query_id
stringlengths
32
32
query
stringlengths
7
4.32k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
b15401941368d1a0168c42d845ddce39
SetWriteDeadline sets the write deadline for this bucket.
[ { "docid": "356821be492d93f4f0cf2a348972de05", "score": "0.87587273", "text": "func (b *Bucket) SetWriteDeadline(t time.Time) error {\n\tb.writeDeadline = t\n\treturn nil\n}", "title": "" } ]
[ { "docid": "e06d35f12f325c77dd91a28b5420f8c0", "score": "0.79935724", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\tc.writeDeadline = t\n\treturn nil\n}", "title": "" }, { "docid": "1646eecbe2449897c93de7797b0f7b4e", "score": "0.7894854", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\treturn c.qs.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "923308ede1e30bb2b09a7784fc8b6b9a", "score": "0.7887935", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "8fc8eb2e61dbda048c485528019691af", "score": "0.7857451", "text": "func (s *Stream) SetWriteDeadline(t time.Time) error {\n\ts.writeDeadline.Store(t)\n\treturn nil\n}", "title": "" }, { "docid": "96cb33a3816235494e0c7e752653061f", "score": "0.78559303", "text": "func (c *ChConn) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "861ef5ea99db04f36ed14ed98dcc081f", "score": "0.7841741", "text": "func (c *Connection) SetWriteDeadline(t time.Time) error {\n\tif c == nil || c.State() != StateActive {\n\t\treturn ErrClosedConnection\n\t}\n\tc.wd = t\n\treturn nil\n}", "title": "" }, { "docid": "7e0eb1f8f68d255745af788b0e764255", "score": "0.77927905", "text": "func (this *Connection) SetWriteDeadline(t time.Time) error {\n\tif this == nil || this.State() != StateActive {\n\t\treturn ErrClosedConnection\n\t}\n\tthis.wd = t\n\treturn nil\n}", "title": "" }, { "docid": "a509fc298299f8d60da768fba0296082", "score": "0.77570504", "text": "func (c *connLinux) SetWriteDeadline(t time.Time) error {\n\treturn c.opError(opSet, c.fd.SetDeadline(t, writeDeadline))\n}", "title": "" }, { "docid": "cd89e1934555a5590f591360c40d0723", "score": "0.7737293", "text": "func (c *ChannelPacketConn) SetWriteDeadline(t time.Time) error {\n\tc.deadlineMtx.Lock()\n\tdefer c.deadlineMtx.Unlock()\n\n\tc.writeDeadline = t\n\treturn nil\n}", "title": "" }, { "docid": "e4e99001a9cbb41722b569cc28af98c9", "score": "0.771131", "text": "func (c *Conn) SetWriteDeadline(t time.Time) {\n\tt = timeToMonotonic(t)\n\tc.mu.Lock()\n\tc.setWriteDeadline(t)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "136d34b0b3b2ebeec870b3ecd8c08fd6", "score": "0.7711026", "text": "func (c *unixConn) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "d70f680b4eee40c02003a42db1490d0b", "score": "0.77028364", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error { return c.fd.SetWriteDeadline(t) }", "title": "" }, { "docid": "7584e77df4e69e76c57758672e310575", "score": "0.76944196", "text": "func (tbc *testBufConn) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "dad4d663965b98f5b2d59971597ba8fd", "score": "0.7694235", "text": "func (e *dtlsendpoint) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "0fb34bbdd15ff32f657202b8d6274883", "score": "0.76767385", "text": "func (conn *Conn) SetWriteDeadline(t time.Time) error {\n\treturn conn.ws.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "a1a20db5f62d3315d1515a7ceb119ea3", "score": "0.76733863", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\treturn c.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "a1a20db5f62d3315d1515a7ceb119ea3", "score": "0.76733863", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\treturn c.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "5d502666636225c57ae49538f3e75ddc", "score": "0.7660365", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\tif c.err != nil {\n\t\treturn c.err\n\t}\n\n\treturn c.Conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "1921fc7e979d1136a5357c1930086996", "score": "0.76579136", "text": "func (conn *TCPConn) SetWriteDeadline(t time.Time) error { return errOpNotImplemented }", "title": "" }, { "docid": "e84ce228b94d709a27ca27471fd5b235", "score": "0.75651973", "text": "func (b *buffConn) SetWriteDeadline(t time.Time) error {\n\treturn b.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "859d4b8bc8a2b30f0ac171595786790d", "score": "0.75642884", "text": "func (d *dummyConn) SetWriteDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "c5a5bbc3e3b685675f8cd8b7b30e6c1f", "score": "0.7561893", "text": "func (s *Stream) SetWriteDeadline(t time.Time) error {\n\ts.cond.L.Lock()\n\tdefer s.cond.L.Unlock()\n\ts.wd = t\n\treturn nil\n}", "title": "" }, { "docid": "cfd5df32a4ca6329b1724ff19bef1b91", "score": "0.752397", "text": "func (c *rpcIngressClient) SetWriteDeadline(id uint16, t time.Time) error {\n\treq := DeadlineReq{\n\t\tConnID: id,\n\t\tDeadline: t,\n\t}\n\n\treturn c.rpc.Call(c.formatMethod(\"SetWriteDeadline\"), &req, nil)\n}", "title": "" }, { "docid": "205b21bb3636e74a3b5bc88383e0f6e2", "score": "0.7510693", "text": "func (c *safeWebsocketConn) SetWriteDeadline(t time.Time) error {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\treturn c.ws.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "e187bf4e5b9a79cd03835c562d50a004", "score": "0.74825406", "text": "func (sk *Socket) SetWriteDeadline(t time.Time) error {\n\treturn sk.plain.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "f41c93a24294d0cdf4244c4583de5df2", "score": "0.74426734", "text": "func (c *LNDConn) SetWriteDeadline(t time.Time) error {\n\treturn c.Conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "99f842fcc84b8ad303a201a7f370587f", "score": "0.7442144", "text": "func (c *websocketTransport) SetWriteDeadline(t time.Time) error {\n\treturn c.socket.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "c3176e4b92fb4db46989c02ba23d8f3e", "score": "0.74060845", "text": "func (tc TeeConn) SetWriteDeadline(t time.Time) error {\n\treturn tc.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "aae7d2e8e50187c2b09e90ebf5b625f4", "score": "0.7396128", "text": "func (cc *ClientCommander) SetWriteDeadline(timeout time.Duration) {\n\tcc.networkSession.SetWriteDeadline(timeout)\n}", "title": "" }, { "docid": "42c406f2a017abb0b8bbfd8aa7c96af0", "score": "0.7369975", "text": "func (conn TeeConn) SetWriteDeadline(t time.Time) error { return nil }", "title": "" }, { "docid": "23ddc388d07d37086450be084735619d", "score": "0.7328626", "text": "func (c *throttledConn) SetWriteDeadline(t time.Time) error {\n\treturn c.originalConn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "2987e1c458cf3203ddbf6937c50220fa", "score": "0.7325205", "text": "func (p *packetConn) SetWriteDeadline(t time.Time) error {\n\treturn p.c.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "26d8ee5e78943ad93a59dba023e29b05", "score": "0.7278437", "text": "func (c *SCTPConn) SetWriteDeadline(_ time.Time) error {\n\treturn syscall.EOPNOTSUPP\n}", "title": "" }, { "docid": "ca13df29cdb66d01794ed98b88a0859d", "score": "0.72698927", "text": "func (dc *dummyConn) SetWriteDeadline(time.Time) error { return nil }", "title": "" }, { "docid": "b1f7f9fbf92585cabead68a907791ad4", "score": "0.7254069", "text": "func (s *Datagram) SetWriteDeadline(t time.Time) error {\n\ts.wrMu.Lock()\n\ts.wrDl.setDeadline(t)\n\ts.wrMu.Unlock()\n\treturn nil\n}", "title": "" }, { "docid": "cc232d3f053d1c4316bb7a7a11a9addf", "score": "0.71716887", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\tconn, err := c.accept()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "8c630515da96557a90aae89821080a5f", "score": "0.7168145", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\tif err := c.pipe.SetWriteDeadline(t); err != nil {\n\t\tif e, ok := err.(*net.OpError); ok {\n\t\t\te.Addr = c.laddr\n\t\t\te.Source = c.laddr\n\t\t\treturn e\n\t\t}\n\t\treturn &net.OpError{\n\t\t\tOp: \"setWriteDeadline\",\n\t\t\tAddr: c.laddr,\n\t\t\tSource: c.laddr,\n\t\t\tNet: c.laddr.Network(),\n\t\t\tErr: err,\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6598d5b691ac6b97a730349141dc371b", "score": "0.71313953", "text": "func (p *packetConnWrapper) SetWriteDeadline(t time.Time) error {\n\treturn p.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "6f9dd91c8e7dd1e12255789a5afd23b0", "score": "0.7103158", "text": "func (pppoe *PPPoE) SetWriteDeadline(t time.Time) error {\n\treturn pppoe.conn.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "b512adbd73f23c6f2d2b0b2fab5177f9", "score": "0.709577", "text": "func (c *Conn) SetWriteDeadline(t time.Time) error {\n\tif err := c.Conn.SetWriteDeadline(t); err != nil {\n\t\tif e, ok := err.(*net.OpError); ok {\n\t\t\te.Addr = c.localAddr\n\t\t\te.Source = c.localAddr\n\t\t\treturn e\n\t\t}\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1155a92c0b8e629e0116d4688ff8aaf1", "score": "0.7052103", "text": "func (c *disconnectedPacketConn) SetWriteDeadline(time.Time) error { //nolint:unused\n\treturn nil\n}", "title": "" }, { "docid": "f6df883043c11573d969be00b1988347", "score": "0.67249894", "text": "func (c *client) SetWriteTimeout(t time.Duration) error {\n\tif t != 0 {\n\t\treturn c.rwc.SetWriteDeadline(time.Now().Add(t))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7312e6e524b3909f454004075b71a267", "score": "0.67164433", "text": "func (c *FCGIClient) SetWriteTimeout(t time.Duration) error {\n\tif conn, ok := c.rwc.(net.Conn); ok && t != 0 {\n\t\treturn conn.SetWriteDeadline(time.Now().Add(t))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8d0518bb8c3575d08f3e41d2280bcdad", "score": "0.6702811", "text": "func (mr *MockWebsocketConnMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetWriteDeadline\", reflect.TypeOf((*MockWebsocketConn)(nil).SetWriteDeadline), arg0)\n}", "title": "" }, { "docid": "01ff1434f66cfca547abf49078946622", "score": "0.64503086", "text": "func (i *eicedConn) SetDeadline(t time.Time) error {\n\ti.SetReadDeadline(t)\n\ti.SetWriteDeadline(t)\n\treturn nil\n}", "title": "" }, { "docid": "75bc3f37648c4fbefc98b4c7c5be52d6", "score": "0.6363051", "text": "func (m *MockWebsocketConn) SetWriteDeadline(arg0 time.Time) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetWriteDeadline\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "f40b2b9dc02791b01581449d559ace8a", "score": "0.6355306", "text": "func (c *Connection) SetDeadline(t time.Time) error {\n\tif err := c.SetReadDeadline(t); err != nil {\n\t\treturn err\n\t}\n\treturn c.SetWriteDeadline(t)\n}", "title": "" }, { "docid": "7a6365e7f4fbdd6afa66b1597496846c", "score": "0.63370544", "text": "func (c *Client) SetWriteTimeout(dur time.Duration) {\n\tc.writeTimeout = dur\n}", "title": "" }, { "docid": "fb5d253896bc8c15379da4a79f2260b0", "score": "0.6288366", "text": "func (mr *MockStreamMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SetWriteDeadline\", reflect.TypeOf((*MockStream)(nil).SetWriteDeadline), arg0)\n}", "title": "" }, { "docid": "37203b94130003ae8214d649df53b223", "score": "0.6261442", "text": "func (c *Conn) SetDeadline(t time.Time) {\n\tt = timeToMonotonic(t)\n\tc.mu.Lock()\n\tc.setReadDeadline(t)\n\tc.setWriteDeadline(t)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "cf700dc69b71197f795b3782f83e195b", "score": "0.62119603", "text": "func (_m *MockConn) SetWriteDeadline(_param0 time.Time) error {\r\n\tret := _m.ctrl.Call(_m, \"SetWriteDeadline\", _param0)\r\n\tret0, _ := ret[0].(error)\r\n\treturn ret0\r\n}", "title": "" }, { "docid": "5f2bd5efd6d2777cf025c55c2e555bc2", "score": "0.6177699", "text": "func (_mr *MockConnMockRecorder) SetWriteDeadline(arg0 interface{}) *gomock.Call {\r\n\treturn _mr.mock.ctrl.RecordCallWithMethodType(_mr.mock, \"SetWriteDeadline\", reflect.TypeOf((*MockConn)(nil).SetWriteDeadline), arg0)\r\n}", "title": "" }, { "docid": "39436387c2728035c7ffb6dca8b72b06", "score": "0.615798", "text": "func (c *ChConn) SetDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "1ffa1f30fa2d0a4f7421484c030f8946", "score": "0.6132248", "text": "func (c *Conn) SetDeadline(t time.Time) error {\n\treturn c.qs.SetDeadline(t)\n}", "title": "" }, { "docid": "9f4ed58c7e97d6d56ef1cdfd8fcc0a0a", "score": "0.6079383", "text": "func (this *Connection) SetDeadline(t time.Time) error {\n\tif err := this.SetReadDeadline(t); err != nil {\n\t\treturn err\n\t}\n\tif err := this.SetWriteDeadline(t); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "889120965e3f4cd77e014bb64e68f1d7", "score": "0.60727", "text": "func (conn *TCPConn) SetDeadline(t time.Time) error { return errOpNotImplemented }", "title": "" }, { "docid": "9b902064c47d511f41dd6b1b5d72846c", "score": "0.605585", "text": "func (c *Conn) SetDeadline(t time.Time) error { return c.fd.SetDeadline(t) }", "title": "" }, { "docid": "1386ab039b9938b74e1edd8653ba5ec6", "score": "0.5987157", "text": "func (c *Conn) SetDeadline(t time.Time) error {\n\treturn c.conn.SetDeadline(t)\n}", "title": "" }, { "docid": "dcc37242da91b885fd40bd81f284ef0a", "score": "0.5987115", "text": "func (c *connLinux) SetDeadline(t time.Time) error {\n\treturn c.opError(opSet, c.fd.SetDeadline(t, deadline))\n}", "title": "" }, { "docid": "9c1b642ec4dc7146e34094a34c0911a8", "score": "0.59832436", "text": "func (s *Stream) SetDeadline(t time.Time) error {\n\ts.SetReadDeadline(t)\n\ts.SetWriteDeadline(t)\n\treturn nil\n}", "title": "" }, { "docid": "66b8ca81414ddc4752505515dcd861ae", "score": "0.5962719", "text": "func (d *dummyConn) SetDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "7630bdd4c463dacdb1a8866e187b07bb", "score": "0.59411746", "text": "func (c *Conn) SetDeadline(t time.Time) error {\n\tif c.err != nil {\n\t\treturn c.err\n\t}\n\n\treturn c.Conn.SetDeadline(t)\n}", "title": "" }, { "docid": "b8a304f8e4c12d75b6500ec195a611ad", "score": "0.5933489", "text": "func (c *websocketTransport) SetDeadline(t time.Time) (err error) {\n\tif err = c.socket.SetReadDeadline(t); err == nil {\n\t\terr = c.socket.SetWriteDeadline(t)\n\t}\n\treturn\n}", "title": "" }, { "docid": "2884cdce58ea750a278a9b7ee07930fb", "score": "0.5930699", "text": "func (c *throttledConn) SetDeadline(t time.Time) error {\n\treturn c.originalConn.SetDeadline(t)\n}", "title": "" }, { "docid": "d934e505393e46949e0d29be45f63b75", "score": "0.59244627", "text": "func (c *Conn) SetDeadline(t time.Time) error {\n\tc.nextDeadline = t\n\treturn c.Conn.SetDeadline(t)\n}", "title": "" }, { "docid": "ce1f2e09960543fb16049d6ee71b34d8", "score": "0.5845777", "text": "func (s *Server) SetWriteTimeout(v string) {\n\tif timeout, err := time.ParseDuration(v); err != nil {\n\t\tpanic(fmt.Sprintf(\"Server: SetWriteTimeout failed, val:%s, err:%s\", v, err.Error()))\n\t} else {\n\t\ts.writeTimeout = timeout\n\t}\n}", "title": "" }, { "docid": "4af058a1d1dd695fdf3f1d22b6f49da1", "score": "0.58396286", "text": "func SetWriteTimeout(t time.Duration) {\n\tclient.WriteTimeout = t\n}", "title": "" }, { "docid": "04cf0742e8cde0f6abf7e73348e230b2", "score": "0.58149886", "text": "func (m *MockStream) SetWriteDeadline(arg0 time.Time) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetWriteDeadline\", arg0)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "08d8d2040dfe01fbca5922cd6bcebb3a", "score": "0.5774128", "text": "func (s *Datagram) SetDeadline(t time.Time) error {\n\ts.SetWriteDeadline(t)\n\ts.SetReadDeadline(t)\n\treturn nil\n}", "title": "" }, { "docid": "93ba670dad5cffd56fc20d6efb356ae2", "score": "0.5734709", "text": "func (cc *ClientCommander) WriteDeadline() time.Duration {\n\treturn cc.networkSession.WriteDeadline()\n}", "title": "" }, { "docid": "e6855b1bd07720129badec525d9266dd", "score": "0.57314247", "text": "func (this *User) SetWriteTimeoutInSecs(n int) error {\n\tif c := this.GetConn(); c != nil {\n\t\treturn c.SetWriteDeadline(time.Now().Add(time.Duration(n) * time.Second))\n\t}\n\treturn ErrNilConn\n}", "title": "" }, { "docid": "9c0c5ff36a45b20105eb7f97a5326989", "score": "0.5723604", "text": "func (s *Stream) SetDeadline(t time.Time) error {\n\tif err := s.SetReadDeadline(t); err != nil {\n\t\treturn err\n\t}\n\tif err := s.SetWriteDeadline(t); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "55958a740dbd5fbccc1e670a423c0073", "score": "0.57181364", "text": "func (c *LNDConn) SetDeadline(t time.Time) error {\n\treturn c.Conn.SetDeadline(t)\n}", "title": "" }, { "docid": "c05178e4522c5441170b2b14312fc496", "score": "0.570759", "text": "func (p *packetConn) SetDeadline(t time.Time) error {\n\treturn p.c.SetDeadline(t)\n}", "title": "" }, { "docid": "1f7bb52449b41d06b42b4fd6bbc8c840", "score": "0.56834614", "text": "func (conn TeeConn) SetDeadline(t time.Time) error { return nil }", "title": "" }, { "docid": "19cb58e7547bf50189dfd3ccd7ede857", "score": "0.5659387", "text": "func (e *dtlsendpoint) SetDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "494e2f20b729ad27a1a8a8e6aa9be647", "score": "0.5658716", "text": "func (tc TeeConn) SetDeadline(t time.Time) error {\n\treturn tc.conn.SetDeadline(t)\n}", "title": "" }, { "docid": "b4c05a629f9122947422625b964e061e", "score": "0.56110233", "text": "func (c *Client) SetWriteTimeout(d time.Duration) error {\n\tif c == nil {\n\t\treturn ErrNoClient\n\t}\n\treturn c.sender.transport.SetWriteTimeout(d)\n}", "title": "" }, { "docid": "232bb30d5774debb1eb5b36d8d236db0", "score": "0.56080294", "text": "func (c *SCTPConn) SetDeadline(_ time.Time) error {\n\treturn syscall.EOPNOTSUPP\n}", "title": "" }, { "docid": "2dd8981a39ce3b6ed9f057182b5130ad", "score": "0.5602562", "text": "func (p *packetConnWrapper) SetDeadline(t time.Time) error {\n\treturn p.conn.SetDeadline(t)\n}", "title": "" }, { "docid": "84b27bb7647ca9f6f62a3dd42599cb21", "score": "0.5547372", "text": "func (pppoe *PPPoE) SetDeadline(t time.Time) error {\n\tpppoe.SetReadDeadline(t)\n\tpppoe.SetWriteDeadline(t)\n\treturn nil\n}", "title": "" }, { "docid": "4c56eccf6069c3418279d7f4e05196a0", "score": "0.5545017", "text": "func (sk *Socket) SetDeadline(t time.Time) error {\n\treturn sk.plain.SetDeadline(t)\n}", "title": "" }, { "docid": "f296ce9cd71fff69b529d67eb44332f5", "score": "0.55197525", "text": "func (b *Bucket) SetReadDeadline(t time.Time) error {\n\tb.readDeadline = t\n\treturn nil\n}", "title": "" }, { "docid": "6d58c3af970bc9884911764fc888d686", "score": "0.5502289", "text": "func (c *rpcIngressClient) SetDeadline(id uint16, t time.Time) error {\n\treq := DeadlineReq{\n\t\tConnID: id,\n\t\tDeadline: t,\n\t}\n\n\treturn c.rpc.Call(c.formatMethod(\"SetDeadline\"), &req, nil)\n}", "title": "" }, { "docid": "52c79694d055611777de2dc58ea3526a", "score": "0.53348243", "text": "func (tbc *testBufConn) SetReadDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" }, { "docid": "c480bfb74cbf2e3e809c8028f9019490", "score": "0.53180146", "text": "func (c *disconnectedPacketConn) SetDeadline(time.Time) error { //nolint:unused\n\treturn nil\n}", "title": "" }, { "docid": "b8c0888147b03fe365925cab53975351", "score": "0.5314512", "text": "func (a *TCPAllocation) SetDeadline(t time.Time) error {\n\tvar d time.Duration\n\tif t == noDeadline() {\n\t\td = time.Duration(math.MaxInt64)\n\t} else {\n\t\td = time.Until(t)\n\t}\n\ta.acceptTimer.Reset(d)\n\treturn nil\n}", "title": "" }, { "docid": "96c55b9c10d724e2b237a5e0c9ea8d27", "score": "0.53094786", "text": "func (l *UnixListener) SetDeadline(t time.Time) error {\n\treturn syscall.EPLAN9\n}", "title": "" }, { "docid": "8431c03d6b1343768ae4d7d1af52250e", "score": "0.52929795", "text": "func (l *TCPListener) SetDeadline(t time.Time) error {\n\tif l == nil || l.fd == nil || l.fd.ctl == nil {\n\t\treturn syscall.EINVAL\n\t}\n\treturn l.fd.setDeadline(t)\n}", "title": "" }, { "docid": "f82a9acae81864629327cd8e2201662b", "score": "0.52491426", "text": "func (c *Conn) SetReadDeadline(t time.Time) error { return c.fd.SetReadDeadline(t) }", "title": "" }, { "docid": "1566a8f310c86fd85d700104434d89be", "score": "0.52160656", "text": "func (pd *pollDesc) WaitWrite(deadline time.Time) (err error) {\n\t// if writable, check hup by select\n\tif pd.writable {\n\t\tselect {\n\t\tcase err = <-pd.writeTicker:\n\t\t\treturn err\n\t\tdefault:\n\t\t\treturn nil\n\t\t}\n\t}\n\t// calling first time\n\tif deadline.IsZero() {\n\t\treturn Exception(ErrDialNoDeadline, \"\")\n\t}\n\tdur := time.Until(deadline)\n\tif dur <= 0 {\n\t\treturn Exception(ErrDialTimeout, dur.String())\n\t}\n\t// add ET|Write|Hup\n\tpd.operator.poll = pollmanager.Pick()\n\terr = pd.operator.Control(PollWritable)\n\tif err != nil {\n\t\tpd.operator.Control(PollDetach)\n\t\treturn err\n\t}\n\t// add timeout trigger\n\tcancel := time.AfterFunc(dur, func() {\n\t\tselect {\n\t\tcase pd.writeTicker <- Exception(ErrDialTimeout, dur.String()):\n\t\tdefault:\n\t\t}\n\t})\n\t// wait\n\tif err = <-pd.writeTicker; err == nil {\n\t\tpd.writable = true\n\t} else {\n\t\tif errors.Is(err, ErrDialTimeout) {\n\t\t\tpd.operator.Control(PollDetach)\n\t\t}\n\t}\n\tcancel.Stop()\n\treturn err\n}", "title": "" }, { "docid": "29ba28d0f19107d7cdd0a63f5e77ba8b", "score": "0.520196", "text": "func (conn *TCPConn) SetReadDeadline(t time.Time) error { return errOpNotImplemented }", "title": "" }, { "docid": "0ee764174e883f6f9f31d1d139b92e31", "score": "0.51664704", "text": "func (c *Conn) SetDeadline(t time.Time) error {\n\tconn, err := c.accept()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn conn.SetDeadline(t)\n}", "title": "" }, { "docid": "184d39379dd89d1e77fc32e43c16a433", "score": "0.51652217", "text": "func (c *Connection) SetReadDeadline(t time.Time) error {\n\tif c == nil || c.State() != StateActive {\n\t\treturn ErrClosedConnection\n\t}\n\tc.rd = t\n\treturn nil\n}", "title": "" }, { "docid": "667f3b64b3fa950dcf6a3013a4e05116", "score": "0.516223", "text": "func (this *Connection) SetReadDeadline(t time.Time) error {\n\tif this == nil || this.State() != StateActive {\n\t\treturn ErrClosedConnection\n\t}\n\tthis.rd = t\n\treturn nil\n}", "title": "" }, { "docid": "e296ff86eb680c07bfbfea5ff94d5bf9", "score": "0.51414293", "text": "func (c *connLinux) SetReadDeadline(t time.Time) error {\n\treturn c.opError(opSet, c.fd.SetDeadline(t, readDeadline))\n}", "title": "" }, { "docid": "64592f6a40f57f2922e5b63b0eba522e", "score": "0.51209396", "text": "func (i *Trace) SetWriteDeadLine() error {\n\ttv := syscall.NsecToTimeval(1e6 * DefaultTXTimeout)\n\treturn syscall.SetsockoptTimeval(i.fd, syscall.SOL_SOCKET, syscall.SO_SNDTIMEO, &tv)\n}", "title": "" }, { "docid": "48ab84349fb7e88cb6e9b006e5f5852a", "score": "0.50947326", "text": "func (c *SCTPConn) SetReadDeadline(_ time.Time) error {\n\treturn syscall.EOPNOTSUPP\n}", "title": "" }, { "docid": "1ab059ff24fc8593269262cb531da172", "score": "0.50855833", "text": "func (l *SRTListener) SetDeadline(t time.Time) error {\n\tif !l.ok() {\n\t\treturn srtapi.EINVPARAM\n\t}\n\tif err := l.fd.pfd.SetDeadline(t); err != nil {\n\t\treturn &OpError{Op: \"set\", Net: l.fd.net, Source: nil, Addr: l.fd.laddr, Err: err}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e6630685ea2e4b1b4de591881a7a7d8e", "score": "0.5061183", "text": "func (d *dummyConn) SetReadDeadline(t time.Time) error {\n\treturn nil\n}", "title": "" } ]
ab07ee9f9ed55a6c673f96002109a439
newPvTable returns a new pvTable
[ { "docid": "889854674bc6618cead30ef8ba7231b2", "score": "0.89644957", "text": "func newPvTable() pvTable {\n\treturn pvTable(make([]pvEntry, pvTableSize))\n}", "title": "" } ]
[ { "docid": "cb0152f16ff49219a073ead82897cbc5", "score": "0.6629724", "text": "func (d *Dict) newTable(name string) *Table {\n\td.byId = append(d.byId, Table{name: name})\n\tt := &d.byId[len(d.byId)-1]\n\td.byName[name] = t\n\treturn t\n}", "title": "" }, { "docid": "45caa5ff76695fe2f1cd256a8d08c0dc", "score": "0.6620586", "text": "func newPageTable(height int64, parent *pageTable, pm *PageManager) (*pageTable, error) {\n\t// Allocate a page for the table\n\tpp, err := pm.allocatePage()\n\tif err != nil {\n\t\treturn nil, build.ExtendErr(\"failed to allocate page for new pageTable\", err)\n\t}\n\n\t// Create and return the table\n\tpt := pageTable{\n\t\tparent: parent,\n\t\theight: height,\n\t\tpp: pp,\n\t\tchildPages: make(map[uint64]*physicalPage),\n\t\tchildTables: make(map[uint64]*pageTable),\n\t}\n\treturn &pt, nil\n}", "title": "" }, { "docid": "9881dfdffc294aa4366d854532ba148e", "score": "0.64649975", "text": "func NewTable(p *TableParams) *Table {\n\tt := new(Table)\n\n\tcp := p.toLibui()\n\tt.t = C.uiNewTable(cp)\n\tC.pkguiFreeTableParams(cp)\n\n\tt.ControlBase = NewControlBase(t, uintptr(unsafe.Pointer(t.t)))\n\treturn t\n}", "title": "" }, { "docid": "38ad02491bfa183eeea29671b399254b", "score": "0.6452859", "text": "func NewTable(name string) *Table {\n\tfmt.Println(\"-- New table:\" + name)\n\tt := new(Table)\n\tt.name = name\n\tt.varNameToRow = make(map[string]int)\n\treturn t\n}", "title": "" }, { "docid": "68a7db8eb3fe5a68e0e8703457d1130e", "score": "0.627188", "text": "func (l *State) NewTable() { l.CreateTable(0, 0) }", "title": "" }, { "docid": "4ec08594722d15acda4ab1ac9a41fb15", "score": "0.62235266", "text": "func NewTable(name string) *Table {\n\treturn &Table{\n\t\tName: name,\n\t\tColumns: make([]TableColumn, 0, 16),\n\t\tIndexes: make([]*Index, 0, 8),\n\t}\n}", "title": "" }, { "docid": "8fefb1d791a267b3b2c149f37b46fb61", "score": "0.6199436", "text": "func newTable(numberOfPlayers int) *table {\n\tnewDeck := newDeck()\n\tplayers := make([]*player, 0)\n\thandCounterPreFlop := make(map[string]int)\n\thandCounterPostFlop := make(map[string]int)\n\thandCounterAfterTurn := make(map[string]int)\n\thandCounterAfterRiver := make(map[string]int)\n\n\tfor i := 1; i <= numberOfPlayers; i++ {\n\t\tplayers = append(players, &player{})\n\t}\n\n\tfor _, hand := range hands {\n\t\thandCounterPreFlop[hand] = 0\n\t\thandCounterPostFlop[hand] = 0\n\t\thandCounterAfterTurn[hand] = 0\n\t\thandCounterAfterRiver[hand] = 0\n\t}\n\n\tnewTable := table{\n\t\tdeck: newDeck,\n\t\tplayers: players,\n\t\thandCounterPreFlop: handCounterPreFlop,\n\t\thandCounterPostFlop: handCounterPostFlop,\n\t\thandCounterAfterTurn: handCounterAfterTurn,\n\t\thandCounterAfterRiver: handCounterAfterRiver,\n\t}\n\n\treturn &newTable\n}", "title": "" }, { "docid": "f5c6af185c5cd87ce88619c3178d269b", "score": "0.6074183", "text": "func NewTable() *Table {\n\tthis := &Table{}\n\tthis.colkey = []string{}\n\tthis.colmap = make(map[string]bool)\n\n\tthis.partorder = make([]string, 0)\n\tthis.fields = make(map[string]*Flag)\n\tthis.parts = make(map[string]string)\n\tthis.paths = make(map[string][]string)\n\n\tthis.format = OUTPUT_ASCII\n\tthis.infoOutput = os.Stderr\n\tthis.dataOutput = os.Stdout\n\n\treturn this\n}", "title": "" }, { "docid": "ba88907713b2ec67bf0c64ce57862087", "score": "0.60466987", "text": "func newTable(db Database, prefix string) Database {\n\treturn &table{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "61d8b19ab787874255b69a466290f58f", "score": "0.60124075", "text": "func NewTable(name, primaryKey, sortKey string) Table {\n\tt := Table{\n\t\tName: name,\n\t\tPrimaryKey: primaryKey,\n\t\tSortKey: sortKey,\n\t}\n\treturn t\n}", "title": "" }, { "docid": "567340304e81805ef653a4aa59e57a55", "score": "0.59680223", "text": "func NewTable(minBet int, deckCount int, runNumber int) *Table {\n\tc.Print(\"\\n\\n======= NEW GAME =======\\n\")\n\tc.Print(\"%d decks in the shoe. \\n\", deckCount)\n\tc.Print(\"%d minimum bet. \\n\", minBet)\n\n\treturn &Table{\n\t\tShoe: cards.NewShoe(deckCount, runNumber),\n\t\tDealer: NewDealer(),\n\t\tPlayers: []player.Player{},\n\t\tminBet: minBet,\n\t\tcount: 0,\n\t\thandCount: 0,\n\t}\n}", "title": "" }, { "docid": "87b23c6187ba975ed98407b1c3469dd1", "score": "0.5850115", "text": "func newTable(tableName string) *table {\n\tonce.Do(func() {\n\t\tsess := session.Must(session.NewSessionWithOptions(session.Options{\n\t\t\tSharedConfigState: session.SharedConfigEnable,\n\t\t}))\n\t\tddbsession = dynamodb.New(sess)\n\t})\n\n\ttable := &table{\n\t\tddb: ddbsession,\n\t\ttableName: aws.String(tableName),\n\t}\n\n\treturn table\n}", "title": "" }, { "docid": "cb8f2f57d1045c590055000853afb143", "score": "0.5823428", "text": "func New() *Table {\n\treturn &Table{m: make(map[interface{}]map[interface{}]interface{})}\n}", "title": "" }, { "docid": "9876235229b6d83a2de024dbeea34d96", "score": "0.58151186", "text": "func NewTable(name string, table *cbt.Table, isCustom bool) *Table {\n\treturn &Table{name: name, table: table, isCustom: isCustom}\n}", "title": "" }, { "docid": "08c35948d8c42a79f35d002bb958c338", "score": "0.5811676", "text": "func NewTable(numRows int) []Struct {\n\trows := make([]Struct, numRows)\n\t//#nosec G404 -- weak random numbers OK\n\tfor i := range rows {\n\t\trows[i].Bool = i%2 > 0\n\t\trows[i].String = fmt.Sprintf(\"String %d\", i)\n\t\trows[i].Bytes = []byte(fmt.Sprintf(\"Bytes %d\", i))\n\t\trows[i].Int = i\n\t\tif i%2 == 0 {\n\t\t\trows[i].IntPtr = &rows[i].Int\n\t\t}\n\t\trows[i].Uint16 = uint16(i)\n\t\trows[i].Float = rand.Float64() * 1000\n\t\trows[i].Currency = []money.Currency{\"\", money.EUR, money.USD}[i%3]\n\t\trows[i].MoneyAmount = money.Amount(rand.Float64() * 100000)\n\t\trows[i].CurrencyAmount = money.CurrencyAmount{\n\t\t\tCurrency: []money.Currency{\"\", money.EUR, money.USD}[i%3],\n\t\t\tAmount: money.Amount(rand.Float64() * 100000),\n\t\t}\n\t\trows[i].Duration = time.Hour*time.Duration(i) + time.Minute*59 + time.Second\n\t\trows[i].Time = time.Date(2012, 12, 12, 12, 12, 12, 0, time.Local)\n\t\tif i%2 == 0 {\n\t\t\trows[i].TimePtr = &rows[i].Time\n\t\t\trows[i].Date = \"2012-12-12\"\n\t\t}\n\t}\n\treturn rows\n}", "title": "" }, { "docid": "487570f5248caa15b199c8f49a34da29", "score": "0.5797097", "text": "func NewTable(t Table) *Table {\n\ttable := new(Table)\n\ttable.Name = t.Name\n\ttable.DefaultSchema = t.DefaultSchema\n\ttable.Database = t.Database\n\ttable.Autocommit = t.Autocommit\n\ttable.Columns = t.Columns\n\ttable.Tx = t.Tx\n\treturn table\n}", "title": "" }, { "docid": "fe3caa71805d0f26d08c08fc3f1858e8", "score": "0.57731885", "text": "func NewTable(dbFileName string) *Table {\n\tpager := NewPager(dbFileName)\n\trowCount := pager.fileReadSize / rowSize\n\t/*fmt.Println(\"TABLE LOAD: read size\", pager.fileReadSize)\n\tfmt.Println(\"TABLE LOAD: row size\", rowSize)\n\tfmt.Println(\"TABLE LOAD: row count\", rowCount)*/\n\ttable := &Table{pager: pager, numRows: int(rowCount)}\n\treturn table\n}", "title": "" }, { "docid": "bd43be7e66a8ec077c995805f7360130", "score": "0.574208", "text": "func (s *ScriptSystem) NewTable() *lua.LTable {\n\treturn s.state.NewTable()\n}", "title": "" }, { "docid": "58772d5a6949b69c65ae03769d7f011c", "score": "0.5729198", "text": "func NewTable() *Table {\n\treturn &Table{\n\t\tBlock: *NewBlock(),\n\t\tFgColor: ColorWhite,\n\t\tBgColor: ColorDefault,\n\t\tSeparator: true,\n\t}\n}", "title": "" }, { "docid": "f8a7e797470cbea48ec3c09a3a901af8", "score": "0.5701182", "text": "func (m *Market) NewTable(cfg cq.Config) cq.Quoter {\n\theaders := []string{\n\t\t\"Pair\",\n\t\t\"Price\",\n\t\t\"Change\",\n\t\t\"Last Size\",\n\t\t\"Bid\",\n\t\t\"Ask\",\n\t\t\"Low\",\n\t\t\"High\",\n\t\t\"Volume\",\n\t}\n\n\tt := &table{\n\t\ttview.NewTable().\n\t\t\tSetBorders(true).\n\t\t\tSetBordersColor(cfg.Theme.BorderColor),\n\t}\n\n\tt.SetBackgroundColor(cfg.Theme.BackgroundColor)\n\n\tfor i, header := range headers {\n\t\tt.SetCell(0, i, tview.NewTableCell(header).\n\t\t\tSetTextColor(cfg.Theme.HeaderTextColor).\n\t\t\tSetAlign(tview.AlignRight))\n\t}\n\n\tfor r := 1; r < len(m.pairs)+1; r++ {\n\t\tfor c := 0; c < len(headers); c++ {\n\t\t\tt.SetCell(r, c, tview.NewTableCell(\"-\").\n\t\t\t\tSetTextColor(cfg.Theme.TextColor).\n\t\t\t\tSetAlign(tview.AlignRight))\n\t\t}\n\t}\n\n\tm.getSnapshot()\n\n\tdata := m.GetQuotes()\n\n\tfor _, quote := range data {\n\t\tmsg := cq.UpdateMsg{\n\t\t\tQuote: quote,\n\t\t\tIsTrade: false,\n\t\t\tFlash: false,\n\t\t}\n\t\tt.InsertQuote(msg, cfg)\n\t}\n\n\treturn t\n}", "title": "" }, { "docid": "7d4926fb9fd888e7617dd6a58720d265", "score": "0.56968075", "text": "func NewKV(db *sqlx.DB, table string) *KV {\n\treturn &KV{db: db, table: table, hashed: true}\n}", "title": "" }, { "docid": "35a0a8a2d824813c5138ea351fbd4112", "score": "0.5616607", "text": "func NewCreateTable(table *Table) *TableDiff {\n\treturn &TableDiff{\n\t\tType: DiffTypeCreate,\n\t\tTo: table,\n\t\tsupported: true,\n\t}\n}", "title": "" }, { "docid": "4a33ba66900e4a852deadcf6b1ed8e46", "score": "0.5612553", "text": "func NewTable(Name string) *Table {\n\ttable := new(Table)\n\ttable.Name = Name\n\treturn table\n}", "title": "" }, { "docid": "5d7b48f6533b30f83e5648ca0c21fe07", "score": "0.5578636", "text": "func NewTable(cols []Column, data []Row) Table {\n\treturn Table{\n\t\tColumns: cols,\n\t\tData: data,\n\t\tSort: []int{},\n\t\tColumnSpacing: defaultColumnSpacing,\n\t}\n}", "title": "" }, { "docid": "dff8c8824701b72769d723a838d847c9", "score": "0.5570284", "text": "func NewTable() Table {\n\tc := &tableImpl{tableViewImpl: newTableViewImpl()}\n\tc.Style().AddClass(\"gwu-Table\")\n\tc.SetCellSpacing(0)\n\tc.SetCellPadding(0)\n\treturn c\n}", "title": "" }, { "docid": "791ab08480552e218f0a7c8218ed7a73", "score": "0.55513334", "text": "func MakeTable(params Params) *Table {\n\ttable := new(Table)\n\ttable.params = params\n\tfor n := 0; n < 256; n++ {\n\t\tcrc := uint16(n) << 8\n\t\tfor i := 0; i < 8; i++ {\n\t\t\tbit := (crc & 0x8000) != 0\n\t\t\tcrc <<= 1\n\t\t\tif bit {\n\t\t\t\tcrc ^= params.Poly\n\t\t\t}\n\t\t}\n\t\ttable.data[n] = crc\n\t}\n\treturn table\n}", "title": "" }, { "docid": "7fe31990b7ea55905c7880e5124ad015", "score": "0.5535186", "text": "func New() *Table {\n\treturn &Table{\n\t\tColSeparator: \" | \",\n\t\tPadding: 0,\n\t\tRightBorder: false,\n\t\tHeaderSeparator: 0,\n\t\tmtx: new(sync.RWMutex),\n\t}\n}", "title": "" }, { "docid": "d9eca7bd53bdaea72e56c3fae9b8bbfe", "score": "0.55151254", "text": "func NewTable() *TableBuilder {\n\treturn &TableBuilder{}\n}", "title": "" }, { "docid": "1716d7273b861775f3274ac13731d384", "score": "0.5514148", "text": "func system_db_newTable(dbObject *bolt.DB, tableName string) error{\n\terr := dbObject.Update(func(tx *bolt.Tx) error {\n\t\t_, err := tx.CreateBucketIfNotExists([]byte(tableName))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}", "title": "" }, { "docid": "3d10cbcb294e8dd9d847650ee8ef199d", "score": "0.55065125", "text": "func NewKVTableTest(address common.Address, backend bind.ContractBackend) (*KVTableTest, error) {\n\tcontract, err := bindKVTableTest(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &KVTableTest{KVTableTestCaller: KVTableTestCaller{contract: contract}, KVTableTestTransactor: KVTableTestTransactor{contract: contract}, KVTableTestFilterer: KVTableTestFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "21f91661774c44515af9b09e3cbe8957", "score": "0.54906416", "text": "func NewTable() *Hashtable {\n\th := new(Hashtable)\n\th.slots = make([]*Slot, 26)\n\tfor i := 0; i < len(h.slots); i++ {\n\t\th.slots[i] = NewSlot()\n\t}\n\treturn h\n}", "title": "" }, { "docid": "84df039dfdfb96246b91d1274516a756", "score": "0.54885966", "text": "func NewTable(tableName string, columnNames []string) *Table {\n\tcapital := snaker.SnakeToCamel(tableName)\n\tcolumns := NewColumns(columnNames)\n\treturn &Table{\n\t\tOriginal: tableName,\n\t\tCapital: capital,\n\t\tColumns: columns,\n\t}\n}", "title": "" }, { "docid": "21e12c4a3e2b05bed479283b6d08eaf5", "score": "0.54659694", "text": "func NewVPTree(points []Point, nTrials int) *VPTree {\n\t// points will be reordered, make a working copy\n\t_points := make([]Point, len(points))\n\tcopy(_points, points)\n\n\ttree := &VPTree{\n\t\trnd: rand.New(rand.NewSource(1234567890)),\n\t\tnTrials: nTrials,\n\t\tdbuf: make([]float32, nTrials),\n\t}\n\ttree.root = tree.build(_points)\n\treturn tree\n}", "title": "" }, { "docid": "3ef1c143c7800901ac5a6da94add519d", "score": "0.54425335", "text": "func NewTable(w io.Writer) *Table {\n\ttable := Table{\n\t\tWriter: w,\n\t}\n\n\treturn &table\n}", "title": "" }, { "docid": "a42b2e6678f85ffe4a4c789d10237e45", "score": "0.54287785", "text": "func newTableCatalog() *tableCatalog {\n\treturn &tableCatalog{tables: make(map[string]*TableDef), SQMtx: sqmutex.NewSQMtx(\"TableCatalog: \")}\n}", "title": "" }, { "docid": "d5e61640ffc14885c0b672e9de2c4801", "score": "0.5405901", "text": "func New(rows, columns int) Bitmaptable {\n\treturn newNTS(rows, columns)\n}", "title": "" }, { "docid": "247426c3c2b3f9e1180519c9250ec307", "score": "0.5379141", "text": "func NewTable(name string, family AddressFamily) *schema.Table {\n\treturn &schema.Table{\n\t\tName: name,\n\t\tFamily: string(family),\n\t}\n}", "title": "" }, { "docid": "08b68bcc0f91deb76d6d96de56546603", "score": "0.53639174", "text": "func NewCreateTable(ctx context.Context, table []byte, columns []string,\n\toptions ...func(Call) error) (*CreateTable, error) {\n\tct := &CreateTable{\n\t\ttableOp: tableOp{base{\n\t\t\ttable: table,\n\t\t\tctx: ctx,\n\t\t}},\n\t\tcolumns: columns,\n\t\tattributes: map[string]string{ // default attributes\n\t\t\t\"BLOOMFILTER\": \"ROW\",\n\t\t\t\"VERSIONS\": \"3\",\n\t\t\t\"IN_MEMORY\": \"false\",\n\t\t\t\"KEEP_DELETED_CELLS\": \"FALSE\",\n\t\t\t\"DATA_BLOCK_ENCODING\": \"FAST_DIFF\",\n\t\t\t\"TTL\": \"2147483647\",\n\t\t\t\"COMPRESSION\": \"NONE\",\n\t\t\t\"MIN_VERSIONS\": \"0\",\n\t\t\t\"BLOCKCACHE\": \"true\",\n\t\t\t\"BLOCKSIZE\": \"65536\",\n\t\t\t\"REPLICATION_SCOPE\": \"0\",\n\t\t},\n\t}\n\terr := applyOptions(ct, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ct, nil\n}", "title": "" }, { "docid": "dc0b8f9f5c3fdbd6970ead3e3fab2a56", "score": "0.53609663", "text": "func NewTable() *Table {\n\tif w, err := termsize.Width(); err == nil {\n\t\treturn &Table{\n\t\t\tmaxWidth: w,\n\t\t\tsepV: \" \",\n\t\t}\n\t}\n\n\treturn &Table{\n\t\tmaxWidth: MaxTableWidth,\n\t\tsepV: \" \",\n\t}\n}", "title": "" }, { "docid": "27693d16ac9d60f4bc7431f89563a8f7", "score": "0.5344564", "text": "func newKVTree() *kvTree {\n\treturn &kvTree{\n\t\ttree: btree.New(64),\n\t}\n}", "title": "" }, { "docid": "b4d4de6c8029cb07f1ef98bd8e259b78", "score": "0.53143317", "text": "func New(name string, cluster Membership, monitor monitor.Monitor, store storage.Storage, cfg *config.Table) *Table {\r\n\tt := &Table{\r\n\t\tname: name,\r\n\t\tstore: store,\r\n\t\thashBy: cfg.HashBy,\r\n\t\tsortBy: cfg.SortBy,\r\n\t\tttl: time.Duration(cfg.TTL) * time.Second,\r\n\t\tcluster: cluster,\r\n\t\tmonitor: monitor,\r\n\t\tloader: loader.New(),\r\n\t}\r\n\r\n\tt.staticSchema = t.loadStaticSchema(cfg.Schema)\r\n\treturn t\r\n}", "title": "" }, { "docid": "e73647c95bf7bbcebc35e0437960d13f", "score": "0.5313132", "text": "func MakeMyTable(params Params) *Table {\n\ttable := new(Table)\n\ttable.params = params\n\ttable.data = [...]uint16{\n\t\t0x0000, 0xC0C1, 0xC181, 0x0140, 0xC301, 0x03C0, 0x0280, 0xC241,\n\t\t0xC601, 0x06C0, 0x0780, 0xC741, 0x0500, 0xC5C1, 0xC481, 0x0440,\n\t\t0xCC01, 0x0CC0, 0x0D80, 0xCD41, 0x0F00, 0xCFC1, 0xCE81, 0x0E40,\n\t\t0x0A00, 0xCAC1, 0xCB81, 0x0B40, 0xC901, 0x09C0, 0x0880, 0xC841,\n\t\t0xD801, 0x18C0, 0x1980, 0xD941, 0x1B00, 0xDBC1, 0xDA81, 0x1A40,\n\t\t0x1E00, 0xDEC1, 0xDF81, 0x1F40, 0xDD01, 0x1DC0, 0x1C80, 0xDC41,\n\t\t0x1400, 0xD4C1, 0xD581, 0x1540, 0xD701, 0x17C0, 0x1680, 0xD641,\n\t\t0xD201, 0x12C0, 0x1380, 0xD341, 0x1100, 0xD1C1, 0xD081, 0x1040,\n\t\t0xF001, 0x30C0, 0x3180, 0xF141, 0x3300, 0xF3C1, 0xF281, 0x3240,\n\t\t0x3600, 0xF6C1, 0xF781, 0x3740, 0xF501, 0x35C0, 0x3480, 0xF441,\n\t\t0x3C00, 0xFCC1, 0xFD81, 0x3D40, 0xFF01, 0x3FC0, 0x3E80, 0xFE41,\n\t\t0xFA01, 0x3AC0, 0x3B80, 0xFB41, 0x3900, 0xF9C1, 0xF881, 0x3840,\n\t\t0x2800, 0xE8C1, 0xE981, 0x2940, 0xEB01, 0x2BC0, 0x2A80, 0xEA41,\n\t\t0xEE01, 0x2EC0, 0x2F80, 0xEF41, 0x2D00, 0xEDC1, 0xEC81, 0x2C40,\n\t\t0xE401, 0x24C0, 0x2580, 0xE541, 0x2700, 0xE7C1, 0xE681, 0x2640,\n\t\t0x2200, 0xE2C1, 0xE381, 0x2340, 0xE101, 0x21C0, 0x2080, 0xE041,\n\t\t0xA001, 0x60C0, 0x6180, 0xA141, 0x6300, 0xA3C1, 0xA281, 0x6240,\n\t\t0x6600, 0xA6C1, 0xA781, 0x6740, 0xA501, 0x65C0, 0x6480, 0xA441,\n\t\t0x6C00, 0xACC1, 0xAD81, 0x6D40, 0xAF01, 0x6FC0, 0x6E80, 0xAE41,\n\t\t0xAA01, 0x6AC0, 0x6B80, 0xAB41, 0x6900, 0xA9C1, 0xA881, 0x6840,\n\t\t0x7800, 0xB8C1, 0xB981, 0x7940, 0xBB01, 0x7BC0, 0x7A80, 0xBA41,\n\t\t0xBE01, 0x7EC0, 0x7F80, 0xBF41, 0x7D00, 0xBDC1, 0xBC81, 0x7C40,\n\t\t0xB401, 0x74C0, 0x7580, 0xB541, 0x7700, 0xB7C1, 0xB681, 0x7640,\n\t\t0x7200, 0xB2C1, 0xB381, 0x7340, 0xB101, 0x71C0, 0x7080, 0xB041,\n\t\t0x5000, 0x90C1, 0x9181, 0x5140, 0x9301, 0x53C0, 0x5280, 0x9241,\n\t\t0x9601, 0x56C0, 0x5780, 0x9741, 0x5500, 0x95C1, 0x9481, 0x5440,\n\t\t0x9C01, 0x5CC0, 0x5D80, 0x9D41, 0x5F00, 0x9FC1, 0x9E81, 0x5E40,\n\t\t0x5A00, 0x9AC1, 0x9B81, 0x5B40, 0x9901, 0x59C0, 0x5880, 0x9841,\n\t\t0x8801, 0x48C0, 0x4980, 0x8941, 0x4B00, 0x8BC1, 0x8A81, 0x4A40,\n\t\t0x4E00, 0x8EC1, 0x8F81, 0x4F40, 0x8D01, 0x4DC0, 0x4C80, 0x8C41,\n\t\t0x4400, 0x84C1, 0x8581, 0x4540, 0x8701, 0x47C0, 0x4680, 0x8641,\n\t\t0x8201, 0x42C0, 0x4380, 0x8341, 0x4100, 0x81C1, 0x8081, 0x4040,\n\t}\n\treturn table\n}", "title": "" }, { "docid": "28c3a7e951d211142666264f94b09950", "score": "0.5304832", "text": "func newBoxPublicSummaryFromTable(table boxPublicSummaryTable) (*boxPublicSummary, error) {\n\tret := boxPublicSummary{\n\t\ttable: table,\n\t}\n\terr := ret.encode()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ret, nil\n}", "title": "" }, { "docid": "a8e67fd7c9fd906bfb41852a42e85b7d", "score": "0.5291197", "text": "func NewTable(c *creator.Creator, fonts map[string]*model.PdfFont, tableData [][]Renderer) *creator.Table {\n\tmaxRowWidth := GetMaxRowWidth(tableData)\n\n\t// Create table.\n\ttable := c.NewTable(maxRowWidth)\n\n\tfor _, column := range tableData {\n\t\tfor _, element := range column {\n\t\t\telement.Render(c, table, fonts)\n\t\t}\n\n\t\trowWidth := getRowWidth(column)\n\n\t\t// if there are cells missing, fill the area with empty ones\n\t\ttable.SkipCells(maxRowWidth - rowWidth)\n\t}\n\n\treturn table\n}", "title": "" }, { "docid": "6016a0c20731339f067f423bb4b5d4a4", "score": "0.5280464", "text": "func NewTable(db Database, prefix string) Database {\n\treturn &table{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "07659b1915d211baf3fa4629cb1b4588", "score": "0.52786636", "text": "func newCountTable(spatialSegment int, indepVars []string) *countTable {\n\tvar t countTable\n\tt.spatialSegment = spatialSegment\n\tt.ageHouseholdTable = mat.Zeroes(7, 7)\n\tt.workHouseholdTable = mat.Zeroes(5, 5)\n\tt.ageWorkHouseholdTable = mat.Zeroes(15, 23)\n\tdims := []int{15, 23}\n\tdims = append(dims, VarLevels(indepVars)...)\n\tt.multiwayTable = mat.Zeroes(dims...)\n\tt.count = 0\n\treturn &t\n}", "title": "" }, { "docid": "56f37a71dd69a1c28b4fbe6d96b84958", "score": "0.5267692", "text": "func newDefaultPriceTable() modules.RPCPriceTable {\n\thes := modules.DefaultHostExternalSettings()\n\toneCurrency := types.NewCurrency64(1)\n\treturn modules.RPCPriceTable{\n\t\tValidity: time.Minute,\n\t\tFundAccountCost: oneCurrency,\n\t\tUpdatePriceTableCost: oneCurrency,\n\n\t\tHasSectorBaseCost: oneCurrency,\n\t\tInitBaseCost: oneCurrency,\n\t\tMemoryTimeCost: oneCurrency,\n\t\tReadBaseCost: oneCurrency,\n\t\tReadLengthCost: oneCurrency,\n\t\tSwapSectorCost: oneCurrency,\n\n\t\tDownloadBandwidthCost: hes.DownloadBandwidthPrice,\n\t\tUploadBandwidthCost: hes.UploadBandwidthPrice,\n\t}\n}", "title": "" }, { "docid": "1f332fef055805b329bbbc354dbd0354", "score": "0.5247707", "text": "func NewTable(name string, template interface{}) (*Table, error) {\n\ttable := &Table{\n\t\tEngine: \"InnoDB\",\n\t\tCharSet: \"utf8mb4\",\n\t\tName: name,\n\t\tKeysAndConstraints: []string{},\n\t}\n\n\tdesc, err := StructToTableDescriptor(template)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\ttable.Descriptor = desc\n\n\treturn table, nil\n}", "title": "" }, { "docid": "da51fc9ff58fd2896e23c5ba20f8d2de", "score": "0.52460045", "text": "func newCreateTableStmt(conn conn, table string) *CreateTableStmt {\n\tstmt := &CreateTableStmt{cmd: &mig.CreateTable{Table: table}}\n\tstmt.conn = conn\n\treturn stmt\n}", "title": "" }, { "docid": "6e6bb9796a003f7765d36cd913a08f95", "score": "0.52413005", "text": "func newTable(ls Lines) *Table {\n\tcrosses := func(hl, vl Line) bool {\n\t\treturn vl.VarMax+1.0 > hl.Fix &&\n\t\t\thl.Fix > vl.VarMin-1.0 &&\n\t\t\thl.VarMax+1.0 > vl.Fix &&\n\t\t\tvl.Fix > hl.VarMin-1.0\n\t} // 数値は調整\n\tt := new(Table)\n\tfor i, hTop := range ls.h {\n\t\tvar vCrossAtTop []Line\n\t\tfor _, vl := range ls.v {\n\t\t\tif crosses(hTop, vl) {\n\t\t\t\tvCrossAtTop = append(vCrossAtTop, vl)\n\t\t\t}\n\t\t}\n\t\tif len(vCrossAtTop) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tvLeft := vCrossAtTop[0]\n\t\tvCrossAtTop = vCrossAtTop[1:]\n\t\tfor _, vRight := range vCrossAtTop {\n\t\t\thBottom := *newLine()\n\t\t\tfor _, hl := range ls.h {\n\t\t\t\tif hTop.Fix > hl.Fix &&\n\t\t\t\t\tcrosses(hl, vLeft) &&\n\t\t\t\t\tcrosses(hl, vRight) {\n\t\t\t\t\thBottom = hl\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif hBottom.Type != \"nil\" {\n\t\t\t\tt.Cell = append(t.Cell, Cell{\n\t\t\t\t\tBoundingBox: BoundingBox{\n\t\t\t\t\t\tPoint{vLeft.Fix, hBottom.Fix},\n\t\t\t\t\t\tPoint{vRight.Fix, hTop.Fix},\n\t\t\t\t\t}})\n\t\t\t\tvLeft = vRight\n\t\t\t}\n\t\t}\n\t\tif i == len(ls.h)-2 {\n\t\t\tbreak\n\t\t}\n\t}\n\tt.Min = Point{ls.h[0].VarMin, ls.v[0].VarMin}\n\tt.Max = Point{ls.h[0].VarMax, ls.v[0].VarMax}\n\treturn t\n}", "title": "" }, { "docid": "3b44d14776a0e9293e0889c172ca03fd", "score": "0.52053726", "text": "func NewTable(db ethdb.Database, prefix string) ethdb.Database {\n\treturn &table{\n\t\tdb: db,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "9e744b30f1d065460e6109d6129bc197", "score": "0.5204439", "text": "func New(title string, options ...Option) (*Table, error) {\n\tpanel := &Table{Builder: sdk.NewTable(title)}\n\tempty := \"\"\n\n\tpanel.Builder.IsNew = false\n\tpanel.Builder.TablePanel.Styles = []sdk.ColumnStyle{\n\t\t{\n\t\t\tAlias: &empty,\n\t\t\tPattern: \"/.*/\",\n\t\t\tType: \"string\",\n\t\t},\n\t}\n\n\tfor _, opt := range append(defaults(), options...) {\n\t\tif err := opt(panel); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn panel, nil\n}", "title": "" }, { "docid": "b7cc3eaf4ddbf67bf93ac892c2bc4f45", "score": "0.51676375", "text": "func NewTableData() *TableData {\n\treturn &TableData{Mutex: &sync.RWMutex{}}\n}", "title": "" }, { "docid": "4a05ee1d7738c6769236915f7e92acbe", "score": "0.51514685", "text": "func NewShowCreateTable(db string, ctl *sql.Catalog, table string) sql.Node {\n\treturn &ShowCreateTable{\n\t\tCurrentDatabase: db,\n\t\tTable: table,\n\t\tCatalog: ctl}\n}", "title": "" }, { "docid": "e02c90941973563a513eed587b1ede27", "score": "0.51167387", "text": "func NewTable(order, root int) *Table {\n\tdistance := make([]int, order)\n\tfor i := range distance {\n\t\tdistance[i] = -1\n\t}\n\treturn &Table{\n\t\tRoot: root,\n\t\tFurthestNode: root,\n\t\tMaxDistance: 0,\n\t\tvisited: make([]bool, order),\n\t\tdistance: distance,\n\t\tparent: make([]int, order),\n\t}\n}", "title": "" }, { "docid": "0b84874ac5ea4b369c46b262f90067f9", "score": "0.5092535", "text": "func NewStdTable(db *sql.DB, name string, keep time.Duration) *StdTable {\n\tcreateTable(db, name)\n\tcreateIndex(db, name)\n\tif keep < 0 {\n\t\tkeep = 24 * time.Hour\n\t}\n\treturn &StdTable{name: name, keep: keep}\n}", "title": "" }, { "docid": "b20d2f1586ed091d0cba3c8798ddc035", "score": "0.5090468", "text": "func NewTable(tableName string) (*DatabaseService, error) {\n\n\tconfig := &aws.Config{\n\t\tRegion: aws.String(region),\n\t\tEndpoint: aws.String(endpoint),\n\t}\n\n\tsess := session.Must(session.NewSession(config))\n\n\tsvc := dynamodb.New(sess)\n\n\tinput := &dynamodb.CreateTableInput{\n\t\tAttributeDefinitions: []*dynamodb.AttributeDefinition{\n\t\t\t{\n\t\t\t\tAttributeName: aws.String(\"Id\"),\n\t\t\t\tAttributeType: aws.String(\"S\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tAttributeName: aws.String(\"name\"),\n\t\t\t\tAttributeType: aws.String(\"S\"),\n\t\t\t},\n\t\t},\n\t\tKeySchema: []*dynamodb.KeySchemaElement{\n\t\t\t{\n\t\t\t\tAttributeName: aws.String(\"Id\"),\n\t\t\t\tKeyType: aws.String(\"HASH\"),\n\t\t\t},\n\t\t\t{\n\t\t\t\tAttributeName: aws.String(\"name\"),\n\t\t\t\tKeyType: aws.String(\"RANGE\"),\n\t\t\t},\n\t\t},\n\t\tProvisionedThroughput: &dynamodb.ProvisionedThroughput{\n\t\t\tReadCapacityUnits: aws.Int64(10),\n\t\t\tWriteCapacityUnits: aws.Int64(10),\n\t\t},\n\t\tTableName: aws.String(tableName),\n\t}\n\n\t_, err := svc.CreateTable(input)\n\tif err != nil {\n\t\tlog.Println(\"Got error calling CreateTable:\")\n\t\tlog.Fatalln(err.Error())\n\t\tos.Exit(1)\n\t}\n\n\treturn &DatabaseService{\n\t\titemTable: svc,\n\t\ttableName: tableName,\n\t}, nil\n}", "title": "" }, { "docid": "295be6a8ca6ec69621ddef2982792a10", "score": "0.5064835", "text": "func NewTable() Table {\n\treturn &termTable{tt: termtable.NewTable(nil, &termtable.TableOptions{\n\t\tPadding: 1,\n\t\tUseSeparator: true,\n\t})}\n}", "title": "" }, { "docid": "1aa73b23c73af9437d236b3de7412e40", "score": "0.5064693", "text": "func (j *PVCTestJig) newPVCTemplate(namespace string, volumeSize string, scName string, adLabel string) *v1.PersistentVolumeClaim {\n\treturn &v1.PersistentVolumeClaim{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tNamespace: namespace,\n\t\t\tGenerateName: j.Name,\n\t\t\tLabels: j.Labels,\n\t\t},\n\t\tSpec: v1.PersistentVolumeClaimSpec{\n\t\t\tAccessModes: []v1.PersistentVolumeAccessMode{\n\t\t\t\tv1.ReadWriteOnce,\n\t\t\t},\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: map[string]string{\n\t\t\t\t\tplugin.LabelZoneFailureDomain: adLabel,\n\t\t\t\t},\n\t\t\t},\n\t\t\tResources: v1.ResourceRequirements{\n\t\t\t\tRequests: v1.ResourceList{\n\t\t\t\t\tv1.ResourceName(v1.ResourceStorage): resource.MustParse(volumeSize),\n\t\t\t\t},\n\t\t\t},\n\t\t\tStorageClassName: &scName,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b2c4a607aebd64a7cfd94b6cfe7399e3", "score": "0.50628805", "text": "func New() *tablesMap {\n\treturn &tablesMap{\n\t\tRWMutex: sync.RWMutex{},\n\t\tdata: make(map[dbutils.OID]tablebackup.TableBackuper),\n\t}\n}", "title": "" }, { "docid": "28416eacae98531b206a767eee0612cf", "score": "0.50502783", "text": "func newFingerTable(nodeStruct *api.Node, m int) fingerTable {\n\tftToBeFilled := make([]*fingerEntry, m)\n\tfor i := range ftToBeFilled {\n\t\tftToBeFilled[i] = newFingerEntry(fingerID(nodeStruct.Id, i, m), nodeStruct)\n\t}\n\n\treturn ftToBeFilled\n}", "title": "" }, { "docid": "c975cff5359dd12a391eae4c47154265", "score": "0.5043806", "text": "func NewTable(ctx *pulumi.Context,\n\tname string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) {\n\tif args == nil || args.DatasetId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'DatasetId'\")\n\t}\n\tif args == nil || args.TableId == nil {\n\t\treturn nil, errors.New(\"missing required argument 'TableId'\")\n\t}\n\tif args == nil {\n\t\targs = &TableArgs{}\n\t}\n\tvar resource Table\n\terr := ctx.RegisterResource(\"gcp:bigquery/table:Table\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9454f5769f8b13d686186944c8026932", "score": "0.50257325", "text": "func NewTableChart(ctx *pulumi.Context,\n\tname string, args *TableChartArgs, opts ...pulumi.ResourceOption) (*TableChart, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.ProgramText == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ProgramText'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource TableChart\n\terr := ctx.RegisterResource(\"signalfx:index/tableChart:TableChart\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "da0016650b41290faa8149f69ba2712c", "score": "0.50128734", "text": "func NewTable(ctx *pulumi.Context,\n\tname string, args *TableArgs, opts ...pulumi.ResourceOption) (*Table, error) {\n\tif args == nil {\n\t\targs = &TableArgs{}\n\t}\n\n\tvar resource Table\n\terr := ctx.RegisterResource(\"aws:dynamodb/table:Table\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "776ec8be0c86f53752303e52987c8de4", "score": "0.49975112", "text": "func TextTagTableNew() (return__ *TextTagTable) {\n\tvar __cgo__return__ interface{}\n\t__cgo__return__ = C.gtk_text_tag_table_new()\n\tif __cgo__return__ != nil {\n\t\treturn__ = NewTextTagTableFromCPointer(unsafe.Pointer(reflect.ValueOf(__cgo__return__).Pointer()))\n\t}\n\treturn\n}", "title": "" }, { "docid": "1f3989dc02318f8dd5d609c89a5ab121", "score": "0.49940622", "text": "func New(cfg *config.Config, dal store.DAL) (*CapTable, error) {\n\treturn &CapTable{\n\t\tDAL: dal,\n\t}, nil\n}", "title": "" }, { "docid": "0269f430613faef59d38048664f0565a", "score": "0.4980984", "text": "func NewAlterTable(from, to *Table) *TableDiff {\n\tclauses, supported := from.Diff(to)\n\tif supported && len(clauses) == 0 {\n\t\treturn nil\n\t}\n\treturn &TableDiff{\n\t\tType: DiffTypeAlter,\n\t\tFrom: from,\n\t\tTo: to,\n\t\talterClauses: clauses,\n\t\tsupported: supported,\n\t}\n}", "title": "" }, { "docid": "db418a09b05f348fee9ddf849d1b0953", "score": "0.495968", "text": "func newTokensTable(attr string) *TokensTable {\n\ttable := &TokensTable{\n\t\tkey: make([]string, 0, 50),\n\t}\n\tpk := x.ParsedKey{Attr: attr}\n\tprefix := pk.IndexPrefix()\n\tit := pstore.NewIterator()\n\tdefer it.Close()\n\tfor it.Seek(prefix); it.ValidForPrefix(prefix); it.Next() {\n\t\tpki := x.Parse(it.Key().Data())\n\t\tx.AssertTrue(pki.IsIndex())\n\t\tx.AssertTrue(len(pki.Term) > 0)\n\t\ttable.push(pki.Term)\n\t}\n\treturn table\n}", "title": "" }, { "docid": "084b10a7032c42b50a987a908907c8e6", "score": "0.49486506", "text": "func (b *Streamer) insertNewTable(projectID, datasetID, tableID string, schema *bigquery.TableSchema) (*bigquery.Table, error) {\n\ttables := bigquery.NewTablesService(b.service)\n\ttable := &bigquery.Table{\n\t\tSchema: schema,\n\t\tTableReference: &bigquery.TableReference{\n\t\t\tProjectId: projectID,\n\t\t\tDatasetId: datasetID,\n\t\t\tTableId: tableID,\n\t\t},\n\t}\n\treturn tables.Insert(projectID, datasetID, table).Do()\n}", "title": "" }, { "docid": "3cb33e8705f6cfce6328b4cc65218938", "score": "0.49430573", "text": "func (db *SqlBlockDB) NewUtoxView() {\n\t// TODO: Consider drop tables if exist\n\n\t// Create utxos table\n\t_, err := db.db.Exec(\n\t\t\"CREATE TABLE IF NOT EXISTS viewpoint (txhash BYTES PRIMARY KEY,\" +\n\t\t\t\"modified BOOL, \" +\n\t\t\t\"version INT, \" +\n\t\t\t\"isCoinBase BOOL, \" +\n\t\t\t\"blockHeight INT)\")\n\tif err != nil {\n\t\treallog.Fatal(err)\n\t}\n\t// Create UtxoEntry table\n\t_, err = db.db.Exec(\n\t\t\"CREATE TABLE IF NOT EXISTS utxooutputs (txhash BYTES,\" +\n\t\t\t\"txOutIdx INT, \" +\n\t\t\t\"spent BOOL, \" +\n\t\t\t\"compressed BOOL, \" +\n\t\t\t\"amount INT, \" +\n\t\t\t\"pkscript BYTES, \" +\n\t\t\t\"PRIMARY KEY (txhash, txOutIdx), \" +\n\t\t\t\"CONSTRAINT fk_txhash FOREIGN KEY (txhash) REFERENCES viewpoint\" +\n\t\t\t\") INTERLEAVE IN PARENT viewpoint (txhash)\")\n\tif err != nil {\n\t\treallog.Fatal(err)\n\t}\n\treallog.Printf(\"Created utxo view\")\n\n}", "title": "" }, { "docid": "443f64714f64212579bf712b52a2c2e0", "score": "0.49389508", "text": "func (m *MySQLHarness) NewTable(db sql.Database, name string, schema sql.PrimaryKeySchema) (sql.Table, error) {\n\tctx := sql.NewEmptyContext()\n\terr := db.(sql.TableCreator).CreateTable(ctx, name, schema, sql.Collation_Default)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttbl, ok, err := db.GetTableInsensitive(ctx, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"successfully created table `%s` but could not retrieve\", name)\n\t}\n\treturn tbl, nil\n}", "title": "" }, { "docid": "1f5c5576033778b2f08b47a77f360c44", "score": "0.49306783", "text": "func (db DBModel) newModel(table string) (Model, error) {\n\tmtype, ok := db.types[table]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"table %s not found in database model\", string(table))\n\t}\n\tmodel := reflect.New(mtype.Elem())\n\treturn model.Interface().(Model), nil\n}", "title": "" }, { "docid": "dd62641b114f374d88c75aaed6b32f81", "score": "0.49279946", "text": "func (this *HashtableSegment) setTable(newTable []unsafe.Pointer) {\n\tthis.threshold = (uint32)(float32(len(newTable)) * this.loadFactor)\n\tthis.pTable = unsafe.Pointer(&newTable)\n}", "title": "" }, { "docid": "23e5dcf58150682fb26a7b2200a20d97", "score": "0.49210718", "text": "func newPDP(pap common.FunctionalEntity, decider decider.Decider, auditor audit.Auditor) *PDP {\n\treturn &PDP{pap: pap, decider: decider, auditor: auditor}\n}", "title": "" }, { "docid": "d67017e4e4f63e0ca94d2de38cc8255b", "score": "0.49195972", "text": "func New(bs []string) (*Table, error) {\n\tm := make(map[string]bool)\n\tfor _, b := range bs {\n\t\tm[b] = true\n\t}\n\tif len(m) != len(bs) {\n\t\treturn nil, fmt.Errorf(\"table.New does not allow duplicated bindings in %s\", bs)\n\t}\n\treturn &Table{\n\t\tAvailableBindings: bs,\n\t\tmbs: m,\n\t}, nil\n}", "title": "" }, { "docid": "9dfb8e9b50ac510437037c6fb79ec565", "score": "0.4910486", "text": "func (d *MockPutDSL) VrfTable(val *vpp_l3.VrfTable) vppclient.PutDSL {\n\tkey := vpp_l3.VrfTableKey(val.Id, val.Protocol)\n\td.parent.Values[key] = val\n\treturn d\n}", "title": "" }, { "docid": "999d8d1b012af68a537d713e84106dc2", "score": "0.4896881", "text": "func newView(kv kv, s snapshot, prefix byte) *view {\n\treturn &view{\n\t\tkv: kv,\n\t\ts: s,\n\t\tprefix: prefix,\n\t}\n}", "title": "" }, { "docid": "ae17c3fc63297db91f105355250f81d7", "score": "0.4887913", "text": "func New(spec Spec) Timetable {\n\ttt := Timetable{\n\t\tID: ulid.New().String(),\n\t\tSpec: spec,\n\t}\n\treturn tt\n}", "title": "" }, { "docid": "3615dc3a353d0ba2399aa77646893688", "score": "0.4877722", "text": "func (this *DBMap) CreateTableMap(v interface{}, tableName string) {\n\tt := reflect.TypeOf(v)\n\tif t.Kind() == reflect.Ptr {\n\t\tt = t.Elem()\n\t}\n\tmeta := this.getTableMapMeta(t)\n\tmeta.tableName = tableName\n\tthis.tableMap[t.String()] = meta\n}", "title": "" }, { "docid": "71416bbd188fa9c95cf24acbeb5cd5be", "score": "0.48692942", "text": "func NewVM() *VM { panic(\"TODO\") }", "title": "" }, { "docid": "ce9c9e51706481f7c73feeb5d4f68f59", "score": "0.48476106", "text": "func New(in io.Reader) optimus.Table {\n\ttable := &table{\n\t\trows: make(chan optimus.Row),\n\t}\n\tgo table.start(in)\n\treturn table\n}", "title": "" }, { "docid": "dfb311586845cde0f245e3a7fb899226", "score": "0.4846795", "text": "func NewTableBundle(getter PolicyGetter, tbInfo *model.TableInfo) (*Bundle, error) {\n\tbundle, err := newBundleFromPolicy(getter, tbInfo.PlacementPolicyRef)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif bundle == nil {\n\t\treturn nil, nil\n\t}\n\tids := []int64{tbInfo.ID}\n\t// build the default partition rules in the table-level bundle.\n\tif tbInfo.Partition != nil {\n\t\tfor _, pDef := range tbInfo.Partition.Definitions {\n\t\t\tids = append(ids, pDef.ID)\n\t\t}\n\t}\n\tbundle.Reset(RuleIndexTable, ids)\n\treturn bundle, nil\n}", "title": "" }, { "docid": "b5d15c2e832d48c2711d878ee31a276a", "score": "0.48421615", "text": "func newPersistentVolumeClaims(c *Client, namespace string) *persistentVolumeClaims {\n\treturn &persistentVolumeClaims{c, namespace}\n}", "title": "" }, { "docid": "abdef128d79aa3ffb612a16648fe1d79", "score": "0.48339057", "text": "func New(dbCfg pgx.ConnConfig, table tablebackup.TableBackuper) *tableBasebackup {\n\treturn &tableBasebackup{\n\t\ttable: table,\n\t\tdbCfg: dbCfg.Merge(pgx.ConnConfig{\n\t\t\tRuntimeParams: map[string]string{\"replication\": \"database\"},\n\t\t\tPreferSimpleProtocol: true}),\n\t\tdir: table.TableDirectory(),\n\t}\n}", "title": "" }, { "docid": "53c3153d4e022bbbe9c27aee262d6e82", "score": "0.4826024", "text": "func newV(major, minor, patch int64) *Version {\n\treturn &Version{\n\t\tmajor: major,\n\t\tminor: minor,\n\t\tpatch: patch,\n\t}\n}", "title": "" }, { "docid": "ec88eef73d501b3ec46870e9e7e79ce3", "score": "0.48217195", "text": "func NewShellTable(sep string) *ShellTable {\n\treturn &ShellTable{separator: &sep}\n}", "title": "" }, { "docid": "8e421d62bedfe3a19404287af5de29f5", "score": "0.47884852", "text": "func newStructPLS(p interface{}) (*structPLS, error) {\n\tv := reflect.ValueOf(p)\n\tif v.Kind() != reflect.Ptr || v.Elem().Kind() != reflect.Struct {\n\t\treturn nil, ErrInvalidEntityType\n\t}\n\tv = v.Elem()\n\tcodec, err := getStructCodec(v.Type())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &structPLS{v, codec}, nil\n}", "title": "" }, { "docid": "99aa144b688da1d3d02549192c6b3eac", "score": "0.4787066", "text": "func newAlterTableStmt(conn conn, table string) *AlterTableStmt {\n\tstmt := &AlterTableStmt{cmd: &mig.AlterTable{Table: table}}\n\tstmt.conn = conn\n\treturn stmt\n}", "title": "" }, { "docid": "cfc250ec4048f42d22c2064257eb60fe", "score": "0.47866097", "text": "func newPKMap() *pkMap {\n\treturn &pkMap{\n\t\tdict: make(map[cipher.PubKey]bool),\n\t}\n}", "title": "" }, { "docid": "0e63a41d63705cef8d6601f7f21e6a39", "score": "0.47704428", "text": "func NewTablePrinter() *TablePrinter {\n\treturn &TablePrinter{}\n}", "title": "" }, { "docid": "808fbb4c7b8e28551ce83be4b44577cb", "score": "0.4760524", "text": "func NewTableColumn(name string) TableColumn {\n\treturn &tablecol{\n\t\tname: name,\n\t}\n}", "title": "" }, { "docid": "363c1775f608451e70194ff1241388d7", "score": "0.4757707", "text": "func NewBtTable(btClient *cbt.Client, tableID string) *cbt.Table {\n\treturn btClient.Open(tableID)\n}", "title": "" }, { "docid": "6fbd5bd2805e7acc0fbd0a90f78883b6", "score": "0.4756354", "text": "func NewSlotTable(transitions []Transition, stateTable StateTable) SlotTable {\n\tslotTable := make(SlotTable, len(transitions))\n\n\tfor n := range transitions {\n\t\ttransition := transitions[n]\n\n\t\tfor _, from := range transition.From {\n\t\t\tcmdStateTuple := CmdStateTuple{\n\t\t\t\tCmd: transition.Command,\n\t\t\t\tState: stateTable[from],\n\t\t\t}\n\n\t\t\tif transition.Slot != (Slot{}) {\n\t\t\t\tslotTable[cmdStateTuple] = transition.Slot\n\t\t\t}\n\t\t}\n\t}\n\n\treturn slotTable\n}", "title": "" }, { "docid": "43b9cfc81af88f622ea5410d6f0c57b9", "score": "0.4743007", "text": "func newTableFormatter(writer io.Writer, tableWidth int, columns []tableColumn) *tableFormatter {\n\treturn &tableFormatter{\n\t\twriter: writer,\n\t\ttableWidth: tableWidth,\n\t\tcolumns: columns,\n\t}\n}", "title": "" }, { "docid": "9deb999a6e71f78c767850e300681d05", "score": "0.47422537", "text": "func newTestStruct() *testStruct {\n\treturn &testStruct{\n\t\tStringKey: \"string-val\",\n\t\tIntKey: 5,\n\t\tFloatKey: 13.37,\n\t}\n}", "title": "" }, { "docid": "df1de0ed3650e36fcf59e1ea79241a14", "score": "0.47308165", "text": "func NewTable(numColumns int, options ...TableOption) *Table {\n\tw, h, err := getTerminalSize()\n\tif err != nil || w == 0 || h == 0 {\n\t\tw = 80\n\t\th = 25\n\t}\n\n\t// Fill with defaults to skip complicated bounds checking on\n\t// changing justify or row styles\n\tdefaultColumns := make([]Col, numColumns)\n\temptyHeaders := make([]Cell, numColumns)\n\tfor i := 0; i < numColumns; i++ {\n\t\tdefaultColumns[i].index = i\n\t\tdefaultColumns[i].style = Styled(Default)\n\t\tdefaultColumns[i].justify = Left\n\t\tdefaultColumns[i].wrap = false\n\t}\n\n\tt := &Table{\n\t\tcolumns: defaultColumns,\n\t\tmaxWidth: w,\n\t\tmaxHeight: h,\n\t\theaders: emptyHeaders,\n\t\tpad: 1,\n\t\ttitle: Title{value: \"\", width: 0, style: Styled(Default)},\n\t\twriter: os.Stdout,\n\t}\n\tfor _, opt := range options {\n\t\topt(t)\n\t}\n\treturn t\n}", "title": "" }, { "docid": "791080728ec62e85616b419ca6019534", "score": "0.4723462", "text": "func NewTableService(logger *zap.Logger, db *DB) *TableService {\n\treturn &TableService{l: logger, db: db}\n}", "title": "" }, { "docid": "b425eb67fa6cf6b02f67b236b0bc236f", "score": "0.4718498", "text": "func (v *productEntryTableType) NewStruct() reform.Struct {\n\treturn new(ProductEntry)\n}", "title": "" }, { "docid": "4e7f6192378f5eb1b1c2ddb1952cf5cd", "score": "0.47125918", "text": "func NewTestPowerTableView(minerPower uint64, totalPower uint64) *TestPowerTableView {\n\treturn &TestPowerTableView{minerPower: minerPower, totalPower: totalPower}\n}", "title": "" }, { "docid": "4e7f6192378f5eb1b1c2ddb1952cf5cd", "score": "0.47125918", "text": "func NewTestPowerTableView(minerPower uint64, totalPower uint64) *TestPowerTableView {\n\treturn &TestPowerTableView{minerPower: minerPower, totalPower: totalPower}\n}", "title": "" } ]
bbb4721e5f68dca02e2a61f47c18cec8
initLogging sets up logger with appropriate logging level
[ { "docid": "5308bf5ea2b9091a54e66b2b2516358c", "score": "0.7815758", "text": "func initLogging(lvl log.Level) {\n\n\tlog.SetFormatter(&log.JSONFormatter{})\n\n\tlog.SetOutput(os.Stdout)\n\n\tlog.SetLevel(lvl)\n\n\tlog.SetReportCaller(true)\n\n}", "title": "" } ]
[ { "docid": "c13731b9ae0d8d66b8707f2f250fd183", "score": "0.7877848", "text": "func (c *Core) initLogger(logLevel log.Level) {\n\tlog.Debugf(\"initializing logger\")\n\tlog.SetOutput(os.Stdout)\n\tlog.SetFormatter(&log.TextFormatter{})\n\tlog.SetLevel(logLevel)\n\tlog.Infof(\"initialized logger to\", log.GetLevel())\n}", "title": "" }, { "docid": "f4e4b339739dbeb247f59b8885a4b63c", "score": "0.7767805", "text": "func initLogger() {\n\tsetLogLevel(logging.INFO)\n}", "title": "" }, { "docid": "45572ab6433899758f92d471d106b21c", "score": "0.7737023", "text": "func initLogging() {\n\n\t// Log as JSON instead of the default ASCII formatter.\n\tlog.SetFormatter(&log.JSONFormatter{})\n\n\tlog.Infoln(\"Logger created\")\n}", "title": "" }, { "docid": "b75c03c3277f512762f3193d0d9be0ec", "score": "0.7635534", "text": "func initLogging() {\n\terr := logger.Init(config.Config.LogPath, config.Config.LogLevel)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "e4a6e4794260ca512ae6b3c27d3249fe", "score": "0.76301205", "text": "func initLogging(c config.Config) {\n\tif c.Logging.Debug {\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\t}\n\tif c.Logging.Trace {\n\t\tlogrus.SetLevel(logrus.TraceLevel)\n\t}\n\tif c.Logging.Text {\n\t\tlogrus.SetFormatter(&logrus.TextFormatter{\n\t\t\tForceColors: c.Logging.Color,\n\t\t\tDisableColors: !c.Logging.Color,\n\t\t})\n\t} else {\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{\n\t\t\tPrettyPrint: c.Logging.Pretty,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f91b3f78b8f55505fc6443b1635772c8", "score": "0.76005846", "text": "func initLogger(cfg config.LoggerCfg) {\n\tlogrus.SetReportCaller(cfg.Caller)\n\tif !cfg.HumanReadable {\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t}\n\tvar level logrus.Level\n\tswitch cfg.Level {\n\tcase warningLoggerLevel:\n\t\tlevel = logrus.WarnLevel\n\tcase errorLoggerLevel:\n\t\tlevel = logrus.ErrorLevel\n\tcase fatalLoggerLevel:\n\t\tlevel = logrus.FatalLevel\n\tdefault:\n\t\tlevel = logrus.DebugLevel\n\t}\n\tlogrus.SetLevel(level)\n}", "title": "" }, { "docid": "370d77d1809b46574ef789a036a67d82", "score": "0.75769633", "text": "func initLogger(cfg config.LoggerCfg) {\n\tlogrus.SetReportCaller(cfg.Caller)\n\tif !cfg.HumanReadable {\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t}\n\tvar level logrus.Level\n\tswitch cfg.Level {\n\tcase warningLoggerLevel:\n\t\tlevel = logrus.WarnLevel\n\tcase errorLoggerLevel:\n\t\tlevel = logrus.ErrorLevel\n\tcase fatalLoggerLevel:\n\t\tlevel = logrus.FatalLevel\n\tcase infoLoggerLevel:\n\t\tlevel = logrus.InfoLevel\n\tdefault:\n\t\tlevel = logrus.DebugLevel\n\t}\n\tlogrus.SetLevel(level)\n}", "title": "" }, { "docid": "53bd1f16986f0afb8b70417760499976", "score": "0.7527928", "text": "func initLogging() {\n\tif AppFlags.traceLogging {\n\t\tlog.SetLevel(log.TraceLevel)\n\t} else if AppFlags.debugLogging {\n\t\tlog.SetLevel(log.DebugLevel)\n\t} else {\n\t\tswitch logLevel := strings.ToUpper(os.Getenv(\"LOG_LEVEL\")); logLevel {\n\t\tcase \"TRACE\":\n\t\t\tlog.SetLevel(log.TraceLevel)\n\t\tcase \"DEBUG\":\n\t\t\tlog.SetLevel(log.DebugLevel)\n\t\tcase \"WARN\":\n\t\t\tlog.SetLevel(log.WarnLevel)\n\t\tcase \"ERROR\":\n\t\t\tlog.SetLevel(log.ErrorLevel)\n\t\tdefault:\n\t\t\tlog.SetLevel(log.InfoLevel)\n\t\t}\n\t}\n\tlog.SetOutput(ioutil.Discard)\n\tlog.AddHook(&writer.Hook{\n\t\tWriter: os.Stderr,\n\t\tLogLevels: []log.Level{\n\t\t\tlog.PanicLevel,\n\t\t\tlog.FatalLevel,\n\t\t\tlog.ErrorLevel,\n\t\t\tlog.WarnLevel,\n\t\t},\n\t})\n\tlog.AddHook(&writer.Hook{\n\t\tWriter: os.Stdout,\n\t\tLogLevels: []log.Level{\n\t\t\tlog.InfoLevel,\n\t\t\tlog.DebugLevel,\n\t\t\tlog.TraceLevel,\n\t\t},\n\t})\n\n\tformatter := &log.TextFormatter{\n\t\tForceColors: true,\n\t}\n\n\tif AppFlags.timestampedLogging || os.Getenv(\"LOG_TIMESTAMPS\") != \"\" {\n\t\tformatter.FullTimestamp = true\n\t}\n\n\tlog.SetFormatter(formatter)\n\n}", "title": "" }, { "docid": "049670eb538b689fb0d2697f50191fc8", "score": "0.7481166", "text": "func InitLogging(cfg *Config) error {\n\n\tlvl, err := log.ParseLevel(cfg.LogLvl)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\n\tlog.SetFormatter(&log.JSONFormatter{})\n\n\tvar f *os.File\n\tif cfg.LogPath != \"\" {\n\t\tf, err = os.OpenFile(cfg.LogPath, os.O_WRONLY|os.O_CREATE, 0755)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t}\n\n\tif cfg.Stdout {\n\t\tmw := io.MultiWriter(os.Stdout, f)\n\t\tlog.SetOutput(mw)\n\t}\n\n\tif lvl == log.DebugLevel {\n\t\tlog.SetOutput(os.Stdout)\n\t}\n\n\tlog.SetLevel(lvl)\n\n\tif lvl == log.DebugLevel {\n\t\tlog.SetReportCaller(true)\n\n\t\ttrace.SetDebug(true)\n\t}\n\treturn nil\n\n}", "title": "" }, { "docid": "a7af85b39a9f53bb0f128adf2fb4227b", "score": "0.7450426", "text": "func initLogging(debug bool) *logrus.Logger {\n\tlogger := logrus.New()\n\tlogger.SetLevel(logrus.InfoLevel)\n\n\tif debug {\n\t\tlogger.SetLevel(logrus.DebugLevel)\n\t}\n\n\treturn logger\n}", "title": "" }, { "docid": "5e63103e99e1c6f0f1af47ba0032ee21", "score": "0.7441153", "text": "func InitLogger(format string, level string) error {\n\tlogLevel, err := log.ParseLevel(level)\n\n\tif err != nil {\n\t\tmsg := fmt.Sprintf(\"Unknown log level: %s.\\nAvailable levels are: debug, info, warn, error, fatal\", level)\n\t\treturn errors.New(msg)\n\t}\n\n\tlog.SetLevel(logLevel)\n\n\tswitch format {\n\tcase \"text\":\n\t\t{\n\t\t\tlog.SetHandler(&LogHandler{writer: os.Stdout, tty: IsTTY()})\n\t\t}\n\tcase \"json\":\n\t\t{\n\t\t\tlog.SetHandler(json.New(os.Stdout))\n\t\t}\n\tdefault:\n\t\t{\n\t\t\tmsg := fmt.Sprintf(\"Unknown log format: %s.\\nAvaialable formats are: text, json\", format)\n\t\t\treturn errors.New(msg)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "74554a7a417d8c10bcf5860f1286f524", "score": "0.73957056", "text": "func TestInitLogging(t *testing.T) {\n\tvar l1, l2 *Standard\n\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\n\t// New must be race-free.\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tl1 = New(\"l1\")\n\t\t_ = l1\n\t}()\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tl2 = New(\"l2\")\n\t\t_ = l2\n\t}()\n\n\twg.Wait()\n\n\t// New must also initialize the level correctly.\n\tl1Level := logging.GetLevel(\"l1\")\n\tif l1Level != logging.INFO {\n\t\tt.Errorf(\"l1 level=%s is unexpectedly not INFO\", l1Level)\n\t}\n\tl2Level := logging.GetLevel(\"l2\")\n\tif l2Level != logging.INFO {\n\t\tt.Errorf(\"l2 level=%s is unexpectedly not INFO\", l2Level)\n\t}\n}", "title": "" }, { "docid": "fb6405d041bfdabe89b5bede776d40dd", "score": "0.7362659", "text": "func initLogger() {\n\tif strings.HasSuffix(svc.Version, \"+dev\") || debugMode {\n\t\tlog.SetLevel(log.DebugLevel)\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"Name\": svc.Name,\n\t\t\t\"Version\": svc.Version,\n\t\t\t\"FullName\": fmt.Sprintf(\"%s-%s\", svc.Name, svc.Version),\n\t\t}).Debug(\"set log debug level\")\n\t}\n}", "title": "" }, { "docid": "34b982ef32a54d96c94a692e231de0fc", "score": "0.7254632", "text": "func init() {\n\t//log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StderrHandler))\n}", "title": "" }, { "docid": "b85a94967e845dee1890cc035181f9ad", "score": "0.7248582", "text": "func InitLogger(log string, level string) {\n\tw := zapcore.AddSync(&lumberjack.Logger{\n\t\tFilename: log,\n\t\tMaxSize: 500, // megabytes\n\t\tMaxBackups: 3,\n\t\tMaxAge: 28, // days\n\t\tCompress: true,\n\t})\n\n\tvar lv zapcore.Level\n\terr := lv.UnmarshalText([]byte(level))\n\tif err != nil {\n\t\tfmt.Println(\"level \", level, \", error:\", err.Error())\n\t\tlv = zapcore.InfoLevel\n\t}\n\n\t// level级别以上的一个文件,如果是info,则warn\\error\\painc等包含\n\tcore := zapcore.NewCore(\n\t\tzapcore.NewConsoleEncoder(NewEncoderConfig()),\n\t\tzapcore.NewMultiWriteSyncer(zapcore.AddSync(os.Stdout), w),\n\t\tlv,\n\t)\n\n\tLogger = zap.New(core, zap.AddCaller())\n\tSugar = Logger.Sugar()\n}", "title": "" }, { "docid": "46a67fb79cb8474553a55d280199e2f6", "score": "0.7244564", "text": "func InitLogger(level string) {\n\tLogger = log.New()\n\tLogger.Level = logutil.StringToLogLevel(level)\n}", "title": "" }, { "docid": "a4d236894ba4c698015427285c4eae61", "score": "0.723936", "text": "func init() {\n\toldLogger = globalLog.Logger\n\tglobalLog.Logger = globalLog.Logger.Level(zerolog.ErrorLevel)\n}", "title": "" }, { "docid": "ce672af423ffacf96f10e92cd1769e8a", "score": "0.7235954", "text": "func InitLogging(options ...LogOption) {\n\tmust := func(err error) {\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\n\tp := logParams{\n\t\tflags: flag.NewFlagSet(os.Args[0], flag.ExitOnError),\n\t}\n\n\t// First, init the flags so that we can set specific values.\n\tklog.InitFlags(p.flags)\n\n\tfor _, o := range options {\n\t\to(&p)\n\t}\n\n\tswitch p.log {\n\tcase nil:\n\tdefault:\n\t\t// Force klog to a file output so that it uses the PipeWriter.\n\t\tmust(p.flags.Set(\"logtostderr\", \"false\"))\n\t\tmust(p.flags.Set(\"alsologtostderr\", \"false\"))\n\n\t\t// Use the LogSink from a logrusr Logger, but wrapped in\n\t\t// an adapter that always returns true for Enabled() since\n\t\t// we rely on klog to do log level filtering.\n\t\tlogger := logrusr.New(p.log, logrusr.WithReportCaller())\n\t\tklog.SetLogger(logr.New(&alwaysEnabledLogSink{\n\t\t\tLogSink: logger.GetSink(),\n\t\t}))\n\n\t\t// Also set the controller-runtime logger to the same\n\t\t// concrete logger but ensure its output is guarded by\n\t\t// the configured V level.\n\t\tcontroller_runtime_log.SetLogger(logr.New(&levelControlledLogSink{\n\t\t\tlevel: p.level,\n\t\t\tLogSink: logger.GetSink(),\n\t\t}))\n\t}\n}", "title": "" }, { "docid": "e0ab57c83decb2852af4868257f64e71", "score": "0.7213876", "text": "func InitLogging(levelString string) {\n\tformatter := logging.MustStringFormatter(\n\t\t`%{color}%{time:15:04:05.000} ▶ %{level:.4s} %{id:03x}%{color:reset} %{message}`,\n\t)\n\tlevel, _ := logging.LogLevel(levelString)\n\tlogging.SetFormatter(formatter)\n\tlogging.SetLevel(level, \"\")\n}", "title": "" }, { "docid": "d7654c9932e6eb454511033f5fdd4cf4", "score": "0.72124684", "text": "func InitLogger(config *LoggingConfig) {\n\tprops := log.LogrusLoggerProperties{\n\t\tLevel: logrus.DebugLevel,\n\t}\n\n\tswitch config.Level {\n\tcase \"debug\":\n\t\tprops.Level = logrus.DebugLevel\n\tcase \"info\":\n\t\tprops.Level = logrus.InfoLevel\n\tcase \"warn\":\n\t\tprops.Level = logrus.WarnLevel\n\tdefault:\n\t\tprops.Level = logrus.DebugLevel\n\t}\n\n\tRootLogger = log.NewLogrus(props)\n}", "title": "" }, { "docid": "88e9aebee4b9c42239f3dd650b64f01b", "score": "0.719792", "text": "func initLog() {\n\terr := globalConfig.Log.Apply()\n\tif nil != err {\n\t\tlog.WithError(err).Fatal(\"Could not apply logging configurations\")\n\t}\n}", "title": "" }, { "docid": "ccbef38e8d08ec5d4c4f4de823afd319", "score": "0.7159271", "text": "func initLog() {\n\t// Create a new backend for logs\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\t// Create a second one for errors and critical log messages\n\terrorBackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\t// Format the first backend using the overall formatter\n\tformatter := logging.NewBackendFormatter(backend, format)\n\t// Format the errors using the error formatter\n\terrorFormat := logging.NewBackendFormatter(errorBackend, errorFormatStr)\n\t// Make the error backend leveled\n\terrorLogBackend := logging.AddModuleLevel(errorFormat)\n\t// Only show error and above messages\n\terrorLogBackend.SetLevel(logging.ERROR, \"\")\n\t// Apply the backend changes\n\tlogging.SetBackend(formatter, errorLogBackend)\n\n}", "title": "" }, { "docid": "d5817ab4d5d7044e5fadf308b0b4970c", "score": "0.7133222", "text": "func initLogger(infoHandle io.Writer, msgType string) {\n\tlogMessage = log.New(infoHandle, msgType, log.LstdFlags|log.LUTC)\n}", "title": "" }, { "docid": "1d84e04c974094d5b46e362d5cfb3247", "score": "0.7131674", "text": "func InitLogger(logLevel string) error {\n\tlevel, err := logrus.ParseLevel(logLevel)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogrus.SetLevel(level)\n\treturn nil\n}", "title": "" }, { "docid": "5d5d4968e4cc2773e8119a8e8244273d", "score": "0.7118929", "text": "func (cni *ContrailCni) loggingInit() error {\n\tlog.Init(cni.LogFile, 10, 10)\n\treturn nil\n}", "title": "" }, { "docid": "7609ce8027ce8d175fbdde95f85938c3", "score": "0.71129924", "text": "func setupLogger() {\n\tlogging.Initialize()\n\tlog = logging.GetLogger(\"init\")\n}", "title": "" }, { "docid": "9cac4b95884256bd4c599e9071439968", "score": "0.7106992", "text": "func (api *API) initLogger() error {\n\tlogger := loggo.GetLogger(\"api\")\n\terr := common.CreateDirIfDoesNotExist(\n\t\tfilepath.FromSlash(common.LogsDir),\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlogger.SetLogLevel(loggo.INFO)\n\n\t// Create the log file\n\tlogFile, err := os.OpenFile(filepath.FromSlash(fmt.Sprintf(\n\t\t\"%s/internal_log_%s.txt\", common.LogsDir,\n\t\ttime.Now().Format(\"2006-01-02_15-04-05\"))),\n\t\tos.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Enable colors\n\t_, err = loggo.ReplaceDefaultWriter(loggocolor.NewWriter(os.Stderr))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Register file writer\n\terr = loggo.RegisterWriter(\"logs\", loggo.NewSimpleWriter(\n\t\tlogFile, loggo.DefaultFormatter,\n\t))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tapi.log = &logger\n\n\treturn nil\n}", "title": "" }, { "docid": "45e2ed467efafde2d6babd74e188764a", "score": "0.70866996", "text": "func InitLogging() {\n\tif os.Getenv(envLogSkipHttpReq) != \"\" {\n\t\tLogHttpRequest = false\n\t}\n\n\tif os.Getenv(envLogSkipHttpResp) != \"\" {\n\t\tLogHttpResponse = false\n\t}\n\n\tif os.Getenv(envApiLogFunctions) != \"\" {\n\t\tSetApiLogFunctions(os.Getenv(envApiLogFunctions))\n\t}\n\n\tif os.Getenv(envLogSkipTagList) != \"\" {\n\t\tSetSkipTags(os.Getenv(envLogSkipTagList))\n\t}\n\n\tif os.Getenv(envLogPasswords) != \"\" {\n\t\tEnableLogging = true\n\t\tLogPasswords = true\n\t}\n\n\tif os.Getenv(envLogFileName) != \"\" {\n\t\tEnableLogging = true\n\t\tApiLogFileName = os.Getenv(envLogFileName)\n\t}\n\n\tLogOnScreen = os.Getenv(envLogOnScreen)\n\tif LogOnScreen != \"\" {\n\t\tApiLogFileName = \"\"\n\t\tEnableLogging = true\n\t}\n\n\tif EnableLogging || os.Getenv(envUseLog) != \"\" {\n\t\tEnableLogging = true\n\t}\n\tSetLog()\n}", "title": "" }, { "docid": "decbc8d5036a6e1b75e410baa92d8c29", "score": "0.7086396", "text": "func InitLogging(logName string, params *LogParams, alsoLogToStderr bool) (err error) {\n\tinitMutex.Lock()\n\tdefer initMutex.Unlock()\n\n\t// if logParams is not provided, then initialize from defaults and command line parameters\n\tif params == nil {\n\t\t// Initialize defaults.\n\t\tlogParams.Level = DefaultLogLevel\n\t\tlogParams.MaxSizeMiB = DefaultMaxLogSize\n\t\tlogParams.MaxFiles = DefaultMaxLogFiles\n\t\tlogParams.Format = DefaultLogFormat\n\t} else {\n\t\tlogParams = *params\n\t}\n\n\t// verify if log location is provided\n\tif logName != \"\" {\n\t\tlogParams.File = logName\n\t}\n\n\t// check any overrides from env and apply\n\tupdateLogParamsFromEnv()\n\n\t// No output except for the hooks\n\tlog.SetOutput(ioutil.Discard)\n\n\tif logParams.GetFile() != \"\" {\n\t\terr = AddFileHook()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif alsoLogToStderr {\n\t\terr = AddConsoleHook()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Set log level\n\tlevel, err := log.ParseLevel(logParams.GetLevel())\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.SetLevel(level)\n\n\t// Remind users where the log file lives\n\tlog.WithFields(log.Fields{\n\t\t\"logLevel\": log.GetLevel().String(),\n\t\t\"logFileLocation\": logParams.GetFile(),\n\t\t\"alsoLogToStderr\": alsoLogToStderr,\n\t}).Info(\"Initialized logging.\")\n\n\treturn nil\n}", "title": "" }, { "docid": "9b14d3848c057f004feb7d2d6d6697db", "score": "0.7081431", "text": "func InitLog(loglevel int, output io.Writer) *log.Logger{\n\tl := log.New(output, \"\", log.Lshortfile)\n\tlog.SetFlags(log.Lshortfile)\n\tl.SetLogLevel(loglevel)\n\tlog.SetStandardLogLevel(loglevel)\n\treturn l\n}", "title": "" }, { "docid": "7d602f4dc472cb8f80cff92fe6c460b0", "score": "0.7080967", "text": "func InitLog(output, loglevel string) error {\n\tswitch output {\n\tcase \"stdout\":\n\t\tLogWriter = reopen.Stdout\n\tcase \"stderr\":\n\t\tLogWriter = reopen.Stderr\n\tcase \"discard\":\n\t\tLogWriter = reopen.Discard\n\tdefault:\n\t\tf, err := reopen.NewFileWriterMode(output, 0644)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tLogWriter = f\n\t}\n\n\tvar level zapcore.Level\n\tif err := level.UnmarshalText([]byte(loglevel)); err != nil {\n\t\treturn err\n\t}\n\n\tconfig := zap.NewProductionConfig().EncoderConfig\n\tconfig.TimeKey = \"time\"\n\tconfig.MessageKey = \"msg\"\n\tconfig.EncodeTime = func(t time.Time, enc zapcore.PrimitiveArrayEncoder) {\n\t\tenc.AppendString(t.Format(\"2006/01/02 15:04:05 MST\"))\n\t}\n\n\tencoder := zapcore.NewJSONEncoder(config)\n\twriteSyncer := zapcore.AddSync(LogWriter)\n\tLogger = zap.New(\n\t\tzapcore.NewCore(\n\t\t\tencoder,\n\t\t\tzapcore.Lock(writeSyncer),\n\t\t\tlevel,\n\t\t),\n\t\tzap.ErrorOutput(writeSyncer),\n\t)\n\n\treturn nil\n}", "title": "" }, { "docid": "63ee180dbc5731ba44fe0ddc56545834", "score": "0.7064681", "text": "func initLogger(config *Config) {\n\tvar (\n\t\tfileName = config.LogFileName\n\t\tmaxSize = config.LogMaxSize\n\t\tlogLevel = config.LogLevel\n\t)\n\n\tif config.LogFileName == \"\" {\n\t\tfileName = \"./log.log\"\n\t}\n\n\tif config.LogMaxSize == 0 {\n\t\tmaxSize = 50\n\t}\n\n\tif config.LogLevel == \"\" {\n\t\tlogLevel = \"info\"\n\t}\n\n\tlevel, err := logrus.ParseLevel(logLevel)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tLogger = &logrus.Logger{\n\t\tFormatter: &logrus.JSONFormatter{},\n\t\tOut: &lumberjack.Logger{\n\t\t\tFilename: fileName,\n\t\t\tMaxSize: maxSize, // MB\n\t\t},\n\t\tLevel: level,\n\t}\n\tif fileName == \"stdout\" {\n\t\tLogger.Out = os.Stdout\n\t\tLogger.Formatter = &logrus.TextFormatter{}\n\t}\n\n\tLogger.Info(\"Logger started\")\n}", "title": "" }, { "docid": "dde4f0ce9a0a24b99474ef0a25bc566f", "score": "0.7047361", "text": "func init() {\n\tlog, _ = NewLogger(FatalLevel)\n}", "title": "" }, { "docid": "325dd0f83d6c27afd11ac8241db859f6", "score": "0.7041706", "text": "func InitLogger(logLevel string, enableConsole bool, enableLogFile bool) {\n\tvar err error\n\n\tif loggerInitialized {\n\t\treturn\n\t}\n\t// If both console logging and log file logging are disabled, re-enable console logging so messages can be seen\n\tif !enableConsole && !enableLogFile {\n\t\tenableConsole = true\n\t}\n\tif enableLogFile {\n\t\tconfigHome := getConfigHome()\n\t\tlogPath = path.Join(configHome, \"<%= appname %>\")\n\t\terr = os.MkdirAll(logPath, logDirectoryMode)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"* error creating log directory %s: %s\\n\", logPath, err.Error())\n\t\t}\n\t\tlogFilePath = path.Join(logPath, logFileName)\n\t\tlogFileHandle, err = os.OpenFile(logFilePath, os.O_APPEND|os.O_CREATE|os.O_RDWR, logFileMode)\n\t\tif err != nil {\n\t\t\tlogFileHandle = nil\n\t\t}\n\t}\n\t// Set up the log writers\n\tlogWriters := make([]io.Writer, 0)\n\tif enableLogFile && logFileHandle != nil {\n\t\tlogWriters = append(logWriters, logFileHandle)\n\t}\n\tif enableConsole {\n\t\tlogWriters = append(logWriters, zerolog.ConsoleWriter{Out: os.Stderr, TimeFormat: time.StampMilli})\n\t}\n\t// Create a new root logger\n\tif len(logWriters) > 1 {\n\t\trootLogger = zerolog.New(zerolog.MultiLevelWriter(logWriters...)).\n\t\t\tWith().\n\t\t\tTimestamp().\n\t\t\tLogger()\n\t} else {\n\t\trootLogger = zerolog.New(logWriters[0]).\n\t\t\tWith().\n\t\t\tTimestamp().\n\t\t\tLogger()\n\t}\n\t// Set global logger message level\n\tlvl, ok := levelMap[logLevel]\n\tif !ok {\n\t\tlvl = zerolog.InfoLevel\n\t}\n\tzerolog.SetGlobalLevel(lvl)\n\tloggerInitialized = true\n}", "title": "" }, { "docid": "8b2b21cf08cbb9da7c287611cc4e3e67", "score": "0.7034184", "text": "func Init(logLevel string) error {\n\tvar l log.Logger\n\tl = log.NewJSONLogger(log.NewSyncWriter(os.Stderr))\n\tlogLevelOption, err := parseLogLevel(logLevel)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tl = level.NewFilter(l, logLevelOption)\n\tlogger = log.With(l, \"ts\", timestampFormat, \"caller\", log.Caller(4))\n\treturn nil\n}", "title": "" }, { "docid": "029383d0c67d2856db12b93b417b2979", "score": "0.7013718", "text": "func InitLogger(logLevel, appName string) *log.Entry {\n\tparentLogger := log.New()\n\tvar logrusLevel log.Level\n\n\tswitch logLevel {\n\tcase \"trace\":\n\t\tlogrusLevel = log.TraceLevel\n\tcase \"debug\":\n\t\tlogrusLevel = log.DebugLevel\n\tcase \"info\":\n\t\tlogrusLevel = log.InfoLevel\n\tcase \"warn\":\n\t\tlogrusLevel = log.WarnLevel\n\tcase \"error\":\n\t\tlogrusLevel = log.ErrorLevel\n\tdefault:\n\t\tlogrusLevel = log.DebugLevel\n\t}\n\n\tparentLogger.SetLevel(logrusLevel)\n\tparentLogger.SetFormatter(&log.JSONFormatter{})\n\treturn parentLogger.WithField(\"application\", appName)\n}", "title": "" }, { "docid": "a6a7ffe62c183953bb015d3b3c840bcd", "score": "0.70136005", "text": "func init() {\n\tlog = config.Logger()\n}", "title": "" }, { "docid": "a53462521ea3633d2176b1cfe1d30479", "score": "0.6995942", "text": "func init() {\n\t//\tloadConfig()\n\tDefaultConfigLogger = ConfigLogger{RootLevel: \"INFO\", EnableConsole: true, EnableFile: false, ConsoleJsonFormat: false, FileJsonFormat: false, LogFileLocation: \"/tmp/rudder_log.log\", LogFileSize: 100, EnableTimestamp: true, EnableFileNameInLog: false, EnableStackTrace: false, LevelConfigStr: \"\"}\n\tloadConfig(DefaultConfigLogger)\n\tLog = configureLogger()\n\tloggerLevelsCache = make(map[string]int)\n}", "title": "" }, { "docid": "b04412f53ef447728556186c0d86c413", "score": "0.6994008", "text": "func InitLogger(cfg *LogConfig) error {\n\tlog.SetLevel(stringToLogLevel(cfg.Level))\n\tlog.AddHook(&contextHook{})\n\n\tif cfg.Format == \"\" {\n\t\tcfg.Format = defaultLogFormat\n\t}\n\tformatter := stringToLogFormatter(cfg.Format, cfg.DisableTimestamp)\n\tlog.SetFormatter(formatter)\n\n\tif len(cfg.File.FileName) != 0 {\n\t\tif err := initFileLog(&cfg.File, nil); err != nil {\n\t\t\treturn errors.Trace(err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3de779b22807aae4ae7d3d11e21b5d69", "score": "0.69715446", "text": "func initLog() {\n\t// Log as JSON instead of the default ASCII formatter.\n\t//log.SetFormatter(&log.JSONFormatter{})\n\n\t// Output to stdout instead of the default stderr\n\t// Can be any io.Writer, see below for File example\n\t//log.SetOutput(os.Stdout)\n\tlog.SetOutput(RootCmd.OutOrStdout())\n\n\t// Only log the warning severity or above.\n\tlog.SetLevel(log.WarnLevel)\n}", "title": "" }, { "docid": "dd68ed4ae31b126560f9e25d5e4c46d0", "score": "0.6966946", "text": "func initLog() {\n\tif cfg.Debug {\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\t\tlogrus.Infof(\"start daemon at debug level\")\n\t}\n\n\tformatter := &logrus.TextFormatter{\n\t\tForceColors: true,\n\t\tFullTimestamp: true,\n\t\tTimestampFormat: \"2006-01-02 15:04:05.000000000\",\n\t}\n\tlogrus.SetFormatter(formatter)\n}", "title": "" }, { "docid": "39bcbbc8e70bfa583ce821c6ead0824a", "score": "0.69632626", "text": "func initLogger(debug bool) {\n\tlog = logrus.New()\n\n\t// Define logger level\n\tif debug {\n\t\tlog.SetLevel(logrus.DebugLevel)\n\t} else {\n\t\tlog.SetLevel(logrus.InfoLevel)\n\t}\n\n\t// Print out file names and line numbers\n\tlog.SetReportCaller(true)\n}", "title": "" }, { "docid": "db14389e282ecfc877faf9f78b6d1e06", "score": "0.6951192", "text": "func initLogLevel() {\n\tmEnv := config.GetModuleEnv(config.ModuleRestaurant)\n\tlogLevel := mEnv[config.KeyLogLevel]\n\tlevlog.SetLevel(logLevel)\n}", "title": "" }, { "docid": "13858e523c6c6a24f42609b68839f3fb", "score": "0.69462323", "text": "func initInstallerLogging() {\n\tvar err error\n\tinitCmdLogging()\n\n\tlogLevel := GetDefaultLogLevel()\n\tif silent {\n\t\tlogLevel = \"fatal\"\n\t\terr = InitLogLevel(logLevel)\n\t\tif err != nil {\n\t\t\tLog().WithField(\"error\", err).Fatal(\"Failed to initialize logging.\")\n\t\t}\n\t}\n\n\t// Installer logs to stdout only\n\tInitLogOutput(os.Stdout)\n\tInitLogFormatter(&log.TextFormatter{DisableTimestamp: true})\n\t// Set provided logging workflows.\n\tif err = SetWorkflows(logWorkflows); err != nil {\n\t\tLog().WithField(\"error\", err).Fatal(\"Failed to initialize logging while setting log workflows.\")\n\t}\n\n\tif err = SetLogLayers(logLayers); err != nil {\n\t\tLog().WithField(\"error\", err).Fatal(\"Failed to initialize logging while setting log layers.\")\n\t}\n\n\tLog().WithField(\"logLevel\", LogLevel).Debug(\"Initialized logging.\")\n}", "title": "" }, { "docid": "1419e47d877f0105d12437d5bb1a8d3b", "score": "0.6943929", "text": "func initLoggers() {\n\n\tvar err error\n\tlogFileFD, err = createLogFile(logFileFD)\n\tif err != nil {\n\t\tlog.Fatalf(\"Could not create log file: [%s]\", err)\n\t}\n\n\t// Logger flags\n\tconst lflags int = log.Ldate | log.Ltime | log.Lmsgprefix\n\n\t// Build slice of loggers for each level\n\tlogger = append(logger, log.New(logFileFD, \"INFO: \", lflags))\n\tlogger = append(logger, log.New(logFileFD, \"NOTICE: \", lflags))\n\tlogger = append(logger, log.New(logFileFD, \"WARNING: \", lflags))\n\tlogger = append(logger, log.New(logFileFD, \"ERROR: \", lflags))\n\tlogger = append(logger, log.New(logFileFD, \"FATAL: \", lflags))\n\n\t// Special logger to handle output to stderr\n\tstderrLogger = log.New(os.Stderr, \"\", lflags)\n}", "title": "" }, { "docid": "a8342fef7085f78fc3b377492098d9a9", "score": "0.69181204", "text": "func InitLogger() {\n\tc := config.GetConfig()\n\tll, err := log.ParseLevel(c.LogLevel)\n\tif err != nil {\n\t\tlog.Error(\"Unable to determine log level from configuration; defaulting to debug log level\")\n\t\tll = log.DebugLevel\n\t}\n\tlog.SetLevel(ll)\n\tlog.SetFormatter(&log.JSONFormatter{})\n}", "title": "" }, { "docid": "308495091d020995e03b59d27066660f", "score": "0.690299", "text": "func init() {\n\tlevel, err := log.ParseLevel(c.LogLevel)\n\tif err != nil {\n\t\tlog.Error(\"Issue setting log level. Make sure log level is a string: debug, warn, info, error, panic\")\n\t}\n\tlog.SetLevel(level)\n}", "title": "" }, { "docid": "d2a0d6adf53f17342f31ed800bee748b", "score": "0.68941677", "text": "func initLog() {\n\tif cfg.Debug {\n\t\tlogrus.SetLevel(logrus.DebugLevel)\n\t\tlogrus.Infof(\"start daemon at debug level\")\n\t}\n\n\tformatter := &logrus.TextFormatter{\n\t\tFullTimestamp: true,\n\t\tTimestampFormat: time.RFC3339Nano,\n\t}\n\tlogrus.SetFormatter(formatter)\n}", "title": "" }, { "docid": "19a7a72913a09ac1a6911c0567c32e0d", "score": "0.6873938", "text": "func InitLogger(level, directory, process string) error {\n\tlogLevel = level\n\tlogDirectory = directory\n\tprocessName = process \n\n\t_log := &Logger{}\n\tlogWriter, err := GetLogWriter()\n\tif err != nil {\n\t\tlog.Println(\"Failed getting log writer\", err.Error())\n\t\treturn err\n\t}\n\n\t_log.Writer = logWriter\n\t_log.LogLevel = LogLevels[logLevel]\n\t_logger = _log\n\treturn nil\n}", "title": "" }, { "docid": "0cecb4ce2961ec517153a41859f3e230", "score": "0.6871401", "text": "func InitLogger(c *koanf.Koanf) {\n\n\tlogConfig := zap.NewProductionConfig()\n\tlogConfig.Sampling = nil\n\n\t// Log Level\n\tvar logLevel zapcore.Level\n\tif err := logLevel.Set(c.String(\"logger.level\")); err != nil {\n\t\tzap.S().Fatalw(\"Could not determine logger.level\", \"error\", err)\n\t}\n\tlogConfig.Level.SetLevel(logLevel)\n\n\t// Handle different logger encodings\n\tloggerEncoding := c.String(\"logger.encoding\")\n\tswitch loggerEncoding {\n\tcase \"stackdriver\":\n\t\tlogConfig.Encoding = \"json\"\n\t\tlogConfig.EncoderConfig = zapdriver.NewDevelopmentEncoderConfig()\n\tdefault:\n\t\tlogConfig.Encoding = loggerEncoding\n\t\t// Enable Color\n\t\tif c.Bool(\"logger.color\") {\n\t\t\tlogConfig.EncoderConfig.EncodeLevel = zapcore.CapitalColorLevelEncoder\n\t\t}\n\t\tlogConfig.DisableStacktrace = c.Bool(\"logger.disable_stacktrace\")\n\t\t// Use sane timestamp when logging to console\n\t\tif logConfig.Encoding == \"console\" {\n\t\t\tlogConfig.EncoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\t\t}\n\n\t\t// JSON Fields\n\t\tlogConfig.EncoderConfig.MessageKey = \"msg\"\n\t\tlogConfig.EncoderConfig.LevelKey = \"level\"\n\t\tlogConfig.EncoderConfig.CallerKey = \"caller\"\n\t}\n\n\t// Settings\n\tlogConfig.Development = c.Bool(\"logger.dev_mode\")\n\tlogConfig.DisableCaller = c.Bool(\"logger.disable_caller\")\n\n\t// Build the logger\n\tglobalLogger, _ := logConfig.Build()\n\tzap.ReplaceGlobals(globalLogger)\n\n}", "title": "" }, { "docid": "0db7c38a1bf0879ef4bee105bf3c1d8b", "score": "0.6862142", "text": "func initLogger(useWatcher bool) (logger log.T) {\n\t// Read the current configurations or get the default configurations\n\tlogConfigBytes := logpkg.GetLogConfigBytes()\n\t// Initialize the base seelog logger\n\tbaseLogger, _ := initBaseLoggerFromBytes(logConfigBytes)\n\t// Create the wrapper logger\n\tlogger = withContext(baseLogger)\n\tif useWatcher {\n\t\t// Start the config file watcher\n\t\tstartWatcher(logger)\n\t}\n\treturn\n}", "title": "" }, { "docid": "55f015d1743915c7d6903c0f42ecba6f", "score": "0.68446094", "text": "func InitLog(fileloc string, logLevel string, stdout bool) {\n\t// limit the size of the message to log\n\tmaxLineSize = 100000\n\n\tlevel, err := logrus.ParseLevel(logLevel)\n\tif err != nil {\n\t\tfmt.Printf(\"Invalid log level value provided; %s, using Info\", logLevel)\n\t\tlevel = logrus.InfoLevel\n\t}\n\tlogrus.SetLevel(level)\n\tlogrus.AddHook(new(captainHook))\n\tlogrus.SetFormatter(new(simpleFormatter))\n\n\tif stdout {\n\t\tlogrus.SetOutput(os.Stderr)\n\t} else {\n\t\tSetOutput(fileloc)\n\t}\n\n\tconf.LogWriter = logrus.StandardLogger().Writer()\n}", "title": "" }, { "docid": "920754266f84ccf4258f8969c73ec900", "score": "0.684395", "text": "func InitLogging() *logrus.Logger {\n\tlog.Formatter = stackdriver.NewFormatter()\n\tlog.Level = logrus.DebugLevel\n\tlog.SetOutput(os.Stdout)\n\n\tlog.Info(\"Logger successfully initialized!\")\n\n\treturn log\n}", "title": "" }, { "docid": "eb242b54de8f2e893d899f14ddc1da8e", "score": "0.68429685", "text": "func InitLogging(level string) {\n\tif envLevel := os.Getenv(\"CERBOS_LOG_LEVEL\"); envLevel != \"\" {\n\t\tdoInitLogging(envLevel)\n\t\treturn\n\t}\n\n\tdoInitLogging(level)\n}", "title": "" }, { "docid": "eb782d20309fc774f36834a1bb5da165", "score": "0.68413395", "text": "func InitLogger(debug bool, logFile string, logLevel string) {\n\tif debug {\n\t\tSetupLogger(os.Stdout, logging.DEBUG)\n\t} else {\n\t\tout := setLogFile(logFile)\n\t\tlevel := readLogLevel(logLevel)\n\t\tSetupLogger(out, level)\n\t}\n}", "title": "" }, { "docid": "b9ccf0ee82ecbd376b6426b400a61207", "score": "0.6838841", "text": "func InitLogger(w io.Writer) {\n\tLog = log.New(w,\n\t\t\"LOG : \",\n\t\tlog.Ldate|log.Ltime|log.Lshortfile)\n}", "title": "" }, { "docid": "7c2f4394bce5fe9f56f7968436e6ef2c", "score": "0.68179613", "text": "func init() {\n\tFUNCNAME := \"logger.init():\"\n\n\tdefer measureRuntime(time.Now(), FUNCNAME)\n\n\tlog.Println(\"running...\", FUNCNAME)\n\n\t//set temporary logger to trace log level\n\tL = &LogInfo{}\n\tL.SetLogStream('T')\n\tL.Level = TRACE\n\n\tL.Info.Printf(\"%s loglevel temporarily set to: %s\", FUNCNAME, string(L.Level))\n}", "title": "" }, { "docid": "982d6cfa89d64b79dd547b18a36b5db5", "score": "0.6784074", "text": "func initLoggers(conf *Config) error {\n\tif conf.Global.Debug {\n\t\t// Enable debuglog\n\t\tg_debug = log.New(os.Stdout, \"[DEBUG] \", log.Ltime)\n\t\tg_debug.Println(\"Entering debug mode.\")\n\n\t\t// Set log output stream to stdout\n\t\tlog.SetOutput(os.Stdout)\n\t\tlog.SetFlags(log.Ltime)\n\t\tg_debug.Println(\"Redirecting log output to stdout.\")\n\t} else {\n\t\t// Disable debuglog\n\t\tg_debug = log.New(ioutil.Discard, \"DEBUG: \", log.Ltime)\n\n\t\t// Enable file logging\n\t\tif out, err := os.OpenFile(conf.Global.ErrorLog, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644); err != nil {\n\t\t\treturn err\n\t\t} else {\n\t\t\tlog.SetOutput(out)\n\t\t\tlog.SetFlags(log.Ldate | log.Ltime)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f7f5126f235c4a3f3c439b14909ccfd2", "score": "0.6769599", "text": "func (this *LoggerEntry) initLogger() (logger *logrus.Entry) {\n\tif this.IsDevelopment {\n\t\tlogrus.SetOutput(os.Stderr)\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t} else {\n\t\tlogFile, err := os.OpenFile(this.LogFilePath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, os.ModePerm)\n\t\tif err != nil {\n\t\t\tlogrus.Fatalf(\"open file error :%s, the reason is:%s\", this.LogFilePath, err.Error())\n\t\t\tlogFile.Close()\n\t\t}\n\t\tlogrus.SetOutput(logFile)\n\t\tlogrus.SetFormatter(&logrus.JSONFormatter{})\n\t}\n\n\tlogrus.SetLevel(logrus.Level(this.Level))\n\n\tfullSystemName := this.System\n\tlogger = logrus.WithFields(logrus.Fields{\n\t\t\"@sysName\": fullSystemName,\n\t})\n\treturn logger\n}", "title": "" }, { "docid": "6002873a700a322144f88aa5ba8188ab", "score": "0.67684156", "text": "func initLog() logger.Interface {\n\tf, _ := os.Create(\"gorm.log\")\n\tnewLogger := logger.New(log.New(io.MultiWriter(f), \"\\r\\n\", log.LstdFlags), logger.Config{\n\t\tColorful: true,\n\t\tLogLevel: logger.Info,\n\t\tSlowThreshold: time.Second,\n\t})\n\treturn newLogger\n}", "title": "" }, { "docid": "270dd78ec4baa7e5f28b723fe6651c8e", "score": "0.6751595", "text": "func (app *mainContext) setupLogging() {\n\tlogLevel, err := logging.LogLevel(app.LogLevel)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Invalid log level: %s\", app.LogLevel)\n\t\texitHook(1)\n\t}\n\tbackend := logging.NewLogBackend(os.Stderr, \"\", 0)\n\tformatter := logging.MustStringFormatter(\"%{time} %{level:.1s} %{shortfile} %{message}\")\n\tformatted := logging.NewBackendFormatter(backend, formatter)\n\tleveled := logging.AddModuleLevel(formatted)\n\tleveled.SetLevel(logLevel, \"\")\n\tlogging.SetBackend(leveled)\n\n\tapp.log = logging.MustGetLogger(\"\")\n}", "title": "" }, { "docid": "973c3793b56240a5b845c582c5d17157", "score": "0.6751406", "text": "func init() {\n\tlogging.initDefault()\n\tlogging.AddCallerSkip(1)\n}", "title": "" }, { "docid": "58805115d86e00085cfa714ee5d60002", "score": "0.6748818", "text": "func InitLogger(filename string, maxSize, maxBackups, maxAge int, compress bool, logLevel string) error {\n\twriteSyncer := getLogWriter(filename, maxSize, maxBackups, maxAge, compress)\n\tencoder := getEncoder()\n\tsetLogLevel(logLevel)\n\n\tcore := zapcore.NewCore(encoder, writeSyncer, atomicLevel)\n\tcaller := zap.AddCaller()\n\tcallerSkip := zap.AddCallerSkip(1)\n\n\tlogger = zap.New(core, caller, zap.AddStacktrace(zap.PanicLevel), callerSkip)\n\treturn nil\n}", "title": "" }, { "docid": "dfd26ba72418fb9eb7df7d986ac730a7", "score": "0.6737969", "text": "func LoggerInit(verbose bool) {\n\ts, _ := spun.NewSpinner(spun.Dots) // nolint: gosec\n\tlogger = &RigLogger{\n\t\tChannel: logChannels{\n\t\t\tInfo: log.New(os.Stdout, color.BlueString(\"[INFO] \"), 0),\n\t\t\tWarning: log.New(os.Stdout, color.YellowString(\"[WARN] \"), 0),\n\t\t\tError: log.New(os.Stderr, color.RedString(\"[ERROR] \"), 0),\n\t\t\tVerbose: deriveVerboseLogChannel(verbose),\n\t\t},\n\t\tIsVerbose: verbose,\n\t\tProgress: &RigSpinner{s},\n\t\tSpinning: false,\n\t\tPrivileged: false,\n\t}\n}", "title": "" }, { "docid": "33fd9456d8ae6e516e3827fffea0da6c", "score": "0.6736389", "text": "func SetupLogging(w io.Writer) {\n\n\tif w == nil {\n\t\tw = os.Stderr\n\t}\n\n\tlogger := kitlog.NewLogfmtLogger(kitlog.NewSyncWriter(w))\n\n\tif internal != nil {\n\t\tlogger.Log(\"event\", \"warning\", \"msg\", \"logging inited twice\")\n\t\treturn\n\t}\n\n\tif lvl := os.Getenv(\"CRYPTIX_LOGLVL\"); lvl != \"\" {\n\t\tlogger.Log(\"module\", \"logging\", \"error\", \"CRYPTIX_LOGLVL is obsolete. levels are bad, mkay?\")\n\t}\n\t// wrap logger to error-check the writes only once\n\tinternal = kitlog.LoggerFunc(func(keyvals ...interface{}) error {\n\t\tif err := logger.Log(keyvals...); err != nil {\n\t\t\tfmt.Fprintf(w, \"warning: logger.Write() failed! %s - vals: %v\", err, keyvals)\n\t\t\tpanic(err) // no other way to escalate this\n\t\t}\n\t\treturn nil\n\t})\n\tinternal = kitlog.With(internal, \"time\", kitlog.DefaultTimestamp, \"caller\", kitlog.DefaultCaller)\n\tstdlog.SetOutput(kitlog.NewStdlibAdapter(kitlog.With(internal, \"module\", \"stdlib\")))\n}", "title": "" }, { "docid": "6798cb53d255b1f88c8813c246064e9c", "score": "0.6733622", "text": "func (l *Logging) Init() {\n\n\tvalue := os.Getenv(\"FRIDAY_LOGGING_LEVEL\")\n\tif value == \"\" {\n\t\tl.Level = \"info\"\n\t} else {\n\t\tl.Level = value\n\t}\n}", "title": "" }, { "docid": "cc4b79269e8c26a5f52789054ff3b039", "score": "0.67286265", "text": "func InitLogger(version string) {\n\thost, _ := os.Hostname()\n\tLogger = zerolog.\n\t\tNew(os.Stderr).\n\t\tWith().\n\t\tCaller().\n\t\tTimestamp().\n\t\tStr(\"host\", host).\n\t\tStr(\"version\", version).\n\t\tLogger()\n}", "title": "" }, { "docid": "2b3510f0bc2da9e5388e31d0da589759", "score": "0.67070305", "text": "func InitTestLogging() {\n\trateLimits := moira.RateLimit{\n\t\tAcceptRate: 1,\n\t\tThreadsQty: 2,\n\t}\n\t_ = metrics.Init(metrics.Config{Enabled: false, IsTest: true}, rateLimits)\n\t_ = logging.Init(\n\t\tlogging.ComponentTests,\n\t\tlogging.Config{\n\t\t\tEnabled: false,\n\t\t\tHost: \"\",\n\t\t\tPort: 0,\n\t\t\tLevel: \"debug\",\n\t\t\tFallback: \"stdout\",\n\t\t\tDebug: true,\n\t\t},\n\t\trateLimits,\n\t)\n}", "title": "" }, { "docid": "959d0bfd4ef96076d46bcb94ea567e48", "score": "0.67036307", "text": "func InitLog(logFile, errLogFile string) {\n\terr := backendLog.AddLogFile(logFile, logger.LevelTrace)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error adding log file %s as log rotator for level %s: %s\", logFile, logger.LevelTrace, err)\n\t\tos.Exit(1)\n\t}\n\terr = backendLog.AddLogFile(errLogFile, logger.LevelWarn)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error adding log file %s as log rotator for level %s: %s\", errLogFile, logger.LevelWarn, err)\n\t\tos.Exit(1)\n\t}\n\n\terr = backendLog.AddLogWriter(os.Stdout, logger.LevelInfo)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error adding stdout to the loggerfor level %s: %s\", logger.LevelWarn, err)\n\t\tos.Exit(1)\n\t}\n\n\terr = backendLog.Run()\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error starting the logger: %s \", err)\n\t\tos.Exit(1)\n\t}\n}", "title": "" }, { "docid": "c91c0f50715f4110909eda87a8896c0a", "score": "0.66960406", "text": "func InitLogs() int {\n\tif logLevel < 1 {\n\t\tusage := \"level of logging to show\"\n\t\tdefaultLevel := \"debug\"\n\t\tvar level string\n\t\tflag.StringVar(&level, \"log_level\", defaultLevel, usage)\n\t\tflag.StringVar(&level, \"ll\", defaultLevel, usage)\n\t\tflag.Parse()\n\t\tfmt.Println(\"Using log level: \", level)\n\t\tlogLevel = LogLevels[level]\n\t\treturn LogLevels[level]\n\t}\n\treturn logLevel\n}", "title": "" }, { "docid": "e01880120f76c69785cb734a062c6428", "score": "0.6691299", "text": "func (l *Log) InitLog(fileName string, logLevel string, logFileLevel string) {\n\tl.logFileName = fileName\n\tl.logFile = File{Path: l.logFileName}\n\tl.logLevel = 0\n\tif logLevel == \"DEBUG\" {\n\t\tl.logLevel = 0\n\t} else if logLevel == \"INFO\" {\n\t\tl.logLevel = 1\n\t} else if logLevel == \"WARN\" {\n\t\tl.logLevel = 2\n\t} else if logLevel == \"ERROR\" {\n\t\tl.logLevel = 3\n\t} else if logLevel == \"NONE\" {\n\t\tl.logLevel = 4\n\t}\n\tl.logFileLevel = 3\n\tif logFileLevel == \"DEBUG\" {\n\t\tl.logFileLevel = 0\n\t} else if logFileLevel == \"INFO\" {\n\t\tl.logFileLevel = 1\n\t} else if logFileLevel == \"WARN\" {\n\t\tl.logFileLevel = 2\n\t} else if logFileLevel == \"ERROR\" {\n\t\tl.logFileLevel = 3\n\t} else if logFileLevel == \"NONE\" {\n\t\tl.logFileLevel = 4\n\t}\n}", "title": "" }, { "docid": "a21bfff9f75bfaa04cecc12b90752d54", "score": "0.66791356", "text": "func init() {\n\tlog.SetOutput(os.Stdout)\n\tSetLogLevel()\n}", "title": "" }, { "docid": "5c07a6be64937fd6394e2c8b4a07996e", "score": "0.66596794", "text": "func InitLoggers(debugLogger io.Writer, infoLogger io.Writer, errorLogger io.Writer) {\n\tDebug = log.New(debugLogger, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\tInfo = log.New(infoLogger, \"DEBUG: \", log.Ldate|log.Ltime|log.Lshortfile)\n\tError = log.New(errorLogger, \"ERROR: \", log.Ldate|log.Ltime|log.Lshortfile)\n}", "title": "" }, { "docid": "408733cacefd1ba18fcbbb4b884972ba", "score": "0.66531384", "text": "func InitializeLogs() error {\n\tlogLevel, err := strconv.Atoi(envy.Get(LogLevelEnv, \"0\"))\n\tif err != nil {\n\t\tlogLevel = DefaultLogLevel\n\t}\n\n\tzerolog.TimeFieldFormat = zerolog.TimeFormatUnix\n\tzerolog.SetGlobalLevel(zerolog.Level(logLevel))\n\n\t// json or human readable output\n\tif envy.Get(EnableJSONLogsEnv, \"false\") == \"false\" {\n\t\tlog.Logger = log.Output(zerolog.ConsoleWriter{Out: os.Stderr})\n\t}\n\n\t// add filepath+row num to log(app/cmd/serve.go:37)\n\tlog.Logger = log.With().Caller().Logger()\n\n\treturn nil\n}", "title": "" }, { "docid": "3bfe41a0552eddfef0fc98f40f8b1555", "score": "0.6652564", "text": "func InitLogging() {\n\t// Log file output\n\tif *logFile != \"\" {\n\t\tf, err := os.OpenFile(*logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0640)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to open log file: %v\", err)\n\t\t}\n\t\t_, err = f.Seek(0, os.SEEK_END)\n\t\tif err != nil {\n\t\t\tErrorf(nil, \"Failed to seek log file to end: %v\", err)\n\t\t}\n\t\tlog.SetOutput(f)\n\t\tredirectStderr(f)\n\t}\n\n\t// Syslog output\n\tif *useSyslog {\n\t\tif *logFile != \"\" {\n\t\t\tlog.Fatalf(\"Can't use --syslog and --log-file together\")\n\t\t}\n\t\tstartSysLog()\n\t}\n}", "title": "" }, { "docid": "79ab5a1e722ac638afaf66033ea211a2", "score": "0.664598", "text": "func init() {\n\tlogger = config.Logger()\n\tlog = logger.WithFields(logrus.Fields{\"tag\": \"Auth\"})\n}", "title": "" }, { "docid": "5ff253af8ca54933e3342703b24c7c91", "score": "0.66441673", "text": "func InitLogger(logPath string, loglevel string) *zap.Logger {\n\thook := lumberjack.Logger{\n\t\tFilename: logPath, // log file path\n\t\tMaxSize: 128, // megabytes\n\t\tMaxBackups: 30, // max backup\n\t\tMaxAge: 7, // days\n\t\tCompress: true, // is Compress, disabled by default\n\t}\n\n\tw := zapcore.AddSync(&hook)\n\n\t// set log print level\n\tvar level zapcore.Level\n\tswitch loglevel {\n\tcase \"debug\":\n\t\tlevel = zap.DebugLevel\n\tcase \"info\":\n\t\tlevel = zap.InfoLevel\n\tcase \"warn\":\n\t\tlevel = zap.WarnLevel\n\tcase \"error\":\n\t\tlevel = zap.ErrorLevel\n\tdefault:\n\t\tlevel = zap.InfoLevel\n\t}\n\tencoderConfig := zap.NewProductionEncoderConfig()\n\t// time format\n\tencoderConfig.EncodeTime = zapcore.ISO8601TimeEncoder\n\tcore := zapcore.NewCore(\n\t\tzapcore.NewConsoleEncoder(encoderConfig),\n\t\tzapcore.NewMultiWriteSyncer(zapcore.AddSync(os.Stdout), w), // this line enables log outputs to multiple destinations: log file/stdout\n\t\tlevel,\n\t)\n\n\tlogger := zap.New(core, zap.AddStacktrace(zap.ErrorLevel))\n\treturn logger\n}", "title": "" }, { "docid": "8e00d972ce9511aac51139db5383b2cc", "score": "0.6642208", "text": "func init() {\n\n\t// initialize logger\n\tlog.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)\n}", "title": "" }, { "docid": "6a1cc56ae6cc41771462e0b6661bdcca", "score": "0.6632025", "text": "func InitLogger(infoIO, warningIO, errorIO io.Writer, local bool) {\n\t// Omits time if running on Heroku\n\tvar lflags int\n\tif local {\n\t\tlflags = log.Ltime\n\t}\n\n\tInfo = log.New(infoIO, \"INFO: \", lflags)\n\tWarning = log.New(warningIO, \"WARNING: \", lflags)\n\tError = log.New(errorIO, \"ERROR: \", lflags)\n}", "title": "" }, { "docid": "686596d7775d0abf6fdd3f2914a5bcbb", "score": "0.6629718", "text": "func InitPackageLogger(pkgName string) *logrus.Logger {\n\n\tpkgLogLevel := DEFAULT_LOG_LEVEL //default log level\n\tisPackegeLevelDefined := false\n\n\tlogger := logrus.New()\n\tlogger.SetReportCaller(true)\n\n\tformatter := loggerFromat()\n\tlogger.SetFormatter(formatter)\n\n\tlogConf, errReadConfig := configs.ReadLogConfigs()\n\tif errReadConfig != nil {\n\t\tlogger.Error(\"Error loading log configuration. \", errReadConfig)\n\t}\n\n\t// Create the log file if doesn't exist. And append to it if it already exists.\n\t_, err := os.OpenFile(logConf.Logfile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)\n\n\tif err != nil {\n\t\t// Cannot open log file. Logging to stderr\n\t\tlogger.Error(\"failed to open logfile\", err)\n\t\tlogger.SetOutput(os.Stdout)\n\t} else {\n\t\t//log output set to stdout and file\n\t\tmultiWriter := io.MultiWriter(os.Stdout, setLogRotation(logConf.Logfile))\n\t\tlogger.SetOutput(multiWriter)\n\t}\n\n\tfor _, pkg := range logConf.Pkg {\n\t\tif pkg.Name == pkgName {\n\t\t\tpkgLogLevel = logLevelMapper(pkg.LogLevel)\n\t\t\tisPackegeLevelDefined = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !isPackegeLevelDefined {\n\t\tpkgLogLevel = logLevelMapper(logConf.LogLevel)\n\t}\n\n\tlogger.SetLevel(pkgLogLevel)\n\treturn logger\n}", "title": "" }, { "docid": "42d54717a7f5f10755e24cf7dc9a5d82", "score": "0.66280615", "text": "func Init(l *Log, lev LogLevel, opt LogOptions, logger LogOutput) {\n\t*l = (Log(logger) << logShiftLogger) |\n\t\t(Log(opt) << logShiftOpt) |\n\t\t(Log(uint8(lev)))\n}", "title": "" }, { "docid": "b22e4d17121edef859e42968eaac6ca7", "score": "0.66157013", "text": "func initLog(conf NodeConfig) {\n\tvar logPath string\n\tif conf.Logger.Appenders[FileLogAppender].Enabled {\n\t\t// initialize logfile\n\t\tlogPath = conf.Logger.Appenders[FileLogAppender].LogPath\n\t\tEnsureFolderExist(logPath[0:strings.LastIndex(logPath, \"/\")])\n\t\tlogfile, err := os.OpenFile(logPath, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0644)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tconf.Logger.Appenders[FileLogAppender].Output = logfile\n\t}\n\n\tlog.SetGlobalConfig(&conf.Logger)\n}", "title": "" }, { "docid": "6f1281284a7ea66bde85026473ef31ec", "score": "0.6609399", "text": "func loggingSetup(name, level string) {\n\tgrip.SetName(name)\n\tgrip.SetThreshold(level)\n}", "title": "" }, { "docid": "2398480a13f965ec2337937d14005113", "score": "0.6606443", "text": "func initLog(ctx *cli.Context) error {\n\tabsLogPath, _ := filepath.Abs(\"./_logs\")\n\tinstId := ctx.GlobalString(utils.InstIdFlag.Name)\n\tabsLogPath = absLogPath + \"/gridServer-\" + instId\n\tif err := os.MkdirAll(filepath.Dir(absLogPath), os.ModePerm); err != nil {\n\t\tfmt.Errorf(\"Error %v in create %s\", err, absLogPath)\n\t\treturn err\n\t}\n\tlvl := log.Lvl(ctx.GlobalInt(utils.VerbosityFlag.Name))\n\tfmt.Println(\"lvl:\", lvl)\n\tlog.LogRotate(absLogPath, lvl)\n\treturn nil\n}", "title": "" }, { "docid": "144714d86e43a815309b1fafbd861ac5", "score": "0.660501", "text": "func init() {\n\tlog = logging.MustGetLogger(\"sWAP\")\n\tvar format = \"%{color}%{level} %{time:Jan 02 15:04:05} %{shortfile}%{color:reset} ▶ %{message}\"\n\tvar logBackend = logging.NewLogBackend(os.Stderr, \"\", 0)\n\tlogBackendLeveled := logging.AddModuleLevel(logBackend)\n\tlogging.SetBackend(logBackendLeveled)\n\tlogging.SetFormatter(logging.MustStringFormatter(format))\n}", "title": "" }, { "docid": "55d51418e8a69c1da5b4ea07cc46608e", "score": "0.6604047", "text": "func initLoggingBackend(logFormatter logging.Formatter, output io.Writer) {\n\tbackend := logging.NewLogBackend(output, \"\", 0)\n\tbackendFormatter := logging.NewBackendFormatter(backend, logFormatter)\n\tlogging.SetBackend(backendFormatter).SetLevel(defaultLevel, \"\")\n}", "title": "" }, { "docid": "94bad660ba70685ca589fc307a5e4082", "score": "0.6599067", "text": "func InitLogger(config *ServerConfig) {\n\n\tconsoleLogLevel := config.Logging.ConsoleLogLevel\n\n\t// stdout handler\n\thandlers := []log15.Handler{}\n\tstdoutHandler := log15.LvlFilterHandler(\n\t\tgetLevel(consoleLogLevel),\n\t\tlog15.StreamHandler(os.Stdout, log15.TerminalFormat()),\n\t)\n\thandlers = append(handlers, stdoutHandler)\n\n\tif config.Logging.LogFile != \"\" {\n\t\tfileLogLevel := config.Logging.FileLogLevel\n\t\tfh, err := log15.FileHandler(config.Logging.LogFile, log15.LogfmtFormat())\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error creating log file: \" + err.Error())\n\t\t\tos.Exit(1)\n\t\t}\n\t\tfileHandler := log15.LvlFilterHandler(getLevel(fileLogLevel), fh)\n\t\thandlers = append(handlers, fileHandler)\n\t}\n\n\trootHandler = log15.MultiHandler(handlers...)\n\n\t// By setting handlers on the root, we handle events from all loggers.\n\tlog15.Root().SetHandler(rootHandler)\n}", "title": "" }, { "docid": "847e2db64939585a903272655610c217", "score": "0.6598438", "text": "func LoggerInit(logDir string) {\n\tdataFilename := \"data.log\"\n\tif logDir != \"\" {\n\t\tdataFilename = logDir + \"/\" + dataFilename\n\t}\n\n\tdataLog, e := NewBufferLog(10000, dataFilename)\n\tif e != nil {\n\t\tfmt.Println(\"init logger error!\")\n\t\tos.Exit(500)\n\t}\n\n\terrorFn := \"error.log\"\n\tif logDir != \"\" {\n\t\terrorFn = logDir + \"/\" + errorFn\n\t}\n\n\terrorLog, e := NewBufferLog(10000, errorFn)\n\tif e != nil {\n\t\tfmt.Println(\"init logger error!\")\n\t\tos.Exit(500)\n\t}\n\n\tdebugLogger, err := NewAsyncLogger(\"DEBUG:\", dataLog)\n\tif err != nil {\n\t\tfmt.Println(\"init logger error!\")\n\t\tos.Exit(500)\n\t}\n\n\twarnLogger, err := NewAsyncLogger(\"WARN:\", dataLog)\n\tinfoLogger, err := NewAsyncLogger(\"INFO:\", dataLog)\n\n\terrorLogger, e := NewAsyncLogger(\"ERROR:\", errorLog)\n\n\tLogger = &MultiLogger{\n\t\tdebugLogger: debugLogger,\n\t\twarnLogger: warnLogger,\n\t\tinfoLogger: infoLogger,\n\t\terrorLogger: errorLogger,\n\t}\n\n\tgo dataLog.writeFile()\n\n\tgo errorLog.writeFile()\n}", "title": "" }, { "docid": "7620f91fb634b8de023ccac2eb9e0e1f", "score": "0.65915465", "text": "func LogInit(logLevel *string, logFile *string, defaultLogFile string, configFile *string) bool {\n\tusingConfigDefaults := false\n\tc, err := load(*configFile)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tusingConfigDefaults = true // no .conf file, so using defaults\n\t\t\tc = Config{}\n\t\t\tsetDefaults(&c)\n\t\t} else {\n\t\t\tpanic(fmt.Sprintf(\"Failed to load config file %s: %v\",\n\t\t\t\t*configFile, err))\n\t\t}\n\t}\n\n\tpath := c.LogPath\n\tif path == \"\" {\n\t\tpath = defaultLogFile\n\t}\n\n\tif logFile != nil {\n\t\tpath = *logFile\n\t}\n\tlog.SetOutput(&lumberjack.Logger{\n\t\tFilename: path,\n\t\tMaxSize: c.MaxLogSizeMb, // megabytes\n\t\tMaxAge: c.MaxLogAgeDays, // days\n\t})\n\n\tif *logLevel == \"\" {\n\t\t*logLevel = c.LogLevel\n\t}\n\n\tlevel, err := log.ParseLevel(*logLevel)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Failed to parse log level: %v\", err))\n\t}\n\n\tlog.SetFormatter(new(log_formatter.VmwareFormatter))\n\tlog.SetLevel(level)\n\n\tif usingConfigDefaults {\n\t\tlog.Info(\"No config file found. Using defaults.\")\n\t}\n\treturn usingConfigDefaults\n}", "title": "" }, { "docid": "457e99c8391850038c54fc984117e898", "score": "0.6589482", "text": "func InitLogger(logPath string, maxSize, maxAge, maxBackups int, compress bool, outToFile bool) {\n\twriteSyncer := getLogWriter(logPath, maxSize, maxAge, maxBackups, compress)\n\tencoder := getEncoder()\n\n\tcore := zapcore.NewCore(encoder, writeSyncer, zapcore.DebugLevel)\n\tLogger = zap.New(core, zap.AddCaller()).Sugar()\n}", "title": "" }, { "docid": "101569d26abebfd8377b003efb5179bb", "score": "0.65832895", "text": "func Init(logWriter io.Writer, logLevel, appName,env string) error {\n\tglobalLL := zerolog.InfoLevel\n\twr := diode.NewWriter(logWriter, 1000, 10*time.Millisecond, func(missed int) {\n\t\tfmt.Printf(\"Logger Dropped %d messages\", missed)\n\t})\n\tlogl := zerolog.New(wr)\n\n\tswitch logLevel {\n\tcase \"disable\":\n\t\tglobalLL = zerolog.Disabled\n\tcase \"error\":\n\t\tglobalLL = zerolog.ErrorLevel\n\tcase \"info\":\n\t\tglobalLL = zerolog.InfoLevel\n\tcase \"debug\":\n\t\tglobalLL = zerolog.DebugLevel\n\t\tzerolog.ErrorStackMarshaler = pkgerrors.MarshalStack\n\tdefault:\n\t\tlog.Printf(\"unknown log level %v, I know levels: disable,error,info,debug. Setting default level:info\\n\", logLevel)\n\t}\n\n\tzerolog.MessageFieldName = \"short_message\"\n\tzerolog.ErrorFieldName = \"short_message\"\n\tzerolog.ErrorStackFieldName = \"full_message\"\n\tzerolog.LevelFieldName = \"loglevel\"\n\tzerolog.SetGlobalLevel(globalLL)\n\thost, err := os.Hostname()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlogl = logl.With().Timestamp().Float64(\"version\", 1.1).\n\t\tStr(\"host\", host).\n\t\tStr(\"_app\", appName).Str(\"_env\", env) /*.Int64(\"timestamp\", time.Now().Unix())*/ .Logger().Level(globalLL)\n\n\tlogger = &logWrapper{\n\t\tlogCore: &logl,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7f988e4f4dfa2ffb26de1fc5eb6672fc", "score": "0.65778226", "text": "func InitializeLogger() {\n\tloggerInitializeOnce.Do(func() {\n\t\thumanEncoder := zapcore.NewConsoleEncoder(zap.NewDevelopmentEncoderConfig())\n\n\t\t// Output streams\n\t\t// TODO(coryrc): also open a log file if in Prow?\n\t\tstdOut := zapcore.Lock(os.Stdout)\n\n\t\t// Level function helper\n\t\tzapLevel := zapLevelFromLogrLevel(verbosity)\n\t\tisPriority := zap.LevelEnablerFunc(func(lvl zapcore.Level) bool {\n\t\t\treturn lvl >= zapLevel\n\t\t})\n\n\t\t// Assemble the output streams\n\t\tzapCore = zapcore.NewTee(\n\t\t\t// TODO(coryrc): log JSON output somewhere?\n\t\t\tzapcore.NewCore(humanEncoder, stdOut, isPriority),\n\t\t)\n\n\t\tlogger = zap.New(zapCore)\n\t\tzap.ReplaceGlobals(logger) // Gets used by klog/glog proxy libraries\n\n\t\t// Set klog/glog verbosities (works with and without proxy libraries)\n\t\tklogLevel := klog.Level(0)\n\t\tklogLevel.Set(strconv.Itoa(verbosity))\n\n\t\tif verbosity > 2 {\n\t\t\tprintFlags()\n\t\t}\n\t})\n}", "title": "" }, { "docid": "2ebbc176a63f1038ce6c26bc518682e2", "score": "0.6573067", "text": "func newInit(opt *Option) error {\n\tvar (\n\t\tlgr [5]Logger\n\t\terr error\n\t\tisDev = env.IsDevelopment()\n\t)\n\n\tcfg := &logger.Config{\n\t\tLevel: InfoLevel,\n\t\tTimeFormat: logger.DefaultTimeFormat,\n\t\tUseColor: isDev,\n\t\tUseJSON: !isDev,\n\t}\n\tif opt != nil {\n\t\tcfg.Level = logger.StringToLevel(opt.Level)\n\t\tcfg.TimeFormat = opt.TimeFormat\n\t\tcfg.Caller = opt.Caller\n\t\tcfg.CallerSkip = opt.CallerSkip\n\t}\n\n\tfor i := DebugLevel; i <= FatalLevel; i++ {\n\t\tlgr[i], err = zerolog.New(cfg, withOutputFile(opt.Output.at(i)))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsetLoggers(lgr[0], lgr[1], lgr[2], lgr[3], lgr[4])\n\n\treturn nil\n}", "title": "" }, { "docid": "b6ae03c1f8c7995ac3317472af402a57", "score": "0.6566694", "text": "func init() {\n log.SetFlags(FLogFlags)\n}", "title": "" }, { "docid": "01f61b37d47a7b4a24c1da92fdc67c86", "score": "0.6555209", "text": "func Init() *log.Logger {\n\tif Log != nil {\n\t\treturn Log\n\t}\n\tc := config.GetConfig()\n\tlog.SetLevel(log.DebugLevel)\n\tLog = log.New()\n\tlogFile := c.GetString(\"LOG_FILE\")\n\tCustomFormatter := new(log.TextFormatter)\n\tCustomFormatter.TimestampFormat = \"2006-01-02 15:04:05\"\n\tCustomFormatter.FullTimestamp = true\n\tLog.Formatter = CustomFormatter\n\n\tLog.Hooks.Add(lfshook.NewHook(lfshook.PathMap{\n\t\tlog.InfoLevel: logFile,\n\t\tlog.ErrorLevel: logFile,\n\t\tlog.WarnLevel: logFile,\n\t\tlog.DebugLevel: logFile,\n\t}))\n\treturn Log\n}", "title": "" }, { "docid": "4c9300e30cac0347a32b2cc51e5e83da", "score": "0.6526812", "text": "func InitLogger(level zapcore.Level, isConsole bool, logpath string) {\n\t// once ensures the singleton is initialized only once\n\tonceLogger.Do(func() {\n\t\tlogger = initLogger(level, isConsole, logpath)\n\t})\n\n\treturn\n}", "title": "" }, { "docid": "65ecac35446292169dd5466221789675", "score": "0.6521324", "text": "func (s *Session) InitLogger() {\n\ts.Out = &Logger{}\n\ts.Out.SetDebug(s.Debug)\n\ts.Out.SetSilent(s.Silent)\n}", "title": "" }, { "docid": "a97c63ed4604f013644bab36de3342cb", "score": "0.651823", "text": "func Init(logger *logging.Logger) {\n\tlog = logger\n}", "title": "" }, { "docid": "372631c99977afc8b45f85dcd18edff8", "score": "0.6511839", "text": "func InitDefaultLogger(output string, level Level) error {\n\tDefaultLogger = &logger{\n\t\tOutput: output,\n\t\tLevel: level,\n\t\tRoller: DefaultRoller(),\n\t\tfileMux: new(sync.RWMutex),\n\t}\n\n\tloggers = append(loggers, DefaultLogger)\n\n\treturn DefaultLogger.Start()\n}", "title": "" }, { "docid": "dd321d1fc6fead9b19a3f4590ccc25c9", "score": "0.65111643", "text": "func init() {\n\tlog = logging.MustGetLogger(\"views\")\n\tvar format = \"%{color}%{level} %{time:Jan 02 15:04:05} %{shortfile}%{color:reset} ▶ %{message}\"\n\tvar logBackend = logging.NewLogBackend(os.Stderr, \"\", 0)\n\tlogBackendLeveled := logging.AddModuleLevel(logBackend)\n\tlogging.SetBackend(logBackendLeveled)\n\tlogging.SetFormatter(logging.MustStringFormatter(format))\n}", "title": "" } ]
716ac078043cfd6d55b1c1528089f935
Specifies the maximum number of resources to return in the response.
[ { "docid": "8b8678974b99493d61005e4e7a09ef27", "score": "0.0", "text": "func (r ApiGetFabricPortPolicyListRequest) Top(top int32) ApiGetFabricPortPolicyListRequest {\n\tr.top = &top\n\treturn r\n}", "title": "" } ]
[ { "docid": "48065e20c3376ce69f35980cda41d43a", "score": "0.6762729", "text": "func (o CircuitBreakersResponseOutput) MaxRequests() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxRequests }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "34c51336d487916698a0c3e860619d08", "score": "0.65412897", "text": "func (o CircuitBreakersOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v CircuitBreakers) *int { return v.MaxRequests }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "bbe7c500a4660f31c299916ca0d63c1c", "score": "0.64409214", "text": "func (o ResourceLimitResponseOutput) Maximum() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ResourceLimitResponse) string { return v.Maximum }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "efa4b6372dc7dc221e3a1fd19176f062", "score": "0.6248626", "text": "func (o BackendResponseOutput) MaxConnections() pulumi.IntOutput {\n\treturn o.ApplyT(func(v BackendResponse) int { return v.MaxConnections }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "bcba436b1079a4ef5a2c1cc45b4f9b19", "score": "0.62042147", "text": "func Limit(limit int) RequestOption {\n\treturn Param(\"limit\", limit)\n}", "title": "" }, { "docid": "71bd6e612db4c5fb1c97e82393abe041", "score": "0.61798805", "text": "func (o HttpReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "8b37e7e4ed7795a6b79fada959423b24", "score": "0.6130044", "text": "func (r ApiLocationsGetRequest) MaxResults(maxResults int32) ApiLocationsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "7e48b5cf2fd927c4eb6d0073f5c98b1e", "score": "0.6129272", "text": "func (r ApiDatacentersServersGetRequest) MaxResults(maxResults int32) ApiDatacentersServersGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "ee20f53a01e79bcd8b0e2ee79f5449a1", "score": "0.6122576", "text": "func (o CircuitBreakersPtrOutput) MaxRequests() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v *CircuitBreakers) *int {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.MaxRequests\n\t}).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a046a6499cbc2201d45e42d3e2fff3ed", "score": "0.61181444", "text": "func (r ApiDatacentersServersRemoteConsoleGetRequest) MaxResults(maxResults int32) ApiDatacentersServersRemoteConsoleGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "b88dc1737c73ce9df9d6b929aad95565", "score": "0.61100996", "text": "func (o AzureBlobStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "533da411e7c53d0907736ea967b8d84e", "score": "0.61036515", "text": "func (o RestSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "37ccfc59b007aab818b0f1c6994132b8", "score": "0.6091498", "text": "func (r ApiDatacentersServersTokenGetRequest) MaxResults(maxResults int32) ApiDatacentersServersTokenGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "df182acd339c331323c614bac8ceed14", "score": "0.6078245", "text": "func (o CircuitBreakersResponseOutput) MaxConnections() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxConnections }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "a7a928085c36d4aa803fd9a329a1a587", "score": "0.6072555", "text": "func (o OracleCloudStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v OracleCloudStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "47f53eeea9a194ea017ad9b784b00812", "score": "0.60634285", "text": "func (o AzureBlobFSReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "1137a5d292aa639b62ef0a7aaf9c5e4e", "score": "0.6059936", "text": "func (o AzureFileStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureFileStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5162122cbdad8db5ed6d796f8210c6a8", "score": "0.6053057", "text": "func (_options *ListResourceKeysOptions) SetLimit(limit int64) *ListResourceKeysOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "09563f771b390d412aded820c28e2cf5", "score": "0.6049238", "text": "func (o AmazonS3CompatibleReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonS3CompatibleReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a4efa39182fdf84dd6420e0909160452", "score": "0.6034678", "text": "func (o RestSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v RestSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "31137ae08d3de253f29dac8de4cde571", "score": "0.6031081", "text": "func MaxConcurrentRequests(max int) Option {\n\treturn optionFunc(func(c *Cache) {\n\t\tif max > 0 {\n\t\t\tc.maxRequests = max\n\t\t}\n\t})\n}", "title": "" }, { "docid": "21a9052c2fedf10cfe1ce0a3a5843baf", "score": "0.60129946", "text": "func (r ApiTargetgroupsGetRequest) MaxResults(maxResults int32) ApiTargetgroupsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "c633cce882880f3ee28d8ac519ff0b76", "score": "0.60063946", "text": "func (o GooglePrivacyDlpV2BigQueryOptionsResponseOutput) RowsLimit() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GooglePrivacyDlpV2BigQueryOptionsResponse) string { return v.RowsLimit }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d77c5b588c8b888b709b8b2e298c4226", "score": "0.6005585", "text": "func WithLimit(n int64) clientv3.OpOption { return clientv3.WithLimit(n) }", "title": "" }, { "docid": "767e9f874d6e346b008039074c2c1bd8", "score": "0.6004614", "text": "func MaxRequestRetries(max int) Option {\n\treturn optionFunc(func(c *Cache) {\n\t\tif max > 0 {\n\t\t\tc.maxRetries = max\n\t\t}\n\t})\n}", "title": "" }, { "docid": "7b4e76f2427fa52e32026f691e54a27d", "score": "0.5997561", "text": "func (o AzureDataLakeStoreReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c669628ba2b3aefa0d669786de67666e", "score": "0.5991525", "text": "func MaxOpenConnections(maximum int) Option {\n\treturn func(options *ClientOptions) error {\n\t\toptions.MaxOpenConnections = maximum\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "ebd871e54af1539b4ebb2599e2f3aaa2", "score": "0.59861505", "text": "func (c *ReportsGenerateCall) MaxResults(maxResults int64) *ReportsGenerateCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "8a69b79d6c464c22460e869a5a20e5f3", "score": "0.59793305", "text": "func (o FileServerReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileServerReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c668f936e17a84d3cd038d276d5de7b5", "score": "0.59762985", "text": "func (_options *ListResourceBindingsOptions) SetLimit(limit int64) *ListResourceBindingsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "28e2e167c485141978368fbbb794e17b", "score": "0.5967543", "text": "func (r ApiDatacentersServersNicsFlowlogsGetRequest) MaxResults(maxResults int32) ApiDatacentersServersNicsFlowlogsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "610ceaa8778c2839d59cba4d659d7a8c", "score": "0.5962972", "text": "func (o AmazonS3ReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonS3ReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "016dc5c488da762331d90d9113be4e93", "score": "0.59614104", "text": "func (s *Stat) MaxResources() int32 {\n\treturn s.maxResources\n}", "title": "" }, { "docid": "016dc5c488da762331d90d9113be4e93", "score": "0.59614104", "text": "func (s *Stat) MaxResources() int32 {\n\treturn s.maxResources\n}", "title": "" }, { "docid": "a406adc2bbe30aaf80be8dbb9d5c1564", "score": "0.5950523", "text": "func (o AzureBlobFSSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "03c2bfac48ef15fa68c8b76e5252ad7b", "score": "0.59466714", "text": "func (o CircuitBreakersResponseOutput) MaxRequestsPerConnection() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxRequestsPerConnection }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "262cfdcb653e37bfeae97646aa447394", "score": "0.59457916", "text": "func (r ApiDatacentersServersCdromsGetRequest) MaxResults(maxResults int32) ApiDatacentersServersCdromsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "22b0487343f8360c5c030a94a7a4624f", "score": "0.59407496", "text": "func (o CircuitBreakersResponseOutput) MaxPendingRequests() pulumi.IntOutput {\n\treturn o.ApplyT(func(v CircuitBreakersResponse) int { return v.MaxPendingRequests }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "305c1a29f1048d76ebf66cab7ea34656", "score": "0.5938735", "text": "func (c *ReportsSavedGenerateCall) MaxResults(maxResults int64) *ReportsSavedGenerateCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "d4824af7880050d86f2648bcd08f944f", "score": "0.5936452", "text": "func (o HttpReadSettingsOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpReadSettings) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "4e5a747bb849a0e399810843a9a1d9ba", "score": "0.5935124", "text": "func (r ApiSnapshotsGetRequest) MaxResults(maxResults int32) ApiSnapshotsGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "f55ee77fde92f810e061f1b214417e77", "score": "0.593401", "text": "func (o GoogleCloudStorageReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v GoogleCloudStorageReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b65b2c05ccc0552b82b38b644104648a", "score": "0.5923652", "text": "func (o AzureBlobFSSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "c92a118ad52dd9a86391bad9c64bbb63", "score": "0.59206384", "text": "func (o ServiceComputeLoggingHttpOutput) RequestMaxEntries() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ServiceComputeLoggingHttp) *int { return v.RequestMaxEntries }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "a6c0f3b906639c37fac7d13aa771df53", "score": "0.59171444", "text": "func (o HttpSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HttpSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "14e56660bdf5b7f9350659573620828e", "score": "0.59109235", "text": "func (_Comptroller *ComptrollerSession) MaxAssets() (*big.Int, error) {\n\treturn _Comptroller.Contract.MaxAssets(&_Comptroller.CallOpts)\n}", "title": "" }, { "docid": "0290d863053fcc73ae1ebe4d6f84ea1c", "score": "0.59054893", "text": "func (o HdfsReadSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v HdfsReadSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "53023fd617fe86197ef84098e2fa07e5", "score": "0.5901157", "text": "func (o AzureBlobStorageWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobStorageWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "77058f1287b1619ccd7d6cf48505e090", "score": "0.5896162", "text": "func (_options *ListResourceKeysForInstanceOptions) SetLimit(limit int64) *ListResourceKeysForInstanceOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "5a0df1a6d81cffeffe4290eb7538c490", "score": "0.5882951", "text": "func (o ServiceVclLoggingHttpOutput) RequestMaxEntries() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v ServiceVclLoggingHttp) *int { return v.RequestMaxEntries }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "5aace8e8f46e15b81bcb3c3320cbe466", "score": "0.5882806", "text": "func (o MongoDbCursorMethodsPropertiesResponseOutput) Limit() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v MongoDbCursorMethodsPropertiesResponse) interface{} { return v.Limit }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "ff3433123feecd710742713136d6521b", "score": "0.58805805", "text": "func (o *Output) MaxSize() int { return 1024 * 1024 * 1024 }", "title": "" }, { "docid": "3d727c3e38cdba302cc58190e1fc6ee1", "score": "0.58805794", "text": "func (o CircuitBreakersOutput) MaxRequestsPerConnection() pulumi.IntPtrOutput {\n\treturn o.ApplyT(func(v CircuitBreakers) *int { return v.MaxRequestsPerConnection }).(pulumi.IntPtrOutput)\n}", "title": "" }, { "docid": "e03a1f850143422bd7616f11d17526e2", "score": "0.58742744", "text": "func (o CosmosDbMongoDbApiSourceResponseOutput) BatchSize() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSourceResponse) interface{} { return v.BatchSize }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "195d3d875b681e4afb11ffb9a368665d", "score": "0.587287", "text": "func (_options *ListResourceInstancesOptions) SetLimit(limit int64) *ListResourceInstancesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "c97310543738cf13bb1f404c2d820cba", "score": "0.5868095", "text": "func MaxConn(n int) Option {\n\treturn setServerOption(maxConnKey{}, n)\n}", "title": "" }, { "docid": "3503c8978455306c44b91682f69a4fb8", "score": "0.5864984", "text": "func MaxInFlight(count int) option {\n\treturn func(opts *clientOptions) {\n\t\topts.wsOptions = append(opts.wsOptions, ws.MaxInFlight(count))\n\t}\n}", "title": "" }, { "docid": "158564583c871838e82db43c0ddc8d51", "score": "0.58642364", "text": "func MaxConn(n int) server.Option {\n\treturn setServerOption(maxConnKey{}, n)\n}", "title": "" }, { "docid": "0a3bce249de5da5ba64abc046ec139ae", "score": "0.58528745", "text": "func (dm *Datamuse) Max(n uint) *Datamuse {\n\tdm.setQueryParam(\"max\", strconv.FormatUint(uint64(n), 10))\n\treturn dm\n}", "title": "" }, { "docid": "e94249e84a1c235e1e1f882da3dfe588", "score": "0.58526695", "text": "func (_Comptroller *ComptrollerCallerSession) MaxAssets() (*big.Int, error) {\n\treturn _Comptroller.Contract.MaxAssets(&_Comptroller.CallOpts)\n}", "title": "" }, { "docid": "585a23214a2a891d7136b8d22a29d2a4", "score": "0.5848998", "text": "func (o AmazonMWSSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AmazonMWSSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e114f050f7f7843c785e43fe346fe8da", "score": "0.5845684", "text": "func (c *ResourcesBuildingsListCall) MaxResults(maxResults int64) *ResourcesBuildingsListCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "26fbcd302c613c90bdaf16b2e8f5a5ad", "score": "0.58426964", "text": "func (o AzureFileStorageWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureFileStorageWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "17d8801aabf07b7f9aec82b70d6cc5d5", "score": "0.5841116", "text": "func (o AzureBlobFSWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureBlobFSWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2a4d07a0e769826c053ad6869f68f87b", "score": "0.5838915", "text": "func MaxIdleConnections(maximum int) Option {\n\treturn func(options *ClientOptions) error {\n\t\toptions.MaxIdleConnections = maximum\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "10f579b4a3465c20456e027dcd3c13c1", "score": "0.5836778", "text": "func (o SqlDWSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlDWSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "edf49b91eba214587875bd94763001bf", "score": "0.58339417", "text": "func MaxAllowed(n int) echo.MiddlewareFunc {\n\tsem := make(chan struct{}, n)\n\tacquire := func() { sem <- struct{}{} }\n\trelease := func() { <-sem }\n\treturn func(h echo.Handler) echo.Handler {\n\t\treturn echo.HandlerFunc(func(c echo.Context) error {\n\t\t\tacquire() // before request\n\t\t\terr := h.Handle(c)\n\t\t\trelease() // after request\n\t\t\treturn err\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ab0b7105f128b7f423d7a71ea3bf9822", "score": "0.58320177", "text": "func (r ApiDatacentersServersVolumesGetRequest) MaxResults(maxResults int32) ApiDatacentersServersVolumesGetRequest {\n\tr.maxResults = &maxResults\n\treturn r\n}", "title": "" }, { "docid": "3024ccda77d44b2c59348a7364fc6558", "score": "0.58192086", "text": "func (o WebSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v WebSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0260269959a6f3576f999509d68477f2", "score": "0.58077866", "text": "func (osd *OpenSearchDomains) MaxBatchSize() int {\n\treturn 10\n}", "title": "" }, { "docid": "800c00dfd7605bbada5778a972a0e894", "score": "0.5805002", "text": "func (o BlobSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e9d2fb809768a946126f94338f6cf782", "score": "0.5804381", "text": "func (o FileSystemSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "ccf13a3d733a75586086b6c79e7636d9", "score": "0.580222", "text": "func (o JsonSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "944e9ea67e8de33e3fdd6cfb057359a7", "score": "0.58012944", "text": "func WithMaxEntries(n int) Option {\n\treturn func(v *Buffer) {\n\t\tv.maxEntries = n\n\t}\n}", "title": "" }, { "docid": "7e5739638075dc0eddfa98a56a12c972", "score": "0.5796944", "text": "func (o ODataSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v ODataSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0300888226b4958d9026310d0eedf12f", "score": "0.5796215", "text": "func (o SqlMISourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "59027adb232d8835072d082968c61377", "score": "0.57872134", "text": "func (o SqlMISinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlMISinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "402f779d124fbcc6d961906868041027", "score": "0.5778671", "text": "func (o AzureDataLakeStoreWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "cbf5a6006983f312641fbe8a2e0be83a", "score": "0.57758635", "text": "func (o *SnapmirrorReleaseIterRequest) MaxRecords() int {\n\tvar r int\n\tif o.MaxRecordsPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.MaxRecordsPtr\n\treturn r\n}", "title": "" }, { "docid": "8aafedce846a47d644f989640efdc1c2", "score": "0.57722294", "text": "func (o CosmosDbMongoDbApiSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "faf9d6a9ac795a77bcedde5fddb000dd", "score": "0.57672995", "text": "func (o FileServerWriteSettingsResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileServerWriteSettingsResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5a858b6cb5ba7bd0d9adcddd04ed3f33", "score": "0.5759849", "text": "func (c *RegionViewsListresourcesCall) MaxResults(maxResults int64) *RegionViewsListresourcesCall {\n\tc.params_.Set(\"maxResults\", fmt.Sprintf(\"%v\", maxResults))\n\treturn c\n}", "title": "" }, { "docid": "b98eb40d483c2906ffb51dffe02fe5f2", "score": "0.5759482", "text": "func (o BlobSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v BlobSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5ce5623ed17aeeb5c4eff1abe5c0bbd9", "score": "0.5755678", "text": "func (o *IscsiInitiatorAuthGetIterRequest) MaxRecords() int {\n\tvar r int\n\tif o.MaxRecordsPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.MaxRecordsPtr\n\treturn r\n}", "title": "" }, { "docid": "5e225aa19dbf8020192b6562cbbc7185", "score": "0.5750585", "text": "func (_options *ListResourceBindingsForAliasOptions) SetLimit(limit int64) *ListResourceBindingsForAliasOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "5dd51c7dade8a10a11110c1bd9f2306b", "score": "0.57486176", "text": "func (o AzureDataExplorerSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataExplorerSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0963ba9e7b45a6144356009cfff33456", "score": "0.57476556", "text": "func (o AzureDataLakeStoreSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDataLakeStoreSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "2198b83a29e90d3e2abb97b538fc7e67", "score": "0.57469344", "text": "func (o AzureDatabricksDeltaLakeSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AzureDatabricksDeltaLakeSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0bce9c04cbeb0b90f055df73411a9981", "score": "0.5745558", "text": "func (o SalesforceServiceCloudSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SalesforceServiceCloudSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "85b41aea6c6f4df02542ff7df853198d", "score": "0.57447904", "text": "func (o SqlServerSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v SqlServerSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "a3fdc4227110998241f3efea34ff9287", "score": "0.5728279", "text": "func (o CosmosDbMongoDbApiSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbMongoDbApiSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "0c587150a9d55b2e5f1c559532c239ea", "score": "0.5726843", "text": "func (o CosmosDbSqlApiSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v CosmosDbSqlApiSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "b4a392271af96682c28fc58960567e1d", "score": "0.5725976", "text": "func Limit(amount int) RequestOption {\n\treturn func(o *requestOptions) {\n\t\to.urlParams.Set(\"limit\", strconv.Itoa(amount))\n\t}\n}", "title": "" }, { "docid": "6db14652716cf1b430319d24ed0c216d", "score": "0.5724448", "text": "func (o FileSystemSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v FileSystemSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "88e827bbdbaf6201196ccf1843ea9fb0", "score": "0.57219684", "text": "func MaxRows(maxRows int64) Option {\n\treturn MaxRowsConfig(maxRows)\n}", "title": "" }, { "docid": "a896a46ac661f4d77c4bc9ea53c0dc6e", "score": "0.5720217", "text": "func (p *Parameter) MaxItems(maxItems int64) *Parameter {\n\tp.data.MaxItems = &maxItems\n\treturn p\n}", "title": "" }, { "docid": "4b0f6678c55128e72977aed8fef75dcd", "score": "0.57189065", "text": "func (c *EntityUsageReportsGetCall) MaxResults(maxResults int64) *EntityUsageReportsGetCall {\n\tc.urlParams_.Set(\"maxResults\", fmt.Sprint(maxResults))\n\treturn c\n}", "title": "" }, { "docid": "a5dfe2c588a23c225ca629abee8a2af6", "score": "0.57148284", "text": "func TooManyRequests() *ErrorResponse {\n\treturn NewErrorResponse(\n\t\thttp.StatusTooManyRequests,\n\t\t\"TOO_MANY_REQUESTS\",\n\t\t\"The client has sent too many requests to the server.\",\n\t)\n}", "title": "" }, { "docid": "bbe58469da8a5d44103e7ce8b681a7b1", "score": "0.5712942", "text": "func SetMaxPrintRows(n int) {\n\tmaxPrintRows = n\n}", "title": "" }, { "docid": "40289e6be16a0fdffd01aca5ae3d8865", "score": "0.5712314", "text": "func (o AvroSinkResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v AvroSinkResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "5c08f25c5d15acc4a1ed6769771e52d8", "score": "0.57102144", "text": "func (o JsonSourceResponseOutput) MaxConcurrentConnections() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v JsonSourceResponse) interface{} { return v.MaxConcurrentConnections }).(pulumi.AnyOutput)\n}", "title": "" } ]
fd4ce84048be577a01d5da13833be034
mapNodeInfoFunc maps a nodeFunc to all nodes in the list in parallel if an error occurs during any of the nodeFuncs' execution, it is logged but not returned the return value is a clusterInfo map from node name to command to unparsed metric string
[ { "docid": "5e6c5b0bac27982cc7c8f1376238f5f8", "score": "0.818294", "text": "func mapNodeInfoFunc(nodes []cluster.Node, nodeF nodeFunc, policy *as.InfoPolicy, logger *zap.SugaredLogger) clusterInfo {\n\tnumNodes := len(nodes)\n\tres := make(clusterInfo, numNodes)\n\n\ttype nodeStats struct {\n\t\tname string\n\t\tmetrics metricsMap\n\t\terror error\n\t}\n\n\tvar wg sync.WaitGroup\n\tresChan := make(chan nodeStats, numNodes)\n\n\tfor _, nd := range nodes {\n\t\twg.Add(1)\n\t\tgo func(nd cluster.Node) {\n\t\t\tdefer wg.Done()\n\n\t\t\tname := nd.GetName()\n\t\t\tmetrics, err := nodeF(nd, policy)\n\t\t\tif err != nil {\n\t\t\t\tlogger.Errorf(\"mapNodeInfoFunc err: %w\", err)\n\t\t\t}\n\n\t\t\tns := nodeStats{\n\t\t\t\tname: name,\n\t\t\t\tmetrics: metrics,\n\t\t\t\terror: err,\n\t\t\t}\n\n\t\t\tresChan <- ns\n\t\t}(nd)\n\t}\n\n\twg.Wait()\n\tclose(resChan)\n\n\tfor ns := range resChan {\n\t\tres[ns.name] = ns.metrics\n\t}\n\n\treturn res\n}", "title": "" } ]
[ { "docid": "85ef4075db2e766917b1bdc111eee6ee", "score": "0.7059702", "text": "func (c *defaultASClient) useNodeFunc(nf nodeFunc) clusterInfo {\n\tvar res clusterInfo\n\n\tnodes := c.cluster.GetNodes()\n\n\tpolicy := as.NewInfoPolicy()\n\tpolicy.Timeout = c.policy.Timeout\n\n\tres = mapNodeInfoFunc(\n\t\tnodes,\n\t\tnf,\n\t\tpolicy,\n\t\tc.logger,\n\t)\n\n\treturn res\n}", "title": "" }, { "docid": "37cc0261530bb2c1cf99f57721a8a3f8", "score": "0.589853", "text": "func allNodeInfo(n cluster.Node, policy *as.InfoPolicy) (metricsMap, error) {\n\tvar res metricsMap\n\tcommands := defaultNodeInfoCommands\n\n\tres, err := n.RequestInfo(policy, commands...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn res, nil\n}", "title": "" }, { "docid": "fd1979dc7ff99fcec9045d98659b60dd", "score": "0.577762", "text": "func (ov *DataHandler) GetClusterNodeInfos() (model.ClusterNodeInfoList, error) {\n\tnodes := &corev1.NodeList{}\n\terr := ov.client.List(context.TODO(), nodes)\n\tif err != nil {\n\t\tklog.Errorf(\"GetClusterTotalResource Failed to list nodes\")\n\t\treturn model.ClusterNodeInfoList{}, err\n\t}\n\tvar clusterNodeInfos []model.ClusterNodeInfo\n\tfor _, node := range nodes.Items {\n\t\t// query pod list in node\n\t\tpodList := &corev1.PodList{}\n\t\terr = ov.client.List(context.TODO(), podList, &client.ListOptions{\n\t\t\tFieldSelector: fields.OneTermEqualSelector(IndexNodeName, node.Name),\n\t\t})\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"GetClusterNodeInfos Failed to get pod list on node: %v error: %v\", node.Name, err)\n\t\t\treturn model.ClusterNodeInfoList{}, err\n\t\t}\n\t\tpodsRequest := getPodRequest(podList, corev1.PodRunning)\n\t\tallocatable := node.Status.Allocatable.DeepCopy()\n\n\t\tclusterNodeInfo := model.ClusterNodeInfo{\n\t\t\tNodeName: node.Name,\n\t\t\tInstanceType: getInstanceType(&node),\n\t\t\tGPUType: node.Labels[GPUType],\n\t\t\tTotalCPU: allocatable.Cpu().MilliValue(),\n\t\t\tTotalMemory: allocatable.Memory().Value(),\n\t\t\tTotalGPU: getGpu(allocatable).MilliValue(),\n\t\t\tRequestCPU: podsRequest.Cpu().MilliValue(),\n\t\t\tRequestMemory: podsRequest.Memory().Value(),\n\t\t\tRequestGPU: getGpu(podsRequest).MilliValue(),\n\t\t}\n\t\tclusterNodeInfos = append(clusterNodeInfos, clusterNodeInfo)\n\t}\n\n\t// sort by node name\n\tsort.SliceStable(clusterNodeInfos, func(i, j int) bool {\n\t\treturn clusterNodeInfos[i].NodeName > clusterNodeInfos[j].NodeName\n\t})\n\n\treturn model.ClusterNodeInfoList{Items: clusterNodeInfos}, nil\n}", "title": "" }, { "docid": "e29eea386e9bc964eb48ed1338fd5aa1", "score": "0.5654057", "text": "func (c *APIClient) NodeMetadataMapping(nodeName string, pods []*kubelet.Pod) error {\n\tendpointList, err := c.Cl.CoreV1().Endpoints(\"\").List(context.TODO(), metav1.ListOptions{TimeoutSeconds: &c.timeoutSeconds, ResourceVersion: \"0\"})\n\tif err != nil {\n\t\tlog.Errorf(\"Could not collect endpoints from the API Server: %q\", err.Error())\n\t\treturn err\n\t}\n\tif endpointList.Items == nil {\n\t\tlog.Debug(\"No endpoints collected from the API server\")\n\t\treturn nil\n\t}\n\tlog.Debugf(\"Successfully collected endpoints\")\n\n\tvar node v1.Node\n\tvar nodeList v1.NodeList\n\tnode.Name = nodeName\n\n\tnodeList.Items = append(nodeList.Items, node)\n\n\tprocessKubeServices(&nodeList, pods, endpointList)\n\treturn nil\n}", "title": "" }, { "docid": "cc2a94b306972971e82af292a85670da", "score": "0.5515991", "text": "func GetNodeInfo(cid uint64, nid uint64) NodeInfo {\n\treturn NodeInfo{ClusterID: cid, NodeID: nid}\n}", "title": "" }, { "docid": "f44b675c98a9a1c99f007edcf39852e3", "score": "0.5495875", "text": "func (mapper *clusterMapper) Map(obj handler.MapObject) []reconcile.Request {\n\tif klog.V(debugLevel) {\n\t\tfnName := dplutils.GetFnName()\n\t\tklog.Infof(\"Entering: %v()\", fnName)\n\n\t\tdefer klog.Infof(\"Exiting: %v()\", fnName)\n\t}\n\n\tcname := obj.Meta.GetName()\n\n\tklog.Info(\"In cluster Mapper for \", cname)\n\n\tplList := &chv1.ChannelList{}\n\n\tlistopts := &client.ListOptions{}\n\terr := mapper.List(context.TODO(), plList, listopts)\n\n\tif err != nil {\n\t\tklog.Error(err)\n\t}\n\n\tvar requests []reconcile.Request\n\n\tfor _, pl := range plList.Items {\n\t\tobjkey := types.NamespacedName{\n\t\t\tName: pl.GetName(),\n\t\t\tNamespace: pl.GetNamespace(),\n\t\t}\n\n\t\trequests = append(requests, reconcile.Request{NamespacedName: objkey})\n\t}\n\n\treturn requests\n}", "title": "" }, { "docid": "283ac6c1dff235532925e73ff6bc3cf2", "score": "0.5371335", "text": "func (ku *KubeUtil) GetNodeInfo(ctx context.Context) (string, string, error) {\n\tpods, err := ku.GetLocalPodList(ctx)\n\tif err != nil {\n\t\treturn \"\", \"\", fmt.Errorf(\"error getting pod list from kubelet: %s\", err)\n\t}\n\n\tfor _, pod := range pods {\n\t\tif pod.Status.HostIP == \"\" || pod.Spec.NodeName == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\treturn pod.Status.HostIP, pod.Spec.NodeName, nil\n\t}\n\n\treturn \"\", \"\", fmt.Errorf(\"failed to get node info, pod list length: %d\", len(pods))\n}", "title": "" }, { "docid": "e14c02c064c56a279cbd659325d9b1a8", "score": "0.52087337", "text": "func NodesMap(nodes []*xpb.NodeInfo) map[string]map[string][]byte {\n\tm := make(map[string]map[string][]byte, len(nodes))\n\tnodesMapInto(nodes, m)\n\treturn m\n}", "title": "" }, { "docid": "e14c02c064c56a279cbd659325d9b1a8", "score": "0.52087337", "text": "func NodesMap(nodes []*xpb.NodeInfo) map[string]map[string][]byte {\n\tm := make(map[string]map[string][]byte, len(nodes))\n\tnodesMapInto(nodes, m)\n\treturn m\n}", "title": "" }, { "docid": "06db957b7047e00bdfe85eef13a479e7", "score": "0.51484543", "text": "func (g *Graph) NodeMap() map[int64]*Node {\n\tnodes := make(map[int64]*Node)\n\tfor _, n := range g.Nodes() {\n\t\tnodes[n.ID()] = n.(*Node)\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "b4fba6a9348eb63440e98b22fd4fcc92", "score": "0.51234525", "text": "func GetNodeInfo(shardID uint64, replicaID uint64) NodeInfo {\n\treturn NodeInfo{ShardID: shardID, ReplicaID: replicaID}\n}", "title": "" }, { "docid": "336be2be407d80c31a3268d88c43b61e", "score": "0.5119008", "text": "func (k *Bootstrapper) applyNodeLabels(cfg config.ClusterConfig) error {\n\t// time cluster was created. time format is based on ISO 8601 (RFC 3339)\n\t// converting - and : to _ because of Kubernetes label restriction\n\tcreatedAtLbl := \"minikube.k8s.io/updated_at=\" + time.Now().Format(\"2006_01_02T15_04_05_0700\")\n\tverLbl := \"minikube.k8s.io/version=\" + version.GetVersion()\n\tcommitLbl := \"minikube.k8s.io/commit=\" + version.GetGitCommitID()\n\tnameLbl := \"minikube.k8s.io/name=\" + cfg.Name\n\n\t// ensure that \"primary\" label is applied only to the 1st node in the cluster (used eg for placing ingress there)\n\t// this is used to uniquely distinguish that from other nodes in multi-master/multi-control-plane cluster config\n\tprimaryLbl := \"minikube.k8s.io/primary=false\"\n\tif len(cfg.Nodes) <= 1 {\n\t\tprimaryLbl = \"minikube.k8s.io/primary=true\"\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), applyTimeoutSeconds*time.Second)\n\tdefer cancel()\n\t// example:\n\t// sudo /var/lib/minikube/binaries/<version>/kubectl label nodes minikube.k8s.io/version=<version> minikube.k8s.io/commit=aa91f39ffbcf27dcbb93c4ff3f457c54e585cf4a-dirty minikube.k8s.io/name=p1 minikube.k8s.io/updated_at=2020_02_20T12_05_35_0700 --all --overwrite --kubeconfig=/var/lib/minikube/kubeconfig\n\tcmd := exec.CommandContext(ctx, \"sudo\", kubectlPath(cfg),\n\t\t\"label\", \"nodes\", verLbl, commitLbl, nameLbl, createdAtLbl, primaryLbl, \"--all\", \"--overwrite\",\n\t\tfmt.Sprintf(\"--kubeconfig=%s\", path.Join(vmpath.GuestPersistentDir, \"kubeconfig\")))\n\n\tif _, err := k.c.RunCmd(cmd); err != nil {\n\t\tif ctx.Err() == context.DeadlineExceeded {\n\t\t\treturn errors.Wrapf(err, \"timeout apply labels\")\n\t\t}\n\t\treturn errors.Wrapf(err, \"applying node labels\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69af8ce4aeafb4068057df146e2781b6", "score": "0.5111533", "text": "func getClusterObjectsMap(clusterClient clusterclient.Client, listOptions *crtclient.ListOptions) (map[string]*clusterObjects, error) { // nolint:funlen\n\tvar clusters capi.ClusterList\n\terr := clusterClient.ListResources(&clusters, listOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get list of clusters\")\n\t}\n\n\tvar kcpList controlplanev1.KubeadmControlPlaneList\n\terr = clusterClient.ListResources(&kcpList, listOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get list of KubeadmControlPlane objects\")\n\t}\n\n\tvar mdList capi.MachineDeploymentList\n\terr = clusterClient.ListResources(&mdList, listOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get list of MachineDeployment objects\")\n\t}\n\n\tvar machineList capi.MachineList\n\terr = clusterClient.ListResources(&machineList, listOptions)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"unable to get list of Machine objects\")\n\t}\n\n\tclusterInfoMap := make(map[string]*clusterObjects)\n\n\tfor i := range clusters.Items {\n\t\tclusterObjectCombined := clusterObjects{cluster: clusters.Items[i]}\n\t\tkey := clusters.Items[i].Name + \"-\" + clusters.Items[i].Namespace\n\t\tclusterInfoMap[key] = &clusterObjectCombined\n\t}\n\n\tfor i := range kcpList.Items {\n\t\tclusterName, labelExists := kcpList.Items[i].GetLabels()[capi.ClusterLabelName]\n\t\tif !labelExists {\n\t\t\tcontinue\n\t\t}\n\t\tkey := clusterName + \"-\" + kcpList.Items[i].Namespace\n\t\tclusterObjectCombined, clusterExists := clusterInfoMap[key]\n\t\tif !clusterExists {\n\t\t\tlog.V(3).Infof(\"unable to find cluster object '%s' for KubeadmControlPlane object '%s'\", clusterName, kcpList.Items[i].Name)\n\t\t\tcontinue\n\t\t}\n\t\tclusterObjectCombined.kcp = kcpList.Items[i]\n\t}\n\n\tfor i := range mdList.Items {\n\t\tclusterName, labelExists := mdList.Items[i].GetLabels()[capi.ClusterLabelName]\n\t\tif !labelExists {\n\t\t\tcontinue\n\t\t}\n\t\tkey := clusterName + \"-\" + mdList.Items[i].Namespace\n\t\tclusterObjectCombined, clusterExists := clusterInfoMap[key]\n\t\tif !clusterExists {\n\t\t\tlog.V(3).Infof(\"unable to find cluster object '%s' for MachineDeployment object '%s'\", clusterName, mdList.Items[i].Name)\n\t\t\tcontinue\n\t\t}\n\t\tclusterObjectCombined.mds = append(clusterObjectCombined.mds, mdList.Items[i])\n\t}\n\n\tfor i := range machineList.Items {\n\t\tclusterName, labelExists := machineList.Items[i].GetLabels()[capi.ClusterLabelName]\n\t\tif !labelExists {\n\t\t\tcontinue\n\t\t}\n\t\tkey := clusterName + \"-\" + machineList.Items[i].Namespace\n\t\tclusterObjectCombined, clusterExists := clusterInfoMap[key]\n\t\tif !clusterExists {\n\t\t\tlog.V(3).Infof(\"unable to find cluster object '%s' for Machine object '%s'\", clusterName, machineList.Items[i].Name)\n\t\t\tcontinue\n\t\t}\n\t\tclusterObjectCombined.machines = append(clusterObjectCombined.machines, machineList.Items[i])\n\t}\n\n\treturn clusterInfoMap, nil\n}", "title": "" }, { "docid": "1c93c3cddd81bd5838df4147a3382bc7", "score": "0.51114184", "text": "func (r *RedisClusterReconciler) getNodeIPs(redisCluster *dbv1.RedisCluster) (map[string]string, error) {\n\tnodeIPs := make(map[string]string)\n\tpods, err := r.getRedisClusterPods(redisCluster)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor _, pod := range pods {\n\t\tnodeIPs[pod.Labels[\"node-number\"]] = pod.Status.PodIP\n\t}\n\treturn nodeIPs, nil\n}", "title": "" }, { "docid": "67486d836c64c36d5dd0822c2edf6277", "score": "0.5110113", "text": "func CollectNodeMetrics(nodeAllocatableResources map[string]int64,\n namespace string, podListOptions *metav1.ListOptions) []int {\n // prepare node allocatable&allocated resources\n nodeResources := map[string][]int64{}\n for nodeName, allocatableResourceValue := range nodeAllocatableResources {\n nodeResources[nodeName] = []int64{allocatableResourceValue, 0}\n }\n // get pods & update node metrics\n pods, _ := kubeclient.GetPods(namespace, podListOptions)\n if pods != nil {\n for _, pod := range pods.Items {\n nodeName := pod.Spec.NodeName\n if _, ok := nodeResources[nodeName]; ok {\n var allocatedResource int64\n if mem, ok := pod.Labels[cache.KeyMemRequest]; ok {\n quantity := resource.MustParse(mem)\n allocatedResource += quantity.MilliValue()\n }\n nodeResources[nodeName][1] += allocatedResource\n }\n }\n } else {\n fmt.Println(\"Get nil nodes\")\n }\n // calculate node metrics\n buckets := []int{0, 0, 0, 0, 0, 0, 0, 0, 0, 0}\n for nodeName, nodeResourceValues := range nodeResources {\n if len(nodeResourceValues) == 2 {\n ratio := float32(nodeResourceValues[1] * 10) / float32(nodeResourceValues[0])\n bucketIndex := int(ratio)\n buckets[bucketIndex] += 1\n } else {\n fmt.Println(\"No \", nodeName, len(nodeResourceValues))\n }\n }\n return buckets\n}", "title": "" }, { "docid": "12ed0a68c732fe79cd53409d36e6d2e1", "score": "0.5097715", "text": "func MapNodes(nodes []Node) map[string]Node {\n\tmNodes := make(map[string]Node, 0)\n\n\tfor _, v := range nodes {\n\t\tmNodes[v.Name] = v\n\t}\n\n\treturn mNodes\n}", "title": "" }, { "docid": "80d109b904149d4c979dcf16daf221fb", "score": "0.5062498", "text": "func (ns *node) NodeGetInfo(\n\tctx context.Context,\n\treq *csi.NodeGetInfoRequest,\n) (*csi.NodeGetInfoResponse, error) {\n\n\tnode, err := k8sapi.GetNode(ns.driver.config.Nodename)\n\tif err != nil {\n\t\tklog.Errorf(\"failed to get the node %s\", ns.driver.config.Nodename)\n\t\treturn nil, err\n\t}\n\t/*\n\t * The driver will support all the keys and values defined in the node's label.\n\t * if nodes are labeled with the below keys and values\n\t * map[beta.kubernetes.io/arch:amd64 beta.kubernetes.io/os:linux kubernetes.io/arch:amd64 kubernetes.io/hostname:pawan-node-1 kubernetes.io/os:linux node-role.kubernetes.io/worker:true openebs.io/zone:zone1 openebs.io/zpool:ssd]\n\t * The driver will support below key and values\n\t * {\n\t *\tbeta.kubernetes.io/arch:amd64\n\t *\tbeta.kubernetes.io/os:linux\n\t *\tkubernetes.io/arch:amd64\n\t *\tkubernetes.io/hostname:pawan-node-1\n\t *\tkubernetes.io/os:linux\n\t *\tnode-role.kubernetes.io/worker:true\n\t *\topenebs.io/zone:zone1\n\t *\topenebs.io/zpool:ssd\n\t * }\n\t */\n\n\ttopology := map[string]string{}\n\n\t// support topologykeys from env ALLOWED_TOPOLOGIES\n\tallowedTopologies := strings.Trim(os.Getenv(\"ALLOWED_TOPOLOGIES\"), \" \")\n\tif strings.ToLower(allowedTopologies) == \"all\" {\n\t\ttopology = node.Labels\n\t} else {\n\t\tallowedKeys := strings.Split(allowedTopologies, \",\")\n\t\tfor _, key := range allowedKeys {\n\t\t\tif key != \"\" {\n\t\t\t\tif value, ok := node.Labels[key]; ok {\n\t\t\t\t\ttopology[key] = value\n\t\t\t\t} else {\n\t\t\t\t\tklog.Warningf(\"failed to get value for topology key: %s\", key)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// add driver's topology key if not labelled already\n\tif _, ok := topology[zfs.ZFSTopologyKey]; !ok {\n\t\ttopology[zfs.ZFSTopologyKey] = ns.driver.config.Nodename\n\t}\n\t// add old topology key to support backward compatibility for velero\n\ttopology[zfs.ZFSTopoNodenameKey] = ns.driver.config.Nodename\n\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: ns.driver.config.Nodename,\n\t\tAccessibleTopology: &csi.Topology{\n\t\t\tSegments: topology,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "230f325fa4666d4eb642bf8c7e4aec37", "score": "0.5004005", "text": "func (e *Executor) mapReduce(ctx context.Context, index string, slices []uint64, c *pql.Call, opt *ExecOptions, mapFn mapFunc, reduceFn reduceFunc) (interface{}, error) {\n\tch := make(chan mapResponse, 0)\n\n\t// Wrap context with a cancel to kill goroutines on exit.\n\tctx, cancel := context.WithCancel(ctx)\n\tdefer cancel()\n\n\t// If this is the coordinating node then start with all nodes in the cluster.\n\t//\n\t// However, if this request is being sent from the coordinator then all\n\t// processing should be done locally so we start with just the local node.\n\tvar nodes []*Node\n\tif !opt.Remote {\n\t\tnodes = Nodes(e.Cluster.Nodes).Clone()\n\t} else {\n\t\tnodes = []*Node{e.Cluster.NodeByHost(e.Host)}\n\t}\n\n\t// Start mapping across all primary owners.\n\tif err := e.mapper(ctx, ch, nodes, index, slices, c, opt, mapFn, reduceFn); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Iterate over all map responses and reduce.\n\tvar result interface{}\n\tvar maxSlice int\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, ctx.Err()\n\t\tcase resp := <-ch:\n\t\t\t// On error retry against remaining nodes. If an error returns then\n\t\t\t// the context will cancel and cause all open goroutines to return.\n\t\t\tif resp.err != nil {\n\t\t\t\t// Filter out unavailable nodes.\n\t\t\t\tnodes = Nodes(nodes).Filter(resp.node)\n\n\t\t\t\t// Begin mapper against secondary nodes.\n\t\t\t\tif err := e.mapper(ctx, ch, nodes, index, resp.slices, c, opt, mapFn, reduceFn); err == errSliceUnavailable {\n\t\t\t\t\treturn nil, resp.err\n\t\t\t\t} else if err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Reduce value.\n\t\t\tresult = reduceFn(result, resp.result)\n\n\t\t\t// If all slices have been processed then return.\n\t\t\tmaxSlice += len(resp.slices)\n\t\t\tif maxSlice >= len(slices) {\n\t\t\t\treturn result, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36aaa4fea4d11da396633772a7b21ec7", "score": "0.5000115", "text": "func NodeInfo() []Node {\n\tvar Nodes []Node\n\n\toutput, _ := exec.Command(\"kubectl\", \"get\", \"nodes\", \"-o\", \"wide\").Output()\n\tline := strings.Split(string(output), \"\\n\")\n\tline = line[1:]\n\n\tfor _, detail := range line {\n\n\t\tfield := strings.Split(detail, \" \")\n\n\t\tvar tmp []string\n\t\tfor _, text := range field {\n\t\t\tif strings.TrimSpace(text) != \"\" {\n\t\t\t\ttmp = append(tmp, text)\n\t\t\t}\n\t\t}\n\n\t\tif len(tmp) > 0 {\n\t\t\tNodes = append(Nodes, Node{\n\t\t\t\tName: strings.TrimSpace(tmp[0]),\n\t\t\t\tStatus: strings.TrimSpace(tmp[1]),\n\t\t\t\tRole: strings.TrimSpace(tmp[2]),\n\t\t\t\tAge: strings.TrimSpace(tmp[3]),\n\t\t\t\tVersion: strings.TrimSpace(tmp[4]),\n\t\t\t\tInternalIP: strings.TrimSpace(tmp[5]),\n\t\t\t\tExternalIP: strings.TrimSpace(tmp[6]),\n\t\t\t\tOSImage: strings.TrimSpace(tmp[7]),\n\t\t\t\tKernelVer: strings.TrimSpace(tmp[8]),\n\t\t\t\tContainerRunTime: strings.TrimSpace(tmp[9]),\n\t\t\t})\n\t\t}\n\t}\n\treturn Nodes\n}", "title": "" }, { "docid": "2a9a2a6f1286cf250854f4588260f6f9", "score": "0.4980221", "text": "func (d *jsiiProxy_Domain) MetricNodes(props *awscloudwatch.MetricOptions) awscloudwatch.Metric {\n\tvar returns awscloudwatch.Metric\n\n\t_jsii_.Invoke(\n\t\td,\n\t\t\"metricNodes\",\n\t\t[]interface{}{props},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "86750299b38376181362317734ade155", "score": "0.4977136", "text": "func BenchmarkGetNode_25_Nodes(b *testing.B) {\n\tbaselineBenchmark(5, 5)(b)\n}", "title": "" }, { "docid": "cc8734fa3b31672d422c9252f039e712", "score": "0.49592566", "text": "func (p *CoreProvider) GetNodeMetrics(nodes ...string) ([]api.TimeInfo, []corev1.ResourceList, error) {\n\ttimeInfo := make([]api.TimeInfo, len(nodes))\n\tcoreMetrics := make([]corev1.ResourceList, len(nodes))\n\tresourceNames := make([]string, len(nodes))\n\n\tfor i := range nodes {\n\t\tresourceNames[i] = fmt.Sprintf(\"%q\", nodes[i])\n\t}\n\n\tcpuMetrics, cpuTimeInfo, err := p.client.getNodeCPU(nodes)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tramMetrics, _, err := p.client.getNodeRAM(nodes)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfor i, name := range nodes {\n\t\tcpu, ok := cpuMetrics[name]\n\t\tif !ok {\n\t\t\tklog.V(4).Infof(\"Metric cpu not found for node '%s'\", name)\n\t\t\tcontinue\n\t\t}\n\t\tram, ok := ramMetrics[name]\n\t\tif !ok {\n\t\t\tklog.V(4).Infof(\"Metric ram not found for node '%s'\", name)\n\t\t\tcontinue\n\t\t}\n\t\tcoreMetrics[i] = corev1.ResourceList{\n\t\t\tcorev1.ResourceCPU: cpu,\n\t\t\tcorev1.ResourceMemory: ram,\n\t\t}\n\t\ttimeInfo[i] = cpuTimeInfo[name]\n\t\tif !ok {\n\t\t\treturn nil, nil, apierr.NewInternalError(fmt.Errorf(\"TimeInfo should be set for every node with metrics\"))\n\t\t}\n\t}\n\treturn timeInfo, coreMetrics, nil\n}", "title": "" }, { "docid": "45c1e352de2ae42256c17b09cd007732", "score": "0.4950483", "text": "func (store *NodeInfoStorage) NodesMap() map[string]*Node {\n\tstore.RLock()\n\tstoreSize := len(store.nodes)\n\tresult := make(map[string]*Node, storeSize)\n\tfor key, value := range store.nodes {\n\t\tresult[key] = value\n\t}\n\tstore.RUnlock()\n\treturn result\n}", "title": "" }, { "docid": "a3874c00994e7cab4406732e4dc1a460", "score": "0.49502525", "text": "func (n Nodes) GetNodesByFunc(f FindNodeFunc) (Nodes, error) {\n\tnodes := Nodes{}\n\tfor _, node := range n {\n\t\tif f(node) {\n\t\t\tnodes = append(nodes, node)\n\t\t}\n\t}\n\tif len(nodes) == 0 {\n\t\treturn nodes, nodeNotFoundedError\n\t}\n\treturn nodes, nil\n}", "title": "" }, { "docid": "e718bdda4cc56c463090e9c25cbbb44e", "score": "0.4939369", "text": "func (it *IngressTranslator) computeIngressBackendNodePortMap(defaultBackendNodePort int32) IngressBackendNodePortMap {\n\t// Inject dklb as the default backend in case none is specified.\n\tif it.ingress.Spec.Backend == nil {\n\t\tit.ingress.Spec.Backend = &extsv1beta1.IngressBackend{\n\t\t\tServiceName: defaultBackendServiceName,\n\t\t\tServicePort: defaultBackendServicePort,\n\t\t}\n\t\tit.recorder.Eventf(it.ingress, corev1.EventTypeWarning, constants.ReasonNoDefaultBackendSpecified, \"%s will be used as the default backend since none was specified\", constants.ComponentName)\n\t}\n\t// backends is the slice containing all Ingress backends present in the current Ingress resource.\n\tbackends := make([]extsv1beta1.IngressBackend, 0)\n\t// Iterate over all Ingress backends, adding them to the slice of results.\n\tkubernetesutil.ForEachIngresBackend(it.ingress, func(_, _ *string, backend extsv1beta1.IngressBackend) {\n\t\tbackends = append(backends, backend)\n\t})\n\t// Create the map that we will be populating and returning.\n\tres := make(IngressBackendNodePortMap, len(backends))\n\t// Iterate over the set of Ingress backends, computing the target node port.\n\tfor _, backend := range backends {\n\t\t// If the target service's name corresponds to \"defaultBackendServiceName\", we use the default backend's node port.\n\t\tif backend.ServiceName == defaultBackendServiceName && backend.ServicePort == defaultBackendServicePort {\n\t\t\tres[backend] = defaultBackendNodePort\n\t\t\tcontinue\n\t\t}\n\t\tif nodePort, err := it.computeNodePortForIngressBackend(backend); err == nil {\n\t\t\tres[backend] = nodePort\n\t\t} else {\n\t\t\t// We've failed to compute the target node port for the current backend.\n\t\t\t// This may be caused by the specified Service resource being absent or not being of NodePort/LoadBalancer type.\n\t\t\t// Hence, we use the default backend's node port and report the error as an event, but do not fail.\n\t\t\tmsg := fmt.Sprintf(\"using the default backend in place of \\\"%s:%s\\\": %v\", backend.ServiceName, backend.ServicePort.String(), err)\n\t\t\tit.recorder.Eventf(it.ingress, corev1.EventTypeWarning, constants.ReasonInvalidBackendService, msg)\n\t\t\tit.logger.Warn(msg)\n\t\t\tres[backend] = defaultBackendNodePort\n\t\t}\n\t}\n\t// Return the populated map.\n\treturn res\n}", "title": "" }, { "docid": "e718bdda4cc56c463090e9c25cbbb44e", "score": "0.4939369", "text": "func (it *IngressTranslator) computeIngressBackendNodePortMap(defaultBackendNodePort int32) IngressBackendNodePortMap {\n\t// Inject dklb as the default backend in case none is specified.\n\tif it.ingress.Spec.Backend == nil {\n\t\tit.ingress.Spec.Backend = &extsv1beta1.IngressBackend{\n\t\t\tServiceName: defaultBackendServiceName,\n\t\t\tServicePort: defaultBackendServicePort,\n\t\t}\n\t\tit.recorder.Eventf(it.ingress, corev1.EventTypeWarning, constants.ReasonNoDefaultBackendSpecified, \"%s will be used as the default backend since none was specified\", constants.ComponentName)\n\t}\n\t// backends is the slice containing all Ingress backends present in the current Ingress resource.\n\tbackends := make([]extsv1beta1.IngressBackend, 0)\n\t// Iterate over all Ingress backends, adding them to the slice of results.\n\tkubernetesutil.ForEachIngresBackend(it.ingress, func(_, _ *string, backend extsv1beta1.IngressBackend) {\n\t\tbackends = append(backends, backend)\n\t})\n\t// Create the map that we will be populating and returning.\n\tres := make(IngressBackendNodePortMap, len(backends))\n\t// Iterate over the set of Ingress backends, computing the target node port.\n\tfor _, backend := range backends {\n\t\t// If the target service's name corresponds to \"defaultBackendServiceName\", we use the default backend's node port.\n\t\tif backend.ServiceName == defaultBackendServiceName && backend.ServicePort == defaultBackendServicePort {\n\t\t\tres[backend] = defaultBackendNodePort\n\t\t\tcontinue\n\t\t}\n\t\tif nodePort, err := it.computeNodePortForIngressBackend(backend); err == nil {\n\t\t\tres[backend] = nodePort\n\t\t} else {\n\t\t\t// We've failed to compute the target node port for the current backend.\n\t\t\t// This may be caused by the specified Service resource being absent or not being of NodePort/LoadBalancer type.\n\t\t\t// Hence, we use the default backend's node port and report the error as an event, but do not fail.\n\t\t\tmsg := fmt.Sprintf(\"using the default backend in place of \\\"%s:%s\\\": %v\", backend.ServiceName, backend.ServicePort.String(), err)\n\t\t\tit.recorder.Eventf(it.ingress, corev1.EventTypeWarning, constants.ReasonInvalidBackendService, msg)\n\t\t\tit.logger.Warn(msg)\n\t\t\tres[backend] = defaultBackendNodePort\n\t\t}\n\t}\n\t// Return the populated map.\n\treturn res\n}", "title": "" }, { "docid": "d30e7f57368d6f2102bb96ffa788e140", "score": "0.4935906", "text": "func (cntrlTopology *mockControllerVolumeTopology) GetTopologyInfoFromNodes(ctx context.Context,\n\treqParams interface{}) ([]map[string]string, error) {\n\tlog := logger.GetLogger(ctx)\n\treturn nil, logger.LogNewError(log, \"GetTopologyInfoFromNodes is not yet implemented.\")\n}", "title": "" }, { "docid": "b6d8e895279662aa359a37c9140d9b5a", "score": "0.49163646", "text": "func (c *Credentials) ClusterNodeIP(timeout ...int) ([]string, error) {\n\n\thttpTimeout := httpTimeout(timeout)\n\n\tapiRequest, err := c.Get(\"internal\", \"/cluster/me/node\", httpTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar nodeList []string\n\n\tfor _, v := range apiRequest.(map[string]interface{})[\"data\"].([]interface{}) {\n\t\tnodeList = append(nodeList, v.(interface{}).(map[string]interface{})[\"ipAddress\"].(string))\n\t}\n\n\treturn nodeList, nil\n}", "title": "" }, { "docid": "c94fe6945f826f6866bcb42156b35ddb", "score": "0.49074903", "text": "func MapFuncAddr(entryAddrs map[uint32]uint32, index uint32) (addr uint32) {\n\taddr, ok := entryAddrs[index]\n\tif !ok {\n\t\tpanic(index)\n\t}\n\treturn\n}", "title": "" }, { "docid": "297eea260a4f0ff5833ac986c3d910a2", "score": "0.49073616", "text": "func NewNodeInfoGetter(c clustersnapshot.ClusterSnapshot) *nodeInfoGetterImpl {\n\treturn &nodeInfoGetterImpl{c}\n}", "title": "" }, { "docid": "8acce9683eb9abb50949922ae4fca9cf", "score": "0.49063358", "text": "func NewNodeInfo() (*NodeInfo, error) {\n\tku, err := kubelet.GetKubeUtil()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnodeInfo := &NodeInfo{\n\t\tclient: ku,\n\t\tgetClusterAgentFunc: clusteragent.GetClusterAgentClient,\n\t\tapiserverNodeLabelsFunc: apiserverNodeLabels,\n\t}\n\n\treturn nodeInfo, nil\n}", "title": "" }, { "docid": "23db164a68c43dc431063d998c603459", "score": "0.49001744", "text": "func (c *defaultASClient) Info() clusterInfo {\n\tres := clusterInfo{}\n\n\t// NOTE this discards the command names\n\tmetricsToParse := c.useNodeFunc(allNodeInfo)\n\tfor node, commands := range metricsToParse {\n\t\tres[node] = metricsMap{}\n\t\tfor command, stats := range commands {\n\t\t\tps := parseStats(command, stats, \";\")\n\t\t\tmergeMetricsMap(res[node], ps, c.logger)\n\t\t}\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "025ca7f125922524684bb5d7332a0277", "score": "0.48979643", "text": "func mapNodeNameToMachine(nodes []corev1.Node, machines []objx.Map) (map[string]objx.Map, bool) {\n\tresult := map[string]objx.Map{}\n\tfor i := range nodes {\n\t\tfor j := range machines {\n\t\t\tif nodes[i].Name == nodeNameFromNodeRef(machines[j]) {\n\t\t\t\tresult[nodes[i].Name] = machines[j]\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn result, len(nodes) == len(result)\n}", "title": "" }, { "docid": "dcc835efdebb769f343485b703976907", "score": "0.48868456", "text": "func GetNodeInfo(nodeName string) (NodeInfo, error) {\n\n\tinfo := NodeInfo{}\n\n\tfor _, n := range nodeList.Node {\n\t\tif n.Name == nodeName {\n\t\t\tinfo = n\n\t\t}\n\t}\n\n\treturn info, nil\n}", "title": "" }, { "docid": "bdab1a552fa259ab6c1e44005b1fb661", "score": "0.4879415", "text": "func handleGetAddedNodeInfo(s *rpcServer, cmd interface{}, closeChan <-chan struct{}) (interface{}, error) {\n\tc := cmd.(*btcjson.GetAddedNodeInfoCmd)\n\n\t// Retrieve a list of persistent (added) peers from the server and\n\t// filter the list of peers per the specified address (if any).\n\tpeers := s.cfg.ConnMgr.PersistentPeers()\n\tif c.Node != nil {\n\t\tnode := *c.Node\n\t\tfound := false\n\t\tfor i, peer := range peers {\n\t\t\tif peer.ToPeer().Addr() == node {\n\t\t\t\tpeers = peers[i : i+1]\n\t\t\t\tfound = true\n\t\t\t}\n\t\t}\n\t\tif !found {\n\t\t\treturn nil, &btcjson.RPCError{\n\t\t\t\tCode: btcjson.ErrRPCClientNodeNotAdded,\n\t\t\t\tMessage: \"Node has not been added\",\n\t\t\t}\n\t\t}\n\t}\n\n\t// Without the dns flag, the result is just a slice of the addresses as\n\t// strings.\n\tif !c.DNS {\n\t\tresults := make([]string, 0, len(peers))\n\t\tfor _, peer := range peers {\n\t\t\tresults = append(results, peer.ToPeer().Addr())\n\t\t}\n\t\treturn results, nil\n\t}\n\n\t// With the dns flag, the result is an array of JSON objects which\n\t// include the result of DNS lookups for each peer.\n\tresults := make([]*btcjson.GetAddedNodeInfoResult, 0, len(peers))\n\tfor _, rpcPeer := range peers {\n\t\t// Set the \"address\" of the peer which could be an ip address\n\t\t// or a domain name.\n\t\tpeer := rpcPeer.ToPeer()\n\t\tvar result btcjson.GetAddedNodeInfoResult\n\t\tresult.AddedNode = peer.Addr()\n\t\tresult.Connected = btcjson.Bool(peer.Connected())\n\n\t\t// Split the address into host and port portions so we can do\n\t\t// a DNS lookup against the host. When no port is specified in\n\t\t// the address, just use the address as the host.\n\t\thost, _, err := net.SplitHostPort(peer.Addr())\n\t\tif err != nil {\n\t\t\thost = peer.Addr()\n\t\t}\n\n\t\tvar ipList []string\n\t\tswitch {\n\t\tcase net.ParseIP(host) != nil, strings.HasSuffix(host, \".onion\"):\n\t\t\tipList = make([]string, 1)\n\t\t\tipList[0] = host\n\t\tdefault:\n\t\t\t// Do a DNS lookup for the address. If the lookup fails, just\n\t\t\t// use the host.\n\t\t\tips, err := btcdLookup(host)\n\t\t\tif err != nil {\n\t\t\t\tipList = make([]string, 1)\n\t\t\t\tipList[0] = host\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tipList = make([]string, 0, len(ips))\n\t\t\tfor _, ip := range ips {\n\t\t\t\tipList = append(ipList, ip.String())\n\t\t\t}\n\t\t}\n\n\t\t// Add the addresses and connection info to the result.\n\t\taddrs := make([]btcjson.GetAddedNodeInfoResultAddr, 0, len(ipList))\n\t\tfor _, ip := range ipList {\n\t\t\tvar addr btcjson.GetAddedNodeInfoResultAddr\n\t\t\taddr.Address = ip\n\t\t\taddr.Connected = \"false\"\n\t\t\tif ip == host && peer.Connected() {\n\t\t\t\taddr.Connected = directionString(peer.Inbound())\n\t\t\t}\n\t\t\taddrs = append(addrs, addr)\n\t\t}\n\t\tresult.Addresses = &addrs\n\t\tresults = append(results, &result)\n\t}\n\treturn results, nil\n}", "title": "" }, { "docid": "4acdded7d741e1b27c600e92d6d7ee4e", "score": "0.4870095", "text": "func (n *NodeInfo) GetNodeLabels(ctx context.Context) (map[string]string, error) {\n\tnodeName, err := n.client.GetNodename(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif config.Datadog.GetBool(\"cluster_agent.enabled\") {\n\t\tcl, err := n.getClusterAgentFunc()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn cl.GetNodeLabels(nodeName)\n\t}\n\treturn n.apiserverNodeLabelsFunc(ctx, nodeName)\n}", "title": "" }, { "docid": "8eeb5027dfece86a3f1d52205838f332", "score": "0.48538557", "text": "func parallelMap(js []pipeline.Job, fn jobFunc, pred jobPredicate) []string {\n\n\tcnt := 0\n\tcStr := make(chan string)\n\n\tfor _, j := range js {\n\t\tif pred(j) {\n\t\t\tcnt++\n\t\t\tgo fn(j, cStr)\n\n\t\t}\n\t}\n\n\tmsgs := []string{}\n\tfor i := 0; i < cnt; i++ {\n\t\tmsgs = append(msgs, <-cStr)\n\t}\n\treturn msgs\n}", "title": "" }, { "docid": "b68b48b17770bedcccc1b22330d81446", "score": "0.48511913", "text": "func (c *Cluster) SelectNodes(f func(n *Node) string) string {\n\tvar ret []string\n\tfor i := range c.Nodes {\n\t\tt := f(&(c.Nodes[i]))\n\t\tif len(t) > 0 {\n\t\t\tret = append(ret, t)\n\t\t}\n\t}\n\treturn strings.Join(ret, \",\")\n}", "title": "" }, { "docid": "9d347e6cf4c7a6e85d6f8d5da6a82c36", "score": "0.4848637", "text": "func GetNodeInfo(w http.ResponseWriter, r *http.Request) {\n\tif (*r).Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\tneighbourMap := db.GetDataBase()\n\tresp := model.Response{}\n\t// set Default value\n\tresp.Default()\n\n\tNodeNameMap, GraphData, err := neighbourMap.GenarateNetworkTopology()\n\n\tif err != nil {\n\t\tlog.Println(\"ERROR: Payload Error\", err)\n\t\tresp.InternalServerError()\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t} else {\n\t\tdata := make(map[string]interface{})\n\t\tdata[\"graphData\"] = GraphData\n\t\tdata[\"nodeNames\"] = NodeNameMap\n\n\t\tresp.Code = http.StatusOK\n\t\tresp.Message = \"Updated time: \"\n\t\tresp.Data = data\n\t\tw.WriteHeader(http.StatusOK)\n\n\t}\n\tjson.NewEncoder(w).Encode(resp)\n\n}", "title": "" }, { "docid": "9ee7a03cf7e7486f2cf7f7aaeb5144f6", "score": "0.48423368", "text": "func expandClusterNetworkingMap(c *Client, f map[string]ClusterNetworking, res *Cluster) (map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := make(map[string]interface{})\n\tfor k, item := range f {\n\t\ti, err := expandClusterNetworking(c, &item, res)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif i != nil {\n\t\t\titems[k] = i\n\t\t}\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "3c1bd0cc05008d5a8233e14d74561541", "score": "0.48400792", "text": "func MachinesForCluster(c client.Client, log logr.Logger) handler.Mapper {\n\treturn &machinesForCluster{\n\t\tClient: c,\n\t\tlog: log,\n\t}\n}", "title": "" }, { "docid": "7cc605dd6c99e386b74bff2b64fe9534", "score": "0.48359403", "text": "func LogClusterNodes(c clientset.Interface) error {\n\tnodeList, err := client.ListNodes(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tklog.Infof(\"Listing cluster nodes:\")\n\tfor i := range nodeList {\n\t\tvar internalIP, externalIP string\n\t\tisSchedulable := isNodeSchedulable(&nodeList[i]) && isNodeUntainted(&nodeList[i])\n\t\tfor _, address := range nodeList[i].Status.Addresses {\n\t\t\tif address.Type == corev1.NodeInternalIP {\n\t\t\t\tinternalIP = address.Address\n\t\t\t}\n\t\t\tif address.Type == corev1.NodeExternalIP {\n\t\t\t\texternalIP = address.Address\n\t\t\t}\n\t\t}\n\t\tklog.Infof(\"Name: %v, clusterIP: %v, externalIP: %v, isSchedulable: %v\", nodeList[i].ObjectMeta.Name, internalIP, externalIP, isSchedulable)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "271802376afdc5ea83c58814174b84e1", "score": "0.48218578", "text": "func (r Resources) FuncMap() map[string]interface{} {\n\tm := make(map[string]interface{})\n\tm[\"AppName\"] = r.AppName\n\tm[\"Bad0\"] = r.Bad0\n\tm[\"Bad1\"] = r.Bad1\n\tm[\"HelloWorld\"] = r.HelloWorld\n\tm[\"HelloX\"] = r.HelloX\n\tm[\"SelectorDetailsArray\"] = r.SelectorDetailsArray\n\tm[\"SelectorDetailsArray2\"] = r.SelectorDetailsArray2\n\tm[\"XHasYCats\"] = r.XHasYCats\n\tm[\"XHasYCats2\"] = r.XHasYCats2\n\tm[\"XRunsAroundYAndSingsZ\"] = r.XRunsAroundYAndSingsZ\n\treturn m\n}", "title": "" }, { "docid": "78e465fb17596a1b0e661effbd0784a7", "score": "0.48116434", "text": "func (a *WebSphereLibertyApplicationAffinity) GetNodeAffinityLabels() map[string]string {\n\treturn a.NodeAffinityLabels\n}", "title": "" }, { "docid": "b405a74f2c11cc86c832ff4f2872d813", "score": "0.47997797", "text": "func (nodeTopology *mockNodeVolumeTopology) GetNodeTopologyLabels(ctx context.Context, info *commoncotypes.NodeInfo) (\n\tmap[string]string, error) {\n\tlog := logger.GetLogger(ctx)\n\treturn nil, logger.LogNewError(log, \"GetNodeTopologyLabels is not yet implemented.\")\n}", "title": "" }, { "docid": "247850967321b9ff9c2d7c3bcbc70267", "score": "0.47821438", "text": "func (c *FakeK8SOrchestrator) GetNodeIDtoNameMap(ctx context.Context) map[string]string {\n\tnodeIDToNamesMap := make(map[string]string)\n\treturn nodeIDToNamesMap\n}", "title": "" }, { "docid": "d8450b7e1e4812bc694dd64c64daaac7", "score": "0.4781586", "text": "func expandClusterControlPlaneMap(c *Client, f map[string]ClusterControlPlane, res *Cluster) (map[string]interface{}, error) {\n\tif f == nil {\n\t\treturn nil, nil\n\t}\n\n\titems := make(map[string]interface{})\n\tfor k, item := range f {\n\t\ti, err := expandClusterControlPlane(c, &item, res)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif i != nil {\n\t\t\titems[k] = i\n\t\t}\n\t}\n\n\treturn items, nil\n}", "title": "" }, { "docid": "8d674f8890ebdff461a79ec59342b30b", "score": "0.47807735", "text": "func NodeInfo(cfg config.ServerConfig) (*pb.NodeInfo, error) {\n\tnode, err := nodeutil.GetNodeInfo(cfg.Node)\n\tnode.Addr = pb.Addr{\n\t\tBindAddr: cfg.Grpc.Addr,\n\t}\n\tif err != nil {\n\t\treturn node, err\n\t}\n\treturn node, nil\n}", "title": "" }, { "docid": "8e9f95dd8d28a319090f7162927b6cb9", "score": "0.47730884", "text": "func (sm ServicePortMap) HealthCheckNodePorts() map[types.NamespacedName]uint16 {\n\t// TODO: If this will appear to be computationally expensive, consider\n\t// computing this incrementally similarly to svcPortMap.\n\tports := make(map[types.NamespacedName]uint16)\n\tfor svcPortName, info := range sm {\n\t\tif info.HealthCheckNodePort() != 0 {\n\t\t\tports[svcPortName.NamespacedName] = uint16(info.HealthCheckNodePort())\n\t\t}\n\t}\n\treturn ports\n}", "title": "" }, { "docid": "7867044b20c2180a0cc5724ffee979bc", "score": "0.47643", "text": "func BenchmarkGetNode_1000_Nodes(b *testing.B) {\n\tbaselineBenchmark(250, 5)(b)\n}", "title": "" }, { "docid": "fc31188fd1f0354996d7019a2e524eee", "score": "0.47561383", "text": "func (this *RpcServer) GetNodeInfo(req *action.RpcBase, resp *action.RpcBase) error {\n\tresp.NodeInfo = this.node.GetNodeInfo()\n\tresp.Result = true\n\treturn nil\n}", "title": "" }, { "docid": "81b250d341737b755986d13fe12fc961", "score": "0.47559223", "text": "func (o LookupDatabaseClusterResultOutput) NodeCount() pulumi.IntOutput {\n\treturn o.ApplyT(func(v LookupDatabaseClusterResult) int { return v.NodeCount }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "b53e82e48db517eee92d4c349435fced", "score": "0.4753186", "text": "func (ctx *NodeContext) getJoinAddressFromKubernetesCluster() []string {\n\tvar kubeClient *kubernetes.Clientset\n\tvar err error\n\tkubeClient, kubeErr := ctx.getKubernetesClient()\n\tif kubeErr != nil {\n\t\tlog.Printf(\"[K8S-JOIN] Error while obtaining K8S apiserver contact info. Error=%s\", kubeErr.Error())\n\t\treturn []string{}\n\t}\n\t// Select all the pods with \"kademlia-node\" label and set the\n\t// limit to the number of such nodes.\n\tkademliaPodOptions := metaV1.ListOptions{\n\t\tLabelSelector: \"app:kademlia-node\",\n\t\tLimit: 10,\n\t}\n\t// Get the list of all nodes in namespace kademlia-k8s with label \"kademlia-node\"\n\tkademliaPodList, err := kubeClient.CoreV1().Pods(\"kademlia-k8s\").List(kademliaPodOptions)\n\tif err != nil {\n\t\tlog.Printf(\"[K8S-JOIN] Error while retrieving other kademlia nodes in the cluster. Error=%s\", err.Error())\n\t\treturn []string{}\n\t}\n\t// Once the list of pods with Kademlia label is obtained, find the running\n\t// nodes which can be contacted. TODO: Add pod status check and consider only\n\t// those which are currently running.\n\tkademliaPods := kademliaPodList.Items\n\tcontactNodes := make([]string, 0)\n\tfor _, kpod := range kademliaPods {\n\t\t// WARNING: There is an assumption here that all Kademlia nodes use\n\t\t// the same port for RPC which is true when running in a Kubernetes cluster.\n\t\tcontactAddress := fmt.Sprintf(\"%s:%d\", kpod.Status.PodIP, ctx.CurrentNodeInfo.Port)\n\t\tcontactNodes = append(contactNodes, contactAddress)\n\t}\n\treturn contactNodes\n}", "title": "" }, { "docid": "91cc166201749eaf741795e9505faeb9", "score": "0.474467", "text": "func BenchmarkGetNode_100_Nodes(b *testing.B) {\n\tbaselineBenchmark(20, 5)(b)\n}", "title": "" }, { "docid": "aaed7ec8bf86bf6929478be200397207", "score": "0.47399905", "text": "func helperGetNodes(ipPort string, miner MinerInfo, addrSet *[]net.Addr) bool {\n\tminersConnectedTo.Lock()\n\tdefer minersConnectedTo.Unlock()\n\tif minersConnectedTo.currentNumNeighbours < int(settings.MinNumMinerConnections) {\n\t\t//fmt.Println(\"Inside helper get node, ready to make RPC call\")\n\t\tcRPC, err := rpc.Dial(\"tcp\", ipPort)\n\t\tdefer cRPC.Close()\n\t\tif err != nil {\n\t\t\tfmt.Println(err.Error)\n\t\t}\n\n\t\terr = cRPC.Call(\"RServer.GetNodes\", miner.Key, addrSet)\n\t\tif err != nil {\n\t\t\texitOnError(miner.Address.String(), err)\n\t\t}\n\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b5007763f0690386021e7b2fdacada2a", "score": "0.4731335", "text": "func (o *SubscriptionMetrics) ComputeNodesMemory() *ClusterResource {\n\tif o != nil && o.bitmap_&4 != 0 {\n\t\treturn o.computeNodesMemory\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fea2c1301a514ee1fa32f14110eb21ab", "score": "0.47295347", "text": "func Map(length int, cb func(i int) Node) []Node {\n\tvar nodes []Node\n\tfor i := 0; i < length; i++ {\n\t\tnodes = append(nodes, cb(i))\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "002d2a5fdef108dca7def6e5b5e32f3e", "score": "0.47291565", "text": "func (r *systemResources) createClusterInfoMap() error {\n\tconfigMap := ops.MakeClusterInfoMap(r.Cluster)\n\t_, err := r.Client.CoreV1().ConfigMaps(constants.KubeSystemNamespace).\n\t\tCreate(context.TODO(), configMap, metav1.CreateOptions{})\n\tif err != nil {\n\t\treturn rigging.ConvertError(err)\n\t}\n\tr.Infof(\"Created %v config map.\", configMap.Name)\n\treturn nil\n}", "title": "" }, { "docid": "2d84afc9f0a568246cd324bd3b9c016d", "score": "0.4728135", "text": "func CompileMapping(nodes chan Nodes, names, regos chan Node) {\n\tvar ns Nodes\n\tfor {\n\t\tselect {\n\t\tcase n := <-names:\n\t\t\tif v, ok := ns.Get(n.MacAddress); ok {\n\t\t\t\tv.Hostname = n.Hostname\n\t\t\t\tv.LastUpdated = n.LastUpdated\n\t\t\t\tns.Update(n.MacAddress, v)\n\t\t\t} else {\n\t\t\t\tns.Update(n.MacAddress, n)\n\t\t\t}\n\t\tcase n := <-regos:\n\t\t\tif v, ok := ns.Get(n.MacAddress); ok {\n\t\t\t\tv.AccessPoint = n.AccessPoint\n\t\t\t\tv.RxSignal = n.RxSignal\n\t\t\t\tv.LastUpdated = n.LastUpdated\n\t\t\t\tns.Update(n.MacAddress, v)\n\t\t\t} else {\n\t\t\t\tns.Update(n.MacAddress, n)\n\t\t\t}\n\t\t}\n\t\tv, _ := ns.Get(\"8C:85:90:27:6D:3D\")\n\t\tfmt.Printf(\"compile: %p\\n\", &v)\n\t\tnodes <- ns\n\t}\n}", "title": "" }, { "docid": "305717889d73397dee07dd91fb333966", "score": "0.47274163", "text": "func (r *ResourceMetricsProvider) getMetricsParallel(resourceFunc queryResourceFromClustersFunc,\n\tmetricsFunc queryMetricsFromClustersFunc) ([]interface{}, error) {\n\tclusters, err := r.clusterLister.List(labels.Everything())\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to list clusters: %v\", err)\n\t\treturn nil, err\n\t}\n\n\t// step 1. Find out the target clusters in lister cache\n\tvar targetClusters []string\n\tfor _, cluster := range clusters {\n\t\tsci := r.informerManager.GetSingleClusterManager(cluster.Name)\n\t\tif sci == nil {\n\t\t\tklog.Errorf(\"Failed to get cluster(%s) manager\", cluster.Name)\n\t\t\tcontinue\n\t\t}\n\t\terr := resourceFunc(sci, cluster.Name)\n\t\tif err != nil {\n\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\tklog.Errorf(\"Failed to query resource in cluster(%s): %v\", cluster.Name, err)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\ttargetClusters = append(targetClusters, cluster.Name)\n\t}\n\n\tvar metrics []interface{}\n\tif len(targetClusters) == 0 {\n\t\treturn metrics, nil\n\t}\n\n\t// step 2. Query metrics from the filtered target clusters\n\tmetricsChanel := make(chan interface{})\n\n\tvar wg sync.WaitGroup\n\tfor _, clusterName := range targetClusters {\n\t\twg.Add(1)\n\n\t\tgo func(cluster string) {\n\t\t\tdefer wg.Done()\n\n\t\t\tsci := r.informerManager.GetSingleClusterManager(cluster)\n\t\t\tif sci == nil {\n\t\t\t\tklog.Errorf(\"Failed to get cluster(%s) manager\", cluster)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tmetrics, err := metricsFunc(sci, cluster)\n\t\t\tif err != nil {\n\t\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\t\tklog.Errorf(\"Failed to query metrics in cluster(%s): %v\", cluster, err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// If there are multiple metrics with same name, it's ok because it's an array instead of a map.\n\t\t\t// The HPA controller will calculate the average utilization with the array.\n\t\t\tmetricsChanel <- metrics\n\t\t}(clusterName)\n\t}\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(metricsChanel)\n\t}()\n\n\tfor {\n\t\tdata, ok := <-metricsChanel\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tmetrics = append(metrics, data)\n\t}\n\n\treturn metrics, nil\n}", "title": "" }, { "docid": "532e44097af983ef62b74d418d3a1c09", "score": "0.47213662", "text": "func GetNodesAddr(ctx context.Context) ([]string, error) {\n\targs := utils.PlanetCommand(Command(\"get\", \"nodes\",\n\t\t\"--output\",\n\t\t`jsonpath={.items[*].status.addresses[?(@.type==\"InternalIP\")].address}`))\n\tcmd := exec.CommandContext(ctx, args[0], args[1:]...)\n\n\tcmd.Stderr = utils.NewStderrLogger(log.WithField(\"cmd\", \"kubectl get nodes\"))\n\n\tout, err := cmd.Output()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err, \"%v : %v\", cmd, err)\n\t}\n\n\tnodes := strings.Fields(strings.TrimSpace(string(out)))\n\treturn nodes, nil\n}", "title": "" }, { "docid": "2010df84b1ca9dc56641c2e91f642ba5", "score": "0.4718042", "text": "func (ctx ConfigCtx) FuncMap() template.FuncMap {\n\treturn template.FuncMap{\n\t\t\"ConfigOption\": ctx.configOption,\n\t\t\"ConfigOptionName\": ctx.configOptionName,\n\t\t\"ConfigOptionIndex\": ctx.configOptionIndex,\n\t\t\"ConfigOptionData\": ctx.configOptionData,\n\t\t\"ConfigOptionFilename\": ctx.configOptionFilename,\n\t\t\"ConfigOptionEquals\": ctx.configOptionEquals,\n\t\t\"ConfigOptionNotEquals\": ctx.configOptionNotEquals,\n\t\t\"LocalRegistryAddress\": ctx.localRegistryAddress,\n\t\t\"LocalRegistryHost\": ctx.localRegistryHost,\n\t\t\"LocalRegistryNamespace\": ctx.localRegistryNamespace,\n\t\t\"LocalImageName\": ctx.localImageName,\n\t\t\"LocalRegistryImagePullSecret\": ctx.localRegistryImagePullSecret,\n\t\t\"ImagePullSecretName\": ctx.imagePullSecretName,\n\t\t\"HasLocalRegistry\": ctx.hasLocalRegistry,\n\t}\n}", "title": "" }, { "docid": "968d416f1e4719fba99c266415106d3b", "score": "0.47176602", "text": "func JoinNodesToCluster(mgr *manager.Manager, node *kubekeyapiv1alpha1.HostCfg) error {\n\tif !ExistNode(node) {\n\t\tif node.IsMaster {\n\t\t\terr := addMaster(mgr, node)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr2 := addWorkerLabel(mgr, node)\n\t\t\tif err2 != nil {\n\t\t\t\treturn err2\n\t\t\t}\n\t\t\tif !node.IsWorker {\n\t\t\t\taddTaintForMasterCmd := fmt.Sprintf(\"sudo -E /bin/sh -c \\\"/usr/local/bin/kubectl taint nodes %s node-role.kubernetes.io/master=effect:NoSchedule --overwrite\\\"\", node.Name)\n\t\t\t\t_, _ = mgr.Runner.ExecuteCmd(addTaintForMasterCmd, 5, true)\n\t\t\t}\n\t\t}\n\t\tif node.IsWorker && !node.IsMaster {\n\t\t\terr := addWorker(mgr, node)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr1 := addWorkerLabel(mgr, node)\n\t\t\tif err1 != nil {\n\t\t\t\treturn err1\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "333fdff505224428002c147b4b9d7e7c", "score": "0.4713434", "text": "func processNode(apiUrl, groupName, nodeName string, node api.Node) {\n\t_, latencyOk := node.Attributes[\"latency\"]\n\t_, distanceOk := node.Attributes[\"distance\"]\n\tif latencyOk || distanceOk {\n\t\ttemplate := \"Analyzing status of the network channel to node '%s' from group '%s'...\"\n\t\tmessage := fmt.Sprintf(template, nodeName, groupName)\n\t\tlog.Println(message)\n\t\thops, latency, err := network.AnalyzeNetworkChannel(node.Host)\n\t\tif err != nil {\n\t\t\ttemplate := \"Cannot analyze network status of node '%s' from group '%s' - %s\"\n\t\t\tmessage := fmt.Sprintf(template, nodeName, groupName, err)\n\t\t\tlog.Println(message)\n\t\t\treturn\n\t\t}\n\t\tif latencyOk {\n\t\t\ttemplate := \"Submitting latency of the node '%s' from group '%s'.\"\n\t\t\tmessage := fmt.Sprintf(template, nodeName, groupName)\n\t\t\tlog.Println(message)\n\t\t\tif err := api.UpdateNodeLatency(apiUrl, groupName, nodeName, latency) ; err != nil {\n\t\t\t\ttemplate := \"Cannot submit latency of node '%s' from group '%s' - %s\"\n\t\t\t\tmessage := fmt.Sprintf(template, nodeName, groupName, err)\n\t\t\t\tlog.Println(message)\n\t\t\t}\n\t\t}\n\t\tif distanceOk {\n\t\t\ttemplate := \"Submitting distance to the node '%s' from group '%s'.\"\n\t\t\tmessage := fmt.Sprintf(template, nodeName, groupName)\n\t\t\tlog.Println(message)\n\t\t\tif err := api.UpdateNodeDistance(apiUrl, groupName, nodeName, hops) ; err != nil {\n\t\t\t\ttemplate := \"Cannot submit distance to node '%s' from group '%s' - %s\"\n\t\t\t\tmessage := fmt.Sprintf(template, nodeName, groupName, err)\n\t\t\t\tlog.Println(message)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5a30930b767dbe54ae2d2e00f45a31ed", "score": "0.46967462", "text": "func (f *Funcs) FuncMap() template.FuncMap {\n\treturn template.FuncMap{\n\t\t\"schema\": f.schemafn,\n\t\t\"defaults\": f.defaultsfn,\n\t\t\"header\": f.header,\n\t\t\"row\": f.rowfn,\n\t\t\"edge\": f.edge,\n\t\t\"quotes\": quotes,\n\t\t\"normalize\": normalize,\n\t}\n}", "title": "" }, { "docid": "d570d8653fcf4fd5bc6d3569671fdbb3", "score": "0.4696602", "text": "func (kj *KubernetesJoiner) getRaftClusterNodeInfo(clusterID, clusterSvcName, ns string, clusterSize int) []cluster.NodeInfo {\n\tnodes := make([]cluster.NodeInfo, clusterSize)\n\tfor i := 0; i < clusterSize; i++ {\n\t\tnodeID := fmt.Sprintf(\"%s-%d\", clusterID, i)\n\t\tnodes[i] = cluster.NodeInfo{\n\t\t\tID: nodeID,\n\t\t\tRPCURL: fmt.Sprintf(\"%s.%s:%d\", nodeID, clusterSvcName, kj.RPCPort),\n\t\t\tAPIURL: fmt.Sprintf(\"%s.%s:%d\", nodeID, clusterSvcName, kj.APIPort),\n\t\t}\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "f52e9e1ed88c097e3b3f38317320a15c", "score": "0.46947628", "text": "func (r *aerospikeReceiver) emitNode(info map[string]string, now pcommon.Timestamp, errs *scrapererror.ScrapeErrors) {\n\tfor k, v := range info {\n\t\tswitch k {\n\t\tcase \"client_connections\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionOpenDataPoint(now, v, metadata.AttributeConnectionTypeClient))\n\t\tcase \"fabric_connections\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionOpenDataPoint(now, v, metadata.AttributeConnectionTypeFabric))\n\t\tcase \"heartbeat_connections\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionOpenDataPoint(now, v, metadata.AttributeConnectionTypeHeartbeat))\n\t\tcase \"client_connections_closed\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeClient, metadata.AttributeConnectionOpClose))\n\t\tcase \"client_connections_opened\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeClient, metadata.AttributeConnectionOpOpen))\n\t\tcase \"fabric_connections_closed\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeFabric, metadata.AttributeConnectionOpClose))\n\t\tcase \"fabric_connections_opened\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeFabric, metadata.AttributeConnectionOpOpen))\n\t\tcase \"heartbeat_connections_closed\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeHeartbeat, metadata.AttributeConnectionOpClose))\n\t\tcase \"heartbeat_connections_opened\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeConnectionCountDataPoint(now, v, metadata.AttributeConnectionTypeHeartbeat, metadata.AttributeConnectionOpOpen))\n\t\tcase \"system_free_mem_pct\":\n\t\t\taddPartialIfError(errs, r.mb.RecordAerospikeNodeMemoryFreeDataPoint(now, v))\n\t\t}\n\t}\n\n\tr.mb.EmitForResource(metadata.WithAerospikeNodeName(info[\"node\"]))\n}", "title": "" }, { "docid": "bdbf49cb27193e0dcb67b17036faafda", "score": "0.46927008", "text": "func GetClusterNodeIPs(clientset client.Interface) ([]string, error) {\n\tpreferredAddressTypes := []v1.NodeAddressType{\n\t\tv1.NodeExternalIP,\n\t\tv1.NodeInternalIP,\n\t}\n\tnodeList, err := clientset.CoreV1().Nodes().List(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tnodeAddresses := []string{}\n\tfor _, node := range nodeList.Items {\n\tOuterLoop:\n\t\tfor _, addressType := range preferredAddressTypes {\n\t\t\tfor _, address := range node.Status.Addresses {\n\t\t\t\tif address.Type == addressType {\n\t\t\t\t\tnodeAddresses = append(nodeAddresses, address.Address)\n\t\t\t\t\tbreak OuterLoop\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodeAddresses, nil\n}", "title": "" }, { "docid": "309aaacc13400119e644b156ee3fa85c", "score": "0.4679199", "text": "func (graph *Graph) IterNodes(attr string, iterFunc func(node *Node) (cont bool, err error)) (err error) {\n\n\tif iterFunc == nil {\n\t\terr = errors.New(\"No iteration function\")\n\t} else {\n\t\tnodeMap := map[interface{}][]*Node{}\n\t\tfor _, node := range graph.Nodes {\n\t\t\tif a, ok := node.Attributes.Get(attr); ok {\n\t\t\t\tnodeMap[a] = append(nodeMap[a], node)\n\t\t\t}\n\t\t}\n\n\t\tvar attrsValues sort.Interface\n\t\tfor key := range nodeMap {\n\t\t\tswitch key.(type) {\n\t\t\tcase string:\n\t\t\t\tif attrsValues == nil {\n\t\t\t\t\tattrsValues = sort.StringSlice{}\n\t\t\t\t}\n\t\t\t\tattrsValues = append(attrsValues.(sort.StringSlice), key.(string))\n\t\t\tcase int:\n\t\t\t\tif attrsValues == nil {\n\t\t\t\t\tattrsValues = sort.IntSlice{}\n\t\t\t\t}\n\t\t\t\tattrsValues = append(attrsValues.(sort.IntSlice), key.(int))\n\t\t\tcase float64:\n\t\t\t\tif attrsValues == nil {\n\t\t\t\t\tattrsValues = sort.Float64Slice{}\n\t\t\t\t}\n\t\t\t\tattrsValues = append(attrsValues.(sort.Float64Slice), key.(float64))\n\t\t\tdefault:\n\t\t\t\terr = errors.New(\"Non sortable type. Requires string, int or float64\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif err == nil {\n\t\t\tsort.Sort(attrsValues)\n\n\t\t\tattrs := reflect.ValueOf(attrsValues)\n\t\t\tfor i := 0; i < attrs.Len(); i++ {\n\t\t\t\tvalue := attrs.Index(i).Interface()\n\t\t\t\tcont := false\n\t\t\t\tfor _, node := range nodeMap[value] {\n\t\t\t\t\tif cont, err = iterFunc(node); err != nil || !cont {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif err != nil || !cont {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6041c1ef9bd36635110e03049c59451c", "score": "0.46784317", "text": "func getSystemInfoMetrics(\n\tctx context.Context,\n\treq *milvuspb.GetMetricsRequest,\n\tnode *IndexNode,\n) (*milvuspb.GetMetricsResponse, error) {\n\t// TODO(dragondriver): add more metrics\n\tnodeInfos := metricsinfo.IndexNodeInfos{\n\t\tBaseComponentInfos: metricsinfo.BaseComponentInfos{\n\t\t\tName: metricsinfo.ConstructComponentName(typeutil.IndexNodeRole, paramtable.GetNodeID()),\n\t\t\tHardwareInfos: metricsinfo.HardwareMetrics{\n\t\t\t\tIP: node.session.Address,\n\t\t\t\tCPUCoreCount: hardware.GetCPUNum(),\n\t\t\t\tCPUCoreUsage: hardware.GetCPUUsage(),\n\t\t\t\tMemory: hardware.GetMemoryCount(),\n\t\t\t\tMemoryUsage: hardware.GetUsedMemoryCount(),\n\t\t\t\tDisk: hardware.GetDiskCount(),\n\t\t\t\tDiskUsage: hardware.GetDiskUsage(),\n\t\t\t},\n\t\t\tSystemInfo: metricsinfo.DeployMetrics{},\n\t\t\tCreatedTime: paramtable.GetCreateTime().String(),\n\t\t\tUpdatedTime: paramtable.GetUpdateTime().String(),\n\t\t\tType: typeutil.IndexNodeRole,\n\t\t\tID: node.session.ServerID,\n\t\t},\n\t\tSystemConfigurations: metricsinfo.IndexNodeConfiguration{\n\t\t\tMinioBucketName: Params.MinioCfg.BucketName.GetValue(),\n\t\t\tSimdType: Params.CommonCfg.SimdType.GetValue(),\n\t\t},\n\t}\n\n\tmetricsinfo.FillDeployMetricsWithEnv(&nodeInfos.SystemInfo)\n\n\tresp, err := metricsinfo.MarshalComponentInfos(nodeInfos)\n\tif err != nil {\n\t\treturn &milvuspb.GetMetricsResponse{\n\t\t\tStatus: &commonpb.Status{\n\t\t\t\tErrorCode: commonpb.ErrorCode_UnexpectedError,\n\t\t\t\tReason: err.Error(),\n\t\t\t},\n\t\t\tResponse: \"\",\n\t\t\tComponentName: metricsinfo.ConstructComponentName(typeutil.IndexNodeRole, paramtable.GetNodeID()),\n\t\t}, nil\n\t}\n\n\treturn &milvuspb.GetMetricsResponse{\n\t\tStatus: merr.Status(nil),\n\t\tResponse: resp,\n\t\tComponentName: metricsinfo.ConstructComponentName(typeutil.IndexNodeRole, paramtable.GetNodeID()),\n\t}, nil\n}", "title": "" }, { "docid": "40f59d75a8bdec7d31061b69f2e2e298", "score": "0.46779826", "text": "func (f EntriesFile) Map(mapFunc func(*EntryAndPosition, error)) error {\n\twg := new(sync.WaitGroup)\n\tentries := make(chan EntryAndPosition)\n\n\tfor i := 0; i < runtime.NumCPU(); i++ {\n\t\twg.Add(1)\n\t\tgo mapWorker(mapFunc, entries, wg)\n\t}\n\n\terr := f.readEntries(entries)\n\twg.Wait()\n\n\treturn err\n}", "title": "" }, { "docid": "e396343369b3fe99e19cb8754c636865", "score": "0.46773636", "text": "func BenchmarkGetNode_10000_Nodes(b *testing.B) {\n\tbaselineBenchmark(2500, 5)(b)\n}", "title": "" }, { "docid": "92fd0cd600b1a36789ce6d596d978c4f", "score": "0.46660683", "text": "func (m *MetricScraperClient) GetNodesMetrics(nodeNames string, metricType structs.ScraperMetricType) (*structs.ScraperMetricList, error) {\n\tif m.host == \"\" {\n\t\treturn nil, errors.WithStack(fmt.Errorf(\"unimplemented\"))\n\t}\n\n\tresp, err := m.c.Get(fmt.Sprintf(\"%s/api/v1/dashboard/nodes/%s/metrics/%s/data\", m.host, nodeNames, metricType))\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, errors.WithStack(fmt.Errorf(\"failed to get node metrics\"))\n\t}\n\n\tdata := &structs.ScraperMetricList{}\n\tif err := json.NewDecoder(resp.Body).Decode(data); err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "f55697c7e0c19333e1e30a59150d92ff", "score": "0.46656352", "text": "func (m *Metrics) SendNodeInfo(nm *types.NodeMetrics) {\n\tnodename := nm.Name\n\tpodname := nm.Podname\n\tmemory := nm.Memory\n\tmemoryUsed := nm.MemoryUsed\n\tstorage := nm.Storage\n\tstorageUsed := nm.StorageUsed\n\tcpuUsed := nm.CPUUsed\n\n\tif m.MemoryCapacity != nil {\n\t\tm.MemoryCapacity.WithLabelValues(podname, nodename).Set(memory)\n\t}\n\n\tif m.MemoryUsed != nil {\n\t\tm.MemoryUsed.WithLabelValues(podname, nodename).Set(memoryUsed)\n\t}\n\n\tif m.StorageCapacity != nil {\n\t\tm.StorageCapacity.WithLabelValues(podname, nodename).Set(storage)\n\t}\n\n\tif m.StorageUsed != nil {\n\t\tm.StorageUsed.WithLabelValues(podname, nodename).Set(storageUsed)\n\t}\n\n\tif m.CPUUsed != nil {\n\t\tm.CPUUsed.WithLabelValues(podname, nodename).Set(cpuUsed)\n\t}\n\n\tcleanedNodeName := utils.CleanStatsdMetrics(nodename)\n\tfor cpuid, value := range nm.CPU {\n\t\tval := float64(value)\n\n\t\tif m.CPUMap != nil {\n\t\t\tm.CPUMap.WithLabelValues(podname, nodename, cpuid).Set(val)\n\t\t}\n\n\t\tif m.StatsdAddr == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := m.gauge(fmt.Sprintf(cpuMap, cleanedNodeName, cpuid), val); err != nil {\n\t\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending cpu data to statsd: %v\", err) //nolint\n\t\t}\n\t}\n\n\tif m.StatsdAddr == \"\" {\n\t\treturn\n\t}\n\n\tif err := m.gauge(fmt.Sprintf(memStats, cleanedNodeName), memory); err != nil {\n\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending memory data to statsd: %v\", err) //nolint\n\t}\n\n\tif err := m.gauge(fmt.Sprintf(storageStats, cleanedNodeName), storage); err != nil {\n\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending storage data to statsd: %v\", err) //nolint\n\t}\n\n\tif err := m.gauge(fmt.Sprintf(memUsedStats, cleanedNodeName), memoryUsed); err != nil {\n\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending memory used data to statsd: %v\", err) //nolint\n\t}\n\n\tif err := m.gauge(fmt.Sprintf(storageUsedStats, cleanedNodeName), storageUsed); err != nil {\n\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending storage used data to statsd: %v\", err) //nolint\n\t}\n\n\tif err := m.gauge(fmt.Sprintf(cpuUsedStats, cleanedNodeName), cpuUsed); err != nil {\n\t\tlog.Errorf(nil, \"[SendNodeInfo] Error occurred while sending cpu used data to statsd: %v\", err) //nolint\n\t}\n}", "title": "" }, { "docid": "3eb01add43ab0003b3d5721eb0e8e94b", "score": "0.46649313", "text": "func (k8s *K8sFramework) AddEventHandlerFuncsToNodeInformer(addFunc, deleteFunc func(obj interface{}), updateFunc func(oldObj, newObj interface{})) {\n\tk8s.nodeInformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: addFunc,\n\t\tUpdateFunc: updateFunc,\n\t\tDeleteFunc: deleteFunc,\n\t})\n}", "title": "" }, { "docid": "79b9c5a71c4f1454450f068753024614", "score": "0.46564648", "text": "func (w *Watcher) buildNodeConfig() ([]*v1.Node, error) {\n\n\t// if the clusterConfig is nil for the watcher, we can't do anything\n\tif w.ClusterConfig == nil {\n\t\t// w.logger.Infof(\"w.ClusterConfig %p, len AllEndpoints %d\", w.ClusterConfig, len(w.AllEndpoints))\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.ClusterConfig was nil\")\n\t}\n\n\t// if all endpoints are empty then throw an error. we can't publish this\n\tif len(w.AllEndpoints) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.AllEndpoints was empty\")\n\t}\n\n\tif len(w.Nodes) == 0 {\n\t\treturn []*v1.Node{}, fmt.Errorf(\"watcher: error in buildNodeConfig(). Tried to build NodeList, but w.Nodes was empty\")\n\t}\n\n\tw.RLock()\n\tdefer w.RUnlock()\n\n\t// make a map for all nodes known to the watcher to prevent dupes\n\tnodeMap := make(map[string]*v1.Node)\n\tfor _, n := range w.Nodes {\n\t\tnodeMap[n.Name] = n\n\t}\n\n\t// loop over subsets across all endpoints and sort them into our nodes\n\t// for _, endpoint := range w.AllEndpoints { // Kubernetes *v1.Endpoint\n\n\t// \t// look over the subsets and address to find what node owns this endpoint\n\t// \tfor _, subset := range endpoint.Subsets {\n\n\t// \t\t// find the owning node of this set of subsets\n\t// \t\tfor _, addr := range subset.Addresses {\n\t// \t\t\tif addr.NodeName == nil {\n\t// \t\t\t\tlog.Warningln(\"watcher: skipped a subset address because the NodeName within was nil\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// check if this address's node name is in our nodeList map. If not,\n\t// \t\t\t// skip it until we learn about this node existing\n\t// \t\t\towningNode, ok := nodeMap[*addr.NodeName]\n\t// \t\t\tif !ok {\n\t// \t\t\t\tlog.Warningln(\"watcher: buildNodeConfig() skipped endpoint\", addr.IP, \"for node\", *addr.NodeName, \"because no node of this name is known yet\")\n\t// \t\t\t\tcontinue\n\t// \t\t\t}\n\n\t// \t\t\t// if the node does not have this endpoint yet, then we add it to the list and set this node in the node map\n\t// \t\t\tif !w.nodeHasAddressAlready(owningNode, addr) {\n\t// \t\t\t\t// fetch the owning node from our node map, append this new endpoint, and set it back\n\t// \t\t\t\towningNode.EndpointAddresses = append(owningNode.EndpointAddresses, addr)\n\t// \t\t\t\tlog.Warningln(\"watcher: node\", owningNode.Name, \"has had the following endpoint added:\", endpoint, \"these endpoints are now set:\", owningNode.EndpointAddresses)\n\t// \t\t\t\tw.Lock()\n\t// \t\t\t\tnodeMap[owningNode.Name] = owningNode\n\t// \t\t\t\tw.Unlock()\n\t// \t\t\t}\n\t// \t\t}\n\t// \t}\n\t// }\n\n\t// convert the nodeList map into a types.NodeList. Sort all the subsets\n\t// and then sort the node list at the end as well\n\tvar nodeList []*v1.Node\n\tfor _, n := range nodeMap {\n\t\tnodeList = append(nodeList, n)\n\t}\n\n\t// log.Debugln(\"watcher: buildNodeConfig is returning\", len(nodeList), \"nodes\")\n\treturn nodeList, nil\n}", "title": "" }, { "docid": "4a623f949b21945034c3b7ea6eaafc49", "score": "0.46534544", "text": "func (o DatadogAgentSpecClusterChecksRunnerOutput) NodeSelector() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v DatadogAgentSpecClusterChecksRunner) map[string]string { return v.NodeSelector }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "b73086eab2b15e24f2224e0b6c8d7511", "score": "0.46515772", "text": "func FuncMap(t *template.Template) template.FuncMap {\n\treturn template.FuncMap{\n\t\t\"tmpl\": tmplName(t),\n\t\t\"tmplExec\": tmplExec,\n\t\t\"tmplFile\": tmplFile,\n\t}\n}", "title": "" }, { "docid": "d08f9d062c970257970cf4368d52ee70", "score": "0.46304607", "text": "func (s *srvNodeInfo) listNodes() {\n\tnmmu.RLock()\n\tnk := make([]int32, len(s.nodeMap))\n\ti := 0\n\tfor k := range s.nodeMap {\n\t\tnk[i] = k\n\t\ti++\n\t}\n\tsort.Slice(nk, func(i, j int) bool { return nk[i] < nk[j] })\n\tfor i := range nk {\n\t\teni := s.nodeMap[nk[i]]\n\t\tsub := time.Now().Sub(eni.lastAlive) / time.Second\n\t\tlog.Printf(\"ID: %4d %25s %14s %3d %2d:%3d %s\\n\", nk[i], eni.nodeName, eni.address, int(sub), eni.count, eni.status, eni.arg)\n\t}\n\tnmmu.RUnlock()\n}", "title": "" }, { "docid": "861bcd5fdeab606abb8456a6e1c5081d", "score": "0.46280614", "text": "func (o DatadogAgentSpecClusterAgentOutput) NodeSelector() pulumi.StringMapOutput {\n\treturn o.ApplyT(func(v DatadogAgentSpecClusterAgent) map[string]string { return v.NodeSelector }).(pulumi.StringMapOutput)\n}", "title": "" }, { "docid": "c262a920397e0b0312bd22733178ebde", "score": "0.46189332", "text": "func createTestNodeDiskMap(p string) map[string][]string {\n\tnodes := make(map[string][]string)\n\tnodes[\"localhost\"] = make([]string, 16)\n\tfor i := 0; i < len(nodes[\"localhost\"]); i++ {\n\t\tdiskPath := filepath.Join(p, strconv.Itoa(i))\n\t\tif _, err := os.Stat(diskPath); err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\tos.MkdirAll(diskPath, 0700)\n\t\t\t}\n\t\t}\n\t\tnodes[\"localhost\"][i] = diskPath\n\t}\n\treturn nodes\n}", "title": "" }, { "docid": "5c69a027c552392f934053b06504cccd", "score": "0.46177715", "text": "func (ns *DefaultNodeServer) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error) {\n\tutil.TraceLog(ctx, \"Using default NodeGetInfo\")\n\n\tcsiTopology := &csi.Topology{\n\t\tSegments: ns.Driver.topology,\n\t}\n\n\treturn &csi.NodeGetInfoResponse{\n\t\tNodeId: ns.Driver.nodeID,\n\t\tAccessibleTopology: csiTopology,\n\t}, nil\n}", "title": "" }, { "docid": "c4e727190cdf46a4e096909f5092bc0d", "score": "0.46014503", "text": "func createCluster(c cfg.NodeConfigs) {\n\tfor _, conf := range c.Nodes {\n\t\twg.Add(1)\n\t\tlog.InfoLogger.Println(\"Creating node\", conf.NodeId, conf.ApiPort)\n\t\tgo node.CreateNode(conf, c)\n\t}\n}", "title": "" }, { "docid": "b5e32d3c47a0ae0307e66b1e950c111c", "score": "0.45895097", "text": "func (d *Data) GetAllNodesInfo() []*models.Node {\n\tnodes := d.NodesInfo\n\tif d.getOpenstackClusterData() != nil {\n\t\tnodes = append(nodes, d.getOpenstackClusterData().nodesInfo...)\n\t}\n\tif d.getK8sClusterData() != nil {\n\t\tnodes = append(nodes, d.getK8sClusterData().nodesInfo...)\n\t}\n\tif d.getAppformixClusterData() != nil {\n\t\tnodes = append(nodes, d.getAppformixClusterData().nodesInfo...)\n\t}\n\n\tif d.GetXflowData() != nil {\n\t\tnodes = append(nodes, d.GetXflowData().getNodes()...)\n\t}\n\n\tvar uniqueNodes []*models.Node\n\tm := make(map[string]bool)\n\n\tfor _, node := range nodes {\n\t\tif _, ok := m[node.UUID]; !ok {\n\t\t\tm[node.UUID] = true\n\t\t\tuniqueNodes = append(uniqueNodes, node)\n\t\t}\n\t}\n\n\treturn uniqueNodes\n}", "title": "" }, { "docid": "65ebd85ccc35b9148e5add27f16e1cc3", "score": "0.45878273", "text": "func (self *Node) MapUseNode() (map[string]Node, error) {\n if err := self.should(types.V_OBJECT, \"an object\"); err != nil {\n return nil, err\n }\n if err := self.skipAllKey(); err != nil {\n return nil, err\n }\n return self.toGenericObjectUseNode()\n}", "title": "" }, { "docid": "8afc54b8a3bdabf1b335681af442441c", "score": "0.4586503", "text": "func (s *lightningClient) GetNodeInfo(ctx context.Context, pubkey route.Vertex,\n\tincludeChannels bool) (*NodeInfo, error) {\n\n\trpcCtx, cancel := context.WithTimeout(ctx, s.timeout)\n\tdefer cancel()\n\n\trpcCtx = s.adminMac.WithMacaroonAuth(rpcCtx)\n\n\tnodeInfo, err := s.client.GetNodeInfo(rpcCtx, &lnrpc.NodeInfoRequest{\n\t\tPubKey: hex.EncodeToString(pubkey[:]),\n\t\tIncludeChannels: includeChannels,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnode, err := newNode(nodeInfo.Node)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinfo := &NodeInfo{\n\t\tNode: node,\n\t\tChannelCount: int(nodeInfo.NumChannels),\n\t\tTotalCapacity: btcutil.Amount(nodeInfo.TotalCapacity),\n\t\tChannels: make([]ChannelEdge, len(nodeInfo.Channels)),\n\t}\n\n\tfor i, channel := range nodeInfo.Channels {\n\t\tedge, err := newChannelEdge(channel)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tinfo.Channels[i] = *edge\n\t}\n\n\treturn info, nil\n}", "title": "" }, { "docid": "1510c5ff53043c222acbd4a0448662b8", "score": "0.4585812", "text": "func (c *CachedNodeInfo) GetNodeInfo(name string) (*v1.Node, error) {\n\tnode, found := c.Session.Nodes[name]\n\tif !found {\n\t\treturn nil, errors.NewNotFound(v1.Resource(\"node\"), name)\n\t}\n\n\treturn node.Node, nil\n}", "title": "" }, { "docid": "e5e0fba9be9895db87157a68cf0a8b81", "score": "0.4585534", "text": "func (ec *Client) GetNodeInfo(ctx context.Context) (*p2p.NodeInfo, error) {\n\tvar result p2p.NodeInfo\n\terr := ec.c.CallContext(ctx, &result, \"admin_nodeInfo\")\n\treturn &result, err\n}", "title": "" }, { "docid": "be5d270a408f05c63ad13106c4c2b265", "score": "0.4582706", "text": "func FuncMap() template.FuncMap {\n\tf := sprig.TxtFuncMap()\n\tdelete(f, \"env\")\n\tdelete(f, \"expandenv\")\n\n\t// Add some extra functionality\n\textra := template.FuncMap{\n\t\t\"toToml\": chartutil.ToToml,\n\t\t\"toYaml\": chartutil.ToYaml,\n\t\t\"fromYaml\": chartutil.FromYaml,\n\t\t\"toJson\": chartutil.ToJson,\n\t\t\"fromJson\": chartutil.FromJson,\n\n\t\t// This is a placeholder for the \"include\" function, which is\n\t\t// late-bound to a template. By declaring it here, we preserve the\n\t\t// integrity of the linter.\n\t\t\"include\": func(string, interface{}) string { return \"not implemented\" },\n\t\t\"required\": func(string, interface{}) interface{} { return \"not implemented\" },\n\t\t\"tpl\": func(string, interface{}) interface{} { return \"not implemented\" },\n\t}\n\n\tfor k, v := range extra {\n\t\tf[k] = v\n\t}\n\n\treturn f\n}", "title": "" }, { "docid": "fd07ae1bf2579999ee9fc4900d0b7144", "score": "0.45810756", "text": "func (m *Collector) AddNodesMetricsEntry(measurement string, node string, tags map[string]string, value interface{}) {\n\ttags[\"node\"] = node\n\ttags[\"clustername\"] = m.ClusterName\n\n\tm.MetricPoints = append(m.MetricPoints, Metrics{\n\t\tMeasurement: measurement,\n\t\tTags: tags,\n\t\tValue: map[string]interface{}{\n\t\t\t\"value\": value,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "e08ece99ca6d80b0782db2891ad5cd8a", "score": "0.45736519", "text": "func (c *esClient) GetNodeInfo() (*NodeInfoOutput, error) {\n\turl := fmt.Sprintf(\"%s://%s:%s/%s\", c.scheme, c.host, c.port, nodeInfoEndpoint)\n\n\tvar nodeInfoOutput NodeInfoOutput\n\n\terr := c.fetchJSON(url, &nodeInfoOutput)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &nodeInfoOutput, nil\n}", "title": "" }, { "docid": "91262228af15634847a39397e08abab9", "score": "0.45712456", "text": "func (s *AutoScalerServerApp) TemplateNodeInfo(ctx context.Context, request *apigrpc.NodeGroupServiceRequest) (*apigrpc.TemplateNodeInfoReply, error) {\n\tglog.V(5).Infof(\"Call server TemplateNodeInfo: %v\", request)\n\n\tif s.Configuration.Optionals.TemplateNodeInfo {\n\t\treturn nil, fmt.Errorf(constantes.ErrNotImplemented)\n\t}\n\n\tif request.GetProviderID() != s.Configuration.ProviderID {\n\t\tglog.Errorf(constantes.ErrMismatchingProvider)\n\t\treturn nil, fmt.Errorf(constantes.ErrMismatchingProvider)\n\t}\n\n\tnodeGroup := s.Groups[request.GetNodeGroupID()]\n\n\tif nodeGroup == nil {\n\t\tglog.Errorf(constantes.ErrNodeGroupNotFound, request.GetNodeGroupID())\n\n\t\treturn &apigrpc.TemplateNodeInfoReply{\n\t\t\tResponse: &apigrpc.TemplateNodeInfoReply_Error{\n\t\t\t\tError: &apigrpc.Error{\n\t\t\t\t\tCode: constantes.CloudProviderError,\n\t\t\t\t\tReason: fmt.Sprintf(constantes.ErrNodeGroupNotFound, request.GetNodeGroupID()),\n\t\t\t\t},\n\t\t\t},\n\t\t}, nil\n\t}\n\n\tnode := &apiv1.Node{\n\t\tSpec: apiv1.NodeSpec{\n\t\t\tProviderID: nodeGroup.providerID(),\n\t\t\tUnschedulable: false,\n\t\t},\n\t}\n\n\treturn &apigrpc.TemplateNodeInfoReply{\n\t\tResponse: &apigrpc.TemplateNodeInfoReply_NodeInfo{NodeInfo: &apigrpc.NodeInfo{\n\t\t\tNode: utils.ToJSON(node),\n\t\t}},\n\t}, nil\n}", "title": "" }, { "docid": "8e4e21a9c733fab9e71877e9add4b289", "score": "0.4570936", "text": "func (c *Client) GetNodeInfo() (*NetInfo, error) {\n\turl := \"/net-info\"\n\tres := &NetInfo{}\n\treturn res, c.Request(url, nil, res)\n}", "title": "" }, { "docid": "6c150cc219869833c590e27ba2b27f02", "score": "0.45661274", "text": "func (b *HealthChecker) CheckClusterNodes(\n\tctx context.Context,\n\tshootClient client.Client,\n\tworkers []gardencorev1beta1.Worker,\n\tcondition gardencorev1beta1.Condition,\n) (\n\t*gardencorev1beta1.Condition,\n\terror,\n) {\n\tworkerPoolToNodes, err := botanist.WorkerPoolToNodesMap(ctx, shootClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tworkerPoolToSecretChecksum, err := botanist.WorkerPoolToCloudConfigSecretChecksumMap(ctx, shootClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, worker := range workers {\n\t\tnodes := workerPoolToNodes[worker.Name]\n\n\t\tif exitCondition := b.checkNodes(condition, nodes, worker.Name); exitCondition != nil {\n\t\t\treturn exitCondition, nil\n\t\t}\n\n\t\tif len(nodes) < int(worker.Minimum) {\n\t\t\tc := b.FailedCondition(condition, \"MissingNodes\", fmt.Sprintf(\"Not enough worker nodes registered in worker pool %q to meet minimum desired machine count. (%d/%d).\", worker.Name, len(nodes), worker.Minimum))\n\t\t\treturn &c, nil\n\t\t}\n\t}\n\n\tif err := botanist.CloudConfigUpdatedForAllWorkerPools(workers, workerPoolToNodes, workerPoolToSecretChecksum); err != nil {\n\t\tc := b.FailedCondition(condition, \"CloudConfigOutdated\", err.Error())\n\t\treturn &c, nil\n\t}\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "ea8357279f944e33cc8fa4fef527c969", "score": "0.45602727", "text": "func (kj *KubernetesJoiner) DiscoverNodes() ([]cluster.NodeInfo, error) {\n\tdiscoveredNodes := []cluster.NodeInfo{}\n\tpodLabels, err := kj.getRaftPodLabels()\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-LABELS\",\n\t\t}).Errorf(\"failed to get labels on the pod\")\n\t\treturn discoveredNodes, err\n\t}\n\tclusterID, present := podLabels[raftClusterIDLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-ID\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterIDLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: raftClusterIDLabel}\n\t}\n\tclusterSize, present := podLabels[raftClusterSizeLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-SIZE\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterSizeLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: raftClusterSizeLabel}\n\t}\n\tclusterSvcName, present := podLabels[raftClusterSvcNameLabel]\n\tif !present {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-RAFT-CLUSTER-SVC-NAME\",\n\t\t}).Warnf(\"couldn't find label: %s\", raftClusterSvcNameLabel)\n\t\treturn discoveredNodes, &LabelNotPresentError{RequiredLabel: clusterSvcName}\n\t}\n\tvar intClusterSize int\n\t_, err = fmt.Sscanf(clusterSize, \"%d\", &intClusterSize)\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"PARSE-RAFT-CLUSTER-SIZE\",\n\t\t}).Errorf(\"error while parsing %s as integer\", clusterSize)\n\t\treturn discoveredNodes, err\n\t}\n\tns, err := kj.getRaftClusterNamespace()\n\tif err != nil {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.ErrorReason: err.Error(),\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"GET-POD-NAMESPACE\",\n\t\t}).Errorf(\"error while getting pod namespace\")\n\t\treturn discoveredNodes, err\n\t}\n\tdiscoveredNodes = kj.getRaftClusterNodeInfo(clusterID, clusterSvcName, ns, intClusterSize)\n\tfor _, node := range discoveredNodes {\n\t\tlogrus.WithFields(logrus.Fields{\n\t\t\tlogfield.Component: k8sJoiner,\n\t\t\tlogfield.Event: \"DISCOVERY-DONE\",\n\t\t}).Infof(\"discovered peer: nodeID=%s, rpcURL=%s, apiURL=%s\",\n\t\t\tnode.ID, node.RPCURL, node.APIURL)\n\t}\n\treturn discoveredNodes, nil\n}", "title": "" }, { "docid": "19b6ea61fb94229ee82e637af0864950", "score": "0.45549038", "text": "func (r *K3sConfigReconciler) MachineToBootstrapMapFunc(o client.Object) []ctrl.Request {\n\tm, ok := o.(*clusterv1.Machine)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"Expected a Machine but got a %T\", o))\n\t}\n\n\tvar result []ctrl.Request\n\tif m.Spec.Bootstrap.ConfigRef != nil && m.Spec.Bootstrap.ConfigRef.GroupVersionKind() == infrabootstrapv1.GroupVersion.WithKind(\"K3sConfig\") {\n\t\tname := client.ObjectKey{Namespace: m.Namespace, Name: m.Spec.Bootstrap.ConfigRef.Name}\n\t\tresult = append(result, ctrl.Request{NamespacedName: name})\n\t}\n\treturn result\n}", "title": "" }, { "docid": "85482b2a1f147429e6e912705c3aa1ca", "score": "0.45447937", "text": "func NewMiddlewareClusterInfoWithMapAndRandom(fields map[string]interface{}) (*MiddlewareClusterInfo, error) {\n\tmci := &MiddlewareClusterInfo{}\n\terr := common.SetValuesWithMapAndRandom(mci, fields)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn mci, nil\n}", "title": "" }, { "docid": "de0c4a3348ccbba9d17bb02efe4629f6", "score": "0.45414233", "text": "func GetClusterServerInfo(ctx stochastikctx.Context) ([]ServerInfo, error) {\n\tfailpoint.Inject(\"mockClusterInfo\", func(val failpoint.Value) {\n\t\t// The cluster topology is injected by `failpoint` memex and\n\t\t// there is no extra checks for it. (let the test fail if the memex invalid)\n\t\tif s := val.(string); len(s) > 0 {\n\t\t\tvar servers []ServerInfo\n\t\t\tfor _, server := range strings.Split(s, \";\") {\n\t\t\t\tparts := strings.Split(server, \",\")\n\t\t\t\tservers = append(servers, ServerInfo{\n\t\t\t\t\tServerType: parts[0],\n\t\t\t\t\tAddress: parts[1],\n\t\t\t\t\tStatusAddr: parts[2],\n\t\t\t\t\tVersion: parts[3],\n\t\t\t\t\tGitHash: parts[4],\n\t\t\t\t})\n\t\t\t}\n\t\t\tfailpoint.Return(servers, nil)\n\t\t}\n\t})\n\n\ttype retriever func(ctx stochastikctx.Context) ([]ServerInfo, error)\n\tvar servers []ServerInfo\n\tfor _, r := range []retriever{GetMilevaDBServerInfo, GetFIDelServerInfo, GetStoreServerInfo} {\n\t\tnodes, err := r(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tservers = append(servers, nodes...)\n\t}\n\treturn servers, nil\n}", "title": "" }, { "docid": "f5ac24dcfe6feedd5e99abb73afff8df", "score": "0.4540976", "text": "func mapMachineNameToNodeName(machines []objx.Map, nodes []corev1.Node) (map[string]string, bool) {\n\tresult := map[string]string{}\n\tfor i := range machines {\n\t\tfor j := range nodes {\n\t\t\tif nodes[j].Name == nodeNameFromNodeRef(machines[i]) {\n\t\t\t\tresult[machineName(machines[i])] = nodes[j].Name\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn result, len(machines) == len(result)\n}", "title": "" }, { "docid": "9bc6a66f8309cf875f1c103abc18c052", "score": "0.45369998", "text": "func (members Members) Map(f func(member NetworkMember) NetworkMember) Members {\n\tvar res Members\n\tfor _, m := range members {\n\t\tres = append(res, f(m))\n\t}\n\treturn res\n}", "title": "" } ]
52bb42cbd61fdef97582561afed18b47
GetCases handler method for getting covid cases from gps coordinates provided by user
[ { "docid": "24ef714f298390c75637f122f052d145", "score": "0.70753735", "text": "func GetCases(c echo.Context) error {\n latitude := c.QueryParam(\"lat\")\n longitude := c.QueryParam(\"lng\")\n fmt.Println(latitude)\n fmt.Println(longitude)\n \n \n state := getState(latitude,longitude)\n res := GetCasesInState(state)\n b, err := json.Marshal(res)\n if err != nil {\n log.Fatal(err)\n }\n fmt.Println(string(b))\n return c.String(http.StatusOK, string(b))\n}", "title": "" } ]
[ { "docid": "e70e40c4bff2bc212db8d41f051e8703", "score": "0.65450096", "text": "func (c *KnowledgeGraphComponent) GetCases(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "091a374c3aa75498f5030ea709cc417f", "score": "0.60011095", "text": "func (c *Client) GetCases(projectID, suiteID int, sectionID ...int) ([]Case, error) {\n\turi := fmt.Sprintf(\"get_cases/%d&suite_id=%d\", projectID, suiteID)\n\tif len(sectionID) > 0 {\n\t\turi = fmt.Sprintf(\"%s&section_id=%d\", uri, sectionID[0])\n\t}\n\n\treturnCases := []Case{}\n\tvar err error\n\tif c.useBetaApi {\n\t\terr = c.sendRequestBeta(\"GET\", uri, nil, &returnCases, \"cases\")\n\t} else {\n\t\terr = c.sendRequest(\"GET\", uri, nil, &returnCases)\n\t}\n\treturn returnCases, err\n}", "title": "" }, { "docid": "c9ba0b80a55fc80e3d1e834599d43bdd", "score": "0.5497175", "text": "func (c *CustomerService) Cases(id string, params *url.Values) (*Page, *http.Response, error) {\n\trestful := Restful{}\n\tpage := new(Page)\n\tpath := NewIdentityResourcePath(id, NewCustomer()).SetNested(NewCase())\n\tresp, err := restful.\n\t\tGet(path.Path()).\n\t\tJson(page).\n\t\tParams(params).\n\t\tClient(c.client).\n\t\tDo()\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\terr = c.unravelPage(page)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn page, resp, err\n}", "title": "" }, { "docid": "2e28bbddef8b11c23b513769b6e8ff62", "score": "0.5441435", "text": "func (server *Server) FetchCityData(c *gin.Context) {\n\teventParam := c.Param(\"city\")\n\t//eventParam = \"grevena\"\n\n\tevent := models.Events{}\n\tevents, err := event.CityEvents(server.DB, string(eventParam))\n\tif err != nil {\n\t\tc.JSON(http.StatusNotFound, gin.H{\n\t\t\t\"status\": http.StatusNotFound,\n\t\t\t\"message\": \"No Events found for this location\",\n\t\t})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": events,\n\t})\n\n}", "title": "" }, { "docid": "0e201623076e549f26fe425833d54878", "score": "0.54332626", "text": "func (h *CityHandler) getCities(c *fiber.Ctx) error {\n\t// Create cancellable context.\n\tcustomContext, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\t// Get all cities.\n\tcities, err := h.cityService.FetchCities(customContext)\n\tif err != nil {\n\t\treturn c.Status(fiber.StatusInternalServerError).JSON(&fiber.Map{\n\t\t\t\"status\": \"fail\",\n\t\t\t\"message\": err.Error(),\n\t\t})\n\t}\n\n\t// Return results.\n\treturn c.Status(fiber.StatusOK).JSON(&fiber.Map{\n\t\t\"status\": \"success\",\n\t\t\"data\": cities,\n\t})\n}", "title": "" }, { "docid": "21c62ab6072079c2ffeb33026a4815ac", "score": "0.53166085", "text": "func GetCasesInState(state string) *(model.Result){\n\n quickstartDatabase := database.MI.Client.Database(\"covid\") // maybe we need create this database before \n // set collection\n covidCollection := quickstartDatabase.Collection(\"cases\")\n ctx, _ := context.WithTimeout(context.Background(), 15*time.Second)\n\n var response bson.M\n var err error\n if err = covidCollection.FindOne(ctx, bson.M{}).Decode(&response); err != nil {\n log.Fatal(err)\n }\n \n var CaseInState int32\n for _,v := range response[\"regiondata\"].(primitive.A){\n if(v.(primitive.M)[\"region\"]==state){\n fmt.Println(state)\n CaseInState = v.(primitive.M)[\"totalinfected\"].(int32)\n fmt.Println(CaseInState)\n break\n }\n //fmt.Println(\"---------\")\n }\n result := &model.Result{\n State:state,\n ActiveCases: response[\"activecases\"].(int32),\n LastUpdatedAtApify:response[\"lastupdatedatapify\"].(primitive.DateTime),\n TotalCasesInIndia:CaseInState,\n }\n\n return result\n}", "title": "" }, { "docid": "21473b53d0f29117d6aefc7e48fe497d", "score": "0.5248044", "text": "func (c *Client) SearchCases(ctx context.Context, params *SearchCasesInput, optFns ...func(*Options)) (*SearchCasesOutput, error) {\n\tif params == nil {\n\t\tparams = &SearchCasesInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"SearchCases\", params, optFns, c.addOperationSearchCasesMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*SearchCasesOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "853f8ffd6c08cc0130ee4245a8513096", "score": "0.52053237", "text": "func CaseList(c echo.Context) error {\n\tconst LogTag = \"CaseList\"\n\tdefer c.Request().Body.Close()\n\n\t//get token\n\ttoken := c.Get(\"user\").(*jwt.Token)\n\n\t//filters locs\n\tconst locProvMainField = \"provinsi_main\"\n\tconst locProvField = \"provinsi\"\n\tconst locKotKabField = \"kota_kabupaten\"\n\tlocProvMainData := c.QueryParam(locProvMainField)\n\tlocProvMain := c.QueryParam(locProvField)\n\tlocKotKabData := c.QueryParam(locKotKabField)\n\n\t//filters date\n\tstartDate, err := date.ParseSimple(c.QueryParam(\"start_date\"))\n\tif err != nil && err.Error() != \"nil\" {\n\t\treturn returnInvalidResponse(http.StatusUnprocessableEntity, err, \"format start_date salah\")\n\t}\n\tendDate, err := date.ParseSimple(c.QueryParam(\"end_date\"))\n\tif err != nil && err.Error() != \"nil\" {\n\t\treturn returnInvalidResponse(http.StatusUnprocessableEntity, err, \"format end_date salah\")\n\t}\n\n\t//init models for response\n\tvar cases []models.Case\n\n\t//Pagination Custom Query\n\tQPaged := modules.QueryPaged{}\n\tQPaged.Init(c)\n\n\t//custom query\n\tdb := covid19.App.DB\n\tdb = db.Table(\"cases\").\n\t\tSelect(\"*\")\n\t// Joins(\"INNER JOIN banks b ON products.id IN (SELECT UNNEST(b.products)) \").\n\n\t//Filter locations\n\tLocQuery := \"LOWER((location->'%s')::text) LIKE ?\"\n\tif len(locProvMainData) != 0 {\n\t\tdb = db.Where(fmt.Sprintf(LocQuery, locProvMainField), \"%\"+strings.ToLower(locProvMainData)+\"%\")\n\t}\n\tif len(locProvMain) != 0 {\n\t\tdb = db.Where(fmt.Sprintf(LocQuery, locProvField), \"%\"+strings.ToLower(locProvMain)+\"%\")\n\t}\n\tif len(locKotKabData) != 0 {\n\t\tdb = db.Where(fmt.Sprintf(LocQuery, locKotKabField), \"%\"+strings.ToLower(locKotKabData)+\"%\")\n\t}\n\n\t//filter by date\n\tif !startDate.IsZero() {\n\t\tif !endDate.IsZero() {\n\t\t\t//GOTCHAS : between startdate now() must now() + 1 day\n\t\t\tdb = db.Where(\"created_at BETWEEN ? AND ?\", startDate, endDate.AddDate(0, 0, 1))\n\t\t} else {\n\t\t\tdb = db.Where(\"created_at BETWEEN ? AND ?\", startDate, startDate.AddDate(0, 0, 1))\n\t\t}\n\t} else if !endDate.IsZero() {\n\t\tdb = db.Where(\"created_at BETWEEN ? AND ?\", endDate, endDate.AddDate(0, 0, 1))\n\t}\n\n\t//generate filter, return db and error\n\tdb, err = QPaged.GenerateFilters(db, CaseFilter{}, \"cases\")\n\tif err != nil {\n\t\tnlogs.NLog(\"warning\", LogTag, map[string]interface{}{\n\t\t\t\"message\": \"error list cases\",\n\t\t\t\"error\": err}, token, \"\", false)\n\n\t\treturn returnInvalidResponse(http.StatusInternalServerError, err, \"kesalahan dalam mendapatkan data\")\n\t}\n\n\t//execute anonymous function pass db and data pass by reference (services)\n\terr = QPaged.Exec(db, &cases, func(DB *gorm.DB, rows interface{}) error {\n\t\t//manual type casting :)\n\t\terr := DB.Find(rows.(*[]models.Case)).Error\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tnlogs.NLog(\"warning\", LogTag, map[string]interface{}{\n\t\t\t\"message\": \"empty data cases\",\n\t\t\t\"error\": err}, token, \"\", false)\n\t\treturn returnInvalidResponse(http.StatusInternalServerError, err, \"Data Kasus Kosong\")\n\t}\n\n\t//get result format\n\tresult := QPaged.GetPage(cases)\n\treturn c.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "7f39eaec47becbdea1c93c534ca71b56", "score": "0.5145219", "text": "func (l Location) NewCases() int {\n\tif len(l.Records) > 0 {\n\t\treturn l.Records[len(l.Records)-1].NewCases\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "f3f5a53854ef8d740ba375f02400866e", "score": "0.51421344", "text": "func ListCases(token string, root *url.URL, casescsv string) map[int]Case {\n\n\tv := url.Values{\"token\": {token}, \"cmd\": {\"search\"}, \"q\": {casescsv}, \"cols\": {\"sTitle,ixProject,sProject,sArea,sCategory,sFixFor,ixFixFor,sStartNote,tags,plugin_customfields_at_fogcreek_com_customere1c\"}}\n\tresp, err := http.PostForm(root.String(), v)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\n\t// Read the response into the data { []byte }.\n\tdefer resp.Body.Close()\n\tdata, err2 := ioutil.ReadAll(resp.Body)\n\tif err2 != nil {\n\t\tfmt.Println(err2)\n\t}\n\n\t// Load the xml data we collected into the object.\n\tr := &Response{}\n\terr3 := xml.Unmarshal(data, r)\n\tif err3 != nil {\n\t\tfmt.Println(err3)\n\t}\n\n\t// Create a map of cases to perform lookups\n\t// using the BugIDs in interval.go package.\n\t// Bug (ixBug) is the key in this map.\n\tc := make(map[int]Case)\n\tfor i := 0; i < len(r.Cases.Case); i++ {\n\t\tc[r.Cases.Case[i].Bug] = r.Cases.Case[i]\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "7f741d60f348f57e6b9735c29690c430", "score": "0.5139767", "text": "func Getdetailsfromcymon(finflag chan string, isIP bool, searchval string, CymonIpInfo map[string]struct {\n\tTitle string\n\tDescription string\n\tReportedBy string\n\tTag string\n\tURL string\n\tHostname string\n\tDomain string\n\tIP string\n\tCountry string\n\tCity string\n}) {\n\n\tvar apiURL string\n\tif isIP {\n\t\tapiURL = \"https://api.cymon.io/v2/ioc/search/ip/\" + searchval\n\t} else {\n\t\tapiURL = \"https://api.cymon.io/v2/ioc/search/domain/\" + searchval\n\t}\n\n\t//Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl)}\n\n\t/*transport := http.Transport{}\n\ttransport.Proxy = http.ProxyURL(proxyUrl)// set proxy\n\ttransport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} //set ssl*/\n\n\t//if need to set proxy\n\t//proxyUrl, _ := url.Parse(\"http://127.0.0.1:8080\")\n\t//client := &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl), TLSClientConfig:&tls.Config{InsecureSkipVerify: true }}}\n\tclient := &http.Client{}\n\treq, _ := http.NewRequest(\"GET\", apiURL, nil)\n\treq.Header.Add(\"Authorization\", cymonauthtoken.Jwt)\n\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tdefer resp.Body.Close()\n\tbody_byte, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t}\n\tjson.Unmarshal(body_byte, &cymonIPResult)\n\n\tvar ipresult resulttoprint\n\n\tfor index, ipInfo := range cymonIPResult.Hits {\n\t\tipresult.Title = ipInfo.Title\n\t\tipresult.Description = ipInfo.Description\n\t\tipresult.ReportedBy = ipInfo.ReportedBy\n\t\tif len(ipInfo.Tags) > 0 {\n\t\t\tipresult.Tag = ipInfo.Tags[0]\n\t\t}\n\t\tipresult.URL = ipInfo.Ioc.URL\n\t\tipresult.Hostname = ipInfo.Ioc.Hostname\n\t\tipresult.IP = ipInfo.Ioc.IP\n\t\tipresult.Country = ipInfo.Location.Country\n\t\tipresult.City = ipInfo.Location.City\n\t\tipresult.Domain = ipInfo.Ioc.Domain\n\t\tCymonIpInfo[string(index)] = ipresult\n\t}\n\n\t//fmt.Println(string(body_byte))\n\tfinflag <- \"got cymonresult\"\n}", "title": "" }, { "docid": "36d8c3b79db7de7622170260abde8c8b", "score": "0.49996606", "text": "func HandleAllCovidCases(perCapita bool, multiplier int,\n\theaders map[string]string,\n\tcovid19DataService service.Covid19DataServiceInterface) (events.APIGatewayProxyResponse, error) {\n\n\treturn handleCases(perCapita, multiplier, headers, covid19DataService,\n\t\tfunc(s db.Covid19SummaryItem) int {\n\t\t\treturn s.TotalCases\n\t\t})\n}", "title": "" }, { "docid": "1b08d359659be06d5378652066f3ef8f", "score": "0.49647838", "text": "func fetchCoordinates(Consumer *models.Consumer) error {\nclient := &http.Client{}\n\taddress := Consumer.Address + \"+\" + Consumer.City + \"+\" + Consumer.State + \"+\" + Consumer.Zip;\n\n mapsUrl := \"http://maps.google.com/maps/api/geocode/json?address=\"\n\n\tmapsUrl += url.QueryEscape(address)\n\tmapsUrl += \"&sensor=false\"\n\n\t//fmt.Println(\"URL: \"+ mapsUrl)\n //mapsUrl = strings.Replace(mapsUrl, \" \", \"+\", -1)\n\t\n\treq, err := http.NewRequest(\"GET\", mapsUrl , nil)\n\tres, err := client.Do(req)\n\n // res, err := http.Get(mapsUrl)\n if err != nil {\n return err\n }\n\n body, err := ioutil.ReadAll(res.Body)\n if err != nil {\n return err\n }\n defer res.Body.Close()\n\n var contents map[string]interface{}\n err = json.Unmarshal(body, &contents)\n if err != nil {\n return err\n }\n\n if !strings.EqualFold(contents[\"status\"].(string), \"OK\") {\n return errors.New(\"Coordinates unavailable\")\n }\n\n results := contents[\"results\"].([]interface{})\n location := results[0].(map[string]interface{})[\"geometry\"].(map[string]interface{})[\"location\"]\n\n Consumer.Coordinate.Lat = location.(map[string]interface{})[\"lat\"].(float64)\n Consumer.Coordinate.Lng = location.(map[string]interface{})[\"lng\"].(float64)\n\n if err != nil {\n return err\n }\n\n return nil\n}", "title": "" }, { "docid": "6ed08a2b90f6954a19a8734f8d3cabe2", "score": "0.49563962", "text": "func (o *SecurityMonitoringRuleCreatePayload) GetCases() []SecurityMonitoringRuleCase {\n\tif o == nil {\n\t\tvar ret []SecurityMonitoringRuleCase\n\t\treturn ret\n\t}\n\n\treturn o.Cases\n}", "title": "" }, { "docid": "667c086aa9b5e154e1a156218a8f9220", "score": "0.4930815", "text": "func BuildCases(inputs ...interface{}) *MatchInfo {\n\tcallerPkg, callerName := getCallerName()\n\tret := []*PatResult{}\n\tl := len(inputs)\n\tfor i := 1; i < l; i += 2 {\n\t\tpp := inputs[i-1].(string)\n\t\tnode, err := p.Parse(pp)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tret = append(ret, &PatResult{pp, node, inputs[i]})\n\t}\n\treturn &MatchInfo{\n\t\tcallerPkg, callerName, ret,\n\t}\n}", "title": "" }, { "docid": "d2bc720596ec55a8b494a7dc2783d810", "score": "0.48067427", "text": "func GetUserVisitedCities(request pb.VisitedRequestP)(*pb.VisitedCitysResponseP,error){\n\tctx, cancel := context.WithTimeout(context.Background(), DEADLINE*time.Second)\n\tdefer cancel()\n\tr, err := ProfSerConn.context.dbClient.GetVisitedCitys(ctx,&request)\n\tif err != nil{\n\t\treturn nil,err\n\t}\n\treturn r,err\n}", "title": "" }, { "docid": "65a7e7033270e8920f73c749f66a29e5", "score": "0.4794407", "text": "func GetCities(fu string) ([]City, error) {\n\tc := NewClaquete(FederativeUnit(fu))\n\treturn c.GetCities()\n}", "title": "" }, { "docid": "51694ca4b75dbfa9031a0b1e535735b0", "score": "0.47815543", "text": "func (h ApisHandler) GetLocationsByCountyID(appVersion *string, w http.ResponseWriter, r *http.Request) {\n\tcountyKeys, ok := r.URL.Query()[\"county-id\"]\n\tif !ok || len(countyKeys[0]) < 1 {\n\t\tlog.Println(\"url param 'county-id' is missing\")\n\t\treturn\n\t}\n\tcountyID := countyKeys[0]\n\n\tlocations, err := h.app.Services.GetLocationsByCountyID(countyID)\n\tif err != nil {\n\t\tlog.Println(\"Error on getting the locations for county\")\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tvar response []locationResponse\n\tif locations != nil {\n\t\tfor _, location := range locations {\n\t\t\tvar availableTestsRes []string\n\t\t\tif location.AvailableTests != nil {\n\t\t\t\tfor _, testType := range location.AvailableTests {\n\t\t\t\t\tavailableTestsRes = append(availableTestsRes, testType.ID)\n\t\t\t\t}\n\t\t\t}\n\t\t\tlocItem := locationResponse{ID: location.ID, Name: location.Name, Address1: location.Address1, Address2: location.Address2,\n\t\t\t\tCity: location.City, State: location.State, ZIP: location.ZIP, Country: location.Country, Latitude: location.Latitude, Longitude: location.Longitude,\n\t\t\t\tTimezone: location.Timezone, Contact: location.Contact, DaysOfOperation: convertFromDaysOfOperations(location.DaysOfOperation),\n\t\t\t\tURL: location.URL, Notes: location.Notes, WaitTimeColor: location.WaitTimeColor, ProviderID: location.Provider.ID,\n\t\t\t\tCountyID: location.County.ID, AvailableTests: availableTestsRes}\n\n\t\t\tresponse = append(response, locItem)\n\t\t}\n\t}\n\tif len(response) == 0 {\n\t\tresponse = make([]locationResponse, 0)\n\t}\n\tdata, err := json.Marshal(response)\n\tif err != nil {\n\t\tlog.Println(\"Error on marshal the locations items\")\n\t\thttp.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "title": "" }, { "docid": "0f2f79107a5488c5fd77df0333d6c36c", "score": "0.476424", "text": "func (m *MockRepository) GetClinics(name string, state string, from, to string) ([]models.Clinic, error) {\n\targs := m.Called(name, state, from, to)\n\n\treturn args.Get(0).([]models.Clinic), args.Error(1)\n}", "title": "" }, { "docid": "84b93a75dcf22bb7cfb0f7642d06c9f6", "score": "0.47217953", "text": "func (c *Client) GetCasesWithCustomFields(projectID, suiteID int, customArray interface{}, sectionID ...int) error {\n\turi := fmt.Sprintf(\"get_cases/%d&suite_id=%d\", projectID, suiteID)\n\tif len(sectionID) > 0 {\n\t\turi = fmt.Sprintf(\"%s&section_id=%d\", uri, sectionID[0])\n\t}\n\n\tvar err error\n\tif c.useBetaApi {\n\t\terr = c.sendRequestBeta(\"GET\", uri, nil, &customArray, \"cases\")\n\t} else {\n\t\terr = c.sendRequest(\"GET\", uri, nil, &customArray)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e18f38a55a9718205280bd4e2e1efb0a", "score": "0.4717049", "text": "func drawCase(r *http.Request) (string) {\n\toutput := \"\"\n\n\n\t// ========== ========== ========== ========== ==========\n\t// New Context - opaque value used by many functions in the Go App Engine SDK to communicate with the App Engine service\n\t// [START new_context]\n\tctx := appengine.NewContext(r) // c or ctx\n\t// [END new_context]\n\t// ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ==========\n\t// [START query]\n\tquery := datastore.NewQuery(\"Case\").Ancestor(caseKey(ctx)).Order(\"-Date\").Limit(10)\n\t// [END query]\n\t// ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ==========\n\t// [START getall]\n\tcases := make([]Case, 0, 10)\n\tif _, err := query.GetAll(ctx, &cases); err != nil {\n\t\t/*\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t\t*/\n\t}\n\t// [END getall]\n\t// ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ==========\n\t/*\n\tif err := guestbookTemplate.Execute(w, greetings); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\t*/\n\t// ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ==========\n\toutput = `\n\t\t<a href=\"/case/1\" class=\"case-block\">\n\t\t\t<img src=\"/caseuploads/blankcase1.jpg\" />\n\t\t\t<span class=\"name-container\">CASENAME</span>\n\t\t\t<span class=\"watt-container\"><span class=\"watts\">123</span> Watt BoomCase</span>\n\t\t\t<span class=\"price-container\">$<span class=\"price\">1500</span></span>\n\t\t</a>\n\t`\n\t// ========== ========== ========== ========== ==========\n\n\n\t// ========== ========== ========== ========== ========== ========== ========== ========== ========== ==========\n\n\n\n\n\n\n\n\n\t// ========== ========== ========== ========== ==========\n\t// New Context - opaque value used by many functions in the Go App Engine SDK to communicate with the App Engine service\n\t// [START new_context]\n\n\t//c := appengine.NewContext(r)\n\n\t// [END new_context]\n\t// ========== ========== ========== ========== ==========\n\n\n\n\n\n\t// ========== ========== ========== ========== ==========\n\t// Getting current user\n\t/*\n\t// If the user is already signed in to your application, user.Current returns a pointer to a user.User value. Otherwise, it returns nil:\n\tif u := user.Current(c); u != nil {\n\t\tg.Author = u.Email\n\t}\n\t// We set the same parent key on every Greeting entity to ensure each Greeting is in the same entity group.\n\t// Queries across the single entity group will be consistent.\n\t// However, the write rate to a single entity group should be limited to ~1/second.\n\tkey := datastore.NewIncompleteKey(c, \"Greeting\", guestbookKey(c))\n\t_, err := datastore.Put(c, key, &g)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t*/\n\t// ========== ========== ========== ========== ==========\n\n\n\n\n\t// ========== ========== ========== ========== ==========\n\t// func root\n\t/*\n\t// Ancestor queries, as shown here, are strongly consistent with the High Replication Datastore.\n\t// Queries that span entity groups are eventually consistent.\n\t// If we omitted the .Ancestor from this query there would be a slight chance that Greeting that had just been written would not show up in a query.\n\n\t// The following code constructs a Query value that requests the 10 most recent Greeting objects that are descendants of the root guestbook key in Date-descending order\n\t// [START query]\n\tq := datastore.NewQuery(\"Greeting\").Ancestor(guestbookKey(c)).Order(\"-Date\").Limit(10)\n\t// [END query]\n\n\t// The following code calls q.GetAll(c, &greetings) to run the query and append the results to the greetings slice:\n\t// [START getall]\n\tgreetings := make([]Greeting, 0, 10)\n\tif _, err := q.GetAll(c, &greetings); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\t// [END getall]\n\n\tif err := guestbookTemplate.Execute(w, greetings); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n\t*/\n\t// ========== ========== ========== ========== ==========\n\n\n\n\n\t// ========== ========== ========== ========== ==========\n\t// func sign\n\t/*\n\tg := Greeting{\n\t\tContent: r.FormValue(\"content\"),\n\t\tDate: time.Now(),\n\t}\n\n\t// [START if_user]\n\tif u := user.Current(c); u != nil {\n\t\tg.Author = u.Email\n\t}\n\t// We set the same parent key on every Greeting entity to ensure each Greeting is in the same entity group.\n\t// Queries across the single entity group will be consistent.\n\t// However, the write rate to a single entity group should be limited to ~1/second.\n\tkey := datastore.NewIncompleteKey(c, \"Greeting\", guestbookKey(c))\n\t_, err := datastore.Put(c, key, &g)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\thttp.Redirect(w, r, \"/\", http.StatusFound)\n\t// [END if_user]\n\t*/\n\t// ========== ========== ========== ========== ==========\n\n\n\n\n\n\n\n\n\n\n return output\n}", "title": "" }, { "docid": "188eb79b98abaca24cfcb077fcf959ff", "score": "0.46956897", "text": "func GetCNCIs(ctx context.Context) (map[string]*CNCI, error) {\n\tvar CNCIs map[string]*CNCI\n\ttemplate := `\n{\n{{- range $i, $val := .}}\n {{- if $i }},{{end}} \n \"{{$val.ID | js }}\" : {\n \"tenant_id\" : \"{{$val.TenantID | js }}\", \"ip\" : \"{{$val.IPv4 | js}}\",\n \"geo\": \"{{$val.Geography | js }}\", \"subnets\": [\n {{- range $j, $net := $val.Subnets -}}\n {{- if $j }},{{end -}}\n \"{{- $net.Subnet -}}\"\n {{- end -}}\n ]}\n {{- end }}\n}\n`\n\targs := []string{\"list\", \"cncis\", \"-f\", template}\n\terr := RunCIAOCmdAsAdminJS(ctx, \"\", args, &CNCIs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn CNCIs, nil\n}", "title": "" }, { "docid": "38c639c0278ec3ab181d3f9091dfd418", "score": "0.46879125", "text": "func Retrieve_gmm_gwy_gps(gmm_api_key string, org_id int, gwy_sn string) (gps_history string) {\n\njsonValue, _ := json.Marshal(\"\")\n\n// Retrieving corresponding gateway ID\ngwy_id := Retrieve_gmm_gwy_id(gmm_api_key, org_id, gwy_sn)\n\nnow := time.Now()\nfrom_time := (now.Unix() - 3600) * 1000\nto_time := now.Unix() * 1000\nurl := \"https://us.ciscokinetic.io/api/v2/gate_ways/\" + strconv.Itoa(gwy_id) + \"/gps_history?from_time=\" + strconv.FormatInt(from_time, 10) + \"&to_time=\" + strconv.FormatInt(to_time, 10)\n\nrequest, _ := http.NewRequest(\"GET\", url, bytes.NewBuffer(jsonValue))\ntoken := \"Token \" + gmm_api_key\nrequest.Header.Set(\"Authorization\", token)\nclient := &http.Client{}\nr, err := client.Do(request)\n\nif err != nil {\nfmt.Printf(\"Retrieve GMM GWY GPS History error %s\\n\", err)\nos.Exit(1)\n}\n\nresponseData, _ := ioutil.ReadAll(r.Body)\nreturn string(responseData)\n}", "title": "" }, { "docid": "bcefb9791bd678a722e6ca2e6c7394de", "score": "0.46649912", "text": "func (g *Geocodio) Call(path string, query map[string]string) (GeocodeResult, error) {\n\n\tif strings.Index(path, \"/\") != 0 {\n\t\treturn GeocodeResult{}, errors.New(\"Path must start with a forward slash: ' / ' \")\n\t}\n\n\t_url := GeocodioAPIBaseURLv1 + path + \"?api_key=\" + g.APIKey\n\n\tfor k, v := range query {\n\t\t_url = _url + \"&\" + k + \"=\" + url.QueryEscape(v)\n\t}\n\n\ttimeout := time.Duration(10 * time.Second)\n\tclient := http.Client{\n\t\tTimeout: timeout,\n\t}\n\n\tresp, err := client.Get(_url)\n\n\tif err != nil {\n\t\treturn GeocodeResult{}, err\n\t}\n\n\tdefer resp.Body.Close()\n\n\tbody, err := ioutil.ReadAll(resp.Body)\n\n\tif err != nil {\n\t\treturn GeocodeResult{}, err\n\t}\n\n\tresult := GeocodeResult{}\n\n\tresult.Debug.RequestedURL = _url\n\tresult.Debug.Status = resp.Status\n\tresult.Debug.StatusCode = resp.StatusCode\n\tresult.Debug.RawResponse = body\n\n\terr = json.Unmarshal(body, &result)\n\tif err != nil {\n\t\treturn result, err\n\t}\n\n\treturn result, err\n}", "title": "" }, { "docid": "2162b78bb358ec0b4f919392a42dafc6", "score": "0.46342045", "text": "func GetCovidMapValues() []covidData {\n\n\tvar retArr []covidData\n\tvar keys []string\n\n\tfor k, _ := range covidDataMap {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, k := range keys {\n\n\t\tretArr = append(retArr, covidDataMap[k])\n\n\t}\n\n\treturn retArr\n\n}", "title": "" }, { "docid": "0f8fc332b725cb4734cc6e56b6242b66", "score": "0.46132043", "text": "func Do(geoFips string, geoLevel string) {\n\n\tfor _, censusGroupID := range censusGroups {\n\t\tvariablesDescGroup := getVariablesToInclude(censusGroupID, geoLevel, true)\n\n\t\tapiParams := \"\"\n\t\tfor key, _ := range variablesDescGroup {\n\t\t\tapiParams = apiParams + key + \",\"\n\t\t}\n\n\t\tcallAPI(apiParams[:len(apiParams)-1], censusGroupID, geoLevel, geoFips)\n\t}\n}", "title": "" }, { "docid": "1cfcb59b450820c7c01683cd53d4a9e0", "score": "0.4590958", "text": "func (c *CaseService) GetCasesBySiteID(siteID, lookback int) ([]*CaseDTO, error) {\n\tcases, err := c.CaseRepo.GetCasesBySiteID(siteID, lookback)\n\n\treturn cases, err\n}", "title": "" }, { "docid": "ed90ee2444a839560b9e456151cea49f", "score": "0.45719898", "text": "func (o GoogleCloudDialogflowCxV3FulfillmentConditionalCasesResponseOutput) Cases() GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseResponseArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3FulfillmentConditionalCasesResponse) []GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseResponse {\n\t\treturn v.Cases\n\t}).(GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseResponseArrayOutput)\n}", "title": "" }, { "docid": "3bbecbedfb10c6cb573286c0094cb464", "score": "0.4570726", "text": "func GetCityReport(ctx iris.Context) {\n\tfirstYear, err := ctx.URLParamInt64(\"firstYear\")\n\tif err != nil {\n\t\tctx.StatusCode(http.StatusBadRequest)\n\t\tctx.JSON(jsonError{\"Rapport par commune, décodage firstYear : \" + err.Error()})\n\t\treturn\n\t}\n\tlastYear, err := ctx.URLParamInt64(\"lastYear\")\n\tif err != nil {\n\t\tctx.StatusCode(http.StatusBadRequest)\n\t\tctx.JSON(jsonError{\"Rapport par commune, décodage lastYear : \" + err.Error()})\n\t\treturn\n\t}\n\tinseeCode, err := ctx.URLParamInt64(\"inseeCode\")\n\tif err != nil {\n\t\tctx.StatusCode(http.StatusBadRequest)\n\t\tctx.JSON(jsonError{\"Rapport par commune, décodage inseeCode : \" + err.Error()})\n\t\treturn\n\t}\n\tdb := ctx.Values().Get(\"db\").(*sql.DB)\n\tvar resp models.CityReport\n\tif err = resp.GetAll(db, inseeCode, firstYear, lastYear); err != nil {\n\t\tctx.StatusCode(http.StatusInternalServerError)\n\t\tctx.JSON(jsonError{\"Rapport par commune, requête : \" + err.Error()})\n\t\treturn\n\t}\n\tctx.StatusCode(http.StatusOK)\n\tctx.JSON(resp)\n}", "title": "" }, { "docid": "397b03b5c8d85a9b9826b8b37612abed", "score": "0.45582655", "text": "func GetHandler(w http.ResponseWriter, r *http.Request) {\n\tkeys := r.URL.Query()\n\tif len(keys) < 1 {\n\t\tlog.Println(\"No params passed\")\n\t\treturn\n\t}\n\n\tride := RideData{\n\t\tID: ID,\n\t\tStartLat: r.URL.Query().Get(\"start_lat\"),\n\t\tEndLat: r.URL.Query().Get(\"end_lat\"),\n\t\tStartLong: r.URL.Query().Get(\"start_long\"),\n\t\tEndLong: r.URL.Query().Get(\"end_long\"),\n\t}\n\n\trideJSON, _ := json.Marshal(ride)\n\n\trides = append(rides, ride)\n\n\tID++\n\tfmt.Println(\"LOG: \" + string(rideJSON))\n\tGetDistanceAndDuration(ride.StartLat, ride.EndLat, ride.StartLong, ride.EndLong)\n}", "title": "" }, { "docid": "6d5f1ee85abbdf9412ba2750bb77c629", "score": "0.4556133", "text": "func (o GoogleCloudDialogflowCxV3FulfillmentConditionalCasesPtrOutput) Cases() GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseArrayOutput {\n\treturn o.ApplyT(func(v *GoogleCloudDialogflowCxV3FulfillmentConditionalCases) []GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCase {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Cases\n\t}).(GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseArrayOutput)\n}", "title": "" }, { "docid": "90ace6bbe1d0883f6ed34a0d36bb7435", "score": "0.450047", "text": "func (h *handler) GetState(w http.ResponseWriter, r *http.Request) {\n\tlocationMap := map[string]coord{\n\t\t\"L0001\": coord{X: 38.219635, Y: -85.763125},\n\t\t\"L0002\": coord{X: 38.219685, Y: -85.763116},\n\t\t\"L0003\": coord{X: 38.219733, Y: -85.763108},\n\t\t\"L0004\": coord{X: 38.219805, Y: -85.763092},\n\t\t\"L0005\": coord{X: 38.219894, Y: -85.763082},\n\t\t\"L0006\": coord{X: 38.219975, Y: -85.763068},\n\t\t\"L0007\": coord{X: 38.220070, Y: -85.763051},\n\t\t\"L0008\": coord{X: 38.220159, Y: -85.763036},\n\t\t\"L0009\": coord{X: 38.220263, Y: -85.763027},\n\t\t\"L0010\": coord{X: 38.220782, Y: -85.762562},\n\t\t\"L0011\": coord{X: 38.220776, Y: -85.762504},\n\t\t\"L0012\": coord{X: 38.220771, Y: -85.762426},\n\t\t\"L0013\": coord{X: 38.220764, Y: -85.762363},\n\t\t\"L0014\": coord{X: 38.220757, Y: -85.762302},\n\t\t\"L0015\": coord{X: 38.220742, Y: -85.762167},\n\t\t\"L0016\": coord{X: 38.220734, Y: -85.762097},\n\t\t\"L0017\": coord{X: 38.220729, Y: -85.762034},\n\t\t\"L0018\": coord{X: 38.220721, Y: -85.761962},\n\t\t\"L0019\": coord{X: 38.220715, Y: -85.761899},\n\t\t\"L0020\": coord{X: 38.220702, Y: -85.761812},\n\t}\n\tcurrent := []state{}\n\th.Lock()\n\tfor s, o := range h.spots {\n\t\tspot := state{ID: s, Occupied: o, Price: 2.50, Location: locationMap[s]}\n\t\tcurrent = append(current, spot)\n\t}\n\th.Unlock()\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(current)\n}", "title": "" }, { "docid": "c34ce614350ddfc790442f81ae9118ef", "score": "0.44961527", "text": "func GetSecLocs(db *mgo.Database) (*model.SecLoc, error) {\n\tlocationsCollection := db.C(gutils.LOCATION)\n\tsectorsCollection := db.C(gutils.SECTOR)\n\tlocations := []*model.Location{}\n\tsectors := []*model.Sector{}\n\n\terr := locationsCollection.Find(bson.M{}).All(&locations)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = sectorsCollection.Find(bson.M{}).All(&sectors)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsecLoc := &model.SecLoc{Sectors: sectors, Locations: locations, Price: utils.InitialCreatePrice}\n\n\treturn secLoc, err\n}", "title": "" }, { "docid": "61a4ee54651bdade6182237af7a814be", "score": "0.44894803", "text": "func listaCiudades(entradaSize int, ciudadesIds string) []city{\n //Conexion a la base de datos \n database, _ := sql.Open(\"sqlite3\", \"./tsp.db\")\n\n //Creamos el arreglo de las TSP\n var ciudadesIdsArray = strings.Split(ciudadesIds, \",\")\n\n //Inicializamos un slice/arreglo de ciudades\n cities := []city{}\n\n // Iteramos en el arreglo de los id de las ciudades\n for _, ciudad := range ciudadesIdsArray{\n //Creamos la query para sacar de la base de datos la ciudad con el id correspondiente\n var sqlQuery = \"SELECT id, name, country, population, latitude, longitude FROM cities WHERE id=\"+ciudad\n //Consulta a la base de datos\n rows, _ := database.Query(sqlQuery)\n //Inicializamos valores para obtener los datos de la consulta\n var id int \n var name string\n var country string\n var population int \n var latitude float64\n var longitude float64\n //Para cada uno de los resultados de la query\n for rows.Next() {\n //Obtenemos datos de la consulta\n rows.Scan(&id, &name, &country, &population, &latitude, &longitude)\n //Creamos la estructura para la ciudad\n cid := city{id, name, country, population, latitude, longitude}\n //Agregamos la ciudad al slice/arreglo de ciudades\n cities = append(cities,cid)\n }\n }\n defer database.Close()\n return cities\n}", "title": "" }, { "docid": "9740d56f6aac9cf0ecfba13725338422", "score": "0.44852024", "text": "func (o GoogleCloudDialogflowCxV3FulfillmentConditionalCasesOutput) Cases() GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseArrayOutput {\n\treturn o.ApplyT(func(v GoogleCloudDialogflowCxV3FulfillmentConditionalCases) []GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCase {\n\t\treturn v.Cases\n\t}).(GoogleCloudDialogflowCxV3FulfillmentConditionalCasesCaseArrayOutput)\n}", "title": "" }, { "docid": "e7775e3ad57af2cd4a6dbde58606c3c7", "score": "0.44662434", "text": "func (s *State) GetCities() ([]City, error) {\n\tvar result []City\n\tvar err error\n\n\tgotCookies := false\n\ts.c.collector.AllowURLRevisit = true\n\ts.c.collector.OnResponse(func(r *colly.Response) {\n\t\t// Now with cookies we visit the index page\n\t\t// to get the list of cities.\n\t\tif !gotCookies {\n\t\t\tgotCookies = true\n\t\t\ts.c.collector.Visit(BaseURL)\n\t\t}\n\t})\n\n\ts.c.collector.OnHTML(\"#cidade > option\", func(e *colly.HTMLElement) {\n\t\tvalue := e.Attr(\"value\")\n\t\tif value != \"0\" {\n\t\t\tresult = append(result, City{\n\t\t\t\tc: s.c,\n\t\t\t\tName: e.Text,\n\t\t\t})\n\t\t}\n\t})\n\n\t// POST will set cookies.\n\terr = s.c.collector.Post(BaseAJAX+\"escolherEstados.php\", map[string]string{\n\t\t\"UF\": string(s.FU),\n\t})\n\n\ts.c.collector.AllowURLRevisit = false\n\n\treturn result, err\n}", "title": "" }, { "docid": "8160ffc39f612283f8393f614802187c", "score": "0.44633698", "text": "func (s *service) GetCities() (*Cities, error) {\n\turl := fmt.Sprintf(\"%s/cities\", config.Conf.MusementAPI)\n\tresponse, _, err := s.c.GetDataFromUrl(url)\n\tif err != nil {\n\t\tlog.Errorf(\"Could not get cities from api, error: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tvar result []City\n\terr = json.Unmarshal(response, &result)\n\tif err != nil {\n\t\tlog. Errorf(\"Could not parse json from api. Error: %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn &Cities{result}, nil\n}", "title": "" }, { "docid": "40831314fa98efda8be02cd1e201dc35", "score": "0.4455448", "text": "func getPlacesInRange(w http.ResponseWriter, r *http.Request) {\n\traw, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to read request body: %s\", err)\n\t\thttp.Error(w, \"Failed to read request body\", 400)\n\t\treturn\n\t}\n\n\tgetPlacesInput := &GetPlacesInRangeInput{}\n\terr = json.Unmarshal(raw, getPlacesInput)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to unmarshal: %s\", err)\n\t\thttp.Error(w, \"Failed to unmarshal\", 400)\n\t\treturn\n\t}\n\tlog.Print(\"Unmarshaled\")\n\n\tscanInput := &dynamodb.ScanInput{\n\t\tTableName: aws.String(DDB_TABLE_NAME),\n\t}\n\n\tresponse, err := ddb.Scan(scanInput)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to scan: %s\", err)\n\t\thttp.Error(w, \"Failed to scan\", 400)\n\t\treturn\n\t}\n\tlatitude, err := strconv.ParseFloat(getPlacesInput.Latitude, 64)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to convert latitude to float: %s\", err)\n\t\thttp.Error(w, \"Failed to convert latitude to float\", 400)\n\t\treturn\n\t}\n\tlongitude, err := strconv.ParseFloat(getPlacesInput.Longitude, 64)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to convert longitude to float: %s\", err)\n\t\thttp.Error(w, \"Failed to convert longitude to float\", 400)\n\t\treturn\n\t}\n\tradiusDegrees, err := strconv.ParseFloat(getPlacesInput.Radius, 64)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to convert radius to float: %s\", err)\n\t\thttp.Error(w, \"Failed to convert radius to float\", 64)\n\t\treturn\n\t}\n\tradius := milesToDegrees(radiusDegrees)\n\n\tcenter := NewPoint(latitude, longitude)\n\tcircle := NewCircle(\n\t\t*center,\n\t\tradius,\n\t)\n\toutput := GetPlacesOutput{}\n\toutput.UserID = getPlacesInput.UserID\n\n\ttableData := response.Items\n\tfor _, ddb_place := range tableData {\n\t\tplace := &Place{}\n\t\terr = dynamodbattribute.ConvertFromMap(ddb_place, place)\n\t\tif err == nil {\n\t\t\tlatitude, err := strconv.ParseFloat(place.Latitude, 64)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlongitude, err := strconv.ParseFloat(place.Longitude, 64)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tplacePoint := NewPoint(latitude, longitude)\n\t\t\tif isPointInCircle(*circle, *placePoint) {\n\t\t\t\toutput.Places = append(output.Places, place)\n\t\t\t}\n\t\t}\n\t}\n\n\traw, err = json.Marshal(output)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to marshal response: %s\", err)\n\t\thttp.Error(w, \"Failed to marshal response\", 400)\n\t\treturn\n\t}\n\tw.Write(raw)\n}", "title": "" }, { "docid": "ff1fb6dfe07861f0176baebe332e31ec", "score": "0.4434799", "text": "func Cities(mapCoords ...string) []City {\n\tresult := make([]City, 0, len(mapCoords)/2)\n\n\tfor _, coord := range mapCoords {\n\t\tif val, ok := cities[coord]; ok {\n\t\t\tresult = append(result, val)\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "fc273dad4c253f59798c8badb73c49cb", "score": "0.4431976", "text": "func (cpi *cloudInfo) GetContinents() []string {\n\treturn []string{ContinentAsia, ContinentAustralia, ContinentEurope, ContinentNorthAmerica, ContinentSouthAmerica}\n}", "title": "" }, { "docid": "74c77d087cfa9e152add41bd474a0111", "score": "0.44318604", "text": "func (g *GeoipCountriesSrc) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/geoip.countries_src\", &g.Value, options...)\n}", "title": "" }, { "docid": "89e58003cf7aa724972bcc7bcd916e5f", "score": "0.44171798", "text": "func (l Location) TotalCases() int {\n\tif len(l.Records) > 0 {\n\t\treturn l.Records[len(l.Records)-1].TotalCases\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "bfa24168395b07085251b5d538999cca", "score": "0.44072407", "text": "func GetCCAndPC(ip string) (string, string, error) {\n\tCC := \"\"\n\tPC := \"\"\n\tareaInfo, err := GetGEOInfo(ip)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\t//fmt.Printf(\"country:%v region:%v\\n\", areaInfo.country, areaInfo.region)\n\tif strings.Contains(areaInfo.country, \"中国\") {\n\t\tif provinceCode, ok := pc[areaInfo.region]; ok {\n\t\t\tCC = \"CN\"\n\t\t\tPC = provinceCode\n\t\t\treturn CC, PC, nil\n\t\t}\n\t\t//\n\t\treturn \"CN\", \"\", nil\n\t}\n\tif countryCode, ok := cc[areaInfo.country]; ok {\n\t\tCC = countryCode\n\t\treturn CC, PC, nil\n\t}\n\treturn CC, PC, errors.New(\"no GEO info in IP-GEO database, ip: \" + ip)\n}", "title": "" }, { "docid": "6acc738633c7e4a547bc1f8c97b1ede9", "score": "0.4405832", "text": "func (mock *UniversalClientMock) GeoDistCalls() []struct {\n\tKey string\n\tMember1 string\n\tMember2 string\n\tUnit string\n} {\n\tvar calls []struct {\n\t\tKey string\n\t\tMember1 string\n\t\tMember2 string\n\t\tUnit string\n\t}\n\tlockUniversalClientMockGeoDist.RLock()\n\tcalls = mock.calls.GeoDist\n\tlockUniversalClientMockGeoDist.RUnlock()\n\treturn calls\n}", "title": "" }, { "docid": "ceba1973c84d9ca36758c00c4edf1e3b", "score": "0.4402573", "text": "func adcpCertHandler(w http.ResponseWriter, r *http.Request) {\n\tfmt.Println(\"method:\", r.Method) // get request method\n\n\tif r.Method == \"GET\" {\n\n\t\tserialNum := bone.GetValue(r, \"id\") // Get the value of the \"id\" parameters in the URL.\n\t\tadcp := getAdcp(serialNum) // Get the ADCP data from the DB\n\t\tadcpCert := &AdcpCert{Adcp: *adcp} // Set the ADCP to struct\n\t\tadcpCert.CompassCal = getCompassCalCertData(serialNum) // Get Compass Cal from the DB\n\t\tadcpCert.TankTest = getTankTestResultCertData(serialNum) // Get Tank Test from the DB\n\t\tadcpCert.SnrTest = getSnrTestResultCertData(serialNum) // Get SNR Test from the DB\n\t\tadcpCert.WaterTest = getWaterTestResultCertData(serialNum) // Get Water Test from the DB\n\n\t\tt, _ := template.ParseFiles(\"header.html\", \"adcp_cert.html\", \"footer.html\")\n\t\tt.ExecuteTemplate(w, \"header\", nil)\n\t\tt.ExecuteTemplate(w, \"content\", adcpCert)\n\t\tt.ExecuteTemplate(w, \"footer\", nil)\n\t\tt.Execute(w, adcpCert)\n\t}\n}", "title": "" }, { "docid": "714e4147e953235a5e34ba47d24358ce", "score": "0.44012168", "text": "func CustPlaceIn(vs ...string) predicate.MstCustomer {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.MstCustomer(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(FieldCustPlace), v...))\n\t})\n}", "title": "" }, { "docid": "0a1db748fdce4a08640ec666e63ef3f8", "score": "0.43947878", "text": "func getCasesString(name []string, expected []string) []CasesString {\n\treturn []CasesString{\n\t\t{\n\t\t\tname: name[0],\n\t\t\tdata: getDefaultMatrix(),\n\t\t\texpected: expected[0],\n\t\t},\n\t\t{\n\t\t\tname: name[1],\n\t\t\tdata: [][]string{{\"9\", \"8\", \"7\", \"0\"}, {\"6\", \"5\", \"4\", \"0\"}, {\"3\", \"2\", \"1\", \"0\"}, {\"0\", \"0\", \"0\", \"0\"}},\n\t\t\texpected: expected[1],\n\t\t},\n\t}\n}", "title": "" }, { "docid": "85f2e8f5e1c62431606bf6c5e6d1f9e9", "score": "0.43944073", "text": "func getRoutes(v Location) string {\n\tx := v.Coord.X\n\ty := v.Coord.Y\n\n\tvar output string\n\n\tif checkCoord(x, y+1) == true {\n\t\toutput = output + \"\\nN: To the north is the \" + lm[Coordinates{x, y + 1}].Name + \".\"\n\t}\n\n\tif checkCoord(x+1, y+1) == true {\n\t\toutput = output + \"\\nNE: To the northeast is the \" + lm[Coordinates{x + 1, y + 1}].Name + \".\"\n\t}\n\n\tif checkCoord(x+1, y) == true {\n\t\toutput = output + \"\\nE: To the east is the \" + lm[Coordinates{x + 1, y}].Name + \".\"\n\t}\n\n\tif checkCoord(x+1, y-1) == true {\n\t\toutput = output + \"\\nSE: To the southeast is the \" + lm[Coordinates{x + 1, y - 1}].Name + \".\"\n\t}\n\n\tif checkCoord(x, y-1) == true {\n\t\toutput = output + \"\\nS: To the south is the \" + lm[Coordinates{x, y - 1}].Name + \".\"\n\t}\n\n\tif checkCoord(x-1, y-1) == true {\n\t\toutput = output + \"\\nSW: To the southwest is the \" + lm[Coordinates{x - 1, y - 1}].Name + \".\"\n\t}\n\n\tif checkCoord(x-1, y) == true {\n\t\toutput = output + \"\\nW: To the west is the \" + lm[Coordinates{x - 1, y}].Name + \".\"\n\t}\n\n\tif checkCoord(x-1, y+1) == true {\n\t\toutput = output + \"\\nNW: To the northwest is the \" + lm[Coordinates{x - 1, y + 1}].Name + \".\"\n\t}\n\n\treturn output\n\n}", "title": "" }, { "docid": "0c1068112e0389cf7d6017f8e18cdc10", "score": "0.43935007", "text": "func (o *SecurityMonitoringRuleCreatePayload) GetCasesOk() (*[]SecurityMonitoringRuleCase, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.Cases, true\n}", "title": "" }, { "docid": "78b792df8161676ea44ad730aae8d764", "score": "0.4392687", "text": "func (nearbyInfo *NearbyAmenitiesInfo) getCafes(latitude, longitude float64) (err error) {\n\tmatrix, err := getDistanceMatrix(latitude, longitude, \"cafe\")\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\tnearbyInfo.Cafes = *matrix\n\n\treturn\n}", "title": "" }, { "docid": "bfb4d33a96901d2582607c96e358f353", "score": "0.43826705", "text": "func location1(name, city string) (name1, continent string){\n switch city{\n\n case \"New York\", \"LA\", \"Chicago\":\n continent = \"North America\"\n default:\n continent = \"Unknown\"\n }\n\n name1 = name\n\n return \n}", "title": "" }, { "docid": "eab3d107b05b7f703d3acd4cf37bb709", "score": "0.43774366", "text": "func (e *EmailpkiGlobalCity) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/emailpki.global.city\", &e.Value, options...)\n}", "title": "" }, { "docid": "e11cfc4749c9f99c19171de3cdf467cc", "score": "0.43757877", "text": "func (a *AviasalesApi) CityDirections(origin string) (flights DataCityDirectionsFlight, err error) {\n\terr = a.getJson(\"v1/city-directions\", map[string]string{\n\t\t\"origin\": origin,\n\t\t\"token\": a.token,\n\t}, &flights)\n\treturn\n}", "title": "" }, { "docid": "b0f103961f4e91bc6e0021b84d743049", "score": "0.43632096", "text": "func certificationsHandler(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tuserID := getTrailheadID(w, vars[\"id\"])\n\tif userID == \"\" {\n\t\treturn\n\t}\n\n\ttrailheadData := doTrailheadAuraCallout(trailhead.GetApexAction(\"AchievementService\", \"fetchAchievements\", userID, \"\", \"\"), \"\")\n\n\tif trailheadData.Actions != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tjson.NewEncoder(w).Encode(trailheadData.Actions[0].ReturnValue.ReturnValue.CertificationsResult)\n\t} else {\n\t\twriteErrorToBrowser(w, `{\"error\":\"No data returned from Trailhead.\"}`, 503)\n\t}\n}", "title": "" }, { "docid": "9a2f955283645b476b5e88362524dae7", "score": "0.43431947", "text": "func GetCovidCases(c echo.Context) (err error) {\n fmt.Println(\"Calling API...\")\n client := &http.Client{}\n req, err := http.NewRequest(\"GET\", \"https://api.apify.com/v2/actor-tasks/81uAfgDHw6d8n1eNd/run-sync-get-dataset-items?token=p2CpMHQHSjXuayE8HPcdYaXjc\", nil)\n if err != nil {\n fmt.Print(err.Error())\n }\n req.Header.Add(\"Accept\", \"application/json\")\n req.Header.Add(\"Content-Type\", \"application/json\")\n resp, err := client.Do(req) //making request\n if err != nil {\n fmt.Print(err.Error())\n }\n defer resp.Body.Close()\n //log.Println(resp.Body)\n bodyBytes, err := ioutil.ReadAll(resp.Body) //reading resonse\n if err != nil {\n fmt.Print(err.Error())\n }\n var responseObject model.Response //object of struct type Response\n json.Unmarshal(bodyBytes, &responseObject) //unmarshaling the response\n //fmt.Printf(\"API Response as struct %+v\\n\", responseObject)\n UpdateData(responseObject)\n return c.JSON(http.StatusOK,\"CovidCases Updated in MongoDb\") \n}", "title": "" }, { "docid": "0a69ff35d12dfc34530728aa1661cd73", "score": "0.433766", "text": "func GeolocateHandler(w http.ResponseWriter, r *http.Request) {\n r.ParseForm()\n debug, _ := strconv.ParseBool(strings.Join(r.Form[\"debug\"], \"\"))\n geoAPIKey := strings.Join(r.Form[\"google_geolocation_apikey\"], \"\")\n url := fmt.Sprintf(\n \"https://www.googleapis.com/geolocation/v1/geolocate?key=%s\", geoAPIKey)\n if len(cGeoLoc) == 0 {\n if debug {\n raw := loadTestFile(\"tests/asviz/geolocate-d.json\")\n cGeoLoc = string(raw)\n } else {\n buf := new(bytes.Buffer)\n resp, err := http.Post(url, \"application/json\", buf)\n if err != nil {\n returnError(w, err)\n return\n }\n defer resp.Body.Close()\n body, _ := ioutil.ReadAll(resp.Body)\n cGeoLoc = string(body)\n }\n }\n fmt.Println(cGeoLoc)\n fmt.Fprintf(w, cGeoLoc)\n}", "title": "" }, { "docid": "98da7d3809c1c4109fae9172d3b48cd1", "score": "0.43263772", "text": "func GetGeoTokens(funcArgs []string) ([]string, *GeoQueryData, error) {\n\tx.AssertTruef(len(funcArgs) > 1, \"Invalid function\")\n\tfuncName := strings.ToLower(funcArgs[0])\n\tswitch funcName {\n\tcase \"near\":\n\t\tif len(funcArgs) != 3 {\n\t\t\treturn nil, nil, x.Errorf(\"near function requires 3 arguments, but got %d\",\n\t\t\t\tlen(funcArgs))\n\t\t}\n\t\tmaxDist, err := strconv.ParseFloat(funcArgs[2], 64)\n\t\tif err != nil {\n\t\t\treturn nil, nil, x.Wrapf(err, \"Error while converting distance to float\")\n\t\t}\n\t\tif maxDist < 0 {\n\t\t\treturn nil, nil, x.Errorf(\"Distance cannot be negative\")\n\t\t}\n\t\tg, err := convertToGeom(funcArgs[1])\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn queryTokensGeo(QueryTypeNear, g, maxDist)\n\tcase \"within\":\n\t\tif len(funcArgs) != 2 {\n\t\t\treturn nil, nil, x.Errorf(\"within function requires 2 arguments, but got %d\",\n\t\t\t\tlen(funcArgs))\n\t\t}\n\t\tg, err := convertToGeom(funcArgs[1])\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn queryTokensGeo(QueryTypeWithin, g, 0.0)\n\tcase \"contains\":\n\t\tif len(funcArgs) != 2 {\n\t\t\treturn nil, nil, x.Errorf(\"contains function requires 2 arguments, but got %d\",\n\t\t\t\tlen(funcArgs))\n\t\t}\n\t\tg, err := convertToGeom(funcArgs[1])\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn queryTokensGeo(QueryTypeContains, g, 0.0)\n\tcase \"intersects\":\n\t\tif len(funcArgs) != 2 {\n\t\t\treturn nil, nil, x.Errorf(\"intersects function requires 2 arguments, but got %d\",\n\t\t\t\tlen(funcArgs))\n\t\t}\n\t\tg, err := convertToGeom(funcArgs[1])\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn queryTokensGeo(QueryTypeIntersects, g, 0.0)\n\tdefault:\n\t\treturn nil, nil, x.Errorf(\"Invalid geo function\")\n\t}\n}", "title": "" }, { "docid": "1a9ec0618996850571e26dd7bc3569a9", "score": "0.43089974", "text": "func GetCV(Pt []float64, Mode int) (Status int, CV []float64, SFD float64, SINF float64, NINF int) {\n\n\t//\tvar NINF int = 0 // Number of violated constraints\n\t//\tvar SINF float64 = 0.0 // Sum of LHS-RHS violations\n\t//\tvar SFD float64 = 0.0 // Sum of the feasibility distance vectors\n\tvar Violation float64 // The constraint violation\n\tvar FVLength float64 // Length of the feasibility vector\n\tNumViol := make([]int, len(Pt)) // Number of violations\n\tSumViol := make([]float64, len(Pt)) // Sum of violations (in terms of feasibility vector components)\n\tSumWeightedViol := make([]float64, len(Pt)) // Sum of the weighted violations (weighted by violation)\n\tSumWeights := make([]float64, len(Pt)) // Sum of the weights\n\t//\tCCPoint := make([]float64, len(Pt)) // Constraint consensus point\n\t//\tCV := make([]float64, len(Pt)) // Consensus Vector\n\t//\tBestPt := make([]float64, len(Pt)) // The best point seen in this CC run\n\t//\tvar BestPtSFD float64 = plinfy\n\tFVMaxViol := make([]float64, len(Pt)) // Captures the individual feasibility vector associated with the maximum LHS-RHS violation\n\tFVMaxFVLength := make([]float64, len(Pt)) // Captures the individual feasibility vector associated with the largest feasibility vector\n\tvar MaxViol float64 // Captures the maximum LHS-RHS violation seen\n\tvar MaxFVLength float64 // Catures the maximum feasibility vector length seen\n\tvar NewMaxViol bool // Boolean to notice when a larger MaxViol is seen\n\tvar NewMaxFVLength bool // Boolean to notice when a large MaxFVLength is seen\n\t//\tvar Status int\n\tvar FVStatus int = 0\n\tvar ViolStatus int = 0\n\tvar ElNum int // Element number\n\tvar ColNum int // Column number\n\tvar rhold, rhold1 float64\n\tvar CVLength float64\n\t//\tvar CVLengthLast float64\n\t//\tvar MaxMultiplier float64\n\t//\tvar NumMultipliers int\n\t//\tvar FDFar bool = false\n\t//var rhold1 float64\n\n\t//var Status int = 0\n\n\t//Status=0\n\n\t// Zero the accumulators\n\tNINF = 0\n\tSFD = 0.0\n\tSINF = 0.0\n\tMaxViol = -plinfy\n\tMaxFVLength = -plinfy\n\tfor i := range Pt {\n\t\tNumViol[i] = 0\n\t\tSumViol[i] = 0.0\n\t\tCV[i] = 0.0\n\t\tFVMaxViol[i] = 0.0\n\t\tFVMaxFVLength[i] = 0.0\n\t\tSumWeightedViol[i] = 0.0\n\t\tSumWeights[i] = 0.0\n\t}\n\n\t// Run through the constraints\n\tfor icon := 0; icon < lp.NumRows; icon++ {\n\t\t// Get the feasibility vector, if there is one\n\n\t\t//test\n\t\tif math.IsNaN(Pt[0]) {\n\t\t\tfmt.Println(\"***1 GetViolation called with NaN point in GetCV\")\n\t\t}\n\t\tFVStatus, ViolStatus, Violation = GetViolation(icon, Pt)\n\n\t\t//test\n\t\t//fmt.Println(\"After GetViolation call for con\",icon,\"Violation:\",Violation,\"FVStatus:\",FVStatus,\"ViolStatus:\",ViolStatus)\n\n\t\tif FVStatus > 0 {\n\t\t\tfmt.Println(\"Error evaluating feasibility status for constraint\", icon, \". Skipping it in GetCV.\")\n\t\t\tcontinue\n\t\t}\n\t\tif ViolStatus > 0 {\n\t\t\t// not violated, so skip\n\t\t\tcontinue\n\t\t}\n\t\t// Check length of feasibility vector\n\t\trhold = 0.0 // Accumulates length of feasibility vector\n\t\tfor iel := 0; iel < lp.LP.Rows[icon].NumEl; iel++ {\n\t\t\tElNum = lp.LP.Rows[icon].ElList[iel]\n\t\t\tColNum = lp.Element[ElNum].Col\n\t\t\trhold1 = Violation * lp.Element[ElNum].Value / lp.LP.Rows[icon].GradVecLenSq\n\t\t\trhold = rhold + rhold1*rhold1\n\t\t}\n\t\tif rhold < Alpha*Alpha {\n\t\t\t// Feasibility vector is too short so skip this constraint\n\t\t\tcontinue\n\t\t}\n\n\t\t// Constraint is violated\n\t\tNINF++\n\t\tFVLength = math.Sqrt(rhold)\n\t\tSFD = SFD + FVLength\n\t\tSINF = SINF + math.Abs(Violation)\n\n\t\t//\t\t\t// Instead of classing a constraint as violated if the feasibility vector is too long,\n\t\t//\t\t\t// use the classical LHS-RHS violation tolerance\n\t\t//\t\t\tif math.Abs(Violation) <= featol {\n\t\t//\t\t\t\tcontinue\n\t\t//\t\t\t}\n\n\t\t// If using SINF\n\t\tNewMaxViol = false\n\t\tif math.Abs(Violation) > MaxViol {\n\t\t\t// There's a new maximum violation\n\t\t\tMaxViol = math.Abs(Violation)\n\t\t\tNewMaxViol = true\n\t\t\t// Empty the old FVMaxViol vector, fill it in the following step\n\t\t\tfor j := 0; j < lp.LP.NumCols; j++ {\n\t\t\t\tFVMaxViol[j] = 0.0\n\t\t\t}\n\t\t}\n\t\t// If using SFD\n\t\tNewMaxFVLength = false\n\t\tif FVLength > MaxFVLength {\n\t\t\t// There is a new longest feasibility vector\n\t\t\tMaxFVLength = FVLength\n\t\t\tNewMaxFVLength = true\n\t\t\t// Empty the old FVMaxFVLength, fill it in the next step\n\t\t\tfor j := 0; j < lp.NumCols; j++ {\n\t\t\t\tFVMaxFVLength[j] = 0.0\n\t\t\t}\n\t\t}\n\n\t\t// Calculate the relevant elements of the feasibility vector\n\t\tfor iel := 0; iel < lp.LP.Rows[icon].NumEl; iel++ {\n\t\t\tElNum = lp.LP.Rows[icon].ElList[iel]\n\t\t\tColNum = lp.Element[ElNum].Col\n\t\t\tNumViol[ColNum]++\n\t\t\tSumViol[ColNum] = SumViol[ColNum] + Violation*lp.Element[ElNum].Value/lp.LP.Rows[icon].GradVecLenSq\n\t\t\tSumWeightedViol[ColNum] = SumWeightedViol[ColNum] + Violation*lp.Element[ElNum].Value/lp.LP.Rows[icon].GradVecLenSq*math.Abs(Violation)\n\t\t\tSumWeights[ColNum] = SumWeights[ColNum] + math.Abs(Violation)\n\t\t\tif NewMaxViol {\n\t\t\t\tFVMaxViol[ColNum] = Violation * lp.Element[ElNum].Value / lp.LP.Rows[icon].GradVecLenSq\n\t\t\t}\n\t\t\tif NewMaxFVLength {\n\t\t\t\tFVMaxFVLength[ColNum] = Violation * lp.Element[ElNum].Value / lp.LP.Rows[icon].GradVecLenSq\n\t\t\t}\n\t\t}\n\t} // end of loop on the constraints\n\n\t// Run through the bounds looking for violations and making appropriate updates\n\tfor ivar := 0; ivar < lp.NumCols; ivar++ {\n\t\tif Pt[ivar] >= lp.LP.Cols[ivar].BndLo-Alpha {\n\t\t\t// greater than lower bound\n\t\t\tif Pt[ivar] <= lp.LP.Cols[ivar].BndUp+Alpha {\n\t\t\t\t// less than upper bound\n\t\t\t\tcontinue\n\t\t\t} else if Pt[ivar]-lp.LP.Cols[ivar].BndUp > Alpha {\n\t\t\t\t// upper bound violated by large enough amount\n\t\t\t\tNINF++\n\t\t\t\tNumViol[ivar]++\n\t\t\t\trhold = lp.LP.Cols[ivar].BndUp - Pt[ivar]\n\t\t\t\tSumViol[ivar] = SumViol[ivar] + rhold\n\t\t\t\tSFD = SFD + math.Abs(rhold)\n\t\t\t\tSumWeightedViol[ivar] = SumViol[ivar]\n\t\t\t\tSumWeights[ivar] = SumWeights[ivar] + rhold\n\n\t\t\t\tif Pt[ivar]-lp.LP.Cols[ivar].BndUp > MaxViol {\n\t\t\t\t\t// There's a new maximum violation\n\t\t\t\t\tMaxViol = Pt[ivar] - lp.LP.Cols[ivar].BndUp\n\t\t\t\t\t// Empty the old FVMaxViol vector, fill it in the following step\n\t\t\t\t\tfor j := 0; j < lp.LP.NumCols; j++ {\n\t\t\t\t\t\tFVMaxViol[j] = 0.0\n\t\t\t\t\t}\n\t\t\t\t\tFVMaxViol[ivar] = lp.LP.Cols[ivar].BndUp - Pt[ivar]\n\t\t\t\t}\n\t\t\t\tif math.Abs(rhold) > MaxFVLength {\n\t\t\t\t\t// There's a new longest FV\n\t\t\t\t\tMaxFVLength = math.Abs(rhold)\n\t\t\t\t\t// Empty the old FVMaxFVLength and fill it in following step\n\t\t\t\t\tfor j := 0; j < lp.NumCols; j++ {\n\t\t\t\t\t\tFVMaxFVLength[j] = 0.0\n\t\t\t\t\t}\n\t\t\t\t\tFVMaxFVLength[ivar] = lp.LP.Cols[ivar].BndUp - Pt[ivar]\n\t\t\t\t}\n\n\t\t\t}\n\t\t} else if lp.LP.Cols[ivar].BndLo-Pt[ivar] > Alpha {\n\t\t\t// lower bound violated by large enough amount\n\t\t\tNINF++\n\t\t\tNumViol[ivar]++\n\t\t\trhold = lp.LP.Cols[ivar].BndLo - Pt[ivar]\n\t\t\tSumViol[ivar] = SumViol[ivar] + rhold\n\t\t\tSFD = SFD + rhold\n\t\t\tSumWeightedViol[ivar] = SumViol[ivar]\n\t\t\tSumWeights[ivar] = SumWeights[ivar] + lp.LP.Cols[ivar].BndLo - Pt[ivar]\n\n\t\t\tif lp.LP.Cols[ivar].BndLo-Pt[ivar] > MaxViol {\n\t\t\t\t// There's a new maximum violation\n\t\t\t\tMaxViol = lp.LP.Cols[ivar].BndLo - Pt[ivar]\n\t\t\t\t// Empty the old FVMaxViol vector, fill it in the following step\n\t\t\t\tfor j := 0; j < lp.LP.NumCols; j++ {\n\t\t\t\t\tFVMaxViol[j] = 0.0\n\t\t\t\t}\n\t\t\t\tFVMaxViol[ivar] = lp.LP.Cols[ivar].BndLo - Pt[ivar]\n\t\t\t}\n\t\t\tif rhold > MaxFVLength {\n\t\t\t\t// There's a new longest FV\n\t\t\t\tMaxFVLength = rhold\n\t\t\t\t//Empty the old FVMaxFVLength and fill it in the following step\n\t\t\t\tfor j := 0; j < lp.NumCols; j++ {\n\t\t\t\t\tFVMaxFVLength[j] = 0.0\n\t\t\t\t}\n\t\t\t\tFVMaxFVLength[ivar] = rhold\n\t\t\t}\n\n\t\t}\n\t}\n\n\tif NINF == 0 {\n\t\t// Exit successfully with a feasible point\n\t\tfor i := 0; i < lp.NumCols; i++ {\n\t\t\tCV[i] = 0.0\n\t\t}\n\t\treturn 0, CV, SFD, SINF, 0\n\t}\n\n\tswitch Mode {\n\n\tcase 0, 1: // Basic CC or superimposed FD vector\n\t\t// Calculate the consensus vector vector and it's length\n\t\trhold = 0.0 // Accumulates the squared elements of the consensus vector\n\t\tfor ivar := 0; ivar < lp.NumCols; ivar++ {\n\t\t\tif NumViol[ivar] == 0 {\n\t\t\t\tCV[ivar] = 0.0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tCV[ivar] = SumViol[ivar] / float64(NumViol[ivar]) // For standard basic CC\n\t\t\trhold = rhold + CV[ivar]*CV[ivar]\n\t\t}\n\t\tCVLength = math.Sqrt(rhold)\n\t\tif CVLength < Beta {\n\t\t\t//CV is too short\n\t\t\tif Mode == 0 {\n\t\t\t\t// Basic CV\n\t\t\t\treturn 1, CV, SFD, SINF, NINF\n\t\t\t}\n\t\t\t// Mode is 1, which superimposes the longest FD vector on top on the basic CV\n\t\t\trhold = 0.0\n\t\t\tfor ivar := 0; ivar < lp.NumCols; ivar++ {\n\t\t\t\tif FVMaxFVLength[ivar] != 0.0 {\n\t\t\t\t\tCV[ivar] = FVMaxFVLength[ivar]\n\t\t\t\t}\n\t\t\t\trhold = rhold + CV[ivar]*CV[ivar]\n\t\t\t}\n\t\t\tCVLength = math.Sqrt(rhold)\n\t\t\tif CVLength < Beta {\n\t\t\t\treturn 1, CV, SFD, SINF, NINF\n\t\t\t}\n\t\t\treturn 0, CV, SFD, SINF, NINF\n\t\t}\n\t\treturn 0, CV, SFD, SINF, NINF\n\n\tcase 2: // CV weighted by lengths of feasibility vectors\n\t\trhold = 0.0 // Accumulates the squared elements of the consensus vector\n\t\tfor ivar := 0; ivar < lp.NumCols; ivar++ {\n\t\t\tif NumViol[ivar] == 0 {\n\t\t\t\tCV[ivar] = 0.0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tCV[ivar] = SumWeightedViol[ivar] / SumWeights[ivar] // For violation-weighted CC\n\t\t\trhold = rhold + CV[ivar]*CV[ivar]\n\t\t}\n\t\tCVLength = math.Sqrt(rhold)\n\t\tif CVLength < Beta {\n\t\t\t//CV is too short\n\t\t\treturn 1, CV, SFD, SINF, NINF\n\t\t}\n\t\treturn 0, CV, SFD, SINF, NINF\n\n\tcase 3: // SUM method\n\t\trhold = 0.0 // Accumulates the squared elements of the consensus vector\n\t\tfor ivar := 0; ivar < lp.NumCols; ivar++ {\n\t\t\tif NumViol[ivar] == 0 {\n\t\t\t\tCV[ivar] = 0.0\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tCV[ivar] = SumViol[ivar] // For the SUM method\n\t\t\trhold = rhold + CV[ivar]*CV[ivar]\n\t\t}\n\t\tCVLength = math.Sqrt(rhold)\n\t\tif CVLength < Beta {\n\t\t\t//CV is too short\n\t\t\treturn 1, CV, SFD, SINF, NINF\n\t\t}\n\t\treturn 0, CV, SFD, SINF, NINF\n\n\t} // end of switch on Mode\n\n\t//***righthere: Things to do:\n\t// potentially update all of the incumbents now this point is assessed\n\t// should return length of CV too, since it is used in some of the CC methods\n\treturn 0, CV, SFD, SINF, NINF\n}", "title": "" }, { "docid": "96bdbdde0625fd21c72f95a5cd8ec04f", "score": "0.43042177", "text": "func GetCoverage(fname string) ([]int64, error) {\n\tf, err := os.Open(fname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmycov := make([]int64, 0)\n\tfor i := 0; ; i++ {\n\t\tdata := make([]byte, 8)\n\t\tbytesread, ferr := f.Read(data)\n\t\tif ferr == io.EOF {\n\t\t\treturn mycov, nil\n\t\t}\n\t\tif ferr != nil {\n\t\t\treturn nil, ferr\n\t\t}\n\t\tif bytesread == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tif i == 0 {\n\t\t\tif !(is64BitHeader(data) || is32BitHeader(data)) {\n\t\t\t\treturn nil, errors.New(\"can't find header\")\n\t\t\t}\n\t\t\t// don't add the header to covset\n\t\t\tcontinue\n\t\t}\n\t\tvar dint int64\n\t\tbuf := bytes.NewReader(data)\n\t\terr := binary.Read(buf, binary.LittleEndian, &dint)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tmycov = append(mycov, dint)\n\t}\n\treturn mycov, nil\n}", "title": "" }, { "docid": "73a4fd8e52ec7d06628e57f6175781a7", "score": "0.43039173", "text": "func (c *Client) GetCase(caseID int) (Case, error) {\n\treturnCase := Case{}\n\terr := c.sendRequest(\"GET\", fmt.Sprintf(\"get_case/%d\", caseID), nil, &returnCase)\n\treturn returnCase, err\n}", "title": "" }, { "docid": "ca2ffb235a52b142eb12e577a428e784", "score": "0.42974815", "text": "func (dis *Districts) GetDistricts(stateId string) {\n\tvariable.GetDist = variable.GetDist + stateId\n\tfmt.Printf(\"Token: %v\", variable.Bearer)\n\tresp, err := variable.Client.R().SetHeader(\"Accept\", \"application/json\").SetAuthToken(variable.Bearer).Get(variable.GetDist)\n\tif err != nil {\n\t\tlog.Printf(\"ERROR in getting response: %v\", err)\n\t}\n\tjson.Unmarshal(resp.Body(), dis)\n\n}", "title": "" }, { "docid": "b34df746973b0293556af0a8989d64de", "score": "0.4294774", "text": "func _TestGetCaseFromInt(t *testing.T) {\n\tw := newDoorman(getProbs(\"1/4\", \"1/2\", \"1/4\"))\n\texpts := map[int]uint{\n\t\t2: 2,\n\t\t13: 2,\n\t\t195: 1,\n\t}\n\tfor data, expt := range expts {\n\t\tif res := w.getCaseFromInt(data); res != expt {\n\t\t\tt.Error(\"incorrect results for: \", data, res)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "093f4b97a288ff3466caa63094610150", "score": "0.4292065", "text": "func (cpi *cloudInfo) GetContinentsData(provider, service string) (map[string][]Region, error) {\n\tif cachedVal, ok := cpi.cloudInfoStore.GetRegions(provider, service); ok {\n\t\tvar continents = make(map[string][]Region)\n\t\tfor id, name := range cachedVal {\n\t\t\tcontinent := getContinent(id)\n\t\t\tcontinents[continent] = append(continents[continent], Region{\n\t\t\t\tId: id,\n\t\t\t\tName: name,\n\t\t\t})\n\t\t}\n\t\treturn continents, nil\n\t}\n\n\treturn nil, emperror.With(errors.New(\"regions not yet cached\"), \"provider\", provider, \"services\", service)\n}", "title": "" }, { "docid": "38cc729223d39963ff5993ed6f5e3e2f", "score": "0.42814752", "text": "func (annotatorForClinicalDataAcd *AnnotatorForClinicalDataAcdV1) CartridgesGet(cartridgesGetOptions *CartridgesGetOptions) (result *ListStringWrapper, response *core.DetailedResponse, err error) {\n\terr = core.ValidateStruct(cartridgesGetOptions, \"cartridgesGetOptions\")\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpathSegments := []string{\"v1/cartridges\"}\n\tpathParameters := []string{}\n\n\tbuilder := core.NewRequestBuilder(core.GET)\n\t_, err = builder.ConstructHTTPURL(annotatorForClinicalDataAcd.Service.Options.URL, pathSegments, pathParameters)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tfor headerName, headerValue := range cartridgesGetOptions.Headers {\n\t\tbuilder.AddHeader(headerName, headerValue)\n\t}\n\n\tsdkHeaders := common.GetSdkHeaders(\"annotator_for_clinical_data_acd\", \"V1\", \"CartridgesGet\")\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(*annotatorForClinicalDataAcd.Version))\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 = annotatorForClinicalDataAcd.Service.Request(request, &rawResponse)\n\tif err != nil {\n\t\treturn\n\t}\n\terr = core.UnmarshalModel(rawResponse, \"\", &result, UnmarshalListStringWrapper)\n\tif err != nil {\n\t\treturn\n\t}\n\tresponse.Result = result\n\n\treturn\n}", "title": "" }, { "docid": "f388143f92565fcd1c2b24a43476028e", "score": "0.4260595", "text": "func replyWithSpecificc(w http.ResponseWriter, DB countryStorage, id string, limit string) {\n\turl := \"http://api.gbif.org/v1/occurrence/search?country=\" + id + \"&limit=\" + limit\n\tresp, err := http.Get(url)\t\t\t\t\t\t\t\t// get url above\n\tif err != nil {\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Error handling for if fetching fails\n\t\thttp.Error(w, \"Occurrence Service Unavailable\", http.StatusServiceUnavailable)\n\t\tDN.TestApi(\"occurrence\")\t\t\t\t\t\t\t\t// Assign error to diagnostics\n\t}\n\tdefer resp.Body.Close()\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(resp.Body)\n\trespByte := buf.Bytes()\n\tjson.Unmarshal(respByte, &OCCstructure)\t\t// Copy JSON Into map\n\n\tfor idx, x := range OCCstructure.Oresult{ // For each occurrence\n\t\tif idx == 0 {\t\t\t\t\t\t\t\t\t\t\t\t\t\t// Skip header\n\t\t\tcontinue\n\t\t}\n\t\tDBc.AssignSpecies(x)\t\t\t\t\t\t\t\t\t\t// Assign the species (occurrence) to the specific country using function\n\t}\n\n\ts, ok := DB.Get(id)\t\t\t\t\t\t\t\t\t\t\t\t// Get country from DBc\n\tif !ok {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// CHeck if it exists\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\t\tjson.NewEncoder(w).Encode(s)\t\t\t\t\t\t\t// Print as JSON to creen\n}", "title": "" }, { "docid": "bee55cca722b6fc68535613ec3f2b524", "score": "0.42511037", "text": "func NewCasesHandler(db *driver.DB) *newCasesRepo {\n\treturn &newCasesRepo{\n\t\trepo: newCases.NewSQLNewCasesRepo(db.SQL),\t// 'newCases' (interface implementation)\n\t}\n}", "title": "" }, { "docid": "778b78b7934d1f0bfd3cf8d33e7cc9f9", "score": "0.4249264", "text": "func getLocations(w http.ResponseWriter, req *http.Request) {\n\tenableCors(&w)\n\n\tdefer req.Body.Close()\n\tjsonBlob, _ := ioutil.ReadAll(req.Body)\n\tvar reqParams LocationIDsParam\n\tjson.Unmarshal([]byte(string(jsonBlob)), &reqParams)\n\tlocationIDs := reqParams.LocationIDs\n\tvar response GetLocationsInfoResponse\n\n\t// get shapes\n\tvar locationCounts []int\n\tvar locations []api.Location\n\tvar locationsStyle []LocationStyle\n\tfor _, locationID := range locationIDs {\n\t\tlocations = append(locations, locationQueryer.LocationDict[locationID])\n\t\tinfectEvents := IDsFilter.InfectEventDataDict[locationID]\n\t\tevents := IDsFilter.EventDataDict[locationID].Events\n\t\teventsLen := float32(len(events))\n\t\tsmallAng := eventsLen / float32(globalTimeSpan[globalFilename])\n\t\tnormalizedSmallAng := (eventsLen - float32(globalEventNumRange[globalFilename].MinNum)) /\n\t\t\t(float32(globalEventNumRange[globalFilename].MaxNum) - float32(globalEventNumRange[globalFilename].MinNum))\n\t\tinfectDurationSum := 0\n\t\tfor _, event := range infectEvents {\n\t\t\tinfectDurationSum += event.DurationTime\n\t\t}\n\t\tvar infectEventsLen = float32(len(infectEvents))\n\t\t// fmt.Println(\"debug\", infectEvents)\n\t\tvar infectDurationAve = float32(infectDurationSum) / infectEventsLen\n\t\tlocationCounts = append(locationCounts, IDsFilter.EventDataDict[locationID].Count)\n\t\tlocationsStyle = append(locationsStyle, LocationStyle{smallAng, normalizedSmallAng, infectDurationAve})\n\t}\n\n\tlocationsBackup = locations\n\n\t// get events?\n\tresponse = GetLocationsInfoResponse{200, locations, locationCounts, locationsStyle}\n\tresponseJSON, _ := json.Marshal(response)\n\tw.Write(responseJSON)\n}", "title": "" }, { "docid": "f1beeb4c0ef137c903321a52a9d0e344", "score": "0.42416227", "text": "func (o SecurityMonitoringDefaultRuleOutput) Cases() SecurityMonitoringDefaultRuleCaseArrayOutput {\n\treturn o.ApplyT(func(v *SecurityMonitoringDefaultRule) SecurityMonitoringDefaultRuleCaseArrayOutput { return v.Cases }).(SecurityMonitoringDefaultRuleCaseArrayOutput)\n}", "title": "" }, { "docid": "7c077b693857a0037a78e6291648548a", "score": "0.42158815", "text": "func (o *OpenShot) GetClips(projectID int) (*Clips, error) {\n\tlog := getLogger(\"GetClips\")\n\tvar clips Clips\n\terr := o.http.Get(log, o.clipsURL(projectID), nil, &clips)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &clips, nil\n}", "title": "" }, { "docid": "0041f76d1c597927c9ff5a9f8d45f20b", "score": "0.4208766", "text": "func (idb *InDB) GetAllGPS(c *gin.Context) {\n\n\tvar (\n\t\tmessage []structs.GPS\n\t\tresult gin.H\n\t)\n\n\tidb.DB.Find(&message)\n\tif len(message) <= 0 {\n\t\tresult = gin.H{\n\t\t\t\"result\": nil,\n\t\t\t\"count\": 0,\n\t\t}\n\t} else {\n\t\tresult = gin.H{\n\t\t\t\"result\": message,\n\t\t\t\"count\": len(message),\n\t\t}\n\t}\n\n\tc.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "f2a6cc574694df7c51f0f38a45a3295d", "score": "0.42072728", "text": "func GetChInfoByID(ctx *sgo.Context) error {\n\ttimeRange, now := range2stamp(ctx.Param(\"range\"))\n\tchInfo, err := modelGetChInfoByID(ctx.Param(\"gateway\"), ctx.Param(\"sensorID\"), timeRange, now)\n\tif err != nil {\n\t\treturn ctx.JSON(500, 0, err.Error(), nil)\n\t}\n\tif len(chInfo) == 0 {\n\t\treturn ctx.JSON(200, 0, \"no result found\", nil)\n\t}\n\treturn ctx.JSON(200, 1, \"success\", chInfo)\n}", "title": "" }, { "docid": "0184263c40070ddc902b257193f3edb1", "score": "0.4203695", "text": "func location(city string) (string, string) {\n var region string\n var continent string\n\n // We are switching on the variable city and the cases check for the value\n // of the city.\n switch city{\n case \"Los Angeles\", \"LA\", \"Santa Monica\":\n region, continent = \"California\", \"North America\"\n\n case \"New York\", \"NYC\":\n region, continent = \"New York\", \"North America\"\n\n default:\n region, continent = \"Unknown\", \"Unknown\"\n }\n return region, continent\n}", "title": "" }, { "docid": "261a1592ad5ad3e6672b6351019c31f1", "score": "0.41965434", "text": "func GetPoints(trips TripsConfig, dayString string) map[int]float64 {\n\n\tpoints := make(map[int]float64)\n\tfor i := 1; i < 25; i++ {\n\t\tpoints[i] = 0\n\t}\n\tfor _, trip := range trips.Trips {\n\n\t\tt, err := time.Parse(\"2006-01-02 15:04:05 -0700\", trip.StartTime)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"parse error\", err.Error())\n\t\t}\n\n\t\tday, err := strconv.Atoi(dayString)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tif t.Day() == day && trip.StartStationID == 229 {\n\t\t\tpoints[t.Hour()]++\n\t\t}\n\t}\n\n\treturn points\n\n}", "title": "" }, { "docid": "52f7142c0f923a038777b1c7b315c1c4", "score": "0.41953093", "text": "func GetDirections(ctx context.Context, depratureTime time.Time, origin common.GeoPoint, points []common.GeoPoint) ([]time.Time, []int, error) {\n\tif points == nil || len(points) == 0 {\n\t\treturn nil, nil, errInvalidParameter.WithMessage(\"Invalid waypoints\")\n\t}\n\tif len(points) == 1 {\n\t\tt := origin.EstimatedDuration(points[0])\n\t\tduration := time.Duration(2*t) * time.Second\n\t\treturn []time.Time{depratureTime.Add(duration)}, []int{0}, nil\n\t}\n\tmapsClient, err := getMapsClient(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\twaypoints := []string{\"optimize:true\"}\n\tfor _, v := range points {\n\t\twaypoints = append(waypoints, v.String())\n\t}\n\treq := &maps.DirectionsRequest{\n\t\tOrigin: origin.String(),\n\t\tDestination: origin.String(),\n\t\tDepartureTime: ttos(depratureTime),\n\t\tUnits: maps.UnitsImperial,\n\t\tWaypoints: waypoints,\n\t}\n\troutes, _, err := mapsClient.Directions(ctx, req)\n\tif err != nil {\n\t\treturn nil, nil, errMaps.WithError(err).Wrap(\"cannot maps.Directions\")\n\t}\n\toptimalPointsOrder := routes[0].WaypointOrder\n\t// get arrival times\n\tnumLegs := len(routes[0].Legs)\n\tvar arrivalTimes []time.Time\n\tfor i := 0; i < numLegs-2; i++ {\n\t\tarrivalTimes = append(arrivalTimes, routes[0].Legs[i].ArrivalTime)\n\t}\n\treturn arrivalTimes, optimalPointsOrder, nil\n}", "title": "" }, { "docid": "e964e07e6cc343b4a38d85b7c25e0ce2", "score": "0.4194864", "text": "func contourPaths(m GridXYZ, levels []float64, trX, trY func(float64) vg.Length) map[float64][]vg.Path {\n\tsort.Float64s(levels)\n\n\tends := make(map[float64]endMap)\n\tconts := make(contourSet)\n\tconrec(m, levels, func(_, _ int, l line, z float64) {\n\t\tpaths(l, z, ends, conts)\n\t})\n\tends = nil\n\n\t// TODO(kortschak): Check that all non-loop paths have\n\t// both ends at boundary. If any end is not at a boundary\n\t// it may have a partner near by. Find this partner and join\n\t// the two conts by merging the near by ends at the mean\n\t// location. This operation is done level by level to ensure\n\t// close contours of different heights are not joined.\n\t// A partner should be a float error different end, but I\n\t// suspect that is is possible for a bi- or higher order\n\t// furcation so it may be that the path ends at middle node\n\t// of another path. This needs to be investigated.\n\n\t// Excise loops from crossed paths.\n\tfor c := range conts {\n\t\t// Always try to do quick excision in production if possible.\n\t\tc.exciseLoops(conts, true)\n\t}\n\n\t// Build vg.Paths.\n\tpaths := make(map[float64][]vg.Path)\n\tfor c := range conts {\n\t\tpaths[c.z] = append(paths[c.z], c.path(trX, trY))\n\t}\n\n\treturn paths\n}", "title": "" }, { "docid": "f110047815202588f5b6f106954b3c66", "score": "0.41943264", "text": "func CaseNew(c echo.Context) error {\n\tdefer c.Request().Body.Close()\n\n\t//TODO: fix this generals function validatePermission and others\n\terr := validatePermission(c, \"cases_new\")\n\tif err != nil {\n\t\treturn returnInvalidResponse(http.StatusForbidden, err, err.Error())\n\t}\n\t_, info := cases.New(c, nil)\n\treturn info\n}", "title": "" }, { "docid": "b2e8b783780ba7bcc17dd97d136bae2a", "score": "0.41861105", "text": "func FindDriverWithinDistanceInKM (distance float64,location_x float64,location_y float64, status string) []int {\r\n psqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s \"+\r\n \"password=%s dbname=%s sslmode=disable\",\r\n host, port, user, password, dbname)\r\n db, err := sql.Open(\"postgres\", psqlInfo)\r\n if err != nil {\r\n panic(err)\r\n } \r\n defer db.Close()\r\n \r\n rows, err := db.Query(\"select findDriverWithinDistance($1,$2,$3,$4,$5)\", distance,location_x,location_y,status,kmInDecimalDegree)\r\n var driverIds []int\r\n for rows.Next() {\r\n \tvar id int;\r\n err = rows.Scan(&id)\r\n \r\n if err != nil {\r\n // handle this error\r\n panic(err)\r\n }\r\n driverIds = append(driverIds,id)\r\n\r\n }\r\n\r\n return driverIds;\r\n}", "title": "" }, { "docid": "bec300ed4f3968631536ae073f7b7042", "score": "0.41848314", "text": "func getAvailableCities() (cities []string) {\n\treturn []string{\n\t\t\"Cairo\",\n\t\t\"Chennai\",\n\t\t\"Denizli\",\n\t\t\"Dubai\",\n\t\t\"Johannesburg\",\n\t\t\"Lagos\",\n\t\t\"Tel Aviv\",\n\t\t\"Atlanta\",\n\t\t\"Buenos Aires\",\n\t\t\"Chicago\",\n\t\t\"Dallas\",\n\t\t\"Denver\",\n\t\t\"Los Angeles\",\n\t\t\"Los Angeles-PF\",\n\t\t\"Mexico City\",\n\t\t\"Miami\",\n\t\t\"Montreal\",\n\t\t\"New Jersey\",\n\t\t\"New York\",\n\t\t\"New York-PF\",\n\t\t\"Phoenix\",\n\t\t\"Salt Lake City\",\n\t\t\"San Jose\",\n\t\t\"Sao Paulo\",\n\t\t\"Seattle\",\n\t\t\"Toronto\",\n\t\t\"Vancouver\",\n\t\t\"Washington DC\",\n\t\t\"Auckland\",\n\t\t\"Hanoi\",\n\t\t\"Hong Kong\",\n\t\t\"Jakarta\",\n\t\t\"Manila\",\n\t\t\"Melbourne\",\n\t\t\"Moscow\",\n\t\t\"Seoul\",\n\t\t\"Sibu\",\n\t\t\"Singapore\",\n\t\t\"St Petersburg\",\n\t\t\"Sydney\",\n\t\t\"Taipei\",\n\t\t\"Tokyo\",\n\t\t\"Amsterdam\",\n\t\t\"Athens\",\n\t\t\"Belgrade\",\n\t\t\"Brussels\",\n\t\t\"Bucharest\",\n\t\t\"Budapest\",\n\t\t\"Copenhagen\",\n\t\t\"Dublin\",\n\t\t\"Frankfurt\",\n\t\t\"Helsinki\",\n\t\t\"Kiev\",\n\t\t\"Lisbon\",\n\t\t\"London\",\n\t\t\"London-PF\",\n\t\t\"Luxembourg\",\n\t\t\"Madrid\",\n\t\t\"Manchester\",\n\t\t\"Milan\",\n\t\t\"Oslo\",\n\t\t\"Oulu\",\n\t\t\"Paris\",\n\t\t\"Prague\",\n\t\t\"Sofia\",\n\t\t\"Stockholm\",\n\t\t\"Vienna\",\n\t\t\"Warsaw\",\n\t\t\"Zurich\",\n\t}\n}", "title": "" }, { "docid": "43c99e04a9a6b5e4084d96824612e52a", "score": "0.41808063", "text": "func parseCases(cases Cases) (casesv reflect.Value, ncases, nfields int, err error) {\n\tcasesv = reflect.ValueOf(cases)\n\tif !casesv.IsValid() {\n\t\terr = fmt.Errorf(\"cases not valid, reflection failed\")\n\t\treturn\n\t}\n\n\t// Ensure cs is a slice of cases.\n\tkc := casesv.Kind()\n\tif kc != reflect.Slice {\n\t\terr = fmt.Errorf(\"wrong kind of argument. Got %v, want %v\", kc, \"slice\")\n\t\treturn\n\t}\n\n\t// Ensure there is at least 1 case.\n\tncases = casesv.Len()\n\tif ncases == 0 {\n\t\terr = fmt.Errorf(\"too few cases. Got 0, want at least 1\")\n\t\treturn\n\t}\n\n\t// Ensure each case is a struct.\n\tkc = casesv.Type().Elem().Kind()\n\tif kc != reflect.Struct {\n\t\terr = fmt.Errorf(\"wrong input type. Got []%v, want []%v\", kc, \"struct\")\n\t\treturn\n\t}\n\n\t// Ensure cases have at least 1 field, for the label.\n\tnfields = casesv.Index(0).NumField()\n\tif nfields == 0 {\n\t\terr = fmt.Errorf(\"too few fields in cases. Got 0, want at least 1\")\n\t\treturn\n\t}\n\n\t// Ensure the first field, the label, is a string.\n\tkfc := casesv.Index(0).Field(0).Kind()\n\tif kfc != reflect.String {\n\t\terr = fmt.Errorf(\"invalid type for first field. Got %v, want %v\", kfc, \"string\")\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "500f2f6fba824f1d40629a9bcb626634", "score": "0.41763893", "text": "func GetGeoDataFromIP(ipaddr string) (model_struct.GeoData, error) {\n\n\tGeo := model_struct.GeoData{}\n\n\tdb, err := geoip2.Open(\"data/GeoLite2-City.mmdb\")\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn Geo, err\n\t}\n\tdefer db.Close()\n\n\t//67.181.148.192\n\tip := net.ParseIP(ipaddr)\n\trecord, err := db.City(ip)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn Geo, err\n\t}\n\tGeo.CITY = record.City.Names[\"en\"]\n\tif len(record.Subdivisions) > 0 {\n\t\tGeo.SUBDEVISIONNAME = record.Subdivisions[0].Names[\"en\"]\n\t}\n\n\tGeo.IP_ADDRESS = ipaddr\n\tGeo.LAT = record.Location.Latitude\n\tGeo.LONG = record.Location.Longitude\n\tGeo.RADIUS = record.Location.AccuracyRadius\n\n\treturn Geo, nil\n\n}", "title": "" }, { "docid": "718b53f907d00a83fd83ac5849b4124f", "score": "0.41685903", "text": "func getCoords(node string) (string, string) {\n\t// Initialise variables\n\tvar lat string = \"\"\n\tvar long string = \"\"\n\n\t// Make the API call\n\tresponse := httpReq(\"http://192.168.0.17/api/interpreter?data=[out:json];node(\" + node + \");out;\")\n\n\t// Get the elements from within the response\n\tcoords, _ := response.GetObjectArray(\"elements\")\n\tfor _, properties := range coords {\n\t\t// Extract the latitude and longitude from the JSON\n\t\tlatitude, _ := properties.GetNumber(\"lat\")\n\t\tlongitude, _ := properties.GetNumber(\"lon\")\n\t\tlat = string(latitude)\n\t\tlong = string(longitude)\n\t}\n\n\t// Return the latitude and longitude of the node\n\treturn lat, long\n}", "title": "" }, { "docid": "e99176f901776434d2fb8d2447272829", "score": "0.4168304", "text": "func getCasesNumber(values []int64) []CasesNumber {\n\n\treturn []CasesNumber{\n\t\t{\n\t\t\tname: \"Success\",\n\t\t\tdata: getDefaultMatrix(),\n\t\t\texpected: values[0],\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"Negative number\",\n\t\t\tdata: [][]string{{\"1\", \"2\"}, {\"3\", \"-4\"}},\n\t\t\texpected: values[1],\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"Conversion error\",\n\t\t\tdata: [][]string{{\"1\", \"W\"}, {\"3\", \"4\"}},\n\t\t\texpected: 0,\n\t\t\terr: errors.New(\"Error converting W to integer\"),\n\t\t},\n\t\t{\n\t\t\tname: \"Big matrix\",\n\t\t\tdata: [][]string{\n\t\t\t\t{\"1\", \"2\", \"3\", \"4\", \"5\", \"6\"},\n\t\t\t\t{\"7\", \"8\", \"9\", \"10\", \"11\", \"12\"},\n\t\t\t\t{\"13\", \"14\", \"15\", \"16\", \"17\", \"18\"},\n\t\t\t\t{\"19\", \"20\", \"21\", \"22\", \"23\", \"24\"},\n\t\t\t\t{\"25\", \"26\", \"27\", \"28\", \"29\", \"30\"},\n\t\t\t\t{\"31\", \"32\", \"33\", \"34\", \"35\", \"36\"},\n\t\t\t},\n\t\t\texpected: values[2],\n\t\t\terr: nil,\n\t\t},\n\t\t{\n\t\t\tname: \"Matrix with zero\",\n\t\t\tdata: [][]string{{\"1\", \"0\"}, {\"3\", \"4\"}},\n\t\t\texpected: values[3],\n\t\t\terr: nil,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6bebe742fd1f193ba73349a7b80c9bf5", "score": "0.4164868", "text": "func GetTides(fc *geojson.FeatureCollection, context *Context) (*geojson.FeatureCollection, error) {\n\tvar (\n\t\terr error\n\t\ttout out\n\t\tresult *geojson.FeatureCollection\n\t)\n\ttidesURL := context.TidesURL\n\ttin, dtgFeatureMap := toTidesIn(fc.Features, context)\n\n\tutil.LogAudit(context, util.LogAuditInput{Actor: \"anon user\", Action: \"POST\", Actee: tidesURL, Message: \"Requesting tide information\", Severity: util.INFO})\n\tif _, err = util.ReqByObjJSON(\"POST\", tidesURL, \"\", tin, &tout); err != nil {\n\t\treturn nil, err\n\t}\n\tutil.LogAudit(context, util.LogAuditInput{Actor: tidesURL, Action: \"POST response\", Actee: \"anon user\", Message: \"Retrieving tide information\", Severity: util.INFO})\n\n\ttideFeatures := []*geojson.Feature{}\n\tfor _, outputLocation := range tout.Locations {\n\t\tif _, ok := dtgFeatureMap[outputLocation.Dtg]; !ok {\n\t\t\tutil.LogInfo(context, \"Failed to find location for output dtg \"+outputLocation.Dtg)\n\t\t\tcontinue\n\t\t}\n\t\toldFeaturePtr, _ := dtgFeatureMap[outputLocation.Dtg]\n\t\tnewFeature := *oldFeaturePtr\n\t\tnewFeature.Properties[\"CurrentTide\"] = outputLocation.Results.CurrTide\n\t\tnewFeature.Properties[\"MinimumTide24Hours\"] = outputLocation.Results.MinTide\n\t\tnewFeature.Properties[\"MaximumTide24Hours\"] = outputLocation.Results.MaxTide\n\t\ttideFeatures = append(tideFeatures, &newFeature)\n\t}\n\n\tresult = geojson.NewFeatureCollection(tideFeatures)\n\n\treturn result, err\n}", "title": "" }, { "docid": "be8f3f93f8404dfa417827f6a43b9c12", "score": "0.4155721", "text": "func getPoints(c *gin.Context) {\n\tif fileID, err := strconv.Atoi(c.Param(\"file_id\")); err == nil {\n\t\tif file, err := getFileByID(fileID); err == nil {\n\t\t\tif len(file.Points) != 0 {\n\t\t\t\trender(c, gin.H{\"payload\": file.Points}, \"\")\n\t\t\t} else {\n\t\t\t\tif points, err := parseFile(file); err == nil {\n\t\t\t\t\tfile.Points = points\n\t\t\t\t\trender(c, gin.H{\"payload\": file.Points}, \"\")\n\t\t\t\t} else {\n\t\t\t\t\trender(c, gin.H{\"payload\": map[string]string{\n\t\t\t\t\t\t\"status\": strconv.FormatInt(http.StatusBadRequest, 10),\n\t\t\t\t\t\t\"reason\": \"error getting points\"}}, \"error.html\")\n\t\t\t\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\trender(c, gin.H{\"payload\": map[string]string{\n\t\t\t\t\"status\": strconv.FormatInt(http.StatusBadRequest, 10),\n\t\t\t\t\"reason\": \"error getting points\"}}, \"error.html\")\n\t\t\tc.AbortWithError(http.StatusBadRequest, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "06d9628b86d4909ef15374143b73924c", "score": "0.4155156", "text": "func getEventsOfCorrelatedLocations(w http.ResponseWriter, req *http.Request) {\n\tenableCors(&w)\n\n\tdefer req.Body.Close()\n\tjsonBlob, _ := ioutil.ReadAll(req.Body)\n\tvar reqParams LocationIDsParam\n\tjson.Unmarshal([]byte(string(jsonBlob)), &reqParams)\n\tlocationIDs := reqParams.LocationIDs\n\n\tIDsBackup = locationIDs\n\n\tvar response EventsResponse\n\teventsList := [][]int{}\n\tfor _, locationID := range locationIDs {\n\t\teventsList = append(eventsList, IDsFilter.EventDataDict[locationID].Events)\n\t}\n\n\t// store the eventsList in backend\n\teventsListBackup = eventsList\n\teventsListNoiseReducedBackup = eventsList\n\n\tresponse = EventsResponse{200, eventsList}\n\tresponseJSON, _ := json.Marshal(response)\n\tw.Write(responseJSON)\n}", "title": "" }, { "docid": "8e8c9db13826edf2abe62bd96d7dd3ca", "score": "0.41542706", "text": "func GetCabs(w http.ResponseWriter, r *http.Request) {\n\n\t// TO allow local testing , CORS when the UI connects from localhost:4200 to localhost:3200 of the server. Not needed if only testing using POSTMAN\n\tif origin := r.Header.Get(\"Origin\"); origin != \"\" {\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", origin)\n\t\tw.Header().Set(\"Access-Control-Allow-Methods\", \"GET, OPTIONS\")\n\t\tw.Header().Set(\"Access-Control-Allow-Headers\",\n\t\t\t\"Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization\")\n\t}\n\tif r.Method == \"OPTIONS\" {\n\t\treturn\n\t}\n\tvar cabsList models.CabsListResponseModel\n\tcabsList.Cabs = cab.GetAllCabs()\n\tcabs, err := json.Marshal(cabsList)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tservices.ErrorWithJSON(w, \"Sorry something went wrong\", http.StatusInternalServerError)\n\t}\n\tservices.ResponseWithJSON(w, cabs, http.StatusOK)\n}", "title": "" }, { "docid": "36ecb2b920c467a8b39f5441e2699e8b", "score": "0.41533867", "text": "func (a *Client) GetCoordinators(params *GetCoordinatorsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetCoordinatorsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetCoordinatorsParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"get-coordinators\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/platform/infrastructure/coordinators\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &GetCoordinatorsReader{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.(*GetCoordinatorsOK)\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 get-coordinators: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "6059fc4aba31717c5b34c19e1926f423", "score": "0.41510898", "text": "func (s *VotingChaincode) getCandidates(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tif len(args) != 1 {\n\t\treturn shim.Error(msg.GetErrMsg(\"COM_ERR_01\", []string{\"getCandidates\", \"1\"}))\n\t}\n\n\tcandidates, err := u.GetAllCompositeKeys(stub, c.CANDIDATE, []string{args[0]})\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(u.ConvertToBytes(candidates))\n}", "title": "" }, { "docid": "e63f2457a019e2f2ea6956f970c504a1", "score": "0.41445798", "text": "func getSimpleFeature(client pb.RouteGuideClient){\n\tfeature, err := client.GetFeature(context.Background(), &pb.Point{\n\t\t//send this point to service\n\t\tLatitude: 310235000,\n\t\tLongitude: 121437403,\n\t})\n\tif err != nil {\n\t\treturn\n\t}\n\n\t//when we got the client ,print out the result\n\tfmt.Println(feature)\n}", "title": "" }, { "docid": "ef2eac4784ec468c8b2f09715a3d8460", "score": "0.4139671", "text": "func FindDriverWithinDistanceInKM (distance float64,location_x float64,location_y float64, driverStatus string) [] int {\r\n return driverDao.FindDriverWithinDistanceInKM(distance,location_x,location_y,driverStatus)\r\n}", "title": "" }, { "docid": "4607e7b43ec979217eee5faf7e1afcc2", "score": "0.4136954", "text": "func (_m *MockManager) Cases() Cases {\n\tret := _m.Called()\n\n\tvar r0 Cases\n\tif rf, ok := ret.Get(0).(func() Cases); ok {\n\t\tr0 = rf()\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(Cases)\n\t\t}\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "96afa6124e8a486b1ed203b1c656040d", "score": "0.41301584", "text": "func (m *EdiscoverySearchItemRequestBuilder) CustodianSourcesById(id string)(*if56cdee80c7867e870947a6c362dab6e3bb804f5bf5cc92a2a195f902db1785c.DataSourceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"dataSource%2Did\"] = id\n }\n return if56cdee80c7867e870947a6c362dab6e3bb804f5bf5cc92a2a195f902db1785c.NewDataSourceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "630e74a41cf43fa81f1a6dd00f5d6a1f", "score": "0.41251004", "text": "func (m *EdiscoveryCasesItemOperationsRequestBuilder) Get(ctx context.Context, requestConfiguration *EdiscoveryCasesItemOperationsRequestBuilderGetRequestConfiguration)(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CaseOperationCollectionResponseable, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CreateCaseOperationCollectionResponseFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ic154d683aa4025ee28853b9c1a3c35cd1f093a1c4542feba4c07682e2752db13.CaseOperationCollectionResponseable), nil\n}", "title": "" }, { "docid": "54346998428e2b26e66c7d6504bcd802", "score": "0.41248992", "text": "func (e *EppCity) Get(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn get(client, \"/api/nodes/epp.city\", &e.Value, options...)\n}", "title": "" }, { "docid": "7f0d008869e7c0c7157be3b4a3a9842f", "score": "0.41233724", "text": "func contactPolice(lat, long string) int {\n\n\t// Get the date in a YYYY-MM format to feed into the API call\n\tmonth := time.Now().AddDate(0, -4, 0).Format(\"2006-01\")\n\n\t// Request a crime report from the given node\n\tresp, err := http.Get(\"https://data.police.uk/api/crimes-street/all-crime?lat=\" + lat + \"&lng=\" + long + \"&date=\" + month)\n\tif err != nil {\n\t\tlog.Printf(\"Error on Police HTTP request: %v\", err)\n\t}\n\n\t// Parse the http response into readable JSON\n\tresponse, err := jason.NewValueFromReader(resp.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error on parsing Police HTTP response: %v\", err)\n\t}\n\n\t// Close the connection\n\tresp.Body.Close()\n\n\t// Extract a usable array from the JSON Array\n\tarray, err := response.Array()\n\tif err != nil {\n\t\tlog.Printf(\"Error converting to array: %v\", err)\n\t}\n\n\t// Return the number of incidents\n\treturn len(array)\n}", "title": "" }, { "docid": "3fc94a29489476b5504824fdb5e4a795", "score": "0.41202518", "text": "func getCentrisData(location string) ResponseBody{\n\n\tvar reqBody RequestBody = RequestBody{Text: location, Language: \"en\"}\n\n\treqBytes, err := json.Marshal(reqBody);\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n req, _ := http.NewRequest(\"POST\", \"https://www.centris.ca/Property/GetSearchAutoCompleteData\", strings.NewReader(string(reqBytes)))\n\treq.Header.Add(\"referer\", \"https://www.centris.ca/\");\n\treq.Header.Add(\"accept-language\", \"en-US,en;q=0.9\");\n\treq.Header.Add(\"origin\", \"https://www.centris.ca\");\n\treq.Header.Add(\"content-type\", \"application/json; charset=UTF-8\");\n\treq.Header.Add(\"accept\", \"/*\");\n\treq.Header.Add(\"authority\", \"www.centris.ca\");\n\t\n res, err := http.DefaultClient.Do(req)\n if err != nil {\n panic(err)\n }\n\n defer res.Body.Close()\n body, _ := ioutil.ReadAll(res.Body)\n\n var listingResult ResponseBody\n err = json.Unmarshal(body, &listingResult)\n if err != nil {\n panic(err)\n }\n\t\n\tif res.StatusCode != http.StatusOK {\n\t\tlog.Fatal(\"Unexpected Status\", res.Status)\n\t} else {\n\t\tfmt.Println(\"Success.\", res.Status)\n\n\t}\n\n\treturn listingResult\n}", "title": "" }, { "docid": "6c2f42b5df6c1535c5ee0f3ff877bab2", "score": "0.41169718", "text": "func GetTokens(siteURL, userAgent string, clientCF *http.Client) []*http.Cookie {\n\tvar jarCF, _ = cookiejar.New(nil)\n\tclientCF.Jar = jarCF\n\tvar req, _ = http.NewRequest(\"GET\", siteURL, nil)\n\n\treq.Header.Set(\"Accept\", \"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\")\n\treq.Header.Set(\"Accept-Language\", \"en-US,en;q=0.5\")\n\treq.Header.Set(\"DNT\", \"1\")\n\treq.Header.Set(\"User-Agent\", userAgent)\n\n\tvar res, resErr = clientCF.Do(req)\n\tif resErr != nil {\n\t\tfmt.Println(\"[\"+getTimestamp()+\"]\", \"[FLUID]\", \"[CLOUDFLARE]\", \"[####]\", \"[REQUEST ERROR]\")\n\t\treturn nil\n\t}\n\tdefer res.Body.Close()\n\n\tvar resBody, _ = ioutil.ReadAll(res.Body)\n\tvar CloudFlareStatus = CheckRestricted(res)\n\n\tif CloudFlareStatus == \"JAVASCRIPT_CHALLENGE\" {\n\t\treturn solveJS(req, res, resBody, clientCF)\n\t} else if CloudFlareStatus == \"RECAPTCHA_CHALLENGE\" {\n\t\treturn solveReCaptcha(req, clientCF)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6334862304206af34d91f4eb865dc184", "score": "0.4112162", "text": "func GetDistanceAndDuration(slat string, endlat string, slng string, endlng string) {\n\turl := \"https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=\" + slat + \",\" + slng + \"&destinations=\" + endlat + \",\" + endlng + \"&key=\" + GOOGLEAPIKEY\n\trs, err := http.Get(url)\n\t// Process response\n\tif err != nil {\n\t\tprintln(\"test1\")\n\t\tpanic(err)\n\t}\n\tdefer rs.Body.Close()\n\n\tbodyBytes, err := ioutil.ReadAll(rs.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar resp Response\n\tjson.Unmarshal(bodyBytes, &resp)\n\n\trw := RideValues{\n\t\tID: rides[len(rides)-1].ID,\n\t\tDistance: resp.Rows[0].Elements[0].Distance.Value,\n\t\tDuration: resp.Rows[0].Elements[0].Duration.Value,\n\t}\n\n\tdata, err := json.Marshal(rw)\n\tfmt.Println(string(data))\n}", "title": "" }, { "docid": "970b1e12745d2d46df797a5063bf5c9e", "score": "0.40953636", "text": "func NewCase() *SCaseFunction {\n\treturn &SCaseFunction{}\n}", "title": "" }, { "docid": "8d8d6bf6f751c3fdfe4366806eecda2b", "score": "0.40949866", "text": "func (a *Client) GetRegionsForCountryUsingGET(params *GetRegionsForCountryUsingGETParams, authInfo runtime.ClientAuthInfoWriter) (*GetRegionsForCountryUsingGETOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetRegionsForCountryUsingGETParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"getRegionsForCountryUsingGET\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/{baseSiteId}/countries/{countyIsoCode}/regions\",\n\t\tProducesMediaTypes: []string{\"application/json\", \"application/xml\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetRegionsForCountryUsingGETReader{formats: a.formats},\n\t\tAuthInfo: authInfo,\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result.(*GetRegionsForCountryUsingGETOK), nil\n\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "6567292b7b8c2f1e8b0ffa85ea07cd75", "score": "0.0", "text": "func (s MessageMetadata) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "405ac6ef0ca6d299ca1b595275c0d98f", "score": "0.64746064", "text": "func (m member) String() string {\n\treturn fmt.Sprintf(\"%s=%s\", m.Key, m.Value)\n}", "title": "" }, { "docid": "f0d0b5223aecb509a4d630c0f716bab8", "score": "0.6471788", "text": "func (m Member) String() string {\n\tjm, _ := json.Marshal(m)\n\treturn string(jm)\n}", "title": "" }, { "docid": "be179c63c06bfc786766c7787d06b4b8", "score": "0.6190382", "text": "func (m Members) String() string {\n\tjm, _ := json.Marshal(m)\n\treturn string(jm)\n}", "title": "" }, { "docid": "b36a0235384eeece0edbebb0c0186aec", "score": "0.6189282", "text": "func (m Member) String() string {\n\t// A key is just an ASCII string, but a value is URL encoded UTF-8.\n\ts := fmt.Sprintf(\"%s%s%s\", m.key, keyValueDelimiter, url.QueryEscape(m.value))\n\tif len(m.properties) > 0 {\n\t\ts = fmt.Sprintf(\"%s%s%s\", s, propertyDelimiter, m.properties.String())\n\t}\n\treturn s\n}", "title": "" }, { "docid": "05b3c2849c763a5cf57fe24b8c1fb11f", "score": "0.61801904", "text": "func (m ClanMember) String() string {\n\tb, _ := json.Marshal(m)\n\treturn string(b)\n}", "title": "" }, { "docid": "8d1f5f24fc1897884d6355d18b550768", "score": "0.59661686", "text": "func (g *GoStruct) String() string {\n\treturn fmt.Sprint(g.v.Interface())\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.5964604", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.5964604", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "242e82a0a19dcbc9b6c9d9c9435dd219", "score": "0.58657914", "text": "func (p Param) String() string {\n\treturn p.name\n}", "title": "" }, { "docid": "7f79e31a4abcda8b626d10d4d629d0f1", "score": "0.5854257", "text": "func (p *Parameters) String() string {\n\treturn p.buildString(false)\n}", "title": "" }, { "docid": "0cac5cf7ba8a7cfec01584f819c0b895", "score": "0.58471674", "text": "func (cwm ClanWarMember) String() string {\n\tb, _ := json.Marshal(cwm)\n\treturn string(b)\n}", "title": "" }, { "docid": "c8e76705d2df1d1164a111d5e75b0134", "score": "0.5844735", "text": "func (m *Member) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Member(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", m.ID))\n\tbuilder.WriteString(\", city=\")\n\tbuilder.WriteString(m.City)\n\tbuilder.WriteString(\", street=\")\n\tbuilder.WriteString(m.Street)\n\tbuilder.WriteString(\", zipcode=\")\n\tbuilder.WriteString(m.Zipcode)\n\tbuilder.WriteString(\", created_at=\")\n\tbuilder.WriteString(m.CreatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", updated_at=\")\n\tbuilder.WriteString(m.UpdatedAt.Format(time.ANSIC))\n\tbuilder.WriteString(\", name=\")\n\tbuilder.WriteString(m.Name)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "5e32eb806ff55e4433e1a2361a5ae0f6", "score": "0.5796773", "text": "func deriveGoString_Stru(this extra.StructWithoutEqualMethod) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() extra.StructWithoutEqualMethod {\\n\")\n\tfmt.Fprintf(buf, \"this := &extra.StructWithoutEqualMethod{}\\n\")\n\tfmt.Fprintf(buf, \"this.Number = %#v\\n\", this.Number)\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "2e6daaa750bb307921f4b0e7a3989155", "score": "0.57853454", "text": "func (p *Parameter) String() string {\n\treturn fmt.Sprintf(\"%v\", p.value)\n}", "title": "" }, { "docid": "2a62a2cfa799102e9a5fe9adb019b0e0", "score": "0.5785162", "text": "func (ps *ParamSpec) String() string {\n\tvar buf strings.Builder\n\t// easier to add \"function\" here and strip it in Params\n\t// than to implement String in a bunch of places to add it\n\tbuf.WriteString(\"function(\")\n\tsep := \"\"\n\tv := 0 // index into Values\n\tfor i := 0; i < int(ps.Nparams); i++ {\n\t\tbuf.WriteString(sep)\n\t\tbuf.WriteString(flagsToName(ps.ParamName(i), ps.Flags[i]))\n\t\tif i >= int(ps.Nparams-ps.Ndefaults) {\n\t\t\tbuf.WriteString(\"=\")\n\t\t\tbuf.WriteString(fmt.Sprint(ps.Values[v]))\n\t\t\tv++\n\t\t}\n\t\tsep = \",\"\n\t}\n\tbuf.WriteString(\")\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.57777846", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "81eb11eb9e22f3e481b1a0ca25e9864f", "score": "0.5768594", "text": "func (p Param) String() (string, error) {\n\treturn string(p), nil\n}", "title": "" }, { "docid": "89f2b14131ac66afef4f7af2114e7a9d", "score": "0.5762477", "text": "func deriveGoString_S(this StructWithoutMethod) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() test.StructWithoutMethod {\\n\")\n\tfmt.Fprintf(buf, \"this := &test.StructWithoutMethod{}\\n\")\n\tfmt.Fprintf(buf, \"this.Name = %#v\\n\", this.Name)\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "68fe1407b4c7bda5dbbbf2c15be6284a", "score": "0.5757471", "text": "func (p *Params) String() string {\n\treturn fmt.Sprintf(\"%v\", *p)\n}", "title": "" }, { "docid": "47b9c2b5e578d7eec4daead72e0cac17", "score": "0.57396", "text": "func (feature Feature) String() string {\n\treturn fmt.Sprintf(\"%s=%v\", feature.Name, feature.Enabled)\n}", "title": "" }, { "docid": "4d751ab19cb14c5f99ea16ccc7a4ad3d", "score": "0.57350814", "text": "func deriveGoString_p(this privateStruct) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() test.privateStruct {\\n\")\n\tfmt.Fprintf(buf, \"this := &test.privateStruct{}\\n\")\n\tif this.ptrfield != nil {\n\t\tfmt.Fprintf(buf, \"this.ptrfield = func (v int) *int { return &v }(%#v)\\n\", *this.ptrfield)\n\t}\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "faa3a6df557dd556d32df74f6fe9e1da", "score": "0.57291114", "text": "func StructToString(si interface{}) string {\n\trval := reflect.ValueOf(si).Elem()\n\ttipe := rval.Type()\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"{ \")\n\tfor i := 0; i < rval.NumField(); i++ {\n\t\ttf := tipe.Field(i)\n\t\tif !rval.FieldByName(tf.Name).CanSet() {\n\t\t\tcontinue // skip unexported fields\n\t\t}\n\t\tvar fStr string\n\t\ttagv := tf.Tag.Get(SecretTag)\n\t\tif tagv == \"password\" || tagv == \"username\" {\n\t\t\tfStr = fmt.Sprintf(\"%s:**** \", tf.Name)\n\t\t} else if tagv == \"url\" {\n\t\t\tval, ok := rval.Field(i).Interface().(string)\n\t\t\tif ok {\n\t\t\t\tval = GetMaskedURL(val)\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, val)\n\t\t\t} else {\n\t\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t\t}\n\t\t} else {\n\t\t\tfStr = fmt.Sprintf(\"%s:%v \", tf.Name, rval.Field(i).Interface())\n\t\t}\n\t\tbuffer.WriteString(fStr)\n\t}\n\tbuffer.WriteString(\" }\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "fddfb1e4b6d5a0730d0c3b261718df52", "score": "0.5707621", "text": "func (s AuthParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5f3e65145487b68feab8d96fb697928", "score": "0.56598943", "text": "func (m *Member) String() string {\n\tvar builder strings.Builder\n\tbuilder.WriteString(\"Member(\")\n\tbuilder.WriteString(fmt.Sprintf(\"id=%v\", m.ID))\n\tbuilder.WriteString(\", MEMBERID=\")\n\tbuilder.WriteString(m.MEMBERID)\n\tbuilder.WriteString(\", MEMBERNAME=\")\n\tbuilder.WriteString(m.MEMBERNAME)\n\tbuilder.WriteByte(')')\n\treturn builder.String()\n}", "title": "" }, { "docid": "4735f2cba6a52fdddf8d65ad94289aa2", "score": "0.56384957", "text": "func (o *Guestmemberinfo) String() string {\n \n \n \n \n \n \n o.CustomFields = map[string]string{\"\": \"\"} \n\n j, _ := json.Marshal(o)\n str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n return str\n}", "title": "" }, { "docid": "2bf1073c65d9c3ae0c51812b8c151d26", "score": "0.5622902", "text": "func (s Struct) String() string {\n\tb, _ := json.MarshalIndent(s, \"\", \" \")\n\treturn string(b)\n}", "title": "" }, { "docid": "46615008444a6f844019e457da20363c", "score": "0.5615709", "text": "func deriveGoString_Str(this StructWithoutEqualMethod) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() test.StructWithoutEqualMethod {\\n\")\n\tfmt.Fprintf(buf, \"this := &test.StructWithoutEqualMethod{}\\n\")\n\tfmt.Fprintf(buf, \"this.Num = %#v\\n\", this.Num)\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "26432878023a9404413027f6a84676a0", "score": "0.5614791", "text": "func (v *PrimitiveRequiredStruct) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [11]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"BoolField: %v\", v.BoolField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ByteField: %v\", v.ByteField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int16Field: %v\", v.Int16Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int32Field: %v\", v.Int32Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Int64Field: %v\", v.Int64Field)\n\ti++\n\tfields[i] = fmt.Sprintf(\"DoubleField: %v\", v.DoubleField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"StringField: %v\", v.StringField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"BinaryField: %v\", v.BinaryField)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ListOfStrings: %v\", v.ListOfStrings)\n\ti++\n\tfields[i] = fmt.Sprintf(\"SetOfInts: %v\", v.SetOfInts)\n\ti++\n\tfields[i] = fmt.Sprintf(\"MapOfIntsToDoubles: %v\", v.MapOfIntsToDoubles)\n\ti++\n\n\treturn fmt.Sprintf(\"PrimitiveRequiredStruct{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "40e558af47293d0d1ddf4dc5e80db7b6", "score": "0.5609881", "text": "func (o NvmeSubsystemModifyRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.56064516", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "52456d8602d8a2f1fcd21f13348c9aaf", "score": "0.5604676", "text": "func (k *StructSimpleKey) String() string {\n var sb strings.Builder\n sb.WriteString(\"StructSimpleKey(\")\n sb.WriteString(\"id=\")\n sb.WriteString(strconv.FormatInt(int64(k.Id), 10))\n sb.WriteString(\")\")\n return sb.String()\n}", "title": "" }, { "docid": "0d871491fa1ad58619931bf9ce0c7fa0", "score": "0.5593684", "text": "func (p PotentialProvider) String() string {\n\tjt, _ := json.Marshal(p)\n\treturn string(jt)\n}", "title": "" }, { "docid": "49d9f1b6f0bf8918a8cf220f528c6b3b", "score": "0.5591593", "text": "func parameterString(name string, uuidStr string, privkey string, pubkey string, lastSignature string) string {\n\tparamStr := \"\"\n\n\tif name != \"\" {\n\t\tparamStr += fmt.Sprintf(\"Name: %v\\n\", name)\n\t}\n\tif uuidStr != \"\" {\n\t\tparamStr += fmt.Sprintf(\"UUID: %v\\n\", uuidStr)\n\t}\n\tif privkey != \"\" {\n\t\tparamStr += fmt.Sprintf(\"PrivKey: %v\\n\", privkey)\n\t}\n\tif pubkey != \"\" {\n\t\tparamStr += fmt.Sprintf(\"PubKey: %v\\n\", pubkey)\n\t}\n\tif lastSignature != \"\" {\n\t\tparamStr += fmt.Sprintf(\"lastSig: %v\\n\", lastSignature)\n\t}\n\n\treturn paramStr\n}", "title": "" }, { "docid": "50dac471dddfd875126b94a864fe54aa", "score": "0.5580823", "text": "func (s ModifyDBParameterGroupOutput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "66acd68a278f17daf9a9fb1503724e3d", "score": "0.5575168", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`params: MaximumRequestBytes: %d`, p.MaximumRequestBytes)\n}", "title": "" }, { "docid": "d2e7c7aa22c42770a81ec2d9a7af7e89", "score": "0.5572706", "text": "func (p *Param) String() string {\n\treturn p.ParamName + \" \" + p.ParamTypeDecl.String()\n}", "title": "" }, { "docid": "675cbca2d17445a20e469d1fe2df838f", "score": "0.5569399", "text": "func __vstring(s *string, p *int, v *types.JsonState, flags uint64)", "title": "" }, { "docid": "d23e2df244c227861260c3f8d49e6c66", "score": "0.55680037", "text": "func (this *Api) String() string {\n\tout, err := json.MarshalIndent(this, \"\", \" \")\n\tif err != nil {\n\t\treturn \"<nil>\"\n\t}\n\treqAddress := fmt.Sprintf(\n\t\t\"%s%sapi/%s\",\n\t\tthis.axleAddress,\n\t\tVERSION_ENDPOINT,\n\t\turl.QueryEscape(this.Identifier),\n\t)\n\treturn fmt.Sprintf(\"Api - %s: %s\", reqAddress, string(out))\n}", "title": "" }, { "docid": "bbc0a707148f9155b8d783f7e43faf92", "score": "0.5544904", "text": "func (vl VerbLevel) String() string {\n\treturn fmt.Sprintf(\"%d=%s\", vl, vl.Name())\n}", "title": "" }, { "docid": "c1057863bbdda3f95fb53d48726ca209", "score": "0.55437064", "text": "func (o ExportPolicyInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "ccf4e4f9346f1db72a4e546bc71ebd23", "score": "0.55335116", "text": "func (s OAuth2CustomParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522136", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522136", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6826f42cca6aa4693f14e0b2825a2e14", "score": "0.5512795", "text": "func (opts CWLOpts) String() string {\r\n\treturn awsutil.Prettify(opts)\r\n}", "title": "" }, { "docid": "6f6e7c5644361110d2d994b8d224353c", "score": "0.5509222", "text": "func (o SnapmirrorGetRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "2345b58fcb3c12c7dd57a211bb28d5f7", "score": "0.5508184", "text": "func toStringValue(v reflect.Value, field reflect.StructField) (string, error) {\n\tif v.Kind() == reflect.Ptr {\n\t\tif v.IsNil() {\n\t\t\treturn \"\", fmt.Errorf(\"can not marshal a nil pointer\")\n\t\t}\n\t\tv = v.Elem()\n\t}\n\n\tif v.Type() == timeType {\n\t\tt := v.Interface().(SDKTime)\n\t\treturn formatTime(t), nil\n\t}\n\n\tif v.Type() == sdkDateType {\n\t\tt := v.Interface().(SDKDate)\n\t\treturn formatDate(t), nil\n\t}\n\n\tswitch v.Kind() {\n\tcase reflect.Bool:\n\t\treturn strconv.FormatBool(v.Bool()), nil\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10), nil\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10), nil\n\tcase reflect.String:\n\t\treturn v.String(), nil\n\tcase reflect.Float32:\n\t\treturn strconv.FormatFloat(v.Float(), 'f', -1, 32), nil\n\tcase reflect.Float64:\n\t\treturn strconv.FormatFloat(v.Float(), 'f', -1, 64), nil\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"marshaling structure to a http.Request does not support field named: %s of type: %v\",\n\t\t\tfield.Name, v.Type().String())\n\t}\n}", "title": "" }, { "docid": "26368d57f3c86b7fcb6660b3c979dbdc", "score": "0.5492733", "text": "func (k *StructOptionalKey) String() string {\n var sb strings.Builder\n sb.WriteString(\"StructOptionalKey(\")\n sb.WriteString(k.StructSimpleKey.String())\n sb.WriteString(\")\")\n return sb.String()\n}", "title": "" }, { "docid": "fb1c18998723ea72d704ea6bc0d1807d", "score": "0.54914474", "text": "func (s ModifyDBParameterGroupInput) String() string {\n\treturn nifcloudutil.Prettify(s)\n}", "title": "" }, { "docid": "b36e8e754272c835c26997a25e403caa", "score": "0.54870045", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unbonding Time: \t\t%s\n Max Validators: \t \t%d\n Epoch: \t\t\t\t\t%d\n MaxValsToAddShares: %d\n MinDelegation\t\t\t\t%d\n MinSelfDelegation %d`,\n\t\tp.UnbondingTime, p.MaxValidators, p.Epoch, p.MaxValsToAddShares, p.MinDelegation, p.MinSelfDelegation)\n}", "title": "" }, { "docid": "3fa731f936f37ffde47610362c4941bb", "score": "0.54803866", "text": "func (f *apiFlag) String() string { return f.spec }", "title": "" }, { "docid": "add6769808802911b81b63cd3c73267f", "score": "0.5461074", "text": "func deriveGoStringStructs(this *Structs) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() *test.Structs {\\n\")\n\tif this == nil {\n\t\tfmt.Fprintf(buf, \"return nil\\n\")\n\t} else {\n\t\tfmt.Fprintf(buf, \"this := &test.Structs{}\\n\")\n\t\tfmt.Fprintf(buf, \"this.Struct = %s\\n\", deriveGoString_N(this.Struct))\n\t\tif this.PtrToStruct != nil {\n\t\t\tfmt.Fprintf(buf, \"this.PtrToStruct = %s\\n\", deriveGoStringName(this.PtrToStruct))\n\t\t}\n\t\tif this.SliceOfStructs != nil {\n\t\t\tfmt.Fprintf(buf, \"this.SliceOfStructs = %s\\n\", deriveGoString_40(this.SliceOfStructs))\n\t\t}\n\t\tif this.SliceToPtrOfStruct != nil {\n\t\t\tfmt.Fprintf(buf, \"this.SliceToPtrOfStruct = %s\\n\", deriveGoString_41(this.SliceToPtrOfStruct))\n\t\t}\n\t\tfmt.Fprintf(buf, \"this.StructWithoutMethod = %s\\n\", deriveGoString_S(this.StructWithoutMethod))\n\t\tif this.PtrToStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.PtrToStructWithoutMethod = %s\\n\", deriveGoString_42(this.PtrToStructWithoutMethod))\n\t\t}\n\t\tif this.SliceOfStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.SliceOfStructWithoutMethod = %s\\n\", deriveGoString_43(this.SliceOfStructWithoutMethod))\n\t\t}\n\t\tif this.SliceToPtrOfStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.SliceToPtrOfStructWithoutMethod = %s\\n\", deriveGoString_44(this.SliceToPtrOfStructWithoutMethod))\n\t\t}\n\t\tfmt.Fprintf(buf, \"return this\\n\")\n\t}\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "efb148808e5c7338a24e7ada71eb6cd1", "score": "0.5454366", "text": "func (o AggrSnaplockAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4abcfcd520d2e00b0d733c5fbcfd9010", "score": "0.5449595", "text": "func (obj *ServerInfoImpl) String() string {\n\tvar buffer bytes.Buffer\n\tbuffer.WriteString(\"ServerInfoImpl:{\")\n\tbuffer.WriteString(fmt.Sprintf(\"CacheInfo: '%+v'\", obj.cacheInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", DatabaseInfo: '%+v'\", obj.databaseInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", MemoryInfo: '%+v'\", obj.memoryInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", NetListenersInfo: '%+v'\", obj.netListenersInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", ServerStatusInfo: '%+v'\", obj.serverStatusInfo))\n\tbuffer.WriteString(fmt.Sprintf(\", TransactionsInfo: '%+v'\", obj.transactionsInfo))\n\tbuffer.WriteString(\"}\")\n\treturn buffer.String()\n}", "title": "" }, { "docid": "df8362cac7507462a63961daa947397f", "score": "0.5449312", "text": "func (p *NetworkMember) String() string {\n\treturn fmt.Sprintf(\"%s, PKIid: %v\", p.Endpoint, p.PKIID)\n}", "title": "" }, { "docid": "85b6d6b9fe6092290c8b5cebc5905c1a", "score": "0.5447738", "text": "func (g Get) String() string {\n\tout, err := json.Marshal(g)\n\tif err != nil {\n\t\treturn err.Error()\n\t}\n\treturn string(out)\n}", "title": "" }, { "docid": "5645b98d27ab43fcddf45cf0f14ffaee", "score": "0.5438647", "text": "func (v Version) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "13a7627d253470f80df7e3b18c59a35c", "score": "0.5435068", "text": "func (p Plan) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "7655b9ce32febc6f0d3c34cc1d4fd927", "score": "0.5432237", "text": "func (p PotentialProviders) String() string {\n\tjt, _ := json.Marshal(p)\n\treturn string(jt)\n}", "title": "" }, { "docid": "3b9d59f30e30aac72a5715a7ca779cff", "score": "0.54278356", "text": "func (ip *ImportParameters) String() string {\n\tb, _ := json.Marshal(ip)\n\treturn string(b)\n}", "title": "" }, { "docid": "e5591d5283fe1e03b4954adf03e94b5a", "score": "0.54232657", "text": "func (o Options) String() string {\n\toutput := []string{}\n\tt := reflect.TypeOf(o)\n\tv := reflect.ValueOf(o)\n\n\t// Iterate over all available struct fields\n\tfor i := 0; i < t.NumField(); i++ {\n\t\t// Skip values that are zero values of the struct. Otherwise Options would have\n\t\t// to track the upstream default values to always provide all options.\n\t\tif v.Field(i).Interface() == reflect.Zero(v.Field(i).Type()).Interface() {\n\t\t\tcontinue\n\t\t}\n\t\ttag := t.Field(i).Tag.Get(\"krbd\")\n\t\t// Bool types don't include their value just the tag.\n\t\tif v.Field(i).Kind() == reflect.Bool {\n\t\t\toutput = append(output, tag)\n\t\t} else {\n\t\t\toutput = append(output, fmt.Sprintf(\"%s=%v\", tag, v.Field(i)))\n\t\t}\n\t}\n\treturn strings.Join(output, \",\")\n}", "title": "" }, { "docid": "1be5a42b527d5469d2f968e69fbf6c74", "score": "0.5422375", "text": "func (o SnapmirrorGetRequestDesiredAttributes) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "f1dd16e8800ca4dd39dcdee6905ea98d", "score": "0.5420609", "text": "func (request VerificationRequest) String() string {\n\tret, _ := json.Marshal(request)\n\treturn string(ret)\n}", "title": "" }, { "docid": "735f0df9f609b7f60edbbdffb704f897", "score": "0.541977", "text": "func (v Vlan) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "7adbafcd2f0855af600cca13f7272e17", "score": "0.5415002", "text": "func (opt Option) String() string {\n\treturn \"{\" + string(opt.Name) + \" \" + opt.Parameters.String() + \"}\"\n}", "title": "" }, { "docid": "718ebf5d3d46fa75adbca55173719590", "score": "0.5410955", "text": "func (i *Info) JSONString(indent bool) string {\n\treturn marshal.SafeJSON(i.ctx, gpuPrinter{i}, indent)\n}", "title": "" }, { "docid": "70fc9ec4d3df13ff0f532a0f589cfd4d", "score": "0.5408141", "text": "func (v *Primitives) String() string {\n\tx := (*PrimitiveRequiredStruct)(v)\n\n\treturn fmt.Sprint(x)\n}", "title": "" }, { "docid": "17d3ceddce745241859756d4909c9351", "score": "0.5405381", "text": "func (k NodePublic) WireGuardGoString() string {\n\t// This implementation deliberately matches the overly complicated\n\t// implementation in wireguard-go.\n\tb64 := func(input byte) byte {\n\t\treturn input + 'A' + byte(((25-int(input))>>8)&6) - byte(((51-int(input))>>8)&75) - byte(((61-int(input))>>8)&15) + byte(((62-int(input))>>8)&3)\n\t}\n\tb := []byte(\"peer(____…____)\")\n\tconst first = len(\"peer(\")\n\tconst second = len(\"peer(____…\")\n\tb[first+0] = b64((k.k[0] >> 2) & 63)\n\tb[first+1] = b64(((k.k[0] << 4) | (k.k[1] >> 4)) & 63)\n\tb[first+2] = b64(((k.k[1] << 2) | (k.k[2] >> 6)) & 63)\n\tb[first+3] = b64(k.k[2] & 63)\n\tb[second+0] = b64(k.k[29] & 63)\n\tb[second+1] = b64((k.k[30] >> 2) & 63)\n\tb[second+2] = b64(((k.k[30] << 4) | (k.k[31] >> 4)) & 63)\n\tb[second+3] = b64((k.k[31] << 2) & 63)\n\treturn string(b)\n}", "title": "" }, { "docid": "b09c49d422f61e9129da7177ef187e07", "score": "0.540514", "text": "func (s BaiduChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b09c49d422f61e9129da7177ef187e07", "score": "0.540514", "text": "func (s BaiduChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "bea5eea78971c84f6a8eebff7e83ba30", "score": "0.54043716", "text": "func (a *Arg) String() string {\n\tif a.Name != \"\" {\n\t\treturn a.Name\n\t}\n\tif a.IsOffsetTooLarge {\n\t\treturn \"_\"\n\t}\n\tif a.IsAggregate {\n\t\treturn \"{\" + a.Fields.String() + \"}\"\n\t}\n\tif a.Value < uint64(len(zeroToNine)) {\n\t\treturn zeroToNine[a.Value : a.Value+1]\n\t}\n\treturn fmt.Sprintf(\"0x%x\", a.Value)\n}", "title": "" }, { "docid": "bac68aad8eefcc67cb20372bc893a7d4", "score": "0.539542", "text": "func (o SnapshotInfoType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "0e7c9375c85d97025670384e8e56c199", "score": "0.53953135", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`params:\n\tOracleRewardPercentage: %d MaximumCodeBytes: %d\n`,\n\t\tp.OracleScriptRewardPercentage, p.MaximumCodeBytes,\n\t)\n}", "title": "" }, { "docid": "e7847f33e4d1d7a24590c684af7420f8", "score": "0.5386971", "text": "func (s APNSVoipChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e7847f33e4d1d7a24590c684af7420f8", "score": "0.5386971", "text": "func (s APNSVoipChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b9d97878d151e4ecce328096f2855449", "score": "0.5372568", "text": "func (s TemplateParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b9d97878d151e4ecce328096f2855449", "score": "0.5372568", "text": "func (s TemplateParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "ef2f38a5f14ed26aa79815149b7081b6", "score": "0.5372007", "text": "func (a *Args) String() string {\n\tbuf := &bytes.Buffer{}\n\n\tfmt.Fprintln(buf, \"MaxMessageSize: \", a.MaxMessageSize)\n\tfmt.Fprintln(buf, \"MaxConcurrentStreams: \", a.MaxConcurrentStreams)\n\tfmt.Fprintln(buf, \"APIWorkerPoolSize: \", a.APIWorkerPoolSize)\n\tfmt.Fprintln(buf, \"AdapterWorkerPoolSize: \", a.AdapterWorkerPoolSize)\n\tfmt.Fprintln(buf, \"APIPort: \", a.APIPort)\n\tfmt.Fprintln(buf, \"APIAddress: \", a.APIAddress)\n\tfmt.Fprintln(buf, \"MonitoringPort: \", a.MonitoringPort)\n\tfmt.Fprintln(buf, \"EnableProfiling: \", a.EnableProfiling)\n\tfmt.Fprintln(buf, \"SingleThreaded: \", a.SingleThreaded)\n\tfmt.Fprintln(buf, \"NumCheckCacheEntries: \", a.NumCheckCacheEntries)\n\tfmt.Fprintln(buf, \"ConfigStoreURL: \", a.ConfigStoreURL)\n\tfmt.Fprintln(buf, \"CertificateFile: \", a.CredentialOptions.CertificateFile)\n\tfmt.Fprintln(buf, \"KeyFile: \", a.CredentialOptions.KeyFile)\n\tfmt.Fprintln(buf, \"CACertificateFile: \", a.CredentialOptions.CACertificateFile)\n\tfmt.Fprintln(buf, \"ConfigDefaultNamespace: \", a.ConfigDefaultNamespace)\n\tfmt.Fprintf(buf, \"LoggingOptions: %#v\\n\", *a.LoggingOptions)\n\tfmt.Fprintf(buf, \"TracingOptions: %#v\\n\", *a.TracingOptions)\n\tfmt.Fprintf(buf, \"IntrospectionOptions: %#v\\n\", *a.IntrospectionOptions)\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "dd43765b28e590ba8bf80617b1f97c07", "score": "0.5370579", "text": "func deriveGoString_St(this Structs) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() test.Structs {\\n\")\n\tfmt.Fprintf(buf, \"this := &test.Structs{}\\n\")\n\tfmt.Fprintf(buf, \"this.Struct = %s\\n\", deriveGoString_N(this.Struct))\n\tif this.PtrToStruct != nil {\n\t\tfmt.Fprintf(buf, \"this.PtrToStruct = %s\\n\", deriveGoStringName(this.PtrToStruct))\n\t}\n\tif this.SliceOfStructs != nil {\n\t\tfmt.Fprintf(buf, \"this.SliceOfStructs = %s\\n\", deriveGoString_40(this.SliceOfStructs))\n\t}\n\tif this.SliceToPtrOfStruct != nil {\n\t\tfmt.Fprintf(buf, \"this.SliceToPtrOfStruct = %s\\n\", deriveGoString_41(this.SliceToPtrOfStruct))\n\t}\n\tfmt.Fprintf(buf, \"this.StructWithoutMethod = %s\\n\", deriveGoString_S(this.StructWithoutMethod))\n\tif this.PtrToStructWithoutMethod != nil {\n\t\tfmt.Fprintf(buf, \"this.PtrToStructWithoutMethod = %s\\n\", deriveGoString_42(this.PtrToStructWithoutMethod))\n\t}\n\tif this.SliceOfStructWithoutMethod != nil {\n\t\tfmt.Fprintf(buf, \"this.SliceOfStructWithoutMethod = %s\\n\", deriveGoString_43(this.SliceOfStructWithoutMethod))\n\t}\n\tif this.SliceToPtrOfStructWithoutMethod != nil {\n\t\tfmt.Fprintf(buf, \"this.SliceToPtrOfStructWithoutMethod = %s\\n\", deriveGoString_44(this.SliceToPtrOfStructWithoutMethod))\n\t}\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "83a77a0f37ca492dd1785c70eebecbd6", "score": "0.5364015", "text": "func deriveGoStringStructWithStructFieldWithoutEqualMethod(this *StructWithStructFieldWithoutEqualMethod) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() *test.StructWithStructFieldWithoutEqualMethod {\\n\")\n\tif this == nil {\n\t\tfmt.Fprintf(buf, \"return nil\\n\")\n\t} else {\n\t\tfmt.Fprintf(buf, \"this := &test.StructWithStructFieldWithoutEqualMethod{}\\n\")\n\t\tif this.A != nil {\n\t\t\tfmt.Fprintf(buf, \"this.A = %s\\n\", deriveGoString_56(this.A))\n\t\t}\n\t\tfmt.Fprintf(buf, \"this.B = %s\\n\", deriveGoString_Str(this.B))\n\t\tfmt.Fprintf(buf, \"return this\\n\")\n\t}\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "7f3059219b7082674bf6ca849d7e31e9", "score": "0.536227", "text": "func StringParam(key, value string) BuildParam {\n\treturn BuildParam{\n\t\tName: key,\n\t\tValue: value,\n\t}\n}", "title": "" }, { "docid": "be142b66126ed3a1a631d8f91dddfd70", "score": "0.53584015", "text": "func deriveGoStringNoPointerStruct(this BuiltInTypes) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() test.BuiltInTypes {\\n\")\n\tfmt.Fprintf(buf, \"this := &test.BuiltInTypes{}\\n\")\n\tfmt.Fprintf(buf, \"this.Bool = %#v\\n\", this.Bool)\n\tfmt.Fprintf(buf, \"this.Byte = %#v\\n\", this.Byte)\n\tfmt.Fprintf(buf, \"this.Complex128 = %#v\\n\", this.Complex128)\n\tfmt.Fprintf(buf, \"this.Complex64 = %#v\\n\", this.Complex64)\n\tfmt.Fprintf(buf, \"this.Float64 = %#v\\n\", this.Float64)\n\tfmt.Fprintf(buf, \"this.Float32 = %#v\\n\", this.Float32)\n\tfmt.Fprintf(buf, \"this.Int = %#v\\n\", this.Int)\n\tfmt.Fprintf(buf, \"this.Int16 = %#v\\n\", this.Int16)\n\tfmt.Fprintf(buf, \"this.Int32 = %#v\\n\", this.Int32)\n\tfmt.Fprintf(buf, \"this.Int64 = %#v\\n\", this.Int64)\n\tfmt.Fprintf(buf, \"this.Int8 = %#v\\n\", this.Int8)\n\tfmt.Fprintf(buf, \"this.Rune = %#v\\n\", this.Rune)\n\tfmt.Fprintf(buf, \"this.String = %#v\\n\", this.String)\n\tfmt.Fprintf(buf, \"this.Uint = %#v\\n\", this.Uint)\n\tfmt.Fprintf(buf, \"this.Uint16 = %#v\\n\", this.Uint16)\n\tfmt.Fprintf(buf, \"this.Uint32 = %#v\\n\", this.Uint32)\n\tfmt.Fprintf(buf, \"this.Uint64 = %#v\\n\", this.Uint64)\n\tfmt.Fprintf(buf, \"this.Uint8 = %#v\\n\", this.Uint8)\n\tfmt.Fprintf(buf, \"this.UintPtr = %#v\\n\", this.UintPtr)\n\tfmt.Fprintf(buf, \"return *this\\n\")\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "8e7669ae5b057277101ff7625af5d2e0", "score": "0.53573185", "text": "func (mm MessageMatcher) String() string {\n\treturn fmt.Sprintf(\"%#v\", SendParams(mm))\n}", "title": "" }, { "docid": "cc960b69484075f7d705c86497200ee5", "score": "0.53568184", "text": "func (s VoiceChannelRequest) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1e77375a4dceb87f5fbe734d7c6f09cf", "score": "0.5356395", "text": "func (p MediaParam) String() string {\n\treturn fmt.Sprint(p)\n}", "title": "" }, { "docid": "75a9f54bbc5d0448ce9408478b7eaba9", "score": "0.53511494", "text": "func (sslFields *PGSSLFields) String() string {\n\tstructElements := reflect.ValueOf(sslFields).Elem()\n\tfieldsLen := structElements.NumField()\n\n\t// generate a tmp slice size 0, initialize it memory capable of out of\n\t// n bytes to caps\n\ttmp := make([]string, 0, fieldsLen)\n\n\t// Go over all fields of the struct\n\tfor i := 0; i < fieldsLen; i++ {\n\t\tfieldValue := structElements.Field(i) // get current field value\n\t\tfieldType := structElements.Type().Field(i) // get the field type\n\t\ttag := fieldType.Tag // get the field tag\n\n\t\t// cast interface{} to string can you guess what might go be wrong here?\n\t\tvalue := fieldValue.Interface().(string)\n\t\tif value != \"\" {\n\t\t\ttmpStr := fmt.Sprintf(\"%s=%s\", tag.Get(\"ssl\"), value)\n\t\t\ttmp = append(tmp, tmpStr) // add the content to the slice\n\t\t}\n\t}\n\n\treturn strings.Join(tmp, \" \") // return a space separated fields\n}", "title": "" }, { "docid": "f3a24fb66dda715f28800694e906457c", "score": "0.53394175", "text": "func String() string {\n\ts := \"{\"\n\ts += fmt.Sprintf(\"cmd:%q,\", cmd)\n\ts += fmt.Sprintf(\"dataPath:%q,\", dataPath)\n\ts += fmt.Sprintf(\"Debug:%v,\", defns[\"Debug\"])\n\ts += fmt.Sprintf(\"Force:%v,\", defns[\"Force\"])\n\ts += fmt.Sprintf(\"mainPath:%q,\", mainPath)\n\ts += fmt.Sprintf(\"mdlDir:%q,\", mdlDir)\n\ts += fmt.Sprintf(\"Noop:%v,\", defns[\"Noop\"])\n\ts += fmt.Sprintf(\"outDir:%q,\", outDir)\n\ts += fmt.Sprintf(\"Quiet:%v,\", defns[\"Quiet\"])\n\ts += fmt.Sprintf(\"Time:%q,\", defns[\"Time\"])\n\ts += \"}\"\n\treturn s\n}", "title": "" }, { "docid": "05b1a9943f2b8e4646846028524d8551", "score": "0.53252137", "text": "func (c *CachedConflictMember) String() string {\n\treturn stringify.Struct(\"CachedConflictMember\",\n\t\tstringify.StructField(\"CachedObject\", c.Unwrap()),\n\t)\n}", "title": "" }, { "docid": "df749b01c1d6546bc837aaae23f719d4", "score": "0.5318594", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Params:\n Unstaking Time: %s\n Max Applications: %d\n Minimum Stake: \t %d\n BaseRelaysPerPOKT %d\n Stability Adjustment %d\n Participation Rate On %v,`,\n\t\tp.UnstakingTime,\n\t\tp.MaxApplications,\n\t\tp.AppStakeMin,\n\t\tp.BaseRelaysPerPOKT,\n\t\tp.StabilityAdjustment,\n\t\tp.ParticipationRateOn)\n}", "title": "" }, { "docid": "389eae9e9df9948c4919c9fd26166858", "score": "0.53179246", "text": "func (s GeoMatchParams) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "50a7c4673fe24e6ed9d2be8bd0050359", "score": "0.5306539", "text": "func String(obj interface{}) string {\n\tswitch val := obj.(type) {\n\tcase []byte:\n\t\treturn string(val)\n\tcase string:\n\t\treturn val\n\t}\n\tv := reflect.ValueOf(obj)\n\tswitch v.Kind() {\n\tcase reflect.Invalid:\n\t\treturn \"\"\n\tcase reflect.Bool:\n\t\treturn strconv.FormatBool(v.Bool())\n\tcase reflect.String:\n\t\treturn v.String()\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\treturn strconv.FormatInt(v.Int(), 10)\n\tcase reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr:\n\t\treturn strconv.FormatUint(v.Uint(), 10)\n\tcase reflect.Float64:\n\t\treturn strconv.FormatFloat(v.Float(), 'f', -1, 64)\n\tcase reflect.Float32:\n\t\treturn strconv.FormatFloat(v.Float(), 'f', -1, 32)\n\tcase reflect.Ptr, reflect.Struct, reflect.Map:\n\t\tb, err := json.Marshal(v.Interface())\n\t\tif err != nil {\n\t\t\treturn \"\"\n\t\t}\n\t\treturn string(b)\n\t}\n\treturn fmt.Sprintf(\"%v\", obj)\n}", "title": "" }, { "docid": "58fdf8936221f278dd5d0e919acdf554", "score": "0.52975494", "text": "func (s DataTransferApi) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a2446acde48b90b569a1c2073757b24d", "score": "0.52873385", "text": "func AttrGoString(a dwarf.Attr,) string", "title": "" }, { "docid": "102384bd35485d4214e6cefae7db452e", "score": "0.528618", "text": "func deriveGoStringMapWithStructs(this *MapWithStructs) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() *test.MapWithStructs {\\n\")\n\tif this == nil {\n\t\tfmt.Fprintf(buf, \"return nil\\n\")\n\t} else {\n\t\tfmt.Fprintf(buf, \"this := &test.MapWithStructs{}\\n\")\n\t\tif this.NameToString != nil {\n\t\t\tfmt.Fprintf(buf, \"this.NameToString = %s\\n\", deriveGoString_45(this.NameToString))\n\t\t}\n\t\tif this.StringToName != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToName = %s\\n\", deriveGoString_46(this.StringToName))\n\t\t}\n\t\tif this.StringToPtrToName != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToPtrToName = %s\\n\", deriveGoString_47(this.StringToPtrToName))\n\t\t}\n\t\tif this.StringToSliceOfName != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToSliceOfName = %s\\n\", deriveGoString_48(this.StringToSliceOfName))\n\t\t}\n\t\tif this.StringToSliceOfPtrToName != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToSliceOfPtrToName = %s\\n\", deriveGoString_49(this.StringToSliceOfPtrToName))\n\t\t}\n\t\tif this.StringToStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToStructWithoutMethod = %s\\n\", deriveGoString_50(this.StringToStructWithoutMethod))\n\t\t}\n\t\tif this.StructWithoutMethodToString != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StructWithoutMethodToString = %s\\n\", deriveGoString_51(this.StructWithoutMethodToString))\n\t\t}\n\t\tif this.StringToPtrToStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToPtrToStructWithoutMethod = %s\\n\", deriveGoString_52(this.StringToPtrToStructWithoutMethod))\n\t\t}\n\t\tif this.StringToSliceOfStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToSliceOfStructWithoutMethod = %s\\n\", deriveGoString_53(this.StringToSliceOfStructWithoutMethod))\n\t\t}\n\t\tif this.StringToSliceOfPtrToStructWithoutMethod != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringToSliceOfPtrToStructWithoutMethod = %s\\n\", deriveGoString_54(this.StringToSliceOfPtrToStructWithoutMethod))\n\t\t}\n\t\tfmt.Fprintf(buf, \"return this\\n\")\n\t}\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "5b910a935b5d23e85f5fa764d8cc6540", "score": "0.52796686", "text": "func (c *Struct) String() string {\n\treturn fmt.Sprintf(\"%s %s\", c.Type(), c.Ident())\n}", "title": "" }, { "docid": "b0ce51d83fb0aa8246c939164840a11b", "score": "0.527688", "text": "func (p *Parameters) String() (ret string) {\n\tret = \"[\"\n\tfor i, v := range p.data() {\n\t\tif i > 0 {\n\t\t\tret += \" \"\n\t\t}\n\t\tret += string(v.key) + \":\" + string(v.value)\n\t}\n\treturn ret + \"]\"\n}", "title": "" }, { "docid": "5efd40ad1e0ddb1e1e166b22a09a87ed", "score": "0.52728844", "text": "func (p Param) Serialize() string {\n\tswitch v := p.Value.(type) {\n\tcase int:\n\t\treturn strconv.Itoa(v)\n\tcase int8:\n\t\treturn strconv.FormatInt(int64(v), 10)\n\tcase int16:\n\t\treturn strconv.FormatInt(int64(v), 10)\n\tcase int32:\n\t\treturn strconv.FormatInt(int64(v), 10)\n\tcase int64:\n\t\treturn strconv.FormatInt(v, 10)\n\tcase uint:\n\t\treturn strconv.FormatUint(uint64(v), 10)\n\tcase uint8:\n\t\treturn strconv.FormatUint(uint64(v), 10)\n\tcase uint16:\n\t\treturn strconv.FormatUint(uint64(v), 10)\n\tcase uint32:\n\t\treturn strconv.FormatUint(uint64(v), 10)\n\tcase uint64:\n\t\treturn strconv.FormatUint(v, 10)\n\tcase float32:\n\t\treturn strconv.FormatFloat(float64(v), 'e', -1, 32)\n\tcase float64:\n\t\treturn strconv.FormatFloat(v, 'e', -1, 64)\n\tcase bool:\n\t\treturn strconv.FormatBool(v)\n\tcase []byte:\n\t\ts := strings.Replace(string(v), `\"\"\"`, `\\\"\\\"\\\"`, -1)\n\t\treturn strings.Join([]string{`\"\"\"`, s, `\"\"\"`}, \"\")\n\tcase string:\n\t\ts := strings.Replace(v, `\"\"\"`, `\\\"\\\"\\\"`, -1)\n\t\treturn strings.Join([]string{`\"\"\"`, s, `\"\"\"`}, \"\")\n\tcase time.Time:\n\t\treturn v.Format(dateTimeFormat)\n\tcase IRIRef:\n\t\treturn v.Ref()\n\tcase Serializable:\n\t\treturn v.Serialize()\n\tdefault:\n\t\ts := fmt.Sprint(v)\n\t\ts = strings.Replace(s, `\"\"\"`, `\\\"\\\"\\\"`, -1)\n\t\treturn strings.Join([]string{`\"\"\"`, s, `\"\"\"`}, \"\")\n\t}\n}", "title": "" }, { "docid": "99740bac5c11a25fa98dadce08227e0e", "score": "0.52707964", "text": "func (v Vlans) String() string {\n\tjv, _ := json.Marshal(v)\n\treturn string(jv)\n}", "title": "" }, { "docid": "ef8ca9fc661003d022e2668811686e28", "score": "0.52649355", "text": "func (p Property) String() string { return fmt.Sprintf(\"%s=%s\", p.Name, p.Value) }", "title": "" }, { "docid": "527130824d7d4013fc5d6795a82bedaf", "score": "0.5263671", "text": "func (o *APIVersion) String() string {\n\tif o == nil {\n\t\treturn \"\"\n\t}\n\tif o.Stage == StageGA {\n\t\treturn fmt.Sprintf(\"v%d\", o.Version)\n\t}\n\treturn fmt.Sprintf(\"v%d%s%d\", o.Version, stageName[o.Stage], *o.StageVersion)\n}", "title": "" }, { "docid": "a924d17955372a4d1e484574889fb028", "score": "0.52564496", "text": "func (o SystemGetVersionRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "8f8b7fc757af433244e20cd9aab0fde3", "score": "0.52561504", "text": "func (kp KeyParam) String() string {\n\treturn kp.key.String()\n}", "title": "" } ]
446fdef0125ab505355f1bd044ac6ab1
Key function returns key value.
[ { "docid": "097ea52a5f547a04b0729af085623ee8", "score": "0.0", "text": "func (e ChapterGetReqValidationError) Key() bool { return e.key }", "title": "" } ]
[ { "docid": "f839052724327da43ec33cb11b004a30", "score": "0.75885636", "text": "func (f stringLikeFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "7326b47ec7fad1239fc3dc6fc00b5d20", "score": "0.7114486", "text": "func (d dbVal) key() string{\n\treturn string(d.k)\n}", "title": "" }, { "docid": "a596d7776419fc1f817669ab07dfcc17", "score": "0.68720675", "text": "func (v keyValue) key() interface{} {\n\treturn v.k\n}", "title": "" }, { "docid": "b179c93dcdf5cffbd595024c01b75551", "score": "0.6852386", "text": "func (i *Iterator[K, V, Aux, A, AP]) Key() K {\n\treturn i.keys[i.pos]\n}", "title": "" }, { "docid": "738c91e532bfb6060d3c8b32093f3e22", "score": "0.67663246", "text": "func (m *KeyUint) Key() driver.Value {\n\treturn driver.Value(m.ID)\n}", "title": "" }, { "docid": "2a069427e76da26f26d1a823005eebdf", "score": "0.67357004", "text": "func (a AlphaNumeric) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "6a12546ab47b5c1ad3198af4d28295f5", "score": "0.6697428", "text": "func GetKey(mp map[int]string, givenValue string) int {\n\tfor key, value := range mp {\n\t\tif value == givenValue {\n\t\t\treturn key\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "8a395027406a586a481914221dbc9b01", "score": "0.668372", "text": "func Key(m interface{}) interface{} { return randKey(m, cRandInt) }", "title": "" }, { "docid": "86af75ff044fbf58e6f9c2cbcfd942bb", "score": "0.66588765", "text": "func getValueKey(s []string, c string) int {\n\tfor k, v := range s {\n\t\tif v == c {\n\t\t\treturn k\n\t\t}\n\t}\n\treturn -1\n}", "title": "" }, { "docid": "612fefb3eef1c872caeab808fda0bdb0", "score": "0.66479045", "text": "func (m Match) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "cd3bd4e8a9cbd4e1bf8d1477eeccca6d", "score": "0.66223323", "text": "func (a Alpha) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "2b213bd59c842706346d25ebddf53e6b", "score": "0.6593437", "text": "func getKey(obj metav1.Object, t *testing.T) string {\n\tkey, err := controller.KeyFunc(obj)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for resource %v: %v\", obj.GetName(), err)\n\t\treturn \"\"\n\t}\n\treturn key\n}", "title": "" }, { "docid": "d9731d9656b632e02981c3bb94415e04", "score": "0.6585843", "text": "func (m MACAddr) Key() string {\n\treturn string(m[:])\n}", "title": "" }, { "docid": "b943cb274323bf8f5774ed1985cf0ce4", "score": "0.6577177", "text": "func (o *Facts) GetKey() string {\n\tif o == nil || IsNil(o.Key) {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "d9937bb12d491801de5d228495ad33b0", "score": "0.65590775", "text": "func (f numericLessThanFunc) key() Key {\n\treturn f.k\n}", "title": "" }, { "docid": "13634f2d629d7f2bcc336b8cd1d6347c", "score": "0.655557", "text": "func (n *Node) GetKey() float32 {\n\treturn n.key\n}", "title": "" }, { "docid": "037c9eb46dfd07d0e40edd7c02561591", "score": "0.6546226", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(objectEntry).key\n\treturn key, nil\n}", "title": "" }, { "docid": "3533d8501664650f6437b62e7d8ab8d4", "score": "0.65316856", "text": "func (it *chainIter[K, V, H]) key() K {\n\treturn it.b.key[it.ib]\n}", "title": "" }, { "docid": "f3bd0087b49d8aaa0a076a1214fb27a5", "score": "0.65268946", "text": "func (n NoMatch) GetKey() string {\n\treturn n.Key\n}", "title": "" }, { "docid": "c1fa595f31307a7ef468c254e330073a", "score": "0.65227526", "text": "func GetKey(allkeys []string, loc Where) string {\n\tif loc == Left {\n\t\treturn allkeys[0]\n\t}\n\tif loc == Right {\n\t\treturn allkeys[len(allkeys)-1]\n\t}\n\t// select a random index between 1 and allkeys-2\n\tidx := unsafe.NewRand().Int()%(len(allkeys)-2) + 1\n\treturn allkeys[idx]\n}", "title": "" }, { "docid": "3442ab6f273d53ac292fb4b557244cab", "score": "0.6499769", "text": "func (n Numeric) GetKey() string {\n\treturn n.Key\n}", "title": "" }, { "docid": "67792a395a04e1af3e63b054b1080998", "score": "0.6489056", "text": "func (d *Stats) KeyVal() string {\n\treturn d.ID\n}", "title": "" }, { "docid": "031dae71ee3017c469fbc739e879a929", "score": "0.6485388", "text": "func (m Min) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "5ea864bf2cb37901dd33b8a25522d698", "score": "0.6451214", "text": "func (mapping *DNSMapping) GetKey() []byte {\n\treturn []byte(mapping.Name + mapping.IP.String())\n}", "title": "" }, { "docid": "1be243b7b4413254822828286c2290b4", "score": "0.64501834", "text": "func (i KeyValIterator) Key() []byte {\n\treturn i.key\n}", "title": "" }, { "docid": "c6eac4fd7b3b8699d9e77934006470d6", "score": "0.64488065", "text": "func (_ KVPairStringAliases) Key(p graphql.ResolveParams) (string, error) {\n\tval, err := graphql.DefaultResolver(p.Source, p.Info.FieldName)\n\tret, ok := val.(string)\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\tif !ok {\n\t\treturn ret, errors.New(\"unable to coerce value for field 'key'\")\n\t}\n\treturn ret, err\n}", "title": "" }, { "docid": "8f42856c5526858a3829519858c56546", "score": "0.6448241", "text": "func stringKeyFunc(obj interface{}) (string, error) {\n\tkey := obj.(*nodeidentity.Info).InstanceID\n\treturn key, nil\n}", "title": "" }, { "docid": "605a23a9681d08128683dc65f91ec960", "score": "0.64470667", "text": "func (p4 *impl) KeyGet(key string) (string, error) {\n\tcb := keycb{}\n\terr := p4.runCmdCb(&cb, \"key\", key)\n\tif err != nil {\n\t\treturn \"0\", err\n\t}\n\tif v, ok := cb[key]; ok {\n\t\treturn v, nil\n\t}\n\treturn \"0\", ErrKeyNotFound\n}", "title": "" }, { "docid": "d864da1fd1111311e850ef167ed727f4", "score": "0.6431529", "text": "func getKey(name, namespace string) string {\n\treturn fmt.Sprintf(\"%s/%s\", name, namespace)\n}", "title": "" }, { "docid": "67bef58f6e77ca86bd9629dc74cdd3cc", "score": "0.6423325", "text": "func (m *Map) Key() Type { return m.key }", "title": "" }, { "docid": "17c812e30897152fb3e5783c7499a5f2", "score": "0.6415269", "text": "func (diane Diane) Key() string {\n\treturn diane.NumeroSiren\n}", "title": "" }, { "docid": "33b8526055d489e7d63daed8e142e46f", "score": "0.64138", "text": "func (l Length) GetKey() string {\n\treturn l.Key\n}", "title": "" }, { "docid": "e07fd8d4339d29e31aff52d1e171ec23", "score": "0.6405272", "text": "func (it *Iterator) Key() []byte {\n\tkvitem := it.it.Item()\n\treturn kvitem.Key()\n}", "title": "" }, { "docid": "5f4707f1578edf785c8274a4db7776e9", "score": "0.6403367", "text": "func (c Group) Get(key string) string { return c[key] }", "title": "" }, { "docid": "b9ff0011ce9d61aae0306a16e66a4d33", "score": "0.63734704", "text": "func (i *Input) GetKey() string {\n\treturn fmt.Sprintf(\"%d:%d:%d\", i.BlockIndex, i.TxIndex, i.OutputIndex)\n}", "title": "" }, { "docid": "dc0d07913b25f19a6edccff33cf74913", "score": "0.6367644", "text": "func (a AlphaDash) GetKey() string {\n\treturn a.Key\n}", "title": "" }, { "docid": "f9b1774c57f49e3811c87549d6026dfa", "score": "0.6366343", "text": "func (o *V1MatchExpression) GetKey() string {\n\tif o == nil || o.Key == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "206589d6d20f65f21f1867e5f0534de6", "score": "0.63598573", "text": "func (it *StoreIterator) Key() string {\n\treturn it.keys[it.pos]\n}", "title": "" }, { "docid": "8b8fa7ccb1c1237e19a131ece9d71082", "score": "0.63402766", "text": "func GetKeyForInt(integer int) string {\n\treturn DefaultConverter.GetKey(integer)\n}", "title": "" }, { "docid": "7d1ea5b23be3ec61f57ec6a80d020666", "score": "0.63352305", "text": "func (node *Node) GetKey(ctx context.Context, key *gmajpb.Key) (*gmajpb.Val, error) {\n\tval, err := node.getKey(key.Key)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &gmajpb.Val{Val: val}, nil\n}", "title": "" }, { "docid": "8c7d80f7676601ea6fa0c8355335b6e7", "score": "0.63284117", "text": "func (entry *Entry) GetKey() Comparator {\n\treturn entry.key\n}", "title": "" }, { "docid": "c61697852cdd8ddb8b40c48f18c5fb9b", "score": "0.6327199", "text": "func (graph *Graph) getKey(node *Node) (key string) {\n for key ,val := range graph.Nodes{\n if(val == node){\n return key\n }\n }\n \n return \"ERROR\"\n}", "title": "" }, { "docid": "969edf5976fffb5b614ef8e8acea6b75", "score": "0.63261014", "text": "func (s *Series) Key(v string) string {\n\treturn strings.Replace(strings.ToLower(v), \" \", \"-\", -1)\n}", "title": "" }, { "docid": "b1291dd3360c3492d4712c8e667a645a", "score": "0.6322614", "text": "func (bi *BoundInt) Key() string {\n\treturn bi.key\n}", "title": "" }, { "docid": "b3c9435a9aa3c2ea4e258aff84751784", "score": "0.6311293", "text": "func (combiner *itrCombiner) keyAt(i int) string {\n\treturn combiner.kvAt(i).Key\n}", "title": "" }, { "docid": "c8e3077c467d04ade4434ada002e7934", "score": "0.6307562", "text": "func (v *PersistenceFeature) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "afcc92aaf53c5e94f7cc83f44a3ab1dc", "score": "0.6304664", "text": "func (i ForwardIteratorStringIntMapOfIntSliceTreeMap) Key() string { return i.node.key }", "title": "" }, { "docid": "8af0ddd79238f6336523a6b3a2ee5ae1", "score": "0.6295458", "text": "func (m *Map) GetKey(value interface{}) (key interface{}, found bool) {\n\tm.mu.RLock()\n\tdefer m.mu.RUnlock()\n\treturn m.nts.GetKey(value)\n}", "title": "" }, { "docid": "6240bc7d26b2e5fbdb7e80ddd347ca37", "score": "0.6295039", "text": "func (v *Var) Key() []byte {\n\tif v.ID == 0 {\n\t\treturn nil\n\t}\n\treturn itob(v.ID)\n}", "title": "" }, { "docid": "079d19c01b5be93017024847127b1d22", "score": "0.62910837", "text": "func (r Range) GetKey() string {\n\treturn r.Key\n}", "title": "" }, { "docid": "dfcc79ada72370dadc5381a00cc19469", "score": "0.6279411", "text": "func (i SNSEndpointAttribute) Key() string {\n\tif val, ok := _SNSEndpointAttributeValueToKeyMap[i]; ok {\n\t\t// found\n\t\treturn val\n\t} else {\n\t\t// not found\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "26cca3154950844923f27970ce5332f8", "score": "0.6274667", "text": "func (n *Node) Key() string {\n\tif n == nil {\n\t\treturn \"\"\n\t}\n\n\tn.RLock()\n\tkey := n.key\n\tn.RUnlock()\n\n\treturn key\n}", "title": "" }, { "docid": "14b743d77308c36a2f53632f7529e8e4", "score": "0.6267663", "text": "func (nn NodeNet) GetKey() string {\n\treturn nn.key\n}", "title": "" }, { "docid": "94199dce98875f4e5fe5b14f15ddd576", "score": "0.6252229", "text": "func Key(typ, name string) string {\n\treturn typ + \"+\" + name\n}", "title": "" }, { "docid": "cdd8c8a36a660d7d8d555062437b5281", "score": "0.62497455", "text": "func GetKey(obj interface{}, t *testing.T) string {\n\ttombstone, ok := obj.(cache.DeletedFinalStateUnknown)\n\tif ok {\n\t\t// if tombstone , try getting the value from tombstone.Obj\n\t\tobj = tombstone.Obj\n\t}\n\tval := reflect.ValueOf(obj).Elem()\n\tname := val.FieldByName(\"Name\").String()\n\tkind := val.FieldByName(\"Kind\").String()\n\t// Note kind is not always set in the tests, so ignoring that for now\n\tif len(name) == 0 || len(kind) == 0 {\n\t\tt.Errorf(\"Unexpected object %v\", obj)\n\t}\n\n\tkey, err := keyFunc(obj)\n\tif err != nil {\n\t\tt.Errorf(\"Unexpected error getting key for %v %v: %v\", kind, name, err)\n\t\treturn \"\"\n\t}\n\treturn key\n}", "title": "" }, { "docid": "b34e0512365ff10d16ad680c4e701f25", "score": "0.6243515", "text": "func (a authConfig) KeyFunc(t *jwt.Token) (interface{}, error) {\n\t// nolint: gocritic\n\tswitch a.KeyType {\n\t//TODO: add more support for keytypes here\n\tdefault:\n\t\treturn []byte(a.Key), nil\n\t}\n}", "title": "" }, { "docid": "62454e1af10d7c626ce3a03c9aefbd51", "score": "0.62352204", "text": "func Key() storj.Key {\n\tvar key storj.Key\n\tRead(key[:])\n\treturn key\n}", "title": "" }, { "docid": "1d4efbaa818024e5c577a71e048f9600", "score": "0.6232253", "text": "func (c *Cognito) getKey(token *jwt.Token) (interface{}, error) {\n\tkeyID, ok := token.Header[\"kid\"].(string)\n\tif !ok {\n\t\treturn nil, errors.New(\"expecting JWT header to have string kid\")\n\t}\n\n\tlog.Debug(\"kid: \", keyID)\n\n\tif key := keySet.LookupKeyID(keyID); len(key) == 1 {\n\t\treturn key[0].Materialize()\n\t}\n\n\treturn nil, errors.New(\"unable to find key\")\n}", "title": "" }, { "docid": "d8fe7d2a37c97278dbdff8480d5fed5a", "score": "0.62277895", "text": "func (excuse SimpleExcuse) GetKey() string {\n\treturn excuse.Key\n}", "title": "" }, { "docid": "650cb36b8abe59ebe5527ae203c23ffc", "score": "0.6222224", "text": "func (m Max) GetKey() string {\n\treturn m.Key\n}", "title": "" }, { "docid": "482dbc93e016c63ed40e9e2738cf7c17", "score": "0.6216279", "text": "func (v Values) Get(key string) string", "title": "" }, { "docid": "482dbc93e016c63ed40e9e2738cf7c17", "score": "0.6216279", "text": "func (v Values) Get(key string) string", "title": "" }, { "docid": "6e36efae7a2b3919b46a5673168c6724", "score": "0.6194336", "text": "func (o TaintOutput) Key() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v Taint) *string { return v.Key }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f7778f8dd479141837b1dbc3041bf9e2", "score": "0.6188707", "text": "func (k *Kvs) Get(key string) string {\n\treturn k.kv[key]\n}", "title": "" }, { "docid": "696fe1831e95c819432b9f0c45ba99aa", "score": "0.6188582", "text": "func (this *Ketama) Get(key string) (string, bool) {\n\tif this.Empty() {\n\t\treturn \"\", false\n\t}\n\n\thashs := hash.GenHashInts([]byte(Salt+key), 1)\n\thash := hashs[0]\n\n\tthis.Lock()\n\tdefer this.Unlock()\n\n\titer := this.m.LowerBound(hash)\n\tif iter.IsValid() {\n\t\treturn iter.Value().(string), true\n\t}\n\treturn this.m.First().Value().(string), true\n}", "title": "" }, { "docid": "3a4c9f14e4846251a99fb373803dc3be", "score": "0.6182585", "text": "func (e *Encryptor) Key() encryption.Key {\n\tif e.keyFunc == nil {\n\t\treturn nil\n\t}\n\treturn e.keyFunc()\n}", "title": "" }, { "docid": "6bb7a74132bbf14aef1c24cf4601b780", "score": "0.61789924", "text": "func GetKey(id int, context appengine.Context) (*models.Key, error) {\n\n\treturn nil, nil\n}", "title": "" }, { "docid": "2a89b603edcc96bc38e14d970b282c0d", "score": "0.61771667", "text": "func (ss *SortedSet) GetByKey(key string) *SortedSetNode {\n\treturn ss.Dict[key]\n}", "title": "" }, { "docid": "95eac26369205354a9d26b0025e58f3c", "score": "0.6174011", "text": "func (s *Segment) GetKey() string {\n\treturn s.Key\n}", "title": "" }, { "docid": "a181c3373dd0c27da7befb1e7c1171fc", "score": "0.6170864", "text": "func (c *Cursor) keyValue() ([]byte, []byte) {\n\tref := &c.stack[len(c.stack)-1]\n\tif ref.index >= ref.page.count {\n\t\treturn nil, nil\n\t}\n\te := ref.page.leafPageElement(ref.index)\n\treturn e.key(), e.value()\n}", "title": "" }, { "docid": "0e3cb0264fa11d3c5de0ea0b62f31cb1", "score": "0.61704916", "text": "func Key(fn func()) {\n\tdsl.Key(fn)\n}", "title": "" }, { "docid": "f3f175b2bcce6cdb627f943f383a848c", "score": "0.6169283", "text": "func Key(x byte) (byte, byte) {\n\t//fmt.Printf(\"%08b\\n\",x)\n\tval := x >> 3\n\n\t// if the x value has a value in the 8 place\n\tif int(x) >= 8 {\n\t\tx = x & 0x07\n\n\t} else {\n\t\treturn val, x\n\t}\n\t// if the x value has a value in the 16 place\n\tif int(x) >= 16 {\n\t\tx = x & 0x0f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 32 {\n\t\tx = x & 0x1f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 64 {\n\t\tx = x & 0x3f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\tif int(x) >= 128 {\n\t\tx = x & 0x7f\n\n\t} else {\n\t\treturn val, x\n\t}\n\n\treturn val, x\n\n}", "title": "" }, { "docid": "aab283ab3b7192039f2a505be14729db", "score": "0.61679953", "text": "func (v *KeyValue_GetValue_Args) GetKey() (o Key) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "7a004467d10378dab614c5bfc11c5f43", "score": "0.6161162", "text": "func (p CacheSlidePointer3) Key() uint64 {\n\treturn types.ExtractBits(uint64(p), 49, 2)\n}", "title": "" }, { "docid": "7a004467d10378dab614c5bfc11c5f43", "score": "0.6161162", "text": "func (p CacheSlidePointer3) Key() uint64 {\n\treturn types.ExtractBits(uint64(p), 49, 2)\n}", "title": "" }, { "docid": "c319a75a3a95c718afe1d6ec1e00bbd9", "score": "0.6160722", "text": "func (o *VirtualizationVmwareVirtualMachineGpuAllOf) GetKey() int64 {\n\tif o == nil || o.Key == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.Key\n}", "title": "" }, { "docid": "c26be8cc2c053b5d1a939abd4721e3fa", "score": "0.61435676", "text": "func (this *AllOne) GetMinKey() string {\n \n}", "title": "" }, { "docid": "fdfc520fe2ffc31f06cd932bdad94ad5", "score": "0.6140586", "text": "func (aws *AWS) GetKey(labels map[string]string, n *v1.Node) models.Key {\n\treturn &awsKey{\n\t\tSpotLabelName: aws.SpotLabelName,\n\t\tSpotLabelValue: aws.SpotLabelValue,\n\t\tLabels: labels,\n\t\tProviderID: labels[\"providerID\"],\n\t}\n}", "title": "" }, { "docid": "081e1f966fa44c407f71292100cb4d4b", "score": "0.6137957", "text": "func (f Filter) Key() string {\n\treturn f.key.String()\n}", "title": "" }, { "docid": "bed2f472630a8622c08fb312bd1e209b", "score": "0.61320305", "text": "func (i ReverseIteratorStringIntMapOfIntSliceTreeMap) Key() string { return i.node.key }", "title": "" }, { "docid": "122f3f5a8ea9410ccd6f1fbdeb824283", "score": "0.61291736", "text": "func getKeyUsingValue(m map[string]int, val int) (key string, ok bool) {\n\tfor k, v := range m {\n\t\tif v == val {\n\t\t\tkey = k\n\t\t\tok = true\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "24c636f4400c40c24af40bc697915849", "score": "0.6128213", "text": "func (e BooleanDataEntry) GetKey() string {\n\treturn e.Key\n}", "title": "" }, { "docid": "ae7fd4515daa2daeeb4052f38ab221cb", "score": "0.6127503", "text": "func (v justValue) key() interface{} {\n\treturn v.v\n}", "title": "" }, { "docid": "8e2e2771eee65941c8cf800b2393345d", "score": "0.6119081", "text": "func Key(id string, fallback string) Reference {\n\treturn key{id, fallback}\n}", "title": "" }, { "docid": "755546b1f8cb7a5fc07c8326cce8d122", "score": "0.61180955", "text": "func (iterator *RBIterator) Key() string {\n\treturn iterator.node.Key\n}", "title": "" }, { "docid": "2cf8f0b20364da1253299ed8c6e2f9b3", "score": "0.61170906", "text": "func (v *PersistenceSetting) GetKey() (o string) {\n\tif v != nil && v.Key != nil {\n\t\treturn *v.Key\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b4e310ba8b8ac5d186ab0807199794c2", "score": "0.61164016", "text": "func (it *itemType) GetKey() interface{} {\n\treturn it.key\n}", "title": "" }, { "docid": "27ea6a30712f4b47108c3478726dbd35", "score": "0.6112465", "text": "func (compte Compte) Key() string {\n\treturn compte.Siret\n}", "title": "" }, { "docid": "cf43946434b43083b562ece1d9831830", "score": "0.6109416", "text": "func (e *Element) Key() interface{} { return e.key }", "title": "" }, { "docid": "9ad83a5ddc2d3eaa233c231f12cc24de", "score": "0.61082727", "text": "func GetKey() *fernet.Key {\n\tmintLock.RLock()\n\tdefer mintLock.RUnlock()\n\treturn key\n\n}", "title": "" }, { "docid": "78085a8c9a8444c01dbf3b7b7fe1dfd3", "score": "0.6102286", "text": "func getKey(p *MProxy) func(token *jwt.Token) (interface{}, error) {\n\treturn func(token *jwt.Token) (interface{}, error) {\n\t\tkid, ok := token.Header[\"kid\"].(string)\n\t\tif !ok {\n\t\t\treturn nil, &Error{\n\t\t\t\tCode: ErrorKeyError,\n\t\t\t\tMsg: \"No valid key id provided by discovery URL\",\n\t\t\t\tErr: nil,\n\t\t\t}\n\t\t}\n\n\t\tkey := p.jwtKeys.LookupKeyID(kid)\n\t\tif len(key) == 0 {\n\t\t\treturn nil, &Error{\n\t\t\t\tCode: ErrorKeyError,\n\t\t\t\tMsg: \"No valid keys provided by discovery URL\",\n\t\t\t\tErr: nil,\n\t\t\t}\n\t\t}\n\n\t\treturn key[0].Materialize()\n\t}\n}", "title": "" }, { "docid": "cb0bf515645d7598feae5ffc808b4be3", "score": "0.61021805", "text": "func (u User) GetKey() string {\n\treturn u.key\n}", "title": "" }, { "docid": "eb4ec52766769a6c1ac9986eac6645d9", "score": "0.6099464", "text": "func (it *Iterator) Key() interface{} {\r\n\treturn it.node.data\r\n}", "title": "" }, { "docid": "7fdbd0bd9ee4d88a80ae6fc3fd695ea4", "score": "0.6097521", "text": "func (i Joke) GetKey() string {\n\treturn fmt.Sprintf(\"%s-%s\", i.Source, i.Id)\n}", "title": "" }, { "docid": "767c9b1f9b7c9d5e53c68f8b39fd9946", "score": "0.6093933", "text": "func (c Command) Key() string {\n\treturn c.String()\n}", "title": "" }, { "docid": "4b828e51af3e6cff772d8ab033b5d243", "score": "0.6093845", "text": "func (a *Alias) Key() string {\n\treturn strings.Trim(a.string, \"$()\")\n}", "title": "" }, { "docid": "8edbb9b2fc3851ac92ddc296ccabf9b7", "score": "0.60907686", "text": "func GetValue(key string) string{\n return secretData[key]\n }", "title": "" }, { "docid": "fa7a93163efc3d1192c70147234daaff", "score": "0.6088966", "text": "func (p *Page) Key() string {\n\treturn \"page.\" + p.Slug\n}", "title": "" }, { "docid": "0fbc4efb0051ea015ecb95111713f050", "score": "0.6087842", "text": "func (e *Execution) Key() string {\n\treturn fmt.Sprintf(\"%d-%s\", e.StartedAt.UnixNano(), e.NodeName)\n}", "title": "" }, { "docid": "9f4fae29e1168e169483d1f6f7b20c96", "score": "0.6081505", "text": "func (n *Node) key() string {\n\treturn n.Metadata.key()\n}", "title": "" }, { "docid": "8e696de02badba2f978a04bc17020564", "score": "0.6080484", "text": "func (self *State) Key() string{\n return self.Object.Get(\"key\").String()\n}", "title": "" } ]
8ddb846883a695e4ce9ce48b60226a95
SetID sets the value for ID
[ { "docid": "df4c7cc00e1413caa23449aa26695a21", "score": "0.0", "text": "func (t *MedicationBatch) SetID(val string) {\n\tt.ID = val\n}", "title": "" } ]
[ { "docid": "4573ff884e10292e3647070591f4f3cb", "score": "0.8279871", "text": "func (cw *current) SetID(id int) {}", "title": "" }, { "docid": "aee43f403e05a1026d1cf19e84ca1792", "score": "0.8146947", "text": "func (b *Base) SetID(n string) {\n\tb.mutex.Lock()\n\tdefer b.mutex.Unlock()\n\n\tb.Name = n\n}", "title": "" }, { "docid": "1a265078cc95382d340c19c941fc2fc2", "score": "0.80628276", "text": "func (i *Sprint) SetID(val int) { i.id = val }", "title": "" }, { "docid": "08cfc156a2a0420aba4f0cc94404bf0b", "score": "0.8041193", "text": "func (t *TestScriptRequestHeader) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "92702ccab432e7b1741506f4172967e5", "score": "0.79992884", "text": "func (q *RedisAI) SetID(n uint64) {\n\tq.id = n\n}", "title": "" }, { "docid": "449b20e9aa5e429cb8fae74cf85469d0", "score": "0.7972499", "text": "func (t *ImmunizationPerformer) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "53d9a9261498addf45b06aa344ee7af1", "score": "0.7942503", "text": "func (t *Basic) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "c088e93369ba2fdb1760dcc4be91ae75", "score": "0.7830398", "text": "func (t *TestScriptTeardown) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "1e09116ae1af4dad8964e49259a3d73a", "score": "0.78222513", "text": "func (t *Expression) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "d1d1dcc4ec97e2be58c1b19b895cd73e", "score": "0.77840966", "text": "func (m *AddIn) SetId(value *string)() {\n m.id = value\n}", "title": "" }, { "docid": "740dd2a044e76dea91631870289b3730", "score": "0.7776552", "text": "func (d *Lamp) SetID(id string) {\n\td.Lock()\n\td.ID = id\n\td.Unlock()\n}", "title": "" }, { "docid": "9b26a7b8f51cb32883db3a3dd8020008", "score": "0.7754248", "text": "func (t *ProcedurePerformer) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "6d14e072a20b99a2e229f8f595d1bcda", "score": "0.7744469", "text": "func (req *Request) SetID(entity interface{}, id string) {\n\tv, err := getIDValue(req.FSC.IDKey, entity)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tv.SetString(id)\n}", "title": "" }, { "docid": "c309b988a0f480bea77414cc116dd49b", "score": "0.773043", "text": "func (o *Object) SetID() {\n\tif o.ID == \"\" {\n\t\to.ID = ca.RandomString(24)\n\t}\n}", "title": "" }, { "docid": "4f121d7642c908c1fb8f75f294f8c4cd", "score": "0.77280134", "text": "func (f *Feature) SetID(id uint64) {\n\tf.id = id\n\tf.hasID = true\n}", "title": "" }, { "docid": "a36794dfb6af8bfa0aba1e2e912902d7", "score": "0.76894146", "text": "func (e *Element) SetID(id string) {\n\te.SetAttribute(\"id\", id)\n}", "title": "" }, { "docid": "41ab65523a47fd5a6de4ba621b6f43ff", "score": "0.76831263", "text": "func (t *TestScriptOperation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "68313c0cbfbf9c8a86cedb373c2b3a93", "score": "0.7682436", "text": "func (t *TestScriptAction1) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "014514cde7c9a2c0c7371ae674d54e34", "score": "0.75784016", "text": "func (t *TestReportTeardown) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "dbd75098603047113f55860f053130dd", "score": "0.75712866", "text": "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencoder := gob.NewEncoder(&encoded)\n\terr := encoder.Encode(tx)\n\tPanicHandle(err)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "title": "" }, { "docid": "ac1221eee211bda269194a82088bc4e3", "score": "0.7565051", "text": "func (t *Binary) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "1cb29a50428180b0a6dc143b61db1b67", "score": "0.7537878", "text": "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tencoder := gob.NewEncoder(&encoded)\n\terr := encoder.Encode(tx)\n\tutils.HandleError(err)\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n\n}", "title": "" }, { "docid": "c1912800e8996bd9445011487d00b7cd", "score": "0.7536884", "text": "func (g *Group) SetID(id string) error {\n\tvalue, err := strconv.ParseUint(id, 10, 32)\n\tif err == nil {\n\t\tg.ID = uint(value)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "d47f92de5fdb58c37cedeba445b8c899", "score": "0.7521331", "text": "func (t *TestScriptSetup) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "5687b66c6ea29fb06d208a004a34ecc0", "score": "0.75186574", "text": "func (m *ItemReference) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a978712457c3a9b0c5fee0cd1bec81a7", "score": "0.7500172", "text": "func (t *Track) SetID(id uint32) {\n\tt.id = id\n}", "title": "" }, { "docid": "7b38948bea99a0d419051954abfa9ff4", "score": "0.7496706", "text": "func (t *GroupCharacteristic) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "5681678257905c6d4513b85f8a766991", "score": "0.7495141", "text": "func (d *Data) SetID(id uint64) {\n\td.id = id\n}", "title": "" }, { "docid": "1cfa5fbdd8329a90d57c042a257a0173", "score": "0.7493347", "text": "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := gob.NewEncoder(&encoded)\n\terr := enc.Encode(tx)\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "title": "" }, { "docid": "bdb86d820e43b56eefa1c8371e163db2", "score": "0.7492134", "text": "func (b *ServerImplBase) SetID(id string) {\n\tb.lock.RLock()\n\tdefer b.lock.RUnlock()\n\tb.ctx.SetID(id)\n}", "title": "" }, { "docid": "4c41a052618d5856e315e3968666fc1c", "score": "0.74881774", "text": "func (t *Immunization) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "203e27ed0f60a224ee7d7648e45b9964", "score": "0.74690044", "text": "func (t *ServiceRequest) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "4c36ed96824f55cec53ac4ff4f0178f4", "score": "0.74657214", "text": "func (t *Flag) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "33b5bda7319f566f09743effd110f9f8", "score": "0.746193", "text": "func (m *ResourceReference) SetId(value *string)() {\n m.id = value\n}", "title": "" }, { "docid": "69b1e23ab21e0fd492e03f0a3fd0af73", "score": "0.7456647", "text": "func (s *store) SetID(id v4.ID) error {\n\tvar ids []model.IDModel\n\n\t// replace the existing ID with the given one\n\ts.db.Find(&ids).Delete(&ids)\n\n\tm := model.NewIDModel(id)\n\tresult := s.db.Create(&m)\n\n\tif result.RowsAffected != 1 {\n\t\treturn fmt.Errorf(\"unable to add id (%d rows affected)\", result.RowsAffected)\n\t}\n\n\treturn result.Error\n}", "title": "" }, { "docid": "0f3896892e125fcfee815d383fb6adf2", "score": "0.7441153", "text": "func (t *TestScriptAction2) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "54aa636e8c75807cf8ad38e2c2694ea6", "score": "0.74364406", "text": "func (m *SynchronizationRule) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "c2aa696101f2153afa8a7850a84ac83e", "score": "0.7430737", "text": "func (m *TargetResource) SetId(value *string)() {\n m.id = value\n}", "title": "" }, { "docid": "8fdc63a8b7bbb1b7d168b1ec903bfae4", "score": "0.7429917", "text": "func (t *SubstancePolymerMonomerSet) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "5b335416fab682eeaf9f7473a53110ab", "score": "0.7428222", "text": "func (t *Element) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "e52a4a0e3b76435b8ce13e6ed708f9c3", "score": "0.7426949", "text": "func (t *TestScript) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "024619bd3b4bc82459353a3df77d6add", "score": "0.7424431", "text": "func (p *Person) SetID(id string) error {\n\ttemp, err := strconv.Atoi(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.ID = temp\n\treturn nil\n}", "title": "" }, { "docid": "7c001cbf77d62875584c575e35c4d3c2", "score": "0.7412633", "text": "func (m *Model) SetID(id string) error {\n\tvar err error\n\tm.ID, err = strconv.ParseUint(id, 10, 64)\n\treturn err\n}", "title": "" }, { "docid": "7a3a8ab44348919d353555d0d5048c11", "score": "0.7404347", "text": "func (r *Response) SetID(id string) { r.id = id }", "title": "" }, { "docid": "4133b74f0fe6bf0aecaf24c65cf6440c", "score": "0.7395828", "text": "func (t *TestScriptFixture) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "b6517df5d1a23261d088266f1c3909ea", "score": "0.73863024", "text": "func (t *TestScriptAction) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "d1520a82d9c30ecd5a9de5f2f595d927", "score": "0.73862356", "text": "func (m *libMetadata) setID(id string) {\n\tif id != m.ID {\n\t\tm.dirty = true\n\t\tm.ID = id\n\t}\n}", "title": "" }, { "docid": "85c5e9b62cb7e47d7d9f4ba9b0fb81a5", "score": "0.73809606", "text": "func (a *Article) SetID(id string) error {\n\ttemp, err := strconv.Atoi(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\ta.ID = temp\n\treturn nil\n}", "title": "" }, { "docid": "288049640249cd820a1b908edf92fb9a", "score": "0.7377818", "text": "func (t *TestScriptCapability) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "8ff9f11025aac82e4c31dd626bfd7f0a", "score": "0.73717093", "text": "func (me *mockEvent) SetID(id nuclio.ID) {\n\tme.Called()\n}", "title": "" }, { "docid": "5de3e2b071efc4c2a3fbc1a8c620ccdc", "score": "0.73575443", "text": "func (tx Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := gob.NewEncoder(&encoded)\n\terr := enc.Encode(tx)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n}", "title": "" }, { "docid": "a25372911bb4a12b84228e12f901c5ae", "score": "0.73547", "text": "func (m *Item) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fcc47374f633972b2d84fa3ac25ec017", "score": "0.73506796", "text": "func (t *CapabilityStatementOperation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "dd56d3a0f1c90b8609920bdb9fa269ce", "score": "0.7348836", "text": "func (t *List) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "fd9e32f0df8c9ff38cd889a07b9e0baa", "score": "0.7331588", "text": "func (user *User) SetID(id string) error {\n user.ID = bson.ObjectIdHex(id)\n return nil\n}", "title": "" }, { "docid": "af701c64f1f1466143339b76349c28b5", "score": "0.730042", "text": "func (bt *BridgeTypeRequest) SetID(value string) error {\n\tname, err := ParseBridgeName(value)\n\tbt.Name = name\n\treturn err\n}", "title": "" }, { "docid": "d087c52c5f74dae53c4cf8c086c2e03d", "score": "0.72883743", "text": "func (t *ValueSet) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "d5d22f083d43ba1d96fa8347a0d34c1d", "score": "0.7276507", "text": "func (ac *AgenttypeCreate) SetID(i int) *AgenttypeCreate {\n\tac.mutation.SetID(i)\n\treturn ac\n}", "title": "" }, { "docid": "86b7be6d48ce7ad1202a7f0b2c4d0c08", "score": "0.7254498", "text": "func (t *ValueSetFilter) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "8cef12e1b98801797ea75b9a253ed27f", "score": "0.72540647", "text": "func (c *RaftCluster) SetID(id types.ID) { c.ID = id }", "title": "" }, { "docid": "d0515a29cc0c3da8215c4b9b7c48aac0", "score": "0.7243516", "text": "func (t *ExampleScenarioOperation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "38be12aee211b451012392d162eb4983", "score": "0.72420615", "text": "func (t *UsageContext) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "fd3e0d2b64ecd0a0d8a2630ee666c85a", "score": "0.7241823", "text": "func (t *Condition) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "d848a9294c1add32920268a76d21ee94", "score": "0.7239457", "text": "func (t *TestScriptVariable) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "476373c05441a3b90db52dc1b1c784d0", "score": "0.72351444", "text": "func (pp *PeopleParser) setID() {\n\tpp.Data.ID = pp.ID\n}", "title": "" }, { "docid": "6cefdde643b5d118ccce6267aa0c3628", "score": "0.7228305", "text": "func (sd *SolrDocument) SetID(id string) {\n\tsd.fields[\"id\"] = []string{id}\n}", "title": "" }, { "docid": "6d86111bad2c5bbb89295d78245e06f6", "score": "0.72236454", "text": "func (a *Alert) SetID(id bson.ObjectId) {\n\ta.rw.Lock()\n\tdefer a.rw.Unlock()\n\ta.id = id\n}", "title": "" }, { "docid": "b85d82aa6bb99a6d2ace2575f3d0e4ed", "score": "0.7220887", "text": "func (t *TestScriptTest) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "c707eca8a3eedf1fe5689a22c2a80546", "score": "0.7209318", "text": "func (t *Timing) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "10d83b25f0070d48c95b7df1b8a37f78", "score": "0.7207593", "text": "func (t *SpecimenDefinitionAdditive) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "f8a19ac34a09d799d1bac100144bf9b1", "score": "0.72057956", "text": "func (a *AggregateBase) setID(id string) {\n\ta.id = id\n}", "title": "" }, { "docid": "aef5d26eac0c8be956d3ef293a227003", "score": "0.7202743", "text": "func (t *TestScriptOrigin) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "15ca6f7c3985971a4cd39e6f468c720c", "score": "0.7199301", "text": "func (m *NormalGraphWidget) SetID(val int32) {\n\tm.idField = val\n}", "title": "" }, { "docid": "435a12cdd8c687ae0c86ce2a6aa0da1e", "score": "0.7189044", "text": "func (m *endpoint) SetID(val string) {\n\tm.idField = val\n}", "title": "" }, { "docid": "d3a727af2465d4ea25f580d39bac5196", "score": "0.7187731", "text": "func (rmd ResourceMetaData) SetID(formatter resourceid.Formatter) {\n\trmd.ResourceData.SetId(formatter.ID())\n}", "title": "" }, { "docid": "ac2d040d4cff0b8acecb1b54e078043f", "score": "0.7186529", "text": "func (packet *CooldownPacket) SetID(id int64) {\n\tpacket.ID = id\n}", "title": "" }, { "docid": "27f9205eca211d736df4716c324fc9f8", "score": "0.7180539", "text": "func (t *ConceptMapUnmapped) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "60483619e8f376c4dee47d8fe335a206", "score": "0.71735173", "text": "func (t *DataRequirement) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "fb673f333145c95b6990920be316654a", "score": "0.7171407", "text": "func (u CurrencyUpdater) SetID(ID uint) CurrencyUpdater {\n\tu.fields[string(CurrencyDBSchema.ID)] = ID\n\treturn u\n}", "title": "" }, { "docid": "ee41400cc56306b7fb76f56c5a911f2b", "score": "0.7170278", "text": "func (packet *UpdateProjectilPacket) SetID(id int64) {\n\tpacket.ID = id\n}", "title": "" }, { "docid": "cacd65e8e5641d5780aec5b09c839b28", "score": "0.7166329", "text": "func (t *TestReportOperation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "b8e9f3a3a7b7a606c4793d4696bd9708", "score": "0.7166004", "text": "func (t *MedicinalProductContraindication) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "719b7c171b1288a76c508e8d67eb50c9", "score": "0.71659535", "text": "func (t *Library) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "f83bfe5dae4bbf164ccec08e9ae996d3", "score": "0.7165666", "text": "func (db *Object) SetID(id primitive.D) {\n\tdb.ID = id\n}", "title": "" }, { "docid": "34234d167c4d6d5746ce63e5ba72f634", "score": "0.7161773", "text": "func (t *Transaction) SetID(id string) error {\n\ttransactionID, err := strconv.ParseUint(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\tt.ID = uint(transactionID)\n\treturn nil\n}", "title": "" }, { "docid": "15d4dfa78ab126d8d9036f428c25da09", "score": "0.715928", "text": "func (t *Annotation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "8912c2a2e4531caf8cf1a0eb42b7e6ec", "score": "0.71564835", "text": "func (t *ElementDefinitionSlicing) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "8c18c48cb297dc8178036c9f67b227fa", "score": "0.7150929", "text": "func (t *Parameters) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "dead35a826c13d733bbdddeee0209976", "score": "0.7147435", "text": "func (t *ProdCharacteristic) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "66646a6aa5edfa474c66856a77da30d2", "score": "0.7146941", "text": "func (t *ContractAction) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "2639e9ca9b841882304e3eb824128678", "score": "0.7145009", "text": "func (t *ContractContext) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "daa80f2cc93e2989d53d3b2612f7b191", "score": "0.71434474", "text": "func (t *ValueSetDesignation) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "6ee6d2b63484e8a9e1f2e98da31a0cee", "score": "0.71324414", "text": "func (t *Signature) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "8ad3e14634a93eeb0f0b9aa37b496b58", "score": "0.71302634", "text": "func (o *SearchModelSetsParams) SetID(id *int64) {\n\to.ID = id\n}", "title": "" }, { "docid": "d979841ee6613a0260f9bac50997c0c6", "score": "0.71259815", "text": "func (m *DetectedSensitiveContentBase) SetId(value *i561e97a8befe7661a44c8f54600992b4207a3a0cf6770e5559949bc276de2e22.UUID)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "577eaf5addf2b5e51644fe26086657a4", "score": "0.7122585", "text": "func (t *MeasureComponent) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "435641ad7b35ac2ab5f72dde8a9d79ba", "score": "0.71214694", "text": "func (n *Node) SetID(v string) *Node {\n\tn.SafeSet(string(idAttr), v, \"\")\n\treturn n\n}", "title": "" }, { "docid": "55e8ce51972b437f369d04c75e4ccf1b", "score": "0.71188277", "text": "func (m *UriClickSecurityState) SetId(value *string)() {\n m.id = value\n}", "title": "" }, { "docid": "c59666a8590df63a690cc16d6b7c69c7", "score": "0.7110798", "text": "func (t *Evidence) SetID(val string) {\n\tt.ID = val\n}", "title": "" }, { "docid": "baf084999f976e5b7fbea9ea912206b1", "score": "0.7109543", "text": "func (dc *DevelopperCreate) SetID(i int) *DevelopperCreate {\n\tdc.mutation.SetID(i)\n\treturn dc\n}", "title": "" }, { "docid": "54ef7b8d814b0568378c7de45be100e7", "score": "0.7105386", "text": "func (fc *FileinsertCreate) SetID(i int) *FileinsertCreate {\n\tfc.mutation.SetID(i)\n\treturn fc\n}", "title": "" } ]
bec74e5838610d7e84189c83ae51a994
parseClusterSizingRequest returns count, cpu and ram components of request
[ { "docid": "628a01e2a4db34bc1870ece692bc0986", "score": "0.7808519", "text": "func (w *worker) parseClusterSizingRequest(request string) (int, int, float32, error) {\n\n\treturn 0, 0, 0.0, fail.NotImplementedError(\"parseClusterSizingRequest() not yet implemented\")\n}", "title": "" } ]
[ { "docid": "d0269b1a2d0202b00b3e4ed7bb90f4bf", "score": "0.62390757", "text": "func (ff *FeatureFile) parseClusterSizingRequirements() fail.Error {\n\tconst yamlRootKey = \"feature.requirements.clusterSizing\"\n\n\tif !ff.specs.IsSet(yamlRootKey) {\n\t\tff.clusterSizingRequirements = map[string]interface{}{}\n\t\treturn nil\n\t}\n\n\tff.clusterSizingRequirements = ff.specs.GetStringMap(yamlRootKey)\n\treturn nil\n}", "title": "" }, { "docid": "9f92b8f1d426f2d2df38fada7eea033f", "score": "0.5886675", "text": "func (ff FeatureFile) getClusterSizingRequirements() map[string]interface{} {\n\tout := make(map[string]interface{}, len(ff.clusterSizingRequirements))\n\tfor k, v := range ff.clusterSizingRequirements {\n\t\tout[k] = v\n\t}\n\treturn out\n}", "title": "" }, { "docid": "868b595d667c86b6f78a6f216320ce8e", "score": "0.56296", "text": "func CalculateUsage(clusterInfo *structs.ClusterCapacity) {\n\t// For each allocation resource, calculate the percentage of overall cluster\n\t// capacity consumed.\n\tclusterInfo.UsedCapacity.CPUPercent = percent.PercentOf(\n\t\tclusterInfo.UsedCapacity.CPUMHz,\n\t\tclusterInfo.TotalCapacity.CPUMHz)\n\n\tclusterInfo.UsedCapacity.DiskPercent = percent.PercentOf(\n\t\tclusterInfo.UsedCapacity.DiskMB,\n\t\tclusterInfo.TotalCapacity.DiskMB)\n\n\tclusterInfo.UsedCapacity.MemoryPercent = percent.PercentOf(\n\t\tclusterInfo.UsedCapacity.MemoryMB,\n\t\tclusterInfo.TotalCapacity.MemoryMB)\n\n\t// Determine the amount of consumed resources consumed by each worker node.\n\tfor _, nodeUsage := range clusterInfo.NodeAllocations {\n\t\tnodeUsage.UsedCapacity.CPUPercent = percent.PercentOf(\n\t\t\tnodeUsage.UsedCapacity.CPUMHz, clusterInfo.UsedCapacity.CPUMHz)\n\t\tnodeUsage.UsedCapacity.DiskPercent = percent.PercentOf(\n\t\t\tnodeUsage.UsedCapacity.DiskMB, clusterInfo.UsedCapacity.DiskMB)\n\t\tnodeUsage.UsedCapacity.MemoryPercent = percent.PercentOf(\n\t\t\tnodeUsage.UsedCapacity.MemoryMB, clusterInfo.UsedCapacity.MemoryMB)\n\t}\n}", "title": "" }, { "docid": "86252e5523760606840d7f82f0113aee", "score": "0.5557164", "text": "func (ff FeatureFile) getClusterSizingRequirementsForFlavor(flavor string) map[string]interface{} {\n\tif flavor != \"\" {\n\t\tanon, ok := ff.clusterSizingRequirements[flavor]\n\t\tif ok {\n\t\t\tsizing, ok := anon.(map[string]interface{})\n\t\t\tif ok {\n\t\t\t\tout := make(map[string]interface{}, len(sizing))\n\t\t\t\tfor k, v := range ff.clusterSizingRequirements {\n\t\t\t\t\tout[k] = v\n\t\t\t\t}\n\t\t\t\treturn out\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dda09ec87b11825a373576a873341b9e", "score": "0.53752834", "text": "func GetNumberOfCoresFromCPUInfo(readBytes *bytes.Buffer) int {\n\tcount := 0\n\tfor _, str := range strings.Split(readBytes.String(), \"\\n\") {\n\t\tif len(str) >= 8 {\n\t\t\tif str[:9] == \"processor\" {\n\t\t\t\tcount++\n\t\t\t}\n\t\t} else {\n\t\t\tcontinue\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "334d0231030f4e2467df7497257215d0", "score": "0.5329778", "text": "func TestCalculateResourceMilliRequirementsOnAllValidClusterSizes(t *testing.T) {\n\tfor name, cis := range validSizes {\n\t\tt.Run(name, func(t *testing.T) {\n\t\t\tcpu, memory := cis.CalculateResourceMilliRequirements(true, true)\n\t\t\tassert.True(t, cpu > 0)\n\t\t\tassert.True(t, memory > 0)\n\t\t\tassert.Equal(t, cpu, cis.CalculateCPUMilliRequirement(true, true))\n\t\t\tassert.Equal(t, memory, cis.CalculateMemoryMilliRequirement(true, true))\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ee7693a86c351502b2b9d0f392f3eb99", "score": "0.53081816", "text": "func (o GetPrivateCloudManagementClusterOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v GetPrivateCloudManagementCluster) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "f3adb3c2f24a8ce89fd3302706e12294", "score": "0.525355", "text": "func (o PrivateCloudManagementClusterOutput) Size() pulumi.IntOutput {\n\treturn o.ApplyT(func(v PrivateCloudManagementCluster) int { return v.Size }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "2a0f1ee0bbaab5941bcf7a145717abe5", "score": "0.5167091", "text": "func AllStats(w http.ResponseWriter, r *http.Request) {\n\n\t\n\tcpuServerUsage, _ := cpu.GetProcessCPUPerformance(serverPID)\n\tfmt.Println(\"cpu usage:\", cpuServerUsage)\n\n\tmemUsage, _ := mem.GetProcessMemoryUtilization(serverPID)\n\n\thostname, _ := os.Hostname()\n\n\tnetworkStats, _ := net.IOCounters()\n\tvar networkStatsOutput []map[string]interface{}\n\tfor _, counter := range networkStats {\n\t\tnetworkStatsOutput = append(networkStatsOutput, map[string]interface{}{\n\t\t\t\"name\": counter.Name,\n\t\t\t\"bytesSent\": utils.FormatBytes(counter.BytesSent, 2),\n\t\t\t\"bytesRecv\": utils.FormatBytes(counter.BytesRecv, 2),\n\t\t\t\"packetsSent\": utils.FormatBytes(counter.PacketsSent, 2),\n\t\t\t\"packetsRecv\": utils.FormatBytes(counter.PacketsRecv, 2),\n\t\t})\n\t}\n\n\t// TODO: adjust the connections with node port from the toml file\n\tconnections, _ := net.Connections(int32(serverPID))\n\n\tnetworkData := map[string]interface{}{\n\t\t\"hostname\": hostname,\n\t\t\"nodeestablishedrequestscount\": len(connections),\n\t\t\"networkinterfacesstats\": networkStatsOutput,\n\t}\n\n\tpartitions, _ := disk.Partitions()\n\tvar storageStatsOutput []map[string]interface{}\n\t// loop over partitions and get stats for every partition\n\tfor _, part := range partitions {\n\t\tu, _ := disk.Usage(part.Mountpoint)\n\t\tstorageStatsOutput = append(storageStatsOutput, map[string]interface{}{\n\t\t\t\"path\": u.Path,\n\t\t\t\"fstype\": u.Fstype,\n\t\t\t\"total\": utils.FormatBytes(u.Total, 2),\n\t\t\t\"free\": utils.FormatBytes(u.Free, 2),\n\t\t\t\"used\": utils.FormatBytes(u.Used, 2),\n\t\t\t\"usedPercent\": fmt.Sprintf(\"%.2f%%\", u.UsedPercent),\n\t\t})\n\t}\n\n\tutils.Respond(w, http.StatusOK, map[string]interface{}{\n\t\t\"nodecpuusage\": fmt.Sprintf(\"%.2f%%\", cpuServerUsage),\n\t\t\"nodememoryusage\": utils.FormatBytes(memUsage, 2),\n\t\t\"networkstats\": networkData,\n\t\t\"storagestats\": storageStatsOutput,\n\t\t\"currenttransactionscount\": 20, // new_transaction.CountTransaction(),\n\t})\n}", "title": "" }, { "docid": "409d13d119903a2ab2a34cb8a1fef5a5", "score": "0.51485974", "text": "func getResourceSummary(capacity, allocatable, requests, limits map[v1.ResourceName]resource.Quantity) *pkgCluster.ResourceSummary {\n\n\tvar capMem = zeroMemory\n\tvar capCPU = zeroCPU\n\tvar allMem = zeroMemory\n\tvar allCPU = zeroCPU\n\tvar reqMem = zeroMemory\n\tvar reqCPU = zeroCPU\n\tvar limitMem = zeroMemory\n\tvar limitCPU = zeroCPU\n\n\tif cpu, ok := capacity[v1.ResourceCPU]; ok {\n\t\tcapCPU = k8sutil.FormatResourceQuantity(v1.ResourceCPU, &cpu)\n\t}\n\n\tif memory, ok := capacity[v1.ResourceMemory]; ok {\n\t\tcapMem = k8sutil.FormatResourceQuantity(v1.ResourceMemory, &memory)\n\t}\n\n\tif cpu, ok := allocatable[v1.ResourceCPU]; ok {\n\t\tallCPU = k8sutil.FormatResourceQuantity(v1.ResourceCPU, &cpu)\n\t}\n\n\tif memory, ok := allocatable[v1.ResourceMemory]; ok {\n\t\tallMem = k8sutil.FormatResourceQuantity(v1.ResourceMemory, &memory)\n\t}\n\n\tif value, ok := requests[v1.ResourceCPU]; ok {\n\t\treqCPU = k8sutil.FormatResourceQuantity(v1.ResourceCPU, &value)\n\t}\n\n\tif value, ok := requests[v1.ResourceMemory]; ok {\n\t\treqMem = k8sutil.FormatResourceQuantity(v1.ResourceMemory, &value)\n\t}\n\n\tif value, ok := limits[v1.ResourceCPU]; ok {\n\t\tlimitCPU = k8sutil.FormatResourceQuantity(v1.ResourceCPU, &value)\n\t}\n\n\tif value, ok := limits[v1.ResourceMemory]; ok {\n\t\tlimitMem = k8sutil.FormatResourceQuantity(v1.ResourceMemory, &value)\n\t}\n\n\treturn &pkgCluster.ResourceSummary{\n\t\tCpu: &pkgCluster.CPU{\n\t\t\tResourceSummaryItem: pkgCluster.ResourceSummaryItem{\n\t\t\t\tCapacity: capCPU,\n\t\t\t\tAllocatable: allCPU,\n\t\t\t\tLimit: limitCPU,\n\t\t\t\tRequest: reqCPU,\n\t\t\t},\n\t\t},\n\t\tMemory: &pkgCluster.Memory{\n\t\t\tResourceSummaryItem: pkgCluster.ResourceSummaryItem{\n\t\t\t\tCapacity: capMem,\n\t\t\t\tAllocatable: allMem,\n\t\t\t\tLimit: limitMem,\n\t\t\t\tRequest: reqMem,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e9aa591ceb74b321a1a1c95d39125aa8", "score": "0.5107514", "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\t\tobject.bitmap_ |= 1\n\t\tcase \"account_username\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.accountUsername = value\n\t\t\tobject.bitmap_ |= 2\n\t\tcase \"availability_zone\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.availabilityZone = value\n\t\t\tobject.bitmap_ |= 4\n\t\tcase \"cloud_account_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.cloudAccountID = value\n\t\t\tobject.bitmap_ |= 8\n\t\tcase \"cloud_provider_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.cloudProviderID = value\n\t\t\tobject.bitmap_ |= 16\n\t\tcase \"cluster_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.clusterID = value\n\t\t\tobject.bitmap_ |= 32\n\t\tcase \"disconnected\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.disconnected = value\n\t\t\tobject.bitmap_ |= 64\n\t\tcase \"display_name\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.displayName = value\n\t\t\tobject.bitmap_ |= 128\n\t\tcase \"external_cluster_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.externalClusterID = value\n\t\t\tobject.bitmap_ |= 256\n\t\tcase \"managed\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.managed = value\n\t\t\tobject.bitmap_ |= 512\n\t\tcase \"product_id\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.productID = value\n\t\t\tobject.bitmap_ |= 1024\n\t\tcase \"product_category\":\n\t\t\tvalue := iterator.ReadString()\n\t\t\tobject.productCategory = value\n\t\t\tobject.bitmap_ |= 2048\n\t\tcase \"reserve\":\n\t\t\tvalue := iterator.ReadBool()\n\t\t\tobject.reserve = value\n\t\t\tobject.bitmap_ |= 4096\n\t\tcase \"resources\":\n\t\t\tvalue := readReservedResourceList(iterator)\n\t\t\tobject.resources = value\n\t\t\tobject.bitmap_ |= 8192\n\t\tdefault:\n\t\t\titerator.ReadAny()\n\t\t}\n\t}\n\treturn object\n}", "title": "" }, { "docid": "df89d22a8672ddce2b51dac3004d96a1", "score": "0.5072", "text": "func getRecommendedShardSizes(currentShardCount int32) map[int32]bool {\n\tsizes := make(map[int32]bool)\n\tbase := 0.5\n\tfor i := 0; i < 7; i++ {\n\t\trecommendedValue := int32(math.Ceil(float64(currentShardCount) * base))\n\t\tsizes[recommendedValue] = true\n\t\tbase += 0.25\n\t}\n\treturn sizes\n}", "title": "" }, { "docid": "91e975bc4db358fd43c4404d76395c5e", "score": "0.50511247", "text": "func (c *jolokiaClient) ClientRequestStats() ([]ClientRequestStats, error) {\n\tv, err := c.read(\"org.apache.cassandra.metrics\", \"type=ClientRequest\", \"*\")\n\tif err != nil {\n\t\treturn []ClientRequestStats{}, fmt.Errorf(\"err reading client request stats: %v\", err)\n\t}\n\n\t// The structure of this response is slightly weird because is just a flat\n\t// list of stats, to keep on top of this, we use a map which we'll convert\n\t// to a list later on\n\tstats := map[string]*ClientRequestStats{}\n\tv.Get(\"value\").GetObject().Visit(func(key []byte, val *fastjson.Value) {\n\t\tattributes := extractAttributes(string(key))\n\t\trequestType := attributes[\"scope\"] // requestType is embedded as scope\n\t\tstat, ok := stats[requestType]\n\t\tif !ok {\n\t\t\tstat = &ClientRequestStats{RequestType: requestType}\n\t\t\tstats[requestType] = stat\n\t\t}\n\n\t\tswitch attributes[\"name\"] {\n\t\tcase \"Latency\":\n\t\t\tstat.RequestLatency = parseLatency(val)\n\t\tcase \"Timeouts\":\n\t\t\t// TODO(suhail): Cassandra 3.0 seems to have this as a meter\n\t\t\tstat.Timeouts = Counter(val.Get(\"MeanRate\").GetInt64() * val.Get(\"Count\").GetInt64())\n\t\tcase \"Failures\":\n\t\t\t// TODO(suhail): Cassandra 3.0 seems to have this as a meter\n\t\t\tstat.Failures = Counter(val.Get(\"MeanRate\").GetInt64() * val.Get(\"Count\").GetInt64())\n\t\tcase \"Unavailables\":\n\t\t\t// TODO(suhail): Cassandra 3.0 seems to have this as a meter\n\t\t\tstat.Unavailables = Counter(val.Get(\"MeanRate\").GetInt64() * val.Get(\"Count\").GetInt64())\n\t\t}\n\t})\n\n\t// We want this function to be determinstic output given two calls and\n\t// assuming the response from Jolokia is consistent. Thus, we sort our\n\t// pools in the output by Pool Name\n\tnames := make([]string, 0, len(stats))\n\tfor requestType := range stats {\n\t\tnames = append(names, requestType)\n\t}\n\tsort.Strings(names)\n\n\tout := make([]ClientRequestStats, 0, len(names))\n\tfor _, requestType := range names {\n\t\tout = append(out, *stats[requestType])\n\t}\n\treturn out, nil\n\n}", "title": "" }, { "docid": "c1a8641311abd755650df3ae3181d2b8", "score": "0.5046903", "text": "func (ps *proportionScheduler) collectSchedulingInfo(jobGroup map[string][]*cache.QuotaAllocatorInfo, nodes []*cache.NodeInfo) (int64, int64, int64) {\n\ttotalCPU := int64(0)\n\ttotalMEM := int64(0)\n\ttotalWeight := int64(0)\n\n\tfor _, node := range nodes {\n\t\tif cpu, ok := node.Node().Status.Capacity[\"cpu\"]; ok {\n\t\t\tif capacity, ok := cpu.AsInt64(); ok {\n\t\t\t\ttotalCPU += capacity\n\t\t\t}\n\t\t}\n\t\tif memory, ok := node.Node().Status.Capacity[\"memory\"]; ok {\n\t\t\tif capacity, ok := memory.AsInt64(); ok {\n\t\t\t\ttotalMEM += capacity\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, jobs := range jobGroup {\n\t\tfor _, job := range jobs {\n\t\t\ttotalWeight += int64(job.QuotaAllocator().Spec.Weight)\n\t\t}\n\t}\n\n\treturn totalCPU, totalMEM, totalWeight\n}", "title": "" }, { "docid": "8903629f6e0953d1a93121bb8794dd92", "score": "0.50467026", "text": "func (hsrv *HTTPServer) infoReqHandler(r *http.Request) (interface{}, error) {\n\tret := make(map[string]*meta.TscaleCluster)\n\n\t// read the cluster state\n\tret[meta.ClusterTypeTstore] = hsrv.broker.GetCluster(meta.ClusterTypeTstore)\n\tret[meta.ClusterTypeKstore] = hsrv.broker.GetCluster(meta.ClusterTypeKstore)\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "c30174d7eb93e781fc457edf7d854ed3", "score": "0.5046183", "text": "func calculateNodesTotalCapacityAndAllocatable(nodeList []v1.Node) (caps map[v1.ResourceName]resource.Quantity, allocs map[v1.ResourceName]resource.Quantity) {\n\n\tcaps, allocs = map[v1.ResourceName]resource.Quantity{}, map[v1.ResourceName]resource.Quantity{}\n\tfor _, node := range nodeList {\n\n\t\tnodeCaps, nodeAllocs := nodeCapacityAndAllocatable(&node)\n\t\tfor nodeCapName, nodeCapValue := range nodeCaps {\n\t\t\tif value, ok := caps[nodeCapName]; !ok {\n\t\t\t\tcaps[nodeCapName] = *nodeCapValue.Copy()\n\t\t\t} else {\n\t\t\t\tvalue.Add(nodeCapValue)\n\t\t\t\tcaps[nodeCapName] = value\n\t\t\t}\n\t\t}\n\n\t\tfor nodeAllocName, nodeAllocValue := range nodeAllocs {\n\t\t\tif value, ok := allocs[nodeAllocName]; !ok {\n\t\t\t\tallocs[nodeAllocName] = *nodeAllocValue.Copy()\n\t\t\t} else {\n\t\t\t\tvalue.Add(nodeAllocValue)\n\t\t\t\tallocs[nodeAllocName] = value\n\t\t\t}\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "632062b1cef138ff45490209876e88ba", "score": "0.5009627", "text": "func IsSupportedClusterSize(size string) bool {\n\tvalidSuffixes := []string{\"\", \"-HA2\", \"-HA3\"}\n\tfor _, suffix := range validSuffixes {\n\t\tswitch size {\n\t\tcase\n\t\t\tSizeAlef500 + suffix,\n\t\t\tSizeAlef1000 + suffix,\n\t\t\tSizeAlef5000 + suffix:\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f4a35e9468505b1e22844d6f8ed0312d", "score": "0.49155205", "text": "func (e *Engine) RecommendCluster(provider string, region string, req ClusterRecommendationReq) (*ClusterRecommendationResp, error) {\n\n\tlog.Infof(\"recommending cluster configuration. Provider: [%s], region: [%s], recommendation request: [%#v]\",\n\t\tprovider, region, req)\n\n\tattributes := []string{Cpu, Memory}\n\tnodePools := make(map[string][]NodePool, 2)\n\n\tfor _, attr := range attributes {\n\n\t\tvalues, err := e.RecommendAttrValues(provider, region, attr, req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not get values for attr: [%s], cause: [%s]\", attr, err.Error())\n\t\t}\n\t\tlog.Debugf(\"recommended values for [%s]: count:[%d] , values: [%#v./te]\", attr, len(values), values)\n\n\t\tvmFilters, _ := e.filtersForAttr(attr, provider)\n\n\t\tfilteredVms, err := e.RecommendVms(provider, region, attr, values, vmFilters, req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"could not get virtual machines for attr: [%s], cause: [%s]\", attr, err.Error())\n\t\t}\n\t\tif len(filteredVms) == 0 {\n\t\t\tlog.Debugf(\"no vms with the requested resources found. attribute: %s\", attr)\n\t\t\t// skip the nodepool creation, go to the next attr\n\t\t\tcontinue\n\t\t}\n\t\tlog.Debugf(\"recommended vms for [%s]: count:[%d] , values: [%#v]\", attr, len(filteredVms), filteredVms)\n\n\t\t//todo add request validation for interdependent request fields, eg: onDemandPct is always 100 when spot\n\t\t// instances are not available for provider\n\t\tif provider == \"oracle\" {\n\t\t\tlog.Warnf(\"onDemand percentage in the request ignored for provider [%s]\", provider)\n\t\t\treq.OnDemandPct = 100\n\t\t}\n\t\tnps, err := e.RecommendNodePools(attr, filteredVms, values, req)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error while recommending node pools for attr: [%s], cause: [%s]\", attr, err.Error())\n\t\t}\n\t\tlog.Debugf(\"recommended node pools for [%s]: count:[%d] , values: [%#v]\", attr, len(nps), nps)\n\n\t\tnodePools[attr] = nps\n\t}\n\n\tif len(nodePools) == 0 {\n\t\tlog.Debugf(\"could not recommend node pools for request: %v\", req)\n\t\treturn nil, errors.New(\"could not recommend cluster with the requested resources\")\n\t}\n\n\tcheapestNodePoolSet := e.findCheapestNodePoolSet(nodePools)\n\n\taccuracy := req.findResponseSum(provider, region, cheapestNodePoolSet)\n\n\treturn &ClusterRecommendationResp{\n\t\tProvider: provider,\n\t\tZones: req.Zones,\n\t\tNodePools: cheapestNodePoolSet,\n\t\tAccuracy: accuracy,\n\t}, nil\n}", "title": "" }, { "docid": "5381fd9879bc4e3e7e5607bbb2988b89", "score": "0.49077225", "text": "func (c *nomadClient) calculatePoolCapacity(capacity *structs.ClusterCapacity,\n\tworkerPool *structs.WorkerPool) (err error) {\n\n\tfor _, node := range workerPool.Nodes {\n\t\tcapacity.NodeCount++\n\t\tcapacity.NodeList = append(capacity.NodeList, node.ID)\n\n\t\tcapacity.TotalCapacity.CPUMHz += *node.Resources.CPU\n\t\tcapacity.TotalCapacity.MemoryMB += *node.Resources.MemoryMB\n\t\tcapacity.TotalCapacity.DiskMB += *node.Resources.DiskMB\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "4fd28958af5b6483d4ca4c0ea980c3d9", "score": "0.4893336", "text": "func (m *metricSaphanaNetworkRequestCount) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" }, { "docid": "22c4be973305e9f9e6826153b04a2de6", "score": "0.48898274", "text": "func (sc *systemCollector) Collect(ch chan<- prometheus.Metric) {\n\tclusterStatusMetrics := sc.collectClusterStatusMetrics()\n\tfor _, sm := range clusterStatusMetrics {\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterStatus, prometheus.GaugeValue, sm.Status)\n\t}\n\n\tcontrollerNodeStatusMetrics, nodeMetrics := sc.collectClusterNodeMetrics()\n\tfor _, nm := range nodeMetrics {\n\t\tnodeType := \"management\"\n\t\tfor status, value := range nm.StatusDetail {\n\t\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeStatus, prometheus.GaugeValue, value, nm.IPAddress, nodeType, status)\n\t\t}\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeCPUCoresUse, prometheus.GaugeValue, nm.LoadAverageOneMinute, nm.IPAddress, nodeType, \"1\")\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeCPUCoresUse, prometheus.GaugeValue, nm.LoadAverageFiveMinutes, nm.IPAddress, nodeType, \"5\")\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeCPUCoresUse, prometheus.GaugeValue, nm.LoadAverageFifteenMinutes, nm.IPAddress, nodeType, \"15\")\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeCPUCoresTotal, prometheus.GaugeValue, nm.CPUCores, nm.IPAddress, nodeType)\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeMemoryUse, prometheus.GaugeValue, nm.MemoryUse, nm.IPAddress, nodeType)\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeMemoryTotal, prometheus.GaugeValue, nm.MemoryTotal, nm.IPAddress, nodeType)\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeMemoryCached, prometheus.GaugeValue, nm.MemoryCached, nm.IPAddress, nodeType)\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeSwapUse, prometheus.GaugeValue, nm.SwapUse, nm.IPAddress, nodeType)\n\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeSwapTotal, prometheus.GaugeValue, nm.SwapTotal, nm.IPAddress, nodeType)\n\n\t\tfor filesystem, diskUse := range nm.DiskUse {\n\t\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeDiskUse, prometheus.GaugeValue, diskUse, nm.IPAddress, nodeType, filesystem)\n\t\t}\n\t\tfor filesystem, diskTotal := range nm.DiskTotal {\n\t\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeDiskTotal, prometheus.GaugeValue, diskTotal, nm.IPAddress, nodeType, filesystem)\n\t\t}\n\t}\n\tfor _, nm := range controllerNodeStatusMetrics {\n\t\tnodeType := \"controller\"\n\t\tfor status, value := range nm.StatusDetail {\n\t\t\tch <- prometheus.MustNewConstMetric(sc.clusterNodeStatus, prometheus.GaugeValue, value, nm.IPAddress, nodeType, status)\n\t\t}\n\t}\n\n\tserviceMetrics := sc.collectServiceStatusMetrics()\n\tfor _, svm := range serviceMetrics {\n\t\tfor status, value := range svm.StatusDetail {\n\t\t\tch <- prometheus.MustNewConstMetric(sc.systemServiceStatus, prometheus.GaugeValue, value, svm.Name, status)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a97dc3f9550076b9405cd58306322ee2", "score": "0.4883279", "text": "func (c *Cluster) Size() int {\n\treturn len(c.nodes)\n}", "title": "" }, { "docid": "47a34af82044d235a1b3519a309cfb74", "score": "0.48818332", "text": "func generateSize(sizeInput string) (size int) {\n\tsize = -1 // default value/behavior\n\tif len(sizeInput) == 0 {\n\t\treturn size\n\t}\n\tlst := strings.Split(sizeInput, \",\")\n\tlog.Debugf(\"Parsing size %s -> %v\", sizeInput, lst)\n\t// Simple non probabilistic status case:\n\tif len(lst) == 1 && !strings.ContainsRune(sizeInput, ':') {\n\t\ts, err := strconv.Atoi(sizeInput)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Bad input size %v, not a number nor comma and colon separated %% list\", sizeInput)\n\t\t\treturn size\n\t\t}\n\t\tsize = s\n\t\tlog.Debugf(\"Parsed size %s -> %d\", sizeInput, size)\n\t\tfnet.ValidatePayloadSize(&size)\n\t\treturn size\n\t}\n\tweights := make([]float32, len(lst))\n\tsizes := make([]int, len(lst))\n\tlastPercent := float64(0)\n\ti := 0\n\tfor _, entry := range lst {\n\t\tl2 := strings.Split(entry, \":\")\n\t\tif len(l2) != 2 {\n\t\t\tlog.Warnf(\"Should have exactly 1 : in size list %s -> %v\", sizeInput, entry)\n\t\t\treturn size\n\t\t}\n\t\ts, err := strconv.Atoi(l2[0])\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"Bad input size %v -> %v, not a number before colon\", sizeInput, l2[0])\n\t\t\treturn size\n\t\t}\n\t\tfnet.ValidatePayloadSize(&s)\n\t\tpercStr := removeTrailingPercent(l2[1])\n\t\tp, err := strconv.ParseFloat(percStr, 32)\n\t\tif err != nil || p < 0 || p > 100 {\n\t\t\tlog.Warnf(\"Percentage is not a [0. - 100.] number in %v -> %v : %v %f\", sizeInput, percStr, err, p)\n\t\t\treturn size\n\t\t}\n\t\tlastPercent += p\n\t\t// Round() needed to cover 'exactly' 100% and not more or less because of rounding errors\n\t\tp32 := float32(stats.Round(lastPercent))\n\t\tif p32 > 100. {\n\t\t\tlog.Warnf(\"Sum of percentage is greater than 100 in %v %f %f %f\", sizeInput, lastPercent, p, p32)\n\t\t\treturn size\n\t\t}\n\t\tweights[i] = p32\n\t\tsizes[i] = s\n\t\ti++\n\t}\n\tres := 100. * rand.Float32()\n\tfor i, v := range weights {\n\t\tif res <= v {\n\t\t\tlog.Debugf(\"[0.-100.[ for %s roll %f got #%d -> %d\", sizeInput, res, i, sizes[i])\n\t\t\treturn sizes[i]\n\t\t}\n\t}\n\tlog.Debugf(\"[0.-100.[ for %s roll %f no hit, defaulting to -1\", sizeInput, res)\n\treturn size // default/reminder of probability table\n}", "title": "" }, { "docid": "f86f499a4967b16a163ca2d4a3374a96", "score": "0.4875199", "text": "func (r IPVSCpustatPlugin) FetchMetrics() (map[string]float64, error) {\n file, err := os.Open(\"/proc/net/ip_vs_stats_percpu\")\n if err != nil {\n return nil, err\n }\n defer file.Close()\n\n return r.Parse(file)\n}", "title": "" }, { "docid": "488fe6a2e71cdcdfe5c7acc96e518bc4", "score": "0.4871194", "text": "func getSystemInfoMetrics(\n\tctx context.Context,\n\treq *milvuspb.GetMetricsRequest,\n\tcoord *IndexCoord,\n) (*milvuspb.GetMetricsResponse, error) {\n\n\tclusterTopology := metricsinfo.IndexClusterTopology{\n\t\tSelf: metricsinfo.IndexCoordInfos{\n\t\t\tBaseComponentInfos: metricsinfo.BaseComponentInfos{\n\t\t\t\tName: metricsinfo.ConstructComponentName(typeutil.IndexCoordRole, coord.session.ServerID),\n\t\t\t\tHardwareInfos: metricsinfo.HardwareMetrics{\n\t\t\t\t\tIP: coord.session.Address,\n\t\t\t\t\tCPUCoreCount: hardware.GetCPUNum(),\n\t\t\t\t\tCPUCoreUsage: hardware.GetCPUUsage(),\n\t\t\t\t\tMemory: hardware.GetMemoryCount(),\n\t\t\t\t\tMemoryUsage: hardware.GetUsedMemoryCount(),\n\t\t\t\t\tDisk: hardware.GetDiskCount(),\n\t\t\t\t\tDiskUsage: hardware.GetDiskUsage(),\n\t\t\t\t},\n\t\t\t\tSystemInfo: metricsinfo.DeployMetrics{},\n\t\t\t\tCreatedTime: paramtable.GetCreateTime().String(),\n\t\t\t\tUpdatedTime: paramtable.GetUpdateTime().String(),\n\t\t\t\tType: typeutil.IndexCoordRole,\n\t\t\t\tID: coord.session.ServerID,\n\t\t\t},\n\t\t\tSystemConfigurations: metricsinfo.IndexCoordConfiguration{\n\t\t\t\tMinioBucketName: Params.MinioCfg.BucketName.GetValue(),\n\t\t\t},\n\t\t},\n\t\tConnectedNodes: make([]metricsinfo.IndexNodeInfos, 0),\n\t}\n\n\tmetricsinfo.FillDeployMetricsWithEnv(&clusterTopology.Self.SystemInfo)\n\n\tnodesMetrics := coord.nodeManager.getMetrics(ctx, req)\n\tfor _, nodeMetrics := range nodesMetrics {\n\t\tif nodeMetrics.err != nil {\n\t\t\tlog.Warn(\"invalid metrics of index node was found\",\n\t\t\t\tzap.Error(nodeMetrics.err))\n\t\t\tclusterTopology.ConnectedNodes = append(clusterTopology.ConnectedNodes, metricsinfo.IndexNodeInfos{\n\t\t\t\tBaseComponentInfos: metricsinfo.BaseComponentInfos{\n\t\t\t\t\tHasError: true,\n\t\t\t\t\tErrorReason: nodeMetrics.err.Error(),\n\t\t\t\t\t// Name doesn't matter here cause we can't get it when error occurs, using address as the Name?\n\t\t\t\t\tName: \"\",\n\t\t\t\t\tID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif nodeMetrics.resp.Status.ErrorCode != commonpb.ErrorCode_Success {\n\t\t\tlog.Warn(\"invalid metrics of index node was found\",\n\t\t\t\tzap.Any(\"error_code\", nodeMetrics.resp.Status.ErrorCode),\n\t\t\t\tzap.Any(\"error_reason\", nodeMetrics.resp.Status.Reason))\n\t\t\tclusterTopology.ConnectedNodes = append(clusterTopology.ConnectedNodes, metricsinfo.IndexNodeInfos{\n\t\t\t\tBaseComponentInfos: metricsinfo.BaseComponentInfos{\n\t\t\t\t\tHasError: true,\n\t\t\t\t\tErrorReason: nodeMetrics.resp.Status.Reason,\n\t\t\t\t\tName: nodeMetrics.resp.ComponentName,\n\t\t\t\t\tID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tinfos := metricsinfo.IndexNodeInfos{}\n\t\terr := metricsinfo.UnmarshalComponentInfos(nodeMetrics.resp.Response, &infos)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"invalid metrics of index node was found\",\n\t\t\t\tzap.Error(err))\n\t\t\tclusterTopology.ConnectedNodes = append(clusterTopology.ConnectedNodes, metricsinfo.IndexNodeInfos{\n\t\t\t\tBaseComponentInfos: metricsinfo.BaseComponentInfos{\n\t\t\t\t\tHasError: true,\n\t\t\t\t\tErrorReason: err.Error(),\n\t\t\t\t\tName: nodeMetrics.resp.ComponentName,\n\t\t\t\t\tID: int64(uniquegenerator.GetUniqueIntGeneratorIns().GetInt()),\n\t\t\t\t},\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tclusterTopology.ConnectedNodes = append(clusterTopology.ConnectedNodes, infos)\n\t}\n\n\tcoordTopology := metricsinfo.IndexCoordTopology{\n\t\tCluster: clusterTopology,\n\t\tConnections: metricsinfo.ConnTopology{\n\t\t\tName: metricsinfo.ConstructComponentName(typeutil.IndexCoordRole, coord.session.ServerID),\n\t\t\t// TODO(dragondriver): fill ConnectedComponents if necessary\n\t\t\tConnectedComponents: []metricsinfo.ConnectionInfo{},\n\t\t},\n\t}\n\n\tresp, err := metricsinfo.MarshalTopology(coordTopology)\n\tif err != nil {\n\t\treturn &milvuspb.GetMetricsResponse{\n\t\t\tStatus: &commonpb.Status{\n\t\t\t\tErrorCode: commonpb.ErrorCode_UnexpectedError,\n\t\t\t\tReason: err.Error(),\n\t\t\t},\n\t\t\tResponse: \"\",\n\t\t\tComponentName: metricsinfo.ConstructComponentName(typeutil.IndexCoordRole, coord.session.ServerID),\n\t\t}, nil\n\t}\n\n\treturn &milvuspb.GetMetricsResponse{\n\t\tStatus: &commonpb.Status{\n\t\t\tErrorCode: commonpb.ErrorCode_Success,\n\t\t\tReason: \"\",\n\t\t},\n\t\tResponse: resp,\n\t\tComponentName: metricsinfo.ConstructComponentName(typeutil.IndexCoordRole, coord.session.ServerID),\n\t}, nil\n}", "title": "" }, { "docid": "0744352cfac13e62867a929377595820", "score": "0.48656034", "text": "func (e *GooseFSEngine) GetWorkerUsedCapacity() (map[string]int64, error) {\n\t// 2. run clean action\n\tcapacityReport, err := e.reportCapacity()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// An Example of capacityReport:\n\t/////////////////////////////////////////////////////////////////\n\t// Capacity information for all workers:\n\t// Total Capacity: 4096.00MB\n\t// Tier: MEM Size: 4096.00MB\n\t// Used Capacity: 443.89MB\n\t// Tier: MEM Size: 443.89MB\n\t// Used Percentage: 10%\n\t// Free Percentage: 90%\n\t//\n\t// Worker Name Last Heartbeat Storage MEM\n\t// 192.168.1.147 0 capacity 2048.00MB\n\t// used 443.89MB (21%)\n\t// 192.168.1.146 0 capacity 2048.00MB\n\t// used 0B (0%)\n\t/////////////////////////////////////////////////////////////////\n\tlines := strings.Split(capacityReport, \"\\n\")\n\tstartIdx := -1\n\tfor i, line := range lines {\n\t\tif strings.HasPrefix(line, \"Worker Name\") {\n\t\t\tstartIdx = i + 1\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif startIdx == -1 {\n\t\treturn nil, fmt.Errorf(\"can't parse result form goosefs fsadmin report capacity\")\n\t}\n\n\tworker2UsedCapacityMap := make(map[string]int64)\n\tlenLines := len(lines)\n\tfor lineIdx := startIdx; lineIdx < lenLines; lineIdx += 2 {\n\t\t// e.g. [\"192.168.1.147\", \"0\", \"capacity\", \"2048.00MB\", \"used\", \"443.89MB\", \"(21%)\"]\n\t\tworkerInfoFields := append(strings.Fields(lines[lineIdx]), strings.Fields(lines[lineIdx+1])...)\n\t\tworkerName := workerInfoFields[0]\n\t\tusedCapacity, _ := utils.FromHumanSize(workerInfoFields[5])\n\t\tworker2UsedCapacityMap[workerName] = usedCapacity\n\t}\n\n\treturn worker2UsedCapacityMap, nil\n}", "title": "" }, { "docid": "fd1e5261f12fdcfccc7e3242213a34fe", "score": "0.48650882", "text": "func getRequestInfo(req interface{}) (int64, internalpb.RateType, int, error) {\n\tswitch r := req.(type) {\n\tcase *milvuspb.InsertRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DMLInsert, proto.Size(r), nil\n\tcase *milvuspb.UpsertRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DMLUpsert, proto.Size(r), nil\n\tcase *milvuspb.DeleteRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DMLDelete, proto.Size(r), nil\n\tcase *milvuspb.ImportRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DMLBulkLoad, proto.Size(r), nil\n\tcase *milvuspb.SearchRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DQLSearch, int(r.GetNq()), nil\n\tcase *milvuspb.QueryRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DQLQuery, 1, nil // think of the query request's nq as 1\n\tcase *milvuspb.CreateCollectionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLCollection, 1, nil\n\tcase *milvuspb.DropCollectionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLCollection, 1, nil\n\tcase *milvuspb.LoadCollectionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLCollection, 1, nil\n\tcase *milvuspb.ReleaseCollectionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLCollection, 1, nil\n\tcase *milvuspb.CreatePartitionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLPartition, 1, nil\n\tcase *milvuspb.DropPartitionRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLPartition, 1, nil\n\tcase *milvuspb.LoadPartitionsRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLPartition, 1, nil\n\tcase *milvuspb.ReleasePartitionsRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLPartition, 1, nil\n\tcase *milvuspb.CreateIndexRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLIndex, 1, nil\n\tcase *milvuspb.DropIndexRequest:\n\t\tcollectionID, _ := globalMetaCache.GetCollectionID(context.TODO(), r.GetDbName(), r.GetCollectionName())\n\t\treturn collectionID, internalpb.RateType_DDLIndex, 1, nil\n\tcase *milvuspb.FlushRequest:\n\t\treturn 0, internalpb.RateType_DDLFlush, 1, nil\n\tcase *milvuspb.ManualCompactionRequest:\n\t\treturn 0, internalpb.RateType_DDLCompaction, 1, nil\n\t\t// TODO: support more request\n\tdefault:\n\t\tif req == nil {\n\t\t\treturn 0, 0, 0, fmt.Errorf(\"null request\")\n\t\t}\n\t\treturn 0, 0, 0, fmt.Errorf(\"unsupported request type %s\", reflect.TypeOf(req).Name())\n\t}\n}", "title": "" }, { "docid": "e310e443f5bb0bfabdecfee9c1974f6b", "score": "0.48475438", "text": "func (self *Node) getJobReqs(jobDef map[string]interface{}, stageType string) (int, int, string) {\n\tthreads := 0\n\tmemGB := 0\n\tspecial := \"\"\n\n\t// Get values passed from the stage code\n\tif jobDef != nil {\n\t\tif v, ok := jobDef[\"__threads\"].(float64); ok {\n\t\t\tthreads = int(v)\n\t\t}\n\t\tif v, ok := jobDef[\"__mem_gb\"].(float64); ok {\n\t\t\tmemGB = int(v)\n\t\t}\n\t\tif v, ok := jobDef[\"__special\"].(string); ok {\n\t\t\tspecial = string(v)\n\t\t}\n\t}\n\n\t// Override with job manager caps specified from commandline\n\toverrideThreads := self.rt.overrides.GetOverride(self, fmt.Sprintf(\"%s.threads\", stageType), float64(threads))\n\tif overrideThreadsNum, ok := overrideThreads.(float64); ok {\n\t\tthreads = int(overrideThreadsNum)\n\t} else {\n\t\tutil.PrintInfo(\"runtime\", \"Invalid value for %s %s.threads: %v\", self.fqname, stageType, overrideThreads)\n\t}\n\n\toverrideMem := self.rt.overrides.GetOverride(self, fmt.Sprintf(\"%s.mem_gb\", stageType), float64(memGB))\n\tif overrideMemFloat, ok := overrideMem.(float64); ok {\n\t\tmemGB = int(overrideMemFloat)\n\t} else {\n\t\tutil.PrintInfo(\"runtime\", \"Invalid value for %s %s.mem_gb: %v\", self.fqname, stageType, overrideMem)\n\t}\n\n\tif self.local {\n\t\tthreads, memGB = self.rt.LocalJobManager.GetSystemReqs(threads, memGB)\n\t} else {\n\t\tthreads, memGB = self.rt.JobManager.GetSystemReqs(threads, memGB)\n\t}\n\n\t// Return modified values\n\treturn threads, memGB, special\n}", "title": "" }, { "docid": "690f63eaac0c048b474852fc640ab463", "score": "0.48466936", "text": "func getClusterFromRequest(c *gin.Context) (cluster.CommonCluster, bool) {\n\t// TODO: move these to a struct and create them only once upon application init\n\tclusters := intCluster.NewClusters(config.DB())\n\tsecretValidator := providers.NewSecretValidator(secret.Store)\n\tclusterManager := cluster.NewManager(clusters, secretValidator, cluster.NewNopClusterEvents(), nil, nil, log, errorHandler)\n\tclusterGetter := common.NewClusterGetter(clusterManager, log, errorHandler)\n\n\treturn clusterGetter.GetClusterFromRequest(c)\n}", "title": "" }, { "docid": "bece666e09d794d71c191b42cdc31a51", "score": "0.48328903", "text": "func DecodeAWSSizesReq(c context.Context, r *http.Request) (interface{}, error) {\n\tvar req AWSSizeReq\n\treq.Region = r.Header.Get(\"Region\")\n\n\treq.Architecture = r.URL.Query().Get(\"architecture\")\n\tif len(req.Architecture) > 0 {\n\t\tif req.Architecture == handlercommon.ARM64Architecture || req.Architecture == handlercommon.X64Architecture {\n\t\t\treturn req, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"wrong query parameter, unsupported architecture: %s\", req.Architecture)\n\t}\n\n\treturn req, nil\n}", "title": "" }, { "docid": "08b21164f436b435846eec8e44471227", "score": "0.4832182", "text": "func (m *metricSaphanaNetworkRequestCount) init() {\n\tm.data.SetName(\"saphana.network.request.count\")\n\tm.data.SetDescription(\"The number of active and pending service requests.\")\n\tm.data.SetUnit(\"{requests}\")\n\tm.data.SetEmptySum()\n\tm.data.Sum().SetIsMonotonic(false)\n\tm.data.Sum().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)\n\tm.data.Sum().DataPoints().EnsureCapacity(m.capacity)\n}", "title": "" }, { "docid": "cd9dd97a33208300a506cbd7da0dab02", "score": "0.4830585", "text": "func parsePtyRequest(s []byte) (width, height int, ok bool) {\n\t_, s, ok = parseString(s)\n\tif !ok {\n\t\treturn\n\t}\n\twidth32, s, ok := parseUint32(s)\n\tif !ok {\n\t\treturn\n\t}\n\theight32, _, ok := parseUint32(s)\n\twidth = int(width32)\n\theight = int(height32)\n\tif width < 1 {\n\t\tok = false\n\t}\n\tif height < 1 {\n\t\tok = false\n\t}\n\treturn\n}", "title": "" }, { "docid": "8a42b1bf8e7b368fd6364a6117fc9516", "score": "0.48294964", "text": "func (*Request_GetWhiteListSizeRequest) Descriptor() ([]byte, []int) {\n\treturn file_aesm_proto_proto_rawDescGZIP(), []int{0, 9}\n}", "title": "" }, { "docid": "dd5f96771e1beb40abb2846519150be6", "score": "0.48205858", "text": "func getUsageCGroup() (float64, float64, int, int, error) {\n\tp, err := process.NewProcess(int32(os.Getpid()))\n\tif err != nil {\n\t\treturn 0, 0, 0, 0, err\n\t}\n\n\tcpuPercent, err := p.Percent(time.Second)\n\tif err != nil {\n\t\treturn 0, 0, 0, 0, err\n\t}\n\n\t// the same with physical machine\n\t// need to divide by core number\n\tcpuPercent = cpuPercent / float64(runtime.NumCPU())\n\n\tmem, err := p.MemoryInfo()\n\tif err != nil {\n\t\treturn 0, 0, 0, 0, err\n\t}\n\n\tmemLimit, err := readUint(cgroupMemLimitPath)\n\tif err != nil {\n\t\treturn 0, 0, 0, 0, err\n\t}\n\n\t// mem.RSS / cgroup limit in bytes\n\tmemPercent := float64(mem.RSS) * 100 / float64(memLimit)\n\n\tgNum := runtime.NumGoroutine()\n\n\ttNum := getThreadNum()\n\n\treturn cpuPercent, memPercent, gNum, tNum, nil\n}", "title": "" }, { "docid": "1b8639702b12fc0d3be8249035ea2eda", "score": "0.48196203", "text": "func computeApproximateRequestSize(r *http.Request) int64 {\n\ts := int64(0)\n\tif r.URL != nil {\n\t\ts += int64(len(r.URL.String()))\n\t}\n\n\ts += int64(len(r.Method))\n\ts += int64(len(r.Proto))\n\tfor name, values := range r.Header {\n\t\ts += int64(len(name))\n\t\tfor _, value := range values {\n\t\t\ts += int64(len(value))\n\t\t}\n\t}\n\ts += int64(len(r.Host))\n\n\tif r.ContentLength != -1 {\n\t\ts += r.ContentLength\n\t}\n\treturn s\n}", "title": "" }, { "docid": "5ad3a8a099feee0daa87a04cb4bef360", "score": "0.480918", "text": "func getSystemInfoMetrics(\n\tctx context.Context,\n\treq *milvuspb.GetMetricsRequest,\n\tqc *QueryCoord,\n) (*milvuspb.GetMetricsResponse, error) {\n\n\tcoordTopology := metricsinfo.CoordTopology{\n\t\tSelf: metricsinfo.ComponentInfos{\n\t\t\tName: metricsinfo.ConstructComponentName(typeutil.QueryCoordRole, Params.QueryCoordID),\n\t\t},\n\t\tConnectedNodes: make([]metricsinfo.ComponentInfos, 0),\n\t}\n\n\tnodesMetrics := qc.cluster.getMetrics(ctx, req)\n\tfor _, nodeMetrics := range nodesMetrics {\n\t\tif nodeMetrics.err != nil {\n\t\t\tlog.Warn(\"invalid metrics of query node was found\",\n\t\t\t\tzap.Error(nodeMetrics.err))\n\t\t\tcoordTopology.ConnectedNodes = append(coordTopology.ConnectedNodes, metricsinfo.ComponentInfos{\n\t\t\t\tHasError: true,\n\t\t\t\tErrorReason: nodeMetrics.err.Error(),\n\t\t\t\t// Name doesn't matter here cause we can't get it when error occurs, using address as the Name?\n\t\t\t\tName: \"\",\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tif nodeMetrics.resp.Status.ErrorCode != commonpb.ErrorCode_Success {\n\t\t\tlog.Warn(\"invalid metrics of query node was found\",\n\t\t\t\tzap.Any(\"error_code\", nodeMetrics.resp.Status.ErrorCode),\n\t\t\t\tzap.Any(\"error_reason\", nodeMetrics.resp.Status.Reason))\n\t\t\tcoordTopology.ConnectedNodes = append(coordTopology.ConnectedNodes, metricsinfo.ComponentInfos{\n\t\t\t\tHasError: true,\n\t\t\t\tErrorReason: nodeMetrics.resp.Status.Reason,\n\t\t\t\tName: nodeMetrics.resp.ComponentName,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\n\t\tinfos := metricsinfo.ComponentInfos{}\n\t\terr := infos.Unmarshal(nodeMetrics.resp.Response)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"invalid metrics of query node was found\",\n\t\t\t\tzap.Error(err))\n\t\t\tcoordTopology.ConnectedNodes = append(coordTopology.ConnectedNodes, metricsinfo.ComponentInfos{\n\t\t\t\tHasError: true,\n\t\t\t\tErrorReason: err.Error(),\n\t\t\t\tName: nodeMetrics.resp.ComponentName,\n\t\t\t})\n\t\t\tcontinue\n\t\t}\n\t\tcoordTopology.ConnectedNodes = append(coordTopology.ConnectedNodes, infos)\n\t}\n\n\tresp, err := coordTopology.Marshal()\n\tif err != nil {\n\t\treturn &milvuspb.GetMetricsResponse{\n\t\t\tStatus: &commonpb.Status{\n\t\t\t\tErrorCode: commonpb.ErrorCode_UnexpectedError,\n\t\t\t\tReason: err.Error(),\n\t\t\t},\n\t\t\tResponse: \"\",\n\t\t}, nil\n\t}\n\n\treturn &milvuspb.GetMetricsResponse{\n\t\tStatus: &commonpb.Status{\n\t\t\tErrorCode: commonpb.ErrorCode_Success,\n\t\t\tReason: \"\",\n\t\t},\n\t\tResponse: resp,\n\t}, nil\n}", "title": "" }, { "docid": "8f86d4433e5d550ca074fd69257e5548", "score": "0.48022902", "text": "func MaxAllowedClusterUtilization(capacity *structs.ClusterCapacity, nodeFaultTolerance int, scaleIn bool) (maxAllowedUtilization int) {\n\tvar allocTotal, capacityTotal, usedCapacity int\n\tvar internalScalingMetric string\n\n\t// Use the cluster scaling metric when determining total cluster capacity\n\t// and task group scaling overhead.\n\tswitch capacity.ScalingMetric.Type {\n\tcase ScalingMetricMemory:\n\t\tinternalScalingMetric = ScalingMetricMemory\n\t\tallocTotal = capacity.TaskAllocation.MemoryMB\n\t\tusedCapacity = capacity.UsedCapacity.MemoryMB\n\t\tcapacityTotal = capacity.TotalCapacity.MemoryMB\n\tdefault:\n\t\tinternalScalingMetric = ScalingMetricProcessor\n\t\tallocTotal = capacity.TaskAllocation.CPUMHz\n\t\tusedCapacity = capacity.UsedCapacity.CPUMHz\n\t\tcapacityTotal = capacity.TotalCapacity.CPUMHz\n\t}\n\n\tnodeAvgAlloc := usedCapacity / capacity.NodeCount\n\tif scaleIn {\n\t\tcapacityTotal = capacityTotal - nodeAvgAlloc\n\t}\n\n\tlogging.Debug(\"client/nomad: Cluster Capacity (CPU [MHz]: %v, Memory [MB]: %v)\",\n\t\tcapacity.TotalCapacity.CPUMHz,\n\t\tcapacity.TotalCapacity.MemoryMB)\n\tlogging.Debug(\"client/nomad: Cluster Utilization (Scaling Metric: %v, CPU [MHz]: %v, Memory [MB]: %v)\",\n\t\tcapacity.ScalingMetric,\n\t\tcapacity.UsedCapacity.CPUMHz,\n\t\tcapacity.UsedCapacity.MemoryMB)\n\tlogging.Debug(\"client/nomad: Scaling Metric (%v), Average Node Capacity: %v, \"+\n\t\t\"Total allocation: %v Used Capacity: %v\",\n\t\tinternalScalingMetric,\n\t\tnodeAvgAlloc,\n\t\tallocTotal,\n\t\tusedCapacity)\n\n\t/*\n\t\t\tMax allowed utilization calculation\n\t\t +-----------------------+ Total Capacity\n\t\t | || |\n\t\t | |------------------+ Overhead: 1 Task worth capacity for all jobs\n\t\tMax Allowed Utilization| || |\n\t\t | || |\n\t\t +----||------------------+ Tolerance: 1 Node worth of average capacity\n\t\t || |\n\t\t || |\n\t\t\t\t\t\t\t\t\t|------------------+ Current Utilization (Including allocations that are being placed)\n\t\t | |\n\t\t | |\n\t\t | |\n\t\t | |\n\t\t | |\n\t\t +-----------------+\n\n\t*/\n\tmaxAllowedUtilization = ((capacityTotal - allocTotal) - (nodeAvgAlloc * nodeFaultTolerance))\n\n\treturn\n}", "title": "" }, { "docid": "2fa209b75eaa9c27036fd02ed0798e83", "score": "0.47956738", "text": "func GetClusterInfo(machineQuery string, unitQuery string) (*ClusterStatus, error) {\n\t// Both query strings are optional.\n\tif machineQuery == \"\" {\n\t\tmachineQuery = \".*\"\n\t}\n\tif unitQuery == \"\" {\n\t\tunitQuery = \".*\"\n\t}\n\tmre := regexp.MustCompile(machineQuery)\n\ture := regexp.MustCompile(unitQuery)\n\n\t// Get the machines.\n\tcmd := exec.Command(fleetctl, \"list-machines\", \"-fields=machine,ip,metadata\", \"-full=true\", \"-l=true\", \"-no-legend\")\n\tstdout, err := execCmd(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmachines := make(map[string]*ClusterMachine, 0)\n\tscanner := bufio.NewScanner(strings.NewReader(stdout))\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif mre.FindStringIndex(line) == nil {\n\t\t\tcontinue\n\t\t}\n\t\twords := filterEmpty(strings.Split(line, \"\\t\"))\n\t\tmachines[words[0]] = NewClusterMachine(words[0], words[1], words[2])\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, scanner.Err()\n\t}\n\n\t// Get the units.\n\tcmd = exec.Command(fleetctl, \"list-units\", \"-fields=machine,unit,hash,active,load,sub\", \"-full=true\", \"-l=true\",\n\t\t\"-no-legend\")\n\tstdout, err = execCmd(cmd)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tscanner = bufio.NewScanner(strings.NewReader(stdout))\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif ure.FindStringIndex(line) == nil {\n\t\t\tcontinue\n\t\t}\n\t\twords := filterEmpty(strings.Split(line, \"\\t\"))\n\t\tmc := strings.Split(words[0], \"/\")\n\t\tif _, ok := machines[mc[0]]; !ok {\n\t\t\tcontinue\n\t\t}\n\t\tmachines[mc[0]].Units = append(machines[mc[0]].Units, NewClusterUnit(words[1], words[2], words[3], words[4],\n\t\t\twords[5]))\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, scanner.Err()\n\t}\n\n\tsortUnitsByUnit := func(u1, u2 *ClusterUnit) bool {\n\t\treturn u1.Unit < u2.Unit\n\t}\n\n\tsortUnitsBySub := func(u1, u2 *ClusterUnit) bool {\n\t\treturn u1.Sub < u2.Sub\n\t}\n\n\tsortMachinesByMetaData := func(m1, m2 *ClusterMachine) bool {\n\t\treturn m1.MetaData < m2.MetaData\n\t}\n\tsortMachinesByIP := func(m1, m2 *ClusterMachine) bool {\n\t\treturn m1.IP < m2.IP\n\t}\n\n\ts := NewClusterStatus()\n\tfor _, m := range machines {\n\t\t// Filter out no units from machines.\n\t\tif unitQuery != \".*\" && len(m.Units) <= 0 {\n\t\t\tcontinue\n\t\t}\n\t\tNewUnitSorter(sortUnitsBySub, sortUnitsByUnit).Sort(m.Units)\n\t\ts.Machines = append(s.Machines, m)\n\t}\n\n\tNewMachineSorter(sortMachinesByMetaData, sortMachinesByIP).Sort(s.Machines)\n\treturn s, nil\n}", "title": "" }, { "docid": "8553f1f8a8c1dbe8224e18e0f637a524", "score": "0.4794524", "text": "func (*CountAllEnabledNodeThresholdsRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_node_threshold_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "789fc4c2d9d138f2364b558212dca248", "score": "0.47812378", "text": "func (req *ClusterRecommendationReq) sum(attr string) float64 {\n\tswitch attr {\n\tcase Cpu:\n\t\treturn req.SumCpu\n\tcase Memory:\n\t\treturn req.SumMem\n\tdefault:\n\t\tlog.Errorf(\"unsupported attribute: [%s]\", attr)\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "775f77333f975befd8dd5ace9d80a1a1", "score": "0.47790235", "text": "func hashSizes(name string) (size, blockSize int, ok bool) {\n\tswitch name {\n\tcase nameMD5:\n\t\treturn 16, 64, true\n\tcase nameSHA1:\n\t\treturn 20, 64, true\n\tcase nameSHA256:\n\t\treturn 32, 64, true\n\t}\n\n\treturn 0, 0, false\n}", "title": "" }, { "docid": "ff3ebfb16a63395df9ef9b3e75507b9b", "score": "0.47779042", "text": "func (k *Kyber) SIZEC() int {\n\treturn k.params.SIZEC\n}", "title": "" }, { "docid": "5d855a50e2d1da0756863d131c2978a5", "score": "0.4767659", "text": "func layoutNormalizeShardsAndReplicasCount(layout *chiv1.ChiClusterLayout) {\n\tif len(layout.Shards) > 0 {\n\t\t// We have Shards specified - ok, this is to be exact ShardsCount\n\t\tlayout.ShardsCount = len(layout.Shards)\n\t} else if layout.ShardsCount == 0 {\n\t\t// Neither ShardsCount nor Shards specified, assume 1 as default value\n\t\tlayout.ShardsCount = 1\n\t} else {\n\t\t// ShardsCount specified explicitly, Just use it\n\t}\n\n\tif layout.ReplicasCount == 0 {\n\t\t// In case no ReplicasCount specified use 1 as a default value - it will be used in Standard layout only\n\t\tlayout.ReplicasCount = 1\n\t}\n}", "title": "" }, { "docid": "d8c1f39dad02f0a4d06f365eb692b258", "score": "0.47674266", "text": "func calcNumThreads(maxChunkSize int64) int {\n\tnumCPUs := runtime.NumCPU()\n\thwMemoryBytes := memorySizeBytes()\n\n\tfmt.Printf(\"number of machine cores: %d\\n\", numCPUs)\n\tfmt.Printf(\"memory size: %d GiB\\n\", hwMemoryBytes/GiB)\n\n\tnumThreads := MinInt(numCPUs, maxNumThreads)\n\tmemoryCostPerThread := 3 * int64(maxChunkSize)\n\n\tfor numThreads > minNumThreads {\n\t\tprojectedMemoryUseBytes := memoryCostPerThread * int64(numThreads)\n\t\tif projectedMemoryUseBytes < (hwMemoryBytes - GiB) {\n\t\t\treturn numThreads\n\t\t}\n\t\tnumThreads -= 2\n\t}\n\treturn minNumThreads\n}", "title": "" }, { "docid": "ac8c15872c75bcde80c11dda84ce3f5c", "score": "0.476522", "text": "func getRequestCount(input string) (string, *requestCount, bool) {\n\tstrArray := strings.Split(input, \", \")\n\tif len(strArray) != 5 {\n\t\treturn \"\", nil, true\n\t}\n\tif strArray[0] == \"uri\" {\n\t\treturn \"\", nil, true\n\t}\n\n\tcode, err := strconv.ParseInt(strArray[2], 10, 32)\n\tif err != nil {\n\t\treturn \"\", nil, true\n\t}\n\tcount, err := strconv.ParseInt(strArray[3], 10, 32)\n\tif err != nil {\n\t\treturn \"\", nil, true\n\t}\n\treqCount := &requestCount{\n\t\tVerb: strArray[1],\n\t\tCode: int(code),\n\t\tCount: int(count),\n\t\tStage: strArray[4],\n\t}\n\n\treturn strArray[0], reqCount, false\n}", "title": "" }, { "docid": "2842ab5013e2571b8a8b2dc419022f73", "score": "0.47624338", "text": "func (*CountMetricStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_metric_stat_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "702f13dd4935b7ce97e376031504a029", "score": "0.47394902", "text": "func CPUStats(w http.ResponseWriter, r *http.Request) {\n\tcpuServerUsage, _ := cpu.GetProcessCPUPerformance(serverPID)\n\n\tutils.Respond(w, http.StatusOK, map[string]interface{}{\n\t\t\"nodecpuusage\": fmt.Sprintf(\"%.2f%%\", cpuServerUsage),\n\t})\n}", "title": "" }, { "docid": "e9a3941c30efe4deacf4796610ef58fc", "score": "0.47312316", "text": "func (sc *SystemConfig) GetCapacity() {\n\n\tvar cmd string\n\n\tif utils.OSType() == config.OSTypeLinux {\n\t\tcmd = fmt.Sprintf(\"df %s --total | grep total | grep -v grep | awk -F' ' '{print$2,$3,$4,$5}'\",\n\t\t\tconfiguration.GetConfig().RootDirectory)\n\t} else if utils.OSType() == config.OSTypeMac { // for mac system\n\t\tcmd = fmt.Sprintf(\"df %s | grep -v Used | grep -v grep | awk -F' ' '{print$2,$3,$4,$5}'\",\n\t\t\tconfiguration.GetConfig().RootDirectory)\n\t} else {\n\t\treturn\n\t}\n\n\tdata, err := utils.OCTSystem(cmd)\n\tif err != nil {\n\t\toctlog.Error(\"exec cmd [%s] error [%s]\\n\", cmd, err)\n\t\treturn\n\t}\n\n\tsegs := strings.Split(strings.Replace(data, \"\\n\", \"\", -1), \" \")\n\tsc.Capacity = utils.StringToInt64(segs[0])\n\tsc.Used = utils.StringToInt64(segs[1])\n\tsc.Available = utils.StringToInt64(segs[2])\n\tsc.Rate = segs[3]\n}", "title": "" }, { "docid": "6f512da8da81ab21aff98966675283d1", "score": "0.4730471", "text": "func (s *StorageAPI) getStorageClusterInfo(clusterName string) (stat *models.StorageClusterStat, err error) {\n\tstatData, err := s.repo.Get(s.ctx, constants.GetStorageClusterStatPath(clusterName))\n\tif err != nil {\n\t\treturn\n\t}\n\tstat = &models.StorageClusterStat{}\n\terr = encoding.JSONUnmarshal(statData, stat)\n\tif err != nil {\n\t\treturn\n\t}\n\tdiskUsageStat := disk.UsageStat{}\n\tfor _, node := range stat.Nodes {\n\t\tdiskUsageStat.Total += node.System.DiskUsageStat.Total\n\t\tdiskUsageStat.Used += node.System.DiskUsageStat.Used\n\t}\n\tdiskUsageStat.UsedPercent = float64(diskUsageStat.Used*100.0) / float64(diskUsageStat.Total)\n\tstat.Capacity = diskUsageStat\n\treturn\n}", "title": "" }, { "docid": "c1e30b1385702b8537c92e57de02f3c9", "score": "0.47301015", "text": "func lookUpUsedCapacity(node v1.Node, usedCapacityMap map[string]int64) int64 {\n\tvar ip, hostname string\n\tfor _, addr := range node.Status.Addresses {\n\t\tif addr.Type == v1.NodeInternalIP {\n\t\t\tip = addr.Address\n\t\t}\n\t\tif addr.Type == v1.NodeInternalDNS {\n\t\t\thostname = addr.Address\n\t\t}\n\t}\n\n\tif len(ip) != 0 {\n\t\tif usedCapacity, found := usedCapacityMap[ip]; found {\n\t\t\treturn usedCapacity\n\t\t}\n\t}\n\n\tif len(hostname) != 0 {\n\t\tif usedCapacity, found := usedCapacityMap[hostname]; found {\n\t\t\treturn usedCapacity\n\t\t}\n\t}\n\t// no info stored in GooseFS master. Scale in such node first.\n\treturn 0\n}", "title": "" }, { "docid": "1a899c52651d76df7b2678b9140f4df3", "score": "0.47249404", "text": "func CPUInfo() ([]CPUInfoStat, error) {\n\tfilename := common.HostProc(\"cpuinfo\")\n\tlines, _ := common.ReadLines(filename)\n\n\tvar ret []CPUInfoStat\n\n\tc := CPUInfoStat{CPU: -1, Cores: 1}\n\tfor _, line := range lines {\n\t\tfields := strings.Split(line, \":\")\n\t\tif len(fields) < 2 {\n\t\t\tcontinue\n\t\t}\n\t\tkey := strings.TrimSpace(fields[0])\n\t\tvalue := strings.TrimSpace(fields[1])\n\n\t\tswitch key {\n\t\tcase \"processor\":\n\t\t\tif c.CPU >= 0 {\n\t\t\t\terr := finishCPUInfo(&c)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn ret, err\n\t\t\t\t}\n\t\t\t\tret = append(ret, c)\n\t\t\t}\n\t\t\tc = CPUInfoStat{Cores: 1}\n\t\t\tt, err := strconv.ParseInt(value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.CPU = int32(t)\n\t\tcase \"vendor_id\":\n\t\t\tc.VendorID = value\n\t\tcase \"cpu family\":\n\t\t\tc.Family = value\n\t\tcase \"model\":\n\t\t\tc.Model = value\n\t\tcase \"model name\":\n\t\t\tc.ModelName = value\n\t\tcase \"stepping\":\n\t\t\tt, err := strconv.ParseInt(value, 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.Stepping = int32(t)\n\t\tcase \"cpu MHz\":\n\t\t\tt, err := strconv.ParseFloat(value, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.Mhz = t\n\t\tcase \"cache size\":\n\t\t\tt, err := strconv.ParseInt(strings.Replace(value, \" KB\", \"\", 1), 10, 64)\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.CacheSize = int32(t)\n\t\tcase \"physical id\":\n\t\t\tc.PhysicalID = value\n\t\tcase \"core id\":\n\t\t\tc.CoreID = value\n\t\tcase \"flags\", \"Features\":\n\t\t\tc.Flags = strings.FieldsFunc(value, func(r rune) bool {\n\t\t\t\treturn r == ',' || r == ' '\n\t\t\t})\n\t\t}\n\t}\n\tif c.CPU >= 0 {\n\t\terr := finishCPUInfo(&c)\n\t\tif err != nil {\n\t\t\treturn ret, err\n\t\t}\n\t\tret = append(ret, c)\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "6d8c605e9e7736262b46186704b92660", "score": "0.4720805", "text": "func (ba *BatchRequest) getReqCounts() reqCounts {\n\tvar counts reqCounts\n\tfor _, r := range ba.Requests {\n\t\tswitch {\n\t\tcase r.Get != nil:\n\t\t\tcounts[0]++\n\t\tcase r.Put != nil:\n\t\t\tcounts[1]++\n\t\tcase r.ConditionalPut != nil:\n\t\t\tcounts[2]++\n\t\tcase r.Increment != nil:\n\t\t\tcounts[3]++\n\t\tcase r.Delete != nil:\n\t\t\tcounts[4]++\n\t\tcase r.DeleteRange != nil:\n\t\t\tcounts[5]++\n\t\tcase r.ClearRange != nil:\n\t\t\tcounts[6]++\n\t\tcase r.Scan != nil:\n\t\t\tcounts[7]++\n\t\tcase r.BeginTransaction != nil:\n\t\t\tcounts[8]++\n\t\tcase r.EndTransaction != nil:\n\t\t\tcounts[9]++\n\t\tcase r.AdminSplit != nil:\n\t\t\tcounts[10]++\n\t\tcase r.AdminMerge != nil:\n\t\t\tcounts[11]++\n\t\tcase r.AdminTransferLease != nil:\n\t\t\tcounts[12]++\n\t\tcase r.AdminChangeReplicas != nil:\n\t\t\tcounts[13]++\n\t\tcase r.HeartbeatTxn != nil:\n\t\t\tcounts[14]++\n\t\tcase r.Gc != nil:\n\t\t\tcounts[15]++\n\t\tcase r.PushTxn != nil:\n\t\t\tcounts[16]++\n\t\tcase r.DeprecatedRangeLookup != nil:\n\t\t\tcounts[17]++\n\t\tcase r.ResolveIntent != nil:\n\t\t\tcounts[18]++\n\t\tcase r.ResolveIntentRange != nil:\n\t\t\tcounts[19]++\n\t\tcase r.Merge != nil:\n\t\t\tcounts[20]++\n\t\tcase r.TruncateLog != nil:\n\t\t\tcounts[21]++\n\t\tcase r.RequestLease != nil:\n\t\t\tcounts[22]++\n\t\tcase r.ReverseScan != nil:\n\t\t\tcounts[23]++\n\t\tcase r.ComputeChecksum != nil:\n\t\t\tcounts[24]++\n\t\tcase r.DeprecatedVerifyChecksum != nil:\n\t\t\tcounts[25]++\n\t\tcase r.CheckConsistency != nil:\n\t\t\tcounts[26]++\n\t\tcase r.Noop != nil:\n\t\t\tcounts[27]++\n\t\tcase r.InitPut != nil:\n\t\t\tcounts[28]++\n\t\tcase r.TransferLease != nil:\n\t\t\tcounts[29]++\n\t\tcase r.LeaseInfo != nil:\n\t\t\tcounts[30]++\n\t\tcase r.WriteBatch != nil:\n\t\t\tcounts[31]++\n\t\tcase r.Export != nil:\n\t\t\tcounts[32]++\n\t\tcase r.Import != nil:\n\t\t\tcounts[33]++\n\t\tcase r.QueryTxn != nil:\n\t\t\tcounts[34]++\n\t\tcase r.AdminScatter != nil:\n\t\t\tcounts[35]++\n\t\tcase r.AddSstable != nil:\n\t\t\tcounts[36]++\n\t\tcase r.RecomputeStats != nil:\n\t\t\tcounts[37]++\n\t\tcase r.Refresh != nil:\n\t\t\tcounts[38]++\n\t\tcase r.RefreshRange != nil:\n\t\t\tcounts[39]++\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unsupported request: %+v\", r))\n\t\t}\n\t}\n\treturn counts\n}", "title": "" }, { "docid": "10dfb5aacc378916bbd5d13038b1b779", "score": "0.47191688", "text": "func MachineTypeToCPUs(s string) int {\n\t{\n\t\t// GCE machine types.\n\t\tvar v int\n\t\tif _, err := fmt.Sscanf(s, \"n1-standard-%d\", &v); err == nil {\n\t\t\treturn v\n\t\t}\n\t\tif _, err := fmt.Sscanf(s, \"n1-highcpu-%d\", &v); err == nil {\n\t\t\treturn v\n\t\t}\n\t\tif _, err := fmt.Sscanf(s, \"n1-highmem-%d\", &v); err == nil {\n\t\t\treturn v\n\t\t}\n\t}\n\n\ttypeAndSize := strings.Split(s, \".\")\n\n\tif len(typeAndSize) == 2 {\n\t\tsize := typeAndSize[1]\n\n\t\tswitch size {\n\t\tcase \"large\":\n\t\t\treturn 2\n\t\tcase \"xlarge\":\n\t\t\treturn 4\n\t\tcase \"2xlarge\":\n\t\t\treturn 8\n\t\tcase \"4xlarge\":\n\t\t\treturn 16\n\t\tcase \"9xlarge\":\n\t\t\treturn 36\n\t\tcase \"12xlarge\":\n\t\t\treturn 48\n\t\tcase \"18xlarge\":\n\t\t\treturn 72\n\t\tcase \"24xlarge\":\n\t\t\treturn 96\n\t\t}\n\t}\n\n\t// Azure doesn't have a standard way to size machines.\n\t// This method is implemented for the default machine type.\n\t// Not all of Azure machine types contain the number of vCPUs int he size and\n\t// the sizing naming scheme is dependent on the machine type family.\n\tswitch s {\n\tcase \"Standard_D2_v3\":\n\t\treturn 2\n\tcase \"Standard_D4_v3\":\n\t\treturn 4\n\tcase \"Standard_D8_v3\":\n\t\treturn 8\n\tcase \"Standard_D16_v3\":\n\t\treturn 16\n\tcase \"Standard_D32_v3\":\n\t\treturn 32\n\tcase \"Standard_D48_v3\":\n\t\treturn 48\n\tcase \"Standard_D64_v3\":\n\t\treturn 64\n\t}\n\n\t// TODO(pbardea): Non-default Azure machine types are not supported\n\t// and will return unknown machine type error.\n\tfmt.Fprintf(os.Stderr, \"unknown machine type: %s\\n\", s)\n\tos.Exit(1)\n\treturn -1\n}", "title": "" }, { "docid": "3499c3813370fbf97f490fb32ebb23fe", "score": "0.47190034", "text": "func (d *Driver) GetClusterSize(ctx context.Context, info *types.ClusterInfo) (*types.NodeCount, error) {\n\tstate, err := getState(info)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsvc, err := getTKEServiceClient(ctx, state, \"GET\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclusters, err := getCluster(svc, state)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &types.NodeCount{Count: clusters.Data.Clusters[0].NodeNum}, nil\n}", "title": "" }, { "docid": "0514d035ab2dd6942718f40b182f4577", "score": "0.47167775", "text": "func CPUInfo() ([]CPUInfoStat, error) {\n\tvar ret []CPUInfoStat\n\n\tout, err := exec.Command(\"/usr/sbin/sysctl\", \"machdep.cpu\").Output()\n\tif err != nil {\n\t\treturn ret, err\n\t}\n\n\tc := CPUInfoStat{}\n\tfor _, line := range strings.Split(string(out), \"\\n\") {\n\t\tvalues := strings.Fields(line)\n\t\tif len(values) < 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\tt, err := strconv.ParseInt(values[1], 10, 64)\n\t\t// err is not checked here because some value is string.\n\t\tif strings.HasPrefix(line, \"machdep.cpu.brand_string\") {\n\t\t\tc.ModelName = strings.Join(values[1:], \" \")\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.family\") {\n\t\t\tc.Family = values[1]\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.model\") {\n\t\t\tc.Model = values[1]\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.stepping\") {\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.Stepping = int32(t)\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.features\") {\n\t\t\tfor _, v := range values[1:] {\n\t\t\t\tc.Flags = append(c.Flags, strings.ToLower(v))\n\t\t\t}\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.leaf7_features\") {\n\t\t\tfor _, v := range values[1:] {\n\t\t\t\tc.Flags = append(c.Flags, strings.ToLower(v))\n\t\t\t}\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.extfeatures\") {\n\t\t\tfor _, v := range values[1:] {\n\t\t\t\tc.Flags = append(c.Flags, strings.ToLower(v))\n\t\t\t}\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.core_count\") {\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.Cores = int32(t)\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.cache.size\") {\n\t\t\tif err != nil {\n\t\t\t\treturn ret, err\n\t\t\t}\n\t\t\tc.CacheSize = int32(t)\n\t\t} else if strings.HasPrefix(line, \"machdep.cpu.vendor\") {\n\t\t\tc.VendorID = values[1]\n\t\t}\n\n\t\t// TODO:\n\t\t// c.Mhz = mustParseFloat64(values[1])\n\t}\n\n\treturn append(ret, c), nil\n}", "title": "" }, { "docid": "199c425468c5c5a573ff15af6a616835", "score": "0.4709132", "text": "func capacityOutputParser(output string) *apis.CStorPoolCapacityAttr {\n\tvar outputStr []string\n\t// Initialize capacity object.\n\tcapacity := &apis.CStorPoolCapacityAttr{\n\t\t\"\",\n\t\t\"\",\n\t\t\"\",\n\t}\n\tif strings.TrimSpace(string(output)) != \"\" {\n\t\toutputStr = strings.Split(string(output), \"\\n\")\n\t\tif !(len(outputStr) < 4) {\n\t\t\tpoolCapacityArrTotal := strings.Fields(outputStr[1])\n\t\t\tpoolCapacityArrFree := strings.Fields(outputStr[2])\n\t\t\tpoolCapacityArrAlloc := strings.Fields(outputStr[3])\n\t\t\tif !(len(poolCapacityArrTotal) < 4 || len(poolCapacityArrFree) < 4) || len(poolCapacityArrAlloc) < 4 {\n\t\t\t\tcapacity.Total = strings.TrimSpace(poolCapacityArrTotal[2])\n\t\t\t\tcapacity.Free = strings.TrimSpace(poolCapacityArrFree[2])\n\t\t\t\tcapacity.Used = strings.TrimSpace(poolCapacityArrAlloc[2])\n\t\t\t}\n\t\t}\n\t}\n\treturn capacity\n}", "title": "" }, { "docid": "43708b0fd5922ef8810ed53e5ad4868d", "score": "0.46986353", "text": "func (ba *BatchRequest) getReqCounts() reqCounts {\n\tvar counts reqCounts\n\tfor _, ru := range ba.Requests {\n\t\tswitch ru.GetValue().(type) {\n\t\tcase *RequestUnion_Get:\n\t\t\tcounts[0]++\n\t\tcase *RequestUnion_Put:\n\t\t\tcounts[1]++\n\t\tcase *RequestUnion_ConditionalPut:\n\t\t\tcounts[2]++\n\t\tcase *RequestUnion_Increment:\n\t\t\tcounts[3]++\n\t\tcase *RequestUnion_Delete:\n\t\t\tcounts[4]++\n\t\tcase *RequestUnion_DeleteRange:\n\t\t\tcounts[5]++\n\t\tcase *RequestUnion_ClearRange:\n\t\t\tcounts[6]++\n\t\tcase *RequestUnion_RevertRange:\n\t\t\tcounts[7]++\n\t\tcase *RequestUnion_Scan:\n\t\t\tcounts[8]++\n\t\tcase *RequestUnion_EndTxn:\n\t\t\tcounts[9]++\n\t\tcase *RequestUnion_AdminSplit:\n\t\t\tcounts[10]++\n\t\tcase *RequestUnion_AdminUnsplit:\n\t\t\tcounts[11]++\n\t\tcase *RequestUnion_AdminMerge:\n\t\t\tcounts[12]++\n\t\tcase *RequestUnion_AdminTransferLease:\n\t\t\tcounts[13]++\n\t\tcase *RequestUnion_AdminChangeReplicas:\n\t\t\tcounts[14]++\n\t\tcase *RequestUnion_AdminRelocateRange:\n\t\t\tcounts[15]++\n\t\tcase *RequestUnion_HeartbeatTxn:\n\t\t\tcounts[16]++\n\t\tcase *RequestUnion_Gc:\n\t\t\tcounts[17]++\n\t\tcase *RequestUnion_PushTxn:\n\t\t\tcounts[18]++\n\t\tcase *RequestUnion_RecoverTxn:\n\t\t\tcounts[19]++\n\t\tcase *RequestUnion_ResolveIntent:\n\t\t\tcounts[20]++\n\t\tcase *RequestUnion_ResolveIntentRange:\n\t\t\tcounts[21]++\n\t\tcase *RequestUnion_Merge:\n\t\t\tcounts[22]++\n\t\tcase *RequestUnion_TruncateLog:\n\t\t\tcounts[23]++\n\t\tcase *RequestUnion_RequestLease:\n\t\t\tcounts[24]++\n\t\tcase *RequestUnion_ReverseScan:\n\t\t\tcounts[25]++\n\t\tcase *RequestUnion_ComputeChecksum:\n\t\t\tcounts[26]++\n\t\tcase *RequestUnion_CheckConsistency:\n\t\t\tcounts[27]++\n\t\tcase *RequestUnion_InitPut:\n\t\t\tcounts[28]++\n\t\tcase *RequestUnion_TransferLease:\n\t\t\tcounts[29]++\n\t\tcase *RequestUnion_LeaseInfo:\n\t\t\tcounts[30]++\n\t\tcase *RequestUnion_WriteBatch:\n\t\t\tcounts[31]++\n\t\tcase *RequestUnion_Export:\n\t\t\tcounts[32]++\n\t\tcase *RequestUnion_Import:\n\t\t\tcounts[33]++\n\t\tcase *RequestUnion_QueryTxn:\n\t\t\tcounts[34]++\n\t\tcase *RequestUnion_QueryIntent:\n\t\t\tcounts[35]++\n\t\tcase *RequestUnion_AdminScatter:\n\t\t\tcounts[36]++\n\t\tcase *RequestUnion_AddSstable:\n\t\t\tcounts[37]++\n\t\tcase *RequestUnion_RecomputeStats:\n\t\t\tcounts[38]++\n\t\tcase *RequestUnion_Refresh:\n\t\t\tcounts[39]++\n\t\tcase *RequestUnion_RefreshRange:\n\t\t\tcounts[40]++\n\t\tcase *RequestUnion_Subsume:\n\t\t\tcounts[41]++\n\t\tcase *RequestUnion_RangeStats:\n\t\t\tcounts[42]++\n\t\tcase *RequestUnion_AdminVerifyProtectedTimestamp:\n\t\t\tcounts[43]++\n\t\tcase *RequestUnion_Migrate:\n\t\t\tcounts[44]++\n\t\tdefault:\n\t\t\tpanic(fmt.Sprintf(\"unsupported request: %+v\", ru))\n\t\t}\n\t}\n\treturn counts\n}", "title": "" }, { "docid": "f6c193f51cbbcde397610af3dceb9fc2", "score": "0.46850994", "text": "func optimalPartInfo(objectSize int64) (totalPartsCount int, partSize int64, lastPartSize int64, err error) {\n\t// object size is '-1' set it to 5TiB.\n\tif objectSize == -1 {\n\t\tobjectSize = maxMultipartPutObjectSize\n\t}\n\t// object size is larger than supported maximum.\n\tif objectSize > maxMultipartPutObjectSize {\n\t\terr = ErrEntityTooLarge(objectSize, maxMultipartPutObjectSize, \"\", \"\")\n\t\treturn\n\t}\n\t// Use floats for part size for all calculations to avoid\n\t// overflows during float64 to int64 conversions.\n\tpartSizeFlt := math.Ceil(float64(objectSize / maxPartsCount))\n\tpartSizeFlt = math.Ceil(partSizeFlt/minPartSize) * minPartSize\n\t// Total parts count.\n\ttotalPartsCount = int(math.Ceil(float64(objectSize) / partSizeFlt))\n\t// Part size.\n\tpartSize = int64(partSizeFlt)\n\t// Last part size.\n\tlastPartSize = objectSize - int64(totalPartsCount-1)*partSize\n\treturn totalPartsCount, partSize, lastPartSize, nil\n}", "title": "" }, { "docid": "2c264d00c05b40a83ac2ee73787f29ab", "score": "0.46749762", "text": "func (t *Tfhd) calcSize() int {\n\tsum := BYTESINSIZE + BYTESINBOXTYPE + BYTESINVERSION + BYTESINFLAGS + BYTESINTRACKID\n\tif t.baseDataOffsetPresent != 0 {\n\t\tsum += BYTESINBASEDATAOFFSET\n\t}\n\tif t.sampleDescriptionPresent != 0 {\n\t\tsum += BYTESINDESCRIPTIONINDEX\n\t}\n\tif t.defaultSampleDurationPresent != 0 {\n\t\tsum += BYTESSAMPLEDURATION\n\t}\n\tif t.defaultSampleSizePresent != 0 {\n\t\tsum += BYTESSAMPLESIZE\n\t}\n\tif t.defaultSampleFlagsPresent != 0 {\n\t\tsum += BYTESSAMPLEFLAGS\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "9cd6e4c941fbc2bcd374e16bf4449e3c", "score": "0.4647528", "text": "func (m *metricSaphanaNetworkRequestFinishedCount) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" }, { "docid": "921001bd781e11e4867a3712c3659850", "score": "0.4642025", "text": "func (*ClusterHealthRequest) Descriptor() ([]byte, []int) {\n\treturn file_es_monitor_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5672af79950eabc8f30f03ef765f1ee7", "score": "0.46418372", "text": "func nodeAppclassUsage(stStore statestore.StateStore) metricValues {\n\tcgroupStats, err := stStore.ListCgroupResourceRecentState(false,\n\t\tsets.NewString(appclass.AppClassOnline, appclass.AppClassSystem, appclass.AppClassOffline))\n\tif err != nil || len(cgroupStats) == 0 {\n\t\treturn metricValues{}\n\t}\n\n\tvar (\n\t\tofflineCpu, onlineCpu float64\n\t\tofflineMemTotal, offlineMemRSS, onlineMemTotal, onlineMemRSS float64\n\t\ttimestamp time.Time\n\t)\n\tfor _, stat := range cgroupStats {\n\t\ttimestamp = stat.Timestamp\n\t\tif stat.Ref.AppClass == appclass.AppClassOnline ||\n\t\t\tstat.Ref.AppClass == appclass.AppClassSystem {\n\t\t\t// online resource including system module resource usage\n\t\t\tonlineCpu += stat.CpuUsage\n\t\t\tonlineMemTotal += stat.MemoryTotalUsage\n\t\t\tonlineMemRSS += stat.MemoryWorkingSetUsage\n\t\t\tcontinue\n\t\t} else if stat.Ref.AppClass == appclass.AppClassOffline {\n\t\t\t// offline pod usage\n\t\t\tofflineCpu += stat.CpuUsage\n\t\t\tofflineMemTotal += stat.MemoryTotalUsage\n\t\t\tofflineMemRSS += stat.MemoryWorkingSetUsage\n\t\t}\n\t}\n\treturn append(metricValues{\n\t\t{\n\t\t\tvalue: onlineCpu,\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"cpu\", \"online\", \"false\"},\n\t\t},\n\t\t{\n\t\t\tvalue: offlineCpu,\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"cpu\", \"offline\", \"false\"},\n\t\t},\n\t\t{\n\t\t\tvalue: bytesToGi(onlineMemTotal),\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"mem\", \"online\", \"false\"},\n\t\t},\n\t\t{\n\t\t\tvalue: bytesToGi(onlineMemRSS),\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"mem_rss\", \"online\", \"false\"},\n\t\t},\n\t\t{\n\t\t\tvalue: bytesToGi(offlineMemTotal),\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"mem\", \"offline\", \"false\"},\n\t\t},\n\t\t{\n\t\t\tvalue: bytesToGi(offlineMemRSS),\n\t\t\ttimestamp: timestamp,\n\t\t\tlabels: []string{\"mem_rss\", \"offline\", \"false\"},\n\t\t},\n\t}, percentUsageMetrics(stStore, offlineCpu, onlineCpu, offlineMemTotal, offlineMemRSS,\n\t\tonlineMemTotal, onlineMemRSS, timestamp)...)\n}", "title": "" }, { "docid": "eda7382f67565fb1cfdfbdcd4fa75305", "score": "0.4623017", "text": "func queryExtentsRequest(c *xgb.Conn, DestinationWindow xproto.Window) []byte {\n\tsize := 8\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"SHAPE\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 5 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(DestinationWindow))\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "0126474f27ccce0f15bacab2e4ff0b01", "score": "0.4611541", "text": "func (m Plugin) FetchMetrics() (map[string]float64, error) {\n\tresp, err := http.Get(fmt.Sprintf(\"http://%s/stats/app\", m.Target))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\ts := struct {\n\t\tUptime float64 `json:\"uptime\"`\n\t\tStartAt float64 `json:\"start_at\"`\n\t\tServiceUnavailableAt float64 `json:\"su_at\"`\n\t\tWorkers float64 `json:\"workers\"`\n\t\tQueueSize float64 `json:\"queue_size\"`\n\t\tRetryQueueSize float64 `json:\"retry_queue_size\"`\n\t\tWorkersQueueSize float64 `json:\"workers_queue_size\"`\n\t\tCommandQueueSize float64 `json:\"cmdq_queue_size\"`\n\t\tRetryCount float64 `json:\"retry_count\"`\n\t\tRequestCount float64 `json:\"req_count\"`\n\t\tSentCount float64 `json:\"sent_count\"`\n\t\tErrCount float64 `json:\"err_count\"`\n\t\tCertificateExpireUntil float64 `json:\"certificate_expire_until\"`\n\t}{}\n\n\tif err := json.NewDecoder(resp.Body).Decode(&s); err != nil {\n\t\treturn nil, err\n\t}\n\tret := make(map[string]float64, 13)\n\tret[\"uptime\"] = s.Uptime\n\tret[\"workers\"] = s.Workers\n\tret[\"queue_size\"] = s.QueueSize\n\tret[\"retry_queue_size\"] = s.RetryQueueSize\n\tret[\"workers_queue_size\"] = s.WorkersQueueSize\n\tret[\"cmdq_queue_size\"] = s.CommandQueueSize\n\tret[\"retry_count\"] = s.RetryCount\n\tret[\"req_count\"] = s.RequestCount\n\tret[\"sent_count\"] = s.SentCount\n\tret[\"err_count\"] = s.ErrCount\n\tret[\"certificate_expire_until\"] = s.CertificateExpireUntil\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "838f27dd65961417051a197d2652f443", "score": "0.46071202", "text": "func predictSize(\n\tfromFilesystemId, fromSnapshotId, toFilesystemId, toSnapshotId string,\n) (int64, error) {\n\tsendArgs := calculateSendArgs(fromFilesystemId, fromSnapshotId, toFilesystemId, toSnapshotId)\n\tpredictArgs := []string{\"send\", \"-nP\"}\n\tpredictArgs = append(predictArgs, sendArgs...)\n\n\tsizeCmd := exec.Command(\"zfs\", predictArgs...)\n\n\tlog.Printf(\"[predictSize] predict command: %s\", strings.Join(predictArgs, \" \"))\n\n\tout, err := sizeCmd.CombinedOutput()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tshrap := strings.Split(string(out), \"\\n\")\n\tif len(shrap) < 2 {\n\t\treturn 0, fmt.Errorf(\"Not enough lines in output %v\", string(out))\n\t}\n\tsizeLine := shrap[len(shrap)-2]\n\tshrap = strings.Fields(sizeLine)\n\tif len(shrap) < 2 {\n\t\treturn 0, fmt.Errorf(\"Not enough fields in %v\", sizeLine)\n\t}\n\n\tsize, err := strconv.ParseInt(shrap[1], 10, 64)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn size, nil\n}", "title": "" }, { "docid": "823b1a521aad6341af169bc42d0c3e0c", "score": "0.45998612", "text": "func getDwsectCUSize(sname string, pkgname string) uint64 {\n\treturn dwsectCUSize[sname+\".\"+pkgname]\n}", "title": "" }, { "docid": "49f41b6102c623db3f32e2f45084a9cb", "score": "0.4596665", "text": "func calculateMemoryConsumption(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, memoryCapacity, memoryAllocatable int) (string, error) {\n\n\tvar totalMemoryConsumption int\n\tvar MemoryConsumption string\n\tvar selector string\n\n\tif experimentsDetails.MemoryConsumptionMebibytes == 0 {\n\t\tif experimentsDetails.MemoryConsumptionPercentage == 0 {\n\t\t\tlog.Info(\"Neither of MemoryConsumptionPercentage or MemoryConsumptionMebibytes provided, proceeding with a default MemoryConsumptionPercentage value of 30%%\")\n\t\t\treturn \"30%\", nil\n\t\t}\n\t\tselector = \"percentage\"\n\t} else {\n\t\tif experimentsDetails.MemoryConsumptionPercentage == 0 {\n\t\t\tselector = \"mebibytes\"\n\t\t} else {\n\t\t\tlog.Warn(\"Both MemoryConsumptionPercentage & MemoryConsumptionMebibytes provided as inputs, using the MemoryConsumptionPercentage value to proceed with the experiment\")\n\t\t\tselector = \"percentage\"\n\t\t}\n\t}\n\n\tswitch selector {\n\n\tcase \"percentage\":\n\n\t\t//Getting the total memory under chaos\n\t\tmemoryForChaos := ((float64(experimentsDetails.MemoryConsumptionPercentage) / 100) * float64(memoryCapacity))\n\n\t\t//Get the percentage of memory under chaos wrt allocatable memory\n\t\ttotalMemoryConsumption = int((float64(memoryForChaos) / float64(memoryAllocatable)) * 100)\n\t\tif totalMemoryConsumption > 100 {\n\t\t\tlog.Infof(\"[Info]: PercentageOfMemoryCapacity To Be Used: %d percent, which is more than 100 percent (%d percent) of Allocatable Memory, so the experiment will only consume upto 100 percent of Allocatable Memory\", experimentsDetails.MemoryConsumptionPercentage, totalMemoryConsumption)\n\t\t\tMemoryConsumption = \"100%\"\n\t\t} else {\n\t\t\tlog.Infof(\"[Info]: PercentageOfMemoryCapacity To Be Used: %v percent, which is %d percent of Allocatable Memory\", experimentsDetails.MemoryConsumptionPercentage, totalMemoryConsumption)\n\t\t\tMemoryConsumption = strconv.Itoa(totalMemoryConsumption) + \"%\"\n\t\t}\n\t\treturn MemoryConsumption, nil\n\n\tcase \"mebibytes\":\n\n\t\t// Bringing all the values in Ki unit to compare\n\t\t// since 1Mi = 1025.390625Ki\n\t\tTotalMemoryConsumption := float64(experimentsDetails.MemoryConsumptionMebibytes) * 1025.390625\n\t\t// since 1Ki = 1024 bytes\n\t\tmemoryAllocatable := memoryAllocatable / 1024\n\n\t\tif memoryAllocatable < int(TotalMemoryConsumption) {\n\t\t\tMemoryConsumption = strconv.Itoa(memoryAllocatable) + \"k\"\n\t\t\tlog.Infof(\"[Info]: The memory for consumption %vKi is more than the available memory %vKi, so the experiment will hog the memory upto %vKi\", int(TotalMemoryConsumption), memoryAllocatable, memoryAllocatable)\n\t\t} else {\n\t\t\tMemoryConsumption = strconv.Itoa(experimentsDetails.MemoryConsumptionMebibytes) + \"m\"\n\t\t}\n\t\treturn MemoryConsumption, nil\n\t}\n\treturn \"\", errors.Errorf(\"please specify the memory consumption value either in percentage or mebibytes in a non-decimal format using respective envs\")\n}", "title": "" }, { "docid": "25606164819db5fc002cbfd4cbd8cb97", "score": "0.45965743", "text": "func (moof *Moof) calcSize() int {\n\tsum := BYTESINSIZE + BYTESINBOXTYPE\n\tfor _, box := range moof.boxes {\n\t\tsum += box.calcSize()\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "d11733c9c332831db487dc9ea83bce7e", "score": "0.45885545", "text": "func determineMachineProcessors() int {\n\tif runtime.GOOS == \"darwin\" {\n\t\toutput, _, err := localcmd.New(\"sysctl\").Args(\"-n\", \"hw.logicalcpu\").Output()\n\t\tif err == nil {\n\t\t\tcpus, aerr := strconv.Atoi(strings.TrimSpace(output))\n\t\t\tif aerr == nil {\n\t\t\t\treturn cpus // use all cpus\n\t\t\t}\n\t\t}\n\t}\n\treturn defaultMachineProcessors\n}", "title": "" }, { "docid": "dc0f153fc997a811f44c76144c23a81d", "score": "0.45746243", "text": "func (a *ClusterApiService) ClusterCollectionPerformanceMetricsGet(ctx _context.Context, localVarOptionals *ClusterCollectionPerformanceMetricsGetOpts) (ClusterMetricsResponse, *_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 ClusterMetricsResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/cluster/metrics\"\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\n\tif localVarOptionals != nil && localVarOptionals.Timestamp.IsSet() {\n\t\tlocalVarQueryParams.Add(\"timestamp\", parameterToString(localVarOptionals.Timestamp.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.IopsTotal.IsSet() {\n\t\tlocalVarQueryParams.Add(\"iops.total\", parameterToString(localVarOptionals.IopsTotal.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.IopsOther.IsSet() {\n\t\tlocalVarQueryParams.Add(\"iops.other\", parameterToString(localVarOptionals.IopsOther.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.IopsWrite.IsSet() {\n\t\tlocalVarQueryParams.Add(\"iops.write\", parameterToString(localVarOptionals.IopsWrite.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.IopsRead.IsSet() {\n\t\tlocalVarQueryParams.Add(\"iops.read\", parameterToString(localVarOptionals.IopsRead.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Duration.IsSet() {\n\t\tlocalVarQueryParams.Add(\"duration\", parameterToString(localVarOptionals.Duration.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ThroughputTotal.IsSet() {\n\t\tlocalVarQueryParams.Add(\"throughput.total\", parameterToString(localVarOptionals.ThroughputTotal.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ThroughputOther.IsSet() {\n\t\tlocalVarQueryParams.Add(\"throughput.other\", parameterToString(localVarOptionals.ThroughputOther.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ThroughputWrite.IsSet() {\n\t\tlocalVarQueryParams.Add(\"throughput.write\", parameterToString(localVarOptionals.ThroughputWrite.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ThroughputRead.IsSet() {\n\t\tlocalVarQueryParams.Add(\"throughput.read\", parameterToString(localVarOptionals.ThroughputRead.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LatencyTotal.IsSet() {\n\t\tlocalVarQueryParams.Add(\"latency.total\", parameterToString(localVarOptionals.LatencyTotal.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LatencyOther.IsSet() {\n\t\tlocalVarQueryParams.Add(\"latency.other\", parameterToString(localVarOptionals.LatencyOther.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LatencyWrite.IsSet() {\n\t\tlocalVarQueryParams.Add(\"latency.write\", parameterToString(localVarOptionals.LatencyWrite.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.LatencyRead.IsSet() {\n\t\tlocalVarQueryParams.Add(\"latency.read\", parameterToString(localVarOptionals.LatencyRead.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Status.IsSet() {\n\t\tlocalVarQueryParams.Add(\"status\", parameterToString(localVarOptionals.Status.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ReturnTimeout.IsSet() {\n\t\tlocalVarQueryParams.Add(\"return_timeout\", parameterToString(localVarOptionals.ReturnTimeout.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Fields.IsSet() {\n\t\tlocalVarQueryParams.Add(\"fields\", parameterToString(localVarOptionals.Fields.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.MaxRecords.IsSet() {\n\t\tlocalVarQueryParams.Add(\"max_records\", parameterToString(localVarOptionals.MaxRecords.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.OrderBy.IsSet() {\n\t\tlocalVarQueryParams.Add(\"order_by\", parameterToString(localVarOptionals.OrderBy.Value(), \"csv\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.ReturnRecords.IsSet() {\n\t\tlocalVarQueryParams.Add(\"return_records\", parameterToString(localVarOptionals.ReturnRecords.Value(), \"\"))\n\t}\n\tif localVarOptionals != nil && localVarOptionals.Interval.IsSet() {\n\t\tlocalVarQueryParams.Add(\"interval\", parameterToString(localVarOptionals.Interval.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\", \"application/hal+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 ClusterMetricsResponse\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 ErrorResponse\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": "3a7054ece4110b0a7ca20b7c94b7b134", "score": "0.45682302", "text": "func (*CreateClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mysql_v1alpha_cluster_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "c228793aec6a8de0ffe9625857eeb6d1", "score": "0.4567816", "text": "func (*ClusterSize) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataproc_logging_autoscaler_log_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "0e4e1a830bc4072e08d14ddb457a1511", "score": "0.45657873", "text": "func (r IPVSCpustatPlugin) Parse(stat io.Reader) (map[string]float64, error) {\n scanner := bufio.NewScanner(stat)\n data := make(map[string]float64)\n\n for scanner.Scan() {\n fields := strings.Fields(scanner.Text())\n // cpu stat line is follow format\n // <CpuNum> <Conns> <InPackets> <OutPackets> <InBytes> <OutBytes>\n if len(fields) != 6 {\n continue\n }\n if fields[0] == \"CPU\" || fields[0] == \"~\" {\n continue\n }\n CPUNum, err := strconv.ParseUint(fields[0], 16, 64)\n if err != nil {\n return nil, err\n }\n if int(CPUNum) >= r.CPUs {\n continue\n }\n KeyPrefix := strings.Replace(KeyPrefixTemplate, \"#\", fmt.Sprint(CPUNum), -1)\n d, err := CPUStatData(fields)\n if err != nil {\n return nil, err\n }\n data[KeyPrefix + \".conns.conn\"] = d.Conns\n data[KeyPrefix + \".packets.in\"] = d.InPackets\n data[KeyPrefix + \".packets.out\"] = d.OutPackets\n data[KeyPrefix + \".bytes.in\"] = d.InBytes\n data[KeyPrefix + \".bytes.out\"] = d.OutBytes\n }\n\n return data, nil\n}", "title": "" }, { "docid": "6f60b126197a5ad4e87475e3495a90c5", "score": "0.456231", "text": "func GetInsight(cluster string, namespace string, objType string, objName string, containerName string) (map[string]map[string]string, string, error) {\n\n\tinsight, err := lookupInsight(cluster, namespace, objType, objName, containerName)\n\tif err != nil {\n\t\treturn nil, \"\", errors.New(\"unable to locate resource spec\")\n\t}\n\n\tvar insightObj = map[string]map[string]string{}\n\tinsightObj[\"limits\"] = map[string]string{}\n\tinsightObj[\"requests\"] = map[string]string{}\n\n\tapprovalSetting, err := getAttribute(insight[\"entityId\"].(string), \"attr_ApprovalSetting\")\n\tif err != nil {\n\t\tapprovalSetting = \"Not Approved\"\n\t}\n\n\tif approvalSetting != \"Not Approved\" && support.InMap(insight, []string{\"recommendedCpuLimit\", \"recommendedMemLimit\", \"recommendedCpuRequest\", \"recommendedMemRequest\"}) && insight[\"recommendedCpuLimit\"].(float64) > 0 && insight[\"recommendedMemLimit\"].(float64) > 0 && insight[\"recommendedCpuRequest\"].(float64) > 0 && insight[\"recommendedMemRequest\"].(float64) > 0 {\n\n\t\tapprovalSetting = \"Approved\"\n\n\t\tinsightObj[\"limits\"][\"cpu\"] = strconv.FormatFloat(insight[\"recommendedCpuLimit\"].(float64), 'f', -1, 64) + \"m\"\n\t\tinsightObj[\"limits\"][\"memory\"] = strconv.FormatFloat(insight[\"recommendedMemLimit\"].(float64), 'f', -1, 64) + \"Mi\"\n\t\tinsightObj[\"requests\"][\"cpu\"] = strconv.FormatFloat(insight[\"recommendedCpuRequest\"].(float64), 'f', -1, 64) + \"m\"\n\t\tinsightObj[\"requests\"][\"memory\"] = strconv.FormatFloat(insight[\"recommendedMemRequest\"].(float64), 'f', -1, 64) + \"Mi\"\n\n\t} else if approvalSetting == \"Not Approved\" && support.InMap(insight, []string{\"currentCpuLimit\", \"currentMemLimit\", \"currentCpuRequest\", \"currentMemRequest\"}) && insight[\"currentCpuLimit\"].(float64) > 0 && insight[\"currentMemLimit\"].(float64) > 0 && insight[\"currentCpuRequest\"].(float64) > 0 && insight[\"currentMemRequest\"].(float64) > 0 {\n\n\t\tinsightObj[\"limits\"][\"cpu\"] = strconv.FormatFloat(insight[\"currentCpuLimit\"].(float64), 'f', -1, 64) + \"m\"\n\t\tinsightObj[\"limits\"][\"memory\"] = strconv.FormatFloat(insight[\"currentMemLimit\"].(float64), 'f', -1, 64) + \"Mi\"\n\t\tinsightObj[\"requests\"][\"cpu\"] = strconv.FormatFloat(insight[\"currentCpuRequest\"].(float64), 'f', -1, 64) + \"m\"\n\t\tinsightObj[\"requests\"][\"memory\"] = strconv.FormatFloat(insight[\"currentMemRequest\"].(float64), 'f', -1, 64) + \"Mi\"\n\n\t} else {\n\n\t\treturn nil, \"\", errors.New(\"invalid resource specs received from repository\")\n\n\t}\n\n\treturn insightObj, approvalSetting, nil\n\n}", "title": "" }, { "docid": "06879efcb2daaf8c3015d117557202cf", "score": "0.45555356", "text": "func getAvailableCpusetList(cpusetReq string) (string, error) {\n\n\tcpusetGuest, err := getCpusetGuest()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcpusetListReq, err := parsers.ParseUintList(cpusetReq)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tcpusetGuestList, err := parsers.ParseUintList(cpusetGuest)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tfor k := range cpusetListReq {\n\t\tif !cpusetGuestList[k] {\n\t\t\tagentLog.WithFields(logrus.Fields{\n\t\t\t\t\"cpuset\": cpusetReq,\n\t\t\t\t\"cpu\": k,\n\t\t\t\t\"guest-cpus\": cpusetGuest,\n\t\t\t}).Warnf(\"cpu is not in guest cpu list, using guest cpus\")\n\t\t\treturn cpusetGuest, nil\n\t\t}\n\t}\n\n\t// All the cpus are valid keep the same cpuset string\n\tagentLog.WithFields(logrus.Fields{\n\t\t\"cpuset\": cpusetReq,\n\t}).Debugf(\"the requested cpuset is valid, using it\")\n\treturn cpusetReq, nil\n}", "title": "" }, { "docid": "b53d2192a6638ad9f50ea8e6ee4ca603", "score": "0.45516247", "text": "func minValuePerVm(req recommender.SingleClusterRecommendationReq, attr string) float64 {\n\tswitch attr {\n\tcase recommender.Cpu:\n\t\treturn req.SumCpu / float64(req.MaxNodes)\n\tcase recommender.Memory:\n\t\treturn req.SumMem / float64(req.MaxNodes)\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "64f4d7181574fd501205ba87e0258790", "score": "0.45476127", "text": "func parseSizeInBytes(sizeStr string) uint {\n\tsizeStr = strings.TrimSpace(sizeStr)\n\tlastChar := len(sizeStr) - 1\n\tmultiplier := uint(1)\n\n\tif lastChar > 0 {\n\t\tif sizeStr[lastChar] == 'b' || sizeStr[lastChar] == 'B' {\n\t\t\tif lastChar > 1 {\n\t\t\t\tswitch unicode.ToLower(rune(sizeStr[lastChar-1])) {\n\t\t\t\tcase 'k':\n\t\t\t\t\tmultiplier = 1 << 10\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tcase 'm':\n\t\t\t\t\tmultiplier = 1 << 20\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tcase 'g':\n\t\t\t\t\tmultiplier = 1 << 30\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tdefault:\n\t\t\t\t\tmultiplier = 1\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsize := cast.ToInt(sizeStr)\n\tif size < 0 {\n\t\tsize = 0\n\t}\n\n\treturn safeMul(uint(size), multiplier)\n}", "title": "" }, { "docid": "c141f09f6cdc4f3435eaa19bdcc99310", "score": "0.45467797", "text": "func getCPUParams(log logging.Logger, bdevLists [][]string, coresPerNuma int) ([]int, []int, error) {\n\tif coresPerNuma < 1 {\n\t\treturn nil, nil, errors.Errorf(errInvalNumCores, coresPerNuma)\n\t}\n\n\tioNumTgts := make([]int, len(bdevLists))\n\tioNumHlprs := make([]int, len(bdevLists))\n\tfor idx, bdevList := range bdevLists {\n\t\tnTgts, nHlprs, err := checkCPUs(log, len(bdevList), coresPerNuma)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tioNumTgts[idx] = nTgts\n\t\tioNumHlprs[idx] = nHlprs\n\t}\n\n\treturn ioNumTgts, ioNumHlprs, nil\n}", "title": "" }, { "docid": "36264eb0b42f759d200896f8d5ddb8af", "score": "0.45448628", "text": "func scale(size int32) (req *containerpb.SetNodePoolSizeRequest) {\n\treq = &containerpb.SetNodePoolSizeRequest{\n\t\tNodeCount: size,\n\t\tName: fmt.Sprintf(\"projects/%s/locations/%s/clusters/%s/nodePools/%s\", project, location, clusterName, nodePoolName),\n\t}\n\n\treturn req\n}", "title": "" }, { "docid": "e5fb7405392de4cfba20e157af936d72", "score": "0.45433003", "text": "func computeSize(kv proto.RawKeyValue) int64 {\n\treturn computeKeyValueSize(kv) + llrbNodeSize + keyValueSize\n}", "title": "" }, { "docid": "ae78fe6b46628c056a6678d7a935f793", "score": "0.4542662", "text": "func (req *ClusterRecommendationReq) minValuePerVm(attr string) float64 {\n\tswitch attr {\n\tcase Cpu:\n\t\treturn req.SumCpu / float64(req.MaxNodes)\n\tcase Memory:\n\t\treturn req.SumMem / float64(req.MaxNodes)\n\tdefault:\n\t\tlog.Errorf(\"unsupported attribute: [%s]\", attr)\n\t\treturn 0\n\t}\n}", "title": "" }, { "docid": "a38eea05f1b464092757e2741f886241", "score": "0.45411992", "text": "func widthForRequest(r *http.Request) (int, error) {\n\tvar width uint64\n\tvar err error\n\tif r.FormValue(\"width\") != \"\" {\n\t\twidth, err = strconv.ParseUint(r.FormValue(\"width\"), 10, 32)\n\t\tif err != nil {\n\t\t\treturn 0, fmt.Errorf(\"Invalid width!\")\n\t\t}\n\n\t\tif width > ImageMaxWidth {\n\t\t\treturn 0, fmt.Errorf(\"Invalid width! Limit is %d\", ImageMaxWidth)\n\t\t}\n\t}\n\n\treturn int(width), nil\n}", "title": "" }, { "docid": "9d679d2d0a18b80f89b1863b28be1cd6", "score": "0.4539824", "text": "func (m *metricContainerCPUUsageUsermode) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" }, { "docid": "2634036b960f8ad8576dcbed51471d66", "score": "0.45372105", "text": "func computeShards(currentShardCount int, timeSeries float64) int {\n\tdesiredShardCount := int(math.Ceil(timeSeries / shardStep))\n\n\t// Compute Scale Down\n\tif currentShardCount > desiredShardCount {\n\t\t// We get the rest of a division of timeSeries by shardStep and we compare it with the scale down threshold\n\t\tif math.Mod(timeSeries, shardStep) > shardStep-shardScaleDownThreshold {\n\t\t\tdesiredShardCount = currentShardCount\n\t\t}\n\t}\n\n\t// We always have a minimum of 1 agent, even if there is no worker node\n\tif desiredShardCount <= 0 {\n\t\treturn 1\n\t}\n\treturn desiredShardCount\n}", "title": "" }, { "docid": "4453ad8c4bad48b6e1a2f8911aaa1a85", "score": "0.45324197", "text": "func (*GetClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_mdb_mysql_v1alpha_cluster_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a9080cc3c7937d32c01cb5f65e95a79e", "score": "0.45319444", "text": "func (d *ACSDriver) GetClusterSize(ctx context.Context, info *types.ClusterInfo) (*types.NodeCount, error) {\n\tcount := &types.NodeCount{}\n\treturn count, nil\n}", "title": "" }, { "docid": "dff2d65a5be8bf69454a5807015c9bc0", "score": "0.45293593", "text": "func (miner *XmrStak) getCPUThreadcount() uint16 {\n\tconfigPath := filepath.Join(miner.Base.executablePath, \"cpu.txt\")\n\tconfigFileBytes, err := ioutil.ReadFile(configPath)\n\t// If config file doesn't exist, return 0 as the threadcount\n\tif err != nil {\n\t\treturn 0\n\t}\n\t// xmr-stak uses a strange JSON-like format, I haven't found a Go library\n\t// that can parse the file, so we're doing some basic string matches\n\tlines := strings.Split(string(configFileBytes), \"\\n\")\n\tvar validLines string\n\tfor _, line := range lines {\n\t\tfor _, char := range line {\n\t\t\t// This is a very very very basic check if this line is actually a comment\n\t\t\tif string(char) == \"/\" || string(char) == \"*\" {\n\t\t\t\t// Skip this line\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tvalidLines += string(char)\n\t\t\t}\n\t\t}\n\t}\n\n\tvar threadcount uint16\n\t// Match anything enclosed in {} for JSON object\n\tvar re = regexp.MustCompile(`{*}`)\n\tfor _ = range re.FindAllString(validLines, -1) {\n\t\tthreadcount++\n\t}\n\treturn threadcount\n}", "title": "" }, { "docid": "6a51093e5533e4de06d9c5b37e32d967", "score": "0.45268577", "text": "func parseSizeInBytes(sizeStr string) uint {\n\tsizeStr = strings.TrimSpace(sizeStr)\n\tlastChar := len(sizeStr) - 1\n\tmultiplier := uint(1)\n\n\tif lastChar > 0 {\n\t\tif sizeStr[lastChar] == 'b' || sizeStr[lastChar] == 'B' {\n\t\t\tif lastChar > 1 {\n\t\t\t\tswitch unicode.ToLower(rune(sizeStr[lastChar-1])) {\n\t\t\t\tcase 'k':\n\t\t\t\t\tmultiplier = 1 << 10\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tcase 'm':\n\t\t\t\t\tmultiplier = 1 << 20\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tcase 'g':\n\t\t\t\t\tmultiplier = 1 << 30\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar-1])\n\t\t\t\tdefault:\n\t\t\t\t\tmultiplier = 1\n\t\t\t\t\tsizeStr = strings.TrimSpace(sizeStr[:lastChar])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsize, _ := conv.ToInt(sizeStr)\n\tif size < 0 {\n\t\tsize = 0\n\t}\n\n\treturn safeMul(uint(size), multiplier)\n}", "title": "" }, { "docid": "01677d5e021a95c7b363722e21bbce90", "score": "0.45258632", "text": "func diskQuotaRequest(podVolumes *diskquota.PodVolumes) metricValues {\n\tvar metrics []metricValue\n\tfor vType, volumes := range podVolumes.Volumes {\n\t\tfor name, path := range volumes.Paths {\n\t\t\tif path != nil && path.Size != nil {\n\t\t\t\tsize := path.Size\n\t\t\t\tmode := \"exclusive\"\n\t\t\t\tif path.SharedInfo != nil {\n\t\t\t\t\tmode = \"shared\"\n\t\t\t\t}\n\t\t\t\tif size.Quota != 0 {\n\t\t\t\t\tmetrics = append(metrics, metricValue{\n\t\t\t\t\t\tvalue: bytesToGi(float64(size.Quota)),\n\t\t\t\t\t\ttimestamp: time.Now(),\n\t\t\t\t\t\tlabels: []string{vType.String(), name, \"quota\", mode},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\t// support inodes metric\n\t\t\t\tif size.Inodes != 0 {\n\t\t\t\t\tmetrics = append(metrics, metricValue{\n\t\t\t\t\t\tvalue: float64(size.Inodes),\n\t\t\t\t\t\ttimestamp: time.Now(),\n\t\t\t\t\t\tlabels: []string{vType.String(), name, \"inodes\", mode},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn metrics\n}", "title": "" }, { "docid": "76f9b56ddcc6fbd229135fcd3b522834", "score": "0.4525813", "text": "func parseLscpu(lscpuOut string) (int, error) {\n\n\tnumCPUline := strings.SplitAfter(lscpuOut, \"CPU(s):\")\n\tcpus, err := strconv.ParseInt(strings.Trim(numCPUline[1], \" \\n\"), 10, 64)\n\tif err != nil {\n\t\treturn -1, err\n\t}\n\treturn int(cpus), nil\n}", "title": "" }, { "docid": "1b5599ce0806396c1ec75899c94f7d67", "score": "0.4523667", "text": "func (c *cluster) size() int {\n\treturn len(c.members)\n}", "title": "" }, { "docid": "f0ecdc6779a89fcde88d0b9c41c94aa6", "score": "0.45191354", "text": "func (m *metricSaphanaServiceThreadCount) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" }, { "docid": "0ba3838a0b7083d67dd9093647aa7d72", "score": "0.45176634", "text": "func computeVMsCapacity(limits types.Limit, mapVMProfiles *map[string]types.VmProfile) {\n\tfor _,v := range *mapVMProfiles {\n\t\tcap := maxPodsCapacityInVM(v,limits)\n\t\tprofile := (*mapVMProfiles)[v.Type]\n\t\tprofile.ReplicasCapacity = cap\n\t\t(*mapVMProfiles)[v.Type] = profile\n\t}\n}", "title": "" }, { "docid": "72c570e998922c6acc47af13f50754e8", "score": "0.45164895", "text": "func getDiskUsageInBytes(\n\tctx context.Context, c *cluster, logger *logger, nodeIdx int,\n) (int, error) {\n\tvar out []byte\n\tfor {\n\t\tif c.t.Failed() {\n\t\t\treturn 0, errors.New(\"already failed\")\n\t\t}\n\t\tvar err error\n\t\t// `du` can warn if files get removed out from under it (which\n\t\t// happens during RocksDB compactions, for example). Discard its\n\t\t// stderr to avoid breaking Atoi later.\n\t\t// TODO(bdarnell): Refactor this stack to not combine stdout and\n\t\t// stderr so we don't need to do this (and the Warning check\n\t\t// below).\n\t\tout, err = c.RunWithBuffer(\n\t\t\tctx,\n\t\t\tlogger,\n\t\t\tc.Node(nodeIdx),\n\t\t\t\"du -sk {store-dir} 2>/dev/null | grep -oE '^[0-9]+'\",\n\t\t)\n\t\tif err != nil {\n\t\t\tif ctx.Err() != nil {\n\t\t\t\treturn 0, ctx.Err()\n\t\t\t}\n\t\t\t// If `du` fails, retry.\n\t\t\t// TODO(bdarnell): is this worth doing? It was originally added\n\t\t\t// because of the \"files removed out from under it\" problem, but\n\t\t\t// that doesn't result in a command failure, just a stderr\n\t\t\t// message.\n\t\t\tlogger.Printf(\"retrying disk usage computation after spurious error: %s\", err)\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\n\tstr := string(out)\n\t// We need this check because sometimes the first line of the roachprod output is a warning\n\t// about adding an ip to a list of known hosts.\n\tif strings.Contains(str, \"Warning\") {\n\t\tstr = strings.Split(str, \"\\n\")[1]\n\t}\n\n\tsize, err := strconv.Atoi(strings.TrimSpace(str))\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn size * 1024, nil\n}", "title": "" }, { "docid": "2f4a67e14b54c19a4c1576e818d8b5d4", "score": "0.45153952", "text": "func (e *Engine) RecommendNodePools(attr string, vms []VirtualMachine, values []float64, req ClusterRecommendationReq) ([]NodePool, error) {\n\n\tvar nps []NodePool\n\n\t// find cheapest onDemand instance from the list - based on price per attribute\n\tselectedOnDemand := vms[0]\n\tfor _, vm := range vms {\n\t\tif vm.OnDemandPrice/vm.getAttrValue(attr) < selectedOnDemand.OnDemandPrice/selectedOnDemand.getAttrValue(attr) {\n\t\t\tselectedOnDemand = vm\n\t\t}\n\t}\n\n\tlog.Debugf(\"requested sum for attribute [%s]: [%f]\", attr, req.sum(attr))\n\n\tvar sumOnDemandValue = req.sum(attr) * float64(req.OnDemandPct) / 100\n\tvar sumSpotValue = req.sum(attr) - sumOnDemandValue\n\n\tlog.Debugf(\"on demand sum value for attr [%s]: [%f]\", attr, sumOnDemandValue)\n\tlog.Debugf(\"spot sum value for attr [%s]: [%f]\", attr, sumSpotValue)\n\n\t// create and append on-demand pool\n\tonDemandPool := NodePool{\n\t\tSumNodes: int(math.Ceil(sumOnDemandValue / selectedOnDemand.getAttrValue(attr))),\n\t\tVmClass: regular,\n\t\tVmType: selectedOnDemand,\n\t}\n\n\tnps = append(nps, onDemandPool)\n\n\t// if spot price pools requested\n\tif req.OnDemandPct < 100 {\n\t\t// retain only the nodes that are available as spot instances\n\t\tvms = e.filterSpots(vms)\n\t\tif len(vms) == 0 {\n\t\t\treturn nil, errors.New(\"no vms suitable for spot pools\")\n\t\t}\n\t}\n\n\t// vms are sorted by attribute value\n\te.sortByAttrValue(attr, vms)\n\n\t// the \"magic\" number of machines for diversifying the types\n\tN := int(math.Min(float64(findN(avgNodeCount(values, req.sum(attr)))), float64(len(vms))))\n\n\t// the second \"magic\" number for diversifying the layout\n\tM := int(math.Min(math.Ceil(float64(N)*1.5), float64(len(vms))))\n\n\tlog.Debugf(\"Magic 'Marton' numbers: N=%d, M=%d\", N, M)\n\n\t// the first M vm-s\n\trecommendedVms := vms[:M]\n\n\t// create spot nodepools - one for the first M vm-s\n\tfor _, vm := range recommendedVms {\n\t\tnps = append(nps, NodePool{\n\t\t\tSumNodes: 0,\n\t\t\tVmClass: spot,\n\t\t\tVmType: vm,\n\t\t})\n\t}\n\tlog.Debugf(\"totally created [%d] regular and spot price node pools\", len(nps))\n\n\t// fill up instances in spot pools\n\ti := 0\n\tvar sumValueInPools float64\n\tfor sumValueInPools < sumSpotValue {\n\t\tnodePoolIdx := i%N + 1\n\t\tif nodePoolIdx == 1 {\n\t\t\t// always add a new instance to the cheapest option and move on\n\t\t\tnps[nodePoolIdx].SumNodes += 1\n\t\t\tsumValueInPools += nps[nodePoolIdx].VmType.getAttrValue(attr)\n\t\t\tlog.Debugf(\"adding vm to the [%d]th node pool sum value in pools: [%f]\", nodePoolIdx, sumValueInPools)\n\t\t\ti++\n\t\t} else if nps[nodePoolIdx].getNextSum(attr) > nps[1].getSum(attr) {\n\t\t\t// for other pools, if adding another vm would exceed the current sum of the cheapest option, move on to the next one\n\t\t\tlog.Debugf(\"skip adding vm to the [%d]th node pool - (price would exceed the sum)\", nodePoolIdx)\n\t\t\ti++\n\t\t} else {\n\t\t\t// otherwise add a new one, but do not move on to the next one\n\t\t\tnps[nodePoolIdx].SumNodes += 1\n\t\t\tsumValueInPools += nps[nodePoolIdx].VmType.getAttrValue(attr)\n\t\t\tlog.Debugf(\"adding vm to the [%d]th node pool sum value in pools: [%f]\", nodePoolIdx, sumValueInPools)\n\t\t}\n\t}\n\n\treturn nps, nil\n}", "title": "" }, { "docid": "6b4eb67e86e73df5fc8c1155e6d88149", "score": "0.45089614", "text": "func (s *System) GetCPUUsage() {}", "title": "" }, { "docid": "480d2b64052e4c2970c604e3080a3128", "score": "0.45089373", "text": "func (si *SampleInformation) calcSize(trun *Trun) int {\n\tsum := 0\n\tif trun.sampleDurationPresent != 0 {\n\t\tsum += 4\n\t}\n\tif trun.sampleSizePresent != 0 {\n\t\tsum += 4\n\t}\n\tif trun.sampleFlagsPresent != 0 {\n\t\tsum += 4\n\t}\n\tif trun.sampleOffsetPresent != 0 {\n\t\tsum += 4\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "d605a90ac17f93345b1009e011defecc", "score": "0.45070297", "text": "func (m *Mfhd) calcSize() int {\n\treturn BYTESINSIZE + BYTESINBOXTYPE + BYTESINVERSION + BYTESINFLAGS + BYTESINSEQ\n}", "title": "" }, { "docid": "c63ce1b5b5f245b32680e4cc5016d0a5", "score": "0.45050758", "text": "func calcSize(in uint8) float64 {\n\treturn float64(in) / 255 * shapeSize * 0.5\n}", "title": "" }, { "docid": "582e79238a663e942bf16b70e938f1f7", "score": "0.45038554", "text": "func (m *metricContainerCPUUsageSystem) updateCapacity() {\n\tif m.data.Sum().DataPoints().Len() > m.capacity {\n\t\tm.capacity = m.data.Sum().DataPoints().Len()\n\t}\n}", "title": "" } ]
720b8979c3f8bda1424bf83a8970ede4
Dump writes the contents of key to sb and returns true if the value for next header in the key is nonzero.
[ { "docid": "7f57b1b85d3a0a29df6d96f5b1662f8f", "score": "0.58844197", "text": "func (k *CtKey6) Dump(sb *strings.Builder, reverse bool) bool {\n\tvar addrDest string\n\n\tif k.NextHeader == 0 {\n\t\treturn false\n\t}\n\n\t// Addresses swapped, see issue #5848\n\tif reverse {\n\t\taddrDest = k.SourceAddr.String()\n\t} else {\n\t\taddrDest = k.DestAddr.String()\n\t}\n\n\tif k.Flags&TUPLE_F_IN != 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%s IN %s %d:%d \",\n\t\t\tk.NextHeader.String(), addrDest, k.SourcePort,\n\t\t\tk.DestPort),\n\t\t)\n\t} else {\n\t\tsb.WriteString(fmt.Sprintf(\"%s OUT %s %d:%d \",\n\t\t\tk.NextHeader.String(), addrDest, k.DestPort,\n\t\t\tk.SourcePort),\n\t\t)\n\t}\n\n\tif k.Flags&TUPLE_F_RELATED != 0 {\n\t\tsb.WriteString(\"related \")\n\t}\n\n\tif k.Flags&TUPLE_F_SERVICE != 0 {\n\t\tsb.WriteString(\"service \")\n\t}\n\n\treturn true\n}", "title": "" } ]
[ { "docid": "0e5dc9e7e64b44b94e79284441aa4df3", "score": "0.6285514", "text": "func (k *CtKey4) Dump(sb *strings.Builder, reverse bool) bool {\n\tvar addrDest string\n\n\tif k.NextHeader == 0 {\n\t\treturn false\n\t}\n\n\t// Addresses swapped, see issue #5848\n\tif reverse {\n\t\taddrDest = k.SourceAddr.String()\n\t} else {\n\t\taddrDest = k.DestAddr.String()\n\t}\n\n\tif k.Flags&TUPLE_F_IN != 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%s IN %s %d:%d \",\n\t\t\tk.NextHeader.String(), addrDest, k.SourcePort,\n\t\t\tk.DestPort),\n\t\t)\n\t} else {\n\t\tsb.WriteString(fmt.Sprintf(\"%s OUT %s %d:%d \",\n\t\t\tk.NextHeader.String(), addrDest, k.DestPort,\n\t\t\tk.SourcePort),\n\t\t)\n\t}\n\n\tif k.Flags&TUPLE_F_RELATED != 0 {\n\t\tsb.WriteString(\"related \")\n\t}\n\n\tif k.Flags&TUPLE_F_SERVICE != 0 {\n\t\tsb.WriteString(\"service \")\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "19959752fa7c6cafbcebe95646f92117", "score": "0.57332164", "text": "func (k *CtKey4Global) Dump(sb *strings.Builder, reverse bool) bool {\n\tvar addrSource, addrDest string\n\n\tif k.NextHeader == 0 {\n\t\treturn false\n\t}\n\n\t// Addresses swapped, see issue #5848\n\tif reverse {\n\t\taddrSource = k.DestAddr.String()\n\t\taddrDest = k.SourceAddr.String()\n\t} else {\n\t\taddrSource = k.SourceAddr.String()\n\t\taddrDest = k.DestAddr.String()\n\t}\n\n\tif k.Flags&TUPLE_F_IN != 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%s IN %s:%d -> %s:%d \",\n\t\t\tk.NextHeader.String(), addrSource, k.SourcePort,\n\t\t\taddrDest, k.DestPort),\n\t\t)\n\t} else {\n\t\tsb.WriteString(fmt.Sprintf(\"%s OUT %s:%d -> %s:%d \",\n\t\t\tk.NextHeader.String(), addrSource, k.SourcePort,\n\t\t\taddrDest, k.DestPort),\n\t\t)\n\t}\n\n\tif k.Flags&TUPLE_F_RELATED != 0 {\n\t\tsb.WriteString(\"related \")\n\t}\n\n\tif k.Flags&TUPLE_F_SERVICE != 0 {\n\t\tsb.WriteString(\"service \")\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "a4555b6bab78f49aa775d3e5ef1a54b8", "score": "0.5569214", "text": "func (chunkedPutContext *chunkedPutContextStruct) DumpKey(key sortedmap.Key) (keyAsString string, err error) {\n\tvar (\n\t\tkeyAsU64 uint64\n\t\tok bool\n\t)\n\n\tkeyAsU64, ok = key.(uint64)\n\tif ok {\n\t\tkeyAsString = fmt.Sprintf(\"0x%016X\", keyAsU64)\n\t} else {\n\t\terr = fmt.Errorf(\"Failure of *chunkedPutContextStruct.DumpKey(%v)\", key)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e2ca6575f675c465ec37a889a9c2e7dc", "score": "0.53869104", "text": "func (s *segmentKeysIndex) add(keyIdx int, key []byte) bool {\n\tif s.numKeys >= s.numIndexableKeys {\n\t\t// All keys that can be indexed already have been,\n\t\t// return false indicating that there's no room for\n\t\t// anymore.\n\t\treturn false\n\t}\n\n\tif len(key) > (len(s.data) - s.numKeyBytes) {\n\t\t// No room for any more keys.\n\t\treturn false\n\t}\n\n\tif keyIdx%(s.hop) != 0 {\n\t\t// Key does not satisfy the hop condition.\n\t\treturn true\n\t}\n\n\ts.offsets[s.numKeys] = uint32(s.numKeyBytes)\n\tcopy(s.data[s.numKeyBytes:], key)\n\ts.numKeys++\n\ts.numKeyBytes += len(key)\n\n\treturn true\n}", "title": "" }, { "docid": "656062b50f79d020ce4d9b0f4b5342f1", "score": "0.5365119", "text": "func (k *CtKey6Global) Dump(sb *strings.Builder, reverse bool) bool {\n\tvar addrSource, addrDest string\n\n\tif k.NextHeader == 0 {\n\t\treturn false\n\t}\n\n\t// Addresses swapped, see issue #5848\n\tif reverse {\n\t\taddrSource = k.DestAddr.String()\n\t\taddrDest = k.SourceAddr.String()\n\t} else {\n\t\taddrSource = k.SourceAddr.String()\n\t\taddrDest = k.DestAddr.String()\n\t}\n\n\tif k.Flags&TUPLE_F_IN != 0 {\n\t\tsb.WriteString(fmt.Sprintf(\"%s IN %s:%d -> %s:%d \",\n\t\t\tk.NextHeader.String(), addrSource, k.SourcePort,\n\t\t\taddrDest, k.DestPort),\n\t\t)\n\t} else {\n\t\tsb.WriteString(fmt.Sprintf(\"%s OUT %s:%d -> %s:%d \",\n\t\t\tk.NextHeader.String(), addrSource, k.SourcePort,\n\t\t\taddrDest, k.DestPort),\n\t\t)\n\t}\n\n\tif k.Flags&TUPLE_F_RELATED != 0 {\n\t\tsb.WriteString(\"related \")\n\t}\n\n\tif k.Flags&TUPLE_F_SERVICE != 0 {\n\t\tsb.WriteString(\"service \")\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "9da60c54b242d15c7c07b7bd110b3ae8", "score": "0.53520143", "text": "func (mp *mirmap) haskey(k voidptr) bool {\n\tocap := mp.cap_\n\toptr := mp.ptr\n\n\tfnptr := mp.keyalg.hash\n\thash := fnptr(k, mp.keysz)\n\tidx := hash % usize(ocap)\n\n\tvar onode *mapnode = optr[idx]\n\tfor onode != nil {\n\t\tif onode.hash == hash {\n\t\t\treturn true\n\t\t}\n\t\tonode = onode.next\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "02702eef1d15736cef9e36a04b5d23a1", "score": "0.53068954", "text": "func (fileInode *fileInodeStruct) DumpKey(key sortedmap.Key) (keyAsString string, err error) {\n\tvar (\n\t\tkeyAsU64 uint64\n\t\tok bool\n\t)\n\n\tkeyAsU64, ok = key.(uint64)\n\tif ok {\n\t\tkeyAsString = fmt.Sprintf(\"0x%016X\", keyAsU64)\n\t} else {\n\t\terr = fmt.Errorf(\"Failure of *fileInodeStruct.DumpKey(%v)\", key)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "99a905b3754321f9b764869bd484a8ca", "score": "0.5266666", "text": "func (enc *Encoder) BoolKey(key string, value bool) {\n\tif enc.hasKeys {\n\t\tif !enc.keyExists(key) {\n\t\t\treturn\n\t\t}\n\t}\n\tenc.grow(5 + len(key))\n\tr := enc.getPreviousRune()\n\tif r != '{' {\n\t\tenc.writeByte(',')\n\t}\n\tenc.writeByte('\"')\n\tenc.writeStringEscape(key)\n\tenc.writeBytes(objKey)\n\tenc.buf = strconv.AppendBool(enc.buf, value)\n}", "title": "" }, { "docid": "ded7671bc2b600680e9580c5edf6ab58", "score": "0.52208114", "text": "func (w *GeneralMetaRangeWriter) shouldBreakAtKey(key graveler.Key) bool {\n\tapproximateSize := w.rangeWriter.GetApproximateSize()\n\tif approximateSize < w.params.MinRangeSizeBytes {\n\t\treturn false\n\t}\n\tif approximateSize >= w.params.MaxRangeSizeBytes {\n\t\treturn true\n\t}\n\n\th := fnv.New64a()\n\t// FNV always reads all bytes and never fails; ignore its return values\n\t_, _ = h.Write(key)\n\tr := h.Sum64() % uint64(w.params.RangeSizeEntriesRaggedness)\n\treturn r == 0\n}", "title": "" }, { "docid": "18ca98e692df9c5c7943011a5e52fc16", "score": "0.51820284", "text": "func (c *CentralCacheTestImpl) Dump(key string, value []byte) error {\n\treturn nil\n}", "title": "" }, { "docid": "127b844c27753922cabcc4c17bdde785", "score": "0.5133338", "text": "func (OnfTest1_Cont1A_List4_List4A_Key) IsYANGGoKeyStruct() {}", "title": "" }, { "docid": "5b64c57c4376509e9e782f4875f9e16b", "score": "0.5108464", "text": "func (r *Range) containsKey(key Key) bool {\n\treturn bytes.Compare(r.Meta.StartKey, key) <= 0 &&\n\t\tbytes.Compare(r.Meta.EndKey, key) > 0\n}", "title": "" }, { "docid": "990b8b2bb5704b49131505cf291f75b3", "score": "0.50903946", "text": "func (store KeyValue) Dump() {\n\t// TODO: Dump out debugging information here\n\ttexts := store.database.Stats()\n\tfor key, value := range texts {\n\t\tlog.Debug(\"Stat\", key, value)\n\t}\n\n\titer := store.database.Iterator(nil, nil)\n\tfor ; iter.Valid(); iter.Next() {\n\t\thash := iter.Key()\n\t\tnode := iter.Value()\n\t\tlog.Debug(\"Row\", hash, node)\n\t}\n}", "title": "" }, { "docid": "bdecffff789b74c6687d72b59a321e1f", "score": "0.5073643", "text": "func (o *Options) DumpHeader() bool { return o.dumpHeader }", "title": "" }, { "docid": "b7d863cc1c2b18f7672d2eb9c4bcbf9f", "score": "0.50713265", "text": "func (OnfTest1_Cont1A_List5_Key) IsYANGGoKeyStruct() {}", "title": "" }, { "docid": "5f7905b6f0e3f4775d38d3ab0ccd95e5", "score": "0.5060103", "text": "func (e HeaderMatchValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c2bafbcbd73fb99fadea5a463d578caa", "score": "0.5032228", "text": "func (e StatsSinkValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "80787ba2297c9e543802eb6178a661f3", "score": "0.5012408", "text": "func (e BitStringValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "ae2e0f3667e333539e245093457c8fa1", "score": "0.50019974", "text": "func (e StatsdSinkValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "817e363cdec122bb4956d6e5b7df0ae4", "score": "0.4981381", "text": "func (e StreamValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "6a6e83d6c9dfc1606ad5b34808d627ce", "score": "0.4969222", "text": "func (e JwtHeaderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "b65e20ebbce0fefdae8371cbd07195e1", "score": "0.49634457", "text": "func (e DogStatsdSinkValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "2c4d4f7247f6e6e68e935423b98f7fbb", "score": "0.49463233", "text": "func (session KeyValueSession) Dump() {\n\ttexts := session.store.database.Stats()\n\tfor key, value := range texts {\n\t\tlog.Debug(\"Stat\", key, value)\n\t}\n\n\titer := session.store.database.Iterator(nil, nil)\n\tfor ; iter.Valid(); iter.Next() {\n\t\thash := iter.Key()\n\t\tnode := iter.Value()\n\t\tlog.Debug(\"Row\", hash, node)\n\t}\n}", "title": "" }, { "docid": "3515a045402208447821e569a50b6465", "score": "0.49358425", "text": "func (e HeaderMutationValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c370d8112ec9afd9de76a87fd120e49e", "score": "0.49274644", "text": "func (batch *BatchDecoder) HasNext() bool {\n\treturn len(batch.keyBytes) > 0 && len(batch.valueBytes) > 0\n}", "title": "" }, { "docid": "d546292ed86f64773b930ab554451b76", "score": "0.4901542", "text": "func (k *Key) IsIncomplete() bool {\n\treturn k.LastTok().IsIncomplete()\n}", "title": "" }, { "docid": "f82b3a0a8af754336cfad5e2a03b178a", "score": "0.4901316", "text": "func (tx *transaction) hasKey(key []byte) bool {\n\t// When the transaction is writable, check the pending transaction\n\t// state first.\n\tif tx.writable {\n\t\tif tx.pendingRemove.Has(key) {\n\t\t\treturn false\n\t\t}\n\t\tif tx.pendingKeys.Has(key) {\n\t\t\treturn true\n\t\t}\n\t}\n\n\t// Consult the database cache and underlying database.\n\treturn tx.snapshot.Has(key)\n}", "title": "" }, { "docid": "c6d9b39228adf8ee4b1603921275d5e9", "score": "0.48884308", "text": "func (ss *SuffixSnapshot) isTSOfKey(key string, groupKey string) (typeutil.Timestamp, bool) {\n\t// not in snapshot path\n\tif !strings.HasPrefix(key, ss.snapshotPrefix) {\n\t\treturn 0, false\n\t}\n\tkey = key[ss.snapshotLen:]\n\n\tmatches := ss.exp.FindStringSubmatch(key)\n\tif len(matches) < 3 {\n\t\treturn 0, false\n\t}\n\tif matches[1] != groupKey {\n\t\treturn 0, false\n\t}\n\t// err ignores since it's protected by the regexp\n\tts, _ := strconv.ParseUint(matches[2], 10, 64)\n\treturn ts, true\n}", "title": "" }, { "docid": "7eb9f831a59487bc5353e9be5d4089aa", "score": "0.4887788", "text": "func (r *Reader) ScanKey() bool {\n\treturn r.scan(false)\n}", "title": "" }, { "docid": "5c5b03cb63007009af0f6d8f11265057", "score": "0.48827106", "text": "func (s *Store) HasKey(key []byte) bool {\n\tb := s.recByKey(key, maxTX)\n\treturn b != nil\n}", "title": "" }, { "docid": "fefbb1f432f4d5b5b02e5527b1dc475a", "score": "0.48791972", "text": "func (iter *FlatIterator) Next() bool {\n\tif len(iter.db.buff) == 0 && !iter.eof {\n\t\tif err := iter.db.readChunk(); err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\titer.eof = true\n\t\t\t\treturn false\n\t\t\t} else {\n\t\t\t\titer.err = err\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\tvar offset int\n\tx, n := binary.Uvarint(iter.db.buff)\n\toffset += n\n\tif n <= 0 {\n\t\treturn false\n\t}\n\tkey := iter.db.buff[offset : offset+int(x)]\n\toffset += int(x)\n\tx, n = binary.Uvarint(iter.db.buff[offset:])\n\toffset += n\n\tif n <= 0 {\n\t\treturn false\n\t}\n\tval := iter.db.buff[offset : offset+int(x)]\n\toffset += int(x)\n\n\titer.key = key\n\titer.val = val\n\titer.db.buff = iter.db.buff[offset:]\n\treturn true\n}", "title": "" }, { "docid": "b2bdd17fa19384e8b66564ac5e31d7cb", "score": "0.48518652", "text": "func (node *Node) keyExists(key int) bool {\n\t_, keyExists := node.hashTable[key]\n\treturn keyExists\n}", "title": "" }, { "docid": "53190e6df3c4b4f49943bb3c1e8b9295", "score": "0.4838339", "text": "func (e NetworkPoliciesConfigDumpValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "03f09b718ff90e0ae6913472b84ad4d3", "score": "0.48376566", "text": "func (ss *SuffixSnapshot) isTSKey(key string) (typeutil.Timestamp, bool) {\n\t// not in snapshot path\n\tif !strings.HasPrefix(key, ss.snapshotPrefix) {\n\t\treturn 0, false\n\t}\n\tkey = key[ss.snapshotLen:]\n\tmatches := ss.exp.FindStringSubmatch(key)\n\tif len(matches) < 3 {\n\t\treturn 0, false\n\t}\n\t// err ignores since it's protected by the regexp\n\tts, _ := strconv.ParseUint(matches[2], 10, 64)\n\treturn ts, true\n}", "title": "" }, { "docid": "29c258bdb34366cc542a134ca5b5f89e", "score": "0.4833662", "text": "func (e GetStreamResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "768e3b2ee43ca89578d8e4d506a27c6e", "score": "0.48103893", "text": "func (k KeyTok) IsIncomplete() bool {\n\treturn k.StringID == \"\" && k.IntID == 0\n}", "title": "" }, { "docid": "e32c7511e5fbfd7f15f65e30d64283ed", "score": "0.48081613", "text": "func (dst *Bravo) Load(key uint64) bool {\n\t_, mask := dst.search(key)\n\treturn mask == 0\n}", "title": "" }, { "docid": "bb12b556a6c4f2bab7d500936aa974b3", "score": "0.48048544", "text": "func (h *Header) Contains(key string) (value string, ok bool) {\n\tvar i int\n\tif i, ok = h.index(key); ok {\n\t\tvalue = h.slice[i+1]\n\t}\n\treturn\n}", "title": "" }, { "docid": "395f311a4fab11a1bfe926a9f04447c6", "score": "0.48022312", "text": "func (c *ImmuClient) Dump(ctx context.Context, writer io.WriteSeeker) (int64, error) {\n\tstart := time.Now()\n\n\tvar counter int64\n\n\tif !c.isConnected() {\n\t\treturn counter, ErrNotConnected\n\t}\n\n\tbkpClient, err := c.ServiceClient.Dump(ctx, &empty.Empty{})\n\tif err != nil {\n\t\treturn counter, err\n\t}\n\tdefer bkpClient.CloseSend()\n\n\tvar offset int64\n\tvar errs []string\n\tfor {\n\t\tkvList, err := bkpClient.Recv()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\terrs = append(errs, fmt.Sprintf(\"error receiving chunk: %v\", err))\n\t\t\tcontinue\n\t\t}\n\t\tfor _, kv := range kvList.Kv {\n\t\t\tkvBytes, err := proto.Marshal(kv)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, fmt.Sprintf(\"error marshaling key-value %+v: %v\", kv, err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\to, err := writeSeek(writer, kvBytes, offset)\n\t\t\tif err != nil {\n\t\t\t\terrs = append(errs, fmt.Sprintf(\"error writing as bytes key-value %+v: %v\", kv, err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\toffset = o\n\t\t\tcounter++\n\t\t}\n\t}\n\tvar errorsMerged error\n\tif len(errs) > 0 {\n\t\terrorsMerged = fmt.Errorf(\"Errors:\\n\\t%s\", strings.Join(errs[:], \"\\n\\t- \"))\n\t}\n\n\tc.Logger.Debugf(\"dump finished in %s\", time.Since(start))\n\n\treturn counter, errorsMerged\n}", "title": "" }, { "docid": "a9766061d40b9bbc5f04c3af5e163fd5", "score": "0.47909722", "text": "func isKeyInDB(tx *sql.Tx, key string) bool {\n\trow := getStmt(tx, \"isKeyInDB\").QueryRow(key)\n\tvar n int\n\t_ = row.Scan(&n)\n\treturn n == 1\n}", "title": "" }, { "docid": "005682c5687d05a9ee1cfa00611fba28", "score": "0.4773924", "text": "func (e GetStreamRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c09386c5abd5bc3a3e6f8ed5ab4f0720", "score": "0.47683665", "text": "func (e UpstreamValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c09386c5abd5bc3a3e6f8ed5ab4f0720", "score": "0.47683665", "text": "func (e UpstreamValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "a85d31618c660a6a1069004aa764f6e9", "score": "0.4765814", "text": "func match(r io.ReaderAt, buf []byte, key []byte, pos uint32) (bool, error) {\n\tklen := len(key)\n\tfor n := 0; n < klen; n += len(buf) {\n\t\tnleft := klen - n\n\t\tif len(buf) > nleft {\n\t\t\tbuf = buf[:nleft]\n\t\t}\n\t\tif _, err := r.ReadAt(buf, int64(pos)); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif !bytes.Equal(buf, key[n:n+len(buf)]) {\n\t\t\treturn false, nil\n\t\t}\n\t\tpos += uint32(len(buf))\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "870b9f7d6d197e20ece422efb831dfcd", "score": "0.4761989", "text": "func (o *Options) SetDumpHeader(v bool) { o.dumpHeader = v }", "title": "" }, { "docid": "8d9a6b590e8605d88b2fb06615746752", "score": "0.47612008", "text": "func (e UpdateShardCountResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "798ad9013373ccdfd9572c2228815165", "score": "0.47596502", "text": "func (o *Commitstatus) HasKey() bool {\n\tif o != nil && o.Key != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "b3a31a2eb8f060d2397d43a615078c18", "score": "0.47527015", "text": "func (e StreamResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "284faf85e95205d680c5dad4cb6b08c2", "score": "0.4746922", "text": "func (e HeadersResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "bf8918e7e254f629b129e27a1bf08650", "score": "0.47384107", "text": "func (e ScopedRoutes_ScopeKeyBuilder_FragmentBuilderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "26f1c36d3f848829e72a80e8d5841fb9", "score": "0.4720938", "text": "func (e HystrixSinkValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "f72174f414a60d8e1bbb4246daad648a", "score": "0.471798", "text": "func (b *bloom) Test(key []byte) bool {\n\th1 := murmur3.Sum32(key)\n\th2 := (h1 >> 17) | (h1 << 15)\n\tfor i := 0; i < bloomHashes; i++ {\n\t\tp := h1 % uint32(bloomBits)\n\t\tif b.bits[p/8]&(1<<(p%8)) == 0 {\n\t\t\treturn false\n\t\t}\n\t\th1 += h2\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "ca4431d0acaabc03065e0ffc2d23702b", "score": "0.47157907", "text": "func (e HttpHeadersValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "0698572d3cfca9ae394a76bbcc3bab11", "score": "0.47144973", "text": "func (e ScopedRoutes_ScopeKeyBuilder_FragmentBuilder_HeaderValueExtractorValidationError) Key() bool {\n\treturn e.key\n}", "title": "" }, { "docid": "155fd9cea0be90111a6941733bf14cfe", "score": "0.47071537", "text": "func (s *sizeTracker) has(key string) bool {\n\t_, has := s.keyToSize[key]\n\treturn has\n}", "title": "" }, { "docid": "af7e0b298a6111f136c89dc3ff143224", "score": "0.47069788", "text": "func (o *MicrosoftGraphWorkbookSortField) HasKey() bool {\n\tif o != nil && o.Key != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d12360b7246f7d32af958dd17b0e8403", "score": "0.4705571", "text": "func (e MetricsSinkValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "9a8198fb604c6093db00d5c6dc2f356a", "score": "0.46964762", "text": "func (view *CrosstabView) Next() bool {\n\tif view.err != nil {\n\t\treturn false\n\t}\n\tview.pos++\n\treturn view.pos < len(view.vkeys)\n}", "title": "" }, { "docid": "376bd008d7a6328dff32f4e74c1e6d5c", "score": "0.46932262", "text": "func (e JwtClaimToHeaderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "0705a72bad25fd17dfbd45fed674514c", "score": "0.46898264", "text": "func (e LoadStatsResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "e87ece99914d94b5f420ad1325ea0567", "score": "0.4681196", "text": "func (e SavePortsResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c5c07abc20fa792ce3ed2b5996696aca", "score": "0.46757257", "text": "func HasKey(key string) bool {\n\treturn sj.HasKey(key)\n}", "title": "" }, { "docid": "934de4268ed4b1089301b59ebba6c9b2", "score": "0.46705803", "text": "func (e UpdateShardCountRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "bb105167679ba627fb69dee196aecc04", "score": "0.46642184", "text": "func (it *BytesScanner) HasNext() bool {\n\treturn it.index < len(it.source) || it.emitEmptySlice\n}", "title": "" }, { "docid": "2ff76b2e45c3afeeb3f74fa8279dc005", "score": "0.46542615", "text": "func (e StreamRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "7d80f248f90b801338a45d3d9a5344b5", "score": "0.46288896", "text": "func (e HealthCheck_PayloadValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "0672cc8c8e3ab29d79d27de235419685", "score": "0.46277338", "text": "func (e SavePortResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "05cf11892136594e1bb9bb8dce9e39eb", "score": "0.46219218", "text": "func (e LoadStatsRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "990ff7942863cf6e28455c3239ff5c2e", "score": "0.46039712", "text": "func writeKey(b *strings.Builder, key map[string]string) {\n\t// Sort the keys so that they print in a consistent\n\t// order. We don't have the YANG AST information, so the\n\t// best we can do is sort them alphabetically.\n\tsize := 0\n\tkeys := make([]string, 0, len(key))\n\tfor k, v := range key {\n\t\tkeys = append(keys, k)\n\t\tsize += len(k) + len(v) + 3 // [, =, ]\n\t}\n\tsort.Strings(keys)\n\tb.Grow(size)\n\tfor _, k := range keys {\n\t\tb.WriteByte('[')\n\t\tb.WriteString(escapeKey(k))\n\t\tb.WriteByte('=')\n\t\tb.WriteString(escapeValue(key[k]))\n\t\tb.WriteByte(']')\n\t}\n}", "title": "" }, { "docid": "c6bb50faa3d3525b2ca9b090ba0867c0", "score": "0.45869657", "text": "func (e SavePortsRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "8252ca1a354550dd1b19bbe22607b049", "score": "0.45851427", "text": "func (e MoveObjectNextResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "00ec4a77ffb11d0072d8550180f3fd61", "score": "0.45695964", "text": "func (s *Store) HasFullKey(key string) bool {\n\treturn s.stores[imageManifestType].Has(key)\n}", "title": "" }, { "docid": "bf2c7e14de9200d57cb9683d1646c5f6", "score": "0.45596406", "text": "func (e E2SmRcPreControlHeaderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "8b77b165a215da833fef9d16bf7f37b0", "score": "0.4558372", "text": "func (e MoveObjectNextRequestValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "9093124dacdc3a33fa80cb729432b41e", "score": "0.45561808", "text": "func (t *TreeMap) Contains(key string) bool {\n\tcurrent := t.root\n\tfor {\n\t\tif current == nil {\n\t\t\treturn false\n\t\t}\n\t\t//fmt.Println(current.key)\n\t\tresult := current.compareTo(key)\n\t\tif result == 0 {\n\t\t\tbreak\n\t\t} else if result > 0 {\n\t\t\t//fmt.Println(\"Moving left...\")\n\t\t\tcurrent = current.left\n\t\t} else {\n\t\t\t//fmt.Println(\"Moving right...\")\n\t\t\tcurrent = current.right\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f7e8875291b52a6df34c521ff7fc2023", "score": "0.4552744", "text": "func (e E2SmRcPreIndicationHeaderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "a341b26d5ea6f328086601ea29bda44b", "score": "0.45503", "text": "func (e HttpBodyValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "64fc748807b93950f59485e07413a83c", "score": "0.45375273", "text": "func (b *Builder) Empty() bool { return len(b.keyHashes) == 0 }", "title": "" }, { "docid": "be402e0ba194cc8d471c401a64251f3d", "score": "0.4527643", "text": "func (e SXGValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "af3d8d9b4593a84358542bd1b0f3f073", "score": "0.45264775", "text": "func (e StatsMatcherValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "fa7d0b76f8af93f5869cff4fc6f9ccda", "score": "0.45253807", "text": "func keySavedInSSHAgent(publicKey []byte, identities []*agent.Key) (result bool, index int) {\n\tfor i, identity := range identities {\n\t\t//In my tests, string(publicKey) has 1 extra character added at the end which would make the comparison to identity.String() fail if not removed\n\t\tpublicKeyString := string(publicKey)[:len(string(publicKey))-1]\n\t\tif publicKeyString == identity.String() {\n\t\t\treturn true, i\n\t\t}\n\t}\n\treturn false, -1\n}", "title": "" }, { "docid": "cb380942ba7227797e628de4b12d0f23", "score": "0.45248002", "text": "func (e HealthCheck_TcpHealthCheckValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "8ee4fbf70f5d35c01fd95a1a34f4793b", "score": "0.45206636", "text": "func (e HttpConnectionManager_TracingValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "19bd4688f092f2b4e8c1d471b8614639", "score": "0.45201522", "text": "func HasKey(key string) bool { return c.HasKey(key) }", "title": "" }, { "docid": "ea5a6bffde1420f964a8820a334fa67b", "score": "0.451757", "text": "func (r *Region) Contains(key []byte) bool {\n\treturn bytes.Compare(r.meta.GetStartKey(), key) <= 0 &&\n\t\t(bytes.Compare(key, r.meta.GetEndKey()) < 0 || len(r.meta.GetEndKey()) == 0)\n}", "title": "" }, { "docid": "3e69a68d0d1e8a414d0f2cba3ce33bb7", "score": "0.4515807", "text": "func (enc *Encoder) BoolKeyNullEmpty(key string, v bool) {\n\tif enc.hasKeys {\n\t\tif !enc.keyExists(key) {\n\t\t\treturn\n\t\t}\n\t}\n\tenc.grow(5 + len(key))\n\tr := enc.getPreviousRune()\n\tif r != '{' {\n\t\tenc.writeByte(',')\n\t}\n\tenc.writeByte('\"')\n\tenc.writeStringEscape(key)\n\tenc.writeBytes(objKey)\n\tif v == false {\n\t\tenc.writeBytes(nullBytes)\n\t\treturn\n\t}\n\tenc.buf = strconv.AppendBool(enc.buf, v)\n}", "title": "" }, { "docid": "66e860ec0c6ca6985714e7ccc5b54bd5", "score": "0.45131323", "text": "func (e ArfcnValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "5b3fe3e99db0cc9685bdb46f686f50e5", "score": "0.45121115", "text": "func (m ConcurrentMap[T]) ContainsKey(key string) bool {\n\tshard := m.getShard(key)\n\tshard.RLock()\n\t_, ok := shard.items[key]\n\tshard.RUnlock()\n\treturn ok\n}", "title": "" }, { "docid": "434202f3ffbb5669bad4cf2c700effae", "score": "0.4510241", "text": "func (u *UFlat) KeyExists(key []byte) (found bool, err error) {\n\treturn u.ByteKeyExists(key)\n}", "title": "" }, { "docid": "06a4d6e31eb9efb9a9b23f4b01723b14", "score": "0.4509537", "text": "func (e MaxofMessageProtocolTestsValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "3b1728df3d7cfc61b8daf2913b157e99", "score": "0.450617", "text": "func (e ScopedRoutes_ScopeKeyBuilderValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "8d992f7e85f818e83f356809e395acc6", "score": "0.45048338", "text": "func (b *profBuf) canWriteRecord(nstk int) bool {\n\tbr := b.r.load()\n\tbw := b.w.load()\n\n\t// room for tag?\n\tif countSub(br.tagCount(), bw.tagCount())+len(b.tags) < 1 {\n\t\treturn false\n\t}\n\n\t// room for data?\n\tnd := countSub(br.dataCount(), bw.dataCount()) + len(b.data)\n\twant := 2 + int(b.hdrsize) + nstk\n\ti := int(bw.dataCount() % uint32(len(b.data)))\n\tif i+want > len(b.data) {\n\t\t// Can't fit in trailing fragment of slice.\n\t\t// Skip over that and start over at beginning of slice.\n\t\tnd -= len(b.data) - i\n\t}\n\treturn nd >= want\n}", "title": "" }, { "docid": "144e9ef9aed6c40ff19b0055644aa546", "score": "0.44987828", "text": "func nextKey(key string) string {\n\tbkey := []byte(key)\n\ti := len(bkey)\n\tfor i > 0 {\n\t\ti--\n\t\tbkey[i]++\n\t\tif bkey[i] != 0 {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn string(bkey)\n}", "title": "" }, { "docid": "e2a15099b469af356c5f4a156142f7cb", "score": "0.44954216", "text": "func (s *Slab) Contains(key int) bool {\n\treturn s.Get(key) != nil\n}", "title": "" }, { "docid": "aac237984e6b0197a6939f737a8cfb74", "score": "0.44943362", "text": "func (e JsonToMetadata_KeyValuePairValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "c7be0d58a15f2203247ef5a04d6c6419", "score": "0.44922647", "text": "func (e ReadinessResponseValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "42db6926c282b9d40100cc586f7d694f", "score": "0.44919723", "text": "func (this *MyHashSet) Contains(key int) bool {\n\tbucket := h(uint32(key)) % this.bucket\n\titer := this.Table[bucket].Head\n\tfor iter != nil {\n\t\tif iter.Val == key {\n\t\t\treturn true\n\t\t}\n\t\titer = iter.Next\n\t}\n\treturn false\n}", "title": "" }, { "docid": "17fc87dcda1afd6bbde63c6a28ce5a09", "score": "0.44904947", "text": "func (e ProxyProtocolUpstreamTransportValidationError) Key() bool { return e.key }", "title": "" }, { "docid": "061d0e777efa6c5d93a7bc86b4a1d77e", "score": "0.4490138", "text": "func (c *LRU) Containkey(key interface{}) (ok bool) {\n\t_, ok = c.items[key]\n\treturn ok\n}", "title": "" }, { "docid": "29dd34c8448981ffd9cae353d02c3eea", "score": "0.44894996", "text": "func (e SavePortRequestValidationError) Key() bool { return e.key }", "title": "" } ]
aef4689af0e54050f4ac29d94e39f765
JSONRead tries to read client sent content using JSON decoding and writes it to object pointed to by obj. Returns true whether no error occurred; otherwise, false. Body is automatically closed when true is returned.
[ { "docid": "8ecb6b0bcc40be538fef2ef87854c2b2", "score": "0.78172517", "text": "func JSONRead(\n\tbody io.ReadCloser,\n\tmaxlen int64,\n\tobj interface{},\n\tw http.ResponseWriter,\n) bool {\n\tif err := json.\n\t\tNewDecoder(io.LimitReader(body, maxlen)).\n\t\tDecode(obj); err != nil {\n\n\t\tjerr := NewJSONError().\n\t\t\tFromError(err).\n\t\t\tStatus(StatusUnprocessableEntity).\n\t\t\tBuild()\n\t\tJSONWrite(w, jerr.Status, jerr)\n\t\treturn false\n\t}\n\n\tif err := body.Close(); err != nil {\n\t\tjerr := NewJSONError().\n\t\t\tFromError(err).\n\t\t\tBuild()\n\t\tJSONWrite(w, jerr.Status, jerr)\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" } ]
[ { "docid": "ac07a676afd278f1558e4ce5ac3ae287", "score": "0.5872233", "text": "func ReadJSON(conn net.Conn, data interface{}) error {\n\tconst bufSize = 1024\n\n\tvar dataBytes []byte\n\tbuf := make([]byte, bufSize)\n\tfor {\n\t\tn, err := conn.Read(buf)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error reading data: %w\", err)\n\t\t}\n\n\t\tdataBytes = append(dataBytes, buf[:n]...)\n\n\t\tif n < 1024 {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif err := json.Unmarshal(dataBytes, data); err != nil {\n\t\treturn fmt.Errorf(\"error unmarshaling data: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7dc5aeea960524ff9f91eea5affffc14", "score": "0.57675683", "text": "func (c *Client) ReadJSON(out interface{}) error {\n\tc.mtx.RLock()\n\tdefer c.mtx.RUnlock()\n\treturn c.conn.ReadJSON(out)\n}", "title": "" }, { "docid": "007c98d1e25a2d6e2f40f568457fb27e", "score": "0.5618066", "text": "func readJSON(body io.Reader, dest interface{}) error {\n\tdecoder := json.NewDecoder(body)\n\terr := decoder.Decode(dest)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "77f3a4b9b9e1a22c6321a6a9c7a0790e", "score": "0.5549915", "text": "func readJSON(r *http.Request, object interface{}) {\n\terr := json.NewDecoder(r.Body).Decode(object)\n\tcheck(err)\n}", "title": "" }, { "docid": "5a3fdb7ace8fa6b70637641b76364586", "score": "0.5399445", "text": "func ReadJSON(r *http.Request, j interface{}) error {\n\tif r.Body == nil {\n\t\treturn errors.New(\"read json: no body\")\n\t}\n\treturn json.NewDecoder(r.Body).Decode(j)\n}", "title": "" }, { "docid": "10bef49ae4c175322dae83b3d6166764", "score": "0.53915757", "text": "func (c *Client) HasJSON() bool {\n\treturn c.Resp != nil && strings.Contains(c.Resp.Header.Get(\"content-type\"), \"application/json\")\n}", "title": "" }, { "docid": "27395527f7a5d52d9567f196fc7098a6", "score": "0.53821945", "text": "func ShouldJsonObj(buf []byte) (*Obj, bool) {\n\tvar jsonObj Obj\n\terr := json.Unmarshal(buf, &jsonObj)\n\treturn &jsonObj, err == nil\n}", "title": "" }, { "docid": "49432b49f3a8c986f9a841486be8094c", "score": "0.5323814", "text": "func (s *Sessions) CheckJSON(session string, dat interface{}) bool {\n\tbs, _, ok := s.Check(session)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn json.Unmarshal(bs, dat) == nil\n}", "title": "" }, { "docid": "c7d23c0ff99da10c8e7427ccce640519", "score": "0.52890617", "text": "func IsJSON(content []byte) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal(content, &js) == nil\n}", "title": "" }, { "docid": "edee28f0db9f6ae828597fc294ffb901", "score": "0.52582324", "text": "func ReadJSON(rd io.Reader, v interface{}) error {\n\treturn Read(rd, v, json.Unmarshal)\n}", "title": "" }, { "docid": "09da0f4c338a8d5219b9f961e8d4d4b8", "score": "0.5246849", "text": "func (c *Connection) ReadJSON(p interface{}) error {\n\tc.mux.RLock()\n\tdefer c.mux.RUnlock()\n\n\treturn c.ws.ReadJSON(p)\n}", "title": "" }, { "docid": "255b9d7bae490bc750e4089ee5692f62", "score": "0.5239011", "text": "func checkJSON(t *testing.T, in interface{}, reader interface{}, typ string) {\n\t// test to and from binary\n\tjs, err := data.ToJSON(in)\n\trequire.Nil(t, err, \"%+v\", err)\n\tstyp := `\"` + typ + `\"`\n\tassert.True(t, strings.Contains(string(js), styp))\n\n\terr = data.FromJSON(js, reader)\n\trequire.Nil(t, err, \"%+v\", err)\n\n\t// also check text format\n\ttext, err := data.ToText(in)\n\trequire.Nil(t, err, \"%+v\", err)\n\tparts := strings.Split(text, \":\")\n\trequire.Equal(t, 2, len(parts))\n\t// make sure the first part is the typ string\n\tassert.Equal(t, typ, parts[0])\n\t// and the data is also present in the json\n\tassert.True(t, strings.Contains(string(js), parts[1]))\n}", "title": "" }, { "docid": "dce4471f1caed1389321638867e6cd5a", "score": "0.52356195", "text": "func (c *connType) Read() (bool, error) {\n\tresp, err := http.ReadResponse(c.br, nil)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode/100 != 2 {\n\t\tvar buffer bytes.Buffer\n\t\tio.Copy(&buffer, resp.Body)\n\t\t// 408 is a special error meaning that the connection timed out\n\t\t// because we didn't send any request. 408 errors don't go with\n\t\t// any particular request. When we get one of these, assume the\n\t\t// connection is bad.\n\t\treturn resp.StatusCode != 408, errors.New(resp.Status + \": \" + buffer.String())\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "15083d2d2d44d587e7e82c8050dd9205", "score": "0.51866055", "text": "func (s *Server) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin bool) {\n\tif atomic.LoadInt32(&s.shutdown) != 0 {\n\t\treturn\n\t}\n\n\t// Read and close the JSON-RPC request body from the caller.\n\tbody, err := ioutil.ReadAll(r.Body)\n\tr.Body.Close()\n\tif err != nil {\n\t\terrCode := http.StatusBadRequest\n\t\thttp.Error(w, fmt.Sprintf(\"%d error reading JSON message: %v\",\n\t\t\terrCode, err), errCode)\n\t\treturn\n\t}\n\n\t// Unfortunately, the http server doesn't provide the ability to\n\t// change the read deadline for the new connection and having one breaks\n\t// long polling. However, not having a read deadline on the initial\n\t// connection would mean clients can connect and idle forever. Thus,\n\t// hijack the connecton from the HTTP server, clear the read deadline,\n\t// and handle writing the response manually.\n\thj, ok := w.(http.Hijacker)\n\tif !ok {\n\t\terrMsg := \"webserver doesn't support hijacking\"\n\t\tlog.Warn(errMsg)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+errMsg, errCode)\n\t\treturn\n\t}\n\tconn, buf, err := hj.Hijack()\n\tif err != nil {\n\t\tlog.Warn(\"Failed to hijack HTTP connection: %v\", err)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+err.Error(), errCode)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tdefer buf.Flush()\n\t//conn.SetReadDeadline(timeZeroVal)\n\n\t// Attempt to parse the raw body into a JSON-RPC request.\n\tvar responseID interface{}\n\tvar jsonErr error\n\tvar result interface{}\n\tvar request btcjson.Request\n\tif err := json.Unmarshal(body, &request); err != nil {\n\t\tjsonErr = &btcjson.RPCError{\n\t\t\tCode: btcjson.ErrRPCParse.Code,\n\t\t\tMessage: \"Failed to parse request: \" + err.Error(),\n\t\t}\n\t}\n\tif jsonErr == nil {\n\t\tif request.ID == nil && !(conf.Cfg.RPC.RPCQuirks && request.Jsonrpc == \"\") {\n\t\t\treturn\n\t\t}\n\n\t\t// The parse was at least successful enough to have an ID so\n\t\t// set it for the response.\n\t\tresponseID = request.ID\n\n\t\t// Setup a close notifier. Since the connection is hijacked,\n\t\t// the CloseNotifer on the ResponseWriter is not available.\n\t\tcloseChan := make(chan struct{}, 1)\n\t\tgo func() {\n\t\t\t_, err := conn.Read(make([]byte, 1))\n\t\t\tif err != nil {\n\t\t\t\tclose(closeChan)\n\t\t\t}\n\t\t}()\n\n\t\t// Check if the user is limited and set error if method unauthorized\n\t\t//if !isAdmin {\n\t\t//\tif _, ok := rpcLimited[request.Method]; !ok {\n\t\t//\t\tjsonErr = &btcjson.RPCError{\n\t\t//\t\t\tCode: btcjson.ErrRPCInvalidParams.Code,\n\t\t//\t\t\tMessage: \"limited user not authorized for this method\",\n\t\t//\t\t}\n\t\t//\t}\n\t\t//}\n\n\t\tif jsonErr == nil {\n\t\t\tparsedCmd := parseCmd(&request)\n\t\t\tif parsedCmd.err != nil {\n\t\t\t\tjsonErr = parsedCmd.err\n\t\t\t} else {\n\t\t\t\tresult, jsonErr = s.standardCmdResult(parsedCmd, closeChan)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Marshal the response.\n\tmsg, err := createMarshalledReply(responseID, result, jsonErr)\n\tif err != nil {\n\t\tlog.Error(\"Failed to marshal reply: %v\", err)\n\t\treturn\n\t}\n\n\t// Write the response.\n\terr = s.writeHTTPResponseHeaders(r, w.Header(), http.StatusOK, buf)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tif _, err := buf.Write(msg); err != nil {\n\t\tlog.Error(\"Failed to write marshalled reply: %v\", err)\n\t}\n\n\t// Terminate with newline to maintain compatibility.\n\tif err := buf.WriteByte('\\n'); err != nil {\n\t\tlog.Error(\"Failed to append terminating newline to reply: %v\", err)\n\t}\n}", "title": "" }, { "docid": "31e36aab6a267bfbb444ac2574d63c0d", "score": "0.5169187", "text": "func ReadJSON(reader io.ReadCloser, model interface{}) error {\n\tdecoder := json.NewDecoder(reader)\n\tif err := decoder.Decode(model); err != nil {\n\t\treturn err\n\t}\n\treader.Close()\n\treturn nil\n}", "title": "" }, { "docid": "c4d3d13e8c7d57a1e765a977dda2c207", "score": "0.51388067", "text": "func (p *pingingWebsocket) ReadJSON(v interface{}) error {\n\tp.readLock.Lock()\n\tdefer p.readLock.Unlock()\n\t_, r, err := p.conn.NextReader()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = codec.NewDecoder(r, &codec.JsonHandle{}).Decode(v)\n\tif err == io.EOF {\n\t\t// One value is expected in the message.\n\t\terr = io.ErrUnexpectedEOF\n\t}\n\treturn err\n}", "title": "" }, { "docid": "92d95905fd841039ec7d3d4e964058a6", "score": "0.5111953", "text": "func (rw *resultWaiter) Read() (*js.Object, error) {\n\trawResult := <-rw.resultChan\n\tif rawResult.err == nil {\n\t\treturn rawResult.result, nil\n\t}\n\treturn rawResult.result, NewPouchError(&js.Error{Object: rawResult.err})\n}", "title": "" }, { "docid": "c47b5dc125b8e7ab5b6ff769b6ad917f", "score": "0.51106715", "text": "func (app *Application) readJSON(w http.ResponseWriter, r *http.Request, dst interface{}) error {\n\n\t// Use http.MaxBytesReader() to limit the size of the request body to 1MB.\n\tmaxBytes := 1_048_576\n\n\tr.Body = http.MaxBytesReader(w, r.Body, int64(maxBytes))\n\n\t// Initialize the json.Decoder, and call the DisallowUnknownFields() method on it // before decoding.\n\tdec := json.NewDecoder(r.Body)\n\tdec.DisallowUnknownFields()\n\n\t// Decode the request body to the destination.\n\terr := dec.Decode(dst)\n\tif err != nil {\n\t\t// If there is an error during decoding, start the triage...\n\t\tvar syntaxError *json.SyntaxError\n\t\tvar unmarshalTypeError *json.UnmarshalTypeError\n\t\tvar invalidUnmarshalError *json.InvalidUnmarshalError\n\n\t\tswitch {\n\t\tcase errors.As(err, &syntaxError):\n\t\t\treturn fmt.Errorf(\"body contains badly-formed JSON (at character %d)\", syntaxError.Offset)\n\n\t\tcase errors.Is(err, io.ErrUnexpectedEOF):\n\t\t\treturn errors.New(\"body contains badly-formed JSON\")\n\n\t\tcase errors.As(err, &unmarshalTypeError):\n\t\t\tif unmarshalTypeError.Field != \"\" {\n\t\t\t\treturn fmt.Errorf(\"body contains incorrect JSON type for field %q\", unmarshalTypeError.Field)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"body contains incorrect JSON type (at character %d)\", unmarshalTypeError.Offset)\n\n\t\tcase errors.Is(err, io.EOF):\n\t\t\treturn errors.New(\"body must not be empty\")\n\n\n\t\t// If the JSON contains a field which cannot be mapped to the target destination\n\t\t//then Decode() will now return an error message in the format \"json: unknown\n\t\t//field \"<name>\"\".\n\t\tcase strings.HasPrefix(err.Error(), \"json: unknown field \"):\n\t\t\tfieldName := strings.TrimPrefix(err.Error(), \"json: unknown field \")\n\t\t\treturn fmt.Errorf(\"body contains unknown key %s\", fieldName)\n\n\t\t// If the request body exceeds 1MB in size the decode will now fail with the\n\t\tcase err.Error() == \"http: request body too large\":\n\t\t\treturn fmt.Errorf(\"body must not be larger than %d bytes\", maxBytes)\n\n\t\tcase errors.As(err, &invalidUnmarshalError):\n\t\t\tpanic(err)\n\n\t\tdefault:\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Call Decode() again, using a pointer to an empty anonymous struct as the\n\t// destination. If the request body only contained a single JSON value this will\n\t//return an io.EOF error. So if we get anything else, we know that there is\n\t// additional data in the request body and we return our own custom error message.\n\terr = dec.Decode(&struct{}{})\n\tif err != io.EOF {\n\t\treturn errors.New(\"body must only contain a single JSON value\") }\n\n\n\treturn nil\n}", "title": "" }, { "docid": "5a21bd56040518e4adb721655df220b8", "score": "0.5091223", "text": "func writeJSON(w http.ResponseWriter, obj interface{}) {\n\tif json.NewEncoder(w).Encode(obj) != nil {\n\t\thttp.Error(w, \"Failed to encode response\", 500)\n\t}\n}", "title": "" }, { "docid": "0eaa22f8d54460303f44ee3892b407d0", "score": "0.5071951", "text": "func (s *rpcServer) jsonRPCRead(w http.ResponseWriter, r *http.Request) {\n\tif atomic.LoadInt32(&s.shutdown) != 0 {\n\t\treturn\n\t}\n\n\t// Read and close the JSON-RPC request body from the caller.\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif err := r.Body.Close(); err != nil {\n\t\tfmt.Println(\"Failed to close response body:\", err)\n\t}\n\n\tif err != nil {\n\t\terrCode := http.StatusBadRequest\n\t\thttp.Error(w, fmt.Sprintf(\"%d error reading JSON message: %v\",\n\t\t\terrCode, err), errCode)\n\t\treturn\n\t}\n\n\t// Unfortunately, the http server doesn't provide the ability to\n\t// change the read deadline for the new connection and having one breaks\n\t// long polling. However, not having a read deadline on the initial\n\t// connection would mean clients can connect and idle forever. Thus,\n\t// hijack the connecton from the HTTP server, clear the read deadline,\n\t// and handle writing the response manually.\n\thj, ok := w.(http.Hijacker)\n\tif !ok {\n\t\terrMsg := \"webserver doesn't support hijacking\"\n\t\tfmt.Print(errMsg)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+errMsg, errCode)\n\t\treturn\n\t}\n\tconn, buf, err := hj.Hijack()\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to hijack HTTP connection: %v\", err)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+err.Error(), errCode)\n\t\treturn\n\t}\n\tdefer func() {\n\t\tif err := conn.Close(); err != nil {\n\t\t\tfmt.Println(\"conn.Close failed:\", err)\n\t\t}\n\t}()\n\tdefer func() {\n\t\tif err := buf.Flush(); err != nil {\n\t\t\tfmt.Println(\"buf.Flush failed:\", err)\n\t\t}\n\t}()\n\tif err := conn.SetReadDeadline(timeZeroVal); err != nil {\n\t\tfmt.Println(\"conn.SetReadDeadline failed:\", err)\n\t}\n\n\t// Attempt to parse the raw body into a JSON-RPC request.\n\tvar responseID interface{}\n\tvar jsonErr error\n\tvar result interface{}\n\tvar request btcjson.Request\n\tif err := json.Unmarshal(body, &request); err != nil {\n\t\tjsonErr = &btcjson.RPCError{\n\t\t\tCode: btcjson.ErrRPCParse.Code,\n\t\t\tMessage: \"Failed to parse request: \" + err.Error(),\n\t\t}\n\t}\n\tif jsonErr == nil {\n\t\t// The JSON-RPC 1.0 spec defines that notifications must have their \"id\"\n\t\t// set to null and states that notifications do not have a response.\n\t\t//\n\t\t// A JSON-RPC 2.0 notification is a request with \"json-rpc\":\"2.0\", and\n\t\t// without an \"id\" member. The specification states that notifications\n\t\t// must not be responded to. JSON-RPC 2.0 permits the null value as a\n\t\t// valid request id, therefore such requests are not notifications.\n\t\t//\n\t\t// Bitcoin Core serves requests with \"id\":null or even an absent \"id\",\n\t\t// and responds to such requests with \"id\":null in the response.\n\t\t//\n\t\t// Btcd does not respond to any request without and \"id\" or \"id\":null,\n\t\t// regardless the indicated JSON-RPC protocol version unless RPC quirks\n\t\t// are enabled. With RPC quirks enabled, such requests will be responded\n\t\t// to if the reqeust does not indicate JSON-RPC version.\n\t\t//\n\t\t// RPC quirks can be enabled by the user to avoid compatibility issues\n\t\t// with software relying on Core's behavior.\n\t\tif request.ID == nil && !(rpcQuirks && request.Jsonrpc == \"\") {\n\t\t\treturn\n\t\t}\n\n\t\t// The parse was at least successful enough to have an ID so\n\t\t// set it for the response.\n\t\tresponseID = request.ID\n\n\t\t// Setup a close notifier. Since the connection is hijacked,\n\t\t// the CloseNotifer on the ResponseWriter is not available.\n\t\tcloseChan := make(chan struct{}, 1)\n\t\tgo func() {\n\t\t\t_, err := conn.Read(make([]byte, 1))\n\t\t\tif err != nil {\n\t\t\t\tclose(closeChan)\n\t\t\t}\n\t\t}()\n\n\t\tif jsonErr == nil {\n\t\t\t// Attempt to parse the JSON-RPC request into a known concrete\n\t\t\t// command.\n\t\t\tparsedCmd := parseCmd(&request)\n\n\t\t\tif parsedCmd.err != nil {\n\t\t\t\tjsonErr = parsedCmd.err\n\t\t\t} else {\n\t\t\t\tresult, jsonErr = s.standardCmdResult(parsedCmd, closeChan)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Marshal the response.\n\tmsg, err := createMarshalledReply(responseID, result, jsonErr)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to marshal reply: %v\\n\", err)\n\t\treturn\n\t}\n\n\t// Write the response.\n\terr = s.writeHTTPResponseHeaders(r, w.Header(), buf)\n\tif err != nil {\n\t\tfmt.Printf(\"%v\\n\", err)\n\t\treturn\n\t}\n\tif _, err := buf.Write(msg); err != nil {\n\t\tfmt.Printf(\"Failed to write marshalled reply: %v\\n\", err)\n\t}\n\n\t// Terminate with newline to maintain compatibility with Bitcoin Core.\n\tif err := buf.WriteByte('\\n'); err != nil {\n\t\tfmt.Printf(\"Failed to append terminating newline to reply: %v\\n\", err)\n\t}\n}", "title": "" }, { "docid": "595d14ec9115705ecaf7d69b4ee3cebb", "score": "0.5071777", "text": "func (s *Server) jsonRPCRead(w http.ResponseWriter, r *http.Request, isAdmin bool) {\n\tif atomic.LoadInt32(&s.shutdown) != 0 {\n\t\treturn\n\t}\n\n\t// Read and close the JSON-RPC request body from the caller.\n\tbody, err := ioutil.ReadAll(r.Body)\n\tr.Body.Close()\n\tif err != nil {\n\t\terrCode := http.StatusBadRequest\n\t\thttp.Error(w, fmt.Sprintf(\"%d error reading JSON message: %s\",\n\t\t\terrCode, err), errCode)\n\t\treturn\n\t}\n\n\t// Unfortunately, the http server doesn't provide the ability to\n\t// change the read deadline for the new connection and having one breaks\n\t// long polling. However, not having a read deadline on the initial\n\t// connection would mean clients can connect and idle forever. Thus,\n\t// hijack the connecton from the HTTP server, clear the read deadline,\n\t// and handle writing the response manually.\n\thj, ok := w.(http.Hijacker)\n\tif !ok {\n\t\terrMsg := \"webserver doesn't support hijacking\"\n\t\tlog.Warnf(errMsg)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+errMsg, errCode)\n\t\treturn\n\t}\n\tconn, buf, err := hj.Hijack()\n\tif err != nil {\n\t\tlog.Warnf(\"Failed to hijack HTTP connection: %s\", err)\n\t\terrCode := http.StatusInternalServerError\n\t\thttp.Error(w, strconv.Itoa(errCode)+\" \"+err.Error(), errCode)\n\t\treturn\n\t}\n\tdefer conn.Close()\n\tdefer buf.Flush()\n\tconn.SetReadDeadline(timeZeroVal)\n\n\t// Attempt to parse the raw body into a JSON-RPC request.\n\tvar responseID interface{}\n\tvar jsonErr error\n\tvar result interface{}\n\tvar request model.Request\n\tif err := json.Unmarshal(body, &request); err != nil {\n\t\tjsonErr = &model.RPCError{\n\t\t\tCode: model.ErrRPCParse.Code,\n\t\t\tMessage: \"Failed to parse request: \" + err.Error(),\n\t\t}\n\t}\n\tif jsonErr == nil {\n\t\t// The JSON-RPC 1.0 spec defines that notifications must have their \"id\"\n\t\t// set to null and states that notifications do not have a response.\n\t\t//\n\t\t// A JSON-RPC 2.0 notification is a request with \"json-rpc\":\"2.0\", and\n\t\t// without an \"id\" member. The specification states that notifications\n\t\t// must not be responded to. JSON-RPC 2.0 permits the null value as a\n\t\t// valid request id, therefore such requests are not notifications.\n\t\t//\n\t\t// Kaspad does not respond to any request without an \"id\" or \"id\":null,\n\t\t// regardless the indicated JSON-RPC protocol version.\n\t\tif request.ID == nil {\n\t\t\treturn\n\t\t}\n\n\t\t// The parse was at least successful enough to have an ID so\n\t\t// set it for the response.\n\t\tresponseID = request.ID\n\n\t\t// Setup a close notifier. Since the connection is hijacked,\n\t\t// the CloseNotifer on the ResponseWriter is not available.\n\t\tcloseChan := make(chan struct{}, 1)\n\t\tspawn(\"Server.jsonRPCRead-conn.Read\", func() {\n\t\t\t_, err := conn.Read(make([]byte, 1))\n\t\t\tif err != nil {\n\t\t\t\tclose(closeChan)\n\t\t\t}\n\t\t})\n\n\t\t// Check if the user is limited and set error if method unauthorized\n\t\tif !isAdmin {\n\t\t\tif _, ok := rpcLimited[request.Method]; !ok {\n\t\t\t\tjsonErr = &model.RPCError{\n\t\t\t\t\tCode: model.ErrRPCInvalidParams.Code,\n\t\t\t\t\tMessage: \"limited user not authorized for this method\",\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif jsonErr == nil {\n\t\t\t// Attempt to parse the JSON-RPC request into a known concrete\n\t\t\t// command.\n\t\t\tparsedCmd := parseCmd(&request)\n\t\t\tif parsedCmd.err != nil {\n\t\t\t\tjsonErr = parsedCmd.err\n\t\t\t} else {\n\t\t\t\tlog.Debugf(\"HTTP server received command <%s> from %s\", parsedCmd.method, r.RemoteAddr)\n\t\t\t\tresult, jsonErr = s.standardCmdResult(parsedCmd, closeChan)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Marshal the response.\n\tmsg, err := createMarshalledReply(responseID, result, jsonErr)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to marshal reply: %s\", err)\n\t\treturn\n\t}\n\n\t// Write the response.\n\terr = s.writeHTTPResponseHeaders(r, w.Header(), http.StatusOK, buf)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\treturn\n\t}\n\tif _, err := buf.Write(msg); err != nil {\n\t\tlog.Errorf(\"Failed to write marshalled reply: %s\", err)\n\t}\n\n\t// Terminate with newline for historical reasons.\n\tif err := buf.WriteByte('\\n'); err != nil {\n\t\tlog.Errorf(\"Failed to append terminating newline to reply: %s\", err)\n\t}\n}", "title": "" }, { "docid": "2913e2af93704240c5d838cca1bd0637", "score": "0.50610286", "text": "func ReadJSON(r *http.Request, v interface{}) error {\n\n\tbuf, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"read response: %s\", err)\n\t}\n\n\tif len(buf) == 0 {\n\t\treturn errors.New(\"no data to parse\")\n\t}\n\n\tif err := json.Unmarshal(buf, v); err != nil {\n\t\treturn fmt.Errorf(\"unmarshal: %s\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "df3cf6c896fa96329875f9da5a0bfbc0", "score": "0.50167614", "text": "func ReadJSON(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tURL := r.URL.Path\n\tID := strings.Replace(URL, \"/api/article/\", \"\", 1)\n\titem, err := GetbyID(ID)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tij, _ := json.Marshal(item)\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", ij)\n}", "title": "" }, { "docid": "4b4c364596d9e2e07a490d2d87674b3e", "score": "0.50048476", "text": "func ReadJSON(obj interface{}, filename string) error {\r\n\tdata, err := ioutil.ReadFile(filename)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\tdata = util.TrimComment(data)\r\n\terr = json.Unmarshal(data, obj)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\treturn nil\r\n}", "title": "" }, { "docid": "04c8b74a7cb38e4cc8bec944c751faa7", "score": "0.4996508", "text": "func ReadJSONBody(ctx context.Context, body io.ReadCloser, v interface{}, w http.ResponseWriter, data log.Data) error {\n\tdefer body.Close()\n\n\t// Set headers\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=utf-8\")\n\n\t// Get Body bytes\n\tpayload, err := ioutil.ReadAll(body)\n\tif err != nil {\n\t\thandleError(ctx, w, apierrors.ErrUnableToReadMessage, data)\n\t\treturn err\n\t}\n\n\t// Unmarshal body bytes to model\n\tif err := json.Unmarshal(payload, v); err != nil {\n\t\thandleError(ctx, w, apierrors.ErrUnableToParseJSON, data)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e67c8ed15d453fefa76166640d2df8f7", "score": "0.4994904", "text": "func SendJson(object MyObject) (net.Conn, error) {\n\tdata, err := AsByte(object)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn, err := net.Dial(CONN_TYPE_TCP, fmt.Sprintf(\"%s:%s\", CONN_HOST, CONN_PORT))\n\tif err != nil {\n\t\treturn conn, err\n\t}\n\tconn.Write(data)\n\treturn conn, err\n}", "title": "" }, { "docid": "3a6cec4db6aa536d4d14995278b42bef", "score": "0.49872977", "text": "func readJSON(meta Metadata, object interface{}, filename string) error {\n\t// Open the file.\n\tfile, err := os.Open(filename)\n\tif os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to open persisted json object file\", err)\n\t}\n\tdefer file.Close()\n\n\t// Read the metadata from the file.\n\tvar header, version string\n\tdec := json.NewDecoder(file)\n\tif err := dec.Decode(&header); err != nil {\n\t\treturn build.ExtendErr(\"unable to read header from persisted json object file\", err)\n\t}\n\tif header != meta.Header {\n\t\treturn ErrBadHeader\n\t}\n\tif err := dec.Decode(&version); err != nil {\n\t\treturn build.ExtendErr(\"unable to read version from persisted json object file\", err)\n\t}\n\tif version != meta.Version {\n\t\treturn ErrBadVersion\n\t}\n\n\t// Read everything else.\n\tremainingBytes, err := ioutil.ReadAll(dec.Buffered())\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to read persisted json object data\", err)\n\t}\n\t// The buffer may or may not have read the rest of the file, read the rest\n\t// of the file to be certain.\n\tremainingBytesExtra, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to read persisted json object data\", err)\n\t}\n\tremainingBytes = append(remainingBytes, remainingBytesExtra...)\n\n\t// Determine whether the leading bytes contain a checksum. A proper checksum\n\t// will be 67 bytes (quote, 64 byte checksum, quote, newline). A manual\n\t// checksum will be the characters \"manual\\n\" (9 characters). If neither\n\t// decode correctly, it is assumed that there is no checksum at all.\n\tcheckManual := len(remainingBytes) >= 9\n\tif len(remainingBytes) >= 67 {\n\t\tvar checksum crypto.Hash\n\t\terr = json.Unmarshal(remainingBytes[:67], &checksum)\n\t\tcheckManual = checkManual && err != nil\n\t\tif err == nil && checksum != crypto.HashBytes(remainingBytes[68:]) {\n\t\t\treturn errors.New(\"loading a file with a bad checksum\")\n\t\t} else if err == nil {\n\t\t\tremainingBytes = remainingBytes[68:]\n\t\t}\n\t}\n\n\t// checkManual will be set to true so long as the remainingBytes is at least\n\t// 9 bytes long, and also there was an error when parsing the checksum. The\n\t// manual checksum is considered correct if the json unmarshalling parses\n\t// correctly, and also the bytes match the string \"manual\".\n\tif checkManual {\n\t\tvar manualChecksum string\n\t\terr := json.Unmarshal(remainingBytes[:9], &manualChecksum)\n\t\tif err == nil && manualChecksum != \"manual\" {\n\t\t\treturn errors.New(\"loading a file with a bad checksum\")\n\t\t} else if err == nil {\n\t\t\tremainingBytes = remainingBytes[10:]\n\t\t}\n\t}\n\n\t// Any valid checksum has been stripped off. If there was an invalid\n\t// checksum, an error has been returned. There is also the case that no\n\t// checksum was written at all, which is ignored as a case - it's needed to\n\t// preserve compatibility with previous persist files.\n\n\t// Parse the json object.\n\treturn json.Unmarshal(remainingBytes, &object)\n}", "title": "" }, { "docid": "d393ffa79080265478ea939f5cf594f5", "score": "0.49848634", "text": "func IsJSON(fileName interface{}, state data.Map) (interface{}, error) {\n\tcontent, err := Cat(fileName, state)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tvar m json.RawMessage\n\tif err := json.Unmarshal([]byte(toolbox.AsString(content)), &m); err != nil {\n\t\treturn false, err\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "932246366c78208c149377ed5b582318", "score": "0.4970268", "text": "func ReadJSON(r *http.Request, data interface{}) error {\n\tif err := json.Unmarshal(r.Body, data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7d4bbe7bd6134eb7a456a1c09ceeec44", "score": "0.49417216", "text": "func sendJSON(r io.Reader, w io.Writer, data []interface{}) string {\n\n\tfmt.Println(\"Data:\", data)\n\n\tmarshalled, _ := json.Marshal(data)\n\tfmt.Println(\"Sending:\", string(marshalled))\n\n\tw.Write(marshalled)\n\tbuf := make([]byte, 1024)\n\tn, _ := r.Read(buf)\n\treturn string(buf[:n])\n}", "title": "" }, { "docid": "475c8a67db75900b6d154f00aa3ab6b1", "score": "0.49401417", "text": "func ReadJSON(path string, dest interface{}) error {\n\tcontent, err := read(path)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"couldn't read the JSON file\")\n\t}\n\n\tif err := json.Unmarshal(content, dest); err != nil {\n\t\treturn errors.Wrap(err, \"couldn't unmarshal the JSON file\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4745e295f3866a38459cb01510f68af7", "score": "0.4911001", "text": "func (nd *NetData) ReadJSON(r io.Reader) error {\n\tdec := json.NewDecoder(r)\n\terr := dec.Decode(nd) // this is way to do it on reader instead of bytes\n\tnan := mat32.NaN()\n\tfor _, ld := range nd.LayData {\n\t\tfor i := range ld.Data {\n\t\t\tif ld.Data[i] == NaNSub {\n\t\t\t\tld.Data[i] = nan\n\t\t\t}\n\t\t}\n\t}\n\tif err == nil || err == io.EOF {\n\t\treturn nil\n\t}\n\tlog.Println(err)\n\treturn err\n}", "title": "" }, { "docid": "95aee5a1ebdde9f4f17edf2280cc916c", "score": "0.49104828", "text": "func (mr *MockConnMockRecorder) ReadJSON(v interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ReadJSON\", reflect.TypeOf((*MockConn)(nil).ReadJSON), v)\n}", "title": "" }, { "docid": "c3777cd58716e32fbc24ba7ff9d34ff3", "score": "0.4903284", "text": "func readJSON(meta Metadata, object interface{}, filename string) error {\n\t// Open the file.\n\tfile, err := os.Open(filename)\n\tif os.IsNotExist(err) {\n\t\treturn err\n\t}\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to open persisted json object file\", err)\n\t}\n\tdefer file.Close()\n\n\t// Read the metadata from the file.\n\tvar header, version string\n\tdec := json.NewDecoder(file)\n\tif err := dec.Decode(&header); err != nil {\n\t\treturn build.ExtendErr(\"unable to read header from persisted json object file\", err)\n\t}\n\tif header != meta.Header {\n\t\treturn ErrBadHeader\n\t}\n\tif err := dec.Decode(&version); err != nil {\n\t\treturn build.ExtendErr(\"unable to read version from persisted json object file\", err)\n\t}\n\tif version != meta.Version {\n\t\treturn ErrBadVersion\n\t}\n\n\t// Read everything else.\n\tremainingBytes, err := ioutil.ReadAll(dec.Buffered())\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to read persisted json object data\", err)\n\t}\n\t// The buffer may or may not have read the rest of the file, read the rest\n\t// of the file to be certain.\n\tremainingBytesExtra, err := ioutil.ReadAll(file)\n\tif err != nil {\n\t\treturn build.ExtendErr(\"unable to read persisted json object data\", err)\n\t}\n\tremainingBytes = append(remainingBytes, remainingBytesExtra...)\n\n\t// Determine whether the leading bytes contain a checksum. A proper checksum\n\t// will be 67 bytes (quote, 64 byte checksum, quote, newline). A manual\n\t// checksum will be the characters \"manual\\n\" (9 characters). If neither\n\t// decode correctly, it is assumed that there is no checksum at all.\n\tvar checksum crypto.Hash\n\terr = json.Unmarshal(remainingBytes[:67], &checksum)\n\tif err == nil && checksum == crypto.HashBytes(remainingBytes[68:]) {\n\t\t// Checksum is proper, and matches the data. Update the data portion to\n\t\t// exclude the checksum.\n\t\tremainingBytes = remainingBytes[68:]\n\t} else {\n\t\t// Cryptographic checksum failed, try interpreting a manual checksum.\n\t\tvar manualChecksum string\n\t\terr := json.Unmarshal(remainingBytes[:8], &manualChecksum)\n\t\tif err == nil && manualChecksum == \"manual\" {\n\t\t\t// Manual checksum is proper. Update the remaining data to exclude\n\t\t\t// the manual checksum.\n\t\t\tremainingBytes = remainingBytes[9:]\n\t\t}\n\t}\n\n\t// Any valid checksum has been stripped off. There is also the case that no\n\t// checksum was written at all, which is ignored as a case - it's needed to\n\t// preserve compatibility with previous persist files.\n\n\t// Parse the json object.\n\treturn json.Unmarshal(remainingBytes, &object)\n}", "title": "" }, { "docid": "060aac47460e51a0faa543af17dab7db", "score": "0.49031484", "text": "func WriteJSON(conn net.Conn, data interface{}) error {\n\tdataBytes, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error marshaling data: %w\", err)\n\t}\n\n\tfor n, totalSent := 0, 0; totalSent < len(dataBytes); totalSent += n {\n\t\tn, err = conn.Write(dataBytes[totalSent:])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error sending data: %w\", err)\n\t\t}\n\n\t\ttotalSent += n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6402fd22a8b2334bfde91e719d48b23f", "score": "0.48961464", "text": "func ReadJSON(uri string, timeout time.Duration, target interface{}) error {\n\tu, err := url.Parse(uri)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar reader io.ReadCloser\n\tswitch u.Scheme {\n\tcase \"http\", \"https\":\n\t\treader, err = newHTTPReader(u.String(), timeout)\n\tcase \"file\":\n\t\treader, err = newFileReader(u.Path)\n\tdefault:\n\t\treturn fmt.Errorf(\"Unsupported URI scheme '%s' in '%s'\", u.Scheme, u)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer reader.Close()\n\treturn json.NewDecoder(reader).Decode(target)\n}", "title": "" }, { "docid": "d98214755ab73455247603f147f80136", "score": "0.48474893", "text": "func (j *jsonReader) Read(ctx context.Context) error {\n\tf, err := os.Open(j.file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\tdec := json.NewDecoder(f)\n\n\t_, err = dec.Token()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// while the array contains values\n\tfor dec.More() {\n\t\tvar it Item\n\t\t// decode an array value (Message)\n\t\terr := dec.Decode(&it)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfor _, fn := range j.callbacks {\n\t\t\tif err = fn(ctx, it); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\t// read closing bracket\n\t_, err = dec.Token()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3a3a47736dac20664d7a8fa90a22fb1b", "score": "0.4844618", "text": "func ReadJSONBody(r *http.Request, schema ozzo.Validatable) {\n\tvar buffer bytes.Buffer\n\n\t// copy request body to in memory buffer while being read\n\treadSplit := io.TeeReader(r.Body, &buffer)\n\tbody, err := ioutil.ReadAll(readSplit)\n\tif err != nil {\n\t\t// never run away with your wife\n\t\tpanic(err)\n\t}\n\n\t// return what you collected\n\tr.Body = ioutil.NopCloser(&buffer)\n\n\tcontent := r.Header.Get(\"Content-Type\")\n\tif content != \"application/json\" || len(body) == 0 {\n\t\t// tell the use all the required attributes\n\t\terr = schema.Validate()\n\t\tif err != nil {\n\t\t\tpanic(APIError{\n\t\t\t\tCode: http.StatusBadRequest,\n\t\t\t\tMessage: \"We could not validate your request.\",\n\t\t\t\tMeta: err,\n\t\t\t})\n\t\t} else {\n\t\t\treturn\n\t\t}\n\t}\n\n\terr = json.Unmarshal(body, &schema)\n\tif err != nil {\n\t\tpanic(APIError{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"We cannot understand your request.\",\n\t\t\tErr: err,\n\t\t})\n\t}\n\n\t// validate parsed JSON data\n\terr = schema.Validate()\n\tif err != nil {\n\t\tpanic(APIError{\n\t\t\tCode: http.StatusBadRequest,\n\t\t\tMessage: \"We could not validate your request.\",\n\t\t\tMeta: err,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "4f53bb8f68cc6399112655bb1be19157", "score": "0.4838449", "text": "func (w WriteRequest) IsRead() bool {\n\treturn false\n}", "title": "" }, { "docid": "4f53bb8f68cc6399112655bb1be19157", "score": "0.4838449", "text": "func (w WriteRequest) IsRead() bool {\n\treturn false\n}", "title": "" }, { "docid": "7430acd796d3fdf3ed8bffbfd6aba3c8", "score": "0.4813902", "text": "func (c *Client) WriteJSON(out interface{}) error {\n\tc.mtx.Lock()\n\tdefer c.mtx.Unlock()\n\treturn c.conn.WriteJSON(out)\n}", "title": "" }, { "docid": "f5e86de0fc9c19de7018da648d9b95df", "score": "0.48049715", "text": "func (r WriteRequest) IsRead() bool {\n\treturn false\n}", "title": "" }, { "docid": "f23a8ac281ed00703d46855d0dd0838f", "score": "0.47972977", "text": "func WriteJSON(w http.ResponseWriter, obj interface{}) error {\n\theader := w.Header()\n\n\theader.Set(\"Content-Type\", \"application/json\")\n\theader.Set(\"Cache-Control\", \"no-cache, no-store, must-revalidate\")\n\theader.Set(\"Pragma\", \"no-cache\")\n\theader.Set(\"Expires\", \"0\")\n\n\tbytes, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tw.Write(bytes)\n\n\treturn nil\n}", "title": "" }, { "docid": "60ebc7ad1199a6f4e9cc9abfcfad67cb", "score": "0.47962272", "text": "func IsJSON(str string) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(str), &js) == nil\n}", "title": "" }, { "docid": "e12fb621d685b6e02b7ae801c4d3a6bc", "score": "0.4789809", "text": "func (s *HTTPSender) SendJSON(o HTTPSendJSONOptions) (err error) {\n\t// Marshal body in\n\tvar bi io.Reader\n\tif o.BodyIn != nil {\n\t\tbb := &bytes.Buffer{}\n\t\tif err = json.NewEncoder(bb).Encode(o.BodyIn); err != nil {\n\t\t\terr = fmt.Errorf(\"astikit: marshaling body in failed: %w\", err)\n\t\t\treturn\n\t\t}\n\t\tbi = bb\n\t}\n\n\t// Create request\n\tvar req *http.Request\n\tif req, err = http.NewRequest(o.Method, o.URL, bi); err != nil {\n\t\terr = fmt.Errorf(\"astikit: creating request failed: %w\", err)\n\t\treturn\n\t}\n\n\t// Update host\n\tif o.Host != \"\" {\n\t\treq.Host = o.Host\n\t}\n\n\t// Add headers\n\tfor k, v := range o.HeadersIn {\n\t\treq.Header.Set(k, v)\n\t}\n\n\t// Send request\n\tvar resp *http.Response\n\tif resp, err = s.Send(req); err != nil {\n\t\terr = fmt.Errorf(\"astikit: sending request failed: %w\", err)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\t// Process headers\n\tif o.HeadersOut != nil {\n\t\to.HeadersOut(resp.Header)\n\t}\n\n\t// Process status code\n\tfn := HTTPSenderDefaultStatusCodeFunc\n\tif o.StatusCodeFunc != nil {\n\t\tfn = o.StatusCodeFunc\n\t}\n\tif err = fn(resp.StatusCode); err != nil {\n\t\t// Try unmarshaling error\n\t\tif o.BodyError != nil {\n\t\t\tif err2 := json.NewDecoder(resp.Body).Decode(o.BodyError); err2 == nil {\n\t\t\t\terr = ErrHTTPSenderUnmarshaledError\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Default error\n\t\terr = fmt.Errorf(\"astikit: validating status code %d failed: %w\", resp.StatusCode, err)\n\t\treturn\n\t}\n\n\t// Unmarshal body out\n\tif o.BodyOut != nil {\n\t\t// Read all\n\t\tvar b []byte\n\t\tif b, err = ioutil.ReadAll(resp.Body); err != nil {\n\t\t\terr = fmt.Errorf(\"astikit: reading all failed: %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\t// Unmarshal\n\t\tif err = json.Unmarshal(b, o.BodyOut); err != nil {\n\t\t\terr = fmt.Errorf(\"astikit: unmarshaling failed: %w (json: %s)\", err, b)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4f2bc986b23dc98540195d2e21fa8914", "score": "0.47779018", "text": "func TestReadFullyJSON(t *testing.T) {\n\tresp := &http.Response{StatusCode: 200, Status: \"OK\", Body: dummyCloser{Reader: strings.NewReader(`{\"a\":\"b\"}`)}}\n\tvar payload struct {\n\t\tA string `json:\"a\"`\n\t}\n\terr := ReadFullyJSON(func() (*http.Response, error) {\n\t\treturn resp, nil\n\t}, &payload)\n\tassert.NoError(t, err)\n\tassert.Equal(t, payload.A, \"b\")\n}", "title": "" }, { "docid": "a0c2a2d99c4b05fec2b381f538bf25aa", "score": "0.47616386", "text": "func writeCheckedJSON(r io.ReadCloser, fileName string) error {\n\treturn writeCheckedFile(r, fileName, func(r io.Reader) error {\n\t\td := json.NewDecoder(r)\n\t\ttmp := map[string]interface{}{}\n\t\treturn d.Decode(&tmp)\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "5d1387c6800a8fa2fedfff02d7923439", "score": "0.47610417", "text": "func checkWireJSON(t *testing.T, in interface{}, reader interface{}, typ byte) {\n\t// test to and from binary\n\tvar err error\n\tjs := wire.JSONBytes(in)\n\tbtyp := fmt.Sprintf(\"[%d,\", typ)\n\tassert.True(t, strings.HasPrefix(string(js), btyp), string(js))\n\n\twire.ReadJSON(reader, js, &err)\n\trequire.Nil(t, err, \"%+v\", err)\n}", "title": "" }, { "docid": "c438eaf6110d7dabe85e6c191e39894d", "score": "0.4755464", "text": "func readJSON(reader io.Reader, data interface{}) error {\n\treturn Serialization.DecoderFactory(reader).Decode(&data)\n}", "title": "" }, { "docid": "81e7eda77f334f29c2b530217990e88d", "score": "0.4722897", "text": "func ReadJSON(path string) ([]byte, error) {\n\tfmt.Println(\"\\nReading \" + path + \"\\n\")\n\tfile, e := ioutil.ReadFile(path)\n\tif e != nil {\n\t\treturn file, errors.New(\"File error: \" + e.Error())\n\t}\n\treturn file, nil\n}", "title": "" }, { "docid": "252fb1e96defc94a6d06ebb89895ba38", "score": "0.47209817", "text": "func (r *Response) JSON(obj interface{}) errors.Error {\n\tblob, err := ioutil.ReadAll(r.Body)\n\n\tif err != nil {\n\t\treturn errors.NewCallout(err.Error())\n\t}\n\n\terr = json.Unmarshal(blob, obj)\n\tif err != nil {\n\t\treturn errors.NewSerializing(err.Error())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bed50d60c8b7ba1fa60e4e0d840939c1", "score": "0.46993396", "text": "func ReadJsonResponse(w *httptest.ResponseRecorder) utils.JSONResponse {\n\tbyt, err := ioutil.ReadAll(w.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tjsResp := utils.JSONResponse{}\n\terr = json.Unmarshal(byt, &jsResp)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn jsResp\n}", "title": "" }, { "docid": "fff0a6358d0b1d6aed997bd0690b53d2", "score": "0.4698796", "text": "func writeJSON(w http.ResponseWriter, b []byte, err error) (int, error) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"http://ui-gmc.localhost\")\n\n\tif err != nil {\n\t\temptyObj, _ := json.Marshal(EmailMessage{})\n\t\tw.Write(emptyObj)\n\t}\n\n\treturn w.Write(b)\n}", "title": "" }, { "docid": "6223b9a880b18a615e59d2736bb45569", "score": "0.46948814", "text": "func (d *DynJSONValue) IsJSON() bool {\n\treturn true\n}", "title": "" }, { "docid": "60088cb3f40667cef4534c498b39f453", "score": "0.46676862", "text": "func HandleJSON(b []byte) ([]byte, error) {\n\tobj, err := AsJson(b)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Do what you will with the JSON object here\n\t// Inject a response into the struct and send it back\n\tobj.Response = \"Handled\"\n\t// ...\n\t// ...\n\t// ...\n\treturn AsByte(obj)\n}", "title": "" }, { "docid": "da75f26332b238a5a0aca0f280a7e0f1", "score": "0.4664441", "text": "func checkJSON(t *testing.T, want string, got []byte) {\n\tstr := string(got)\n\tif str == want {\n\t\tOk(t, \"check JSON\")\n\t\treturn\n\t}\n\tKo(t, \"Marshaled data does not match expectations.\\nWant: %s\\nGot: %s\", want, str)\n\treturn\n}", "title": "" }, { "docid": "824df7a65b72914123cd91929684db5d", "score": "0.4664145", "text": "func readJSON(v interface{}, r *http.Request) (b []byte, err error) {\n\tbody := r.Body\n\tdefer body.Close()\n\tb, err = ioutil.ReadAll(body)\n\tif err != nil {\n\t\tglog.Errorln(err)\n\t\treturn\n\t}\n\terr = json.Unmarshal(b, v)\n\tif err != nil {\n\t\tglog.Warningln(err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ce387c0dd45d7227759ee3e811670b84", "score": "0.46637493", "text": "func ReadJSONToBytes(filePath string) (s []byte, err error) {\n\n\tif _, err = os.Stat(filePath); os.IsNotExist(err) {\n\t\treturn\n\t}\n\n\tvar raw []byte\n\n\traw, err = ioutil.ReadFile(filePath)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\ts = raw\n\n\treturn\n}", "title": "" }, { "docid": "67b526685eb761b20fedec418fb863d8", "score": "0.46404672", "text": "func _readJSON(r io.Reader, i interface{}) error {\n\treturn json.NewDecoder(r).Decode(&i)\n}", "title": "" }, { "docid": "b74700c3faabe0660de3152840dad4ea", "score": "0.46381006", "text": "func IsJSON(value interface{}) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(toString(value)), &js) == nil\n}", "title": "" }, { "docid": "8f996818450f327b15485c06a5a7d303", "score": "0.46012303", "text": "func (ms *MixnetServer) jsonReceive(rw http.ResponseWriter, req *http.Request) {\n\tcontents, err := ioutil.ReadAll(req.Body)\n\treq.Body.Close()\n\tif err != nil {\n\t\thttp.Error(rw, fmt.Sprintf(\"couldn't read request: %s\", err.Error()), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tputReq := &pb.PutOnionsRequest{}\n\tif err := protojson.Unmarshal(contents, putReq); err != nil {\n\t\thttp.Error(rw, fmt.Sprintf(\"couldn't parse request: %s\", err.Error()), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err := ms.Receive(putReq); err != nil {\n\t\thttp.Error(rw, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\trw.WriteHeader(http.StatusAccepted)\n}", "title": "" }, { "docid": "a30026bc5e84a661da437de04eaa1aab", "score": "0.45928562", "text": "func (h *HTTPRequest) DoJSON() (err error) {\n\th.Client.Timeout = h.Timeout\n\n\tif h.Method == \"\" {\n\t\th.Method = \"GET\"\n\t}\n\n\tif h.ReqBody != nil {\n\t\t// We have a request to send to the server\n\t\tbuf := new(bytes.Buffer)\n\t\terr = json.NewEncoder(buf).Encode(h.ReqBody)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\th.Request, err = http.NewRequest(h.Method, h.URL, buf)\n\t} else {\n\t\t// Just gimme dem datas\n\t\th.Request, err = http.NewRequest(h.Method, h.URL, nil)\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\th.Request.Header.Set(\"Content-Type\", \"application/json\")\n\n\tres, err := h.Client.Do(h.Request)\n\tif res != nil {\n\t\tdefer res.Body.Close()\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif h.ResBody != nil && res.Body != nil {\n\t\treturn json.NewDecoder(res.Body).Decode(&h.ResBody)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "184e674bf7f1b4381857c8eed018d07b", "score": "0.45887768", "text": "func isJSON(str string) bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(str), &js) == nil\n}", "title": "" }, { "docid": "df81330951006bf081bea7d03e9026d4", "score": "0.45863685", "text": "func ReadJSON(fn string, v interface{}) error {\n\tfile, err := os.Open(fn)\n\tdefer file.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdecoder := json.NewDecoder(file)\n\treturn decoder.Decode(v)\n}", "title": "" }, { "docid": "ba2ad560e3dfe26c6979cf2dd5cc143d", "score": "0.45856917", "text": "func (mr *MockConnMockRecorder) ReadJSON(v interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ReadJSON\", reflect.TypeOf((*MockConn)(nil).ReadJSON), v)\n}", "title": "" }, { "docid": "b84e52165a8c7b803e458f1cc5e098db", "score": "0.45808005", "text": "func SerializeJson(obj interface{}) io.ReadCloser {\n\tvar buf bytes.Buffer\n\t_ = json.NewEncoder(&buf).Encode(obj)\n\treturn ioutil.NopCloser(&buf)\n}", "title": "" }, { "docid": "e878ba168145da851459fe888505bb6a", "score": "0.45743564", "text": "func (r ReadRequest) IsRead() bool {\n\treturn true\n}", "title": "" }, { "docid": "34cfb654ddfc10f54689e1a21735cd33", "score": "0.45717424", "text": "func (w *Watcher) tryRead(fd int, pcb *aiocb) bool {\n\tbuf := pcb.buffer\n\n\tvar useSwap bool\n\tif buf == nil { // internal buffer\n\t\tbuf = w.swapBuffer[w.nextSwapBuffer]\n\t\tuseSwap = true\n\t}\n\n\tfor {\n\t\t// return values are stored in pcb\n\t\tpcb.size, pcb.err = syscall.Read(fd, buf)\n\t\tif pcb.err == syscall.EAGAIN {\n\t\t\treturn false\n\t\t}\n\n\t\t// On MacOS we can see EINTR here if the user\n\t\t// pressed ^Z.\n\t\tif pcb.err == syscall.EINTR {\n\t\t\tcontinue\n\t\t}\n\t\tbreak\n\t}\n\n\t// IO completed\n\tif useSwap {\n\t\tpcb.buffer = buf\n\t\tpcb.useSwap = true\n\t\tw.nextSwapBuffer = (w.nextSwapBuffer + 1) % len(w.swapBuffer)\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "3600da3a017f5a01c68530050b2aee3f", "score": "0.45626384", "text": "func (c *Client) Read() {\n\n\t// if function finish, remove client\n\t// and also close connection\n\tdefer func() {\n\t\tc.Manager.Unregister <- c\n\t\tc.Conn.Close()\n\t}()\n\n\tfor {\n\t\t// read message from client\n\t\t_, msg, err := c.Conn.ReadMessage()\n\t\tif err != nil {\n\t\t\tc.Manager.Unregister <- c\n\t\t\tc.Conn.Close()\n\t\t\tbreak\n\t\t}\n\n\t\tvar message Message\n\t\terr = json.Unmarshal(msg, &message)\n\t\tif err != nil {\n\t\t\tc.Manager.Unregister <- c\n\t\t\tc.Conn.Close()\n\t\t\tbreak\n\t\t}\n\n\t\t// send broadcast\n\t\tc.Manager.BroadCast <- &message\n\n\t}\n\n}", "title": "" }, { "docid": "4db955a87640d5d25d4aa1821cbfbd57", "score": "0.4562515", "text": "func (apim *Bundle) IsPayloadJSON() bool {\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(apim.Payload), &js) == nil\n}", "title": "" }, { "docid": "60f7af2c70d54eba82641b1aca8db89f", "score": "0.45617342", "text": "func IsJSON(s string) bool {\n\tif s == \"\" {\n\t\treturn false\n\t}\n\n\tvar js json.RawMessage\n\treturn json.Unmarshal([]byte(s), &js) == nil\n}", "title": "" }, { "docid": "24f4fa62e52a3f937cb44ab77dbdf7f2", "score": "0.4559597", "text": "func SendJSON(w io.Writer, op string, body interface{}) {\n\tlogger := logging.Logger\n\tres := toResponse(body, op)\n\terr := json.NewEncoder(w).Encode(res)\n\tif err != nil {\n\t\tlogger.Error(\"could not encode json response\", zap.Error(err))\n\t}\n}", "title": "" }, { "docid": "09ef9658cd52242f15fcc731f43137f8", "score": "0.45570144", "text": "func (nd *NetData) OpenJSON(filename gi.FileName) error {\n\tfp, err := os.Open(string(filename))\n\tdefer fp.Close()\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\text := filepath.Ext(string(filename))\n\tif ext == \".gz\" {\n\t\tgzr, err := gzip.NewReader(fp)\n\t\tdefer gzr.Close()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t\treturn nd.ReadJSON(gzr)\n\t} else {\n\t\treturn nd.ReadJSON(bufio.NewReader(fp))\n\t}\n}", "title": "" }, { "docid": "9731ee3c4c83cb229fa9c8eee9bd921d", "score": "0.4548808", "text": "func WriteJSON(w http.ResponseWriter, obj interface{}) error {\n\twriteContentType(w, jsonContentType)\n\tjsonBytes, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn err\n\t}\n\tjsonBytes = append(jsonBytes, '\\n')\n\t_, err = w.Write(jsonBytes)\n\treturn err\n}", "title": "" }, { "docid": "d05db1e4703b1f85c7de09888f343af5", "score": "0.45378497", "text": "func Read(r *http.Request, body interface{}) error {\n\tb, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn json.Unmarshal(b, body)\n}", "title": "" }, { "docid": "8e4e3359134b53a018eaa842c823f6d0", "score": "0.45329815", "text": "func JSONWrite(w http.ResponseWriter, status int, content interface{}) error {\n\tNewHeader().ContentType().JSON().Write(w.Header())\n\tw.WriteHeader(status)\n\tif content != nil {\n\t\terr := json.NewEncoder(w).Encode(content)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a946c7a927a1229b8ed0f32adeac684", "score": "0.45221868", "text": "func isJSON(s []byte) bool {\n\tvar js map[string]interface{}\n\treturn json.Unmarshal(s, &js) == nil\n}", "title": "" }, { "docid": "1dc89ee26156dbb638b900adf64c645f", "score": "0.4517649", "text": "func (m *MockConn) ReadJSON(v interface{}) error {\n\tret := m.ctrl.Call(m, \"ReadJSON\", v)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e4bdbf3258fac5138da950ccc530dfb2", "score": "0.4516027", "text": "func readJSON(r *http.Request, v interface{}) error {\n\terr := json.NewDecoder(r.Body).Decode(v)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid JSON input\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7c9e5b969915e877a7f28fbf66efb7df", "score": "0.45092598", "text": "func (p *Proxy) handleRead(resp http.ResponseWriter, req *http.Request, lc *lazyConn, connOut net.Conn, waitForData bool) {\n\tif lc.hitEOF {\n\t\t// We hit EOF on the server while processing a previous request,\n\t\t// immediately return EOF to the client\n\t\tresp.Header().Set(X_ENPROXY_EOF, \"true\")\n\t\t// Echo back connection id (for debugging purposes)\n\t\tresp.Header().Set(X_ENPROXY_ID, lc.id)\n\t\tresp.WriteHeader(200)\n\t\treturn\n\t}\n\n\t// Get clientIp for reporting stats\n\tclientIp := clientIpFor(req)\n\n\tb := make([]byte, p.ReadBufferSize)\n\tfirst := true\n\thaveRead := false\n\tbytesInBatch := 0\n\tlastReadTime := time.Now()\n\tfor {\n\t\treadDeadline := time.Now().Add(p.FlushTimeout)\n\t\tif err := connOut.SetReadDeadline(readDeadline); err != nil {\n\t\t\tlog.Debugf(\"Unable to set read deadline: %v\", err)\n\t\t}\n\n\t\t// Read\n\t\tn, readErr := connOut.Read(b)\n\t\tif first {\n\t\t\tif readErr == io.EOF {\n\t\t\t\t// Reached EOF, tell client using a special header\n\t\t\t\tresp.Header().Set(X_ENPROXY_EOF, \"true\")\n\t\t\t}\n\t\t\t// Echo back connection id (for debugging purposes)\n\t\t\tresp.Header().Set(X_ENPROXY_ID, lc.id)\n\t\t\t// Always respond 200 OK\n\t\t\tresp.WriteHeader(200)\n\t\t\tfirst = false\n\t\t}\n\n\t\t// Write if necessary\n\t\tif n > 0 {\n\t\t\tif clientIp != \"\" && p.OnBytesSent != nil && n > 0 {\n\t\t\t\tp.OnBytesSent(clientIp, lc.addr, req, int64(n))\n\t\t\t}\n\n\t\t\thaveRead = true\n\t\t\tlastReadTime = time.Now()\n\t\t\tbytesInBatch = bytesInBatch + n\n\t\t\t_, writeErr := resp.Write(b[:n])\n\t\t\tif writeErr != nil {\n\t\t\t\tlog.Errorf(\"Error writing to response: %s\", writeErr)\n\t\t\t\tif err := connOut.Close(); err != nil {\n\t\t\t\t\tlog.Debugf(\"Unable to close out connection: %v\", err)\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Inspect readErr to decide whether or not to continue reading\n\t\tif readErr != nil {\n\t\t\tswitch e := readErr.(type) {\n\t\t\tcase net.Error:\n\t\t\t\tif e.Timeout() {\n\t\t\t\t\tif n == 0 {\n\t\t\t\t\t\t// We didn't read anything, might be time to return to\n\t\t\t\t\t\t// client\n\t\t\t\t\t\tif !waitForData {\n\t\t\t\t\t\t\t// We're not supposed to wait for data, so just\n\t\t\t\t\t\t\t// return right away\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif haveRead {\n\t\t\t\t\t\t\t// We've read some data, so return right away so\n\t\t\t\t\t\t\t// that client doesn't have to wait\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tif readErr == io.EOF {\n\t\t\t\t\tlc.hitEOF = true\n\t\t\t\t} else {\n\t\t\t\t\tlog.Errorf(\"Unexpected error reading from upstream: %s\", readErr)\n\t\t\t\t\t// TODO: probably want to close connOut right away\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tif time.Now().Sub(lastReadTime) > 10*time.Second {\n\t\t\t// We've spent more than 10 seconds without reading, return so that\n\t\t\t// CloudFlare doesn't time us out\n\t\t\t// TODO: Fastly has much more configurable timeouts, might be able to bump this up\n\t\t\treturn\n\t\t}\n\n\t\tif bytesInBatch > p.BytesBeforeFlush {\n\t\t\t// We've read a good chunk, flush the response to keep its buffer\n\t\t\t// from getting too big.\n\t\t\tresp.(http.Flusher).Flush()\n\t\t\tbytesInBatch = 0\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bcc4c06eddf4f0841af27e26a856f4b6", "score": "0.4502216", "text": "func WriteJSONOk(w http.ResponseWriter, data interface{}) error {\n\terr := JSONEncoder(w, data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6be686a6c2c6d7a31a832165b29175fd", "score": "0.44954374", "text": "func (c *Client) Read() {\n\tdefer c.socket.Close()\n\tfor {\n\t\tvar msg *Message\n\t\terr := c.socket.ReadJSON(&msg)\n\t\tif err != nil {\n\t\t\tlog.Print(err)\n\t\t\treturn\n\t\t}\n\n\t\tmsg.ID = uuid.New().String()\n\t\tmsg.Room = c.room\n\t\tmsg.LoginID = c.user.GetUserLoginID()\n\t\tmsg.CreateAt = time.Now().UTC()\n\t\tc.hub.broadcast <- msg\n\t\t// // send message to save in another channel\n\t\t// *c.save <- *sm\n\t}\n}", "title": "" }, { "docid": "c701fd3804a3247dcc514fac9cbb0cec", "score": "0.44881234", "text": "func (impl *Implementation) ReadJSON(ctx context.Context, bucketName, path string) (map[string]interface{}, error) {\n\tif ctx.Value(MockSuccess) != nil {\n\t\treturn map[string]interface{}{}, nil\n\t}\n\tif ctx.Value(MockError) != nil {\n\t\treturn nil, errors.New(\"\")\n\t}\n\n\tvar control map[string]interface{}\n\ttext, err := impl.ReadText(ctx, bucketName, path)\n\tif err == nil {\n\t\tjson.Unmarshal([]byte(text), &control)\n\t}\n\tif control == nil {\n\t\tcontrol = map[string]interface{}{}\n\t}\n\treturn control, nil\n}", "title": "" }, { "docid": "4070f49aa8dabad3ebb49450a1df4265", "score": "0.4487145", "text": "func isJSON(s []byte) (bool, map[string]interface{}) {\n\tvar js map[string]interface{}\n\treturn json.Unmarshal([]byte(s), &js) == nil, js\n}", "title": "" }, { "docid": "dc9562878f2427e1cf47e0db9dbd5a8f", "score": "0.44805214", "text": "func ReadJson(filename string, interf interface{}) {\n\ttextFileBytes, err := ioutil.ReadFile(filename)\n\tCheck(err, \"ioutil.ReadFile!\")\n\n\terr = json.Unmarshal(textFileBytes, &interf)\n\tCheck(err, \"json.Unmarshal!\")\n}", "title": "" }, { "docid": "3008f73b568b41bb483b40667a3d3647", "score": "0.4474408", "text": "func IsJSON() bool {\n\n\tflag := pflag.Lookup(\"o\")\n\tif flag != nil && flag.Changed {\n\t\treturn strings.Contains(pflag.Lookup(\"o\").Value.String(), \"json\")\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "924bb2bc369f8931ae154f391440aafb", "score": "0.44706723", "text": "func writeJSON(w http.ResponseWriter, obj interface{}, status int) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tenc := json.NewEncoder(w)\n\tenc.Encode(obj)\n}", "title": "" }, { "docid": "75a07aa75c42842589c3b311ec65a706", "score": "0.44614872", "text": "func (j *JSONOutput) WriteJSON(out io.Writer, value any) (bool, error) {\n\tif !j.Enabled {\n\t\treturn false, nil\n\t}\n\n\tenc := json.NewEncoder(out)\n\tenc.SetIndent(\"\", \" \")\n\treturn true, enc.Encode(value)\n}", "title": "" }, { "docid": "cca03b75e1b598cd5fb82f28d4d62a7d", "score": "0.44547892", "text": "func readJSON(decoder *json.Decoder) []interface{} {\n\treturns := make([]interface{}, 0)\n\tvar jsonVal interface{}\n\tfor decoder.More() {\n\t\tdecoder.Decode(&jsonVal)\n\t\treturns = append(returns, jsonVal)\n\t\tif isAtRequest(jsonVal) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn returns\n}", "title": "" }, { "docid": "38968b2d0a560e077bc8f6e10a04a51e", "score": "0.4453327", "text": "func (j JSON) ReadBody(r *http.Request) error {\n\tif err := json.NewDecoder(r.Body).Decode(j.Val); err != nil {\n\t\treturn ReadError{err}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7966b5cd4a164c20f7731d7efa3e397e", "score": "0.44348612", "text": "func (vr *ValidationRules) IsJSON() *ValidationRules {\n\tvr.Rules = append(vr.Rules, ValidationRule{\n\t\tRule: is.JSON.Error(\"api.msg.error.validation.must_be_json\"),\n\t\tRuleOpt: nil,\n\t})\n\treturn vr\n}", "title": "" }, { "docid": "bafa8d480064e8d2afc1d197e8791774", "score": "0.44339544", "text": "func WithJSON(body io.Reader) Option {\n\treturn optionFunc(func(c *Config) {\n\t\tif c.ClientConfig.Body != nil {\n\t\t\tpanic(\"body is already set, enable to set body only once\") // xxx\n\t\t}\n\t\tc.ClientConfig.Body = body\n\t\tc.ModifyRequests = append(c.ModifyRequests, func(req *http.Request) {\n\t\t\treq.Header.Set(\"Content-Type\", \"application/json\")\n\t\t})\n\t})\n}", "title": "" }, { "docid": "b8e1b59ff9bea35d18f8e0e31909a45a", "score": "0.44330615", "text": "func (o *OptionalBool) ReadFromJSONReader(r *jreader.Reader) {\n\tval, nonNull := r.BoolOrNull()\n\tif r.Error() == nil {\n\t\tif nonNull {\n\t\t\t*o = NewOptionalBool(val)\n\t\t} else {\n\t\t\t*o = OptionalBool{}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e362d54c43a101a89add135c826b0ce3", "score": "0.44255748", "text": "func (f *FileSystem) LoadFromJSON(data []byte) (bool, error) {\n\terr := json.Unmarshal(data, &f)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "1ea768b41e14922257755742a9a122c9", "score": "0.44177485", "text": "func CompareJSONReaderBytes(r io.Reader, expect []byte) error {\n\tif r == nil {\n\t\treturn fmt.Errorf(\"missing body\")\n\t}\n\tactual, err := ioutil.ReadAll(r)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to read, %v\", err)\n\t}\n\n\tif err := JSONEqual(expect, actual); err != nil {\n\t\treturn fmt.Errorf(\"JSON documents not equal, %v\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "980fb4c8eb7426ab83ff697439bf65ec", "score": "0.44154847", "text": "func ReadJSONResponse(resp *http.Response, v interface{}) error {\n\tdefer resp.Body.Close()\n\n\tswitch {\n\tcase resp.StatusCode < 200, resp.StatusCode > 299:\n\t\treturn NewResponseErrorf(resp, \"Invalid status code: %d\", resp.StatusCode)\n\tcase v == nil:\n\t\treturn nil\n\tdefault:\n\t\tif err := json.NewDecoder(resp.Body).Decode(v); err != nil {\n\t\t\treturn NewResponseError(resp, err.Error())\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bc5e213939b28db45c67bd88dc110f9c", "score": "0.4411626", "text": "func (r *JSONReader) Close(ctx context.Context) error {\n\tif r.closer != nil {\n\t\terr := r.closer.Close()\n\t\tr.closer = nil\n\n\t\treturn err\n\t}\n\treturn errors.New(\"already closed\")\n}", "title": "" }, { "docid": "544508c2bcb9dbca16f8a554714372c3", "score": "0.4409191", "text": "func WriteJSON(w http.ResponseWriter, obj interface{}, status int) {\n\tbuffer, err := json.MarshalIndent(obj, \"\", \" \")\n\tif err != nil {\n\t\tlog.Println(\"Internal server error while converting object to json: \", obj)\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tSetCORSHeaders(w)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(status)\n\tw.Write(buffer)\n}", "title": "" }, { "docid": "b275df7fc113c57dc46907ccb129d174", "score": "0.44067904", "text": "func checkJson(j interface{}, tst JsonTest) (bool, error) {\n\n\tvar match bool\n\tvar failReasons error\n\n\t// Unmarshall generic decoding:\n\t// - interface{} = strings, integers, and booleans,\n\t// - []interface{} = arrays,\n\t// - map[string]interface{} for objects\n\t//\n\t// See http://stackoverflow.com/a/22470287 &&\n\t// http://blog.golang.org/json-and-go\n\n\tswitch t := j.(type) {\n\n\t// We have a JSON array\n\t// eg. [\"one\", \"two\", \"three\"]\n\tcase []interface{}:\n\t\tfor _, v := range t {\n\t\t\tvar result bool\n\t\t\t// FIXME: Need to pass the key name with the value.\n\t\t\tresult, failReasons = checkJson(v, tst)\n\t\t\tmatch = match || result\n\t\t}\n\n\t// We have further JSON objects to decode\n\t// eg. {\"obj1\": {\"obj2\": {\"key\": \"value\"}}}\n\tcase map[string]interface{}:\n\t\tjsn := j.(map[string]interface{})\n\n\t\t// If jsn has the key we're looking for. Test it.\n\t\tif jsn[tst.key] != nil {\n\n\t\t\tmatch, failReasons = checkJsonValue(jsn, tst)\n\n\t\t} else { // Do further unzipping. There might be more objects.\n\t\t\tmatch = false\n\n\t\t\tfor _, v := range t {\n\t\t\t\tresult, err := checkJson(v, tst)\n\t\t\t\tmatch = match || result\n\t\t\t\tif err != nil {\n\t\t\t\t\tfailReasons = err\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\treturn match, failReasons\n}", "title": "" }, { "docid": "597d20511f6a38a6f2173ecd73fbf9dc", "score": "0.44067407", "text": "func (c *Client) listenRead() {\n\t// log.Println(\"Listening read from client\")\n\tc.server.wg.Add(1)\n\tdefer func() {\n\t\t// log.Println(c.entity.Id(), \" listenRead exited\")\n\t\tc.server.wg.Done()\n\t}()\n\tfor {\n\t\tselect {\n\n\t\t// receive done request\n\t\tcase <-c.doneCh:\n\t\t\tc.ws.Close()\n\t\t\tc.server.Del(c)\n\t\t\t// c.doneCh <- true // for listenWrite method\n\t\t\treturn\n\n\t\t// read data from websocket connection\n\t\tdefault:\n\t\t\tmsg := c.NewMsg()\n\t\t\terr := websocket.JSON.Receive(c.ws, &msg.Payload)\n\t\t\tif err != nil {\n\t\t\t\tc.doneCh <- true\n\t\t\t\treturn\n\n\t\t\t} else {\n\t\t\t\t// log.Printf(\"%+v\", msg)\n\t\t\t\tc.entitySyncMutex.Lock()\n\t\t\t\tent := c.entity\n\t\t\t\tc.entitySyncMutex.Unlock()\n\n\t\t\t\tif ent.Enabled() {\n\t\t\t\t\tmsg_frwd, to_self, stop := c.entity.HandleIncomingMsg(&msg)\n\t\t\t\t\tif stop == false {\n\t\t\t\t\t\tc.server.ForwardMsg(&msg)\n\t\t\t\t\t}\n\t\t\t\t\tif to_self != nil {\n\t\t\t\t\t\tc.Write(c.server.NewServerMsg(to_self.Payload))\n\t\t\t\t\t}\n\t\t\t\t\tif msg_frwd != nil {\n\t\t\t\t\t\tc.server.ForwardMsg(msg_frwd)\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}", "title": "" } ]
0612cd4d749d0a0054c777eb61554baa
NewCounter returns a counter. Observations are aggregated and emitted once per write invocation.
[ { "docid": "26c0e1deb82dce445bc9cbd21d2c93b3", "score": "0.74843454", "text": "func (cw *CloudWatch) NewCounter(name string) metrics.Counter {\n\tcw.mtx.Lock()\n\tdefer cw.mtx.Unlock()\n\tc := &counter{c: generic.NewCounter(name)}\n\tcw.counters[name] = c\n\treturn c\n}", "title": "" } ]
[ { "docid": "da36627e0c5688ad30c6df64cf9f7cc4", "score": "0.79406846", "text": "func NewCounter() Counter {\n\treturn &counter{\n\t\toccurrences: make(map[string]int),\n\t}\n}", "title": "" }, { "docid": "d28b96dc0af86f28786563b0c2361e3c", "score": "0.7842036", "text": "func NewCounter() *Counter{\n\treturn &Counter{}\n}", "title": "" }, { "docid": "cc65a1dbb05a4a7363f92fcdf4755fb9", "score": "0.78150797", "text": "func NewCounter() *Counter {\n\treturn &Counter{\n\t\tn: 0,\n\t\tlastT: UTCNow(),\n\t\tlastN: 0,\n\t}\n}", "title": "" }, { "docid": "65fc2cd9bcff0091aedd3dfa27d1fdc4", "score": "0.77491975", "text": "func New() *Counter {\n\tc := Counter{\n\t\tdata: make(Data),\n\t\tinc: make(chan string, 100),\n\t\tdo: make(chan func(Data), 100),\n\t}\n\tgo c.worker()\n\treturn &c\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "a65e191a9fb0f8defdd781aa0bd57401", "score": "0.7733629", "text": "func NewCounter() *Counter {\n\treturn &Counter{}\n}", "title": "" }, { "docid": "2790bb75de93896a5ccee299d514c99f", "score": "0.75713074", "text": "func NewCounter(initial int) *Counter {\n\treturn &Counter{value: initial, allTimeValue: initial, lastRAR: time.Now()}\n}", "title": "" }, { "docid": "edbd9f256f1188887bb4d11c48527896", "score": "0.75569123", "text": "func NewCounter(name string) Counter {\n\tc := &GenericCounter{}\n\tPublish(name, c)\n\treturn c\n}", "title": "" }, { "docid": "0d65093d0169901e4b66a8d89419ed21", "score": "0.74808997", "text": "func NewCounter(ns, n string) *Counter {\n\tmn := newName(ns, n)\n\treturn &Counter{\n\t\tname: mn,\n\t}\n}", "title": "" }, { "docid": "012a00441b88d54f48ba0f996d47b7c9", "score": "0.74750423", "text": "func NewCounter(name string, help string) *Counter {\n\tv := &Counter{help: help}\n\tif name != \"\" {\n\t\tpublish(name, v)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "3603dc884bff492b56487837627b52c5", "score": "0.73821783", "text": "func NewCounter(namespace, name string) Counter {\n\treturn Counter{metrics.NewCounter(namespace, name)}\n}", "title": "" }, { "docid": "c6147dba12f9aad0b04d3f5cdcbe5600", "score": "0.7379758", "text": "func NewCounter() *Counter {\n\tvs := NewValues(func() interface{} { return new(cval) })\n\treturn &Counter{vs: vs}\n}", "title": "" }, { "docid": "00aa2b4ee91d1abe654153c07247059c", "score": "0.73593014", "text": "func newCounter(name string) *counter {\r\n\treturn &counter{Name: name}\r\n}", "title": "" }, { "docid": "1273aaa6ee030251b8ab3657e4a536a9", "score": "0.73499316", "text": "func (c *Circonus) NewCounter(name string) *Counter {\n\treturn &Counter{\n\t\tname: name,\n\t\tm: c.m,\n\t}\n}", "title": "" }, { "docid": "80702c1b26046230718f8a207bdd1fac", "score": "0.7296489", "text": "func NewCounter(tel *Telemetry, name string, duration time.Duration) *Counter {\n\tcount := Counter{\n\t\tName: name,\n\t\tvalue: 0,\n\t\tpoints: make(map[time.Time]float64),\n\t\tduration: duration,\n\t}\n\ttel.lock.Lock()\n\tdefer tel.lock.Unlock()\n\ttel.registry[name] = &count\n\treturn &count\n}", "title": "" }, { "docid": "c04c1806ef40a36d50decc06620ed03e", "score": "0.7254886", "text": "func NewCounter(name, desc string, labelNames []string) Counter {\n\treturn exporter.NewCounter(name, desc, labelNames)\n}", "title": "" }, { "docid": "fe7b3f467cb9704fcae8ad62aaba8202", "score": "0.72175306", "text": "func New(w io.Writer) *CountingWriter {\n\treturn &CountingWriter{\n\t\twriter: w,\n\t\tbytesWritten: 0,\n\t}\n}", "title": "" }, { "docid": "bb973841478a1baa82bd1d0aba123567", "score": "0.71933746", "text": "func New() *Counter {\n\tdict := make(map[key]count)\n\tcounter := Counter(dict)\n\treturn &counter\n}", "title": "" }, { "docid": "e113ec9a9f9f0e7e4089df458f28927e", "score": "0.7192822", "text": "func NewCounter(name, service string) (*Int, error) {\n\treturn &Int{\n\t\tData: &MetricData{\n\t\t\tName: name,\n\t\t\tservice: service,\n\t\t},\n\t}, nil\n}", "title": "" }, { "docid": "8b1a941d48e835ea2261690118a89be0", "score": "0.7181074", "text": "func newCounter() func() int {\n\tn := 0\n\treturn func() int {\n\t\tn++\n\t\treturn n\n\t}\n}", "title": "" }, { "docid": "ce1ea795fcac635357481e7185f1cb2e", "score": "0.7134195", "text": "func NewWriteCounter(writer io.Writer) WriteCounter {\n\treturn &counter{\n\t\twriter: writer,\n\t}\n}", "title": "" }, { "docid": "b7d0be5b1e6782a0a5b8f7d935ae6061", "score": "0.7128773", "text": "func NewCounter(name string, opts ...MOption) *Counter {\n\treturn default_client.NewCounter(name, opts...)\n}", "title": "" }, { "docid": "a982b9a0e46598dc438c9fc27fbaa202", "score": "0.71044856", "text": "func NewCounter(client *redis.Client, prefix string, period, interval time.Duration) *Counter {\n\treturn &Counter{\n\t\tclient: client,\n\t\tpfx: prefix,\n\t\tperiod: period,\n\t\tinterval: interval,\n\t\tbkts: int(period/interval) * 2,\n\t}\n}", "title": "" }, { "docid": "121880f952f91d4d1099d87b815d87e7", "score": "0.70859265", "text": "func NewResponseWriterCounter(rw http.ResponseWriter) *ResponseWriterCounter {\n\treturn &ResponseWriterCounter{\n\t\tResponseWriter: rw,\n\t\tstarted: time.Now(),\n\t}\n}", "title": "" }, { "docid": "f5e181f6ccc7b01d5dc0450656ceb26b", "score": "0.70454806", "text": "func NewCounter(name, desc string, fields ...string) metrics.Counter {\n\tm := prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tName: name,\n\t\tHelp: desc,\n\t}, fields)\n\tprometheus.MustRegister(m)\n\treturn &counterMetric{\n\t\tname: name,\n\t\tfields: map[string]bool{},\n\t\tmet: m,\n\t}\n}", "title": "" }, { "docid": "1f319c1a80ad285a4ec319a8f9352e7e", "score": "0.7023967", "text": "func NewCounter(opts prometheus.CounterOpts) prometheus.Counter {\n\topts.ConstLabels = constLabels\n\treturn prometheus.NewCounter(opts)\n}", "title": "" }, { "docid": "829c1af0fb51f30119d7e83a332e7bcc", "score": "0.69507354", "text": "func NewCounter(scope string) *Counter {\n\tcounter := make([][]map[uint64]map[uint64]int, actionLen)\n\tfor i := range counter {\n\t\tcounter[i] = make([]map[uint64]map[uint64]int, filtersLen)\n\t\tfor k := range counter[i] {\n\t\t\tcounter[i][k] = make(map[uint64]map[uint64]int)\n\t\t}\n\t}\n\treturn &Counter{counter: counter, scope: scope}\n}", "title": "" }, { "docid": "692cf50b5beb25a615a15706d9011b18", "score": "0.69450957", "text": "func (p graphiteProvider) NewCounter(name, _ string) metrics.Counter {\n\treturn p.e.NewCounter(name)\n}", "title": "" }, { "docid": "13ef717984773e42f504dd9c90034761", "score": "0.69106346", "text": "func NewCounter(subscriber wire.EventSubscriber) *Counter {\n\tsc := &Counter{}\n\tsubscriber.SubscribeCallback(string(topics.AcceptedBlock), sc.decrement)\n\treturn sc\n}", "title": "" }, { "docid": "4b3684b4e414ec53f5a0003ee428dc79", "score": "0.69042146", "text": "func NewCounter(metadata metric.Metadata, childLabels ...string) *AggCounter {\n\tc := &AggCounter{g: *metric.NewCounter(metadata)}\n\tc.init(childLabels)\n\treturn c\n}", "title": "" }, { "docid": "a961701c24bf19915a21b418cb49ccd6", "score": "0.68642515", "text": "func NewCounter(opts prometheus.CounterOpts, prec uint) prometheus.Counter {\n\treturn NewFixedPrecisionCounter(opts, prec)\n}", "title": "" }, { "docid": "2cffbcaadf458cedf7aed77e9c6c72f0", "score": "0.686007", "text": "func (p *Provider) NewCounter(name string) metrics.Counter {\n\treturn p.newCounter(prefixName(p.prefix, name), p.defaultTags...)\n}", "title": "" }, { "docid": "2a270b64bb461cd95906d84e0899b98e", "score": "0.68248034", "text": "func NewReadWriteCounter(rw io.ReadWriter) ReadWriteCounter {\n\treturn &counter{\n\t\treader: rw,\n\t\twriter: rw,\n\t}\n}", "title": "" }, { "docid": "d603735653b0a3d9258020bdcd1bc8ba", "score": "0.68037254", "text": "func NewCounter(mod *libbpfgo.Module, name string, counter prometheus.Counter) (*Counter, error) {\n\tc := &Counter{\n\t\tdoorbellCh: make(chan []byte, chanSize),\n\t\tcounter: counter,\n\t}\n\n\tvar err error\n\n\tc.arr, err = mod.GetMap(name + counterSuffix)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tc.doorbellBuf, err = mod.InitRingBuf(name+doorbellSuffix, c.doorbellCh)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tc.doorbellBuf.Start()\n\n\tc.wg.Add(1)\n\tgo c.loop()\n\n\treturn c, nil\n}", "title": "" }, { "docid": "d1b2e7c5a88035aef98a5b8f8fd729ff", "score": "0.6766554", "text": "func NewCounterHandler(name string, path string) *Counter {\n\tcount := uint64(0)\n\n\tif counterStore.counterMap[name] != 0 {\n\t\tcount = counterStore.counterMap[name]\n\t}\n\n\treturn &Counter{\n\t\tname: name,\n\t\tpath: path,\n\t\tcount: count,\n\t\tstore: counterStore,\n\t}\n}", "title": "" }, { "docid": "afae8ebfa4e8466e8ac922c20e237ea9", "score": "0.6743198", "text": "func (p dogstatsdProvider) NewCounter(name, _ string) metrics.Counter {\n\treturn p.e.NewCounter(name)\n}", "title": "" }, { "docid": "038e1eedaf7b43018b768879dc2f8edd", "score": "0.6692939", "text": "func NewCountingWriter(out io.Writer) *CountingWriter {\n\treturn &CountingWriter{\n\t\t0, out,\n\t}\n}", "title": "" }, { "docid": "b08465c1b59cd7e78a89d38276238e96", "score": "0.6692588", "text": "func CreateCounter(id string, data MetricMetadata) {\n\tCounters[id] = counterData{\n\t\tCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\tNamespace: data.Namespace,\n\t\t\tName: data.Name,\n\t\t\tHelp: data.Help,\n\t\t}),\n\t\tIncChannel: make(chan int),\n\t}\n\tprometheus.MustRegister(Counters[id].Counter)\n\tgo func(cd counterData) {\n\t\tfor {\n\t\t\t<-cd.IncChannel\n\t\t\tcd.Counter.Inc()\n\t\t}\n\t}(Counters[id])\n}", "title": "" }, { "docid": "4b726cfe201704fca95a5086382cb270", "score": "0.6687994", "text": "func (p statsdProvider) NewCounter(name, _ string) metrics.Counter {\n\treturn p.e.NewCounter(name)\n}", "title": "" }, { "docid": "049d82cfe3de4ef11c287ed7aa857368", "score": "0.6646438", "text": "func NewCounterFunc(name string, help string, Mf MetricFunc) *CounterFunc {\n\tc := &CounterFunc{\n\t\tMf: Mf,\n\t\thelp: help,\n\t}\n\n\tif name != \"\" {\n\t\tpublish(name, c)\n\t}\n\treturn c\n}", "title": "" }, { "docid": "5f5cdc55f161a6fdf9405346862603e5", "score": "0.66373104", "text": "func createCounter(initial int) func() int {\n\tif initial < 0 {\n\t\tinitial = 0\n\t}\n\n\treturn func() int {\n\t\tinitial++\n\t\treturn initial\n\t}\n}", "title": "" }, { "docid": "d4b9309d2be6b413c408b2d49be6b24b", "score": "0.6635619", "text": "func NewCounter(name string, metricDims DimMap) Counter {\n\treturn globalEnv.NewCounter(name, metricDims)\n}", "title": "" }, { "docid": "b79e2ea464ba1991ae1802a14d49b53f", "score": "0.662474", "text": "func NewCounters(port int, active bool) *Counters {\n\treturn &Counters{port: port, active: active}\n}", "title": "" }, { "docid": "5c90f37d752269549d30afc26515d63c", "score": "0.66105026", "text": "func NewCounter(name, subsystem, help string, labels []string) Counter {\n\treturn prmkit.NewCounterFrom(prometheus.CounterOpts{Namespace: Namespace, Subsystem: subsystem, Name: name, Help: help}, labels)\n}", "title": "" }, { "docid": "513f1c456ca7a9fd1bd3a6555d054c76", "score": "0.6559714", "text": "func (p expvarProvider) NewCounter(name, _ string) metrics.Counter {\n\treturn kitexp.NewCounter(p.prefix + name)\n}", "title": "" }, { "docid": "6fd634c7b93e39c806d361270a83ae7a", "score": "0.653839", "text": "func (service *Service) NewCounter(opts prometheus.CounterOpts) prometheus.Counter {\n\tc := prometheus.NewCounter(opts)\n\tservice.MustRegister(c)\n\treturn c\n}", "title": "" }, { "docid": "f9c2a7920ced8761958e570316235261", "score": "0.65134746", "text": "func (c *counterClient) Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error) {\n\tout := new(CreateResponse)\n\terr := c.cc.Invoke(ctx, \"/atomix.runtime.counter.v1.Counter/Create\", in, out, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "53deb1c89c86c45850fbbdaa89d17682", "score": "0.6493983", "text": "func (p lowCardinalityWrappedProvider) NewCounter(name string) metrics.Counter {\n\treturn counter{\n\t\tCounter: p.Provider.NewCounter(name),\n\t\tlabelsToInclude: p.labelsToInclude,\n\t}\n}", "title": "" }, { "docid": "f8596907607eb1d993657ea142a56be5", "score": "0.6453873", "text": "func NewCounter(sub, name, help string, labels ...string) (*prometheus.CounterVec, error) {\n\tcnt := prometheus.NewCounterVec(\n\t\tprometheus.CounterOpts{\n\t\t\tNamespace: namespace,\n\t\t\tSubsystem: sub,\n\t\t\tName: name,\n\t\t\tHelp: help,\n\t\t},\n\t\tlabels,\n\t)\n\n\tif err := prometheus.Register(cnt); err != nil {\n\t\tif _, ok := err.(prometheus.AlreadyRegisteredError); !ok {\n\t\t\treturn nil, errors.Wrap(err, \"failed to register consumer error metrics\")\n\t\t}\n\t}\n\treturn cnt, nil\n}", "title": "" }, { "docid": "b1a0fa142021e013689583ea25977026", "score": "0.6446513", "text": "func NewCountWriter(out io.Writer) *CountWriter {\n\treturn &CountWriter{NewWriter(out), 0}\n}", "title": "" }, { "docid": "401e7a1290d32d802dbaa88ca6326c9f", "score": "0.6404406", "text": "func (c *CounterClient) Create() *CounterCreate {\n\tmutation := newCounterMutation(c.config, OpCreate)\n\treturn &CounterCreate{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "8346f8cd72a8ecf3eefae220d87204cd", "score": "0.6403486", "text": "func NewCounter(name string, labels []string) CounterBundle {\n\treturn CounterBundle{\n\t\tc: promauto.NewCounterVec(prometheus.CounterOpts{\n\t\t\tName: name,\n\t\t}, labels),\n\t}\n}", "title": "" }, { "docid": "b87bbaaefb04d33c0ef1cc944e8b85ff", "score": "0.6399797", "text": "func New(value int) alertCounter {\n return alertCounter(value)\n}", "title": "" }, { "docid": "d7a45e1487aa39f34dd5591bd6b5c464", "score": "0.6378482", "text": "func New(value int) alertCounter {\n\treturn alertCounter(value)\n}", "title": "" }, { "docid": "90fc8c8d4f4bd0fcd6f377c9ee9f3bef", "score": "0.62876934", "text": "func Counter(category, name string) CounterMetric {\n\treturn newCounter(category, name, false)\n}", "title": "" }, { "docid": "af712028b7054c6d29ab3ff36d2e3940", "score": "0.62540823", "text": "func (mex *MetricsExposer) CreateCounter(name, description string) metrics.Counter {\n\tcounter := prometheus.NewCounter(prometheus.CounterOpts{\n\t\tName: name,\n\t\tHelp: description,\n\t})\n\n\tmex.register(counter)\n\n\treturn &Counter{\n\t\tmetric: metric{\n\t\t\tname: name,\n\t\t\tdescription: description,\n\t\t},\n\t\tc: counter,\n\t}\n}", "title": "" }, { "docid": "c9a23ee3024546b8feb44203aefc3725", "score": "0.6210134", "text": "func NewCount() *Count {\n\treturn &Count{}\n}", "title": "" }, { "docid": "0f4e0d38e20881b29349ac9f39509ae4", "score": "0.619536", "text": "func newRetryCounter() *retryCounter {\n\treturn &retryCounter{\n\t\tMaxRetries: defaultMaxRetries,\n\t\tMaxRetryDelay: defaultMaxRetryDelay,\n\t\tcount: make(map[string]int),\n\t}\n}", "title": "" }, { "docid": "172ab0797dd31bb10cc8d70960c23b00", "score": "0.6162918", "text": "func NewReadCounter(r io.Reader) ReadCounter {\n\treturn &counter{\n\t\treader: r,\n\t}\n}", "title": "" }, { "docid": "44220dce76d0326e520400750dcadedf", "score": "0.6092339", "text": "func CountingWriter(w io.Writer) (io.Writer, *int64) {\n bc := ByteCounter2 {\n Writer: w,\n Count: 0,\n }\n \n return &bc, &bc.Count\n}", "title": "" }, { "docid": "45de130586aa6ba4653943943c3da8eb", "score": "0.6064022", "text": "func NewRotateCounter(rotatePoint int64) (*RotateCounter, error) {\n\tif rotatePoint <= 0 {\n\t\treturn nil, fmt.Errorf(\"rotatePoint should bigger than 0, but got %v\", rotatePoint)\n\t}\n\tc := &RotateCounter{\n\t\trotatePoint: rotatePoint,\n\t\tc: make(chan int64, rotateCounterChanLength),\n\t}\n\tgo c.runGenerator()\n\treturn c, nil\n}", "title": "" }, { "docid": "a3f88bfddd3d966ddd59d5656a37744a", "score": "0.60224795", "text": "func New() *Incrementer {\n\ti := new(Incrementer)\n\ti.max = ^uint(0)\n\ti.mu = new(sync.RWMutex)\n\treturn i\n}", "title": "" }, { "docid": "fcdb74f6c28c75c484e29218cacb7a82", "score": "0.602129", "text": "func NewMockCounter(ctrl *gomock.Controller) *MockCounter {\n\tmock := &MockCounter{ctrl: ctrl}\n\tmock.recorder = &MockCounterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "c1cd603356d6770802eb330e53f494d1", "score": "0.5999884", "text": "func (c *StatusCounter) Create() error {\n\tdesc := &monitoring.MetricDescriptor{\n\t\tType: StatusCountMetric,\n\t\tLabels: []*monitoring.LabelDescriptor{\n\t\t\t&monitoring.LabelDescriptor{\n\t\t\t\tKey: \"response_code\",\n\t\t\t\tValueType: \"INT64\",\n\t\t\t\tDescription: \"HTTP status code\",\n\t\t\t},\n\t\t},\n\t\tMetricKind: \"CUMULATIVE\",\n\t\tValueType: \"INT64\",\n\t\tDescription: \"Cumulative count of HTTP responses by status code.\",\n\t}\n\n\tif err := c.CreateMetricCallback(c.projectSpec, desc); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a50f61aedec6ac4d694c3341aee48c6d", "score": "0.5970025", "text": "func (r *Recorder) Counter(name string, tags ...Tag) Counter {\n\tm := r.Get(name)\n\tif m == nil {\n\t\tm = &RecorderCounter{RecorderMetric: RecorderMetric{name, tags}}\n\t\tr.register(name, m)\n\t}\n\n\treturn m.(Counter)\n}", "title": "" }, { "docid": "a9ba76f56581176717c78f274b42c939", "score": "0.59448713", "text": "func RegisterNewMetricsCounter(name string, help string) prometheus.Counter {\n\treturn promauto.NewCounter(prometheus.CounterOpts{\n\t\tName: name,\n\t\tHelp: help,\n\t})\n}", "title": "" }, { "docid": "3c1f80f3fc3fe16c70a6c246efe69ac4", "score": "0.59441817", "text": "func RegisterNewGaugeCounter(name string, help string) prometheus.Gauge {\n\treturn promauto.NewGauge(prometheus.GaugeOpts{\n\t\tName: name,\n\t\tHelp: help,\n\t})\n}", "title": "" }, { "docid": "efc6a70557981c04fc5b19bd72d833f3", "score": "0.5943269", "text": "func (c *Counters) CreateCounter(name, help string, lables []string) (*Counter, error) {\n\tcounter := prometheus.NewCounterVec(prometheus.CounterOpts{\n\t\tName: name,\n\t\tHelp: help,\n\t}, lables)\n\terr := prometheus.Register(counter)\n\treturn &Counter{counter: counter, active: c.active}, err\n}", "title": "" }, { "docid": "ead825ca140f14c5f076540e955aca0d", "score": "0.59226537", "text": "func StartCounter() *Counter {\n\tgen := genserver.New(\"Counter\")\n\treturn &Counter{gen: gen, number: 0}\n}", "title": "" }, { "docid": "9c8cbbe6d4d0c2ac5b31a6a3d5ce16e2", "score": "0.5913339", "text": "func GetNextCounter(resource string) (int, error) {\n\tsession := mongo.GetMongoSession()\n\tdatabase := mongo.GetDatabase()\n\tdefer session.Close()\n\tcounterCollection := session.DB(database).C(collection)\n\tquery := bson.M{\"resource\": resource}\n\tupdate := mgo.Change{\n\t\tUpdate: bson.M{\"$inc\": bson.M{\"c\": 1}},\n\t\tReturnNew: true,\n\t\tUpsert: true,\n\t}\n\tcounter := model.Counter{}\n\t_, err := counterCollection.Find(query).Apply(update, &counter)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\treturn counter.C, err\n}", "title": "" }, { "docid": "9f8eb2667cd54a6b7c28231096e26513", "score": "0.59119236", "text": "func NewReadCounter(r io.Reader) *ReadCounter {\n\treturn &ReadCounter{\n\t\tr: r,\n\t}\n}", "title": "" }, { "docid": "7a793902175fc8cce33f2a570c108588", "score": "0.5906392", "text": "func Constructor() HitCounter {\n\treturn HitCounter{\n\t\thead: MaxNumCounts - 1,\n\t\tvHead: MaxNumCounts,\n\t\ttail: 0,\n\t\tvTail: 1,\n\t\tcounts: make([]int, MaxNumCounts),\n\t}\n}", "title": "" }, { "docid": "9db06e586b784e9610775790b8e5e31f", "score": "0.5830356", "text": "func NewAtomicCounter(initial ...int64) AtomicCounter {\n\tc := &atomicCounter{}\n\tc.value = arity.SoleUntyped(int64(0), initial).(int64)\n\tc.notify = make(chan int, 1)\n\treturn c\n}", "title": "" }, { "docid": "0ba96ec9daf3836beb335a0d2087db7e", "score": "0.58243376", "text": "func NewReaderCounter(r io.ReadCloser) *ReaderCounter {\n\treturn &ReaderCounter{\n\t\tr: r,\n\t}\n}", "title": "" }, { "docid": "0a2b3be0331756d9c6fda91e50b0ff38", "score": "0.58004445", "text": "func CountingWriter(w io.Writer) (io.Writer, *int64) {\n\tcw := CustomWriter{0, w}\n\treturn &cw, &cw.length\n}", "title": "" }, { "docid": "e6ed7ee9c3352873d31eb3f0f697b718", "score": "0.5794386", "text": "func NewStringCounter(search string) *StringCounter {\n\treturn &StringCounter{searchString: search}\n}", "title": "" }, { "docid": "3d2a96077194e2ea6e279cf228c1ebf8", "score": "0.57881975", "text": "func (service *Service) NewCounterFunc(opts prometheus.CounterOpts, function func() float64) prometheus.CounterFunc {\n\tg := prometheus.NewCounterFunc(opts, function)\n\tservice.MustRegister(g)\n\treturn g\n}", "title": "" }, { "docid": "9d1934acdb0ffd64d7e013e0e100bf6f", "score": "0.5775118", "text": "func CountingWriter(w io.Writer) (io.Writer, *int64) {\n\tvar counter Counter\n\tcounter.writer = w\n\treturn &counter, &counter.count\n}", "title": "" }, { "docid": "60dc099b63928a0ba4c5d2b390ca705b", "score": "0.5742833", "text": "func NewWindowedCounter(duration time.Duration) *WindowedCounter {\n\treturn &WindowedCounter{\n\t\tcurrent: &Counter{start: time.Now().UTC(), duration: duration},\n\t}\n}", "title": "" }, { "docid": "40ef4f341d87b1cc74960106fe5b9992", "score": "0.57374054", "text": "func NewMockTagsAwareCounter(ctrl *gomock.Controller) *MockTagsAwareCounter {\n\tmock := &MockTagsAwareCounter{ctrl: ctrl}\n\tmock.recorder = &MockTagsAwareCounterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "3bd0f88f7ee65553fa25ec16e33ded01", "score": "0.57322013", "text": "func NewVoteCounter(initialVotes int) *int {\n\treturn &initialVotes\n}", "title": "" }, { "docid": "bce63b89cb1495b1e8f3663938486afa", "score": "0.5731885", "text": "func CreateCounters(data map[string]MetricMetadata) {\n\tfor k, v := range data {\n\t\tCounters[k] = counterData{\n\t\t\tCounter: prometheus.NewCounter(prometheus.CounterOpts{\n\t\t\t\tNamespace: v.Namespace,\n\t\t\t\tName: v.Name,\n\t\t\t\tHelp: v.Help,\n\t\t\t}),\n\t\t\tIncChannel: make(chan int),\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dd0b8dd648c99fe0f9aab89d0e0ead5a", "score": "0.5699623", "text": "func NewCount(count int32) *Count {\n\tcountTemp := Count{\n\t\ttdCommon: tdCommon{Type: \"count\"},\n\t\tCount: count,\n\t}\n\n\treturn &countTemp\n}", "title": "" }, { "docid": "f709938e87103e24faeec4203ebf5519", "score": "0.5698921", "text": "func NewCounterFromN(n int64) *Counter {\n\treturn &Counter{\n\t\tn: n,\n\t}\n}", "title": "" }, { "docid": "03f860701800d2e33b405b007bb72958", "score": "0.56831074", "text": "func NewCountConn(idb *mgo.Database) *CountConn {\n\treturn &CountConn{\n\t\tdb: idb,\n\t\tcl: idb.C(countsCL),\n\t}\n}", "title": "" }, { "docid": "7cba5c4cf612976044fee5c46bd11dea", "score": "0.56432605", "text": "func CountingWriter(w io.Writer) (io.Writer, *int64){\n\tvar counter int64\n\tnewWriter := countingWriter{\n\t\tcount: &counter,\n\t\tw: w,\n\t}\n\n\treturn newWriter, newWriter.count\n}", "title": "" }, { "docid": "968a9ea4f67018b5701a2228a8b27be4", "score": "0.56352645", "text": "func NewRollingCounter(bucketWidth time.Duration, numBuckets int, now time.Time) RollingCounter {\n\treturn faststats.NewRollingCounter(bucketWidth, numBuckets, now)\n}", "title": "" }, { "docid": "be80e11e5e8019b60b602e0633a85b7f", "score": "0.56212735", "text": "func (p *dataDogLambdaPublisher) Counter(name string, tags ...Tag) Counter {\n\treturn &publisherCounter{publisherMetric{name: name, tags: tags, nf: p.notify}}\n}", "title": "" }, { "docid": "b8e1e2a280cb2ffebe1120f0381cae1b", "score": "0.5620075", "text": "func NewLicenseRequestCounter(capacity int) interface {\n\tIncrement(license domain.ID) uint32\n\tRollback(license domain.ID)\n} {\n\treturn &lrCounter{\n\t\tpool: make([]uint32, 0, capacity),\n\t\tidx: make(map[domain.ID]int, capacity),\n\t}\n}", "title": "" }, { "docid": "7dfda55d8992e875f494a91a3f0b23d7", "score": "0.55808437", "text": "func New(writersC, iterC, arrSize int) *Writer {\n\treturn &Writer{\n\t\twritersCount: writersC,\n\t\titerCount: iterC,\n\t\tarrSize: arrSize,\n\t}\n}", "title": "" }, { "docid": "bc70617f626b56c896d727191f70b52b", "score": "0.5576502", "text": "func NewTokenCounter(r TokenReader) TokenReader {\n\treturn &tokenCounter{r: r}\n}", "title": "" }, { "docid": "6baada7962ae2dc998960b18eb165150", "score": "0.5568552", "text": "func counter(w http.ResponseWriter, r *http.Request) {\n\tcount := c.get()\n\n\tfmt.Fprintf(w, \"Count %d\\n\", count)\n}", "title": "" }, { "docid": "819fe0f74220632477c772bfee44787f", "score": "0.55618703", "text": "func NewCount(n *onet.TreeNodeInstance) (onet.ProtocolInstance, error) {\n\tp := &ProtocolCount{\n\t\tTreeNodeInstance: n,\n\t\tQuit: make(chan bool),\n\t\ttimeout: 1024,\n\t}\n\tp.Count = make(chan int, 1)\n\tif err := p.RegisterChannel(&p.CountChan); err != nil {\n\t\tlog.Error(\"Couldn't reister channel:\", err)\n\t}\n\tif err := p.RegisterChannel(&p.PrepareCountChan); err != nil {\n\t\tlog.Error(\"Couldn't reister channel:\", err)\n\t}\n\tif err := p.RegisterChannel(&p.NodeIsUpChan); err != nil {\n\t\tlog.Error(\"Couldn't reister channel:\", err)\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "0546b5941969cf691ebcead864fba03e", "score": "0.5552878", "text": "func NewStatusCounter(project string, resource *monitoring.MonitoredResource, service *monitoring.Service) *StatusCounter {\n\treturn &StatusCounter{\n\t\tprojectSpec: projectResourceSpec(project),\n\t\tresource: resource,\n\t\tcounts: make(map[string]int64),\n\t\tresetTime: time.Now(),\n\t\tCreateMetricCallback: func(projectSpec string, desc *monitoring.MetricDescriptor) error {\n\t\t\t_, err := service.Projects.MetricDescriptors.Create(projectSpec, desc).Do()\n\t\t\treturn err\n\t\t},\n\t\tCreateTimeSeriesCallback: func(projectSpec string, req *monitoring.CreateTimeSeriesRequest) error {\n\t\t\t_, err := service.Projects.TimeSeries.Create(projectSpec, req).Do()\n\t\t\treturn err\n\t\t},\n\t}\n}", "title": "" }, { "docid": "6217d33a8e870d310153df0be7628c45", "score": "0.5528416", "text": "func (muo *ModelUpdateOne) AddCounter(i int64) *ModelUpdateOne {\n\tmuo.mutation.AddCounter(i)\n\treturn muo\n}", "title": "" } ]
fac54a5504fb023186957ed360c5ee72
NewTokenList creates a new instance of TokenList, bound to a specific deployed contract.
[ { "docid": "f3482c03b7d3649f88d39f42cd7807e8", "score": "0.67632055", "text": "func NewTokenList(address common.Address, backend bind.ContractBackend) (*TokenList, error) {\n\tcontract, err := bindTokenList(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenList{TokenListCaller: TokenListCaller{contract: contract}, TokenListTransactor: TokenListTransactor{contract: contract}, TokenListFilterer: TokenListFilterer{contract: contract}}, nil\n}", "title": "" } ]
[ { "docid": "a2975347060f745429df998c814700d5", "score": "0.6253707", "text": "func bindTokenList(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TokenListABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "0d09c85eb5398ec54a329469517ddc9c", "score": "0.610705", "text": "func NewTokenListCaller(address common.Address, caller bind.ContractCaller) (*TokenListCaller, error) {\n\tcontract, err := bindTokenList(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenListCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "438efffd18ba1c4332d53ac2268bd598", "score": "0.59642905", "text": "func NewITokenList(address common.Address, backend bind.ContractBackend) (*ITokenList, error) {\n\tcontract, err := bindITokenList(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ITokenList{ITokenListCaller: ITokenListCaller{contract: contract}, ITokenListTransactor: ITokenListTransactor{contract: contract}, ITokenListFilterer: ITokenListFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "f1319393b5740cac839629eecde715a4", "score": "0.5908641", "text": "func DeployTokenList(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *TokenList, error) {\n\tparsed, err := abi.JSON(strings.NewReader(TokenListABI))\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(TokenListBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &TokenList{TokenListCaller: TokenListCaller{contract: contract}, TokenListTransactor: TokenListTransactor{contract: contract}, TokenListFilterer: TokenListFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "3b5f87b60505c58f272f14d45cf29298", "score": "0.58520955", "text": "func NewList(client *secretsapi.Client, p listPrimeable) *List {\n\treturn &List{\n\t\tsecretsClient: client,\n\t\tout: p.Output(),\n\t\tproj: p.Project(),\n\t\tcfg: p.Config(),\n\t\tauth: p.Auth(),\n\t}\n}", "title": "" }, { "docid": "6516ff5e74cacd4a3f001940ef010866", "score": "0.58386135", "text": "func NewListCommand(parent cmd.Registerer, globals *config.Data, data manifest.Data) *ListCommand {\n\tvar c ListCommand\n\tc.CmdClause = parent.Command(\"list\", \"List API tokens\")\n\tc.Globals = globals\n\tc.manifest = data\n\tc.CmdClause.Flag(\"customer-id\", \"Alphanumeric string identifying the customer\").StringVar(&c.customerID)\n\treturn &c\n}", "title": "" }, { "docid": "8d012a1db03fbff0a40ca4fd8c5a17d3", "score": "0.5832603", "text": "func NewTokenListTransactor(address common.Address, transactor bind.ContractTransactor) (*TokenListTransactor, error) {\n\tcontract, err := bindTokenList(address, nil, transactor, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenListTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "3d84d112df7549fbda3dfd8b62406f6d", "score": "0.5826397", "text": "func NewGetNFTContractTokensList(ctx *middleware.Context, handler GetNFTContractTokensListHandler) *GetNFTContractTokensList {\n\treturn &GetNFTContractTokensList{Context: ctx, Handler: handler}\n}", "title": "" }, { "docid": "451362adaf8b2b0a8846c569536dc9d6", "score": "0.5676608", "text": "func (vm *VM) NewList() (*ListHandle, error) {\n\tif vm.vm == nil {\n\t\treturn nil, &NilVMError{}\n\t}\n\tC.wrenEnsureSlots(vm.vm, 1)\n\tC.wrenSetSlotNewList(vm.vm, 0)\n\tvalue := vm.getSlotValue(0)\n\tlistHandle, ok := value.(*ListHandle)\n\tif !ok {\n\t\treturn nil, &UnexpectedValue{Value: value}\n\t}\n\treturn listHandle, nil\n}", "title": "" }, { "docid": "bcc361e03162a4fd4a86b3003875d4e2", "score": "0.5618987", "text": "func New() *List { return new(List) }", "title": "" }, { "docid": "ca043df5a55f32446f6375bf9e54af2f", "score": "0.5592569", "text": "func (_ShadowTokenListManager *ShadowTokenListManagerCaller) TokenList(opts *bind.CallOpts) (common.Address, error) {\n\tvar out []interface{}\n\terr := _ShadowTokenListManager.contract.Call(opts, &out, \"tokenList\")\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "509c00b53b940f1758ee79fddb8ce780", "score": "0.5573678", "text": "func newList() *list {\n\n\treturn &list{\n\t\tlength: 0,\n\t\thead: nil,\n\t\ttail: nil,\n\t}\n}", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.5553196", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.5553196", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "c75fc07d765f617b35ad522762fa7afe", "score": "0.5553196", "text": "func New() *List { return new(List).Init() }", "title": "" }, { "docid": "3646726d6db623e87f31c6ee981039eb", "score": "0.5552275", "text": "func NewList(cli CLI, version string, repo repository.Repository) Command {\n\treturn &List{cli: cli, repo: repo}\n}", "title": "" }, { "docid": "cdf2d6d26f5e9c19905ee646af23188b", "score": "0.55488795", "text": "func NewTOKENMANAGEMENT(config configuration.CONFIGURATION) *TOKENMANAGEMENT_IMPL {\n client := new(TOKENMANAGEMENT_IMPL)\n client.config = config\n return client\n}", "title": "" }, { "docid": "f959198448a34ec186bdbca1857211fe", "score": "0.5539417", "text": "func NewList(accountID int) List {\n\treturn List{\n\t\taccountID: accountID,\n\t}\n}", "title": "" }, { "docid": "e02d0168c3fd3e03be82d444d99202ce", "score": "0.55349445", "text": "func NewThingList() *ThingList { return new(ThingList).Init() }", "title": "" }, { "docid": "22e7db3c8ade89b4bda639ceb3ada927", "score": "0.5510829", "text": "func NewListCommand(parent cmd.Registerer, globals *config.Data) *ListCommand {\n\tvar c ListCommand\n\tc.Globals = globals\n\tc.CmdClause = parent.Command(\"list\", \"List Fastly services\")\n\t// no flags, because ListServicesInput has no fields\n\treturn &c\n}", "title": "" }, { "docid": "4f7592bbc332ceb3af8353635645e62e", "score": "0.5502304", "text": "func (r *REST) NewList() runtime.Object {\n\treturn &creator_v1.ServiceList{}\n}", "title": "" }, { "docid": "461e61857e224be70b180a2929e3a279", "score": "0.5498325", "text": "func NewContractList(cl *types.ContractList, repo repository.Repository) *ContractList {\n\treturn &ContractList{\n\t\trepo: repo,\n\t\tlist: cl,\n\t}\n}", "title": "" }, { "docid": "33080c9b43100a185076c220d303809a", "score": "0.54833305", "text": "func NewTodoTaskList()(*TodoTaskList) {\n m := &TodoTaskList{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "407baa2cac47dc006dcb47fdaa1b47b5", "score": "0.5458756", "text": "func (rs *TokenRoute) CreateNewToken(tok *Models.Token) error {\n\treturn nil\n}", "title": "" }, { "docid": "eb26b617b3c0cdd53cd2b4df8e610922", "score": "0.5442853", "text": "func ListNew() *List {\n return &List{0, nil, nil}\n}", "title": "" }, { "docid": "199c9bacc1fe778a9379b7e6e46ab453", "score": "0.5435986", "text": "func newList(es ...Expression) list {\n\treturn list{es}\n}", "title": "" }, { "docid": "6a0fc2304457686329232093428398f7", "score": "0.54311055", "text": "func newList() *list {\n\treturn &list{make(map[Object]int), make(ObjectList, 0)}\n}", "title": "" }, { "docid": "0c75e299abbe563056170c514c46ed8b", "score": "0.54265743", "text": "func createNewTokens(client clientset.Interface, tokens []BootstrapToken) error {\n\treturn updateOrCreateTokens(client, true, tokens)\n}", "title": "" }, { "docid": "7e3f8ae8a7d89f1fbef6b176112645fb", "score": "0.54264367", "text": "func (m *Mokta) NewToken(clientID string) (string, error) {\n\treturn m.NewCustomToken(OktaToken{\n\t\tm.publicKeyID,\n\t\tm.serverID,\n\t\t500,\n\t\tclientID,\n\t\t[]string{\"bcda_api\"},\n\t\tclientID,\n\t})\n}", "title": "" }, { "docid": "434350ae84b6754a7a60d7c7ab9f594f", "score": "0.5416194", "text": "func newList(ctx TransactionContextInterface) *list {\n\tstateList := new(ledgerapi.StateList)\n\tstateList.Ctx = ctx\n\tstateList.Name = \"org.papernet.commercialpaperlist\"\n\tstateList.Deserialize = func(bytes []byte, state ledgerapi.StateInterface) error {\n\t\treturn Deserialize(bytes, state.(*CommercialPaper))\n\t}\n\n\tlist := new(list)\n\tlist.stateList = stateList\n\n\treturn list\n}", "title": "" }, { "docid": "2d80169c5ed360227036b8f9006a22f1", "score": "0.5399317", "text": "func (_TokenCashier *TokenCashierSession) TokenLists(arg0 *big.Int) (common.Address, error) {\n\treturn _TokenCashier.Contract.TokenLists(&_TokenCashier.CallOpts, arg0)\n}", "title": "" }, { "docid": "ee65a7dc67454405832c353c684815d6", "score": "0.5381406", "text": "func NewTreeList(proj *Project) (newTree *DepTree) {\n\tcreated := make(map[string]*DepService)\n\tnewTree = &DepTree{CurrNode: nil}\n\tfor i := range proj.Services {\n\t\tlog.Println(\"Finding a spot in the tree for\", proj.Services[i].conf.Name)\n\t\tif _, ok := created[proj.Services[i].conf.Name]; ok {\n\t\t\tcontinue\n\t\t}\n\t\tdepSrv := &DepService{build: proj.Services[i], Children: make(map[string]*DepService)}\n\t\tif len(depSrv.build.conf.DependsOn) != 0 {\n\t\t\tgetDependencies(depSrv, newTree, created, proj)\n\t\t} else if newTree.CurrNode == nil {\n\t\t\tnewTree.CurrNode = depSrv\n\t\t} else {\n\t\t\tnewTree.CurrNode.Children[depSrv.build.conf.Name] = depSrv\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1144bd7db573676896131b43f3136905", "score": "0.5374682", "text": "func Create(p *conekta.TokenParams) (*conekta.Token, error) {\n\ttk := &conekta.Token{}\n\th := map[string]string{\n\t\t\"Authorization\": \"Basic \" + base64.StdEncoding.EncodeToString([]byte(conekta.PubliAPIKey)),\n\t\t\"Conekta-Client-User-Agent\": \"{\\\"agent\\\":\\\"Conekta JavascriptBindings/0.3.0\\\"}\",\n\t\t\"RaiseHtmlError\": \"false\",\n\t\t\"Accept\": \"application/vnd.conekta-v0.3.0+json\",\n\t}\n\tconekta.MakeRequest(\"POST\", \"/tokens\", p, tk, h)\n\tif tk.Object == \"error\" {\n\t\treturn nil, &conekta.Error{\n\t\t\tErrorType: tk.Type,\n\t\t\tDetails: []conekta.ErrorDetails{\n\t\t\t\t{\n\t\t\t\t\tMessage: tk.Message,\n\t\t\t\t\tMessageToPurchaser: tk.MessageToPurchaser,\n\t\t\t\t\tParam: tk.Param,\n\t\t\t\t\tCode: tk.Code,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\treturn tk, nil\n}", "title": "" }, { "docid": "5bb7434ead5b41ff25d3276dbe9bce79", "score": "0.53327304", "text": "func (r *REST) NewList() runtime.Object {\n\treturn r.store.NewListFunc()\n}", "title": "" }, { "docid": "5bb7434ead5b41ff25d3276dbe9bce79", "score": "0.53327304", "text": "func (r *REST) NewList() runtime.Object {\n\treturn r.store.NewListFunc()\n}", "title": "" }, { "docid": "2086c7d4370d2963092de297a4f33b54", "score": "0.53266585", "text": "func (_TokenCashier *TokenCashierCaller) TokenLists(opts *bind.CallOpts, arg0 *big.Int) (common.Address, error) {\n\tvar out []interface{}\n\terr := _TokenCashier.contract.Call(opts, &out, \"tokenLists\", arg0)\n\n\tif err != nil {\n\t\treturn *new(common.Address), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "4362005143bd13148ab851f9cde3785a", "score": "0.5322895", "text": "func NewList(bucketName string) List {\n\treturn &MyList{\n\t\tbucketName,\n\t}\n}", "title": "" }, { "docid": "f9f996a8c8e61835856271197411e073", "score": "0.5312947", "text": "func NewList() *List {\n\treturn &List{\" \", []Expression{}}\n}", "title": "" }, { "docid": "714148ae09a12af546a00392764706f8", "score": "0.5312705", "text": "func (_ShadowTokenListManager *ShadowTokenListManagerSession) TokenList() (common.Address, error) {\n\treturn _ShadowTokenListManager.Contract.TokenList(&_ShadowTokenListManager.CallOpts)\n}", "title": "" }, { "docid": "15b3f7c77ae17b5027d0baa816c586be", "score": "0.52859795", "text": "func NewListCommand(parent common.Registerer, globals *config.Data) *ListCommand {\n\tvar c ListCommand\n\tc.Globals = globals\n\tc.manifest.File.SetOutput(c.Globals.Output)\n\tc.manifest.File.Read(manifest.Filename)\n\tc.CmdClause = parent.Command(\"list\", \"List Kafka endpoints on a Fastly service version\")\n\tc.CmdClause.Flag(\"service-id\", \"Service ID\").Short('s').StringVar(&c.manifest.Flag.ServiceID)\n\tc.CmdClause.Flag(\"version\", \"Number of service version\").Required().IntVar(&c.Input.ServiceVersion)\n\treturn &c\n}", "title": "" }, { "docid": "7509d0248b2fbf5ffb2dad1359109a0e", "score": "0.5281776", "text": "func newTxList(strict bool) *_TrxList {\n\treturn &_TrxList{\n\t\tstrict: strict,\n\t\ttrxs: newTrxSortedMap(),\n\t\tcostcap: new(big.Int),\n\t}\n}", "title": "" }, { "docid": "37503edec0eb9500d59d9a64580c5bd7", "score": "0.5277294", "text": "func createNewMembershipList() *MembershipList {\n\t// initialize the membership list, used when the process is born\n\tvar mbl MembershipList\n\tmbl.Lock = &sync.Mutex{}\n\tmbl.Members = []membershipEntry{{HOSTNAME, time.Now().Unix(), 0, true, 2}}\n\treturn &mbl\n}", "title": "" }, { "docid": "f98bf51e1ad83fef695440c7d4a648c5", "score": "0.52750343", "text": "func (_ShadowTokenListManager *ShadowTokenListManagerCallerSession) TokenList() (common.Address, error) {\n\treturn _ShadowTokenListManager.Contract.TokenList(&_ShadowTokenListManager.CallOpts)\n}", "title": "" }, { "docid": "511c4ac13b74fab6879556634db458c7", "score": "0.52644265", "text": "func New(ctx context.Context, db *database.RevisionDB, cacheDuration time.Duration, minTokenSize uint) (*TokenManager, error) {\n\tif cacheDuration > 60*time.Minute {\n\t\treturn nil, fmt.Errorf(\"cache duration must be <= 60 minutes, got: %v\", cacheDuration)\n\t}\n\tnow := time.Now()\n\ttm := &TokenManager{\n\t\tdb: db,\n\t\tallowed: make(map[int64]*database.RevisionKey),\n\t\tminTokenSize: int(minTokenSize),\n\t\tcacheDuration: cacheDuration,\n\t\tcacheRefreshAfter: now.Add(-2 * cacheDuration),\n\t}\n\tif err := tm.maybeRefreshCache(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\treturn tm, nil\n}", "title": "" }, { "docid": "df45ea8d4dd158973355efb40751f89a", "score": "0.526087", "text": "func (def *Definition) NewToken(data interface{}) (isecuritystt.Token, error) {\n\tvar token isecuritystt.Token\n\tvar err error\n\tif _ijwt.Conf.PrivateKey != nil {\n\t\t/*\n\t\t\t//create a rsa 256 signer\n\t\t\tsigner := jwt.New(jwt.GetSigningMethod(\"RS256\"))\n\n\t\t\t//set claims\n\t\t\tclaims := make(jwt.MapClaims)\n\t\t\t//claims[\"iss\"] = \"admin\"\n\t\t\tclaims[\"exp\"] = time.Now().Add(time.Minute * 20).Unix()\n\t\t\tclaims[\"Data\"] = data\n\t\t\tsigner.Claims = claims\n\t\t*/\n\t\tsigner := jwt.NewWithClaims(jwt.SigningMethodRS256, jwt.MapClaims{\n\t\t\t\"exp\": time.Now().Add((time.Hour * 24) * 365).Unix(),\n\t\t\t\"Data\": data,\n\t\t\t//\"nbf\": time.Date(2015, 10, 10, 12, 0, 0, 0, time.UTC).Unix(),\n\t\t})\n\n\t\ttokenString, err := signer.SignedString(_ijwt.Conf.PrivateKey)\n\t\tif err == nil {\n\t\t\ttoken = isecuritystt.Token{\n\t\t\t\tToken: tokenString,\n\t\t\t}\n\t\t}\n\t}\n\n\t//retorna IRESPONSE\n\treturn token, err\n}", "title": "" }, { "docid": "14db2312242afd5b072eb8afa59e51d5", "score": "0.525235", "text": "func newToken(Type, Value string, StartingPosition, LineNum, ColNum int) *Token {\n\treturn &Token{Type: Type, Value: Value, Length: len(Value), StartingPosition: StartingPosition,\n\t\tLineNum: LineNum, ColNum: ColNum}\n}", "title": "" }, { "docid": "5b589ecf73218e613c4be4214418c85e", "score": "0.5251802", "text": "func NewList() *List {\n\treturn &List{nil, 0}\n}", "title": "" }, { "docid": "daf312d21c910deedc423c74f14ae209", "score": "0.5250694", "text": "func (_TokenCashier *TokenCashierCallerSession) TokenLists(arg0 *big.Int) (common.Address, error) {\n\treturn _TokenCashier.Contract.TokenLists(&_TokenCashier.CallOpts, arg0)\n}", "title": "" }, { "docid": "13e5296ac7faef54465a2d01ae230628", "score": "0.52354264", "text": "func NewList(strs [][]byte, str []byte, mode int) *List {\n\tif mode == Comp {\n\t\tstr = lastWord(str)\n\t} else {\n\t\tstr = firstWord(str)\n\t}\n\treturn &List{strs: strs, str: str, curr: -1}\n}", "title": "" }, { "docid": "3829a9f4134bfdacfdea4e6fd8d89595", "score": "0.52310693", "text": "func newNetworkPolicyList() *api.NetworkPolicyList {\n\treturn &api.NetworkPolicyList{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: api.KindNetworkPolicyList,\n\t\t\tAPIVersion: api.GroupVersionCurrent,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b143c04aa587eda0f12b9d717dea5a5f", "score": "0.52274156", "text": "func New() *List {\n\treturn &List{}\n}", "title": "" }, { "docid": "b143c04aa587eda0f12b9d717dea5a5f", "score": "0.52274156", "text": "func New() *List {\n\treturn &List{}\n}", "title": "" }, { "docid": "93851049abc24c1c9003544fb6aaf000", "score": "0.52244604", "text": "func NewToken () (t* PrToken) {\n Token := PrToken{}\n\n Token.APIVersion = \"core.pavedroad.io/v1alpha1\"\n Token.Kind = \"PrToken\"\n Token.Metadata.Name = \"testoken\"\n Token.Metadata.UID = \"\"\n Token.Metadata.Site = \"github\"\n Token.Metadata.EndPoint = \"https://api.github.com\"\n Token.Metadata.Token = \"#####################\"\n Token.Metadata.Scope = append(Token.Metadata.Scope, \"user\")\n Token.Metadata.Scope = append(Token.Metadata.Scope, \"repo\")\n Token.Created = \"\"\n Token.Updated = \"\"\n Token.Active = true\n\n return &Token\n}", "title": "" }, { "docid": "4529b82c1a0b40262ebdd0c8fbb0d958", "score": "0.5219053", "text": "func getNewObjList(ctx *cliContext) interface{} {\n\tobjValue := reflect.New(ctx.listStructInfo.GetTypeFn())\n\treturn objValue.Interface()\n}", "title": "" }, { "docid": "c4eb1721bf9d20bde17df0cf017d949e", "score": "0.52186936", "text": "func NewList() Storage {\n\treturn &List{content: []string{}}\n}", "title": "" }, { "docid": "87d29f0116f97e8c0276c7904911c8e7", "score": "0.5213775", "text": "func NewListCmd(f factory.Factory, globalFlags *flags.GlobalFlags) *cobra.Command {\n\tlistCmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"Lists configuration\",\n\t\tLong: `\n#######################################################\n#################### devspace list ####################\n#######################################################\n\t`,\n\t\tArgs: cobra.NoArgs,\n\t}\n\n\tlistCmd.AddCommand(newSyncCmd(f, globalFlags))\n\tlistCmd.AddCommand(newSpacesCmd(f))\n\tlistCmd.AddCommand(newClustersCmd(f))\n\tlistCmd.AddCommand(newPortsCmd(f, globalFlags))\n\tlistCmd.AddCommand(newProfilesCmd(f))\n\tlistCmd.AddCommand(newVarsCmd(f, globalFlags))\n\tlistCmd.AddCommand(newDeploymentsCmd(f, globalFlags))\n\tlistCmd.AddCommand(newProvidersCmd(f))\n\tlistCmd.AddCommand(newContextsCmd(f))\n\tlistCmd.AddCommand(newCommandsCmd(f, globalFlags))\n\tlistCmd.AddCommand(newNamespacesCmd(f, globalFlags))\n\n\treturn listCmd\n}", "title": "" }, { "docid": "a39621075c0357d41e2263660e1bf25b", "score": "0.5213141", "text": "func New() *List {\n\treturn new(List).Init()\n}", "title": "" }, { "docid": "43c800309e939938dca3017b80d77029", "score": "0.5208097", "text": "func New(timeoutCallback TokenTimeout) *Token {\n\tnewToken := Token{\n\t\tTokenValue: GenerateTokenString(),\n\t\tvalidToken: true,\n\t\ttokenUsedSinceLastTimout: false,\n\t\ttimoutTicker: time.NewTicker(time.Duration(tokenTimeout) * time.Second),\n\t}\n\n\tgo newToken.startTimeout(timeoutCallback)\n\n\treturn &newToken\n}", "title": "" }, { "docid": "0ab3444446af44c3b73e22ad5cd1b973", "score": "0.51949704", "text": "func NewToken(ctx *pulumi.Context,\n\tname string, args *TokenArgs, opts ...pulumi.ResourceOption) (*Token, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Scopes == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Scopes'\")\n\t}\n\tsecrets := pulumi.AdditionalSecretOutputs([]string{\n\t\t\"token\",\n\t})\n\topts = append(opts, secrets)\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource Token\n\terr := ctx.RegisterResource(\"linode:index/token:Token\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "e5cc9a80e1f733a19f15ccc719f198ff", "score": "0.5172105", "text": "func NewList() List {\n\treturn &list{}\n}", "title": "" }, { "docid": "729cf9f0c5fa3006cdf869a224f3ab37", "score": "0.5172088", "text": "func NewCmdCreateToken(f cmdutil.Factory, ioStreams genericiooptions.IOStreams) *cobra.Command {\n\to := NewTokenOpts(ioStreams)\n\n\tcmd := &cobra.Command{\n\t\tUse: \"token SERVICE_ACCOUNT_NAME\",\n\t\tDisableFlagsInUseLine: true,\n\t\tShort: \"Request a service account token\",\n\t\tLong: tokenLong,\n\t\tExample: tokenExample,\n\t\tValidArgsFunction: completion.ResourceNameCompletionFunc(f, \"serviceaccount\"),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tif err := o.Complete(f, cmd, args); err != nil {\n\t\t\t\tcmdutil.CheckErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := o.Validate(); err != nil {\n\t\t\t\tcmdutil.CheckErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err := o.Run(); err != nil {\n\t\t\t\tcmdutil.CheckErr(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t},\n\t}\n\n\to.PrintFlags.AddFlags(cmd)\n\n\tcmd.Flags().StringArrayVar(&o.Audiences, \"audience\", o.Audiences, \"Audience of the requested token. If unset, defaults to requesting a token for use with the Kubernetes API server. May be repeated to request a token valid for multiple audiences.\")\n\n\tcmd.Flags().DurationVar(&o.Duration, \"duration\", o.Duration, \"Requested lifetime of the issued token. The server may return a token with a longer or shorter lifetime.\")\n\n\tcmd.Flags().StringVar(&o.BoundObjectKind, \"bound-object-kind\", o.BoundObjectKind, \"Kind of an object to bind the token to. \"+\n\t\t\"Supported kinds are \"+strings.Join(sets.StringKeySet(boundObjectKindToAPIVersion).List(), \", \")+\". \"+\n\t\t\"If set, --bound-object-name must be provided.\")\n\tcmd.Flags().StringVar(&o.BoundObjectName, \"bound-object-name\", o.BoundObjectName, \"Name of an object to bind the token to. \"+\n\t\t\"The token will expire when the object is deleted. \"+\n\t\t\"Requires --bound-object-kind.\")\n\tcmd.Flags().StringVar(&o.BoundObjectUID, \"bound-object-uid\", o.BoundObjectUID, \"UID of an object to bind the token to. \"+\n\t\t\"Requires --bound-object-kind and --bound-object-name. \"+\n\t\t\"If unset, the UID of the existing object is used.\")\n\n\treturn cmd\n}", "title": "" }, { "docid": "0a530533145232ca6ecaa2501adf85a5", "score": "0.51686364", "text": "func New() *List {\n\treturn new(List)\n}", "title": "" }, { "docid": "2d1dff88924038a1ee16ce2ba91af852", "score": "0.5167338", "text": "func bindITokenList(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(ITokenListABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil\n}", "title": "" }, { "docid": "0d07c2bd4ec5084bea88941b8259c4e9", "score": "0.5163889", "text": "func New(k Kind, ttl time.Duration, checkins int32) (t Token, err error) {\n\tif checkins == 0 {\n\t\treturn t, errors.New(\"failed to initialize new token: checkins remainder must be -1 or greater than 0\")\n\t}\n\n\t// setting given ttl (time to live in seconds) if given duration is greater than zero,\n\t// otherwise using default token longevity\n\t// NOTE: the final expiration time is the current time plus ttl duration\n\tif ttl <= 0 {\n\t\tttl = DefaultTTL\n\t}\n\n\t// current timestamp\n\tnow := time.Now()\n\n\tt = Token{\n\t\tKind: k,\n\t\tHash: NewHash(),\n\t\tCheckinTotal: checkins,\n\t\tCheckinRemainder: checkins,\n\t\tCreatedAt: now,\n\t\tExpireAt: now.Add(ttl),\n\t}\n\n\treturn t, nil\n}", "title": "" }, { "docid": "55dc84b8c06262cada14b41c7c73099b", "score": "0.51636934", "text": "func (base *Contract) CreateToken(addr smc.Address,\n\tname string,\n\tsymbol string,\n\ttotalsupply big.Int,\n\taddSupplyEnabled bool,\n\tburnEnabled bool,\n\tgasprice uint64) smc.Error {\n\treturn base.Ctx.NewToken(addr, name, symbol, totalsupply, addSupplyEnabled, burnEnabled, gasprice)\n}", "title": "" }, { "docid": "827bee35fa8ead0fba0cf3dba813c2d0", "score": "0.51627266", "text": "func NewList(mb block) *List {\n\tunderlying := &parserBlock{\n\t\topenPos: Position{0, 0}, // FIXME\n\t\tparentB: mb,\n\t\tparentC: mb,\n\t\ttyp: \"list\",\n\t\telement: newElement(\"div\", \"list\"),\n\t\tgenericCatch: &genericCatch{},\n\t}\n\treturn &List{false, false, nil, underlying}\n}", "title": "" }, { "docid": "2152bab25f2086ac4984519c73116b12", "score": "0.5160977", "text": "func NewToken(keyHash string) Token {\n\treturn Token{RateRequest: models.RateRequest{KeyHash: keyHash, Type: models.BLOCK}, Out: make(chan models.RateRequest)}\n}", "title": "" }, { "docid": "fe34a4a7663fa522834ec7343b8c1941", "score": "0.51603556", "text": "func (h *TokenHandler) New(w http.ResponseWriter, r *http.Request) {\n\ttoken, err := h.interactor.New()\n\tif err != nil {\n\t\tError(w, http.StatusNotFound, err, \"failed to create token\")\n\t\treturn\n\t}\n\tJSON(w, http.StatusCreated, token)\n}", "title": "" }, { "docid": "634e37032c7073c0d1e41be9b037c3f9", "score": "0.5153761", "text": "func NewList(prime primeable) *List {\n\treturn &List{\n\t\tout: prime.Output(),\n\t\tproj: prime.Project(),\n\t}\n}", "title": "" }, { "docid": "c2f4ae3a6093706477fd9e64fd7dd302", "score": "0.51533324", "text": "func NewList() *List {\n\tll := &List{}\n\treturn ll\n}", "title": "" }, { "docid": "5f5cfd1f001085b410efd43a5a51405c", "score": "0.5148272", "text": "func newTokener(ctx context.Context, assetID uint32, net dex.Network, be bind.ContractBackend) (*tokener, error) {\n\ttoken, netToken, swapContract, err := networkToken(assetID, net)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif token.ver != 0 {\n\t\treturn nil, fmt.Errorf(\"only version 0 contracts supported\")\n\t}\n\n\tes, err := erc20v0.NewERC20Swap(swapContract.Address, be)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terc20, err := erc20.NewIERC20(netToken.Address, be)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tboundAddr, err := es.TokenAddress(readOnlyCallOpts(ctx, false))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving bound address for %s version %d contract: %w\",\n\t\t\ttoken.Name, token.ver, err)\n\t}\n\n\tif boundAddr != netToken.Address {\n\t\treturn nil, fmt.Errorf(\"wrong bound address for %s version %d contract. wanted %s, got %s\",\n\t\t\ttoken.Name, token.ver, netToken.Address, boundAddr)\n\t}\n\n\ttkn := &tokener{\n\t\tregisteredToken: token,\n\t\tswapContract: &swapSourceV0{es},\n\t\terc20Contract: erc20,\n\t\tcontractAddr: swapContract.Address,\n\t\ttokenAddr: netToken.Address,\n\t}\n\n\treturn tkn, nil\n}", "title": "" }, { "docid": "9f3fef69d8d6a1a9e8e71c01a8150fa7", "score": "0.51465905", "text": "func NewITokenListCaller(address common.Address, caller bind.ContractCaller) (*ITokenListCaller, error) {\n\tcontract, err := bindITokenList(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ITokenListCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "1a55a55328c60db8e3fe980f4e8be53f", "score": "0.51318276", "text": "func NewWordlist() *Wordlist {\n\treturn &Wordlist{\n\t\tItems: make([]Credential, 0),\n\t}\n}", "title": "" }, { "docid": "78ff649d4ca02991848276301da0993d", "score": "0.5131391", "text": "func NewITokenListTransactor(address common.Address, transactor bind.ContractTransactor) (*ITokenListTransactor, error) {\n\tcontract, err := bindITokenList(address, nil, transactor, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ITokenListTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "a614f232581e4b3498c55c6e32f3034c", "score": "0.5129254", "text": "func NewListCommand(c Context) *cobra.Command {\n\toptions := listOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tAliases: []string{\"l\"},\n\t\tShort: \"List todo items\",\n\t\tArgs: cobra.NoArgs,\n\t\tRunE: func(cmd *cobra.Command, _ []string) error {\n\t\t\toptions.client = c.GetTodoClient()\n\n\t\t\tcmd.SilenceErrors = true\n\t\t\tcmd.SilenceUsage = true\n\n\t\t\treturn runList(options)\n\t\t},\n\t}\n\tcobra.OnInitialize()\n\n\treturn cmd\n}", "title": "" }, { "docid": "e108e3b0169bc6cca51f0ab83d8e65bd", "score": "0.5121051", "text": "func NewList() *List {\n\treturn &List{}\n}", "title": "" }, { "docid": "e108e3b0169bc6cca51f0ab83d8e65bd", "score": "0.5121051", "text": "func NewList() *List {\n\treturn &List{}\n}", "title": "" }, { "docid": "41ef102691004bbfa8108d4e0e9504fe", "score": "0.5120433", "text": "func (a *TokensApiService) ListTokens(ctx _context.Context) ApiListTokensRequest {\n\treturn ApiListTokensRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "848c1f66bd5651bb7adf105500df1e42", "score": "0.511717", "text": "func NewToken(tokenType, principal string, attributes Attributes) Token {\n\treturn simpleToken{tokenType, principal, attributes}\n}", "title": "" }, { "docid": "c86b1ebb92f8b26238554be4677772d7", "score": "0.51145554", "text": "func New() *List {\n\treturn &List{0, nil, nil}\n}", "title": "" }, { "docid": "fcd5baa755f4ab92f38686d59cc24973", "score": "0.5107851", "text": "func (o *CloudStatus) NewList() *Args {\n\to.Args.Verb = \"GET\"\n\t//o.Args.RequiresAuth = true\n\treturn o.Args\n}", "title": "" }, { "docid": "1949c4eda38055fecd1b88398d6ef978", "score": "0.5105326", "text": "func (f *Fetcher) GetListedToken(block *big.Int, reserveAddr ethereum.Address,\n\ttokenSymbol *blockchain.TokenInfoGetter) ([]common.ListedToken, error) {\n\tvar (\n\t\tlogger = f.sugar.With(\"func\", caller.GetCurrentFunctionName())\n\t\tresult = make(map[string]common.ListedToken)\n\t\treturnResult []common.ListedToken\n\t)\n\t// step 1: get conversionRatesContract address\n\tlogger.Infow(\"reserve address\", \"reserve\", reserveAddr)\n\treserveContractClient, err := contracts.NewReserve(reserveAddr, f.ethClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcallOpts := &bind.CallOpts{BlockNumber: block}\n\tconversionRatesContract, err := reserveContractClient.ConversionRatesContract(callOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// step 2: get listedTokens from conversionRatesContract\n\tconversionRateContractClient, err := contracts.NewConversionRates(conversionRatesContract, f.ethClient)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlistedTokens, err := conversionRateContractClient.GetListedTokens(callOpts)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, address := range listedTokens {\n\t\tsymbol, err := tokenSymbol.Symbol(address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tname, err := tokenSymbol.Name(address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttimestamp, err := f.contractTimestampResolver.Resolve(address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdecimals, err := tokenSymbol.Decimals(address)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tresult = updateListedToken(result, symbol, name, address, timestamp, decimals)\n\t}\n\tfor _, token := range result {\n\t\treturnResult = append(returnResult, token)\n\t}\n\n\treturn returnResult, nil\n}", "title": "" }, { "docid": "b763cbaa881b01f0ec16d6881a674871", "score": "0.5093846", "text": "func NewList() *List {\n\tlist := &List{Size: 0}\n\treturn list\n}", "title": "" }, { "docid": "bf7af800e22833d31a236b2e8fcc3d95", "score": "0.5087702", "text": "func NewConnList() (cl *connList) {\n\tcl = &connList{\n\t\tm: make(map[string]net.Conn),\n\t}\n\treturn cl\n}", "title": "" }, { "docid": "dc7f3c488e615396bc2d38b35a08787b", "score": "0.5086922", "text": "func newTokenCredentialRequests(c *LoginV1alpha1Client) *tokenCredentialRequests {\n\treturn &tokenCredentialRequests{\n\t\tclient: c.RESTClient(),\n\t}\n}", "title": "" }, { "docid": "e1b6f52c39ed092aa33b6eaa7d489f70", "score": "0.5084102", "text": "func newSessionList() *SessionList {\n\treturn &SessionList{\n\t\tmapOnlineList: make(map[string]ISession),\n\t}\n}", "title": "" }, { "docid": "e88b0cc3a8b089a1d282f965945701e0", "score": "0.50822806", "text": "func NewListType(ty *Type, maxLen int) *Type {\n\treturn &Type{\n\t\tKind: KindList,\n\t\tListType: ty,\n\t\tMaxLen: maxLen,\n\t\tFields: ty.Fields,\n\t}\n}", "title": "" }, { "docid": "3eb0ee9bfd5fb199623cc08da4b01902", "score": "0.5080383", "text": "func New() *List {\n\treturn &List{\n\t\tdata: []interface{}{},\n\t\tlock: &sync.RWMutex{},\n\t}\n}", "title": "" }, { "docid": "d374ac21f140ad21d50dbb51f87657cb", "score": "0.50768787", "text": "func MakeListTokensEndpoint(service token.Service) endpoint.Endpoint {\n\treturn func(ctx context.Context, request interface{}) (interface{}, error) {\n\t\ttokens, err := service.ListTokens(ctx)\n\n\t\tif err != nil {\n\t\t\tif serviceErr := serviceError(nil); errors.As(err, &serviceErr) && serviceErr.ServiceError() {\n\t\t\t\treturn ListTokensResponse{\n\t\t\t\t\tErr: err,\n\t\t\t\t\tTokens: tokens,\n\t\t\t\t}, nil\n\t\t\t}\n\n\t\t\treturn ListTokensResponse{\n\t\t\t\tErr: err,\n\t\t\t\tTokens: tokens,\n\t\t\t}, err\n\t\t}\n\n\t\treturn ListTokensResponse{Tokens: tokens}, nil\n\t}\n}", "title": "" }, { "docid": "4ca6e1ed318edf535b766ed897f36898", "score": "0.50764364", "text": "func NewList(name string, data []Any) *List {\n\treturn &List{name, data}\n}", "title": "" }, { "docid": "5583bada5bd8cfdd49c73cb342974492", "score": "0.5073682", "text": "func NewToken(l *log.Logger, client *client.Client, db *db.Database) *Token {\n\treturn &Token{l, client, db}\n}", "title": "" }, { "docid": "8ba97f6902e3baad21a09a810e7f62f2", "score": "0.5072999", "text": "func newListCmd() *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"list\",\n\t\tShort: \"list configured networks\",\n\t\tRunE: list,\n\t}\n\n\treturn cmd\n}", "title": "" }, { "docid": "6fc0507352be69120a9555113568add7", "score": "0.50635874", "text": "func NewCVLTokenContract(address common.Address, backend bind.ContractBackend) (*CVLTokenContract, error) {\n\tcontract, err := bindCVLTokenContract(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &CVLTokenContract{CVLTokenContractCaller: CVLTokenContractCaller{contract: contract}, CVLTokenContractTransactor: CVLTokenContractTransactor{contract: contract}, CVLTokenContractFilterer: CVLTokenContractFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "eb2a8b6c9c647a0a8aa7d5bd97dac873", "score": "0.505813", "text": "func NewCommandList() *CommandList {\n\treturn &CommandList{\n\t\tparentCommand: new(parentCommand),\n\t}\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "66c35cac911768ec01f87c8c3ff2433f", "score": "0.50412285", "text": "func NewToken(address common.Address, backend bind.ContractBackend) (*Token, error) {\n\tcontract, err := bindToken(address, backend, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Token{TokenCaller: TokenCaller{contract: contract}, TokenTransactor: TokenTransactor{contract: contract}, TokenFilterer: TokenFilterer{contract: contract}}, nil\n}", "title": "" } ]
444dc26c493f933e385b5a4339628fa9
NetListener the returned listener is already Accept()'ing. So it's not suitable to pass into http.Serve().
[ { "docid": "0cceb825c487f1f7dc05ef9db4ff8227", "score": "0.6299026", "text": "func (l *DefaultListener) NetListener() net.Listener {\n\treturn l.listener\n}", "title": "" } ]
[ { "docid": "0049c4e3309af9f1aaf6a30995547082", "score": "0.7371726", "text": "func Accept(lis net.Listener) { DefaultServer.Accept(lis) }", "title": "" }, { "docid": "0049c4e3309af9f1aaf6a30995547082", "score": "0.7371726", "text": "func Accept(lis net.Listener) { DefaultServer.Accept(lis) }", "title": "" }, { "docid": "3838be901643678c22ce1da334ae0eec", "score": "0.6958359", "text": "func (l *UnixListener) Accept() (Conn, error) {}", "title": "" }, { "docid": "5e5e5e72969fecf2ad588ca119c9ff88", "score": "0.6882286", "text": "func ServeListener(ln net.Listener) {\n\tdefaultServer.ServeListener(ln)\n}", "title": "" }, { "docid": "f285033f9742512db5469cefa0d5d9b8", "score": "0.6761194", "text": "func Serve(l net.Listener) error {\n return nil\n}", "title": "" }, { "docid": "f6683177117a564870a524a6f6ff4513", "score": "0.67528", "text": "func (s *Server) Accept(addr string, listener net.Listener) {\n\thttpServer := &HTTPServer{\n\t\tsrv: &http.Server{\n\t\t\tAddr: addr,\n\t\t},\n\t\tl: listener,\n\t}\n\ts.servers = append(s.servers, httpServer)\n}", "title": "" }, { "docid": "328c9f4311a85ba005e098511f0eb685", "score": "0.66399133", "text": "func (s *Server) serveListener(ln net.Listener) error {\n\n\tvar tempDelay time.Duration\n\n\ts.mu.Lock()\n\ts.ln = ln\n\ts.mu.Unlock()\n\n\tfor {\n\t\tconn, e := ln.Accept()\n\t\tif e != nil {\n\t\t\tselect {\n\t\t\tcase <-s.getDoneChan():\n\t\t\t\treturn ErrServerClosed\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\tif ne, ok := e.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\n\t\t\t\tlog.Errorf(\"rpcx: Accept error: %v; retrying in %v\", e, tempDelay)\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn e\n\t\t}\n\t\ttempDelay = 0\n\n\t\tif tc, ok := conn.(*net.TCPConn); ok {\n\t\t\ttc.SetKeepAlive(true)\n\t\t\ttc.SetKeepAlivePeriod(3 * time.Minute)\n\t\t\ttc.SetLinger(10)\n\t\t}\n\n\t\tconn, ok := s.Plugins.DoPostConnAccept(conn)\n\t\tif !ok {\n\t\t\tcloseChannel(s, conn)\n\t\t\tcontinue\n\t\t}\n\n\t\ts.mu.Lock()\n\t\ts.activeConn[conn] = struct{}{}\n\t\ts.mu.Unlock()\n\n\t\tgo s.serveConn(conn)\n\t}\n}", "title": "" }, { "docid": "ffd9267fd64b58481f96f71f76fa6b85", "score": "0.6621514", "text": "func (s *Server) Accept() (net.Conn, error){\n return s.listener.Accept()\n}", "title": "" }, { "docid": "c2e3c0f6dfc500d1f6333ab44567e74b", "score": "0.65506077", "text": "func (s *Server) Accept(addr string, listeners ...net.Listener) {\n\tfor _, listener := range listeners {\n\t\thttpServer := &HTTPServer{\n\t\t\tsrv: &http.Server{\n\t\t\t\tAddr: addr,\n\t\t\t},\n\t\t\tl: listener,\n\t\t}\n\t\ts.servers = append(s.servers, httpServer)\n\t}\n}", "title": "" }, { "docid": "4d5fc3ff079f1a180e1e7d6df3a10c9b", "score": "0.6523648", "text": "func (s *httpServer) Listener() net.Listener { return s.listener }", "title": "" }, { "docid": "a050b90427d56d3b25baab115acb9cf1", "score": "0.6504171", "text": "func (l *listener) Accept() (net.Conn, error) {\n\treturn nil, errors.New(\"listener is not capable of serving any connections\")\n}", "title": "" }, { "docid": "b779dd3377a429cc490ab4057f03dcb8", "score": "0.6462668", "text": "func (l *TCPListener) Accept() (Conn, error) {}", "title": "" }, { "docid": "439fc7b23f233299d0aa2d7796eb36b9", "score": "0.64195585", "text": "func serve(l net.Listener) {\n\thttp.Serve(l, http.HandlerFunc(serveRequest))\n}", "title": "" }, { "docid": "5be1b996d95eb1281c8dd92123f8e5a4", "score": "0.6416876", "text": "func serve(ln net.Listener) {\n\terr := server.Serve(ln.(*net.TCPListener))\n\tif err != http.ErrServerClosed {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "7133c589f8a70932596a868a6abd50e9", "score": "0.63803655", "text": "func (h *HTTPServer) Serve(lis net.Listener) error {\n\tif h.stopped.Load() {\n\t\treturn errServerStopped\n\t}\n\n\th.lock.Lock()\n\tdefer h.lock.Unlock()\n\n\tif h.listener != nil {\n\t\treturn errAlreadyListening\n\t}\n\n\th.listener = lis\n\tgo h.serve(h.listener)\n\treturn nil\n}", "title": "" }, { "docid": "42df2ec26dde097b015c950f3f344af4", "score": "0.63731796", "text": "func (*Server) Serve(Listener) error { return nil }", "title": "" }, { "docid": "7131db838ac41271c4349c13f0b49f26", "score": "0.631247", "text": "func Serve(l net.Listener) error {\n\tfor {\n\t\trw, e := l.Accept()\n\t\tif e != nil {\n\t\t\t// TODO: e.Temporary()?\n\t\t\treturn e\n\t\t}\n\n\t\tgo func(rw net.Conn) {\n\t\t\tc, err := newConn(rw)\n\t\t\tif err != nil {\n\t\t\t\trw.Close()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tEcho(c)\n\t\t\tc.Close()\n\t\t}(rw)\n\n\t}\n\n}", "title": "" }, { "docid": "484282d4ddffdf0120409783b179fbb2", "score": "0.6281071", "text": "func (s *Server) Serve(l net.Listener, h Handler) error {\n\tdefer l.Close()\n\n\tif l == nil {\n\t\tln, err := TCPListener(\":8080\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tl = ln\n\t}\n\tif h == nil {\n\t\th = HTTPHandler()\n\t}\n\n\tvar tempDelay time.Duration\n\tfor {\n\t\tconn, e := l.Accept()\n\t\tif e != nil {\n\t\t\tif ne, ok := e.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\tlog.Logf(\"server: Accept error: %v; retrying in %v\", e, tempDelay)\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn e\n\t\t}\n\t\ttempDelay = 0\n\t\tgo h.Handle(conn)\n\t}\n\n}", "title": "" }, { "docid": "b916d0c62ee3dd261a7f46eb9fcc5ad3", "score": "0.6275733", "text": "func ServeListener(l net.Listener, chanLen int) <-chan *Control {\n\tch := make(chan *Control, chanLen)\n\n\tgo func() {\n\t\tdefer close(ch)\n\n\t\tfor {\n\t\t\tconn, err := l.Accept()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif ctrl := ControlStream(conn); ch != nil && len(ch) < cap(ch) {\n\t\t\t\tch <- ctrl\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn ch\n}", "title": "" }, { "docid": "3c10b5b92d84763842b0c1fc055746ac", "score": "0.6243768", "text": "func (srv *Server) Serve(l net.Listener) error {\n\tbackoff := retry.Exponential(time.Millisecond * 10).Max(time.Second)\n\ttry := 0\n\n\tsrv.logf(\"listening on %s\", l.Addr())\n\tfor {\n\t\trwc, err := l.Accept()\n\t\tif err != nil {\n\t\t\tif util.IsTempErr(err) {\n\t\t\t\ttry++\n\t\t\t\tsrv.logf(\"9p: Accept error: %v; retrying in %v\", err, backoff(try))\n\t\t\t\ttime.Sleep(backoff(try))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t} else {\n\t\t\ttry = 0\n\t\t}\n\n\t\tsrv.logf(\"accepted connection from %s\", rwc.RemoteAddr())\n\t\tconn := newConn(srv, rwc)\n\t\tgo conn.serve()\n\t}\n}", "title": "" }, { "docid": "d8fd0b1a36dd4ece58321a8dc87af0cc", "score": "0.624285", "text": "func (s *ProxyServer) ServeOnListener(l net.Listener) error {\n\tserver := http.Server{\n\t\tHandler: s.handler,\n\t}\n\treturn server.Serve(l)\n}", "title": "" }, { "docid": "dc8a9f973c9cc96e4cc2d928af962e63", "score": "0.6216713", "text": "func (l *Listener) Accept() (net.Conn, error) {\n\tc, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn Server(c, l.config), nil\n}", "title": "" }, { "docid": "2ac94c6f2fb2de41a68d2e7a2878959d", "score": "0.6196227", "text": "func (s *Server) Serve(h http.Handler) error {\n\tlis, err := s.Listener()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer lis.Close()\n\n\ts.server = &http.Server{\n\t\tAddr: lis.Addr().String(),\n\t\tHandler: h,\n\t}\n\n\tdefer func() {\n\t\ts.server = nil\n\t}()\n\n\terr = s.server.Serve(lis)\n\tif err == http.ErrServerClosed {\n\t\terr = nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "defd0dc48604ea5e91c7bd998beb7606", "score": "0.6191228", "text": "func Serve(l net.Listener) error {\n\treturn nil\n}", "title": "" }, { "docid": "75cd3cb0cec50b0087488948e39f6d6a", "score": "0.618492", "text": "func listen(listener net.Listener) {\n\t// add default handler\n\thandler.Add(\"default\", handlers.Default(0))\n\n\tfor {\n\t\t// accept connection\n\t\tconn, errConn := listener.Accept()\n\t\tshorts.Check(errConn)\n\n\t\t// handle connection\n\t\tgo handleConnSafe(conn)\n\t}\n}", "title": "" }, { "docid": "217a208b6ed2bf5a75f015fbdd8de88e", "score": "0.6175986", "text": "func (l *networkListener) Accept() (net.Conn, error) {\n\tc, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, errors.WithStack(err)\n\t}\n\n\tl.mutex.RLock()\n\tdefer l.mutex.RUnlock()\n\n\tconfig := l.config\n\treturn tls.Server(c, config), nil\n}", "title": "" }, { "docid": "c23b4740b83e951cac7a50c1b2124d82", "score": "0.61676794", "text": "func (s *Server) Serve(l net.Listener) (err error) {\n\tlog.WithFields(log.Fields{\n\t\t\"pkg\": \"nntp-server\",\n\t\t\"addr\": l.Addr(),\n\t}).Debug(\"Serving\")\n\tfor err == nil {\n\t\tvar c net.Conn\n\t\tc, err = l.Accept()\n\t\tif err == nil {\n\t\t\t// we got a new connection\n\t\t\tgo s.handleInboundConnection(c)\n\t\t} else {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"pkg\": \"nntp-server\",\n\t\t\t}).Error(\"failed to accept inbound connection\", err)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "71f422df11544b3059b074d30fdb257c", "score": "0.6166373", "text": "func (s *Server) Serve(l net.Listener) error {\n\tvar (\n\t\tc net.Conn\n\t\te error\n\t\tf *os.File\n\t)\n\n\tcheck := func(e error) {\n\t\tif e != nil {\n\t\t\ts.ErrorLog.Printf(\"ERROR: %s\\n\", e)\n\t\t}\n\t}\n\n\ts.listener = l\n\n\tfor {\n\t\tc, e = s.listener.Accept()\n\t\tcheck(e)\n\n\t\tswitch c.(type) {\n\t\tcase *net.IPConn:\n\t\t\tf, e = c.(*net.IPConn).File()\n\t\tcase *net.TCPConn:\n\t\t\tf, e = c.(*net.TCPConn).File()\n\t\tcase *net.UDPConn:\n\t\t\tf, e = c.(*net.UDPConn).File()\n\t\tcase *net.UnixConn:\n\t\t\tf, e = c.(*net.UnixConn).File()\n\t\t}\n\n\t\tcheck(e)\n\n\t\tc = Conn{\n\t\t\tConn: c,\n\t\t\tctx: SSL_new(s.ctx),\n\t\t\tf: f,\n\t\t\tfd: int(f.Fd()),\n\t\t}\n\n\t\toc := c.(Conn)\n\t\tSSL_set_fd(oc.ctx, oc.fd)\n\n\t\tcheck(oc.getHandshake())\n\n\t\tbuf := bufio.NewReader(oc)\n\t\treq, e := http.ReadRequest(buf)\n\t\tcheck(e)\n\n\t\tres := &response{\n\t\t\tConn: oc,\n\t\t\tHeaders: make(http.Header),\n\t\t\treq: req,\n\t\t}\n\n\t\ts.Handler.ServeHTTP(res, req)\n\n\t\tcheck(req.Body.Close())\n\n\t\tcheck(oc.Close())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03c6d8d844a2e849338258a865bbba86", "score": "0.6165988", "text": "func (l *Listener) Accept() (net.Conn, error) {\n\treturn l.AcceptMemConn()\n}", "title": "" }, { "docid": "38402dc1310caf93eacb4614f6d88270", "score": "0.61499137", "text": "func (l *loopbackListener) Accept() (conn net.Conn, err error) {\n\tselect {\n\tcase <-l.stopper.ShouldQuiesce():\n\t\treturn nil, errLocalListenerClosed\n\tcase <-l.active:\n\t\treturn nil, errLocalListenerClosed\n\tcase <-l.requests:\n\t}\n\tc1, c2 := net.Pipe()\n\tselect {\n\tcase l.conns <- c1:\n\t\treturn c2, nil\n\tcase <-l.stopper.ShouldQuiesce():\n\tcase <-l.active:\n\t}\n\terr = errLocalListenerClosed\n\terr = errors.CombineErrors(err, c1.Close())\n\terr = errors.CombineErrors(err, c2.Close())\n\treturn nil, err\n}", "title": "" }, { "docid": "ceb336ba5062c3284cdca31cd6d0d13c", "score": "0.6148795", "text": "func (srv *Server) Serve(ln net.Listener) error {\n\tvar tempDelay time.Duration // how long to sleep on accept failure\n\n\tserveCtx, cancelFunc := context.WithCancel(context.Background())\n\tdefer cancelFunc()\n\tfor {\n\t\trw, e := ln.Accept()\n\t\tif e != nil {\n\t\t\tselect {\n\t\t\tcase <-srv.doneChan:\n\t\t\t\treturn ErrServerClosed\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif e == ErrAcceptTimedout {\n\t\t\t\t// for overlay network\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif opError, ok := e.(*net.OpError); ok && opError.Timeout() {\n\t\t\t\t// don't log the scheduled timeout\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif ne, ok := e.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\tl.Error(\"qrpc: Accept\", zap.Duration(\"retrying in\", tempDelay), zap.Error(e))\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tl.Error(\"qrpc: Accept fatal\", zap.Error(e)) // accept4: too many open files in system\n\t\t\ttime.Sleep(time.Second) // keep trying instead of quit\n\t\t\tcontinue\n\t\t}\n\t\ttempDelay = 0\n\n\t\tGoFunc(&srv.wg, func() {\n\t\t\tc := srv.newConn(serveCtx, rw)\n\t\t\tc.serve()\n\t\t})\n\t}\n}", "title": "" }, { "docid": "36666b12c1d5022ade59858e80253985", "score": "0.61483276", "text": "func (ml *ManagedListener) Accept() (net.Conn, error) {\n\t// defer trace.Tracer.Enable(trace.Enabled).ScopedTrace()()\n\treturn ml.Listener.Accept()\n}", "title": "" }, { "docid": "b350c4a9a8edf9492b632bb8995ded76", "score": "0.6126058", "text": "func (l *Listener) Accept() (net.Conn, error) {\n\tc, err := l.fileListener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tl.inc()\n\n\treturn newConn(c, l), nil\n}", "title": "" }, { "docid": "a68bf4f22b14321467801d69c948f5e7", "score": "0.61112", "text": "func ServeWithListener(l net.Listener, s *http.Server, logger *zap.Logger) (*http.Server, error) {\n\tgo func() {\n\t\tif err := s.Serve(l); err != nil {\n\t\t\tlogger.Error(\"failed to serve\", zap.Error(err))\n\t\t}\n\t}()\n\n\treturn s, nil\n}", "title": "" }, { "docid": "5b278216f016ac327d8660f01df81e3f", "score": "0.61041564", "text": "func (s *Server) AddListener(l net.Listener) (ok bool) {\n\t// Shutdown catch\n\tok = true\n\ts.is_closed_mutex.RLock()\n\tdefer s.is_closed_mutex.RUnlock()\n\tif s.is_closed {\n\t\tok = false\n\t\treturn\n\t}\n\t// Add listener to internal list\n\ts.listeners_mutex.Lock()\n\ts.listeners = append(s.listeners, l)\n\ts.listeners_mutex.Unlock()\n\t// Actual listening goroutine\n\tgo func() {\n\t\tfor {\n\t\t\tcon, err := l.Accept()\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error: %s\\n\", err.Error())\n\t\t\t\tbreak\n\t\t\t}\n\t\t\ts.AddClientByConnection(con)\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "e24ed318226e3d989150921a35eafcde", "score": "0.6103496", "text": "func (s *Server) Serve(listener net.Listener) error {\n\tif err := s.verifySettings(); err != nil {\n\t\treturn err\n\t}\n\ts.calculateCapabilities()\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil && s.handleAcceptError(err) != nil {\n\t\t\treturn err\n\t\t}\n\t\ts.serveOne(conn)\n\t}\n}", "title": "" }, { "docid": "ad632d60853036fa378eb5eb2546f625", "score": "0.6099569", "text": "func NetListener(customListener net.Listener) ListenOption {\n\treturn func(o *ListenOptions) {\n\t\tif customListener == nil {\n\t\t\treturn\n\t\t}\n\t\tif o.Context == nil {\n\t\t\to.Context = context.TODO()\n\t\t}\n\t\to.Context = context.WithValue(o.Context, netListener{}, customListener)\n\t}\n}", "title": "" }, { "docid": "f7d25162cd574b4cceb10b8e021939d2", "score": "0.6092408", "text": "func (on *onion) Listener(in net.Listener) (l net.Listener, err error) {\n\tl = in\n\tfor _, layer := range on.layers {\n\t\tif on.verbose {\n\t\t\tif l == nil {\n\t\t\t\tglog.Infof(\"[%s] listen init\", layer.Name())\n\t\t\t} else {\n\t\t\t\tglog.Infof(\"[%s] listen => %s\", layer.Name(), l.Addr())\n\t\t\t}\n\t\t}\n\t\tl, err = layer.Listener(l)\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "965f4a6dc461357f63d220978cdf6077", "score": "0.6090075", "text": "func (srv *Server) Serve(l net.Listener) error {\n\tif !srv.trackListener(&l, true) {\n\t\treturn ErrServerClosed\n\t}\n\tdefer srv.trackListener(&l, false)\n\n\tvar tempDelay time.Duration // how long to sleep on accept Err\n\tfor {\n\t\trw, e := l.Accept()\n\t\tif e != nil {\n\t\t\tselect {\n\t\t\tcase <-srv.getDoneChan():\n\t\t\t\treturn ErrServerClosed\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif ne, ok := e.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\tsrv.logf(\"pop3: Accept error: %v; retrying in %v\", e, tempDelay)\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn e\n\t\t}\n\t\ttempDelay = 0\n\t\tc := srv.newConn(rw)\n\t\tconnCtx := context.Background()\n\t\tgo c.serve(connCtx)\n\t}\n}", "title": "" }, { "docid": "8677d1ce1b9a753fdf7f57bf2016554a", "score": "0.608979", "text": "func (s *Server) Serve(lis net.Listener) error {\n\treturn http.Serve(lis, s)\n}", "title": "" }, { "docid": "a7d76d0404715f25a898bc6576b891bc", "score": "0.6082355", "text": "func (srv *Server) Serve(l net.Listener) error {\n\tdefer l.Close()\n\tvar tempDelay time.Duration // how long to sleep on accept failure\n\n\tif err := func() error {\n\t\tsrv.mu.Lock()\n\t\tdefer srv.mu.Unlock()\n\t\tselect {\n\t\tcase <-srv.getDoneChanLocked():\n\t\t\treturn errors.WithStack(serverClosedError{})\n\t\tdefault:\n\t\t}\n\t\tsrv.trackListenerLocked(l, true)\n\t\treturn nil\n\t}(); err != nil {\n\t\treturn err\n\t}\n\tdefer srv.trackListener(l, false)\n\n\tsrv.serveErrorsMu.Lock()\n\tsrv.serveErrors = make(map[string]int)\n\tsrv.serveErrorsMu.Unlock()\n\tfor {\n\t\t// wait for active network connections to fall to allowed levels\n\t\trwc, err := l.Accept()\n\t\tif err != nil {\n\t\t\tselect {\n\t\t\tcase <-srv.getDoneChan():\n\t\t\t\treturn errors.WithStack(serverClosedError{})\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif ne, ok := err.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t\ttempDelay = 0\n\t\tsrv.getMuxerLimiter() <- struct{}{}\n\t\tgo func(rwc io.ReadWriteCloser) {\n\t\t\tmux := NewMuxer(rwc)\n\t\t\tmux.StatsCollector = srv\n\t\t\tmux.ReadTimeout = srv.ReadTimeout\n\t\t\tmux.WriteTimeout = srv.WriteTimeout\n\t\t\tsrv.trackMuxer(mux)\n\t\t\tif err := mux.ServeHTTP(srv.Handler); err != nil {\n\t\t\t\tsrv.serveErrorsMu.Lock()\n\t\t\t\tdefer srv.serveErrorsMu.Unlock()\n\t\t\t\tsrv.serveErrors[err.Error()]++\n\t\t\t}\n\t\t\t<-srv.getMuxerLimiter()\n\t\t}(rwc)\n\t}\n}", "title": "" }, { "docid": "00dad3a4336d8b328f6a1d9ec163c7ec", "score": "0.6075693", "text": "func (server *Server) Serve(ln net.Listener) (err error) {\n\tfor {\n\t\tconn, err := ln.Accept()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Connection accept error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tgo func() {\n\t\t\tif err := server.HandleConnection(conn); err != nil && err != io.EOF {\n\t\t\t\tlog.Printf(\"Connection error: %v\", err)\n\t\t\t}\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "d867bb0cc3ceb571a13ff1c392074f3c", "score": "0.6074958", "text": "func (srv *Server) Serve(listener net.Listener) error {\n\twg := sync.WaitGroup{}\n\tfor {\n\n\t\tselect {\n\t\tcase <-srv.getDoneChan():\n\t\t\tlistener.Close()\n\t\t\twg.Wait()\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\t\tswitch lstnr := listener.(type) {\n\t\tcase *net.TCPListener:\n\t\t\tlstnr.SetDeadline(time.Now().Add(1e9))\n\t\tcase *net.UnixListener:\n\t\t\tlstnr.SetDeadline(time.Now().Add(1e9))\n\t\tdefault:\n\t\t\terrors.New(\"Unknown listener type\")\n\t\t}\n\n\t\t// accept connection from client\n\t\tclient, err := listener.Accept()\n\t\tif nil != err {\n\t\t\tif opErr, ok := err.(*net.OpError); ok && opErr.Timeout() {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\t// create milter object\n\t\tsession := session{\n\t\t\tactions: srv.Actions,\n\t\t\tprotocol: srv.Protocol,\n\t\t\tsock: client,\n\t\t\tmilter: srv.NewMilter(),\n\t\t}\n\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\twg.Done()\n\t\t\tsession.Handle()\n\t\t}()\n\t}\n}", "title": "" }, { "docid": "4a13d6a13736399866403dced88e7d1c", "score": "0.60530394", "text": "func (c *Config) Listener(proto, addr string, port int) (net.Listener, error) {\n\tif addr == \"\" {\n\t\taddr = c.BindAddr\n\t}\n\n\tif 0 > port || port > 65535 {\n\t\treturn nil, &net.OpError{\n\t\t\tOp: \"listen\",\n\t\t\tNet: proto,\n\t\t\tErr: &net.AddrError{Err: \"invalid port\", Addr: fmt.Sprint(port)},\n\t\t}\n\t}\n\treturn net.Listen(proto, net.JoinHostPort(addr, strconv.Itoa(port)))\n}", "title": "" }, { "docid": "77bb5952525fa84adb72ebc35112dd6c", "score": "0.6052337", "text": "func (l *nsListener) Accept() (net.Conn, error) {\n\tif c, ok := <-l.conns; ok {\n\t\treturn c, nil\n\t}\n\treturn nil, errors.New(\"listener closed\")\n}", "title": "" }, { "docid": "970003fda49821b59ad2672cc6ab38b7", "score": "0.60430694", "text": "func NetListener(customListener net.Listener) transport.ListenOption {\n\treturn func(o *transport.ListenOptions) {\n\t\tif customListener == nil {\n\t\t\treturn\n\t\t}\n\t\tif o.Context == nil {\n\t\t\to.Context = context.TODO()\n\t\t}\n\t\to.Context = context.WithValue(o.Context, netListener{}, customListener)\n\t}\n}", "title": "" }, { "docid": "497d3d99c69de6620c73534de76d7b95", "score": "0.60405177", "text": "func (l *listener) Accept() (net.Conn, error) {\n\tc, rsa, err := l.c.Accept(0)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsavm := rsa.(*unix.SockaddrVM)\n\tremote := &Addr{\n\t\tContextID: savm.CID,\n\t\tPort: savm.Port,\n\t}\n\n\treturn &Conn{\n\t\tc: c,\n\t\tlocal: l.addr,\n\t\tremote: remote,\n\t}, nil\n}", "title": "" }, { "docid": "0650d920e63d08ff1044c81df5d76436", "score": "0.603796", "text": "func Listener(l net.Listener) server.Option {\n\treturn setServerOption(netListener{}, l)\n}", "title": "" }, { "docid": "5df6510fa89da6dfe0255bc920a2787c", "score": "0.602694", "text": "func Listen(network, address string) (Listener, error) {}", "title": "" }, { "docid": "09acd62f47ed855e3a120a1d901d831a", "score": "0.6017256", "text": "func Serve(l net.Listener) error {\n\terrs := make(chan error)\n\t// This goroutine prints any errors encountered by handleNewConnection()\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase e := <-errs:\n\t\t\t\tlog.Printf(\"Listen server reported an error: %s\\n\", e)\n\t\t\t}\n\t\t}\n\t}()\n\t// Start our connection listener, asynchronously handle connections using handleNewConnection\n\tvar err error\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tbreak\n\t\t}\n\t\tgo handleNewConnection(conn, errs)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "1dec2619606e52162a00e12f7f7be5d5", "score": "0.60107493", "text": "func (s Server) Serve(listener net.Listener) error {\n\tctx := context.TODO()\n\t// TODO: Have this configurable in the Server struct, and augment this\n\t// with peer info.\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgo s.serveConn(ctx, conn)\n\t}\n}", "title": "" }, { "docid": "f6298cc0fbe0f549c71c2e62891de8fa", "score": "0.60051626", "text": "func (srv *Server) Serve(ln Listener, idx int) error {\n\n\tdefer ln.Close()\n\tvar tempDelay time.Duration // how long to sleep on accept failure\n\n\tsrv.trackListener(ln, idx, true)\n\tdefer srv.trackListener(ln, idx, false)\n\n\tacceptCheckFunc := srv.bindings[idx].LifecycleCallbacks.OnAccept\n\tcloseNotifyFunc := srv.bindings[idx].LifecycleCallbacks.OnClose\n\n\tserveCtx, cancelFunc := context.WithCancel(context.Background())\n\tdefer cancelFunc()\n\tfor {\n\t\tsrv.waitThrottle(idx, srv.doneChan)\n\t\trw, e := ln.Accept()\n\t\tif e != nil {\n\t\t\tselect {\n\t\t\tcase <-srv.doneChan:\n\t\t\t\treturn ErrServerClosed\n\t\t\tdefault:\n\t\t\t}\n\t\t\tif ne, ok := e.(net.Error); ok && ne.Temporary() {\n\t\t\t\tif tempDelay == 0 {\n\t\t\t\t\ttempDelay = 5 * time.Millisecond\n\t\t\t\t} else {\n\t\t\t\t\ttempDelay *= 2\n\t\t\t\t}\n\t\t\t\tif max := 1 * time.Second; tempDelay > max {\n\t\t\t\t\ttempDelay = max\n\t\t\t\t}\n\t\t\t\tl.Error(\"qrpc: Accept\", zap.Duration(\"retrying in\", tempDelay), zap.Error(e))\n\t\t\t\ttime.Sleep(tempDelay)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tl.Error(\"qrpc: Accept fatal\", zap.Error(e)) // accept4: too many open files in system\n\t\t\ttime.Sleep(time.Second) // keep trying instead of quit\n\t\t\tcontinue\n\t\t}\n\t\ttempDelay = 0\n\n\t\tif acceptCheckFunc != nil {\n\t\t\te = acceptCheckFunc(rw)\n\t\t\tif e != nil {\n\t\t\t\tl.Debug(\"OnAccept\", zap.Error(e))\n\t\t\t\trw.Close()\n\t\t\t\tif closeNotifyFunc != nil {\n\t\t\t\t\tcloseNotifyFunc(rw)\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tutil.GoFunc(&srv.wg, func() {\n\t\t\tc := srv.newConn(serveCtx, rw, idx)\n\t\t\tc.serve()\n\t\t})\n\t}\n}", "title": "" }, { "docid": "56c0f4c073e4e88a6a597e121924054b", "score": "0.60039085", "text": "func (srv *Server) Serve(l net.Listener) error {\n\tdefer l.Close()\n\n\t// When the handler is not specified, the default dispatcher\n\t// will be used instead.\n\thandler := srv.Handler\n\tif handler == nil {\n\t\thandler = DefaultDispatcher\n\t}\n\n\tfor {\n\t\trwc, err := l.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tc := newConn(rwc)\n\t\tc.ReadTimeout = srv.ReadTimeout\n\t\tc.WriteTimeout = srv.WriteTimeout\n\n\t\tgo srv.serve(c, handler)\n\t}\n}", "title": "" }, { "docid": "28ee81be6fc9d60708a9900810c87936", "score": "0.59900546", "text": "func (l *listener) Accept() (conn net.Conn, err error) {\n\trawConn, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn\n\t}\n\tconn = &Conn{conn: rawConn}\n\treturn\n}", "title": "" }, { "docid": "e470872efe0df9e28ca3610dd42efe9c", "score": "0.59798014", "text": "func (s *Server) Serve(ln net.Listener) error {\n\tserver := &http.Server{\n\t\tHandler: s.mux,\n\t}\n\ts.server = server\n\n\t// ErrServerClosed is returned by the Server's Serve\n\t// after a call to Shutdown or Close, we can ignore it.\n\tif err := server.Serve(ln); err != nil && err != http.ErrServerClosed {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4bf67aac769062fc5c3cf94bba1dda25", "score": "0.5974373", "text": "func ServeListener(listener net.Listener) {\n\tDefaultMux.Compile()\n\t// Install our handler at the root of the standard net/http default mux.\n\t// This allows packages like expvar to continue working as expected.\n\thttp.Handle(\"/\", DefaultMux)\n\n\tlog.Println(\"Starting Goji on\", listener.Addr())\n\n\tgraceful.HandleSignals()\n\tbind.Ready()\n\tgraceful.PreHook(func() { log.Printf(\"Goji received signal, gracefully stopping\") })\n\tgraceful.PostHook(func() { log.Printf(\"Goji stopped\") })\n\n\terr := graceful.Serve(listener, http.DefaultServeMux)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tgraceful.Wait()\n}", "title": "" }, { "docid": "056210010f5ca2f77e8ed7637b792ad8", "score": "0.59735423", "text": "func (layer *Layer) Listener(listener net.Listener) (net.Listener, error) {\n\treturn net.Listen(layer.network, fmt.Sprintf(\"%s:%d\", layer.address, layer.port))\n}", "title": "" }, { "docid": "436c11b86df02a024d681c44baf2071a", "score": "0.59642565", "text": "func (l *Listener) Accept() (net.Conn, error) {\n\tl.closedMutex.Lock()\n\tdefer l.closedMutex.Unlock()\n\tfor !l.isClosed {\n\t\tl.closedCond.Wait()\n\t}\n\treturn nil, net.ErrClosed\n}", "title": "" }, { "docid": "056caf096fce63d7c4e90f17ddd1ff63", "score": "0.5961229", "text": "func (s *Server) Serve(lis net.Listener) error {\n\tlis = &onceCloseListener{Listener: lis}\n\tdefer lis.Close()\n\n\tif !s.trackListener(&lis, true) {\n\t\treturn fmt.Errorf(\"server closed\")\n\t}\n\tdefer s.trackListener(&lis, false)\n\n\thdlr := s.Handler\n\tif hdlr == nil {\n\t\thdlr = DefaultHandler\n\t}\n\n\tfor {\n\t\tconn, err := lis.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgo s.onConn(conn, hdlr)\n\t}\n}", "title": "" }, { "docid": "780cb973a26ef9d7bd3a4897bbde64f4", "score": "0.5959203", "text": "func (srv *Server) Serve(l net.Listener) error {\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tgo srv.serveConn(conn)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b94c0a8713c52b8775c366810a3f54f7", "score": "0.5955813", "text": "func (l *Layer) Accept() (net.Conn, error) { return l.ln.Accept() }", "title": "" }, { "docid": "930b69be7268faecfae1ec2e07851bac", "score": "0.5952725", "text": "func (m *Main) Listener() net.Listener { return m.ln }", "title": "" }, { "docid": "7c306f89db6d32c24ff9d0f4ade3e0a0", "score": "0.59420604", "text": "func (l *listenerWrapper) Accept() (net.Conn, error) {\n\tc, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &conn{Conn: c}, nil\n}", "title": "" }, { "docid": "7e1214bcc775169eba7f92cd07083197", "score": "0.59394455", "text": "func (srv *Server) Serve(lis net.Listener) error {\n\treturn srv.serveImpl(lis, true)\n}", "title": "" }, { "docid": "736038e64f1ea024abe057e31b989d09", "score": "0.5936615", "text": "func Listener(l net.Listener) Option {\n\treturn setServerOption(netListener{}, l)\n}", "title": "" }, { "docid": "c20d8ee80c91ab11e81878e20f5299e2", "score": "0.59294724", "text": "func Serve(l net.Listener, handler http.Handler) error {\n\tdefaultServer = NewWithServer(&http.Server{Handler: handler})\n\treturn defaultServer.Serve(l)\n}", "title": "" }, { "docid": "c20d8ee80c91ab11e81878e20f5299e2", "score": "0.59294724", "text": "func Serve(l net.Listener, handler http.Handler) error {\n\tdefaultServer = NewWithServer(&http.Server{Handler: handler})\n\treturn defaultServer.Serve(l)\n}", "title": "" }, { "docid": "6972f9681fd69152c88768fda63d8205", "score": "0.59218794", "text": "func (s *Server) Serve(l net.Listener) error {\n\tserveErr := errors.New(\"already serving\")\n\ts.serveOnce.Do(func() {\n\t\ts.setAppStatus(appserver.AppDetailedStatusStarting)\n\t\tif err := EnableIPv4Forwarding(); err != nil {\n\t\t\tserveErr = fmt.Errorf(\"error enabling IPv4 forwarding: %w\", err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"Set IPv4 forwarding = 1\")\n\t\tdefer func() {\n\t\t\ts.revertIPv4ForwardingValue()\n\t\t}()\n\n\t\tif err := EnableIPv6Forwarding(); err != nil {\n\t\t\tserveErr = fmt.Errorf(\"error enabling IPv6 forwarding: %w\", err)\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"Set IPv6 forwarding = 1\")\n\t\tdefer func() {\n\t\t\ts.revertIPv6ForwardingValue()\n\t\t}()\n\n\t\tif err := EnableIPMasquerading(s.defaultNetworkInterface); err != nil {\n\t\t\tserveErr = fmt.Errorf(\"error enabling IP masquerading for %s: %w\", s.defaultNetworkInterface, err)\n\t\t\treturn\n\t\t}\n\n\t\tfmt.Println(\"Enabled IP masquerading\")\n\n\t\tdefer func() {\n\t\t\ts.disableIPMasquerading()\n\t\t}()\n\n\t\tif err := SetIPTablesForwardAcceptPolicy(); err != nil {\n\t\t\tserveErr = fmt.Errorf(\"error settings iptables forward policy to ACCEPT\")\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"Set iptables forward policy to ACCEPT\")\n\n\t\tdefer func() {\n\t\t\ts.restoreIPTablesForwardPolicy()\n\t\t}()\n\n\t\ts.lisMx.Lock()\n\t\ts.lis = l\n\t\ts.lisMx.Unlock()\n\t\ts.setAppStatus(appserver.AppDetailedStatusRunning)\n\t\tfor {\n\t\t\tconn, err := s.lis.Accept()\n\t\t\tif err != nil {\n\t\t\t\tserveErr = fmt.Errorf(\"failed to accept client connection: %w\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tgo s.serveConn(conn)\n\t\t}\n\t})\n\n\ts.setAppError(serveErr)\n\treturn serveErr\n}", "title": "" }, { "docid": "135dc015e64150687a410c76439a25c9", "score": "0.5916407", "text": "func (server *Server) createListenner(port string) net.Listener {\n //create listenner.\n l, err := net.Listen(server.connectionType, server.ipAddr+\":\"+port)\n if err != nil {\n fmt.Println(\"Error listening:\", err.Error())\n os.Exit(1)\n }\n //save the current port\n server.port = port\n return l\n}", "title": "" }, { "docid": "3a3dcae08b00eef9c8efd857afdd1e21", "score": "0.590515", "text": "func (l *listener) Accept() (c net.Conn, err error) {\n\tc, err = l.Listener.Accept()\n\tif err != nil {\n\t\tif l.hasState(stateClosing) {\n\t\t\terr = errShutdownRequested\n\t\t}\n\t\treturn\n\t}\n\tif l.tlsConfigured() {\n\t\tc = tls.Server(c, l.tlsConfig)\n\t}\n\treturn\n}", "title": "" }, { "docid": "ccbf9bd076e04caa581afa6cb794ce8b", "score": "0.5896439", "text": "func (srv *Server) Serve(l net.Listener) error {\n\t// remember net.Listener\n\tsrv.mu.Lock()\n\tsrv.listeners[l] = struct{}{}\n\tsrv.mu.Unlock()\n\tdefer func() {\n\t\tsrv.mu.Lock()\n\t\tdelete(srv.listeners, l)\n\t\tsrv.mu.Unlock()\n\t}()\n\n\t// replace ConnState\n\tsrv.connStateOnce.Do(func() {\n\t\tsrv.originalConnState = srv.Server.ConnState\n\t\tsrv.Server.ConnState = srv.connState\n\t})\n\n\terr := srv.Server.Serve(l)\n\n\tgo func() {\n\t\t// wait for closing keep-alive connection by sending `Connection: Close` header.\n\t\ttime.Sleep(srv.KillTimeOut)\n\n\t\t// time out, close all idle connections\n\t\tsrv.mu.Lock()\n\t\tfor conn := range srv.idlePool {\n\t\t\tconn.Close()\n\t\t}\n\t\tsrv.mu.Unlock()\n\t}()\n\n\t// wait all connections have done\n\tsrv.wg.Wait()\n\n\tif atomic.LoadInt32(&srv.closed) != 0 {\n\t\t// ignore closed network error when srv.Close() is called\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a01e06b8a215ab83020d471c215d29f9", "score": "0.58941436", "text": "func (p *Proxy) Serve(listener net.Listener) error {\n\tp.streamWaitGroup.Add(1)\n\tdefer p.streamWaitGroup.Done()\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tselect {\n\t\t\tcase <-p.ctx.Done():\n\t\t\t\treturn nil\n\t\t\tdefault:\n\t\t\t\treturn fmt.Errorf(\"cannot accept a new connection: %w\", err)\n\t\t\t}\n\t\t}\n\n\t\tipAddr := conn.RemoteAddr().(*net.TCPAddr).IP // nolint: forcetypeassert\n\t\tlogger := p.logger.BindStr(\"ip\", ipAddr.String())\n\n\t\tif !p.allowlist.Contains(ipAddr) {\n\t\t\tconn.Close()\n\t\t\tlogger.Info(\"ip was rejected by allowlist\")\n\t\t\tp.eventStream.Send(p.ctx, NewEventIPAllowlisted(ipAddr))\n\n\t\t\tcontinue\n\t\t}\n\n\t\tif p.blocklist.Contains(ipAddr) {\n\t\t\tconn.Close()\n\t\t\tlogger.Info(\"ip was blacklisted\")\n\t\t\tp.eventStream.Send(p.ctx, NewEventIPBlocklisted(ipAddr))\n\n\t\t\tcontinue\n\t\t}\n\n\t\terr = p.workerPool.Invoke(conn)\n\n\t\tswitch {\n\t\tcase err == nil:\n\t\tcase errors.Is(err, ants.ErrPoolClosed):\n\t\t\treturn nil\n\t\tcase errors.Is(err, ants.ErrPoolOverload):\n\t\t\tlogger.Info(\"connection was concurrency limited\")\n\t\t\tp.eventStream.Send(p.ctx, NewEventConcurrencyLimited())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d9c200604f2afe1e06447efda37bc425", "score": "0.5885582", "text": "func (listener *Listener) Accept() (net.Conn, error) {\n\treturn listener.AcceptTProxy()\n}", "title": "" }, { "docid": "e0c0958e71106011f255a8357464f133", "score": "0.58760697", "text": "func (ln *Listener) Accept() (net.Conn, error) {\n\tacc := <-ln.accepting\n\tif acc != nil {\n\t\t//return acc()\n\t\tc, err := acc()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &safeConnEOF{c}, nil // TODO: remove wrapper when fixed\n\t}\n\treturn nil, os.ErrClosed\n}", "title": "" }, { "docid": "8a2f1863c34d3dd5bdff7ac64a49b53c", "score": "0.58750194", "text": "func (s *Server) Serve(l net.Listener) error {\n\treturn s.Serve(l)\n}", "title": "" }, { "docid": "19a25e5e368298e09ee4cca8d9bd441d", "score": "0.5871049", "text": "func (l *NetListener) Accept() (net.Conn, error) {\n\tc, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn c, err\n\t}\n\tif glog.V(5) {\n\t\tglog.Info(\"Accepted conn:\", c.RemoteAddr().String())\n\t}\n\tmutex.Lock()\n\tconn := NetConn{Conn: c, session: l.session}\n\tconns[conn.RemoteAddr().String()] = &conn\n\tmutex.Unlock()\n\tif l.session != nil {\n\t\tl.session.Started(conn.LocalAddr(), conn.RemoteAddr())\n\t}\n\treturn conn, err\n}", "title": "" }, { "docid": "fffd70c975a74b0072a20cbe8bf0262e", "score": "0.58685195", "text": "func listen(listener net.Listener, remoteDialer func(dest string) (net.Conn, error)) {\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tif netErr, ok := err.(net.Error); ok && netErr.Temporary() {\n\t\t\t\tlog.Printf(\"Temporary error while accepting connection: %s\", netErr)\n\t\t\t}\n\n\t\t\tlog.Fatalf(\"Unrecoverable error while accepting connection: %s\", err)\n\t\t\treturn\n\t\t}\n\n\t\tgo handleTCPConn(conn, remoteDialer)\n\t}\n}", "title": "" }, { "docid": "34be3d4d8dce5ad60184e6495d50d7f4", "score": "0.58544105", "text": "func listen(addr net.Addr) (net.Listener, error) {\n\t// Servers without an address can still work without network.\n\tif addr != nil {\n\t\treturn net.Listen(addr.Network(), addr.String())\n\t}\n\n\taddr = NewAddr(\"none\", \"none\")\n\n\treturn &listener{addr}, nil\n}", "title": "" }, { "docid": "42f487b1d154550604a07554ca804793", "score": "0.585305", "text": "func (ts *Server) Accept() (net.Conn, error) {\n\treturn ts.listener.Accept()\n}", "title": "" }, { "docid": "105f1ef957d997ec424c8d329533692c", "score": "0.58501315", "text": "func (l *Listener) Serve() error {\n\t// Ensure we mark state closed if we fail before Close is called externally.\n\tdefer l.Close()\n\n\tif atomic.LoadInt32(&l.stopFlag) != 0 {\n\t\treturn errors.New(\"serve called on a closed listener\")\n\t}\n\n\tlisten, err := l.listenFunc()\n\tif err != nil {\n\t\treturn err\n\t}\n\tclose(l.listeningChan)\n\n\tfor {\n\t\tconn, err := listen.Accept()\n\t\tif err != nil {\n\t\t\tif atomic.LoadInt32(&l.stopFlag) == 1 {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\tgo l.handleConn(conn)\n\t}\n}", "title": "" }, { "docid": "1c3a8daa25366ba43db9d96b67e6ef88", "score": "0.58497554", "text": "func (ln *inmemListener) Accept() (net.Conn, error) {\n\tdeadline := ln.deadline\n\tif !deadline.IsZero() {\n\t\tselect {\n\t\tcase conn := <-ln.pendingConns:\n\t\t\treturn conn, nil\n\t\tcase <-time.After(time.Until(deadline)):\n\t\t\treturn nil, deadlineError(\"deadline\")\n\t\tcase <-ln.stopCh:\n\t\t\treturn nil, errors.New(\"listener shut down\")\n\t\t}\n\t}\n\n\tselect {\n\tcase conn := <-ln.pendingConns:\n\t\treturn conn, nil\n\tcase <-ln.stopCh:\n\t\treturn nil, errors.New(\"listener shut down\")\n\t}\n}", "title": "" }, { "docid": "f6a673ba2e1c5d31ee6b35318806cece", "score": "0.58460355", "text": "func newListener(transport string, addr string, options ...func(*net.Listener) error) (net.Listener, error) {\n\n\tlistener, err := net.Listen(transport, addr)\n\tif err != nil {\n\t\treturn listener, err\n\t}\n\n\tfor _, option := range options {\n\t\terr = option(&listener)\n\t\tif err != nil {\n\t\t\treturn listener, err // further options won't be executed\n\t\t}\n\t}\n\n\treturn listener, nil\n}", "title": "" }, { "docid": "73d4e2e8cdfe30176a122d288403fd80", "score": "0.58399016", "text": "func NewListener(l net.Listener) *Listener {\n\treturn &Listener{\n\t\tListener: l,\n\t\tlimits: struct {\n\t\t\tglobal int\n\t\t\tconnection int\n\t\t}{global: 0, connection: 0},\n\t\tmu: &sync.Mutex{},\n\t\tctx: context.Background(),\n\t}\n}", "title": "" }, { "docid": "0c7a79ce4643b89458782e3dc2f0628c", "score": "0.58393174", "text": "func Listen(listener net.Listener, pipeline Pipeline) {\n\n\tdefer listener.Close()\n\n\tfor pipeline.Open() {\n\t\tsocketConn, err := listener.Accept()\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error %s trying to listen on %s.\", err, listener)\n\t\t\tgo pipeline.Error(err)\n\t\t\tcontinue\n\t\t}\n\n\t\tgo pipeline.Handler(socketConn)\n\t}\n\n\tfmt.Printf(\"Closing listener.\\n\")\n}", "title": "" }, { "docid": "bf1463700e56fd6fa258cef76170c856", "score": "0.5833859", "text": "func socketListener(chn chan<- string, errChn chan<- error) {\n\tln, err := net.Listen(\"unix\", cfg.SockFile)\n\tif err != nil {\n\t\terrChn <- err\n\t\treturn\n\t}\n\tdefer ln.Close()\n\n\t// signal that we created a socket\n\tchn <- \"socket_opened\"\n\n\t// accept\n\tc, err := acceptConn(ln)\n\tif err != nil {\n\t\terrChn <- err\n\t\treturn\n\t}\n\n\t// read from the socket\n\tbuf := make([]byte, 512)\n\tnr, err := c.Read(buf)\n\tif err != nil {\n\t\terrChn <- err\n\t\treturn\n\t}\n\n\tdata := buf[0:nr]\n\tswitch string(data) {\n\tcase \"get_listener\":\n\t\tfmt.Println(\"get_listener received - sending listener information\")\n\n\t\terr := sendListener(c)\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Unable to send http listener socket over the unix domain socket\")\n\t\t\terrChn <- err\n\t\t\treturn\n\t\t}\n\n\t\tchn <- \"listener_sent\"\n\t}\n}", "title": "" }, { "docid": "f041d9ef31bdb5864e1deae42dacf32d", "score": "0.58333045", "text": "func (l *maListener) Accept() (manet.Conn, error) {\n\tnconn, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn wrapNetConn(nconn, l.wrapMA), nil\n}", "title": "" }, { "docid": "0574361de754c8dc5a998c220528fca8", "score": "0.5831235", "text": "func Serve(l net.Listener) (err error) {\n\tfor {\n\t\tvar conn net.Conn\n\n\t\tif conn, err = l.Accept(); err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tgo func(c net.Conn) {\n\t\t\tvar conduit *sio.Conduit\n\n\t\t\tdefer c.Close()\n\n\t\t\tif conduit, err = sio.NewConduit(c); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\t// This is just an echo server, so... echo!\n\t\t\tif _, err = io.Copy(conduit, conduit); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\t\t}(conn)\n\t}\n}", "title": "" }, { "docid": "aaec4f6f2339a14f1b395c1603af39f8", "score": "0.58282423", "text": "func (l *mixnetListener) Accept() (net.Conn, error) {\n\tc, err := l.Listener.Accept()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Tao handshake Protocol:\n\t// 0. TLS handshake explicit handshake (so we can check cert first)\n\t// If cert is presented, there are two optional steps:\n\t// 1a. Client -> Server: Tao delegation for X.509 certificate.\n\t// 2a. Server: checks for a Tao-authorized program.\n\t// Then send back your certs:\n\t// 3. Server -> Client: Tao delegation for X.509 certificate.\n\t// 4. Client: checks for a Tao-authorized program.\n\terr = c.(*tls.Conn).Handshake()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tms := util.NewMessageStream(c)\n\tvar a tao.Attestation\n\tif len(c.(*tls.Conn).ConnectionState().PeerCertificates) > 0 {\n\t\tif err := ms.ReadMessage(&a); err != nil {\n\t\t\tc.Close()\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err := tao.AddEndorsements(l.guard, &a, l.verifier); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tpeerCert := c.(*tls.Conn).ConnectionState().PeerCertificates[0]\n\t\tif err := tao.ValidatePeerAttestation(&a, peerCert, l.guard); err != nil {\n\t\t\tc.Close()\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tif _, err := ms.WriteMessage(l.delegation); err != nil {\n\t\tc.Close()\n\t\treturn nil, err\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "c7ab876df3e66cae288fe0e44c3b2c98", "score": "0.58217853", "text": "func (server *Server) listen(listener net.Listener, done chan bool) {\n\n\tfor {\n\t\tconn, err := listener.Accept()\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\tgo server.handleClient(&conn)\n\t\t//every thing is ok\n\t}\n\n}", "title": "" }, { "docid": "1a55757a7506833a0e9c9f6ffcb37f6b", "score": "0.5817412", "text": "func (l *BfeListener) Accept() (net.Conn, error) {\n\tconn, err := l.Listener.Accept()\n\tif err != nil {\n\t\tlog.Logger.Debug(\"BfeListener: accept error %s\", err)\n\t\treturn nil, err\n\t}\n\n\tswitch l.BalancerType {\n\tcase bfe_conf.BalancerProxy:\n\t\tconn = bfe_proxy.NewConn(conn, l.ProxyHeaderTimeout, l.ProxyHeaderLimit)\n\t\tlog.Logger.Debug(\"BfeListener: accept connection via PROXY\")\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "7d38229e3162d079b27f52777f792316", "score": "0.58169895", "text": "func (s *Server) Serve(l net.Listener) error {\n\ts.listener = l\n\tfor {\n\t\ttcpConn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tif s.isClosed() {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"accept incoming connection: %s\", err)\n\t\t}\n\t\t// Before use, a handshake must be performed on the incoming net.Conn.\n\t\tgo s.handleConn(tcpConn)\n\t}\n}", "title": "" }, { "docid": "44ddf64d23add57ef53963ffcc68ac2e", "score": "0.58120775", "text": "func (l *listenerWrapper) Accept() (net.Conn, error) {\n\tvar retries int\n\tfor {\n\t\tconn, err := l.Listener.Accept()\n\t\tif err != nil {\n\t\t\t// Temporary() method is implemented by certain error types returned\n\t\t\t// from the net package, and it is useful for us to not shutdown the\n\t\t\t// server in these conditions. The listen queue being full is one\n\t\t\t// such case.\n\t\t\tif ne, ok := err.(interface{ Temporary() bool }); !ok || !ne.Temporary() {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tretries++\n\t\t\ttimer := time.NewTimer(backoffFunc(retries))\n\t\t\tselect {\n\t\t\tcase <-timer.C:\n\t\t\tcase <-l.closed.Done():\n\t\t\t\ttimer.Stop()\n\t\t\t\t// Continuing here will cause us to call Accept() again\n\t\t\t\t// which will return a non-temporary error.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\t// Reset retries after a successful Accept().\n\t\tretries = 0\n\n\t\t// TODO: Close connections if in \"non-serving\" state\n\n\t\t// Since the net.Conn represents an incoming connection, the source and\n\t\t// destination address can be retrieved from the local address and\n\t\t// remote address of the net.Conn respectively.\n\t\tdestAddr, ok1 := conn.LocalAddr().(*net.TCPAddr)\n\t\tsrcAddr, ok2 := conn.RemoteAddr().(*net.TCPAddr)\n\t\tif !ok1 || !ok2 {\n\t\t\t// If the incoming connection is not a TCP connection, which is\n\t\t\t// really unexpected since we check whether the provided listener is\n\t\t\t// a TCP listener in Serve(), we return an error which would cause\n\t\t\t// us to stop serving.\n\t\t\treturn nil, fmt.Errorf(\"received connection with non-TCP address (local: %T, remote %T)\", conn.LocalAddr(), conn.RemoteAddr())\n\t\t}\n\n\t\tl.mu.RLock()\n\t\tfc, err := l.filterChains.Lookup(xdsclient.FilterChainLookupParams{\n\t\t\tIsUnspecifiedListener: l.isUnspecifiedAddr,\n\t\t\tDestAddr: destAddr.IP,\n\t\t\tSourceAddr: srcAddr.IP,\n\t\t\tSourcePort: srcAddr.Port,\n\t\t})\n\t\tl.mu.RUnlock()\n\t\tif err != nil {\n\t\t\t// When a matching filter chain is not found, we close the\n\t\t\t// connection right away, but do not return an error back to\n\t\t\t// `grpc.Serve()` from where this Accept() was invoked. Returning an\n\t\t\t// error to `grpc.Serve()` causes the server to shutdown. If we want\n\t\t\t// to avoid the server from shutting down, we would need to return\n\t\t\t// an error type which implements the `Temporary() bool` method,\n\t\t\t// which is invoked by `grpc.Serve()` to see if the returned error\n\t\t\t// represents a temporary condition. In the case of a temporary\n\t\t\t// error, `grpc.Serve()` method sleeps for a small duration and\n\t\t\t// therefore ends up blocking all connection attempts during that\n\t\t\t// time frame, which is also not ideal for an error like this.\n\t\t\tl.logger.Warningf(\"connection from %s to %s failed to find any matching filter chain\", conn.RemoteAddr().String(), conn.LocalAddr().String())\n\t\t\tconn.Close()\n\t\t\tcontinue\n\t\t}\n\t\treturn &connWrapper{Conn: conn, filterChain: fc, parent: l}, nil\n\t}\n}", "title": "" }, { "docid": "819f47860bc3388a043deb6a83d56c27", "score": "0.5811849", "text": "func Listen(network, laddr string, config *tls.Config, g Guard, v *Verifier, del *Attestation) (net.Listener, error) {\n\tconfig.ClientAuth = tls.RequireAnyClientCert\n\tinner, err := tls.Listen(network, laddr, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &listener{inner, g, v, del}, nil\n}", "title": "" }, { "docid": "8df072f78835d97c15c92ce00e486efc", "score": "0.5809842", "text": "func (srv *Server) Serve(lis net.Listener) error {\n\tfor {\n\t\tcn, err := lis.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif ka := srv.config.TCPKeepAlive; ka > 0 {\n\t\t\tif tc, ok := cn.(*net.TCPConn); ok {\n\t\t\t\t_ = tc.SetKeepAlive(true)\n\t\t\t\t_ = tc.SetKeepAlivePeriod(ka)\n\t\t\t}\n\t\t}\n\n\t\tgo srv.serveClient(newClient(cn))\n\t}\n}", "title": "" }, { "docid": "1a4077c733fe340cd956e0b390a07833", "score": "0.58065337", "text": "func (srv *Server) Serve(ctx context.Context, ln net.Listener) error {\n\tsrv.Logf(\"Listening on %v\", ln.Addr())\n\tdefer ln.Close()\n\tconns := make(chan net.Conn)\n\tacceptErr := make(chan error)\n\tgo func() {\n\t\tfor {\n\t\t\tc, err := ln.Accept()\n\t\t\tif err != nil {\n\t\t\t\tif ne, ok := err.(net.Error); ok && ne.Temporary() {\n\t\t\t\t\tsrv.Logf(\"Accept error: %v\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tsrv.Logf(\"Fatal accept error: %v\", err)\n\t\t\t\tacceptErr <- err\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tconns <- c\n\t\t}\n\t}()\n\n\tvar (\n\t\twg sync.WaitGroup\n\t\tstop = false\n\t)\n\tfor !stop {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tstop = true\n\t\tcase <-acceptErr:\n\t\t\tstop = true\n\t\tcase c := <-conns:\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tsrv.Logf(\"Accepted connection from %s\", c.RemoteAddr())\n\t\t\t\tsrv.newSession(c).serve(ctx)\n\t\t\t\twg.Done()\n\t\t\t}()\n\t\t}\n\t}\n\twg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "4065ce4bf339b76ed55e52afde069b2d", "score": "0.5805401", "text": "func (l *tlsKeepaliveListener) Accept() (c net.Conn, err error) {\n\tc, err = l.Listener.Accept()\n\tif err != nil {\n\t\treturn\n\t}\n\tc = tls.Server(c, l.config)\n\treturn c, nil\n}", "title": "" }, { "docid": "e1aed3e2c31eaf8f193a36cad6407f3d", "score": "0.57977164", "text": "func (c *Client) Listen(n appnet.Type, port routing.Port) (net.Listener, error) {\n\tlocal := appnet.Addr{\n\t\tNet: n,\n\t\tPubKey: c.conf.VisorPK,\n\t\tPort: port,\n\t}\n\n\tlisID, err := c.rpcC.Listen(local)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tlistener := &Listener{\n\t\tlog: c.log,\n\t\tid: lisID,\n\t\trpc: c.rpcC,\n\t\taddr: local,\n\t\tcm: idmanager.New(),\n\t}\n\n\tlistener.freeLisMx.Lock()\n\n\tfreeLis, err := c.lm.Add(lisID, listener)\n\tif err != nil {\n\t\tlistener.freeLisMx.Unlock()\n\n\t\tif err := listener.Close(); err != nil {\n\t\t\tc.log.WithError(err).Error(\"Unexpected error while closing listener.\")\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\tlistener.freeLis = freeLis\n\n\tlistener.freeLisMx.Unlock()\n\n\treturn listener, nil\n}", "title": "" }, { "docid": "3a12de05eec48867384379fbe0f0173b", "score": "0.5797298", "text": "func NewListener(lstn net.Listener) net.Listener {\n\treturn NewListenerWith(stats.DefaultEngine, lstn)\n}", "title": "" }, { "docid": "5d89e6cc7274def390ff24425e035f92", "score": "0.579669", "text": "func (l *TCPListener) AcceptTCP() (*TCPConn, error) {}", "title": "" }, { "docid": "7cdf042ea86638c8fe74470817b6abea", "score": "0.57959795", "text": "func Serve(l net.Listener) error {\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif sec {\n\t\t\tsecure.Handshake(conn)\n\t\t\tcontinue\n\t\t}\n\t\tgo pipe(conn, conn)\n\t}\n\treturn nil\n}", "title": "" } ]
af5a94ea670ab518b70c93907e79e793
Deprecated: Use Response_Workers.ProtoReflect.Descriptor instead.
[ { "docid": "b6d94ea98b773dc022b922900db4aa52", "score": "0.70325637", "text": "func (*Response_Workers) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{7}\n}", "title": "" } ]
[ { "docid": "04c2e940d51ec6f843215c68bf5fb311", "score": "0.6948607", "text": "func (*Response_Workers_Info) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "51e913568e153ab1f1fe9d4ad1fe14fe", "score": "0.6947203", "text": "func (*Request_Workers) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "e4aa5017104768de90fe1f91c49a83e2", "score": "0.6946297", "text": "func (*Request_Workers_Name) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "fe7c2acf9a6b4afef92772806b3c79b9", "score": "0.6943078", "text": "func (*Request_Workers_ID) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "34f6ff93f8e98f9a2fc4429e78ada8c1", "score": "0.68994546", "text": "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "69124f8da1b539755bd7444056c4b0d6", "score": "0.6825985", "text": "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.6819676", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "960ccb11fe9123315b7fade3573baa43", "score": "0.6795579", "text": "func (*EvictWritersResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "2afe6cd9edaf49fc958d20eb9f2dca94", "score": "0.6757903", "text": "func (*GetMetricsInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "b640f20e26ebcf04554c487eedb41b79", "score": "0.6734983", "text": "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "3ab7613230c6da0ee0c1f1e5794eb804", "score": "0.6729046", "text": "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "title": "" }, { "docid": "eb39db0d6b926b3143384a9cba5fff5d", "score": "0.6713584", "text": "func (*RefreshCallQueueResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "04b935a942c5b8e6aaff355d572b1015", "score": "0.671051", "text": "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "title": "" }, { "docid": "547e27a83d465ecdbbb5d11db36db9a4", "score": "0.67042714", "text": "func (*AddProducerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "bbc524c2c62696d4c5f5a6ee99e598d2", "score": "0.6687897", "text": "func (*RecentMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "d58ff8c943f8ad8bafadee12aa7c1e27", "score": "0.6678193", "text": "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "3464cb071f0a438206006f951cad165f", "score": "0.6663573", "text": "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "5a80b9c2277934d79109cfddc4cb82bd", "score": "0.664106", "text": "func (*GetBalancerBandwidthResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "aacda3c84a2a04e1240dfd4105f73652", "score": "0.6634787", "text": "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "title": "" }, { "docid": "2e8d9c648dfb098b7b5186719fc4b75e", "score": "0.662666", "text": "func (*UpdateTelemetryReportedResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "eefad4fc0a6190fc1e581704fd3037af", "score": "0.66238034", "text": "func (*MetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "c4e0c99a41bc277d5d316a9ab5d31e89", "score": "0.66173947", "text": "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "59ee29ec355e7b0f57369569aa747f1b", "score": "0.6615035", "text": "func (*Response_CreateWorker) Descriptor() ([]byte, []int) {\n\treturn file_proto_work_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a48b3fc2baa55d78df03156954824146", "score": "0.66132194", "text": "func (*SendFromMinerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "5878afaf71a7ddabf6e5b1fde21ee581", "score": "0.66004217", "text": "func (*RefreshResponse) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{17}\n}", "title": "" }, { "docid": "44cb726aafc4c3280bcc7c1a68859c09", "score": "0.65998703", "text": "func (*ListMessagesResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{15}\n}", "title": "" }, { "docid": "6c2cb31078d3143144840838a3152606", "score": "0.65971375", "text": "func (*RefreshRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "9a98404a14e087eca16556596bf79f5b", "score": "0.65830886", "text": "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "c80af1a616239bf428b18ff9d644e0f2", "score": "0.65799916", "text": "func (*WatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "55d6b477ce7c7cc68b36608db2bfd5f8", "score": "0.6572927", "text": "func (*StandardProtocols) Descriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "0b72b448d0cb268be041c97e8aa977e8", "score": "0.6566319", "text": "func (*CMsgGCPlayerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{117}\n}", "title": "" }, { "docid": "87cbc4c872c5b9363c9813abc2ee5d75", "score": "0.65586406", "text": "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "41990ed90c7427c39b120f8234007336", "score": "0.65561837", "text": "func (*UpdateConversationResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "d21db54a9f4ab13889e9684eba40591e", "score": "0.6553403", "text": "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "df5187a7a50b46904deb2b27230469c0", "score": "0.6550937", "text": "func (x *fastReflection_MsgUpdateParams) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParams\n}", "title": "" }, { "docid": "817880f7dfa7b43d3ea4d9a0e03df30c", "score": "0.65457773", "text": "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b45804af2533189346e1a87ee66b960e", "score": "0.65434945", "text": "func (*WatchLimitResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "b6a60c3a363be48fefbb4c1018db6b9e", "score": "0.654298", "text": "func (*WatchLimitsResponse) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "aab97e40930921511eb07502bcbc28e0", "score": "0.6541593", "text": "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6b3458c6707a8cb092cd4455840c6ad2", "score": "0.65389717", "text": "func (*WatchRequestTypeProto) Descriptor() ([]byte, []int) {\n\treturn file_raft_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "0b564d4e4dd97d9966bdbb64ea68c23f", "score": "0.653682", "text": "func (*ApiWarning) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "95dd2f837bf4ca03c012533277debe65", "score": "0.6532872", "text": "func (*ReportResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "9629bb9def4e0d9ca19b38ff0537c452", "score": "0.65260375", "text": "func (*ModifyResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "24c4cf1976616e3e94e39c16212e5443", "score": "0.6525858", "text": "func (*RefreshCallQueueRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_RefreshCallQueueProtocol_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "99097539054bc3cb75856e5ff711e216", "score": "0.6522683", "text": "func (*PatchTasksRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{154}\n}", "title": "" }, { "docid": "ad0ef08a3dcd3c9d7feeecf25f60bc22", "score": "0.6522185", "text": "func (*CreateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "68e417541665c551a6efc00457613b80", "score": "0.65161854", "text": "func (*CheckResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9570b8664c80344fc96ea3050b6f3768", "score": "0.65146846", "text": "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "b7d2c3791528ece9c432115b77fec03d", "score": "0.6512856", "text": "func (*AddProducerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f5be3320d2d74645aef0fc5ea13d4acb", "score": "0.6506056", "text": "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "698cae0bbce0a45139119016f6cef94b", "score": "0.6505565", "text": "func (*Retry_Conf_Grpc) Descriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_retry_proto_rawDescGZIP(), []int{0, 0, 3}\n}", "title": "" }, { "docid": "8044337f675cdeb7d39a1839e61399e4", "score": "0.65044224", "text": "func (*SendResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{27}\n}", "title": "" }, { "docid": "c5abd309c3a4a243dfb795e453b774e6", "score": "0.64919263", "text": "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "d01ab7e23b9988b7c7045491530b426c", "score": "0.64918786", "text": "func (*ListMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b82bc40d52fa4c364e20ac57ce577a4a", "score": "0.648983", "text": "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "8dacf4fbf05ac820251c0ffb34d3a360", "score": "0.64885914", "text": "func (*RecentMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "13b44209d8b5c65702d90be7e1d6ec42", "score": "0.64838386", "text": "func (*UpdateTelemetryReportedRequest) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{29}\n}", "title": "" }, { "docid": "c6dc773283265bd0d43a60e980f4f5d7", "score": "0.6482627", "text": "func (*FeedbackMetrics) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "27adb8465b6ac57c784f33e8bd24cdb2", "score": "0.64804196", "text": "func (*RunDisconnectedServicesJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "37c2e9a81b80ad626b90804e9728710c", "score": "0.64802235", "text": "func (*ListMessagesRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_threads_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "c2165efc075574910d02e08f6f39d82d", "score": "0.64783853", "text": "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "d8e0990c59a8fea1a03ee5d035bd2da8", "score": "0.64750636", "text": "func (*TelemetryParams) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{62}\n}", "title": "" }, { "docid": "a65ab7c43093a7b6f6a121c517a69554", "score": "0.64733726", "text": "func (*Message5907) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "fb1ddb6443cdf81602d35cce82a0181d", "score": "0.646912", "text": "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "cfe2db06445051d633e9781e3c56e94a", "score": "0.6468006", "text": "func (*Diagnostic) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "07bdc479d5a08a84ae5add8f9bc6b630", "score": "0.64675784", "text": "func (*ValidateReply) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "c63aceb00e5ddcb825b0ff11b2720016", "score": "0.6461815", "text": "func (*EvictWritersRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "2a700ce61586aed3eee2d772a0a73e53", "score": "0.64613885", "text": "func (*SendFromMinerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c1265750659ce06c6b02bbb00e7965b1", "score": "0.64582294", "text": "func (*RunDeleteDisconnectedServicesJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_external_applications_applications_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "564dcda5c270f87efac5837a1f815115", "score": "0.645693", "text": "func (*Listen) Descriptor() ([]byte, []int) {\n\treturn file_pkg_smgrpc_smgrpc_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c28b4b8eaed25d86b6505ce60a4334f1", "score": "0.64563096", "text": "func (*ListenRequest) Descriptor() ([]byte, []int) {\n\treturn file_threads_proto_rawDescGZIP(), []int{46}\n}", "title": "" }, { "docid": "47e7a220f7f02d82b86170aade74142b", "score": "0.64553154", "text": "func (*ChangeReport) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicemanagement_v1_resources_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "898d8ba28699b23e48f09c875c01713a", "score": "0.6453909", "text": "func (*StopBroadcastResponse) Descriptor() ([]byte, []int) {\n\treturn file_services_core_protobuf_servers_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "59e47a8b50781e5e152944c61660e213", "score": "0.6448955", "text": "func (*PerformanceResponse) Descriptor() ([]byte, []int) {\n\treturn file_commissionService_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "a4a6c3c4ddbf4524026b4a14a9c8c0e5", "score": "0.6448027", "text": "func (*Message7920) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{20}\n}", "title": "" }, { "docid": "c859f8756c022c70017e7c5b206720f4", "score": "0.64477164", "text": "func (*DeregisterResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_engine_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "24d2099ceb413d17708eb8d83244edd1", "score": "0.64471734", "text": "func (*RejectedJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "9568f8cf18df8244a6372fc581aceed6", "score": "0.64468384", "text": "func (*GenerateMessageResponse) Descriptor() ([]byte, []int) {\n\treturn file_google_ai_generativelanguage_v1beta2_discuss_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "141ff329deae5c5130f01dfc6b0ce365", "score": "0.6441541", "text": "func (*Message7921) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "3b82612a6cbde58052f4b878bb230095", "score": "0.64355034", "text": "func (*WatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_authzed_api_v0_watch_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "e11b38cd7c62e1f274bbb765a1bb820d", "score": "0.64348495", "text": "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "732ddf6e0207152b9eb2f5bd144e9221", "score": "0.64337254", "text": "func (*CreateAlterResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "de1face20f4f86d711123fdca95144d9", "score": "0.64294815", "text": "func (*HeartbeatRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_clusrun_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a584c8b4713fe492d79eb6d2ddccafbc", "score": "0.64292866", "text": "func (*GetStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "ae49bbb46ff8d31d0cad34b0895e31fb", "score": "0.64285684", "text": "func (*CMsgGCPlayerInfoSubmitResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{119}\n}", "title": "" }, { "docid": "6ab81a10f420f302af54808ae537c5f0", "score": "0.6428147", "text": "func (*GetServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "2e5ecc9b01b93c995757929d7e8b957e", "score": "0.64277136", "text": "func (*ReceiveBenchmarkJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_bench_receiving_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "74833794abd9692301acc0835072aad2", "score": "0.6427362", "text": "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "4e6c2758326af6c5aeda1cb86b5f4edd", "score": "0.6425658", "text": "func (*Message5908) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "51218dfb2c7b87f29059ddb755308b73", "score": "0.6420189", "text": "func (*RevokeJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{21}\n}", "title": "" }, { "docid": "1d3787cb624229e6b32c40bfcf02f29c", "score": "0.6420153", "text": "func (*BatchResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_buildbucket_proto_builds_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "983eb8557fa820b969fe5bd851801282", "score": "0.6416997", "text": "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "86a4377c9e10b9a9186e3294d39cc8fd", "score": "0.6413417", "text": "func (*WatchLimitsRequest) Descriptor() ([]byte, []int) {\n\treturn edgelq_limits_proto_v1alpha2_limit_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "ddf73526f602402fe5934c33bf75874b", "score": "0.6412446", "text": "func (*RefreshProjectResponse) Descriptor() ([]byte, []int) {\n\treturn file_web_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "84f15101f676abc2a0e846633c02611e", "score": "0.6408753", "text": "func (*TaskUpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_protobuf_v1_task_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "90aed803dd8518ce47ea539e85d5a3dc", "score": "0.6408333", "text": "func (*ReportRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_api_servicecontrol_v1_service_controller_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "cd8c7a05f84132d62ef0a65844cc8478", "score": "0.64068174", "text": "func (*PatchKeysRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{74}\n}", "title": "" }, { "docid": "a13e3dd79473a16314919ec32963d925", "score": "0.6403133", "text": "func (*RejectedJobResponse) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "840d7a5c8da1f8edc43be0bc145a9356", "score": "0.64025843", "text": "func (*CMsgClientToGCWageringRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{169}\n}", "title": "" }, { "docid": "41618ca03b8cb8e357735ae13af4fbb1", "score": "0.63991237", "text": "func (*PostModelVersionMetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{93}\n}", "title": "" } ]
f1e972341fa95e4ea0a86c4a8949e9c4
NewPcloudNetworksPortsPutBadRequest creates a PcloudNetworksPortsPutBadRequest with default headers values
[ { "docid": "ff467fb05d97a14df0799f34d4acc004", "score": "0.73109114", "text": "func NewPcloudNetworksPortsPutBadRequest() *PcloudNetworksPortsPutBadRequest {\n\treturn &PcloudNetworksPortsPutBadRequest{}\n}", "title": "" } ]
[ { "docid": "647ddc97b60357013149d8d1f706a0f7", "score": "0.63248795", "text": "func NewPcloudNetworksPutBadRequest() *PcloudNetworksPutBadRequest {\n\treturn &PcloudNetworksPutBadRequest{}\n}", "title": "" }, { "docid": "ad4efd5abc34e212176b0a52d60bcd7e", "score": "0.55596834", "text": "func NewPcloudNetworksPortsPutForbidden() *PcloudNetworksPortsPutForbidden {\n\treturn &PcloudNetworksPortsPutForbidden{}\n}", "title": "" }, { "docid": "c07af9e0909d6d05167eed4c35edcb90", "score": "0.55332", "text": "func NewPcloudNetworksPortsPutUnauthorized() *PcloudNetworksPortsPutUnauthorized {\n\treturn &PcloudNetworksPortsPutUnauthorized{}\n}", "title": "" }, { "docid": "4bad1bd0fa29b6c09f658ab480f19d8d", "score": "0.5471643", "text": "func NewPcloudCloudconnectionsPutBadRequest() *PcloudCloudconnectionsPutBadRequest {\n\treturn &PcloudCloudconnectionsPutBadRequest{}\n}", "title": "" }, { "docid": "1de368a53762ccda2ee948937c628bcb", "score": "0.5285382", "text": "func NewUpdateInputPortBadRequest() *UpdateInputPortBadRequest {\n\treturn &UpdateInputPortBadRequest{}\n}", "title": "" }, { "docid": "b1b4200f660652a24b060f0bcb2a2ab9", "score": "0.5238496", "text": "func NewPcloudNetworksGetallBadRequest() *PcloudNetworksGetallBadRequest {\n\treturn &PcloudNetworksGetallBadRequest{}\n}", "title": "" }, { "docid": "d9b746150d9f698970e4eaa09badb38c", "score": "0.51991224", "text": "func NewPcloudNetworksPortsPutNotFound() *PcloudNetworksPortsPutNotFound {\n\treturn &PcloudNetworksPortsPutNotFound{}\n}", "title": "" }, { "docid": "1e22acb7b69e2b5dcc5b6a5a6b955a80", "score": "0.5144827", "text": "func NewPcloudCloudconnectionsPostBadRequest() *PcloudCloudconnectionsPostBadRequest {\n\treturn &PcloudCloudconnectionsPostBadRequest{}\n}", "title": "" }, { "docid": "625617b34af5b17fcadfc462f3053f8e", "score": "0.5125548", "text": "func NewPcloudCloudinstancesVolumesPutBadRequest() *PcloudCloudinstancesVolumesPutBadRequest {\n\treturn &PcloudCloudinstancesVolumesPutBadRequest{}\n}", "title": "" }, { "docid": "e968207657941918aabd3a0f2e34dc86", "score": "0.5112611", "text": "func newBadRequest(format string, a ...interface{}) *echo.HTTPError {\n\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "d192d8d7d7b28c86f7375e782b956710", "score": "0.50871885", "text": "func NewRemoveInputPortBadRequest() *RemoveInputPortBadRequest {\n\treturn &RemoveInputPortBadRequest{}\n}", "title": "" }, { "docid": "d6a19bf96e16f122a5a4dddd38525070", "score": "0.5073428", "text": "func NewBindHostBadRequest() *BindHostBadRequest {\n\n\treturn &BindHostBadRequest{}\n}", "title": "" }, { "docid": "c925b25d7f9d4fdd98921e5f7a578db3", "score": "0.50481683", "text": "func (o *GetIotHostsBadRequest) Code() int {\n\treturn 400\n}", "title": "" }, { "docid": "9dcf724b215c9d212f0aaa9038e8d42a", "score": "0.50440246", "text": "func NewListByProjectBadRequest(body *ListByProjectBadRequestResponseBody) *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": "9c08dd43ad23001f85c640dd91e4000e", "score": "0.5029092", "text": "func NewPcloudNetworksPortsPutOK() *PcloudNetworksPortsPutOK {\n\treturn &PcloudNetworksPortsPutOK{}\n}", "title": "" }, { "docid": "b5edfcdd6a489fb470189618a49bf5d4", "score": "0.49690413", "text": "func NewDataConnectionPutBadRequest() *DataConnectionPutBadRequest {\n\treturn &DataConnectionPutBadRequest{}\n}", "title": "" }, { "docid": "87b306e12f3c408b2416ad923d9aaffc", "score": "0.49626198", "text": "func (f *JsonDB) CreateOrUpdatePorts(projectName string, ip string, ports []models.Port) error {\n\tfor _, port := range ports {\n\t\terr := f.CreateOrUpdatePort(projectName, ip, port)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c63f6077a6e7058fcea498d2ed2ff502", "score": "0.49398708", "text": "func NewListProjectVersionOfCloudPoolBadRequest() *ListProjectVersionOfCloudPoolBadRequest {\n\treturn &ListProjectVersionOfCloudPoolBadRequest{}\n}", "title": "" }, { "docid": "4216fa38e8d683c46d0bbb8ea0921db6", "score": "0.4901813", "text": "func NewPutCustomFieldsBadRequest() *PutCustomFieldsBadRequest {\n\treturn &PutCustomFieldsBadRequest{}\n}", "title": "" }, { "docid": "c8eea4bda89caa8216f534b693d41f9e", "score": "0.48880726", "text": "func NewSpaceBadRequest() *SpaceBadRequest {\n\treturn &SpaceBadRequest{}\n}", "title": "" }, { "docid": "680ac181884a2d7d2fba4c570e0cee6b", "score": "0.48794565", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone400InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone400InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/400/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "1d6acbc74caaf50e5892e933695d27f5", "score": "0.48775908", "text": "func NewPcloudVpnconnectionsPeersubnetsPutBadRequest() *PcloudVpnconnectionsPeersubnetsPutBadRequest {\n\treturn &PcloudVpnconnectionsPeersubnetsPutBadRequest{}\n}", "title": "" }, { "docid": "b88d10c08880d65f2495ace0001e5440", "score": "0.4873289", "text": "func (s *DockerAPISuite) TestContainerAPIInvalidPortSyntax(c *testing.T) {\n\tconfig := `{\n\t\t\t\t \"Image\": \"busybox\",\n\t\t\t\t \"HostConfig\": {\n\t\t\t\t\t\"NetworkMode\": \"default\",\n\t\t\t\t\t\"PortBindings\": {\n\t\t\t\t\t \"19039;1230\": [\n\t\t\t\t\t\t{}\n\t\t\t\t\t ]\n\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\t}`\n\n\tres, body, err := request.Post(\"/containers/create\", request.RawString(config), request.JSON)\n\tassert.NilError(c, err)\n\tif versions.GreaterThanOrEqualTo(testEnv.DaemonAPIVersion(), \"1.32\") {\n\t\tassert.Equal(c, res.StatusCode, http.StatusBadRequest)\n\t} else {\n\t\tassert.Assert(c, res.StatusCode != http.StatusOK)\n\t}\n\n\tb, err := request.ReadBody(body)\n\tassert.NilError(c, err)\n\tassert.Assert(c, strings.Contains(string(b[:]), \"invalid port\"))\n}", "title": "" }, { "docid": "da981cb55a873ee4ca28bf2b923d734a", "score": "0.48667896", "text": "func (client *MultipleResponsesClient) get202None204NoneDefaultNone202InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGet202None204NoneDefaultNone202InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/202/none/204/none/default/none/response/202/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "f31ad554102788ab6e377a8f1a8de03d", "score": "0.48541418", "text": "func (o *UpdateHostGroupsBadRequest) Code() int {\n\treturn 400\n}", "title": "" }, { "docid": "e07ba49f6e521129369ced2249a5b3bb", "score": "0.48461485", "text": "func NewAddNewPostBadRequest() *AddNewPostBadRequest {\n\n\treturn &AddNewPostBadRequest{}\n}", "title": "" }, { "docid": "cd4ef3f0ad1079e53522eb815dca491e", "score": "0.4841293", "text": "func NewCloudNFSExportAddBadRequest() *CloudNFSExportAddBadRequest {\n\n\treturn &CloudNFSExportAddBadRequest{}\n}", "title": "" }, { "docid": "c79b6d5dab2a66702803460c935d6b78", "score": "0.4831729", "text": "func NewPutProjectProjectNameBadRequest() *PutProjectProjectNameBadRequest {\n\n\treturn &PutProjectProjectNameBadRequest{}\n}", "title": "" }, { "docid": "01ed67eb22189aeb5626ee06efb41631", "score": "0.4825451", "text": "func (o *DeleteNodePoolConfigItemBadRequest) Code() int {\n\treturn 400\n}", "title": "" }, { "docid": "ced2a6e4201df9302053f35c6da76d31", "score": "0.4778555", "text": "func NewCreateNetworkIPRangeBadRequest() *CreateNetworkIPRangeBadRequest {\n\treturn &CreateNetworkIPRangeBadRequest{}\n}", "title": "" }, { "docid": "1a698c1b48debe7fe9a61d7c2e438058", "score": "0.47763962", "text": "func (ctx *ShowDeploymentPodLimitRangeDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "3d3d3538b0a4ce0f9a46b88263fbdc03", "score": "0.47738758", "text": "func (o *PcloudNetworksPortsPutBadRequest) IsCode(code int) bool {\n\treturn code == 400\n}", "title": "" }, { "docid": "9bc0daf09fe8e0ff555db2a9e5ca2c5d", "score": "0.47703367", "text": "func (f *JsonDB) CreateOrUpdatePort(projectName string, ip string, portModel models.Port) error {\n\tportsFromFile, err := f.getPorts(projectName, ip)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tportJson := jsonPort{}\n\tportJson.FromModel(portModel)\n\n\tfound := false\n\tfor _, p := range portsFromFile {\n\t\tif p.Number == portModel.Number {\n\t\t\tfound = true\n\n\t\t\t// add missings fields if it already exist !\n\t\t\tportJson.PortType = p.PortType\n\t\t\tportJson.ID = p.ID\n\t\t\tp = portJson\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !found {\n\t\tportsFromFile = append(portsFromFile, portJson)\n\t}\n\n\treturn f.writePorts(projectName, ip, portsFromFile)\n}", "title": "" }, { "docid": "4a4856c63c1a7faaa6477674f66b7501", "score": "0.4769154", "text": "func TestPostInvalidJSONWorkspaceV0(t *testing.T) {\n\t// Use a blueprint that's missing a trailing '\"' on name\n\tbp := `{\n\t\t\"name\": \"test-invalid-json-blueprint-ws-v0\",\n\t\t\"version\": \"0.0.1\",\n\t\t\"description\": \"TestPostInvalidJSONWorkspaceV0\",\n\t\t\"modules\": [{\"name: \"util-linux\", \"version\": \"*\"}],\n\t}`\n\n\tresp, err := PostJSONBlueprintV0(testState.socket, bp)\n\trequire.NoError(t, err, \"failed with a client error\")\n\trequire.False(t, resp.Status, \"did not return an error\")\n}", "title": "" }, { "docid": "80891cf2cc351653d74d18eb1badb7c0", "score": "0.47664535", "text": "func (o *PcloudPvminstancesGetallBadRequest) Code() int {\n\treturn 400\n}", "title": "" }, { "docid": "2f9a510d2645424f9d994d3b8b493206", "score": "0.47387028", "text": "func NewPcloudNetworksPortsPutUnprocessableEntity() *PcloudNetworksPortsPutUnprocessableEntity {\n\treturn &PcloudNetworksPortsPutUnprocessableEntity{}\n}", "title": "" }, { "docid": "e3253b49ec885288aa25e3fd77a5e7dc", "score": "0.47074908", "text": "func NewPostContractCallBadRequest() *PostContractCallBadRequest {\n\treturn &PostContractCallBadRequest{}\n}", "title": "" }, { "docid": "ee5ebdd52575bf8ad47e561a2a7679a4", "score": "0.47037634", "text": "func NewPostProjectsBadRequest() *PostProjectsBadRequest {\n\treturn &PostProjectsBadRequest{}\n}", "title": "" }, { "docid": "1bfb90ae918d177910d9329a0b088e97", "score": "0.47013763", "text": "func newError(statusCode int, text string) error {\n\treturn &Error{\n\t\tStatusCode: statusCode,\n\t\tMessage: text,\n\t}\n}", "title": "" }, { "docid": "c5f0788f8a071ac70334df2ac67de097", "score": "0.46887827", "text": "func NewCreateBindBadRequest() *CreateBindBadRequest {\n\treturn &CreateBindBadRequest{\n\t\tConfigurationVersion: 0,\n\t}\n}", "title": "" }, { "docid": "559906aa82af79d5e9f986506a3236d7", "score": "0.46844912", "text": "func (ctx *CreateSpaceIterationsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "f246b8d1e50c6d6cd47a35c97fc6bb22", "score": "0.46789566", "text": "func NewChannelsPostBadRequest() *ChannelsPostBadRequest {\n\treturn &ChannelsPostBadRequest{}\n}", "title": "" }, { "docid": "94c5f35143d8a842f80440fea2f3d179", "score": "0.4669075", "text": "func NewPostIPAMSwitchesBadRequest() *PostIPAMSwitchesBadRequest {\n\treturn &PostIPAMSwitchesBadRequest{}\n}", "title": "" }, { "docid": "f19e7dc4320ef8bf9492944337c334e4", "score": "0.4662984", "text": "func (o *PcloudNetworksPortsPutBadRequest) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "336a865c1db3e84a16b45dd086e03803", "score": "0.46589988", "text": "func NewBadRequest(msg string) *ResponseError {\n\treturn NewResponseError(http.StatusBadRequest, msg)\n}", "title": "" }, { "docid": "7fb8e6369cda32ffa609013c591d41a4", "score": "0.4647765", "text": "func NewPostServicePortsParams() *PostServicePortsParams {\n\tvar ()\n\treturn &PostServicePortsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "7ceb7685ae739d6afb8e41ea774deb43", "score": "0.4642245", "text": "func NewPutProjectProjectNameDefault(code int) *PutProjectProjectNameDefault {\n\tif code <= 0 {\n\t\tcode = 500\n\t}\n\n\treturn &PutProjectProjectNameDefault{\n\t\t_statusCode: code,\n\t}\n}", "title": "" }, { "docid": "142b6c84e2ec5219de3d9eacadb39448", "score": "0.46404782", "text": "func NewAddBadRequest(body *AddBadRequestResponseBody) *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": "6ecb1c18ed84c0cc75b90b23ed7c4860", "score": "0.46345782", "text": "func NewPcloudDhcpPostBadRequest() *PcloudDhcpPostBadRequest {\n\treturn &PcloudDhcpPostBadRequest{}\n}", "title": "" }, { "docid": "3fe7bdd3fe6cbde2e496ae2711a7e8d3", "score": "0.46184403", "text": "func (f *JsonDB) CreatePort(projectName string, ip string, port models.Port) error {\n\treturn errors.New(\"Not implemented yet\")\n}", "title": "" }, { "docid": "d3ff358b98b128ca42a11445b49ad6a8", "score": "0.4617645", "text": "func NewStatusBadRequest(body *StatusBadRequestResponseBody) *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": "8c25f47575bd219bb6e5f4d25d8f174d", "score": "0.46172863", "text": "func NewListBadRequest(body *ListBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "8c25f47575bd219bb6e5f4d25d8f174d", "score": "0.46172863", "text": "func NewListBadRequest(body *ListBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "8c25f47575bd219bb6e5f4d25d8f174d", "score": "0.46172863", "text": "func NewListBadRequest(body *ListBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "0f1c42d1bf2c8868b0625b6ca68077ab", "score": "0.4614519", "text": "func NewPcloudNetworksPutUnauthorized() *PcloudNetworksPutUnauthorized {\n\treturn &PcloudNetworksPutUnauthorized{}\n}", "title": "" }, { "docid": "c769cc23c7222006287c861707e395ba", "score": "0.46049348", "text": "func NewGetNFTContractTokenHoldersBadRequest() *GetNFTContractTokenHoldersBadRequest {\n\n\treturn &GetNFTContractTokenHoldersBadRequest{}\n}", "title": "" }, { "docid": "f4412525b292cb3aad3c1dbb9fad1d0b", "score": "0.4596668", "text": "func NewPcloudIpsecpoliciesPostBadRequest() *PcloudIpsecpoliciesPostBadRequest {\n\treturn &PcloudIpsecpoliciesPostBadRequest{}\n}", "title": "" }, { "docid": "6f71098c9cfb522ea12d1a2dada2d3ea", "score": "0.45843226", "text": "func NewPostServicePortsParamsWithTimeout(timeout time.Duration) *PostServicePortsParams {\n\tvar ()\n\treturn &PostServicePortsParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "877eca4c44315dfcd402892bbab5d0d4", "score": "0.45752585", "text": "func (client *MultipleResponsesClient) getDefaultNone400InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGetDefaultNone400InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/default/none/response/400/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "245b08f4dc5ba4f625a9c0777260670e", "score": "0.4574484", "text": "func NewPcloudNetworksPutForbidden() *PcloudNetworksPutForbidden {\n\treturn &PcloudNetworksPutForbidden{}\n}", "title": "" }, { "docid": "4a79c7de4807d703e64c224bedb7952d", "score": "0.45658356", "text": "func NewPostProjectBadRequest() *PostProjectBadRequest {\n\treturn &PostProjectBadRequest{}\n}", "title": "" }, { "docid": "53c227439aa8ad53fcc96901e29949f0", "score": "0.45555097", "text": "func (ctx *ShowSpaceEnvironmentsDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "3996611d9a34ed9a837c5eeca0f21347", "score": "0.45492733", "text": "func NewCreateBadRequest(body *CreateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "3996611d9a34ed9a837c5eeca0f21347", "score": "0.45492733", "text": "func NewCreateBadRequest(body *CreateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "3996611d9a34ed9a837c5eeca0f21347", "score": "0.45492733", "text": "func NewCreateBadRequest(body *CreateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "36da587522965f4a504d93343bf5a1b8", "score": "0.45450228", "text": "func NewResetProjectToRemoteBadRequest() *ResetProjectToRemoteBadRequest {\n\treturn &ResetProjectToRemoteBadRequest{}\n}", "title": "" }, { "docid": "4b45ea245179b78737736bd861aeff79", "score": "0.45347878", "text": "func (ctx *ShowSpaceDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "9534c5c2811543293164a26827211068", "score": "0.4533395", "text": "func (ctx *CreateSpaceContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "56722880ff2d1e47acbfd7ad736d6647", "score": "0.4512246", "text": "func (eiec *ErrInvalidEndpointConfig) BadRequest() {}", "title": "" }, { "docid": "3906fe0324e1fc5c5a423ac410c6171a", "score": "0.4507003", "text": "func (ctx *ShowEnvironmentsBySpaceDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "95e895238b372b8e1657afc8c1b07438", "score": "0.45025665", "text": "func (client *MultipleResponsesClient) getDefaultNone200InvalidCreateRequest(ctx context.Context, options *MultipleResponsesClientGetDefaultNone200InvalidOptions) (*policy.Request, error) {\n\turlPath := \"/http/payloads/default/none/response/200/invalid\"\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "6923fa05bc838f0046452b5850893211", "score": "0.4494962", "text": "func (ctx *SetDeploymentDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "f82df3651667ca8a0f301db972411cf3", "score": "0.44898704", "text": "func NewPostContractCallComputeBadRequest() *PostContractCallComputeBadRequest {\n\treturn &PostContractCallComputeBadRequest{}\n}", "title": "" }, { "docid": "7b305d6f66f826908656c27a77145a87", "score": "0.44782248", "text": "func NewBadRequest(err error, msg string) error {\n\treturn &errWithType{\n\t\terror: newLocationError(wrapErrorWithMsg(err, msg), 1),\n\t\terrType: BadRequest,\n\t}\n}", "title": "" }, { "docid": "0a5ad510519a92b1dedbc9ea395d8865", "score": "0.4476809", "text": "func CreateOrUpdatePortGroups(nbClient libovsdbclient.Client, pgs ...*nbdb.PortGroup) error {\n\tops, err := CreateOrUpdatePortGroupsOps(nbClient, nil, pgs...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = TransactAndCheck(nbClient, ops)\n\treturn err\n}", "title": "" }, { "docid": "27a603e510ec1ef72a057d9196fd02d4", "score": "0.44548056", "text": "func NewPcloudCloudconnectionsGetallBadRequest() *PcloudCloudconnectionsGetallBadRequest {\n\treturn &PcloudCloudconnectionsGetallBadRequest{}\n}", "title": "" }, { "docid": "1785a5cd77cae5bc5497ea45a6150ad9", "score": "0.44496232", "text": "func NewUpdateHostGroupsBadRequest() *UpdateHostGroupsBadRequest {\n\treturn &UpdateHostGroupsBadRequest{}\n}", "title": "" }, { "docid": "27c7a2f29c6218171ca64f70df6278b5", "score": "0.44469666", "text": "func (ctx *ListSpaceIterationsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "6d2fd6a59bc2b30455c3ceb138c2a0c5", "score": "0.4446578", "text": "func NewGetCorporationsNpccorpsBadRequest() *GetCorporationsNpccorpsBadRequest {\n\treturn &GetCorporationsNpccorpsBadRequest{}\n}", "title": "" }, { "docid": "5d6f849973f0d04eb258502cd66d12b5", "score": "0.44400147", "text": "func NewCreateNewGroupPublicV2BadRequest() *CreateNewGroupPublicV2BadRequest {\n\treturn &CreateNewGroupPublicV2BadRequest{}\n}", "title": "" }, { "docid": "a09478f4cae47ffce50afe60704217be", "score": "0.44354102", "text": "func NewProjectRolesBadRequest(body *ProjectRolesBadRequestResponseBody) *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": "587395393aaa3cb340054d127fe7e6bd", "score": "0.44328627", "text": "func NewPostAPIV1CompaniesBadRequest() *PostAPIV1CompaniesBadRequest {\n\n\treturn &PostAPIV1CompaniesBadRequest{}\n}", "title": "" }, { "docid": "6dd0230e362f6bd4e60e004fe50a40aa", "score": "0.4432592", "text": "func NewAcceptTncBadRequest(body *AcceptTncBadRequestResponseBody) *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": "65c458725eec4275996f7a50cbdfb538", "score": "0.44325426", "text": "func (ctx *ShowDeploymentStatsDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "bb7b41190fe65e184f4811b943be2ea7", "score": "0.44313124", "text": "func (o *ShutdownDeploymentStatelessResourceBadRequest) Code() int {\n\treturn 400\n}", "title": "" }, { "docid": "f3dd77ff7cc7eecb4cc6d605802257de", "score": "0.44259006", "text": "func (e PostMessageParamsValidationError) Reason() string { return e.reason }", "title": "" }, { "docid": "4286f4ae4b364abec0d6e258e9c3f6da", "score": "0.44236445", "text": "func NewPcloudSppplacementgroupsMembersPostBadRequest() *PcloudSppplacementgroupsMembersPostBadRequest {\n\treturn &PcloudSppplacementgroupsMembersPostBadRequest{}\n}", "title": "" }, { "docid": "4286f4ae4b364abec0d6e258e9c3f6da", "score": "0.44236445", "text": "func NewPcloudSppplacementgroupsMembersPostBadRequest() *PcloudSppplacementgroupsMembersPostBadRequest {\n\treturn &PcloudSppplacementgroupsMembersPostBadRequest{}\n}", "title": "" }, { "docid": "202dd81a16ca0e094a1bbe92777f189d", "score": "0.4410452", "text": "func NewListByProjectNotFound(body *ListByProjectNotFoundResponseBody) *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": "72f9a14582e10653df31d6e039bc906c", "score": "0.44102877", "text": "func NewPcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest() *PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest {\n\treturn &PcloudCloudconnectionsVirtualprivatecloudsGetallBadRequest{}\n}", "title": "" }, { "docid": "e969098fc6b119eff18673235557788f", "score": "0.44059837", "text": "func NewCreateCloudPoolBadRequest() *CreateCloudPoolBadRequest {\n\treturn &CreateCloudPoolBadRequest{}\n}", "title": "" }, { "docid": "e99894af1c1687ed3a0cc89a52815c05", "score": "0.43971193", "text": "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "e99894af1c1687ed3a0cc89a52815c05", "score": "0.43971193", "text": "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "e99894af1c1687ed3a0cc89a52815c05", "score": "0.43971193", "text": "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "e99894af1c1687ed3a0cc89a52815c05", "score": "0.43971193", "text": "func NewUpdateBadRequest(body *UpdateBadRequestResponseBody) *goa.ServiceError {\n\tv := &goa.ServiceError{\n\t\tName: *body.Name,\n\t\tID: *body.ID,\n\t\tMessage: *body.Message,\n\t\tTemporary: *body.Temporary,\n\t\tTimeout: *body.Timeout,\n\t\tFault: *body.Fault,\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "ee011ac8d24cdfd8ca3cfeadc2f115c0", "score": "0.43907395", "text": "func (client *WebAppsClient) createOrUpdateHostNameBindingSlotCreateRequest(ctx context.Context, resourceGroupName string, name string, hostName string, slot string, hostNameBinding HostNameBinding, options *WebAppsClientCreateOrUpdateHostNameBindingSlotOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/hostNameBindings/{hostName}\"\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif name == \"\" {\n\t\treturn nil, errors.New(\"parameter name cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{name}\", url.PathEscape(name))\n\tif hostName == \"\" {\n\t\treturn nil, errors.New(\"parameter hostName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{hostName}\", url.PathEscape(hostName))\n\tif slot == \"\" {\n\t\treturn nil, errors.New(\"parameter slot cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{slot}\", url.PathEscape(slot))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2022-09-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, runtime.MarshalAsJSON(req, hostNameBinding)\n}", "title": "" }, { "docid": "29d3c0ea42950c1ff4f3854ab3d4b99b", "score": "0.43736923", "text": "func NewBluemixServiceInstancePutBadRequest() *BluemixServiceInstancePutBadRequest {\n\treturn &BluemixServiceInstancePutBadRequest{}\n}", "title": "" }, { "docid": "4e6d27b9343d3017e0acf097e6edeac3", "score": "0.43693447", "text": "func NewEditHostBadRequest() *EditHostBadRequest {\n\treturn &EditHostBadRequest{}\n}", "title": "" }, { "docid": "07480264367cdcc0b8262dd065db5d70", "score": "0.43678367", "text": "func (ctx *ShowDeploymentStatSeriesDeploymentsContext) BadRequest(r *JSONAPIErrors) error {\n\tctx.ResponseData.Header().Set(\"Content-Type\", \"application/vnd.api+json\")\n\treturn ctx.ResponseData.Service.Send(ctx.Context, 400, r)\n}", "title": "" }, { "docid": "637278e231bf01964294b8fdd00cdfea", "score": "0.4363037", "text": "func NewIssueTransmissionTokenBadRequest(body *IssueTransmissionTokenBadRequestResponseBody) *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": "" } ]
9d59ab28e5f96c44fcde274ca6409353
AddOrUpdateAlertToGrps adds the given alert to cache groups.
[ { "docid": "77f7354b89ecb9d6748c4ae95f212430", "score": "0.77533275", "text": "func (m *MemDb) AddOrUpdateAlertToGrps(alert *monitoring.Alert) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\talertState := monitoring.AlertState(monitoring.AlertState_vvalue[alert.Spec.State])\n\tkey := fmt.Sprintf(\"%s.%s\", alert.Tenant, alert.Status.Reason.PolicyID)\n\n\tvar evtMessageObjRefKey string\n\tif alert.Status.ObjectRef != nil {\n\t\tmessage := alert.Status.Message\n\t\tif strings.Contains(message, globals.DiskHighThresholdMessage) {\n\t\t\tmessage = globals.DiskHighThresholdMessage\n\t\t}\n\t\tif strings.Contains(message, globals.DiskHighSecondThresholdMessage) {\n\t\t\tmessage = globals.DiskHighSecondThresholdMessage\n\t\t}\n\t\tif strings.Contains(message, globals.DiskPHighThresholdMessagePrefix) {\n\t\t\tmessage = strings.Split(message, globals.DiskPHighThresholdMessageSuffix)[0]\n\t\t}\n\t\tif strings.Contains(message, globals.DiskPHighSecondThresholdMessagePrefix) {\n\t\t\tmessage = strings.Split(message, globals.DiskPHighSecondThresholdMessageSuffix)[0]\n\t\t}\n\n\t\tevtMessageObjRefKey = fmt.Sprintf(\"%s.%s\", message, alert.Status.ObjectRef.String())\n\t}\n\n\talertsByPolicy, found := m.alertsByPolicy[key]\n\tif !found {\n\t\tm.alertsByPolicy[key] = make(map[monitoring.AlertState]*alertsGroup)\n\t}\n\n\tif alertState != monitoring.AlertState_RESOLVED {\n\t\t// find if the state already exists\n\t\taGrp, found := alertsByPolicy[alertState]\n\t\tif !found {\n\t\t\taGrp = &alertsGroup{grpByEventURI: make(map[string]string), grpByEventMessageAndObjectRef: make(map[string]string)}\n\t\t\tm.alertsByPolicy[key][alertState] = aGrp\n\t\t}\n\t\t// group by events URI\n\t\taGrp.grpByEventURI[alert.Status.EventURI] = alert.Name\n\n\t\t// group by event message and object ref\n\t\tif alert.Status.ObjectRef != nil {\n\t\t\taGrp.grpByEventMessageAndObjectRef[evtMessageObjRefKey] = alert.Name\n\t\t}\n\t}\n\n\t// remove it from other groups if it exists\n\tfor state, aGrp := range alertsByPolicy {\n\t\tif alertState != state {\n\t\t\t// remove it from the other alert state groups\n\t\t\tdelete(aGrp.grpByEventURI, alert.Status.EventURI)\n\n\t\t\tif alert.Status.ObjectRef != nil {\n\t\t\t\tdelete(aGrp.grpByEventMessageAndObjectRef, evtMessageObjRefKey)\n\t\t\t}\n\n\t\t\tif len(aGrp.grpByEventURI) == 0 && len(aGrp.grpByEventMessageAndObjectRef) == 0 {\n\t\t\t\tdelete(m.alertsByPolicy[key], state)\n\t\t\t}\n\t\t}\n\t}\n\n\t// delete the policy from cache if there are no entries for it\n\tif len(m.alertsByPolicy[key]) == 0 {\n\t\tdelete(m.alertsByPolicy, key)\n\t\treturn\n\t}\n}", "title": "" } ]
[ { "docid": "c6a133b10aa2466b09c75aa7fef5ec90", "score": "0.5102325", "text": "func (s *DataStore) AddTagsToAlertGroupsByQuery(p core.AlertGroupQueryParams, tags []string, action HistoryEntry) error {\n\tvar mustNot []interface{}\n\tfor _, tag := range tags {\n\t\tmustNot = append(mustNot, TermQuery(\"tags\", tag))\n\t}\n\n\tquery := s.buildAlertGroupQuery(p)\n\tif len(mustNot) > 0 {\n\t\tquery.Query.Bool.MustNot = mustNot\n\t}\n\tquery.Script = &Script{\n\t\tLang: \"painless\",\n\t\tInline: `\n\t\t if (params.tags != null) {\n\t\t\t if (ctx._source.tags == null) {\n\t\t\t ctx._source.tags = new ArrayList();\n\t\t\t }\n\t\t\t for (tag in params.tags) {\n\t\t\t if (!ctx._source.tags.contains(tag)) {\n\t\t\t ctx._source.tags.add(tag);\n\t\t\t }\n\t\t\t }\n\t\t\t }\n\t\t\t if (ctx._source.evebox == null) {\n\t\t\t ctx._source.evebox = new HashMap();\n\t\t\t }\n\t\t\t if (ctx._source.evebox.history == null) {\n\t\t\t ctx._source.evebox.history = new ArrayList();\n\t\t\t }\n\t\t\t ctx._source.evebox.history.add(params.action);\n\t\t`,\n\t\tParams: map[string]interface{}{\n\t\t\t\"tags\": tags,\n\t\t\t\"action\": action,\n\t\t},\n\t}\n\n\tresponse, err := s.es.doUpdateByQuery(query)\n\tif err != nil {\n\t\tlog.Error(\"failed to update by query: %v\", err)\n\t\treturn err\n\t}\n\tfailures := response.GetMapList(\"failures\")\n\tlog.Info(\"Events updated: %v; failures=%d {%+v}\",\n\t\tresponse.Get(\"updated\"), len(failures), failures)\n\n\treturn nil\n}", "title": "" }, { "docid": "b621db8e1f62128c23fff4e6866a91ee", "score": "0.4996911", "text": "func (d *Dispatcher) processAlert(alert *types.Alert, route *Route) {\n\tgroupLabels := getGroupLabels(alert, route)\n\n\tfp := groupLabels.Fingerprint()\n\n\td.mtx.Lock()\n\tdefer d.mtx.Unlock()\n\n\trouteGroups, ok := d.aggrGroupsPerRoute[route]\n\tif !ok {\n\t\trouteGroups = map[model.Fingerprint]*aggrGroup{}\n\t\td.aggrGroupsPerRoute[route] = routeGroups\n\t}\n\n\tag, ok := routeGroups[fp]\n\tif ok {\n\t\tag.insert(alert)\n\t\treturn\n\t}\n\n\t// If the group does not exist, create it. But check the limit first.\n\tif limit := d.limits.MaxNumberOfAggregationGroups(); limit > 0 && d.aggrGroupsNum >= limit {\n\t\td.metrics.aggrGroupLimitReached.Inc()\n\t\tlevel.Error(d.logger).Log(\"msg\", \"Too many aggregation groups, cannot create new group for alert\", \"groups\", d.aggrGroupsNum, \"limit\", limit, \"alert\", alert.Name())\n\t\treturn\n\t}\n\n\tag = newAggrGroup(d.ctx, groupLabels, route, d.timeout, d.logger)\n\trouteGroups[fp] = ag\n\td.aggrGroupsNum++\n\td.metrics.aggrGroups.Inc()\n\n\t// Insert the 1st alert in the group before starting the group's run()\n\t// function, to make sure that when the run() will be executed the 1st\n\t// alert is already there.\n\tag.insert(alert)\n\n\tgo ag.run(func(ctx context.Context, alerts ...*types.Alert) bool {\n\t\t_, _, err := d.stage.Exec(ctx, d.logger, alerts...)\n\t\tif err != nil {\n\t\t\tlvl := level.Error(d.logger)\n\t\t\tif ctx.Err() == context.Canceled {\n\t\t\t\t// It is expected for the context to be canceled on\n\t\t\t\t// configuration reload or shutdown. In this case, the\n\t\t\t\t// message should only be logged at the debug level.\n\t\t\t\tlvl = level.Debug(d.logger)\n\t\t\t}\n\t\t\tlvl.Log(\"msg\", \"Notify for alerts failed\", \"num_alerts\", len(alerts), \"err\", err)\n\t\t}\n\t\treturn err == nil\n\t})\n}", "title": "" }, { "docid": "7e24236e3ef818ad3350928de490dd79", "score": "0.49317127", "text": "func (a *Alerts) Put(alerts ...*types.Alert) error {\n\tfor _, alert := range alerts {\n\t\tfp := alert.Fingerprint()\n\n\t\texisting := false\n\n\t\t// Check that there's an alert existing within the store before\n\t\t// trying to merge.\n\t\tif old, err := a.alerts.Get(fp); err == nil {\n\t\t\texisting = true\n\n\t\t\t// Merge alerts if there is an overlap in activity range.\n\t\t\tif (alert.EndsAt.After(old.StartsAt) && alert.EndsAt.Before(old.EndsAt)) ||\n\t\t\t\t(alert.StartsAt.After(old.StartsAt) && alert.StartsAt.Before(old.EndsAt)) {\n\t\t\t\talert = old.Merge(alert)\n\t\t\t}\n\t\t}\n\n\t\tif err := a.callback.PreStore(alert, existing); err != nil {\n\t\t\tlevel.Error(a.logger).Log(\"msg\", \"pre-store callback returned error on set alert\", \"err\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tif err := a.alerts.Set(alert); err != nil {\n\t\t\tlevel.Error(a.logger).Log(\"msg\", \"error on set alert\", \"err\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\ta.callback.PostStore(alert, existing)\n\n\t\ta.mtx.Lock()\n\t\tfor _, l := range a.listeners {\n\t\t\tselect {\n\t\t\tcase l.alerts <- alert:\n\t\t\tcase <-l.done:\n\t\t\t}\n\t\t}\n\t\ta.mtx.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fa0f4424c040b2cbf2216051d10f2da4", "score": "0.49217203", "text": "func (chart *Chart) AddAlert(alert Alert) error {\n\texists, err := chart.FindAlertIndex(alert.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists >= 0 {\n\t\tchart.Alerts[exists] = alert\n\t} else {\n\t\tchart.Alerts = append(chart.Alerts, alert)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "438385a48b2c5d118a94fe5783fa439b", "score": "0.4716083", "text": "func (g *Groups) Upsert(grp Group) {\n\tfor i := 0; i < len(*g); i++ {\n\t\tif (*g)[i].ID == grp.ID {\n\t\t\treturn\n\t\t}\n\t}\n\t*g = append(*g, grp)\n}", "title": "" }, { "docid": "535ffb830d0d17efbc65b8f583046822", "score": "0.46141744", "text": "func (ag *aggrGroup) insert(alert *types.Alert) {\n\tif err := ag.alerts.Set(alert); err != nil {\n\t\tlevel.Error(ag.logger).Log(\"msg\", \"error on set alert\", \"err\", err)\n\t}\n\n\t// Immediately trigger a flush if the wait duration for this\n\t// alert is already over.\n\tag.mtx.Lock()\n\tdefer ag.mtx.Unlock()\n\tif !ag.hasFlushed && alert.StartsAt.Add(ag.opts.GroupWait).Before(time.Now()) {\n\t\tag.next.Reset(0)\n\t}\n}", "title": "" }, { "docid": "f1680702294ad698f0bcdcd8b91eb394", "score": "0.45666462", "text": "func (m *MemDb) DeleteAlertFromGrps(alert *monitoring.Alert) {\n\tm.Lock()\n\tdefer m.Unlock()\n\n\tkey := fmt.Sprintf(\"%s.%s\", alert.Tenant, alert.Status.Reason.PolicyID)\n\talertState := monitoring.AlertState(monitoring.AlertState_vvalue[alert.Spec.State])\n\tif alertsByPolicy, found := m.alertsByPolicy[key]; found {\n\t\tgrp, found := alertsByPolicy[alertState]\n\t\tif found {\n\t\t\tdelete(grp.grpByEventURI, alert.Status.EventURI)\n\n\t\t\tif alert.Status.ObjectRef != nil {\n\t\t\t\tmessage := alert.Status.Message\n\t\t\t\tif strings.Contains(message, globals.DiskHighThresholdMessage) {\n\t\t\t\t\tmessage = globals.DiskHighThresholdMessage\n\t\t\t\t}\n\t\t\t\tif strings.Contains(message, globals.DiskHighSecondThresholdMessage) {\n\t\t\t\t\tmessage = globals.DiskHighSecondThresholdMessage\n\t\t\t\t}\n\t\t\t\tif strings.Contains(message, globals.DiskPHighThresholdMessagePrefix) {\n\t\t\t\t\tmessage = strings.Split(message, globals.DiskPHighThresholdMessageSuffix)[0]\n\t\t\t\t}\n\t\t\t\tif strings.Contains(message, globals.DiskPHighSecondThresholdMessagePrefix) {\n\t\t\t\t\tmessage = strings.Split(message, globals.DiskPHighSecondThresholdMessageSuffix)[0]\n\t\t\t\t}\n\n\t\t\t\tevtMessageObjRefKey := fmt.Sprintf(\"%s.%s\", message, alert.Status.ObjectRef.String())\n\t\t\t\tdelete(grp.grpByEventMessageAndObjectRef, evtMessageObjRefKey)\n\t\t\t}\n\n\t\t\tif len(grp.grpByEventURI) == 0 && len(grp.grpByEventMessageAndObjectRef) == 0 {\n\t\t\t\tdelete(m.alertsByPolicy, key)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "66f03c053e8d75def1c3ce4b915c7880", "score": "0.45490387", "text": "func (o *AuthGroup) UpsertGP(updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1b74a0283a445e16af2a60435e282910", "score": "0.45043167", "text": "func addAuthAlerts(auth AlertAuth) {\n var err error\n ses, c := accessDB(users_collection)\n defer ses.Close()\n colQuerier := bson.M{\"id_user\":adminId}\n change := bson.M{\n \"$push\":bson.M{\n \"alerts\":\n auth,}}\n err = c.Update(colQuerier, change)\n verifyErr(err)\n}", "title": "" }, { "docid": "ac16ed983e5bfa70e4c6e5b88c97666a", "score": "0.4501505", "text": "func (o *AuthGroup) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no auth_group provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(authGroupColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tauthGroupUpsertCacheMut.RLock()\n\tcache, cached := authGroupUpsertCache[key]\n\tauthGroupUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tauthGroupColumns,\n\t\t\tauthGroupColumnsWithDefault,\n\t\t\tauthGroupColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tauthGroupColumns,\n\t\t\tauthGroupPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert auth_group, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"auth_group\", update, whitelist)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `auth_group` WHERE `id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(authGroupType, authGroupMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(authGroupType, authGroupMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for auth_group\")\n\t}\n\n\tvar lastID int64\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == authGroupMapping[\"ID\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for auth_group\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tauthGroupUpsertCacheMut.Lock()\n\t\tauthGroupUpsertCache[key] = cache\n\t\tauthGroupUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9db1ee48e8e8e1afad64577d8513f9d8", "score": "0.44750676", "text": "func (s *Service) Upsert(rep report.Report, as alliance.Service) error {\n\tstats := new(bytes.Buffer)\n\tif err := json.NewEncoder(stats).Encode(rep.Stats); err != nil {\n\t\treturn err\n\t}\n\n\t_, err := s.db.Exec(`\n\t\tINSERT INTO reports (reporter, team, stats, notes, eventKey, matchKey)\n\t\tVALUES ($1, $2, $3, $4, $5, $6)\n\t\tON CONFLICT (eventKey, matchKey, team)\n\t\tDO\n\t\t\tUPDATE\n\t\t\t\tSET reporter = $1, team = $2, stats = $3, notes = $4\n\t`, rep.Reporter, rep.Team, stats.String(), rep.Notes, rep.EventKey, rep.MatchKey)\n\n\treturn err\n}", "title": "" }, { "docid": "22d23ac5dcc56019c59e6caaa777b27e", "score": "0.44424695", "text": "func (c package_cache) append_packages(ps map[string]*package_file_cache, pkgs []package_import) {\n\tfor _, m := range pkgs {\n\t\tif _, ok := ps[m.abspath]; ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tif mod, ok := c[m.abspath]; ok {\n\t\t\tps[m.abspath] = mod\n\t\t} else {\n\t\t\tmod = new_package_file_cache(m.abspath, m.path)\n\t\t\tps[m.abspath] = mod\n\t\t\tc[m.abspath] = mod\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8663d0b3f0b86fcce61756ca13b93ec8", "score": "0.44228283", "text": "func AddOrUpdateBindings(gcpclient gcpclient.Client, projectID, serviceAccountEmail string) (AddorUpdateBindingResponse, error) {\n\tpolicy, err := gcpclient.GetIamPolicy(projectID)\n\tif err != nil {\n\t\treturn AddorUpdateBindingResponse{}, err\n\t}\n\n\t//Checking if policy is modified\n\tnewBindings, modified := util.AddOrUpdateBinding(policy.Bindings, OSDRequiredRoles, serviceAccountEmail)\n\n\t// add new bindings to policy\n\tpolicy.Bindings = newBindings\n\treturn AddorUpdateBindingResponse{\n\t\tmodified: modified,\n\t\tpolicy: policy,\n\t}, nil\n}", "title": "" }, { "docid": "654e7e897023a0efd9d9280780cda3d4", "score": "0.4415471", "text": "func (o *AuthGroup) UpsertG(updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateColumns, whitelist...)\n}", "title": "" }, { "docid": "fed0c836fa44d20f47a2881dcf63d5f1", "score": "0.4396771", "text": "func (o *AuthGroupPermission) UpsertGP(updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "7fda06c98efb4f67e53f1ac5256cddca", "score": "0.4345388", "text": "func (o *AuthGroup) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "5a690938c27c0087fe784f535b5d2fc2", "score": "0.4338247", "text": "func (o *AuthGroupPermission) UpsertG(updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateColumns, whitelist...)\n}", "title": "" }, { "docid": "3c85127538524d0e9cd1fa2f8fac3a98", "score": "0.4322414", "text": "func (o *AuthGroupPermission) Upsert(exec boil.Executor, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no auth_group_permissions provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(authGroupPermissionColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tauthGroupPermissionUpsertCacheMut.RLock()\n\tcache, cached := authGroupPermissionUpsertCache[key]\n\tauthGroupPermissionUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tauthGroupPermissionColumns,\n\t\t\tauthGroupPermissionColumnsWithDefault,\n\t\t\tauthGroupPermissionColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tauthGroupPermissionColumns,\n\t\t\tauthGroupPermissionPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert auth_group_permissions, could not build update column list\")\n\t\t}\n\n\t\tcache.query = queries.BuildUpsertQueryMySQL(dialect, \"auth_group_permissions\", update, whitelist)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `auth_group_permissions` WHERE `id`=?\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(authGroupPermissionType, authGroupPermissionMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(authGroupPermissionType, authGroupPermissionMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tresult, err := exec.Exec(cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for auth_group_permissions\")\n\t}\n\n\tvar lastID int64\n\tvar identifierCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tlastID, err = result.LastInsertId()\n\tif err != nil {\n\t\treturn ErrSyncFail\n\t}\n\n\to.ID = int(lastID)\n\tif lastID != 0 && len(cache.retMapping) == 1 && cache.retMapping[0] == authGroupPermissionMapping[\"ID\"] {\n\t\tgoto CacheNoHooks\n\t}\n\n\tidentifierCols = []interface{}{\n\t\to.ID,\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, identifierCols...)\n\t}\n\n\terr = exec.QueryRow(cache.retQuery, identifierCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for auth_group_permissions\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tauthGroupPermissionUpsertCacheMut.Lock()\n\t\tauthGroupPermissionUpsertCache[key] = cache\n\t\tauthGroupPermissionUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a2377844ae586274c44cef1ac7aa87ac", "score": "0.43019035", "text": "func (aug *AuthUserGroup) Upsert(ctx context.Context, db DB) error {\n\tswitch {\n\tcase aug._deleted: // deleted\n\t\treturn logerror(&ErrUpsertFailed{ErrMarkedForDeletion})\n\t}\n\t// upsert\n\tconst sqlstr = `INSERT INTO auth_user_groups (` +\n\t\t`id, user_id, group_id` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3` +\n\t\t`)` +\n\t\t` ON CONFLICT (id) DO ` +\n\t\t`UPDATE SET ` +\n\t\t`user_id = EXCLUDED.user_id, group_id = EXCLUDED.group_id `\n\t// run\n\tlogf(sqlstr, aug.ID, aug.UserID, aug.GroupID)\n\tif _, err := db.ExecContext(ctx, sqlstr, aug.ID, aug.UserID, aug.GroupID); err != nil {\n\t\treturn logerror(err)\n\t}\n\t// set exists\n\taug._exists = true\n\treturn nil\n}", "title": "" }, { "docid": "aa11c55d191c156dc27de60bc5e7aef0", "score": "0.42791134", "text": "func (a *LocalKeyAgent) AddHostSignersToCache(hostSigners []services.CertAuthority) error {\n\tbk, err := boltbk.New(filepath.Join(a.KeyDir, HostSignersFilename))\n\tif err != nil {\n\t\treturn trace.Wrap(nil)\n\t}\n\tdefer bk.Close()\n\tca := local.NewCAService(bk)\n\n\tfor _, hostSigner := range hostSigners {\n\t\terr := ca.UpsertCertAuthority(hostSigner, 0)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(nil)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e7d01bc56e69d0730ac1d7bd29fe09e", "score": "0.4264283", "text": "func (c *ConfigWatcher) processAlert(eventType kvstore.WatchEventType, alert *monitoring.Alert) error {\n\tc.logger.Debugf(\"processing alert watch event: {%s} {%#v} \", eventType, alert)\n\tswitch eventType {\n\tcase kvstore.Created:\n\t\tif err := c.memDb.AddObject(alert); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.memDb.AddOrUpdateAlertToGrps(alert)\n\tcase kvstore.Updated:\n\t\tif err := c.memDb.UpdateObject(alert); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.memDb.AddOrUpdateAlertToGrps(alert)\n\tcase kvstore.Deleted:\n\t\tif err := c.memDb.DeleteObject(alert); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.memDb.DeleteAlertFromGrps(alert)\n\tdefault:\n\t\tc.logger.Errorf(\"invalid alert watch event, type %s policy %+v\", eventType, alert)\n\t\treturn fmt.Errorf(\"invalid alert watch event\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8357ce2dc3f3083ba3e2a0de9d360ef7", "score": "0.41932625", "text": "func (dag *DoorAccessGroup) Upsert(db XODB) error {\n\tvar err error\n\n\t// if already exist, bail\n\tif dag._exists {\n\t\treturn errors.New(\"insert failed: already exists\")\n\t}\n\n\t// sql query\n\tconst sqlstr = `INSERT INTO public.door_access_groups (` +\n\t\t`id, access_group_id, door_id, action_code, action_order, group_is_manager` +\n\t\t`) VALUES (` +\n\t\t`$1, $2, $3, $4, $5, $6` +\n\t\t`) ON CONFLICT (id) DO UPDATE SET (` +\n\t\t`id, access_group_id, door_id, action_code, action_order, group_is_manager` +\n\t\t`) = (` +\n\t\t`EXCLUDED.id, EXCLUDED.access_group_id, EXCLUDED.door_id, EXCLUDED.action_code, EXCLUDED.action_order, EXCLUDED.group_is_manager` +\n\t\t`)`\n\n\t// run query\n\tXOLog(sqlstr, dag.ID, dag.AccessGroupID, dag.DoorID, dag.ActionCode, dag.ActionOrder, dag.GroupIsManager)\n\t_, err = db.Exec(sqlstr, dag.ID, dag.AccessGroupID, dag.DoorID, dag.ActionCode, dag.ActionOrder, dag.GroupIsManager)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// set existence\n\tdag._exists = true\n\n\treturn nil\n}", "title": "" }, { "docid": "2c8deecb6702eb9ae6f26844e9a432bd", "score": "0.41901636", "text": "func Add(timers map[string]Data, metric *common.Metric) {\n\tt, ok := timers[metric.Bucket]\n\tif !ok {\n\t\tvar p Float64Slice\n\t\tt = Data{p, 0}\n\t}\n\tt.Points = append(t.Points, metric.Value)\n\tt.Amount_submitted += int64(1 / metric.Sampling)\n\ttimers[metric.Bucket] = t\n}", "title": "" }, { "docid": "f7e053b35abe6c64ecfc22aaf64e4e24", "score": "0.41815484", "text": "func (p *ConnPool) UpdateAggregateHosts(index, aggregateID string, hostIP []string) error {\n\terr := p.DeleteAggregateHosts(index, aggregateID+\"[^0-9]\")\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = p.CreateAggregateHostIndex(index, aggregateID, hostIP)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error while updating aggregate host \")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fd7cb159dc01f0ae065baccb2cce9dc", "score": "0.41606435", "text": "func (d *Dao) AddReportsCacheByMids(c context.Context, mrs map[int64][]*model.Report) (err error) {\n\tvar (\n\t\tbs []byte\n\t\turs map[int64]map[string]*model.Report\n\t\tconn = d.mc.Get(c)\n\t)\n\tdefer conn.Close()\n\tfor mid, rs := range mrs {\n\t\tif urs, err = formatReport(rs); err != nil {\n\t\t\tlog.Error(\"d.AddReportsCacheByMids() formatReport() data(%v) error(%v)\", rs, err)\n\t\t\tcontinue\n\t\t}\n\t\tif bs, err = json.Marshal(urs); err != nil {\n\t\t\tPromError(\"增加上报缓存json解析\")\n\t\t\tlog.Error(\"json.Marshal(%v) error(%v)\", mrs, err)\n\t\t\tcontinue\n\t\t}\n\t\tk := reportKey(mid)\n\t\titem := &memcache.Item{Key: k, Value: bs, Expiration: d.mcReportExpire}\n\t\tif err = conn.Set(item); err != nil {\n\t\t\tPromError(\"mc:批量添加上报\")\n\t\t\tlog.Error(\"conn.Store(%s) error(%v)\", k, err)\n\t\t\treturn\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "8bdad1f4cc05c64c5ad1ad4c0847d6a0", "score": "0.41505048", "text": "func (t *BGP) AddAlertRule(id int) {\n\talertRule := AlertRule{RuleID: id}\n\tt.AlertRules = append(t.AlertRules, alertRule)\n}", "title": "" }, { "docid": "a75b7f37a38d80f74e99d2da567001c7", "score": "0.41404918", "text": "func (o *AuthGroupPermission) UpsertP(exec boil.Executor, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(exec, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1bd5b4069ce50fc8c763a5104f79056d", "score": "0.41236067", "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": "7d2200ab72bbd6c37e36392e77298e51", "score": "0.4105239", "text": "func (e *jsiiProxy_EmrModifyInstanceGroupByName) AddRetry(props *awsstepfunctions.RetryProps) awsstepfunctions.TaskStateBase {\n\tvar returns awsstepfunctions.TaskStateBase\n\n\t_jsii_.Invoke(\n\t\te,\n\t\t\"addRetry\",\n\t\t[]interface{}{props},\n\t\t&returns,\n\t)\n\n\treturn returns\n}", "title": "" }, { "docid": "8114c05a8a26daefdb39b94c97b1bee5", "score": "0.41004464", "text": "func (gc *gossipChannel) AddToMsgStore(msg *protoext.SignedGossipMessage) {\n\tif protoext.IsDataMsg(msg.GossipMessage) {\n\t\tgc.Lock()\n\t\tdefer gc.Unlock()\n\t\tadded := gc.blockMsgStore.Add(msg)\n\t\tif added {\n\t\t\tgc.logger.Debugf(\"Adding %v to the block puller\", msg)\n\t\t\tgc.blocksPuller.Add(msg)\n\t\t}\n\t}\n\n\tif protoext.IsStateInfoMsg(msg.GossipMessage) {\n\t\tgc.stateInfoMsgStore.Add(msg)\n\t}\n}", "title": "" }, { "docid": "1a11586d018610b00acd2046a7f102ae", "score": "0.4099329", "text": "func addToAggregate(rec *DataRecord,\n\tproj *Project) {\n\n\tgrpIx := getIndex(proj.GroupNames, rec.CurrentGroup)\n\n\t// Update the overall assignment totals\n\tproj.Assignments[grpIx]++\n\n\t// Update the within-variable assignment totals\n\tdata := proj.Data\n\tfor j, va := range proj.Variables {\n\t\tfor k, lev := range va.Levels {\n\t\t\tif rec.Data[j] == lev {\n\t\t\t\tdata[j][k][grpIx]++\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "402fcfae7402352164a8dabbe52c4d27", "score": "0.409195", "text": "func (a *AggregationProcess) addOrUpdateRecordInMap(flowKey *FlowKey, record entities.Record, isIPv4 bool) error {\n\ta.mutex.Lock()\n\tdefer a.mutex.Unlock()\n\n\tvar flowType uint8\n\tvar err error\n\tif flowTypeIE, _, exist := record.GetInfoElementWithValue(\"flowType\"); exist {\n\t\tflowType = flowTypeIE.GetUnsigned8Value()\n\t} else {\n\t\tklog.Warning(\"FlowType does not exist in current record.\")\n\t}\n\tcorrelationRequired := isCorrelationRequired(flowType, record)\n\n\tcurrTime := time.Now()\n\taggregationRecord, exist := a.flowKeyRecordMap[*flowKey]\n\tif exist {\n\t\tif correlationRequired {\n\t\t\t// Do correlation of records if record belongs to inter-node flow and\n\t\t\t// records from source and destination node are not received.\n\t\t\tif !aggregationRecord.ReadyToSend && !areRecordsFromSameNode(record, aggregationRecord.Record) {\n\t\t\t\tif err = a.correlateRecords(record, aggregationRecord.Record); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\taggregationRecord.ReadyToSend = true\n\t\t\t\taggregationRecord.areCorrelatedFieldsFilled = true\n\t\t\t}\n\t\t\t// Aggregation of incoming flow record with existing by updating stats\n\t\t\t// and flow timestamps.\n\t\t\tif isRecordFromSrc(record) {\n\t\t\t\tif err = a.aggregateRecords(record, aggregationRecord.Record, true, false); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err = a.aggregateRecords(record, aggregationRecord.Record, false, true); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\t// For flows that do not need correlation, just do aggregation of the\n\t\t\t// flow record with existing record by updating the stats and flow timestamps.\n\t\t\tif err = a.aggregateRecords(record, aggregationRecord.Record, true, true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\t// Reset the inactive expiry time in the queue item with updated aggregate\n\t\t// record.\n\t\ta.expirePriorityQueue.Update(aggregationRecord.PriorityQueueItem,\n\t\t\tflowKey, aggregationRecord, aggregationRecord.PriorityQueueItem.activeExpireTime, currTime.Add(a.inactiveExpiryTimeout))\n\t} else {\n\t\t// Add all the new stat fields and initialize them.\n\t\tif correlationRequired {\n\t\t\tif isRecordFromSrc(record) {\n\t\t\t\tif err := a.addFieldsForStatsAggregation(record, true, false); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := a.addFieldsForThroughputCalculation(record, true, false); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := a.addFieldsForStatsAggregation(record, false, true); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err := a.addFieldsForThroughputCalculation(record, false, true); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif err := a.addFieldsForStatsAggregation(record, true, true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := a.addFieldsForThroughputCalculation(record, true, true); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\taggregationRecord = &AggregationFlowRecord{\n\t\t\tRecord: record,\n\t\t\tReadyToSend: false,\n\t\t\twaitForReadyToSendRetries: 0,\n\t\t\tisIPv4: isIPv4,\n\t\t}\n\n\t\tif !correlationRequired {\n\t\t\taggregationRecord.ReadyToSend = true\n\t\t\t// If no correlation is required for an Inter-Node record, K8s metadata is\n\t\t\t// expected to be not completely filled. For Intra-Node flows and ToExternal\n\t\t\t// flows, areCorrelatedFieldsFilled is set to true by default.\n\t\t\tif flowType == registry.FlowTypeInterNode {\n\t\t\t\taggregationRecord.areCorrelatedFieldsFilled = false\n\t\t\t} else {\n\t\t\t\taggregationRecord.areCorrelatedFieldsFilled = true\n\t\t\t}\n\t\t}\n\t\taggregationRecord.areExternalFieldsFilled = false\n\t\t// Push the record to the priority queue.\n\t\tpqItem := &ItemToExpire{\n\t\t\tflowKey: flowKey,\n\t\t}\n\t\taggregationRecord.PriorityQueueItem = pqItem\n\n\t\tpqItem.flowRecord = aggregationRecord\n\t\tpqItem.activeExpireTime = currTime.Add(a.activeExpiryTimeout)\n\t\tpqItem.inactiveExpireTime = currTime.Add(a.inactiveExpiryTimeout)\n\t\theap.Push(&a.expirePriorityQueue, pqItem)\n\t}\n\ta.flowKeyRecordMap[*flowKey] = aggregationRecord\n\treturn nil\n}", "title": "" }, { "docid": "572df66b391458c5dd6a7fc254bfea18", "score": "0.4085189", "text": "func (o *UserAuth) UpsertGP(updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "1fabca0fa10c9128735b47f685148c04", "score": "0.40763628", "text": "func (c *Cache) Add(key, element string) {\n\tc.Lock()\n\tdefer c.Unlock()\n\n\teventsForTopic := c.cache[key]\n\tfor _, id := range eventsForTopic {\n\t\tif id == element {\n\t\t\treturn\n\t\t}\n\t}\n\n\tc.cache[key] = append(c.cache[key], element)\n}", "title": "" }, { "docid": "c4d7b36d4ae2b77ed93c4fe500c0ac8f", "score": "0.40762243", "text": "func AddHostSignersToCache(hostSigners []services.CertAuthority) error {\n\tbk, err := boltbk.New(filepath.Join(getKeysDir(), HostSignersFilename))\n\tif err != nil {\n\t\treturn trace.Wrap(nil)\n\t}\n\tdefer bk.Close()\n\tca := services.NewCAService(bk)\n\n\tfor _, hostSigner := range hostSigners {\n\t\terr := ca.UpsertCertAuthority(hostSigner, 0)\n\t\tif err != nil {\n\t\t\treturn trace.Wrap(nil)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d68241eb14f730208b2507685bf52ac7", "score": "0.40713775", "text": "func (o *Registry) Upsert(ctx context.Context, exec boil.ContextExecutor, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no registries provided for upsert\")\n\t}\n\tcurrTime := time.Now().In(boil.GetLocation())\n\n\tif queries.MustTime(o.CreatedAt).IsZero() {\n\t\tqueries.SetScanner(&o.CreatedAt, currTime)\n\t}\n\tqueries.SetScanner(&o.UpdatedAt, currTime)\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(registryColumnsWithDefault, o)\n\tnzUniques := queries.NonZeroDefaultSet(mySQLRegistryUniqueColumns, o)\n\n\tif len(nzUniques) == 0 {\n\t\treturn errors.New(\"cannot upsert with a table that cannot conflict on a unique column\")\n\t}\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzUniques {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tregistryUpsertCacheMut.RLock()\n\tcache, cached := registryUpsertCache[key]\n\tregistryUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tregistryColumns,\n\t\t\tregistryColumnsWithDefault,\n\t\t\tregistryColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tregistryColumns,\n\t\t\tregistryPrimaryKeyColumns,\n\t\t)\n\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert registries, could not build update column list\")\n\t\t}\n\n\t\tret = strmangle.SetComplement(ret, nzUniques)\n\t\tcache.query = buildUpsertQueryMySQL(dialect, \"registries\", update, insert)\n\t\tcache.retQuery = fmt.Sprintf(\n\t\t\t\"SELECT %s FROM `registries` WHERE %s\",\n\t\t\tstrings.Join(strmangle.IdentQuoteSlice(dialect.LQ, dialect.RQ, ret), \",\"),\n\t\t\tstrmangle.WhereClause(\"`\", \"`\", 0, nzUniques),\n\t\t)\n\n\t\tcache.valueMapping, err = queries.BindMapping(registryType, registryMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(registryType, registryMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert for registries\")\n\t}\n\n\tvar uniqueMap []uint64\n\tvar nzUniqueCols []interface{}\n\n\tif len(cache.retMapping) == 0 {\n\t\tgoto CacheNoHooks\n\t}\n\n\tuniqueMap, err = queries.BindMapping(registryType, registryMapping, nzUniques)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to retrieve unique values for registries\")\n\t}\n\tnzUniqueCols = queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), uniqueMap)\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.retQuery)\n\t\tfmt.Fprintln(boil.DebugWriter, nzUniqueCols...)\n\t}\n\n\terr = exec.QueryRowContext(ctx, cache.retQuery, nzUniqueCols...).Scan(returns...)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to populate default values for registries\")\n\t}\n\nCacheNoHooks:\n\tif !cached {\n\t\tregistryUpsertCacheMut.Lock()\n\t\tregistryUpsertCache[key] = cache\n\t\tregistryUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "ef78f1e9a7e64b5ba177adbea1a05ad8", "score": "0.40609178", "text": "func (p *ConnPool) Upsert(table, key string, data interface{}) *errors.Error {\n\tsaveID := table + \":\" + key\n\n\tjsondata, err := json.Marshal(data)\n\tif err != nil {\n\t\treturn errors.PackError(errors.UndefinedErrorType, err.Error())\n\t}\n\tcreateErr := p.WritePool.Set(saveID, jsondata, 0).Err()\n\tif createErr != nil {\n\t\treturn errors.PackError(errors.UndefinedErrorType, writeToDBErrMsg+createErr.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fdff8290b11c316ee1480e28512a0869", "score": "0.40560025", "text": "func (o *Log) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no logs provided for upsert\")\n\t}\n\n\tif err := o.doBeforeUpsertHooks(exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(logColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs postgres problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range updateColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range whitelist {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tlogUpsertCacheMut.RLock()\n\tcache, cached := logUpsertCache[key]\n\tlogUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tvar ret []string\n\t\twhitelist, ret = strmangle.InsertColumnSet(\n\t\t\tlogColumns,\n\t\t\tlogColumnsWithDefault,\n\t\t\tlogColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t\twhitelist,\n\t\t)\n\t\tupdate := strmangle.UpdateColumnSet(\n\t\t\tlogColumns,\n\t\t\tlogPrimaryKeyColumns,\n\t\t\tupdateColumns,\n\t\t)\n\t\tif len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert logs, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(logPrimaryKeyColumns))\n\t\t\tcopy(conflict, logPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = queries.BuildUpsertQueryPostgres(dialect, \"\\\"logs\\\"\", updateOnConflict, ret, update, conflict, whitelist)\n\n\t\tcache.valueMapping, err = queries.BindMapping(logType, logMapping, whitelist)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(logType, logMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert logs\")\n\t}\n\n\tif !cached {\n\t\tlogUpsertCacheMut.Lock()\n\t\tlogUpsertCache[key] = cache\n\t\tlogUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(exec)\n}", "title": "" }, { "docid": "27b14bdfdcc9976392b934aeae42e2df", "score": "0.40559635", "text": "func (o *Group) Upsert(ctx context.Context, exec boil.ContextExecutor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no groups provided for upsert\")\n\t}\n\tif !boil.TimestampsAreSkipped(ctx) {\n\t\tcurrTime := time.Now().In(boil.GetLocation())\n\n\t\tif o.CreatedAt.IsZero() {\n\t\t\to.CreatedAt = currTime\n\t\t}\n\t\to.UpdatedAt = currTime\n\t}\n\n\tif err := o.doBeforeUpsertHooks(ctx, exec); err != nil {\n\t\treturn err\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(groupColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\tgroupUpsertCacheMut.RLock()\n\tcache, cached := groupUpsertCache[key]\n\tgroupUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\tgroupAllColumns,\n\t\t\tgroupColumnsWithDefault,\n\t\t\tgroupColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\tgroupAllColumns,\n\t\t\tgroupPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert groups, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(groupPrimaryKeyColumns))\n\t\t\tcopy(conflict, groupPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"auth\\\".\\\"groups\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(groupType, groupMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(groupType, groupMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, cache.query)\n\t\tfmt.Fprintln(writer, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRowContext(ctx, cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.ExecContext(ctx, cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert groups\")\n\t}\n\n\tif !cached {\n\t\tgroupUpsertCacheMut.Lock()\n\t\tgroupUpsertCache[key] = cache\n\t\tgroupUpsertCacheMut.Unlock()\n\t}\n\n\treturn o.doAfterUpsertHooks(ctx, exec)\n}", "title": "" }, { "docid": "45ce926aff4429a12cde9f1d72161dcf", "score": "0.40462384", "text": "func (o *UserAuth) UpsertG(updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateColumns, whitelist...)\n}", "title": "" }, { "docid": "8e8b6b3716207e312d714301a78455df", "score": "0.40431628", "text": "func (this *P2PServer) addToRetryList(addr string, node *discover.Node) {\n\tthis.ReconnectAddrs.Lock()\n\tdefer this.ReconnectAddrs.Unlock()\n\tif this.RetryAddrs == nil {\n\t\tthis.RetryAddrs = make(map[string]*retryPeerInfo)\n\t}\n\tif _, ok := this.RetryAddrs[addr]; ok {\n\t\tdelete(this.RetryAddrs, addr)\n\t}\n\t//alway set retry to 0\n\tthis.RetryAddrs[addr] = &retryPeerInfo{\n\t\tnum: 0,\n\t\tnodestr: node.String(),\n\t}\n}", "title": "" }, { "docid": "074d1f901a8e24292d365cfabef50adc", "score": "0.4028419", "text": "func (ssbde *stmtSummaryByDigestEvicted) AddEvicted(evictedKey *stmtSummaryByDigestKey, evictedValue *stmtSummaryByDigest, historySize int) {\n\tif evictedValue == nil {\n\t\treturn\n\t}\n\n\tevictedValue.Lock()\n\tdefer evictedValue.Unlock()\n\n\tssbde.Lock()\n\tdefer ssbde.Unlock()\n\n\tif evictedValue.history == nil {\n\t\treturn\n\t}\n\tfor e, h := evictedValue.history.Back(), ssbde.history.Back(); e != nil; e = e.Prev() {\n\t\tevictedElement := e.Value.(*stmtSummaryByDigestElement)\n\n\t\t// use closure to minimize time holding lock\n\t\tfunc() {\n\t\t\tevictedElement.Lock()\n\t\t\tdefer evictedElement.Unlock()\n\t\t\t// no record in ssbde.history, direct insert\n\t\t\tif ssbde.history.Len() == 0 && historySize != 0 {\n\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\tssbde.history.PushFront(record)\n\n\t\t\t\th = ssbde.history.Back()\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// look for matching history interval\n\t\tMATCHING:\n\t\t\tfor ; h != nil; h = h.Prev() {\n\t\t\t\thistoryElement := h.Value.(*stmtSummaryByDigestEvictedElement)\n\n\t\t\t\tswitch historyElement.matchAndAdd(evictedKey, evictedElement) {\n\t\t\t\tcase isMatch:\n\t\t\t\t\t// automatically added\n\t\t\t\t\tbreak MATCHING\n\t\t\t\t// not matching, create a new record and insert\n\t\t\t\tcase isTooYoung:\n\t\t\t\t\t{\n\t\t\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\t\t\tssbde.history.InsertAfter(record, h)\n\t\t\t\t\t\tbreak MATCHING\n\t\t\t\t\t}\n\t\t\t\tdefault: // isTooOld\n\t\t\t\t\t{\n\t\t\t\t\t\tif h == ssbde.history.Front() {\n\t\t\t\t\t\t\t// if digest older than all records in ssbde.history.\n\t\t\t\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\t\t\t\tssbde.history.PushFront(record)\n\t\t\t\t\t\t\tbreak MATCHING\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\t// prevent exceeding history size\n\t\tfor ssbde.history.Len() > historySize && ssbde.history.Len() > 0 {\n\t\t\tssbde.history.Remove(ssbde.history.Front())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1d405f3fc3782e2fa794de702509e3db", "score": "0.40135464", "text": "func (s *Store) addReplicaToGroupMapLocked(repl *Replica) error {\n\tif _, loaded := s.mu.replicas.LoadOrStore(repl.GroupID, repl); loaded {\n\t\treturn errors.New(\"replica already exists\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "752dc302f1df0075d8e30a831cc8514b", "score": "0.40059757", "text": "func (ssbde *stmtSummaryByDigestEvicted) AddEvicted(evictedKey *stmtSummaryByDigestKey, evictedValue *stmtSummaryByDigest, historySize int) {\n\tif evictedValue == nil {\n\t\treturn\n\t}\n\n\tevictedValue.Lock()\n\tdefer evictedValue.Unlock()\n\n\tif evictedValue.history == nil {\n\t\treturn\n\t}\n\tfor e, h := evictedValue.history.Back(), ssbde.history.Back(); e != nil; e = e.Prev() {\n\t\tevictedElement := e.Value.(*stmtSummaryByDigestElement)\n\n\t\t// use closure to minimize time holding lock\n\t\tfunc() {\n\t\t\tevictedElement.Lock()\n\t\t\tdefer evictedElement.Unlock()\n\t\t\t// no record in ssbde.history, direct insert\n\t\t\tif ssbde.history.Len() == 0 && historySize != 0 {\n\n\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\tssbde.history.PushFront(record)\n\n\t\t\t\th = ssbde.history.Back()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// look for matching history interval\n\t\tMATCHING:\n\t\t\tfor ; h != nil; h = h.Prev() {\n\t\t\t\thistoryElement := h.Value.(*stmtSummaryByDigestEvictedElement)\n\n\t\t\t\tswitch historyElement.matchAndAdd(evictedKey, evictedElement) {\n\t\t\t\tcase isMatch:\n\t\t\t\t\t// automatically added\n\t\t\t\t\tbreak MATCHING\n\t\t\t\t// not matching, create a new record and insert\n\t\t\t\tcase isTooYoung:\n\t\t\t\t\t{\n\t\t\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\t\t\tssbde.history.InsertAfter(record, h)\n\t\t\t\t\t\tbreak MATCHING\n\t\t\t\t\t}\n\t\t\t\tdefault: // isTooOld\n\t\t\t\t\t{\n\t\t\t\t\t\tif h == ssbde.history.Front() {\n\t\t\t\t\t\t\t// if digest older than all records in ssbde.history.\n\t\t\t\t\t\t\teBeginTime := evictedElement.beginTime\n\t\t\t\t\t\t\teEndTime := evictedElement.endTime\n\t\t\t\t\t\t\trecord := newStmtSummaryByDigestEvictedElement(eBeginTime, eEndTime)\n\t\t\t\t\t\t\trecord.addEvicted(evictedKey, evictedElement)\n\t\t\t\t\t\t\tssbde.history.PushFront(record)\n\t\t\t\t\t\t\tbreak MATCHING\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\t// prevent exceeding history size\n\t\tfor ssbde.history.Len() > historySize && ssbde.history.Len() > 0 {\n\t\t\tssbde.history.Remove(ssbde.history.Front())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f27c0d72e2c78c6296517245d31f3b18", "score": "0.40033168", "text": "func (am *Alertmanager) PutAlerts(postableAlerts apimodels.PostableAlerts) error {\n\talerts := make(alertingNotify.PostableAlerts, 0, len(postableAlerts.PostableAlerts))\n\tfor _, pa := range postableAlerts.PostableAlerts {\n\t\talerts = append(alerts, &alertingNotify.PostableAlert{\n\t\t\tAnnotations: pa.Annotations,\n\t\t\tEndsAt: pa.EndsAt,\n\t\t\tStartsAt: pa.StartsAt,\n\t\t\tAlert: pa.Alert,\n\t\t})\n\t}\n\n\treturn am.Base.PutAlerts(alerts)\n}", "title": "" }, { "docid": "68de6acb9af9e75818c3014de379d17a", "score": "0.40025902", "text": "func (d *Dispatcher) Groups(routeFilter func(*Route) bool, alertFilter func(*types.Alert, time.Time) bool) (AlertGroups, map[model.Fingerprint][]string) {\n\tgroups := AlertGroups{}\n\n\td.mtx.RLock()\n\tdefer d.mtx.RUnlock()\n\n\t// Keep a list of receivers for an alert to prevent checking each alert\n\t// again against all routes. The alert has already matched against this\n\t// route on ingestion.\n\treceivers := map[model.Fingerprint][]string{}\n\n\tnow := time.Now()\n\tfor route, ags := range d.aggrGroupsPerRoute {\n\t\tif !routeFilter(route) {\n\t\t\tcontinue\n\t\t}\n\n\t\tfor _, ag := range ags {\n\t\t\treceiver := route.RouteOpts.Receiver\n\t\t\talertGroup := &AlertGroup{\n\t\t\t\tLabels: ag.labels,\n\t\t\t\tReceiver: receiver,\n\t\t\t}\n\n\t\t\talerts := ag.alerts.List()\n\t\t\tfilteredAlerts := make([]*types.Alert, 0, len(alerts))\n\t\t\tfor _, a := range alerts {\n\t\t\t\tif !alertFilter(a, now) {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tfp := a.Fingerprint()\n\t\t\t\tif r, ok := receivers[fp]; ok {\n\t\t\t\t\t// Receivers slice already exists. Add\n\t\t\t\t\t// the current receiver to the slice.\n\t\t\t\t\treceivers[fp] = append(r, receiver)\n\t\t\t\t} else {\n\t\t\t\t\t// First time we've seen this alert fingerprint.\n\t\t\t\t\t// Initialize a new receivers slice.\n\t\t\t\t\treceivers[fp] = []string{receiver}\n\t\t\t\t}\n\n\t\t\t\tfilteredAlerts = append(filteredAlerts, a)\n\t\t\t}\n\t\t\tif len(filteredAlerts) == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\talertGroup.Alerts = filteredAlerts\n\n\t\t\tgroups = append(groups, alertGroup)\n\t\t}\n\t}\n\tsort.Sort(groups)\n\tfor i := range groups {\n\t\tsort.Sort(groups[i].Alerts)\n\t}\n\tfor i := range receivers {\n\t\tsort.Strings(receivers[i])\n\t}\n\n\treturn groups, receivers\n}", "title": "" }, { "docid": "b4dc9229a770f8ef45aa400327ddc866", "score": "0.39943737", "text": "func (c *Cache) Add(p *points.Points) {\n\tif values, exists := c.data[p.Metric]; exists {\n\t\tvalues.Data = append(values.Data, p.Data...)\n\t} else {\n\t\tatomic.AddUint32(&c.metricCount, 1)\n\t\tc.data[p.Metric] = p\n\t}\n\tc.size = atomic.AddUint32(&c.sizeShared, uint32(len(p.Data)))\n}", "title": "" }, { "docid": "ea7692e57fa56a9ec08124b8677562b2", "score": "0.39905858", "text": "func mergeAlertsByReason(ctx *router.Context, alerts []messages.Alert) (groupCounts, error) {\n\tc, p := ctx.Context, ctx.Params\n\n\ttree := p.ByName(\"tree\")\n\n\tbyReason := map[string][]messages.Alert{}\n\tfor _, alert := range alerts {\n\t\tbf, ok := alert.Extension.(messages.BuildFailure)\n\t\tif !ok {\n\t\t\tlogging.Infof(c, \"%s failed, but isn't a builder-failure: %s\", alert.Key, alert.Type)\n\t\t\tcontinue\n\t\t}\n\t\tr := bf.Reason\n\t\tk := r.Kind() + \"|\" + r.Signature()\n\t\tbyReason[k] = append(byReason[k], alert)\n\t}\n\n\tsortedReasons := []string{}\n\tfor reason := range byReason {\n\t\tsortedReasons = append(sortedReasons, reason)\n\t}\n\n\tsort.Strings(sortedReasons)\n\n\t// Maps alert category to map of groupID to count of alerts in group.\n\tgroupIDs := groupCounts{}\n\tvar mux sync.Mutex\n\n\terr := parallel.WorkPool(groupingPoolSize, func(workC chan<- func() error) {\n\t\tfor _, reason := range sortedReasons {\n\t\t\tstepAlerts := byReason[reason]\n\t\t\tif len(stepAlerts) == 1 {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tworkC <- func() error {\n\t\t\t\tsort.Sort(messages.Alerts(stepAlerts))\n\t\t\t\tmergedBF := stepAlerts[0].Extension.(messages.BuildFailure)\n\n\t\t\t\tstepsAtFault := make([]*messages.BuildStep, len(stepAlerts))\n\t\t\t\tfor i := range stepAlerts {\n\t\t\t\t\tbf, ok := stepAlerts[i].Extension.(messages.BuildFailure)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn fmt.Errorf(\"alert extension %s was not a BuildFailure\", stepAlerts[i].Extension)\n\t\t\t\t\t}\n\n\t\t\t\t\tstepsAtFault[i] = bf.StepAtFault\n\t\t\t\t}\n\n\t\t\t\tgroupTitle := mergedBF.Reason.Title(stepsAtFault)\n\t\t\t\tfor _, alr := range stepAlerts {\n\t\t\t\t\tann := &model.Annotation{\n\t\t\t\t\t\tTree: datastore.MakeKey(c, \"Tree\", tree),\n\t\t\t\t\t\tKeyDigest: fmt.Sprintf(\"%x\", sha1.Sum([]byte(alr.Key))),\n\t\t\t\t\t\tKey: alr.Key,\n\t\t\t\t\t}\n\t\t\t\t\terr := datastore.Get(c, ann)\n\t\t\t\t\tif err != nil && err != datastore.ErrNoSuchEntity {\n\t\t\t\t\t\tlogging.Warningf(c, \"got err while getting annotation from key %s: %s. Ignoring\", alr.Key, err)\n\t\t\t\t\t}\n\n\t\t\t\t\tcat := alertCategory(&alr)\n\n\t\t\t\t\t// Count ungrouped alerts as their own groups.\n\t\t\t\t\tgID := groupTitle\n\t\t\t\t\tif ann != nil {\n\t\t\t\t\t\tgID = ann.GroupID\n\t\t\t\t\t}\n\n\t\t\t\t\tmux.Lock()\n\t\t\t\t\tif _, ok := groupIDs[cat]; !ok {\n\t\t\t\t\t\tgroupIDs[cat] = map[string]int{}\n\t\t\t\t\t}\n\t\t\t\t\tgroupIDs[cat][gID]++\n\t\t\t\t\tmux.Unlock()\n\n\t\t\t\t\t// If we didn't find an annotation, then the default group ID will be present.\n\t\t\t\t\t// We only want the case where the user explicitly sets the group to something.\n\t\t\t\t\t// Ungrouping an alert sets the group ID to \"\".\n\t\t\t\t\tif err != datastore.ErrNoSuchEntity && ann.GroupID != groupTitle {\n\t\t\t\t\t\tlogging.Warningf(c, \"Found groupID %s, wanted to set %s. Assuming user set group manually.\", ann.GroupID, groupTitle)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\n\t\t\t\t\tann.GroupID = groupTitle\n\t\t\t\t\tif err := datastore.Put(c, ann); err != nil {\n\t\t\t\t\t\treturn fmt.Errorf(\"got err while put: %s\", err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t})\n\n\treturn groupIDs, err\n}", "title": "" }, { "docid": "bc32aa0a5bb23700c225f601fab0b933", "score": "0.39901155", "text": "func (o *Stockcollectionprop) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "49dccfd88d8f1451f6a25ca2373bfde4", "score": "0.3978521", "text": "func (mm *OnuMetricsManager) AddGemPortForPerfMonitoring(ctx context.Context, gemPortNTPInstID uint16) {\n\tmm.OnuMetricsManagerLock.Lock()\n\tdefer mm.OnuMetricsManagerLock.Unlock()\n\tlogger.Debugw(ctx, \"add gemport for perf monitoring - start\", log.Fields{\"device-id\": mm.deviceID, \"gemPortID\": gemPortNTPInstID})\n\t// mark the instance for addition\n\tmm.GroupMetricMap[GemPortHistoryName].pmMEData.InstancesToAdd = mm.appendIfMissingUnt16(mm.GroupMetricMap[GemPortHistoryName].pmMEData.InstancesToAdd, gemPortNTPInstID)\n\t// If the instance presence toggles too soon, we need to remove it from gemPortNCTPPerfHistInstToDelete slice\n\tmm.GroupMetricMap[GemPortHistoryName].pmMEData.InstancesToDelete = mm.removeIfFoundUint16(mm.GroupMetricMap[GemPortHistoryName].pmMEData.InstancesToDelete, gemPortNTPInstID)\n\n\tmm.l2PmToAdd = mm.appendIfMissingString(mm.l2PmToAdd, GemPortHistoryName)\n\t// We do not need to remove from l2PmToDelete slice as we could have Add and Delete of\n\t// GemPortPerfHistory ME simultaneously for different instances of the ME.\n\t// The creation or deletion of an instance is decided based on its presence in gemPortNCTPPerfHistInstToDelete or\n\t// gemPortNCTPPerfHistInstToAdd slice\n\n\tlogger.Debugw(ctx, \"add gemport for perf monitoring - end\",\n\t\tlog.Fields{\"device-id\": mm.deviceID, \"pms-to-add\": mm.l2PmToAdd,\n\t\t\t\"instances-to-add\": mm.GroupMetricMap[GemPortHistoryName].pmMEData.InstancesToAdd})\n\tgo func() {\n\t\tif err := mm.PAdaptFsm.PFsm.Event(L2PmEventAddMe); err != nil {\n\t\t\t// log at warn level as the gem port for monitoring is going to be added eventually\n\t\t\tlogger.Warnw(ctx, \"error calling event\", log.Fields{\"device-id\": mm.deviceID, \"err\": err})\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "a0112d8e10c6a692a14426ceeef07cd1", "score": "0.39634222", "text": "func (o *Log) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "a539df771bb6b26f040923b2e52f9952", "score": "0.39587754", "text": "func (o *DGuildRole) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "4684ddd015aa6ed0f95b4745d3060d4a", "score": "0.39579615", "text": "func (o *InstitutionRole) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "53c0fafb8fc66f352ad53de15aac0ce8", "score": "0.39570782", "text": "func (s *Service) UpsertEndpoints(endpoints []*Endpoint, handlers ...EndpointOnChangeHandler) (result *ServiceUpdateRecord, err error) {\n\tresult = &ServiceUpdateRecord{}\n\tfor _, e := range endpoints {\n\t\tif s.IsChildEndpoint(e) {\n\t\t\terr = s.Add(e, handlers...)\n\t\t\tif err != nil {\n\t\t\t\terr = s.Update(e, handlers...)\n\t\t\t\t// this will not hit since the only error check is of e's existence which the add already has done\n\t\t\t\t// unless another goroutine has removed the endpoint in the middle of this func\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\tresult.Updated = append(result.Updated, e)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tresult.Added = append(result.Added, e)\n\t\t\tcontinue\n\t\t}\n\t\tresult.Ignored = append(result.Ignored, e)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "37f460c218864082a6cbe282aeb0bee1", "score": "0.3956502", "text": "func (s *GroupQueryStrategy) Upsert(m core.Model) error {\n\t_, err := s.DB.Model(m).\n\t\tOnConflict(\"(id) DO UPDATE\").\n\t\tSet(`(\n\t\t\t\"name\",\n\t\t\t\"description\",\n\t\t\t\"image_url\"\n\t\t) = (\n\t\t\t?name,\n\t\t\t?description,\n\t\t\t?image_url)`).\n\t\tInsert()\n\treturn err\n}", "title": "" }, { "docid": "b882dc708a5a2185078db311231e2655", "score": "0.39485252", "text": "func (o *Log) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "0b04fc6e6886fa280df85d51d46bb4fe", "score": "0.39448792", "text": "func (b *Bindings) AddKeygroup(name string, k KeyGroup) {\n\tif b.FindKeyGroupIndex(name, k) == -1 {\n\t\tb.Keygroups[name] = append(b.Keygroups[name], k)\n\t}\n}", "title": "" }, { "docid": "aca1eab70eb84a64e63c63664c294f61", "score": "0.3937549", "text": "func (set *BasicBackend) Import(alert *models.Alert) {\n\tdefer utils.TimeIt(time.Now(), Operations.WithLabelValues(\"import\"))\n\n\t// Bump lastUpdate\n\tset.lastUpdate = time.Now().UTC()\n\n\tkey := utils.Key(alert)\n\tlog.Debugf(\"Doing Import of %s: %+v\", key, alert)\n\n\t// Lock the dataset for insert delete\n\t// At some point we will probably want to lock items but this will work for now AFAIK\n\tset.lock.Lock()\n\tdefer set.lock.Unlock()\n\n\tpAlert, ok := set.data[key]\n\t// Alert Exists. Merge the summary\n\tif !ok {\n\t\tlog.Debugln(\"No existing alert creating new entry\")\n\t\tpAlert = models.InternalAlert{}\n\t}\n\n\tutils.Merge(&pAlert, alert)\n\n\tset.data[key] = pAlert\n\tset.collectMetrics()\n}", "title": "" }, { "docid": "f498fc53bc9d152f0af736d5ca7c7559", "score": "0.39334482", "text": "func (chart *Chart) UpdateAlert(alert Alert) error {\n\ti, err := chart.FindAlertIndex(alert.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tchart.Alerts[i] = alert\n\treturn nil\n}", "title": "" }, { "docid": "415d1cf6e4dd3273021f4ce36bacc561", "score": "0.39193335", "text": "func (db *InMemDB) Upsert(_ context.Context, rec *Record) error {\n\tdb.mu.Lock()\n\tdefer db.mu.Unlock()\n\n\tdb.records[rec.Email] = rec\n\treturn nil\n}", "title": "" }, { "docid": "7491542b583f4f330813aef8de3150d0", "score": "0.39154506", "text": "func (r *OnPremisesPublishingProfileAgentGroupsCollectionRequest) Add(ctx context.Context, reqObj *OnPremisesAgentGroup) (resObj *OnPremisesAgentGroup, err error) {\n\terr = r.JSONRequest(ctx, \"POST\", \"\", reqObj, &resObj)\n\treturn\n}", "title": "" }, { "docid": "f042deecbc4d52f006ea07108880f94a", "score": "0.39149204", "text": "func (o *Session) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "ecdf19190fff0fda6f5e9dc95b519a88", "score": "0.39049068", "text": "func AddStats(m map[string]string) {\n\ttotalMap := make(map[string]int64)\n\tpendingMap := make(map[string]int64)\n\n\tfis, err := ioutil.ReadDir(conf.Dir)\n\tif err != nil {\n\t\tm[\"PERSIST_error\"] = err.Error()\n\t\treturn\n\t}\n\n\tfor _, fi := range fis {\n\t\trelFilename := fi.Name()\n\n\t\tif fi.IsDir() || !strings.HasSuffix(relFilename, logSuffix) {\n\t\t\tcontinue\n\t\t}\n\n\t\ttable := getTableFromFileName(relFilename)\n\t\toff := getAcknowledgedOffset(relFilename)\n\t\tsz := fi.Size()\n\n\t\ttotalMap[table] += sz\n\t\tif sz > off.Offset {\n\t\t\tpendingMap[table] += sz - off.Offset\n\t\t}\n\t}\n\n\tfor table, num := range totalMap {\n\t\tm[\"PERSIST_table_size__\"+table] = fmt.Sprint(num)\n\t}\n\n\tvar totalPending int64\n\n\tfor table, num := range pendingMap {\n\t\ttotalPending += num\n\t\tm[\"PERSIST_table_pending__\"+table] = fmt.Sprint(num)\n\t}\n\n\tm[\"PERSIST_total_pending\"] = fmt.Sprint(totalPending)\n}", "title": "" }, { "docid": "63701af5164f5af71d0ac73a0ce252d5", "score": "0.3897556", "text": "func (vars *EnvVars) Upsert(k, v string) {\n\tfor i, p := range *vars {\n\t\tif p.Name == k {\n\t\t\t(*vars)[i].Val = v\n\t\t\treturn\n\t\t}\n\t}\n\t*vars = append(*vars, EnvPair{Name: k, Val: v})\n}", "title": "" }, { "docid": "80202ae1599065ec70bb8da0c35bc28c", "score": "0.3895211", "text": "func (o *Session) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "750460280f6833572e6573cbc8679b8f", "score": "0.38931763", "text": "func (s *state) UpsertGuildFromElementMap(eMap map[string]etfapi.Element) (snowflake.Snowflake, error) {\n\te, ok := eMap[\"id\"]\n\tif !ok {\n\t\treturn 0, errors.Wrap(ErrMissingData, \"UpsertGuildFromElementMap could not find guild id map element\")\n\t}\n\n\tid, err := etfapi.SnowflakeFromElement(e)\n\tif err != nil {\n\t\treturn id, errors.Wrap(err, \"UpsertGuildFromElementMap could not find guild id\")\n\t}\n\n\tg, ok := s.guilds[id]\n\tif !ok {\n\t\tg, err = GuildFromElementMap(eMap)\n\t\tif err != nil {\n\t\t\treturn id, errors.Wrap(err, \"UpsertGuildFromElementMap could not insert guild into the session\")\n\t\t}\n\t\ts.guilds[id] = g\n\n\t\treturn id, nil\n\t}\n\n\terr = g.UpdateFromElementMap(eMap)\n\tif err != nil {\n\t\treturn id, errors.Wrap(err, \"UpsertGuildFromElementMap could not update guild into the session\")\n\t}\n\n\ts.guilds[id] = g\n\treturn id, nil\n}", "title": "" }, { "docid": "e9d9923f4d9cf8b59291a9dfcc67ac5d", "score": "0.38929912", "text": "func (ds *DoitServer) AddGroupHosts(d *Domain, id int, hosts ...Host) error {\n\tdomain, err := ds.GetDomain(d.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tg, err := ds.GetGroup(domain, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgormErr := ds.Store.Conn.Model(&g).Association(\"Hosts\").Append(hosts)\n\treturn gormErr.Error\n}", "title": "" }, { "docid": "3a737cff49d7b5d8f283c3ba1aa18a10", "score": "0.38906774", "text": "func (o *Stockcollectionprop) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "ce981449a3921860408a56aa549e01bd", "score": "0.3888578", "text": "func (o *AuthGroup) UpdateGP(whitelist ...string) {\n\tif err := o.Update(boil.GetDB(), whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "efd3cd2e79b7ac8b4eefdf1668a1755a", "score": "0.38785595", "text": "func Add(context interface{}, db *db.DB, patterns []pattern.Pattern) error {\n\tfor _, pat := range patterns {\n\t\tif err := pattern.Upsert(context, db, &pat); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b9a22cb2b32660eaae92b5b8d5d28d87", "score": "0.3877834", "text": "func (st *Status) AddOrUpdatePeer(data *client.NotifyDataForeignCluster) *PeerInfo {\n\tst.Lock()\n\tdefer st.Unlock()\n\t//remove this check when handling the case of unauthorized ForeignCluster (probably manually discovered)\n\t//which had his authn request refused.\n\tif data.ClusterID == \"\" {\n\t\tpanic(\"clusterId of a NotifyDataForeignCluster object should always be not empty\")\n\t}\n\t_, present := st.peerList[data.ClusterID]\n\tif !present {\n\t\treturn st.addPeer(data)\n\t}\n\treturn st.updatePeer(data)\n}", "title": "" }, { "docid": "09e9bd0b9ba196dcc5be5b04d9c8b31b", "score": "0.38769975", "text": "func SendMetrics(metrics []*models.Metric) {\n\taddonsAccepting := make(map[string][]string)\n\tdataList := make(map[string][]*client.Point)\n\tnowUnix := time.Now().Unix()\n\tfor _, m := range metrics {\n\t\tp, err := metric2Point(m)\n\t\tif err != nil {\n\t\t\tlog.Warn(\"point-error\", \"error\", err, \"metric\", m)\n\t\t\tcontinue\n\t\t}\n\t\tgroupLock.RLock()\n\t\taccepts := groupAccept[m.Name]\n\t\tif len(accepts) == 0 {\n\t\t\taccepts = groupAccept[\"*\"]\n\t\t\taddonsAccepting[m.Name] = accepts\n\t\t}\n\t\tgroupLock.RUnlock()\n\t\tif len(accepts) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, name := range accepts {\n\t\t\texpire := groupExpire[name]\n\t\t\tif expire > 0 && nowUnix-m.Time >= expire {\n\t\t\t\tlog.Warn(\"point-expire\", \"metric\", m, \"group\", name)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdataList[name] = append(dataList[name], p)\n\t\t}\n\t}\n\n\tgroupLock.RLock()\n\tfor name, points := range dataList {\n\t\tif g := groups[name]; g != nil {\n\t\t\tg.Send(points)\n\t\t}\n\t}\n\tgroupLock.RUnlock()\n\n\tif len(addonsAccepting) > 0 {\n\t\tgroupLock.Lock()\n\t\tfor name, accepts := range addonsAccepting {\n\t\t\tgroupAccept[name] = accepts\n\t\t}\n\t\tb, _ := json.Marshal(groupAccept)\n\t\tioutil.WriteFile(acceptDumpFile, b, 0644)\n\t\tlog.Info(\"add-accepts\", \"count\", len(groupAccept))\n\t\tgroupLock.Unlock()\n\t}\n}", "title": "" }, { "docid": "ac9105724f9a159d4cb21a3d746db425", "score": "0.3867002", "text": "func (s *SubRepoPermsStore) Upsert(ctx context.Context, userID int32, repoID api.RepoID, perms authz.SubRepoPermissions) error {\n\tq := sqlf.Sprintf(`\nINSERT INTO sub_repo_permissions (user_id, repo_id, path_includes, path_excludes, version, updated_at)\nVALUES (%s, %s, %s, %s, %s, now())\nON CONFLICT (user_id, repo_id, version) DO UPDATE\nSET (user_id, repo_id, path_includes, path_excludes, version, updated_at) =\n(EXCLUDED.user_id, EXCLUDED.repo_id, EXCLUDED.path_includes, EXCLUDED.path_excludes, EXCLUDED.version, now())\n`, userID, repoID, pq.Array(perms.PathIncludes), pq.Array(perms.PathExcludes), SubRepoPermsVersion)\n\treturn errors.Wrap(s.Exec(ctx, q), \"upserting sub repo permissions\")\n}", "title": "" }, { "docid": "66101df2722041db2d04bd27776e9e91", "score": "0.38627145", "text": "func (o *ContentUnitI18n) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "8857a73197786d4b2b1a08f9e8638f57", "score": "0.38570878", "text": "func (ps *PoolSpec) WithWriteCacheRaidGroups(writeCacheRaidGroups ...RaidGroup) *PoolSpec {\n\tps.WriteCacheRaidGroups = append(ps.WriteCacheRaidGroups, writeCacheRaidGroups...)\n\treturn ps\n}", "title": "" }, { "docid": "3556a0b5a6b0262ff22d994644090045", "score": "0.38565794", "text": "func (o *RoomStatistic) Upsert(exec boil.Executor, updateOnConflict bool, conflictColumns []string, updateColumns, insertColumns boil.Columns) error {\n\tif o == nil {\n\t\treturn errors.New(\"models: no room_statistics provided for upsert\")\n\t}\n\n\tnzDefaults := queries.NonZeroDefaultSet(roomStatisticColumnsWithDefault, o)\n\n\t// Build cache key in-line uglily - mysql vs psql problems\n\tbuf := strmangle.GetBuffer()\n\tif updateOnConflict {\n\t\tbuf.WriteByte('t')\n\t} else {\n\t\tbuf.WriteByte('f')\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range conflictColumns {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(updateColumns.Kind))\n\tfor _, c := range updateColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tbuf.WriteString(strconv.Itoa(insertColumns.Kind))\n\tfor _, c := range insertColumns.Cols {\n\t\tbuf.WriteString(c)\n\t}\n\tbuf.WriteByte('.')\n\tfor _, c := range nzDefaults {\n\t\tbuf.WriteString(c)\n\t}\n\tkey := buf.String()\n\tstrmangle.PutBuffer(buf)\n\n\troomStatisticUpsertCacheMut.RLock()\n\tcache, cached := roomStatisticUpsertCache[key]\n\troomStatisticUpsertCacheMut.RUnlock()\n\n\tvar err error\n\n\tif !cached {\n\t\tinsert, ret := insertColumns.InsertColumnSet(\n\t\t\troomStatisticAllColumns,\n\t\t\troomStatisticColumnsWithDefault,\n\t\t\troomStatisticColumnsWithoutDefault,\n\t\t\tnzDefaults,\n\t\t)\n\t\tupdate := updateColumns.UpdateColumnSet(\n\t\t\troomStatisticAllColumns,\n\t\t\troomStatisticPrimaryKeyColumns,\n\t\t)\n\n\t\tif updateOnConflict && len(update) == 0 {\n\t\t\treturn errors.New(\"models: unable to upsert room_statistics, could not build update column list\")\n\t\t}\n\n\t\tconflict := conflictColumns\n\t\tif len(conflict) == 0 {\n\t\t\tconflict = make([]string, len(roomStatisticPrimaryKeyColumns))\n\t\t\tcopy(conflict, roomStatisticPrimaryKeyColumns)\n\t\t}\n\t\tcache.query = buildUpsertQueryPostgres(dialect, \"\\\"room_statistics\\\"\", updateOnConflict, ret, update, conflict, insert)\n\n\t\tcache.valueMapping, err = queries.BindMapping(roomStatisticType, roomStatisticMapping, insert)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(ret) != 0 {\n\t\t\tcache.retMapping, err = queries.BindMapping(roomStatisticType, roomStatisticMapping, ret)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tvalue := reflect.Indirect(reflect.ValueOf(o))\n\tvals := queries.ValuesFromMapping(value, cache.valueMapping)\n\tvar returns []interface{}\n\tif len(cache.retMapping) != 0 {\n\t\treturns = queries.PtrsFromMapping(value, cache.retMapping)\n\t}\n\n\tif boil.DebugMode {\n\t\tfmt.Fprintln(boil.DebugWriter, cache.query)\n\t\tfmt.Fprintln(boil.DebugWriter, vals)\n\t}\n\tif len(cache.retMapping) != 0 {\n\t\terr = exec.QueryRow(cache.query, vals...).Scan(returns...)\n\t\tif err == sql.ErrNoRows {\n\t\t\terr = nil // Postgres doesn't return anything when there's no update\n\t\t}\n\t} else {\n\t\t_, err = exec.Exec(cache.query, vals...)\n\t}\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"models: unable to upsert room_statistics\")\n\t}\n\n\tif !cached {\n\t\troomStatisticUpsertCacheMut.Lock()\n\t\troomStatisticUpsertCache[key] = cache\n\t\troomStatisticUpsertCacheMut.Unlock()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "28d4a5308012a090c42d1323de5ca552", "score": "0.38539293", "text": "func (h *HistogramAggregator) Push(acc telegraf.Accumulator) {\n\tmetricsWithGroupedFields := []groupedByCountFields{}\n\tnow := timeNow()\n\n\tfor id, aggregate := range h.cache {\n\t\tif h.ExpirationInterval != 0 && now.After(aggregate.expireTime) {\n\t\t\tdelete(h.cache, id)\n\t\t\tcontinue\n\t\t}\n\t\tif h.PushOnlyOnUpdate && !h.cache[id].updated {\n\t\t\tcontinue\n\t\t}\n\t\taggregate.updated = false\n\t\th.cache[id] = aggregate\n\t\tfor field, counts := range aggregate.histogramCollection {\n\t\t\th.groupFieldsByBuckets(&metricsWithGroupedFields, aggregate.name, field, copyTags(aggregate.tags), counts)\n\t\t}\n\t}\n\n\tfor _, metric := range metricsWithGroupedFields {\n\t\tacc.AddFields(metric.name, makeFieldsWithCount(metric.fieldsWithCount), metric.tags)\n\t}\n}", "title": "" }, { "docid": "272ef2551b4814c59edc9fac411fd1da", "score": "0.38501033", "text": "func (a *Accounts) AddOrUpdate(name string, account Account) {\n\tfor i, existingAccount := range *a {\n\t\tif existingAccount.Name == name {\n\t\t\t(*a)[i] = account\n\t\t\treturn\n\t\t}\n\t}\n\n\t*a = append(*a, account)\n}", "title": "" }, { "docid": "16951a6a9a4f1a24e2c03659a190b453", "score": "0.3844367", "text": "func putConfigGroups(ctx context.Context, cfg *pb.Config, project, hash string) error {\n\tcgLen := len(cfg.GetConfigGroups())\n\tif cgLen == 0 {\n\t\treturn nil\n\t}\n\n\tprojKey := datastore.MakeKey(ctx, projectConfigKind, project)\n\tkeys := make([]*datastore.Key, cgLen)\n\tfor i, cg := range cfg.GetConfigGroups() {\n\t\tkeys[i] = datastore.NewKey(ctx, \"ProjectConfigGroup\",\n\t\t\tstring(makeConfigGroupID(hash, cg.GetName(), i)), 0, projKey)\n\t}\n\n\tres, err := datastore.Exists(ctx, keys)\n\tif err != nil {\n\t\treturn errors.Annotate(err, \"failed to check the existence of ConfigGroups\").Tag(transient.Tag).Err()\n\t}\n\tentities := make([]ConfigGroup, 0, cgLen)\n\tfor i, cg := range cfg.GetConfigGroups() {\n\t\tif res.Get(0, i) {\n\t\t\tcontinue // already exists\n\t\t}\n\t\tentities = append(entities, ConfigGroup{\n\t\t\tID: ConfigGroupID(keys[i].StringID()),\n\t\t\tProject: projKey,\n\t\t\tDrainingStartTime: cfg.GetDrainingStartTime(),\n\t\t\tSubmitOptions: cfg.GetSubmitOptions(),\n\t\t\tContent: cg,\n\t\t})\n\t}\n\n\t// TODO(yiwzhang): batch up to ~10 entities to avoid hitting 10MiB limit of\n\t// request size: https://cloud.google.com/datastore/docs/concepts/limits\n\tif err := datastore.Put(ctx, entities); err != nil {\n\t\treturn errors.Annotate(err, \"failed to put ConfigGroups\").Tag(transient.Tag).Err()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "534678cac6c3d674f83bd053193fa8b1", "score": "0.38396245", "text": "func (proc *Proc) UpdateOrInsertIngressTLS(ingress *ksm.Ingress, descLabels map[string]string, Log logrus.FieldLogger) error {\n\tinputHost, isExist := descLabels[\"tls_host\"]\n\tif !isExist {\n\t\treturn fmt.Errorf(\"ERROR. Failed to Parse Ingress. Can Not Found host.[ %+v ]\", descLabels)\n\t}\n\tinputSecret, isExist := descLabels[\"secret\"]\n\tif !isExist {\n\t\treturn fmt.Errorf(\"ERROR. Failed to Parse Ingress. Can Not Found path.[ %+v ]\", descLabels)\n\t}\n\n\tfor tlsIdx, tls := range ingress.Spec.TLS {\n\t\tif inputSecret == tls.Secretname {\n\t\t\tingress.Spec.TLS[tlsIdx].RefreshTime = tools.GetMillis()\n\t\t\t// SecretName, Host가 동일한 경우\n\t\t\tfor hostIdx, host := range tls.Hosts {\n\t\t\t\tif inputHost == host.Host {\n\t\t\t\t\tingress.Spec.TLS[tlsIdx].Hosts[hostIdx].RefreshTime = tools.GetMillis()\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\t\t\t// Host가 없는 경우\n\t\t\thost := ksm.IngressHost{\n\t\t\t\tRefreshTime: tools.GetMillis(),\n\t\t\t\tUpdateTime: tools.GetMillis(),\n\t\t\t\tHost: inputHost,\n\t\t\t}\n\t\t\tingress.Spec.TLS[tlsIdx].Hosts = append(ingress.Spec.TLS[tlsIdx].Hosts, host)\n\t\t\tLog.Debugf(\"Ingress[ %s ] NS[ %s ] Add TLS Host. SecretName[ %s ] Host[ %s ]\",\n\t\t\t\tingress.Name, ingress.Namespace, inputHost, inputSecret)\n\t\t\treturn nil\n\t\t}\n\t}\n\t// SecretName이 없는 경우\n\ttls := ksm.IngressTLS{\n\t\tRefreshTime: tools.GetMillis(),\n\t\tUpdateTime: tools.GetMillis(),\n\t\tSecretname: inputSecret,\n\t\tHosts: []ksm.IngressHost{\n\t\t\t{\n\t\t\t\tRefreshTime: tools.GetMillis(),\n\t\t\t\tUpdateTime: tools.GetMillis(),\n\t\t\t\tHost: inputHost,\n\t\t\t},\n\t\t},\n\t}\n\tingress.Spec.TLS = append(ingress.Spec.TLS, tls)\n\tLog.Debugf(\"Ingress[ %s ] NS[ %s ] Add TLS. SecretName[ %s ] Host[ %s ]\",\n\t\tingress.Name, ingress.Namespace, inputSecret, inputHost)\n\treturn nil\n}", "title": "" }, { "docid": "e04784b620f176adaa7c99b7e1ffdf7b", "score": "0.38326532", "text": "func CreateOrUpdateAlertRules(ctx context.Context, client client.Client, namespace string, diskmakerName string, ownerRefs []metav1.OwnerReference) error {\n\treplacer := strings.NewReplacer(\n\t\t\"${OBJECT_NAMESPACE}\", namespace,\n\t\t\"${DAEMONSET_NAME}\", diskmakerName,\n\t)\n\trule, err := getPrometheusRule(replacer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get prometheus rule. %v\", err)\n\t}\n\n\trule.SetOwnerReferences(ownerRefs)\n\n\tif _, err = createOrUpdatePrometheusRule(ctx, client, rule); err != nil {\n\t\treturn fmt.Errorf(\"failed to enable prometheus rule. %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0f48d7e77272980ce06305f2142396e2", "score": "0.38319683", "text": "func (pc *PostureCache) Upsert(identityId string, emitDataAltered bool, cb func(exist bool, valueInMap *PostureData, newValue *PostureData) *PostureData) {\n\tpc.identityToPostureData.Upsert(identityId, newPostureData(), cb)\n\n\tif emitDataAltered {\n\t\tpc.Emit(EventIdentityPostureDataAltered, identityId)\n\t}\n}", "title": "" }, { "docid": "0cb727b5452783685f47a58f1cb3ffaa", "score": "0.38311383", "text": "func (o *RemoteUser) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "a8736b3d677f9fd734bc42a3e4e079bc", "score": "0.38279825", "text": "func (o *Board) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "71e51ec869d1d214276b764f548bd1f6", "score": "0.38268608", "text": "func (o *DGuildRole) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "cf752701e386daeda5ca5a749c98b3b9", "score": "0.38241124", "text": "func (s *Service) Upsert(matchKey string, isBlue bool, alliance alliance.Alliance) error {\n\tstmt, err := s.db.Prepare(`\n\t\tINSERT INTO alliances (matchKey, isBlue, number)\n\t\tVALUES ($1, $2, $3)\n\t\tON CONFLICT (matchKey, number)\n\t\tDO\n\t\t\tUPDATE\n\t\t\t\tSET\n\t\t\t\t\tisBlue = $2\n\t\t`)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer stmt.Close()\n\n\tfor _, team := range alliance {\n\t\tif _, err := stmt.Exec(matchKey, isBlue, team); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f025b236fd60ceffa272c49068a0eae0", "score": "0.38196874", "text": "func (client *Client) AttachLogStoreToEndpointGroup(request *AttachLogStoreToEndpointGroupRequest) (_result *AttachLogStoreToEndpointGroupResponse, _err error) {\n\truntime := &util.RuntimeOptions{}\n\t_result = &AttachLogStoreToEndpointGroupResponse{}\n\t_body, _err := client.AttachLogStoreToEndpointGroupWithOptions(request, runtime)\n\tif _err != nil {\n\t\treturn _result, _err\n\t}\n\t_result = _body\n\treturn _result, _err\n}", "title": "" }, { "docid": "02cc9c5178cfefdce797135cdfe67f9e", "score": "0.38175842", "text": "func (t *DNSServer) AddAlertRule(id int) {\n\talertRule := AlertRule{RuleID: id}\n\tt.AlertRules = append(t.AlertRules, alertRule)\n}", "title": "" }, { "docid": "b707a173b4a513d24e7bf2ca0c71282b", "score": "0.38096303", "text": "func (w *FeatureStoreWrapper) Upsert(kind ld.VersionedDataKind, item ld.VersionedData) error {\n\tfinalItem, err := w.core.UpsertInternal(kind, item)\n\t// Note that what we put into the cache is finalItem, which may not be the same as item (i.e. if\n\t// another process has already updated the item to a higher version).\n\tif err == nil && finalItem != nil {\n\t\tif w.cache != nil {\n\t\t\tw.cache.Set(featureStoreCacheKey(kind, item.GetKey()), finalItem, cache.DefaultExpiration)\n\t\t\tw.cache.Delete(featureStoreAllItemsCacheKey(kind))\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a35b70a0979a24e3c7c045a718af9f26", "score": "0.380901", "text": "func (mgr *Mgr) AddToCertPool(poolName string, cert []byte) {\n\tmgr.localAddToCertPool(poolName, cert)\n\tmgr.globalAddToCertPool(poolName, cert)\n}", "title": "" }, { "docid": "74c1bf8a2f72e2096a37f470412a9f86", "score": "0.3807305", "text": "func (c *client) addFlows(cache *flowCategoryCache, flowCacheKey string, flows []binding.Flow) error {\n\t_, ok := cache.Load(flowCacheKey)\n\t// If a flow cache entry already exists for the key, return immediately. Otherwise, add the flows to the switch\n\t// and populate the cache with them.\n\tif ok {\n\t\tklog.V(2).Infof(\"Flows with cache key %s are already installed\", flowCacheKey)\n\t\treturn nil\n\t}\n\terr := c.ofEntryOperations.AddAll(flows)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfCache := flowCache{}\n\t// Add the successfully installed flows into the flow cache.\n\tfor _, flow := range flows {\n\t\tfCache[flow.MatchString()] = flow\n\t}\n\tcache.Store(flowCacheKey, fCache)\n\treturn nil\n}", "title": "" }, { "docid": "023876dde9a0e07396e008821bc51aa3", "score": "0.3805502", "text": "func (o *Collection) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "900f64850ffcfeedc61a8d3eff945fd1", "score": "0.3803242", "text": "func (o *Collection) UpsertGP(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) {\n\tif err := o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "aabfafa1d798db917412cfb038899452", "score": "0.37998828", "text": "func (c *client) updatetrustMapAgg(ClientID shared.ClientID, amount float64) {\n\tc.trustMapAgg[ClientID] = append(c.trustMapAgg[ClientID], amount)\n}", "title": "" }, { "docid": "4c9edc6740b2b628b515f227091fb184", "score": "0.37970358", "text": "func addGroupPoints(grps []uint, grpMap map[uint]groupRecord) plotter.XYs {\n\tpts := make(plotter.XYs, len(grps))\n\tfor idx, grp := range grps {\n\t\tms := getGrpLatency(grpMap[grp].grMap)\n\t\tx := float64(grp)\n\t\ty := float64(ms)\n\t\tpts[idx].X = x\n\t\tpts[idx].Y = y\n\t}\n\treturn pts\n}", "title": "" }, { "docid": "b2f6360316e9a9f164082a49ca787259", "score": "0.37949428", "text": "func upsertPNLEntry(pnlHistory []PNLResult, entry *PNLResult) ([]PNLResult, error) {\n\tif entry.Time.IsZero() {\n\t\treturn nil, errTimeUnset\n\t}\n\tfor i := range pnlHistory {\n\t\tif !entry.Time.Equal(pnlHistory[i].Time) {\n\t\t\tcontinue\n\t\t}\n\t\tpnlHistory[i].UnrealisedPNL = entry.UnrealisedPNL\n\t\tpnlHistory[i].RealisedPNL = entry.RealisedPNL\n\t\tpnlHistory[i].RealisedPNLBeforeFees = entry.RealisedPNLBeforeFees\n\t\tpnlHistory[i].Exposure = entry.Exposure\n\t\tpnlHistory[i].Direction = entry.Direction\n\t\tpnlHistory[i].Price = entry.Price\n\t\tpnlHistory[i].Status = entry.Status\n\t\tpnlHistory[i].Fee = entry.Fee\n\t\tif entry.IsOrder {\n\t\t\tpnlHistory[i].IsOrder = true\n\t\t}\n\t\tif entry.IsLiquidated {\n\t\t\tpnlHistory[i].IsLiquidated = true\n\t\t}\n\t\treturn pnlHistory, nil\n\t}\n\tpnlHistory = append(pnlHistory, *entry)\n\tsort.Slice(pnlHistory, func(i, j int) bool {\n\t\treturn pnlHistory[i].Time.Before(pnlHistory[j].Time)\n\t})\n\treturn pnlHistory, nil\n}", "title": "" }, { "docid": "09b834997710e971adab5596c47d3b54", "score": "0.37945437", "text": "func (o *InstitutionRole) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" }, { "docid": "1e3e2b607328cf042f2568790064f499", "score": "0.37902963", "text": "func (c *Client) Upsert(fqdn, domain, value string, ttl uint) error {\n\n\tactions := []Action{}\n\tif err := c.ExistingTXTRecords(fqdn); err == nil {\n\t\tactions = append(actions, Action{action: Update, domain: domain, fqdn: fqdn, value: value, ttl: ttl})\n\t} else {\n\t\tactions = append(actions, Action{action: Add, domain: domain, fqdn: fqdn, value: value, ttl: ttl})\n\t}\n\n\tif err := c.DoActions(actions...); err != nil {\n\t\treturn fmt.Errorf(\"hover: failed to add record(s) for %s: %w\", domain, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03426cea270c82a14045a79ec892cbce", "score": "0.37880248", "text": "func AddPemToCertPool(pemCerts []byte, pool *x509.CertPool) error {\n\tcerts, _, err := pemToX509Certs(pemCerts)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, cert := range certs {\n\t\tpool.AddCert(cert)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fff4fa6c932e578dcffa635abfb3426d", "score": "0.37868235", "text": "func (o *Board) UpsertG(updateOnConflict bool, conflictColumns []string, updateColumns []string, whitelist ...string) error {\n\treturn o.Upsert(boil.GetDB(), updateOnConflict, conflictColumns, updateColumns, whitelist...)\n}", "title": "" } ]
b313ac9716866e92c5c0a0b75728871f
IndexViewSettings retrieves index settings
[ { "docid": "fcc30337fd9e0861241d67e0b5d41f48", "score": "0.78936917", "text": "func (e Es) IndexViewSettings(indexName string) (*IndexSettings, error) {\n\tbody, err := e.getJSON(fmt.Sprintf(\"/%s/_settings\", indexName))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// return settings, nil\n\terr = checkError(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Index %s failed: %s\", indexName, err.Error())\n\t}\n\n\tindexName = e.resolveAlias(indexName)\n\n\tsettings := &IndexSettings{}\n\terr = utils.DictToAny(body[indexName].(map[string]interface{})[\"settings\"].(map[string]interface{})[\"index\"].(map[string]interface{}), settings)\n\n\treturn settings, nil\n}", "title": "" } ]
[ { "docid": "0cc3d5b9f69b0cd3dc4f2638ba223d80", "score": "0.73299974", "text": "func (i *Index) GetSettings() (interface{}, error) {\n\treturn i.client.transport.request(\"GET\", \"/1/indexes/\"+i.nameEncoded+\"/settings?getVersion=2\", nil, read)\n}", "title": "" }, { "docid": "9edcdb531afe92426dc3229ee8e9091f", "score": "0.6484597", "text": "func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettingsService {\n\treturn NewIndicesGetSettingsService(c).Index(indices...)\n}", "title": "" }, { "docid": "9edcdb531afe92426dc3229ee8e9091f", "score": "0.6484597", "text": "func (c *Client) IndexGetSettings(indices ...string) *IndicesGetSettingsService {\n\treturn NewIndicesGetSettingsService(c).Index(indices...)\n}", "title": "" }, { "docid": "9900f4676f8ab9153537d44f9e76a7da", "score": "0.62939554", "text": "func (sd SettingsDatabase) GetSettingsByIndex(index string) (*Settings, error){\n\tresult, err := sd.db.GetItem(&dynamodb.GetItemInput{\n\t\tTableName: aws.String(sd.tableName),\n\t\tKey: map[string]*dynamodb.AttributeValue{\n\t\t\t\"id\": {\n\t\t\t\tS: aws.String(index),\n\t\t\t}},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsett := &Settings{}\n\terr = dynamodbattribute.UnmarshalMap(result.Item, &sett)\n\tif err != nil {\n\t\treturn nil,err\n\t}\n\tif sett.Id == \"\" {\n\t\treturn nil, errors.New(\"Couldn't find settings with provided primary key\")\n\t}\n\tif !sett.validate(){\n\t\treturn nil, errors.New(\"Acquired settings are not correct\")\n\t}\n\tsett.Unmarshal()\n\treturn sett, nil\n}", "title": "" }, { "docid": "a9fb1731a3a10abc3474c57df0a66464", "score": "0.6070071", "text": "func (idx *Index) Settings(settings Dict) *Index {\n\tidx.dict[SETTINGS] = settings\n\treturn idx\n}", "title": "" }, { "docid": "7f49105fd076bae598d3ebf947dc3fc4", "score": "0.5886656", "text": "func (t *IndexTemplate) AddIndexSettings(settings map[string]interface{}) *IndexTemplate {\n\tfor k, v := range settings {\n\t\tif m, ok := v.(map[string]interface{}); ok {\n\t\t\tif t.template.Settings[k] == nil {\n\t\t\t\tt.template.Settings[k] = make(map[string]interface{})\n\t\t\t}\n\t\t\tfor childK, childV := range m {\n\t\t\t\tt.template.Settings[k].(map[string]interface{})[childK] = childV\n\t\t\t}\n\t\t} else {\n\t\t\tt.template.Settings[k] = v\n\t\t}\n\t}\n\treturn t\n}", "title": "" }, { "docid": "707cd893e8321e1fd77aee61c5144c6e", "score": "0.5714584", "text": "func (c WgConfig) Index() revel.Result {\n\tdata, err := ioutil.ReadFile(path_wgconf)\n\tif err != nil {\n\t\tfmt.Println(\"File reading error\", err)\n\t\tpanic(err)\n\t}\n\twg0conf := string(data)\n\treturn c.Render(wg0conf)\n}", "title": "" }, { "docid": "8bde318e0d61efa1a387d76188153613", "score": "0.5534284", "text": "func SettingsHandler(rw http.ResponseWriter, req *http.Request) {\n\treq.ParseForm()\n\tform = req.Form\n\t//fmt.Println(form) //returns an array of strings\n\tIndexHandler(rw, req)\n}", "title": "" }, { "docid": "4f51715fb9391e6116baa3953327ff7c", "score": "0.55209494", "text": "func ReadSettings(w http.ResponseWriter, r *http.Request) {\n\tvar safesettings Vertigo\n\tsafesettings = *Settings\n\tsafesettings.CookieHash = \"\"\n\tswitch Root(r) {\n\tcase \"api\":\n\t\trender.R.JSON(w, 200, safesettings)\n\t\treturn\n\tcase \"user\":\n\t\trender.R.HTML(w, 200, \"settings\", safesettings)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "fc2eacd08c956efdc1da8a6451039124", "score": "0.54597676", "text": "func (c *Client) GetIndices(name string) (map[string]Index, error) {\n\turl := path.Join(c.URL, fmt.Sprintf(\"/%s/_settings\", name))\n\n\tstatusCode, body, err := doGet(url, c.HTTPAuth)\n\tif err != nil {\n\t\treturn nil, err\n\t} else if statusCode != http.StatusOK {\n\t\treturn nil, unexpectedError(url, statusCode)\n\t}\n\n\tresponse := make(map[string]Index)\n\terr = json.Unmarshal(body, &response)\n\n\treturn response, err\n}", "title": "" }, { "docid": "27d8190c1c82fe40e074b6aeb3ce07db", "score": "0.54387736", "text": "func (h *Handler) GetAllSettings() map[string]interface{} {\n\treturn h.vp.AllSettings()\n}", "title": "" }, { "docid": "2e2b4e0b547b8631a37d04ff5ccf1ec9", "score": "0.5436627", "text": "func (i *Index) SetSettings(settings interface{}) (interface{}, error) {\n\treturn i.client.transport.request(\"PUT\", \"/1/indexes/\"+i.nameEncoded+\"/settings\", settings, write)\n}", "title": "" }, { "docid": "6da4c6e9f255db517018993940c9ee48", "score": "0.53844786", "text": "func (f DebugFlags) Index(w http.ResponseWriter, r *http.Request) {\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\tif err := indexTmpl.Execute(w, registeredFlags); err != nil {\n\t\tklog.Error(err)\n\t}\n}", "title": "" }, { "docid": "12e3b1d47a461c556a1405789ac96aa1", "score": "0.52888745", "text": "func GetSettings(w http.ResponseWriter, r *http.Request) {\n\tif data, err := settings.GetSettings(); err != nil {\n\t\trest.HttpError(err, http.StatusInternalServerError).Write(&w)\n\t} else {\n\t\trest.Success(data).Write(&w)\n\t}\n\n}", "title": "" }, { "docid": "6d9f3b29fef3a569c6dd79f52aee58ab", "score": "0.52477306", "text": "func (f *DatatypeFlattened) IndexOptions(indexOptions string) *DatatypeFlattened {\n\tf.indexOptions = indexOptions\n\treturn f\n}", "title": "" }, { "docid": "b2c9463fccb756446f0b20e827b4fbc7", "score": "0.52266103", "text": "func CurrentSettings(c buffalo.Context) error {\n\treturn c.Render(http.StatusOK, render.JSON(settings.SerializableSettings()))\n}", "title": "" }, { "docid": "e8213424ddc89a8ed3fc3739f8834fa0", "score": "0.5200306", "text": "func (p *ServeConfig) View() ServeConfigView {\n\treturn ServeConfigView{ж: p}\n}", "title": "" }, { "docid": "b8ad964e043c6b5d440cdad967403629", "score": "0.5199728", "text": "func (this *Context) GetSettings(key string) interface{} {\n\treturn this.Settings[key]\n}", "title": "" }, { "docid": "390e184333147ce36378399bea452880", "score": "0.5189273", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\t// Display the view\n\tv := view.New(r)\n\tv.Name = \"index\"\n\tv.Render(w)\n}", "title": "" }, { "docid": "cd85b922399a27498280e4d18dfdb4bc", "score": "0.5188695", "text": "func NewIndexSettingsTimeSeriesBuilder() *IndexSettingsTimeSeriesBuilder {\n\tr := IndexSettingsTimeSeriesBuilder{\n\t\t&IndexSettingsTimeSeries{},\n\t}\n\n\treturn &r\n}", "title": "" }, { "docid": "d3203ea86d455970f5723d525cb5be15", "score": "0.517994", "text": "func (m *BatchQuery) Settings() cfg.Configuration {\n\treturn m.internDH.Settings\n}", "title": "" }, { "docid": "ddc6fc0353ebc85224cb0ea01124e9b0", "score": "0.5174985", "text": "func ViewReadConfig() View {\n\treturn viewInfo\n}", "title": "" }, { "docid": "e6dc73d58a1dc18021b3f183dff9a884", "score": "0.5134919", "text": "func GetIndex(w http.ResponseWriter, req *http.Request) {\n\tesVersion, err := Elastic.ElasticsearchVersion(\"http://127.0.0.1:9200\")\n\tif err != nil {\n\t\tesVersion = \"Unknown\"\n\t}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tvar result map[string]string\n\tresult = make(map[string]string)\n\tresult[\"Ammonitrix version\"] = build.Version\n\tresult[\"API version\"] = \"1\"\n\tresult[\"Elastic Search version\"] = esVersion\n\tb, _ := json.Marshal(result)\n\tfmt.Fprintln(w, string(b))\n}", "title": "" }, { "docid": "f043f1eabe17c006d26de42c2e0d039c", "score": "0.5106805", "text": "func (orchestrator *Orchestrator) getAnalyticsSettings() viewmodel.Analytics {\n\treturn viewmodel.Analytics{\n\t\tEnabled: orchestrator.config.Analytics.Enabled,\n\t\tGoogleAnalytics: viewmodel.GoogleAnalytics{\n\t\t\tEnabled: orchestrator.config.Analytics.GoogleAnalytics.Enabled,\n\t\t\tTrackingID: orchestrator.config.Analytics.GoogleAnalytics.TrackingID,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ec0fbd2ca85de1bbb09ed3ab223225ec", "score": "0.5104753", "text": "func (p *WebServerConfig) View() WebServerConfigView {\n\treturn WebServerConfigView{ж: p}\n}", "title": "" }, { "docid": "26b4fcf56d4bbd4f3a55ecf35e95a1bf", "score": "0.5101415", "text": "func (c App) Index() revel.Result {\n\ttab := \"index\"\n\treturn c.Render(tab)\n}", "title": "" }, { "docid": "42c4d6e79b27402f0b3a5882054b8b54", "score": "0.50927585", "text": "func (u *DBUser) GetViewableProjectSettings() ([]string, error) {\n\tif evergreen.PermissionsDisabledForTests() {\n\t\treturn nil, nil\n\t}\n\tenv := evergreen.GetEnvironment()\n\troleManager := env.RoleManager()\n\tctx, cancel := env.Context()\n\tdefer cancel()\n\n\tviewProjects, err := rolemanager.FindAllowedResources(ctx, roleManager, u.Roles(), evergreen.ProjectResourceType, evergreen.PermissionProjectSettings, evergreen.ProjectSettingsView.Value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn viewProjects, nil\n}", "title": "" }, { "docid": "4971c10cccb7736f0b94a45a740f03be", "score": "0.5040167", "text": "func (s *Service) Settings() *Settings {\n\treturn s.repo.Get()\n}", "title": "" }, { "docid": "10ddee6218f984bb31dcf002dc087b83", "score": "0.502466", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\t// Render.HTML(w, http.StatusOK, \"index\", map[string]string{})\n\tw.Header().Set(\"Content-type\", \"text/html;charset=utf-8\")\n\ttemplateForIndex.Execute(w, nil)\n}", "title": "" }, { "docid": "67002b343bbadc30fcd029e7e3e11927", "score": "0.5011812", "text": "func (v *version) Settings() SettingInformer {\n\treturn &settingInformer{factory: v.SharedInformerFactory}\n}", "title": "" }, { "docid": "bb9bfee73971df6f01dfbe73ac80ef8f", "score": "0.50111556", "text": "func (e Es) IndexViewMapping(indexName string, documentType string, propertyName string) (*IndexMappings, error) {\n\tbody, err := e.getJSON(fmt.Sprintf(\"/%s/_mapping\", indexName))\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = checkError(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Index %s failed: %s\", indexName, err.Error())\n\t}\n\n\tindexName = e.resolveAlias(indexName)\n\n\tbody = body[indexName].(map[string]interface{})\n\n\tif doc, ok := body[\"mappings\"]; ok {\n\t\tbody = doc.(map[string]interface{})\n\t}\n\n\tif documentType != \"\" {\n\t\tif doc, ok := body[documentType]; ok {\n\t\t\tbody = doc.(map[string]interface{})[\"properties\"].(map[string]interface{})\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"No '%s' document in mapping\", documentType)\n\t\t}\n\t}\n\tif propertyName != \"\" {\n\t\tif doc, ok := body[propertyName]; ok {\n\t\t\tbody = doc.(map[string]interface{})\n\t\t} else {\n\t\t\treturn nil, fmt.Errorf(\"No '%s' property in document '%s'\", propertyName, documentType)\n\t\t}\n\t}\n\tmappings := &IndexMappings{}\n\terr = utils.DictToAny(body, mappings)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn mappings, nil\n}", "title": "" }, { "docid": "de534a5dadf9367ee9af23333189eafa", "score": "0.49980664", "text": "func Index(env utils.Env, w http.ResponseWriter, r *http.Request) error {\n\tInfo(env, w, r)\n\treturn nil\n}", "title": "" }, { "docid": "fa5b71fe8e25d4a71c3d786fd9a47f02", "score": "0.49884674", "text": "func (v *Viper) AllSettings() map[string]any {\n\tv.m.Lock()\n\tdefer v.m.Unlock()\n\n\treturn v.live.AllSettings()\n}", "title": "" }, { "docid": "14ee9650df1c1eaab886afe3fd8ea308", "score": "0.49521056", "text": "func (c *Client) IndexPutSettings(indices ...string) *IndicesPutSettingsService {\n\treturn NewIndicesPutSettingsService(c).Index(indices...)\n}", "title": "" }, { "docid": "14ee9650df1c1eaab886afe3fd8ea308", "score": "0.49521056", "text": "func (c *Client) IndexPutSettings(indices ...string) *IndicesPutSettingsService {\n\treturn NewIndicesPutSettingsService(c).Index(indices...)\n}", "title": "" }, { "docid": "624369b5bd9ec7a97836119d5fe482e9", "score": "0.49313053", "text": "func (uis *UIServer) GetSettings() evergreen.Settings {\n\treturn uis.Settings\n}", "title": "" }, { "docid": "23793b5f48b7a8b609e9595df4a68c82", "score": "0.49296388", "text": "func (i indexParam) Index() bool {\n\tif v, ok := i.index.Bool(); ok {\n\t\treturn v\n\t}\n\treturn DefaultIndex\n}", "title": "" }, { "docid": "897b51230c10ecdca85b4a628594467d", "score": "0.49263337", "text": "func Settings(w http.ResponseWriter, r *http.Request) {\n\tif ctx.Get(r, \"user\") != nil {\n\t\tswitch {\n\t\tcase r.Method == \"GET\":\n\t\t\tparams := struct {\n\t\t\t\tUser models.User\n\t\t\t\tTitle string\n\t\t\t\tFlashes []interface{}\n\t\t\t\tToken string\n\t\t\t\tVersion string\n\t\t\t}{Title: \"Settings\", Version: config.Version, User: ctx.Get(r, \"user\").(models.User), Token: csrf.Token(r)}\n\t\t\tgetTemplate(w, \"settings\").ExecuteTemplate(w, \"base\", params)\n\t\tcase r.Method == \"POST\":\n\t\t\terr := auth.ChangePassword(r)\n\t\t\tmsg := models.Response{Success: true, Message: \"Settings Updated Successfully\"}\n\t\t\tif err == auth.ErrInvalidPassword {\n\t\t\t\tmsg.Message = \"Invalid Password\"\n\t\t\t\tmsg.Success = false\n\t\t\t\tJSONResponse(w, msg, http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tmsg.Message = err.Error()\n\t\t\t\tmsg.Success = false\n\t\t\t\tJSONResponse(w, msg, http.StatusBadRequest)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tJSONResponse(w, msg, http.StatusOK)\n\t\t}\n\t} else {\n\t\tRestrictedUserSettings(w, r)\n\t}\n}", "title": "" }, { "docid": "a834f3a987d9dc55b125ec1448f20de6", "score": "0.49071467", "text": "func GetSettings() *Settings {\n\treturn settings\n}", "title": "" }, { "docid": "a834f3a987d9dc55b125ec1448f20de6", "score": "0.49071467", "text": "func GetSettings() *Settings {\n\treturn settings\n}", "title": "" }, { "docid": "bd26d4c379e62ecb870767e5ec5e2ba0", "score": "0.4897993", "text": "func (o *Option) GetIndex() bool {\n\treturn o.index\n}", "title": "" }, { "docid": "488e150a40c6804be7e23fa8e1596982", "score": "0.4890375", "text": "func (c App) Index() revel.Result {\n\treturn c.Render()\n}", "title": "" }, { "docid": "488e150a40c6804be7e23fa8e1596982", "score": "0.4890375", "text": "func (c App) Index() revel.Result {\n\treturn c.Render()\n}", "title": "" }, { "docid": "e8907aae61ef0a492b0cb703fb3d0d46", "score": "0.48795316", "text": "func (app App) GetIndex(w http.ResponseWriter, req *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"text/html\")\n\tw.Write([]byte(indexHTML))\n}", "title": "" }, { "docid": "d8b9dc72a6a7632ebfabc37734291805", "score": "0.48762006", "text": "func (h *Host) Settings() modules.HostSettings {\n\th.mu.RLock()\n\tdefer h.mu.RUnlock()\n\treturn h.settings\n}", "title": "" }, { "docid": "2ee2e8c01f44101ff7b78a9dd909e2c8", "score": "0.48725796", "text": "func Views() map[string]string {\n\treturn map[string]string{\n\t\t\"default\": \"form.prefs.select.view_default\",\n\t\t\"list\": \"form.prefs.select.view_list\",\n\t\t\"masonry\": \"form.prefs.select.view_masonry\",\n\t}\n}", "title": "" }, { "docid": "2e2c54e2c5f4b4f34479140d1912f25a", "score": "0.48703852", "text": "func (BaseUIPage) ReadSettings(c context.Context) (map[string]string, error) {\n\treturn nil, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "3e3a15e04ef4ccea87e22b639637e3b6", "score": "0.4853689", "text": "func (s *Show) showIndices() {\n\t// most of this functionaity will have to wait on PR 209 in the elastigo\n\t// project to be merged.\n\tresult := utils.ESConn(s.config.Endpoint).GetCatIndexInfo(\"\")\n\n\tw := utils.NewTabWriter()\n\n\tfmt.Fprintf(w, \"\\nHealth\\tStatus\\tName\\tShards\\tReplicas\\tDocuments\\tSize\")\n\tfmt.Fprintf(w, \"\\n----------\\t----------\\t----------\\t----------\\t----------\\t----------\\t----------\\n\")\n\n\tfor _, i := range result {\n\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%d\\t%d\\t%d\\t%d\\n\",\n\t\t\ti.Health, i.Status, i.Name, i.Shards, i.Replicas, i.Docs.Deleted, i.Store.Size)\n\t}\n\n\tfmt.Fprintf(w, \"\\n\")\n\tw.Flush()\n}", "title": "" }, { "docid": "6e80b5300f2c8dbedb63515d4787875b", "score": "0.48522192", "text": "func (s *NotificationSettingsService) GetSettingsForProject(pid interface{}, options ...RequestOptionFunc) (*NotificationSettings, *Response, error) {\n\tproject, err := parseID(pid)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tu := fmt.Sprintf(\"projects/%s/notification_settings\", PathEscape(project))\n\n\treq, err := s.client.NewRequest(http.MethodGet, u, nil, options)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tns := new(NotificationSettings)\n\tresp, err := s.client.Do(req, ns)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn ns, resp, nil\n}", "title": "" }, { "docid": "bc3b2573742fa974044c45cd49b3ff31", "score": "0.48425907", "text": "func (terkc *TerraKeysController) Index(c *gin.Context) {\n\tkeys, err := terkc.App.GetKeyStore().Terra().GetAll()\n\tif err != nil {\n\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tjsonAPIResponse(c, presenters.NewTerraKeyResources(keys), \"terraKey\")\n}", "title": "" }, { "docid": "2bdf741447efd511796ab1985cc7ae18", "score": "0.4840491", "text": "func (s *Service) GetSettings() (Settings, error) {\n\tbody, err := s.getSettingsResponseBody()\n\n\treturn body.Data, err\n}", "title": "" }, { "docid": "60cd328ae9bcede143a256d74a201ade", "score": "0.48390454", "text": "func (controller *TrackController) Index() {\n\tlog.Println(\"Index Start\")\n\n\tcontroller.Layout = \"layout.html\"\n\tcontroller.TplName = \"content.html\"\n\tcontroller.LayoutSections = map[string]string{}\n\tcontroller.LayoutSections[\"PageHead\"] = \"head.html\"\n\n\tlog.Println(\"Index Finish\")\n}", "title": "" }, { "docid": "7f203cf7cbe42049cceb617323acaa71", "score": "0.48384938", "text": "func index(w http.ResponseWriter, r *http.Request) {\n\ttpl := template.Must(template.ParseFiles(\"./views/index.gohtml\"))\n\ttpl.Execute(w, \"Vilda\")\n}", "title": "" }, { "docid": "3369edcfc6a34d12ff7595a6416950be", "score": "0.4838271", "text": "func (m *AccessReviewScheduleDefinition) GetSettings()(AccessReviewScheduleSettingsable) {\n return m.settings\n}", "title": "" }, { "docid": "9d0c50bd6289f1d1f5247355158f0c25", "score": "0.48271248", "text": "func PgShowAllSettings(db XODB) ([]pgtypes.Record, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.pg_show_all_settings()`\n\n\t// run query\n\tvar ret []pgtypes.Record\n\tXOLog(sqlstr)\n\terr = db.QueryRow(sqlstr).Scan(&ret)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "9e2f8fcb16d1782ea5d46a8e7dcc36a3", "score": "0.4819911", "text": "func IndexGET(w http.ResponseWriter, r *http.Request) {\n\t// Display the view\n\tv := view.New(r)\n\tv.Name = \"index/anon\"\n\tv.Render(w)\n\treturn\n}", "title": "" }, { "docid": "44587a493a7c4dca360989cc98fef388", "score": "0.48187637", "text": "func (c StatsController) Index() revel.Result {\n\tif !c.GetCurrentUser() {\n\t\treturn c.ForbiddenResponse()\n\t}\n\n\tvar stats models.Stats\n\n\tif Stats, ok := app.Mapper.GetModel(&stats); ok {\n\t\tif err := Stats.FindBy(\"owner\", c.CurrentUser.GetID()).Exec(&stats); err != nil {\n\t\t\treturn c.ErrorResponse(err, err.Error(), 200)\n\t\t}\n\n\t\treturn c.SuccessResponse(stats, \"ok\", 200, serializers.StatsSerializer{})\n\t}\n\n\treturn c.ServerErrorResponse()\n}", "title": "" }, { "docid": "bdfa96bc6bf137dc4d89629baad0f2f0", "score": "0.4818029", "text": "func getSettings(logType string, startDate string, maxLines string) []Setting {\n\tvar settings []Setting\n\tsettings = append(settings, Setting{\n\t\tId: \"LogType\", Name: \"Log Type\", Type: \"text\",\n\t\tValue: logType, Description: \"Either SIMMON or REPORTER\",\n\t\tValidator: func(newValue string, fields *ValidatedFormFields) error {\n\t\t\tswitch newValue {\n\t\t\tcase \"SIMMON\":\n\t\t\t\tfields.LogFilePath = config.Get().SimmonLogFilePath\n\t\t\tcase \"REPORTER\":\n\t\t\t\tfields.LogFilePath = config.Get().ReporterLogFilePath\n\t\t\tdefault:\n\t\t\t\treturn errors.New(\"Only SIMMON or REPORTER allowed\")\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t})\n\tsettings = append(settings, Setting{\n\t\tId: \"StartDate\", Name: \"Start Date-Time\", Type: \"text\",\n\t\tValue: startDate, Description: \"Show records from this date/time on\",\n\t\tValidator: func(newValue string, fields *ValidatedFormFields) error {\n\t\t\t// This string can be any prefix, not just a date string. However if it is a \n\t\t\t// datestring, then the date comparison will be performed, else just a string match.\n\t\t\tfields.StartDate = newValue\n\t\t\treturn nil\n\t\t},\n\t})\n\tsettings = append(settings, Setting{\n\t\tId: \"MaxLines\", Name: \"Max Line Count\", Type: \"number\",\n\t\tValue: maxLines, Description: \"Maximum number of lines to show (0 means show all lines)\",\n\t\tValidator: func(newValue string, fields *ValidatedFormFields) error {\n\t\t\tmaxLines, err := strconv.Atoi(newValue)\n\t\t\tif err != nil {\n\t\t\t\tif maxLines < 0 || maxLines > 1000 {\n\t\t\t\t\terr = errors.New(\"out of range (0,1000)\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfields.MaxLines = maxLines\n\t\t\treturn err\n\t\t},\n\t})\n\treturn settings\n}", "title": "" }, { "docid": "e9609f855a63dba920e1613992120048", "score": "0.4815855", "text": "func (editor *Editor) Settings() *Settings {\n\treturn &editor.settings\n}", "title": "" }, { "docid": "121b242a8aef5a3abf855e969f95434f", "score": "0.48036197", "text": "func (c *UserClient) QuerySettings(u *User) *UserSettingsQuery {\n\tquery := &UserSettingsQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := u.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(user.Table, user.FieldID, id),\n\t\t\tsqlgraph.To(usersettings.Table, usersettings.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.O2O, false, user.SettingsTable, user.SettingsColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(u.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "f476da507b5aed3a44bf21c5ab38dd13", "score": "0.47979143", "text": "func GetSettings(viper *viper.Viper) *Settings {\n\treturn &Settings{\n\t\tLogger: FromViperLoggerSettings(viper),\n\t\tTasks: FromViperTasksSettings(viper),\n\t\tScheduler: FromViperSchedulerSettings(viper),\n\t\tStats: FromViperStatsSettings(viper),\n\t\tEndpoints: FromViperEndpointsSettings(viper),\n\t}\n}", "title": "" }, { "docid": "1e56afe1226afb455c0e883bd1cb94bc", "score": "0.47973207", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\tvar index = template.Must(template.ParseFiles(\n\t\t\"views/index.html\",\n\t))\n\tindex.Execute(w, nil)\n}", "title": "" }, { "docid": "d9e8fc7781248ed67b621070dbcb7ca2", "score": "0.4796062", "text": "func index(w http.ResponseWriter, r *http.Request) {\n\tif r.URL.Path == \"/\" || r.URL.Path == \"/index\" {\n\t\tpg.Readings = getMetricDefs()\n\t\ttmpl.ExecuteTemplate(w, \"kubismus\", pg)\n\t} else {\n\t\thttp.NotFound(w, r)\n\t}\n}", "title": "" }, { "docid": "3a6ab522cbe5a9d649ed3d579aff569d", "score": "0.47914946", "text": "func (a *app) Settings() SettingsService {\n\treturn a.SettingsService\n}", "title": "" }, { "docid": "73d5f6caf3f1548dcb8e6c2be981ac19", "score": "0.47905082", "text": "func (m *Model) Indexes() map[string]Index {\n\treturn m.indexes\n}", "title": "" }, { "docid": "3da0254f7697b5cce5d74fb25a61f208", "score": "0.4778576", "text": "func (vrfkc *VRFKeysController) Index(c *gin.Context) {\n\tkeys, err := vrfkc.App.GetKeyStore().VRF().GetAll()\n\tif err != nil {\n\t\tjsonAPIError(c, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tjsonAPIResponse(c, presenters.NewVRFKeyResources(keys), \"vrfKey\")\n}", "title": "" }, { "docid": "bb32ab74d8dab4532e7fa82ff948a45c", "score": "0.4775947", "text": "func (ms modelSpec) indexKey() string {\n\treturn ms.modelName + \":all\"\n}", "title": "" }, { "docid": "bf892fc7cee5e41b67e4ad3769e81257", "score": "0.47732732", "text": "func (sc *SettingsController) GetSettingsByClientID(si usecase.SettingsInteractor) func(*gin.Context) {\n\treturn func(c *gin.Context) {\n\t\tclientID := c.Param(\"clientID\")\n\t\tsettings, err := si.GetSettingsByClientID(clientID)\n\n\t\tif err != nil {\n\t\t\tc.JSON(http.StatusNoContent, gin.H{\n\t\t\t\t\"error\": \"Unable to get settings by clientID\",\n\t\t\t\t\"internalMessage\": err.Error(),\n\t\t\t})\n\t\t\treturn\n\t\t}\n\n\t\tc.JSON(http.StatusOK, gin.H{\n\t\t\t\"status\": \"ok\",\n\t\t\t\"settings\": settings,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "862aabdf2c480a9a1418f93f46ae8277", "score": "0.47708184", "text": "func GolferSettings(w http.ResponseWriter, r *http.Request) {\n\tdata := struct {\n\t\tCountries map[string][]*country.Country\n\t\tKeymaps []string\n\t\tTimeZones []zone.Zone\n\t}{country.Tree, []string{\"default\", \"vim\"}, zone.List()}\n\n\trender(w, r, \"golfer/settings\", data, \"Settings\")\n}", "title": "" }, { "docid": "e52873d085d164a47ebe8c4a2ff768a8", "score": "0.47705707", "text": "func Get() *Settings {\n\treturn settings\n}", "title": "" }, { "docid": "883f548f0c5285ae8e8eb13f31bac171", "score": "0.47612137", "text": "func (p *ticketVotePlugin) Settings() []backend.PluginSetting {\n\tlog.Tracef(\"ticketvote Settings\")\n\n\treturn []backend.PluginSetting{\n\t\t{\n\t\t\tKey: ticketvote.SettingKeyLinkByPeriodMin,\n\t\t\tValue: strconv.FormatInt(p.linkByPeriodMin, 10),\n\t\t},\n\t\t{\n\t\t\tKey: ticketvote.SettingKeyLinkByPeriodMax,\n\t\t\tValue: strconv.FormatInt(p.linkByPeriodMax, 10),\n\t\t},\n\t\t{\n\t\t\tKey: ticketvote.SettingKeyVoteDurationMin,\n\t\t\tValue: strconv.FormatUint(uint64(p.voteDurationMin), 10),\n\t\t},\n\t\t{\n\t\t\tKey: ticketvote.SettingKeyVoteDurationMax,\n\t\t\tValue: strconv.FormatUint(uint64(p.voteDurationMax), 10),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "fd98f2166b100788a7cc7f885850dbd6", "score": "0.47574297", "text": "func (s *aviInfraSettingLister) List(selector labels.Selector) (ret []*v1alpha1.AviInfraSetting, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.AviInfraSetting))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "95fa57d77ddb877d4fba50b1ce7de3ab", "score": "0.47524762", "text": "func (s *Session) HostSettings() modules.HostExternalSettings {\n\treturn s.host.HostExternalSettings\n}", "title": "" }, { "docid": "1bdd14b8f2ed3739717afa255bfecf6b", "score": "0.47487488", "text": "func (req MaxRequest) Index(index interface{}) MaxRequest {\n\treq.index = index\n\treturn req\n}", "title": "" }, { "docid": "f0d0120bab2c6540047b63148f6257e4", "score": "0.47364515", "text": "func (modules Modules) Index() map[string]Module {\n\tnamed := make(map[string]Module)\n\tfor _, module := range modules {\n\t\tnamed[module.Name] = module\n\t}\n\treturn named\n}", "title": "" }, { "docid": "e01616a0278f9c0bb43474707c4cbddd", "score": "0.47303757", "text": "func indexHandler(w http.ResponseWriter, r *http.Request) {\n\t//path for index view\n\tindexView := \"views/index.html\";\n\t//index.html is parsed as a template file\n\tt, _ := template.ParseFiles(indexView);\n\t//nil because there is no data to pass to template file\n\tt.Execute(w, nil);\n}", "title": "" }, { "docid": "7cbba702fe854fb170e63b28617379b6", "score": "0.47273114", "text": "func (m *EntitlementManagementRequestBuilder) Settings()(*i441d3614c41d6a7eafb923dbc4975591570abe0ca8005d661c628e49592a07f8.SettingsRequestBuilder) {\n return i441d3614c41d6a7eafb923dbc4975591570abe0ca8005d661c628e49592a07f8.NewSettingsRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "b4802dc84a77d38a0cb759d622d5cf92", "score": "0.4726065", "text": "func (t *Controller) Index(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tdata, err := t.dataProvider.GetResults()\n\tif err != nil {\n\t\tlog.Printf(\"Failed to retrieve results: %s\", err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tfmt.Fprintf(w, `{\"status\": 500, \"message\": \"Failed to retrieve data\"}`)\n\t\treturn\n\t}\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n}", "title": "" }, { "docid": "38b00d4d8bbff3cc430bfe42d056089e", "score": "0.47217354", "text": "func (s *Settings) GetAll() ([]Settings, error) {\n\tvar rows []Settings\n\tresult := _db.Model(&s).Select(\"*\").Scan(&rows)\n\treturn rows, result.Error\n}", "title": "" }, { "docid": "fedddd45a21c7adaf4cc8207f1843a70", "score": "0.47115022", "text": "func Index(c *gin.Context) {\n\tctx := c.GetStringMap(\"context\")\n\tc.HTML(http.StatusOK, \"index.gohtml\", ctx)\n}", "title": "" }, { "docid": "f0c6321980dfe50e9f2659de402e6278", "score": "0.47113827", "text": "func index(w http.ResponseWriter, r *http.Request) {\n\tvd := ViewData{\n\t\tEnvVariable1: TEST_VAR_ENV42069,\n\t\tMongoURI: MONGO_URI,\n\t\tNumOClicks: howManyTimesClicked().ClickNums,\n\t}\n\tfmt.Printf(\"DEBUG: Here is how many times we clicked: %v\\n\", vd.NumOClicks)\n\t/* Execute template, handle error */\n\terr1 := template1.ExecuteTemplate(w, \"index.gohtml\", vd)\n\tHandleError(w, err1)\n}", "title": "" }, { "docid": "d0103f1f0beec4cbb28b57ce26dcb19e", "score": "0.47074142", "text": "func (eb ElasticBuf) Index() int {\n\treturn eb.property.index()\n}", "title": "" }, { "docid": "e241524e58b28c92d9a68da0f9c8da9e", "score": "0.47029555", "text": "func ViewConfigure(vi View) {\n\tviewInfo = vi\n}", "title": "" }, { "docid": "3cd5d164b307814a345feb492a5617ab", "score": "0.46892706", "text": "func index(c *gin.Context) {\n\tc.HTML(http.StatusOK, \"index\", gin.H{\n\t\t\"home\": \"active\",\n\t})\n}", "title": "" }, { "docid": "f6e4ef891ae7d3da343e9eb08f4a0d3b", "score": "0.4685297", "text": "func (c *controller) UIIndex(at struct{ at.GetMapping `value:\"/ui\"`; at.FileServer `value:\"/ui\"` }, ctx context.Context) {\n\treturn\n}", "title": "" }, { "docid": "2457be17675feeb9a41cce83990dc498", "score": "0.46824995", "text": "func Index(c *fiber.Ctx) {\n\t_ = c.Render(\"index\", fiber.Map{})\n}", "title": "" }, { "docid": "1bf11158aad6403268b9d44f0792298e", "score": "0.46750697", "text": "func index(w http.ResponseWriter, r *http.Request) {\n\tif err := homeView.Template.ExecuteTemplate(w, homeView.Layout, nil); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "cf3a18b68a76f7550eeeba001477f180", "score": "0.46714208", "text": "func index(w http.ResponseWriter, r *http.Request) {\r\n\r\n\t// Context of this request\r\n\tc := appengine.NewContext(r)\r\n\t\r\n\t// Execute index template\r\n\tif err := templates.ExecuteTemplate(w, \"index\", nil); err != nil {\r\n\t\t// execute error is occured\r\n\t\tc.Errorf(\"%v\", err)\r\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\r\n\t\treturn\r\n\t}\r\n}", "title": "" }, { "docid": "5afe67f665efb0d1609e791fc43673a0", "score": "0.4668831", "text": "func AllDaySettingsEndPoint(w http.ResponseWriter, r *http.Request) {\n\tdaysettings, err := dao.FindDay()\n\tif err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusOK, daysettings)\n}", "title": "" }, { "docid": "cafe3bb1fa28d47e2d9aa3fa3e85e749", "score": "0.46646908", "text": "func (pc *PostController) GetIndex(w http.ResponseWriter, req *http.Request) {\n\tq := &PostQuery{\n\t\tStart: 1,\n\t\tResults: 5,\n\t}\n\tposts := pc.repository.Fetch(q)\n\tqp := q.Previous()\n\tqp.Results = 1\n\tprevPosts := pc.repository.Fetch(qp)\n\tpc.viewSet.PostListView(posts, nil, prevPosts, q).Render(w)\n}", "title": "" }, { "docid": "ba06fc29142139754071d776a463a9bf", "score": "0.4662451", "text": "func (s *Server) ClusterSettings() *cluster.Settings {\n\treturn s.st\n}", "title": "" }, { "docid": "f56cc18190b6fefbac119d5a41bb5fd6", "score": "0.4658296", "text": "func (bot *Bot) Settings() *model.Workspace {\n\treturn bot.workspace\n}", "title": "" }, { "docid": "d62d703506fd9313ca2ae727b15ba8f3", "score": "0.4653888", "text": "func (c *Config) BuildIndex() {\n\tclsMap := make(map[string]*Cluster)\n\tinsMap := make(map[string]*Instance)\n\tipMap := make(map[string]*Instance)\n\n\t// if meta node occurs on other pgsql group, it's vars will be overwritten\n\tfor i, cls := range c.Clusters {\n\t\tif cls.Name == GROUP_META {\n\t\t\tc.MetaCluster = &(c.Clusters[i])\n\t\t\tcontinue\n\t\t}\n\t\tclsMap[cls.Name] = &(c.Clusters[i])\n\t\tfor j, ins := range cls.Instances {\n\t\t\tinsMap[ins.Name] = &(cls.Instances[j])\n\t\t\tipMap[ins.IP] = &(cls.Instances[j])\n\t\t}\n\t}\n\n\tc.ClusterMap = clsMap\n\tc.InstanceMap = insMap\n\tc.IpMap = ipMap\n}", "title": "" }, { "docid": "b5910ca5bde2f3f388a66595d2eeac8c", "score": "0.4652241", "text": "func GetIndex(w http.ResponseWriter, r *http.Request) {\n\tvar location string\n\tlocation = getQueryKey(r, \"location\", \"Barcelona\")\n\tdata, err := ioutil.ReadFile(\"templates/indexV1.html\")\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tw.Header().Set(\"Cache-Control\", \"max-age=86400, public\")\n\tfmt.Fprint(w, strings.Replace(string(data), \"#LOCATION#\", location, -1))\n\treturn\n}", "title": "" }, { "docid": "14e16289de1559425677060e059c67fd", "score": "0.46515638", "text": "func (s *UserSettings) GetSettings() map[string]bool {\n\treturn s.Settings\n}", "title": "" }, { "docid": "87b255dee2e17c10d0d2fdca23d1436a", "score": "0.46513474", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\ttemplates.RenderTemplate(w, \"index.html\", nil)\n}", "title": "" }, { "docid": "593ddb992d8111154290ea9a3c91afcf", "score": "0.464184", "text": "func index(res http.ResponseWriter, req *http.Request) {\n\n\ttpl.ExecuteTemplate(res, \"index.html\", false)\n}", "title": "" }, { "docid": "e6c62beb588dbfb0a61040cf28b06e9d", "score": "0.46417758", "text": "func (s *Server) handleSettings(w http.ResponseWriter, r *http.Request) {\n\tvar tmpl html.SettingsTemplate\n\ttmpl.Render(r.Context(), w)\n}", "title": "" }, { "docid": "1d32b24ebc990dda91d02a1ce3dc0212", "score": "0.46402606", "text": "func (c FieldsCollection) IndexContent() *models.Field {\n\treturn c.MustGet(\"IndexContent\")\n}", "title": "" }, { "docid": "1893ab8199f5a62322fcd873155c1e87", "score": "0.46341458", "text": "func Index(w http.ResponseWriter, r *http.Request) {\n\t\n\t// (View the file: `tmpl/Index`\n\ttmpl.ExecuteTemplate(w, \"Index\", nil)\n\n}", "title": "" } ]
96ed6da014d371c4d38454e75408ea57
Listen for Pods. We're only interested in MODIFIED and DELETED events.
[ { "docid": "f39a5b58a192a4c08e78433bbaca4dba", "score": "0.63432884", "text": "func listen(wsConn *websocket.Conn, wsErrors chan string) {\n\tlog.Println(\"Listening for pods\")\n\n\tfor {\n\t\t_, r, err := wsConn.NextReader()\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error getting reader: %v\",err)\n\t\t\twsErrors <- \"Error\"\n\t\t\treturn\n\t\t}\n\n\n\t\tdec := json.NewDecoder(r)\n\t\tvar objmap map[string]*json.RawMessage\n\t\tdec.Decode(&objmap)\n\n\t\tvar actionType string\n\t\tjson.Unmarshal(*objmap[\"type\"], &actionType)\n\n\t\tvar pod api.Pod\n\t\terr = json.Unmarshal(*objmap[\"object\"], &pod)\n\n\t\tswitch actionType {\n\t\tcase \"MODIFIED\":\n\t\t\tregister(pod)\n\t\tcase \"DELETED\":\n\t\t\tdeletePod(pod)\n\t\t}\n\t}\n}", "title": "" } ]
[ { "docid": "4b4a4f710d40bdf05df31a34741bb905", "score": "0.6468875", "text": "func (h *handler) OnAdd(obj interface{}) {\n\tpod, ok := obj.(*v1.Pod)\n\tif !ok {\n\t\treturn\n\t}\n\th.watcher.OnAdd(h.convertPodToEndpoints(pod))\n}", "title": "" }, { "docid": "1b496713e4e8e9abf54bc0f3a96a966c", "score": "0.61196244", "text": "func listenForPods() {\n\n\twsConn := openConnection()\n\n\tvar wsErrors chan string = make(chan string)\n\tgo listen(wsConn, wsErrors)\n\tgo reconnector(wsErrors)\n\tselect {}\n\n}", "title": "" }, { "docid": "b681ab5892c9403111a2b4309770077b", "score": "0.6086927", "text": "func (p *PodHandler) OnAdd(obj interface{}) {\n\tpod, ok := obj.(*v1.Pod)\n\tif !ok {\n\t\tlog.Errorf(\"Expected Pod but OnAdd handler received %+v\", obj)\n\t\treturn\n\t}\n\n\t//TODO JRN: Should we be filtering this by the `isPodActive` to reduce chatter and confusion about\n\t// what is actually being indexed by the indexer? This gets a little tricky with the OnUpdate piece\n\t// of cronjobs that stick around in Completed/Succeeded status\n\tlogger := log.WithFields(p.podFields(pod))\n\tlogger.Debug(\"Pod OnAdd\")\n}", "title": "" }, { "docid": "aa9193d8cce7c110f63190f6c57ca26b", "score": "0.59688026", "text": "func (p *PodLogs) Watch() {\n\n\tgo p.PodTicker()\n\tgo p.sender.Ticker()\n\n\t// ignored := ignoredPods(p.Ignored)\n\n\tw, err := p.Client.CoreV1().Pods(p.Namespace).Watch(metav1.ListOptions{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tch := w.ResultChan()\n\n\tfor {\n\t\tevent := <-ch\n\t\te := marshalEvent(event)\n\t\tname := e.Name()\n\n\t\tlog.Warn(\"New event received: \", event.Type)\n\t\tswitch event.Type {\n\t\tcase \"MODIFIED\":\n\t\t\tch := make(chan bool, 1)\n\t\t\tif podCh, ok := p.Channels[name]; !ok && e.State() == \"Running\" {\n\t\t\t\tp.Add(name, ch)\n\t\t\t\tgo p.Run(name, ch, \"\")\n\t\t\t} else if ok && e.State() != \"Running\" {\n\t\t\t\tp.Stop(podCh)\n\t\t\t}\n\t\tcase \"ADDED\":\n\t\t\tch := make(chan bool, 1)\n\t\t\tif _, ok := p.Channels[name]; !ok && e.State() == \"Running\" {\n\t\t\t\tp.Add(name, ch)\n\t\t\t\tgo p.Run(name, ch, \"\")\n\t\t\t}\n\t\tcase \"DELETED\":\n\t\t\tif ch, ok := p.Channels[name]; ok {\n\t\t\t\tp.Del(name)\n\t\t\t\tch <- true\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "563e1a7cc801128fa98e7e860b690e55", "score": "0.5846316", "text": "func (h *handler) OnUpdate(oldObj, newObj interface{}) {\n\toldPod, ok := oldObj.(*v1.Pod)\n\tif !ok {\n\t\treturn\n\t}\n\tnewPod, ok := newObj.(*v1.Pod)\n\tif !ok {\n\t\treturn\n\t}\n\n\toldEndpoints := map[observer.EndpointID]observer.Endpoint{}\n\tnewEndpoints := map[observer.EndpointID]observer.Endpoint{}\n\n\t// Convert pods to endpoints and map by ID for easier lookup.\n\tfor _, e := range h.convertPodToEndpoints(oldPod) {\n\t\toldEndpoints[e.ID] = e\n\t}\n\tfor _, e := range h.convertPodToEndpoints(newPod) {\n\t\tnewEndpoints[e.ID] = e\n\t}\n\n\tvar removedEndpoints, updatedEndpoints, addedEndpoints []observer.Endpoint\n\n\t// Find endpoints that are present in oldPod and newPod and see if they've\n\t// changed. Otherwise if it wasn't in oldPod it's a new endpoint.\n\tfor _, e := range newEndpoints {\n\t\tif existing, ok := oldEndpoints[e.ID]; ok {\n\t\t\tif !reflect.DeepEqual(existing, e) {\n\t\t\t\tupdatedEndpoints = append(updatedEndpoints, e)\n\t\t\t}\n\t\t} else {\n\t\t\taddedEndpoints = append(addedEndpoints, e)\n\t\t}\n\t}\n\n\t// If an endpoint is present in the oldPod but not in the newPod then\n\t// send as removed.\n\tfor _, e := range oldEndpoints {\n\t\tif _, ok := newEndpoints[e.ID]; !ok {\n\t\t\tremovedEndpoints = append(removedEndpoints, e)\n\t\t}\n\t}\n\n\tif len(removedEndpoints) > 0 {\n\t\th.watcher.OnRemove(removedEndpoints)\n\t}\n\n\tif len(updatedEndpoints) > 0 {\n\t\th.watcher.OnChange(updatedEndpoints)\n\t}\n\n\tif len(addedEndpoints) > 0 {\n\t\th.watcher.OnAdd(addedEndpoints)\n\t}\n\n\t// TODO: can changes be missed where a pod is deleted but we don't\n\t// send remove notifications for some of its endpoints? If not provable\n\t// then maybe keep track of pod -> endpoint association to be sure\n\t// they are all cleaned up.\n}", "title": "" }, { "docid": "4b6bc0d7455bcb7805626ceffbe9e3c4", "score": "0.5777839", "text": "func (k *K8s) podEvents(clientset *kubernetes.Clientset, namespace string, jobname string) error {\n\twatch, err := clientset.CoreV1().Pods(namespace).Watch(metav1.ListOptions{\n\t\tLabelSelector: \"job-name=\" + jobname,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar logError error\n\tgo func(logError error) {\n\t\tfor event := range watch.ResultChan() {\n\t\t\tpod, ok := event.Object.(*apiv1.Pod)\n\t\t\tif !ok {\n\t\t\t\tlog.Fatal(\"unexpected type\")\n\t\t\t}\n\t\t\tif pod.Status.Phase == \"Succeeded\" {\n\t\t\t\tpodExecuted.L.Lock()\n\t\t\t\tk.result, err = podLogs(*pod, clientset, namespace)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogError = err\n\t\t\t\t}\n\t\t\t\tk.isLogReady++\n\t\t\t\tpodExecuted.Signal()\n\t\t\t\tpodExecuted.L.Unlock()\n\t\t\t}\n\t\t\t/* \t\t\tif pod.Status.Phase == apiv1.PodFailed {\n\t\t\t\tlogError = err\n\t\t\t} */\n\t\t}\n\t}(logError)\n\tif logError != nil {\n\t\treturn logError\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1514997465d7380a1e85a0f6315924d0", "score": "0.57652724", "text": "func (c *Client) WatchPods(ctx context.Context, namespace string) (<-chan *PodEvent, error) {\n\tr, err := c.clientset.CoreV1().Pods(namespace).Watch(metav1.ListOptions{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tch := make(chan *PodEvent)\n\tgo func() {\n\t\t<-ctx.Done()\n\t\tr.Stop()\n\t}()\n\tgo func() {\n\t\tfor ev := range r.ResultChan() {\n\t\t\tpod, ok := ev.Object.(*corev1.Pod)\n\t\t\tif !ok {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tvar t PodEventType\n\t\t\tswitch ev.Type {\n\t\t\tcase watch.Added:\n\t\t\t\tt = PodAdded\n\t\t\tcase watch.Modified:\n\t\t\t\tt = PodModified\n\t\t\tcase watch.Deleted:\n\t\t\t\tt = PodDeleted\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tch <- &PodEvent{\n\t\t\t\tType: t,\n\t\t\t\tPod: pod,\n\t\t\t}\n\t\t}\n\t\tclose(ch)\n\t}()\n\treturn ch, nil\n}", "title": "" }, { "docid": "b609f5f0c74c10ffdf5d7b98bed804bc", "score": "0.57248056", "text": "func registerK8sPodChangeEventHandler(c chan UpdateOp, addEvHandler func(object v12.Pod), updateEvHandler func(object v12.Pod), deleteEvHandler func(object v12.Pod)) {\n\tfor pod := range c {\n\t\tlog.Printf(\"main.registerK8sPodChangeEventHandler <- recieved OPTYPE %s for Pod: %s\", pod.OpType, pod.Pod.GetName())\n\t\tswitch pod.OpType {\n\t\tcase \"add\":\n\t\t\taddEvHandler(*pod.Pod)\n\t\tcase \"update\":\n\t\t\tupdateEvHandler(*pod.Pod)\n\t\tcase \"delete\":\n\t\t\tdeleteEvHandler(*pod.Pod)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "0e33502c9d5acf28e8f0ec4bc469f6c8", "score": "0.5662333", "text": "func (c *Cluster) handlePodEvents(events <-chan watch.Event, wg *sync.WaitGroup) {\n\tfor {\n\t\tevent, ok := <-events\n\t\tif !ok {\n\t\t\twg.Done()\n\t\t\treturn\n\t\t}\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"cluster\": c.config.Name,\n\t\t\t\"obj\": event.Object,\n\t\t}).Debug(\"Pod event handler tick\")\n\t\tif event.Type == watch.Error {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"cluster\": c.config.Name,\n\t\t\t\t\"obj\": event.Object,\n\t\t\t}).Warning(\"Got error in Pod event handler, aborting for reconnect...\")\n\t\t\twg.Done()\n\t\t\treturn\n\t\t}\n\t\teventObj, ok := event.Object.(*v1coreapi.Pod)\n\t\tif !ok {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"cluster\": c.config.Name,\n\t\t\t}).Error(\"Got event in pod handler which does not contain a pod?\")\n\t\t\tcontinue\n\t\t}\n\t\tc.lastPodVersion = eventObj.ResourceVersion\n\t\tip := net.ParseIP(eventObj.Status.PodIP)\n\t\tif ip == nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"cluster\": c.config.Name,\n\t\t\t\t\"pod\": eventObj.Name,\n\t\t\t\t\"ip\": eventObj.Status.PodIP,\n\t\t\t}).Error(\"Couldn't parse pod ip\")\n\t\t\tcontinue\n\t\t}\n\t\tobj := state.K8RouterBackend{\n\t\t\tIP: &ip,\n\t\t\tName: eventObj.Name,\n\t\t}\n\t\tmyEvent := state.BackendChange{\n\t\t\tBackend: obj,\n\t\t\tCreated: false,\n\t\t}\n\t\tswitch event.Type {\n\t\tcase watch.Deleted:\n\t\t\tdelete(c.knownPods, eventObj.Namespace+\"-\"+eventObj.Name)\n\t\t\tc.backendEvents <- myEvent\n\t\tcase watch.Modified:\n\t\t\tc.backendEvents <- myEvent\n\t\t\tmyEvent.Created = true\n\t\t\tc.backendEvents <- myEvent\n\t\t\tc.knownPods[eventObj.Namespace+\"-\"+eventObj.Name] = obj\n\t\tcase watch.Added:\n\t\t\tval, ok := c.knownPods[eventObj.Namespace+\"-\"+eventObj.Name]\n\t\t\tif !ok || !state.IsBackendEquivalent(&obj, &val) {\n\t\t\t\tmyEvent.Created = true\n\t\t\t\tc.backendEvents <- myEvent\n\t\t\t}\n\t\t\tc.knownPods[eventObj.Namespace+\"-\"+eventObj.Name] = obj\n\t\tdefault:\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"cluster\": c.config.Name,\n\t\t\t}).Error(\"Unknown event type in pod handler!\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2f592eb6e8cae9efa736522a8f992ee4", "score": "0.55759865", "text": "func (s *Server) Run() error {\n\tsig := make(chan os.Signal, 1)\n\tsignal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)\n\tgo func() {\n\t\t<-sig\n\t\ts.Stop()\n\t}()\n\n\topts := metav1.ListOptions{\n\t\tFieldSelector: fields.OneTermEqualSelector(\"spec.nodeName\", s.nodeName).String(),\n\t}\n\n\tpods, err := s.k8sClient.CoreV1().Pods(s.namespace).List(opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\ts.resourceManager.SetPods(pods)\n\ts.reconcile()\n\n\topts.ResourceVersion = pods.ResourceVersion\n\ts.podWatcher, err = s.k8sClient.CoreV1().Pods(s.namespace).Watch(opts)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase ev, ok := <-s.podWatcher.ResultChan():\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\tswitch ev.Type {\n\t\t\tcase watch.Added:\n\t\t\t\ts.resourceManager.AddPod(ev.Object.(*corev1.Pod))\n\t\t\tcase watch.Modified:\n\t\t\t\ts.resourceManager.UpdatePod(ev.Object.(*corev1.Pod))\n\t\t\tcase watch.Deleted:\n\t\t\t\ts.resourceManager.DeletePod(ev.Object.(*corev1.Pod))\n\t\t\t}\n\t\t\ts.reconcile()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f359345c39d7beaf141f0593190d2172", "score": "0.5488446", "text": "func (p *PodHandler) OnUpdate(oldObj, newObj interface{}) {\n\t_, ok1 := oldObj.(*v1.Pod)\n\tnewPod, ok2 := newObj.(*v1.Pod)\n\tif !ok1 || !ok2 {\n\t\tlog.Errorf(\"Expected Pod but OnUpdate handler received %+v %+v\", oldObj, newObj)\n\t\treturn\n\t}\n\n\tlogger := log.WithFields(p.podFields(newPod))\n\tlogger.Debug(\"Pod OnUpdate\")\n}", "title": "" }, { "docid": "7f1b790225a4215204292ac0c049c761", "score": "0.54491323", "text": "func PendingPodsWatcher(ctx context.Context, namespace string, watchInterval time.Duration) {\n\tdefer func() { // Always keep it running.\n\t\tif err := recover(); err != nil {\n\t\t\tfmt.Printf(\"Catch panic in PendingPodsWatcher: %+v\\n\", err)\n\t\t}\n\t\tgo PendingPodsWatcher(ctx, namespace, watchInterval)\n\t}()\n\tfor {\n\t\tfmt.Println(\"Start to check Pending Pods\")\n\t\terr := CheckPods(\n\t\t\tctx,\n\t\t\tos.Getenv(\"KUBECONFIG\"),\n\t\t\tnamespace,\n\t\t\tmetav1.ListOptions{\n\t\t\t\tFieldSelector: string(types.StatusPhasePending),\n\t\t\t\t// LabelSelector: \"something=\",\n\t\t\t},\n\t\t\tcheckPendingPod,\n\t\t)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Fail to check Pods in Pending status: %+v\\n\", err)\n\t\t} else {\n\t\t\tfmt.Println(\"Successfully finish checking Pods in Pending status\")\n\t\t}\n\t\ttime.Sleep(watchInterval)\n\t}\n}", "title": "" }, { "docid": "b63d1acca133eccaa08358e9499d0bec", "score": "0.542416", "text": "func (pw *PodWatcher) Init() {\n\tlistWatch := &cache.ListWatch{\n\t\tListFunc: func(options metav1.ListOptions) (runtime.Object, error) {\n\t\t\toptions.LabelSelector = pw.labelSelector\n\t\t\tl, err := pw.client.CoreV1().Pods(metav1.NamespaceAll).List(pw.ctx, options)\n\t\t\tif err != nil {\n\t\t\t\tlog.Logger.Error(\"pw: list error\", \"err\", err)\n\t\t\t\tpw.ListHealthy = false\n\t\t\t\tmetrics.IncPodWatcherFailures(\"list\")\n\t\t\t} else {\n\t\t\t\tpw.ListHealthy = true\n\t\t\t}\n\t\t\treturn l, err\n\t\t},\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\n\t\t\toptions.LabelSelector = pw.labelSelector\n\t\t\tw, err := pw.client.CoreV1().Pods(metav1.NamespaceAll).Watch(pw.ctx, options)\n\t\t\tif err != nil {\n\t\t\t\tlog.Logger.Error(\"pw: watch error\", \"err\", err)\n\t\t\t\tpw.WatchHealthy = false\n\t\t\t\tmetrics.IncPodWatcherFailures(\"watch\")\n\t\t\t} else {\n\t\t\t\tpw.WatchHealthy = true\n\t\t\t}\n\t\t\treturn w, err\n\t\t},\n\t}\n\teventHandler := cache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tpw.eventHandler(watch.Added, nil, obj.(*v1.Pod))\n\t\t},\n\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\tpw.eventHandler(watch.Modified, oldObj.(*v1.Pod), newObj.(*v1.Pod))\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tpw.eventHandler(watch.Deleted, obj.(*v1.Pod), nil)\n\t\t},\n\t}\n\tpw.store, pw.controller = cache.NewInformer(listWatch, &v1.Pod{}, pw.resyncPeriod, eventHandler)\n}", "title": "" }, { "docid": "603ad0728af9cd6996556dc6362cee83", "score": "0.53752655", "text": "func (h *handler) OnDelete(obj interface{}) {\n\tvar pod *v1.Pod\n\tswitch o := obj.(type) {\n\tcase *cache.DeletedFinalStateUnknown:\n\t\t// Assuming we never saw the pod state where new endpoints would have been created\n\t\t// to begin with it seems that we can't leak endpoints here.\n\t\tpod = o.Obj.(*v1.Pod)\n\tcase *v1.Pod:\n\t\tpod = o\n\t}\n\tif pod == nil {\n\t\treturn\n\t}\n\th.watcher.OnRemove(h.convertPodToEndpoints(pod))\n}", "title": "" }, { "docid": "5997616f016a316553318e6ee1763839", "score": "0.53506696", "text": "func (p *Provider) NotifyPods(ctx context.Context, changed func(*corev1.Pod)) {\n\ti, err := p.remote.GetInformer(ctx, &corev1.Pod{})\n\tif err != nil {\n\t\tlog.G(ctx).Error(\"cannot get informer\", err)\n\t\treturn\n\t}\n\ti.AddEventHandler(kcache.ResourceEventHandlerFuncs{\n\t\tAddFunc: func(obj interface{}) {\n\t\t\tif rmt, ok := obj.(*corev1.Pod); ok {\n\t\t\t\tlcl := rmt.DeepCopy()\n\t\t\t\tremote.RecoverPod(lcl)\n\t\t\t\tchanged(lcl)\n\t\t\t}\n\t\t},\n\t\tUpdateFunc: func(_, obj interface{}) {\n\t\t\tif rmt, ok := obj.(*corev1.Pod); ok {\n\t\t\t\tlcl := rmt.DeepCopy()\n\t\t\t\tremote.RecoverPod(lcl)\n\t\t\t\tchanged(lcl)\n\t\t\t}\n\t\t},\n\t\tDeleteFunc: func(obj interface{}) {\n\t\t\tif rmt, ok := obj.(*corev1.Pod); ok {\n\t\t\t\tlcl := rmt.DeepCopy()\n\t\t\t\tremote.RecoverPod(lcl)\n\t\t\t\tchanged(lcl)\n\t\t\t}\n\t\t},\n\t})\n}", "title": "" }, { "docid": "2675be12074eb88fec95f2a282765386", "score": "0.5342101", "text": "func (f *Folder) watchEvents() error {\n\tstream, err := f.localServer.Events()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tfor ev := range stream {\n\t\t\tdata := ev.Data.(map[string]interface{})\n\n\t\t\tif val, ok := data[\"folder\"]; !ok || (ok && (f.id != val)) {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch ev.Type {\n\t\t\tcase events.FolderSummary:\n\t\t\t\tlog.WithFields(f.ShortFields()).Info(\"updating\")\n\t\t\t\tf.Status = ServiceUpdating\n\t\t\tcase events.FolderCompletion:\n\t\t\t\tlog.WithFields(f.ShortFields()).Info(\"update complete\")\n\t\t\t\tf.Status = ServiceWatching\n\n\t\t\t\tif f.Reload {\n\t\t\t\t\tf.restartContainer <- true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.WithFields(f.Fields()).Debug(\"cleaning up event handler\")\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "979af1e1cd87f28e875107f8539ff4d4", "score": "0.5292205", "text": "func (p *PodHandler) OnDelete(obj interface{}) {\n\tpod, ok := obj.(*v1.Pod)\n\tif !ok {\n\t\tdeletedObj, dok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif dok {\n\t\t\tpod, ok = deletedObj.Obj.(*v1.Pod)\n\t\t}\n\t}\n\n\tif !ok {\n\t\tlog.Errorf(\"Expected Pod but OnDelete handler received %+v\", obj)\n\t\treturn\n\t}\n\n\tlogger := log.WithFields(p.podFields(pod))\n\tlogger.Debug(\"Pod OnDelete\")\n}", "title": "" }, { "docid": "30959f247627153e1b7814d5429d7e0a", "score": "0.5285273", "text": "func (npc *NetworkPolicyController) OnPodUpdate(obj interface{}) {\n\tpod := obj.(*api.Pod)\n\tglog.V(2).Infof(\"Received update to pod: %s/%s\", pod.Namespace, pod.Name)\n\n\tnpc.RequestFullSync()\n}", "title": "" }, { "docid": "5855944dff964a3c3317f6fe782c2985", "score": "0.5242994", "text": "func (dc *DemoController) HandleUpdate(etype controllers.EventType, oldObj, newObj interface{}) {\n\toldPod := oldObj.(*v1.Pod)\n\tnewPod := newObj.(*v1.Pod)\n\tif oldPod.ResourceVersion == newPod.ResourceVersion {\n\t\treturn\n\t}\n\tdc.queue.Add(newPod)\n\tif len(newPod.Status.ContainerStatuses) > 0 {\n\t\tlog.Printf(\"update %v\", newPod.Status.ContainerStatuses[0].Ready)\n\t} else {\n\t\tlog.Printf(\"update --\")\n\t}\n\tlog.Printf(\"handle pod update event, old: %s, new: %s, %s %v\", oldPod.Name, newPod.Name, oldPod.Namespace, newPod.DeletionTimestamp)\n\treturn\n}", "title": "" }, { "docid": "eb87eeb644116cb7e823bec4a643dde9", "score": "0.5223733", "text": "func (p *PodLogs) Run(pod string, ch chan bool, con string) {\n\tlog.Warnf(\"Trying to start watcher for pod %s-%s\", pod, con)\n\tc := &http.Client{}\n\n\treq, err := p.newLogRequest(pod, con)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tp.Shutdown(pod, con)\n\t}\n\n\tresp, err := c.Do(req)\n\tif err != nil {\n\t\tlog.Error(err)\n\t\tp.Del(pod)\n\t\tif c, ok := p.Channels[pod+\"-\"+con]; ok {\n\t\t\tp.Stop(c)\n\t\t\tp.Del(pod + \"-\" + con)\n\t\t}\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tvar stop bool\n\tgo func(s bool, ch chan bool) {\n\t\tstop = <-ch\n\t}(stop, ch)\n\n\tif resp.StatusCode == 400 {\n\t\te := &LogRequestError{}\n\t\tdata, err := ioutil.ReadAll(resp.Body)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tp.Shutdown(pod, con)\n\t\t\treturn\n\t\t}\n\n\t\tlog.Error(string(data))\n\t\tif e.IsContanerCreating() {\n\t\t\tlog.Error(\"Container not created yet\")\n\t\t\tp.Shutdown(pod, con)\n\t\t\treturn\n\t\t}\n\n\t\terr = json.Unmarshal(data, &e)\n\t\tif err != nil {\n\t\t\tlog.Error(err)\n\t\t\tp.Shutdown(pod, con)\n\t\t\treturn\n\t\t}\n\n\t\tcons := e.Containers()\n\t\tif len(cons) > 0 {\n\t\t\tfor _, container := range cons {\n\t\t\t\tch, err := p.AddWatcherToDb(pod + \"-\" + con)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tgo p.Run(pod, ch, container)\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tlog.Warnf(\"Watcher for pod %s-%s started\", pod, con)\n\treader := bufio.NewReader(resp.Body)\n\tfor {\n\t\tif stop {\n\t\t\tlog.Warn(\"Stopping logwatcher for Pod: \", pod)\n\t\t\tp.Shutdown(pod, con)\n\t\t\treturn\n\t\t}\n\t\tline, err := reader.ReadBytes('\\n')\n\t\tif err != nil && err == io.EOF {\n\t\t\tlog.Errorf(\"Received EOF for pod %s. Shutdown logwatcher.\", pod)\n\t\t\tp.Shutdown(pod, con)\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\tlog.Errorf(\"Error received %s for pod %s-%s. Shutdown logwatcher.\", err.Error(), pod, con)\n\t\t\tp.Shutdown(pod, con)\n\t\t\tcontinue\n\t\t}\n\n\t\tp.sender.Send(p.Namespace, pod, string(line), con)\n\t}\n}", "title": "" }, { "docid": "f123a73e5a5cf907feb297532ece9c0c", "score": "0.52120155", "text": "func (w *ClientPod) Listen(sm client.SystemServer, encoding octo.MessageEncoding) error {\n\tw.cnl.Lock()\n\tif w.started {\n\t\tw.cnl.Unlock()\n\t\treturn nil\n\t}\n\tw.cnl.Unlock()\n\n\tw.system = sm\n\tw.encoding = encoding\n\n\tif err := w.reconnect(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a5654cde4726ab0f11cdcfbd3a16de17", "score": "0.5187684", "text": "func (dc *DemoController) HandleAdd(etype controllers.EventType, obj interface{}) {\n\tpod := obj.(*v1.Pod)\n\tdc.queue.Add(pod)\n\tif len(pod.Status.ContainerStatuses) > 0 {\n\t\tlog.Printf(\"add %v\", pod.Status.ContainerStatuses[0].Ready)\n\t} else {\n\t\tlog.Printf(\"add --\")\n\t}\n\tlog.Printf(\"handle pod add event, %s %s %v\", pod.Name, pod.Namespace, pod.DeletionTimestamp)\n\treturn\n}", "title": "" }, { "docid": "252e3f63c087c5932cfb0f80b58b36d7", "score": "0.5182128", "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": "782f46b6c77d78cf466d6ea2d0727e0e", "score": "0.517385", "text": "func (dc *DemoController) HandleDel(etype controllers.EventType, obj interface{}) {\n\tpod := obj.(*v1.Pod)\n\tdc.queue.Add(pod)\n\tif len(pod.Status.ContainerStatuses) > 0 {\n\t\tlog.Printf(\"del %v\", pod.Status.ContainerStatuses[0].Ready)\n\t} else {\n\t\tlog.Printf(\"del --\")\n\t}\n\tlog.Printf(\"handle pod del event, %s %s %v\", pod.Name, pod.Namespace, pod.DeletionTimestamp)\n\treturn\n}", "title": "" }, { "docid": "4497f48ffd44e187df733d0b82d41231", "score": "0.51480126", "text": "func (kubernetesOps *KubernetesOps) StartEventWatcher() (bool, error) {\n\n\twatch, err := kubernetesOps.PodInterface.Watch(v1.ListOptions{})\n\tif err != nil {\n\t\tlog.Println(\"Unable to get watch channel\", err)\n\t\treturn false, err\n\t}\n\n\tgo func() {\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-watch.ResultChan():\n\t\t\t\tswitch event.Type {\n\t\t\t\tcase \"ADDED\", \"MODIFIED\":\n\t\t\t\t\tlog.Println(\"Type: \", event.Type)\n\t\t\t\t\tpod, ok := event.Object.(*corev1.Pod)\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\tlog.Println(\"Unexpected object type\")\n\t\t\t\t\t} else {\n\t\t\t\t\t\tkubernetesOps.ValidateAndPushForUpdate(pod)\n\t\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tlog.Println(\"Type: \", event.Type)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\t// Resync to make sure all pods has cat-facts\n\tgo kubernetesOps.Resync()\n\treturn true, nil\n}", "title": "" }, { "docid": "4dda04619d89526570cacaacb6ec8486", "score": "0.5129034", "text": "func (sm *Manager) watcher(ctx context.Context, ns string) {\n\t// Build a options structure to defined what we're looking for\n\tlistOptions := metav1.ListOptions{\n\t\tFieldSelector: fmt.Sprintf(\"metadata.name=%s\", sm.configMap),\n\t}\n\n\t// Watch function\n\t// Use a restartable watcher, as this should help in the event of etcd or timeout issues\n\trw, err := watchtools.NewRetryWatcher(\"1\", &cache.ListWatch{\n\t\tWatchFunc: func(options metav1.ListOptions) (watch.Interface, error) {\n\t\t\treturn sm.clientSet.CoreV1().ConfigMaps(ns).Watch(context.TODO(), listOptions)\n\t\t},\n\t})\n\n\tif err != nil {\n\t\tlog.Errorf(\"error creating watcher: %s\", err.Error())\n\t\tctx.Done()\n\t}\n\n\tch := rw.ResultChan()\n\tdefer rw.Stop()\n\tlog.Infof(\"Beginning watching Kubernetes configMap [%s]\", sm.configMap)\n\n\tvar svcs plndrServices\n\n\tgo func() {\n\t\tfor event := range ch {\n\n\t\t\t// We need to inspect the event and get ResourceVersion out of it\n\t\t\tswitch event.Type {\n\t\t\tcase watch.Added, watch.Modified:\n\t\t\t\tlog.Debugf(\"ConfigMap [%s] has been Created or modified\", sm.configMap)\n\t\t\t\tcm, ok := event.Object.(*v1.ConfigMap)\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Errorf(\"Unable to parse ConfigMap from watcher\")\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tdata := cm.Data[\"plndr-services\"]\n\t\t\t\tjson.Unmarshal([]byte(data), &svcs)\n\t\t\t\tlog.Debugf(\"Found %d services defined in ConfigMap\", len(svcs.Services))\n\n\t\t\t\terr = sm.syncServices(&svcs)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"%v\", err)\n\t\t\t\t}\n\t\t\tcase watch.Deleted:\n\t\t\t\tlog.Debugf(\"ConfigMap [%s] has been Deleted\", sm.configMap)\n\n\t\t\tcase watch.Bookmark:\n\t\t\t\t// Un-used\n\t\t\tcase watch.Error:\n\t\t\t\tlog.Infoln(\"err\")\n\n\t\t\t\t// This round trip allows us to handle unstructured status\n\t\t\t\terrObject := apierrors.FromObject(event.Object)\n\t\t\t\tstatusErr, ok := errObject.(*apierrors.StatusError)\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Fatalf(spew.Sprintf(\"Received an error which is not *metav1.Status but %#+v\", event.Object))\n\t\t\t\t\t// Retry unknown errors\n\t\t\t\t\t//return false, 0\n\t\t\t\t}\n\n\t\t\t\tstatus := statusErr.ErrStatus\n\t\t\t\tlog.Errorf(\"%v\", status)\n\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}()\n\n\t<-signalChan\n}", "title": "" }, { "docid": "44b3a10c62ef1ba102cd1f7c6408d5fc", "score": "0.5105419", "text": "func podCompleted(event watch.Event) (bool, error) {\n\tswitch event.Type {\n\tcase watch.Deleted:\n\t\treturn false, errors.NewNotFound(schema.GroupResource{Resource: \"pods\"}, \"\")\n\t}\n\tswitch t := event.Object.(type) {\n\tcase *corev1.Pod:\n\t\tswitch t.Status.Phase {\n\t\tcase corev1.PodFailed, corev1.PodSucceeded:\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "27bba6fa5731eef8015a352d5909ccf9", "score": "0.5094366", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"pod-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Pod\n\terr = c.Watch(&source.Kind{Type: &ketiv1.Pod{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Pod\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &ketiv1.Pod{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c6454267e36eeceff25f25678b0aba56", "score": "0.50826824", "text": "func (f *PodLister) Pods(namespace string) corelisters.PodNamespaceLister {\n\treturn f.PodsReactor(namespace)\n}", "title": "" }, { "docid": "758b19253cfda39640ddd1877f22d0fa", "score": "0.5013405", "text": "func (ps *PodSyncer) handleAddEvent(obj interface{}) {\n\tpod := obj.(*corev1.Pod)\n\tps.addKindAndVersion(pod)\n\n\tklog.V(4).Infof(\"add pod: %s\", pod.Name)\n\n\tgo syncToNode(watch.Added, util.ResourcePod, pod)\n\n\tsyncToStorage(ps.ctx, watch.Added, util.ResourcePod, pod)\n}", "title": "" }, { "docid": "696ffc82f178fd16d696ea7361e42777", "score": "0.49829498", "text": "func (d *podEventsOps) GetAll(\n\tctx context.Context,\n\tjobID string,\n\tinstanceID uint32,\n\tpodID ...string) ([]*task.PodEvent, error) {\n\tpodEventsObject := &PodEventsObject{\n\t\tJobID: jobID,\n\t\tInstanceID: instanceID,\n\t}\n\tvar result []base.Object\n\tvar runID uint64\n\tvar err error\n\tif len(podID) > 0 && len(podID[0]) > 0 {\n\t\trunID, err = util.ParseRunID(podID[0])\n\t\tif err != nil {\n\t\t\treturn nil, errors.Wrap(err, \"Failed to parse runID\")\n\t\t}\n\t} else {\n\t\t// Events are sorted in descending order by run_id and then update_time.\n\t\t// If pod event is not specified, we will get the latest run_id.\n\t\tpodEventsObject = &PodEventsObject{\n\t\t\tJobID: jobID,\n\t\t\tInstanceID: instanceID,\n\t\t}\n\t\t// By default, the Get will fetch the latest row of the latest run_id.\n\t\trow, err := d.store.oClient.Get(\n\t\t\tctx,\n\t\t\tpodEventsObject,\n\t\t)\n\n\t\tif err != nil {\n\t\t\td.store.metrics.OrmTaskMetrics.PodEventsGetFail.Inc(1)\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(row) == 0 {\n\t\t\treturn []*task.PodEvent{}, nil\n\t\t}\n\t\trunID = row[\"run_id\"].(uint64)\n\t}\n\n\tpodEventsObject = &PodEventsObject{\n\t\tJobID: jobID,\n\t\tInstanceID: instanceID,\n\t\tRunID: base.NewOptionalUInt64(runID),\n\t}\n\trows, err := d.store.oClient.GetAll(ctx, podEventsObject)\n\tfor _, row := range rows {\n\t\tpodEventsObjectValue := &PodEventsObject{}\n\t\tpodEventsObjectValue.transform(row)\n\t\tresult = append(result, podEventsObjectValue)\n\t}\n\n\tvar podEvents []*task.PodEvent\n\tfor _, value := range result {\n\t\tpodEvent := &task.PodEvent{}\n\n\t\tpodEventsObjectValue := value.(*PodEventsObject)\n\t\tmesosTaskID := fmt.Sprintf(\"%s-%d-%d\",\n\t\t\tpodEventsObjectValue.JobID,\n\t\t\tpodEventsObjectValue.InstanceID,\n\t\t\tbase.ConvertFromOptionalToRawType(reflect.ValueOf(\n\t\t\t\tpodEventsObjectValue.RunID)).(uint64))\n\n\t\tprevMesosTaskID := fmt.Sprintf(\"%s-%d-%d\",\n\t\t\tpodEventsObjectValue.JobID,\n\t\t\tpodEventsObjectValue.InstanceID,\n\t\t\tpodEventsObjectValue.PreviousRunID)\n\n\t\tdesiredMesosTaskID := fmt.Sprintf(\"%s-%d-%d\",\n\t\t\tpodEventsObjectValue.JobID,\n\t\t\tpodEventsObjectValue.InstanceID,\n\t\t\tpodEventsObjectValue.DesiredRunID)\n\n\t\t// Set podEvent fields\n\t\tpodEvent.TaskId = &mesos_v1.TaskID{\n\t\t\tValue: &mesosTaskID,\n\t\t}\n\t\tpodEvent.PrevTaskId = &mesos_v1.TaskID{\n\t\t\tValue: &prevMesosTaskID,\n\t\t}\n\t\tpodEvent.DesriedTaskId = &mesos_v1.TaskID{\n\t\t\tValue: &desiredMesosTaskID,\n\t\t}\n\t\tconvertedTS, err := gocql.ParseUUID(base.ConvertFromOptionalToRawType(\n\t\t\treflect.\n\t\t\t\tValueOf(podEventsObjectValue.UpdateTime)).(string))\n\t\tif err != nil {\n\t\t\td.store.metrics.OrmTaskMetrics.PodEventsGetFail.Inc(1)\n\t\t\treturn nil, errors.Wrap(err, \"Failed to parse update_time\")\n\t\t}\n\n\t\tpodEvent.Timestamp = convertedTS.Time().Format(time.RFC3339)\n\t\tpodEvent.ConfigVersion = podEventsObjectValue.ConfigVersion\n\t\tpodEvent.DesiredConfigVersion = podEventsObjectValue.DesiredConfigVersion\n\n\t\tpodEvent.ActualState = podEventsObjectValue.ActualState\n\t\tpodEvent.GoalState = podEventsObjectValue.GoalState\n\t\tpodEvent.Message = podEventsObjectValue.Message\n\t\tpodEvent.Reason = podEventsObjectValue.Reason\n\t\tpodEvent.AgentID = podEventsObjectValue.AgentID\n\t\tpodEvent.Hostname = podEventsObjectValue.Hostname\n\t\tpodEvent.Healthy = podEventsObjectValue.Healthy\n\n\t\tpodEvents = append(podEvents, podEvent)\n\t}\n\td.store.metrics.OrmTaskMetrics.PodEventsGet.Inc(1)\n\n\treturn podEvents, nil\n}", "title": "" }, { "docid": "8e5f3e57a7f8f6345baf599962a60a12", "score": "0.49695066", "text": "func (h *eventHandler) OnUpdate(oldObj, newObj interface{}) {\n\tnewRd := newObj.(*ReviewDeployment)\n\th.handleUpdatedReviewDeployment(newRd)\n}", "title": "" }, { "docid": "c4493611e9005b2b4c991e5728418e56", "score": "0.4948834", "text": "func (c *Controller) Once(ctx context.Context) error {\n\tpods, err := c.lister.ListPods(c.namespace, c.selector)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to list pods\")\n\t}\n\n\tfor _, pod := range pods {\n\t\t// we only check at the beginning of loop if we are done\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\tlogger := c.logger.With(\n\t\t\tzap.String(\"namespace\", pod.ObjectMeta.Namespace),\n\t\t\tzap.String(\"name\", pod.ObjectMeta.Name),\n\t\t)\n\n\t\tswitch pod.Status.Phase {\n\t\tcase v1.PodPending, v1.PodSucceeded, v1.PodUnknown:\n\t\t\tlogger.Debug(\"skipping pod\",\n\t\t\t\tzap.String(\"reason\", \"PodPhase\"),\n\t\t\t\tzap.String(\"PodPhase\", string(pod.Status.Phase)),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\t\t// only look at pods that are older than the grace period\n\t\tif pod.ObjectMeta.CreationTimestamp.Time.Add(c.grace).After(time.Now()) {\n\t\t\tlogger.Debug(\"skipping pod\",\n\t\t\t\tzap.String(\"reason\", \"CreationTimestamp\"),\n\t\t\t\tzap.Time(\"CreationTimestamp\", pod.ObjectMeta.CreationTimestamp.Time),\n\t\t\t)\n\t\t\tcontinue\n\t\t}\n\n\tSTATUS:\n\t\tfor _, status := range pod.Status.ContainerStatuses {\n\t\t\treason := \"\"\n\t\t\tif status.State.Terminated != nil {\n\t\t\t\treason = status.State.Terminated.Reason\n\t\t\t} else if status.State.Waiting != nil {\n\t\t\t\treason = status.State.Waiting.Reason\n\t\t\t}\n\n\t\t\tif _, ok := c.reasonsMap[reason]; !ok {\n\t\t\t\tlogger.Debug(\"skipping pod\",\n\t\t\t\t\tzap.String(\"reason\", \"Reason\"),\n\t\t\t\t\tzap.String(\"Reason\", reason),\n\t\t\t\t)\n\t\t\t\tcontinue STATUS\n\t\t\t}\n\n\t\t\tlogger.Info(\"deleting pod\",\n\t\t\t\tzap.String(\"Reason\", reason),\n\t\t\t\tzap.Bool(\"dry-run\", c.dryRun),\n\t\t\t)\n\n\t\t\tif !c.dryRun {\n\t\t\t\terr := c.deleter.DeletePod(pod.ObjectMeta.Namespace, pod.ObjectMeta.Name)\n\t\t\t\tif err != nil {\n\t\t\t\t\t// if not found is fine as pod may have exited\n\t\t\t\t\tif !k8sErrors.IsNotFound(err) {\n\t\t\t\t\t\treturn errors.Wrapf(err, \"failed to delete pod %s/%s\", pod.ObjectMeta.Namespace, pod.ObjectMeta.Name)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a91ea7c20d5034e0385bbbe6038effe", "score": "0.4919822", "text": "func (h *enqueueRequestsForPodEvents) Update(e event.UpdateEvent, queue workqueue.RateLimitingInterface) {\n\t// cloudmap reconcile depends Virtualnode Pod Selector labels and if there is an update to a Pod\n\t// we need to check if there is any change w.r.t VirtualNode it belongs.\n\toldPod := e.ObjectOld.(*corev1.Pod)\n\tnewPod := e.ObjectNew.(*corev1.Pod)\n\n\tlabelsChanged := !reflect.DeepEqual(oldPod.Labels, newPod.Labels)\n\n\tif newPod.DeletionTimestamp != nil || ReadyStatusChanged(oldPod, newPod) || labelsChanged {\n\t\tif labelsChanged {\n\t\t\th.enqueueVirtualNodesForPods(context.Background(), queue, oldPod)\n\t\t}\n\n\t\th.enqueueVirtualNodesForPods(context.Background(), queue, newPod)\n\t}\n}", "title": "" }, { "docid": "2f17d19c34beaefc1b1c21408b3685b2", "score": "0.49105734", "text": "func PodEventStream() {\n\tconfig, err := rest.InClusterConfig()\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\tclientset, err := kubernetes.NewForConfig(config)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\n\twatchlist := cache.NewListWatchFromClient(clientset.Core().RESTClient(), \"pods\", v1.NamespaceDefault,\n\t\tfields.Everything())\n\t_, controller := cache.NewInformer(\n\t\twatchlist,\n\t\t&v1.Pod{},\n\t\ttime.Second*0,\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\tAddFunc: func(obj interface{}) {\n\t\t\t\tfmt.Printf(\"add: %s \\n\", obj)\n\t\t\t},\n\t\t\tDeleteFunc: func(obj interface{}) {\n\t\t\t\tfmt.Printf(\"delete: %s \\n\", obj)\n\t\t\t},\n\t\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\t\tfmt.Printf(\"old: %s, new: %s \\n\", oldObj, newObj)\n\t\t\t},\n\t\t},\n\t)\n\tstop := make(chan struct{})\n\tgo controller.Run(stop)\n}", "title": "" }, { "docid": "92f50d8b52d401d6f78d54841ce57b33", "score": "0.48985055", "text": "func (ctrl *PodGroupController) podUpdated(old, new interface{}) {\n\n\tctrl.podAdded(new)\n}", "title": "" }, { "docid": "ba2d41d7dbb21c6e12883aadf6a9aad4", "score": "0.48931265", "text": "func (c *Controller) addPod(obj interface{}) {\n\t// pod adding is handled by cni where danmep is involved, no action is needed\n\tif !c.podSynced() || !c.serviceSynced() || !c.epsSynced() || !c.danmepSynced() {\n\t\treturn\n\t}\n\tglog.Infof(\"addPod is called: %s %s\", obj.(*corev1.Pod).GetName(), obj.(*corev1.Pod).GetNamespace())\n}", "title": "" }, { "docid": "f6742035eb8a5305f96cb5bde320c258", "score": "0.4891667", "text": "func PodsResponding(c clientset.Interface, ns, name string, wantName bool, pods *v1.PodList) error {\n\tginkgo.By(\"trying to dial each unique pod\")\n\tlabel := labels.SelectorFromSet(labels.Set(map[string]string{\"name\": name}))\n\treturn wait.PollImmediate(poll, podRespondingTimeout, NewProxyResponseChecker(c, ns, label, name, wantName, pods).CheckAllResponses)\n}", "title": "" }, { "docid": "b9ad9645c875f5f8194e8101a5e54765", "score": "0.48842883", "text": "func (e *EventSource) Run() {\n\tserviceWatch, err := e.clientset.CoreV1().Services(\"\").Watch(metav1.ListOptions{})\n\tif err != nil {\n\t\te.slogger.Errorf(\"Error while watching services: %v\", err)\n\t\treturn\n\t}\n\n\tfor event := range serviceWatch.ResultChan() {\n\t\tswitch event.Type {\n\t\tcase watch.Error:\n\t\t\te.slogger.Errorf(\"Error listening to service events: %v\", event.Object)\n\t\t\tbreak\n\t\tcase watch.Added:\n\t\t\te.addService(event.Object.(*v1.Service))\n\t\tcase watch.Deleted:\n\t\t\te.deleteService(event.Object.(*v1.Service))\n\t\tcase watch.Modified:\n\t\t\tsvc := event.Object.(*v1.Service)\n\t\t\t// TODO: This may not work as the commands may not come in order.\n\t\t\t// Consider using a single command channel in checker or\n\t\t\t// introduce a separate command for updating service\n\t\t\te.deleteService(svc)\n\t\t\te.addService(svc)\n\t\tdefault:\n\t\t\te.slogger.Info(\"Ignoring unsupported event: %s\", event.Type)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2eb06c9fd3a518ebb5d2830cd94ef1f3", "score": "0.48799893", "text": "func (m *Manager) OnAdd(obj interface{}) {\n\tswitch obj := obj.(type) {\n\tcase *v1beta1.Ingress:\n\t\tif changed := m.upsertIngress(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\tcase *v1.Secret:\n\t\tif changed := m.upsertSecret(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3a2f9f221345355f93db1a9ab9d24324", "score": "0.48680046", "text": "func (a *Adapter) PodInformer(ctx context.Context, endpointChan chan<- []string) (err error) {\n\tpodEndpoints := sync.Map{}\n\n\tlog.Infof(\"Watching for Pods with labelselector %s in namespace %s\", a.cniPodLabelSelector, a.cniPodNamespace)\n\tfactory := informers.NewSharedInformerFactoryWithOptions(a.clientset, resyncInterval, informers.WithNamespace(a.cniPodNamespace),\n\t\tinformers.WithTweakListOptions(func(options *apisv1.ListOptions) { options.LabelSelector = a.cniPodLabelSelector }))\n\n\tinformer := factory.Core().V1().Pods().Informer()\n\tfactory.Start(ctx.Done())\n\tif !cache.WaitForCacheSync(ctx.Done(), informer.HasSynced) {\n\t\treturn fmt.Errorf(\"timed out waiting for caches to sync\")\n\t}\n\n\t// list warms the pod cache and verifies whether pods for given specs can be found, preventing to fail silently\n\tvar podList []*corev1.Pod\n\tfor {\n\t\tpodList, err = factory.Core().V1().Pods().Lister().List(labels.Everything())\n\t\tif err == nil && len(podList) > 0 {\n\t\t\tbreak\n\t\t}\n\t\tlog.Errorf(\"Error listing Pods with labelselector %s in namespace %s: %v\", a.cniPodNamespace, a.cniPodLabelSelector, err)\n\t\ttime.Sleep(resyncInterval)\n\t}\n\tfor _, pod := range podList {\n\t\tif !isPodTerminating(pod) && isPodRunning(pod) {\n\t\t\tpodEndpoints.Store(pod.Name, pod.Status.PodIP)\n\t\t}\n\t}\n\tqueueEndpoints(&podEndpoints, endpointChan)\n\n\t// delta triggered updates\n\tinformer.AddEventHandler(cache.ResourceEventHandlerFuncs{\n\t\tUpdateFunc: func(_, newResource interface{}) {\n\t\t\tpod, ok := newResource.(*corev1.Pod)\n\t\t\tif !ok {\n\t\t\t\tlog.Printf(\"cannot cast object to corev1.Pod %v\", newResource)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tswitch {\n\n\t\t\tcase isPodTerminating(pod):\n\t\t\t\tname, exists := podEndpoints.LoadAndDelete(pod.Name)\n\t\t\t\tif !exists {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Infof(\"Deleted pod: %s IP: %s\", pod.Name, name)\n\t\t\t\tqueueEndpoints(&podEndpoints, endpointChan)\n\n\t\t\tcase isPodRunning(pod):\n\t\t\t\tif _, isStored := podEndpoints.LoadOrStore(pod.Name, pod.Status.PodIP); isStored {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlog.Infof(\"New discovered pod: %s IP: %s\", pod.Name, pod.Status.PodIP)\n\t\t\t\tqueueEndpoints(&podEndpoints, endpointChan)\n\t\t\t}\n\t\t},\n\t})\n\t<-ctx.Done()\n\treturn nil\n}", "title": "" }, { "docid": "58b1204e673aace931edf9bb181112fe", "score": "0.48432538", "text": "func (k RunningK8sMockData) Pods() ([]*models.K8sResource, error) {\n\t// TODO: implement\n\treturn []*models.K8sResource{}, nil\n}", "title": "" }, { "docid": "ca4ee70d9683ae9d319e7d39a73d87f8", "score": "0.48429188", "text": "func (p *PodmanProvider) NotifyPods(ctx context.Context, notifier func(*v1.Pod)) {\n\tp.notifier = notifier\n}", "title": "" }, { "docid": "6c085f2fb9b69b8a5f3ee84d1a26bf20", "score": "0.4836585", "text": "func GetPodsEvents(client kubernetes.Interface, namespace string, pods []v1.Pod) (\n\t[]v1.Event, error) {\n\n\tnsQuery := common.NewSameNamespaceQuery(namespace)\n\tif namespace == v1.NamespaceAll {\n\t\tnsQuery = common.NewNamespaceQuery([]string{})\n\t}\n\n\tchannels := &common.ResourceChannels{\n\t\tEventList: common.GetEventListChannel(client, nsQuery, 1),\n\t}\n\n\teventList := <-channels.EventList.List\n\tif err := <-channels.EventList.Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\tevents := filterEventsByPodsUID(eventList.Items, pods)\n\n\treturn events, nil\n}", "title": "" }, { "docid": "abbe90aabb99bc45c1b3191050198a94", "score": "0.48200077", "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": "18885b6396a339319d9ae326e6f5929c", "score": "0.478999", "text": "func (m *Manager) OnDelete(obj interface{}) {\n\tswitch obj := obj.(type) {\n\tcase *v1beta1.Ingress:\n\t\tif changed := m.deleteIngress(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\tcase *v1.Secret:\n\t\tif changed := m.deleteSecret(obj); changed {\n\t\t\tm.notifySubscribers()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "03d93aabbdf563318c8d450c862de9d4", "score": "0.4789591", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"oidcclientwatcher-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource OIDCClientWatcher\n\terr = c.Watch(&source.Kind{Type: &operatorv1alpha1.OIDCClientWatcher{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner OIDCClientWatcher\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &operatorv1alpha1.OIDCClientWatcher{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cd2c2770f0df62a7c4284b351c5e6cd5", "score": "0.47872734", "text": "func LogPodStatusChanged(id, oldStatus, newStatus string) {\n\tLogPodEvent(id, EventPodStatusChange, podData{\n\t\tOldStatus: oldStatus,\n\t\tNewStatus: newStatus,\n\t})\n}", "title": "" }, { "docid": "a9f069b8b6801ddccfb6ec2247fb2048", "score": "0.47683948", "text": "func podRunningAndReady(event watch.Event) (bool, error) {\n\tswitch event.Type {\n\tcase watch.Deleted:\n\t\treturn false, errors.NewNotFound(schema.GroupResource{Resource: \"pods\"}, \"\")\n\t}\n\tswitch t := event.Object.(type) {\n\tcase *corev1.Pod:\n\t\tswitch t.Status.Phase {\n\t\tcase corev1.PodFailed, corev1.PodSucceeded:\n\t\t\treturn false, ErrPodCompleted\n\t\tcase corev1.PodRunning:\n\t\t\tconditions := t.Status.Conditions\n\t\t\tif conditions == nil {\n\t\t\t\treturn false, nil\n\t\t\t}\n\t\t\tfor i := range conditions {\n\t\t\t\tif conditions[i].Type == corev1.PodReady &&\n\t\t\t\t\tconditions[i].Status == corev1.ConditionTrue {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "17c30018b52c3243b48755c8d3e35be6", "score": "0.47574708", "text": "func (pw *PodWatcher) Run() {\n\tlog.Logger.Info(\"starting pod watcher\")\n\t// Running controller will block until writing on the stop channel.\n\tpw.controller.Run(pw.stopChannel)\n\tlog.Logger.Info(\"stopped pod watcher\")\n}", "title": "" }, { "docid": "afc230f9490a90fd782337bb28712c1f", "score": "0.47520012", "text": "func (c *PodController) onUpdate(oldObj, _ interface{}) {\n\tkey, err := cache.MetaNamespaceKeyFunc(oldObj)\n\tif err != nil {\n\t\tlog.Printf(\"onUpdate: Unable to get key for #%v\", oldObj, err)\n\t}\n\tlog.Printf(\"onAdd: %v\", key)\n}", "title": "" }, { "docid": "f58e7c1e63034a80b3408689dec22819", "score": "0.47481486", "text": "func (ctrl *PodGroupController) podAdded(obj interface{}) {\n\tpod := obj.(*v1.Pod)\n\tpgName := util.GetGangNameByPod(pod)\n\tif len(pgName) == 0 {\n\t\treturn\n\t}\n\tpg, err := ctrl.pgLister.PodGroups(pod.Namespace).Get(pgName)\n\tif err != nil {\n\t\tklog.Errorf(\"Error while adding pod, err: %v\", err)\n\t\treturn\n\t}\n\tklog.Infof(\"Add podGroup when pod gets added, podGroup: %v, pod: %v\", util.GetId(pg.Namespace, pg.Name),\n\t\tutil.GetId(pod.Namespace, pod.Name))\n\tctrl.pgAdded(pg)\n}", "title": "" }, { "docid": "131f067bbc8051fdfa3589de7acd30af", "score": "0.47457734", "text": "func (watcher *PolarisServiceWatcher) startWatch() {\n\tfor {\n\t\tresp, err := watcher.consumer.WatchService(watcher.subscribeParam)\n\t\tif err != nil {\n\t\t\ttime.Sleep(time.Duration(500 * time.Millisecond))\n\t\t\tcontinue\n\t\t}\n\t\twatcher.notifyAllSubscriber(&config_center.ConfigChangeEvent{\n\t\t\tValue: resp.GetAllInstancesResp.Instances,\n\t\t\tConfigType: remoting.EventTypeAdd,\n\t\t})\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase event := <-resp.EventChannel:\n\t\t\t\teType := event.GetSubScribeEventType()\n\t\t\t\tif eType == internalapi.EventInstance {\n\t\t\t\t\tinsEvent := event.(*model.InstanceEvent)\n\n\t\t\t\t\tif insEvent.AddEvent != nil {\n\t\t\t\t\t\twatcher.notifyAllSubscriber(&config_center.ConfigChangeEvent{\n\t\t\t\t\t\t\tValue: insEvent.AddEvent.Instances,\n\t\t\t\t\t\t\tConfigType: remoting.EventTypeAdd,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tif insEvent.UpdateEvent != nil {\n\t\t\t\t\t\tinstances := make([]model.Instance, len(insEvent.UpdateEvent.UpdateList))\n\t\t\t\t\t\tfor i := range insEvent.UpdateEvent.UpdateList {\n\t\t\t\t\t\t\tinstances[i] = insEvent.UpdateEvent.UpdateList[i].After\n\t\t\t\t\t\t}\n\t\t\t\t\t\twatcher.notifyAllSubscriber(&config_center.ConfigChangeEvent{\n\t\t\t\t\t\t\tValue: instances,\n\t\t\t\t\t\t\tConfigType: remoting.EventTypeUpdate,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t\tif insEvent.DeleteEvent != nil {\n\t\t\t\t\t\twatcher.notifyAllSubscriber(&config_center.ConfigChangeEvent{\n\t\t\t\t\t\t\tValue: insEvent.DeleteEvent.Instances,\n\t\t\t\t\t\t\tConfigType: remoting.EventTypeDel,\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "198cac9e1d82c6481b055ae058311393", "score": "0.47450277", "text": "func onWatchFiles(watcher *fsnotify.Watcher) {\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-watcher.Events:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif event.Op&fsnotify.Write == fsnotify.Write {\n\t\t\t\tlog.Println(\"Reloading: \" + event.Name)\n\n\t\t\t\tif event.Name == requestFile {\n\t\t\t\t\tloadRequestScript()\n\t\t\t\t}\n\n\t\t\t\tif event.Name == responseFile {\n\t\t\t\t\tloadResponseScript()\n\t\t\t\t}\n\t\t\t}\n\t\tcase err, ok := <-watcher.Errors:\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Println(\"error:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "250a4dd12cea362193e882929a34967c", "score": "0.47406358", "text": "func WaitforPodsRunning(kubeConfigPath string, podlist v1.PodList, timout time.Duration) {\n\tif len(podlist.Items) == 0 {\n\t\tFatalf(\"podlist should not be empty\")\n\t}\n\n\tpodRunningCount := 0\n\tfor _, pod := range podlist.Items {\n\t\tif pod.Status.Phase == v1.PodRunning {\n\t\t\tpodRunningCount++\n\t\t}\n\t}\n\tif podRunningCount == len(podlist.Items) {\n\t\tInfof(\"All pods come into running status\")\n\t\treturn\n\t}\n\n\t// new kube client\n\tkubeClient := NewKubeClient(kubeConfigPath)\n\t// define signal\n\tsignal := make(chan struct{})\n\t// define list watcher\n\tlistWatcher := cache.NewListWatchFromClient(\n\t\tkubeClient.CoreV1().RESTClient(),\n\t\t\"pods\",\n\t\tv1.NamespaceAll,\n\t\tfields.Everything())\n\t// new controller\n\t_, controller := cache.NewInformer(\n\t\tlistWatcher,\n\t\t&v1.Pod{},\n\t\ttime.Second*0,\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\t// receive update events\n\t\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\t\t// check update obj\n\t\t\t\tp, ok := newObj.(*v1.Pod)\n\t\t\t\tif !ok {\n\t\t\t\t\tFatalf(\"Failed to cast observed object to pod\")\n\t\t\t\t}\n\t\t\t\t// calculate the pods in running status\n\t\t\t\tcount := 0\n\t\t\t\tfor i := range podlist.Items {\n\t\t\t\t\t// update pod status in podlist\n\t\t\t\t\tif podlist.Items[i].Name == p.Name {\n\t\t\t\t\t\tInfof(\"PodName: %s PodStatus: %s\", p.Name, p.Status.Phase)\n\t\t\t\t\t\tpodlist.Items[i].Status = p.Status\n\t\t\t\t\t}\n\t\t\t\t\t// check if the pod is in running status\n\t\t\t\t\tif podlist.Items[i].Status.Phase == v1.PodRunning {\n\t\t\t\t\t\tcount++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// send an end signal when all pods are in running status\n\t\t\t\tif len(podlist.Items) == count {\n\t\t\t\t\tsignal <- struct{}{}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t)\n\n\t// run controoler\n\tpodChan := make(chan struct{})\n\tgo controller.Run(podChan)\n\tdefer close(podChan)\n\n\t// wait for a signal or timeout\n\tselect {\n\tcase <-signal:\n\t\tInfof(\"All pods come into running status\")\n\tcase <-time.After(timout):\n\t\tFatalf(\"Wait for pods come into running status timeout: %v\", timout)\n\t}\n}", "title": "" }, { "docid": "7a8df5ff6d89ffd1fedd8504e24c622b", "score": "0.47304404", "text": "func ProcessPodVolumes(pod *v1.Pod, addVolumes bool, desiredStateOfWorld cache.DesiredStateOfWorld, volumePluginMgr *volume.VolumePluginMgr, pvcLister corelisters.PersistentVolumeClaimLister, pvLister corelisters.PersistentVolumeLister) {\n\tif pod == nil {\n\t\treturn\n\t}\n\n\tif len(pod.Spec.Volumes) <= 0 {\n\t\tglog.V(10).Infof(\"Skipping processing of pod %q/%q: it has no volumes.\",\n\t\t\tpod.Namespace,\n\t\t\tpod.Name)\n\t\treturn\n\t}\n\n\tnodeName := types.NodeName(pod.Spec.NodeName)\n\tif nodeName == \"\" {\n\t\tglog.V(10).Infof(\n\t\t\t\"Skipping processing of pod %q/%q: it is not scheduled to a node.\",\n\t\t\tpod.Namespace,\n\t\t\tpod.Name)\n\t\treturn\n\t} else if !desiredStateOfWorld.NodeExists(nodeName) {\n\t\t// If the node the pod is scheduled to does not exist in the desired\n\t\t// state of the world data structure, that indicates the node is not\n\t\t// yet managed by the controller. Therefore, ignore the pod.\n\t\tglog.V(10).Infof(\n\t\t\t\"Skipping processing of pod %q/%q: it is scheduled to node %q which is not managed by the controller.\",\n\t\t\tpod.Namespace,\n\t\t\tpod.Name,\n\t\t\tnodeName)\n\t\treturn\n\t}\n\n\t// Process volume spec for each volume defined in pod\n\tfor _, podVolume := range pod.Spec.Volumes {\n\t\tvolumeSpec, err := CreateVolumeSpec(podVolume, pod.Namespace, pvcLister, pvLister)\n\t\tif err != nil {\n\t\t\tglog.V(10).Infof(\n\t\t\t\t\"Error processing volume %q for pod %q/%q: %v\",\n\t\t\t\tpodVolume.Name,\n\t\t\t\tpod.Namespace,\n\t\t\t\tpod.Name,\n\t\t\t\terr)\n\t\t\tcontinue\n\t\t}\n\n\t\tattachableVolumePlugin, err :=\n\t\t\tvolumePluginMgr.FindAttachablePluginBySpec(volumeSpec)\n\t\tif err != nil || attachableVolumePlugin == nil {\n\t\t\tglog.V(10).Infof(\n\t\t\t\t\"Skipping volume %q for pod %q/%q: it does not implement attacher interface. err=%v\",\n\t\t\t\tpodVolume.Name,\n\t\t\t\tpod.Namespace,\n\t\t\t\tpod.Name,\n\t\t\t\terr)\n\t\t\tcontinue\n\t\t}\n\n\t\tuniquePodName := volumehelper.GetUniquePodName(pod)\n\t\tif addVolumes {\n\t\t\t// Add volume to desired state of world\n\t\t\t_, err := desiredStateOfWorld.AddPod(\n\t\t\t\tuniquePodName, pod, volumeSpec, nodeName)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(10).Infof(\n\t\t\t\t\t\"Failed to add volume %q for pod %q/%q to desiredStateOfWorld. %v\",\n\t\t\t\t\tpodVolume.Name,\n\t\t\t\t\tpod.Namespace,\n\t\t\t\t\tpod.Name,\n\t\t\t\t\terr)\n\t\t\t}\n\n\t\t} else {\n\t\t\t// Remove volume from desired state of world\n\t\t\tuniqueVolumeName, err := volumehelper.GetUniqueVolumeNameFromSpec(\n\t\t\t\tattachableVolumePlugin, volumeSpec)\n\t\t\tif err != nil {\n\t\t\t\tglog.V(10).Infof(\n\t\t\t\t\t\"Failed to delete volume %q for pod %q/%q from desiredStateOfWorld. GetUniqueVolumeNameFromSpec failed with %v\",\n\t\t\t\t\tpodVolume.Name,\n\t\t\t\t\tpod.Namespace,\n\t\t\t\t\tpod.Name,\n\t\t\t\t\terr)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdesiredStateOfWorld.DeletePod(\n\t\t\t\tuniquePodName, uniqueVolumeName, nodeName)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d6631df772f623f2b66774482881494d", "score": "0.47226706", "text": "func init() {\n\tObjs = append(Objs, &PodEventsObject{})\n}", "title": "" }, { "docid": "23553511db04bad12de8ef764ef93572", "score": "0.47166803", "text": "func (mp *Watcher) Events() []string {\n\treturn []string{LongpollEvent}\n}", "title": "" }, { "docid": "1e14dcac97506ba720e0771a4f924a6d", "score": "0.46788302", "text": "func (w *watcher) HandleUpdate(e watch.Event) {\n\tw.Mutex.Lock()\n\tdefer w.Mutex.Unlock()\n\tsvc, ok := e.Object.(*corev1.Service)\n\n\t// Not a service\n\tif !ok {\n\t\treturn\n\t}\n\n\t// Not of type clusterIP\n\tif svc.Spec.ClusterIP == \"None\" {\n\t\treturn\n\t}\n\n\tswitch e.Type {\n\tcase \"ADDED\":\n\t\tw.data[svc.Spec.ClusterIP] = true\n\tcase \"DELETED\":\n\t\tdelete(w.data, svc.Spec.ClusterIP)\n\t}\n}", "title": "" }, { "docid": "9dbd9b4ea1513bed0d50e7bf47ecac3e", "score": "0.4678821", "text": "func PLEGWatch(out *models.LineInfo) {\n\tpath := os.Getenv(\"JOURNAL_PATH\")\n\n\tfmt.Println(\"Journal path:\", path)\n\n\tjcfg := sdjournal.JournalReaderConfig{\n\t\tNumFromTail: uint64(1),\n\t\tPath: path,\n\t\tMatches: []sdjournal.Match{\n\t\t\t{\n\t\t\t\tField: sdjournal.SD_JOURNAL_FIELD_SYSLOG_IDENTIFIER,\n\t\t\t\tValue: \"hyperkube\",\n\t\t\t},\n\t\t},\n\t}\n\n\tr, err := sdjournal.NewJournalReader(jcfg)\n\tif err != nil {\n\t\tfmt.Printf(\"Error opening journal: %v\\n\", err)\n\t}\n\n\tif r == nil {\n\t\tfmt.Println(\"Error: got a nil reader.\")\n\t}\n\n\tdefer r.Close()\n\n\tfmt.Println(\"=== Watching journal ===\")\n\n\tuntil := make(chan time.Time)\n\n\tif err := r.Follow(until, out); err != nil {\n\t\tfmt.Printf(\"Could not read from journal: %s\\n\", err)\n\t}\n}", "title": "" }, { "docid": "766b64fca042cb76f1d414cee84677b7", "score": "0.4672776", "text": "func WaitforPodsRunning(kubeConfigPath string, podlist v1.PodList, timout time.Duration) error {\n\tif len(podlist.Items) == 0 {\n\t\treturn fmt.Errorf(\"podlist should not be empty\")\n\t}\n\n\tpodRunningCount := 0\n\tfor _, pod := range podlist.Items {\n\t\tif pod.Status.Phase == v1.PodRunning {\n\t\t\tpodRunningCount++\n\t\t}\n\t}\n\tif podRunningCount == len(podlist.Items) {\n\t\tutils.Infof(\"All pods come into running status\")\n\t\treturn nil\n\t}\n\n\t// new kube client\n\tkubeClient := utils.NewKubeClient(kubeConfigPath)\n\t// define signal\n\tsignal := make(chan struct{})\n\t// define list watcher\n\tlistWatcher := cache.NewListWatchFromClient(\n\t\tkubeClient.CoreV1().RESTClient(),\n\t\t\"pods\",\n\t\tv1.NamespaceAll,\n\t\tfields.Everything())\n\t// new controller\n\t_, controller := cache.NewInformer(\n\t\tlistWatcher,\n\t\t&v1.Pod{},\n\t\ttime.Second*0,\n\t\tcache.ResourceEventHandlerFuncs{\n\t\t\t// receive update events\n\t\t\tUpdateFunc: func(oldObj, newObj interface{}) {\n\t\t\t\t// check update obj\n\t\t\t\tp, ok := newObj.(*v1.Pod)\n\t\t\t\tif !ok {\n\t\t\t\t\tutils.Fatalf(\"Failed to cast observed object to pod\")\n\t\t\t\t}\n\t\t\t\t// calculate the pods in running status\n\t\t\t\tcount := 0\n\t\t\t\tfor i := range podlist.Items {\n\t\t\t\t\t// update pod status in podlist\n\t\t\t\t\tif podlist.Items[i].Name == p.Name {\n\t\t\t\t\t\tutils.Infof(\"PodName: %s PodStatus: %s\", p.Name, p.Status.Phase)\n\t\t\t\t\t\tpodlist.Items[i].Status = p.Status\n\t\t\t\t\t}\n\t\t\t\t\t// check if the pod is in running status\n\t\t\t\t\tif podlist.Items[i].Status.Phase == v1.PodRunning {\n\t\t\t\t\t\tcount++\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// send an end signal when all pods are in running status\n\t\t\t\tif len(podlist.Items) == count {\n\t\t\t\t\tsignal <- struct{}{}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t)\n\n\t// run controoler\n\tpodChan := make(chan struct{})\n\tgo controller.Run(podChan)\n\tdefer close(podChan)\n\n\t// wait for a signal or timeout\n\tselect {\n\tcase <-signal:\n\t\tutils.Infof(\"All pods come into running status\")\n\tcase <-time.After(timout):\n\t\terrInfo := fmt.Sprintf(\"Wait for pods come into running status timeout: %v\", timout)\n\t\treturn errors.NewTimeoutErr(errInfo)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "11f15922de3dbf9175e4f0e3f58eaf5d", "score": "0.4658835", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"podlocality-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &v1.Pod{}}, &handler.EnqueueRequestForObject{}, predicate.Funcs{\n\t\tCreateFunc: func(evt event.CreateEvent) bool {\n\t\t\treturn hasSidecarAnnotation(evt.Object) && hasNode(evt.Object)\n\t\t},\n\t\tDeleteFunc: func(evt event.DeleteEvent) bool { return false },\n\t\tUpdateFunc: func(evt event.UpdateEvent) bool {\n\t\t\treturn hasSidecarAnnotation(evt.ObjectNew) && hasNode(evt.ObjectNew) && !hasNode(evt.ObjectOld)\n\t\t},\n\t\tGenericFunc: func(evt event.GenericEvent) bool { return false },\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = mgr.GetFieldIndexer().IndexField(&v1.Pod{}, \"spec.nodeName\", func(obj apimachineryruntime.Object) []string {\n\t\tpod := obj.(*v1.Pod)\n\t\treturn []string{pod.Spec.NodeName}\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = c.Watch(&source.Kind{Type: &v1.Node{}}, &handler.EnqueueRequestsFromMapFunc{\n\t\tToRequests: handler.ToRequestsFunc(func(a handler.MapObject) []reconcile.Request {\n\t\t\tlist := &v1.PodList{}\n\t\t\terr := mgr.GetClient().List(context.TODO(), client.MatchingField(\"spec.nodeName\", a.Meta.GetName()), list)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err, \"Could not list pods\")\n\t\t\t}\n\n\t\t\tvar requests []reconcile.Request\n\t\t\tfor _, pod := range list.Items {\n\t\t\t\tif podHasSidecar(pod) {\n\t\t\t\t\trequests = append(requests, reconcile.Request{\n\t\t\t\t\t\tNamespacedName: types.NamespacedName{\n\t\t\t\t\t\t\tName: pod.Name,\n\t\t\t\t\t\t\tNamespace: pod.Namespace,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn requests\n\t\t}),\n\t}, predicate.Funcs{\n\t\tCreateFunc: func(evt event.CreateEvent) bool { return evt.Meta != nil },\n\t\tDeleteFunc: func(evt event.DeleteEvent) bool { return false },\n\t\tUpdateFunc: func(evt event.UpdateEvent) bool {\n\t\t\treturn evt.MetaOld != nil && evt.MetaNew != nil &&\n\t\t\t\t(evt.MetaOld.GetLabels()[NodeRegionLabel] != evt.MetaNew.GetLabels()[NodeRegionLabel] ||\n\t\t\t\t\tevt.MetaOld.GetLabels()[NodeZoneLabel] != evt.MetaNew.GetLabels()[NodeZoneLabel])\n\t\t},\n\t\tGenericFunc: func(evt event.GenericEvent) bool { return false },\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0bdd18dbdc39ca13e6e40baa9761198a", "score": "0.4651509", "text": "func (disc *nodeEtcdDiscovery) OnUpdate(old, cur interface{}) {\n\t//do nothing\n}", "title": "" }, { "docid": "e3af49c06a548602ca83945aba018ba0", "score": "0.46403596", "text": "func (c *LiveConnection) On(typ ResponseType, cb LiveListener) {\n\tif typ == WildcardResponse {\n\t\tc.OnError(cb)\n\t\tc.OnInvalidRequest(cb)\n\t\tc.OnKafkaMessage(cb)\n\t\tc.OnHeartbeat(cb)\n\t\tc.OnSuccess(cb)\n\t\treturn\n\t}\n\n\tc.mu.Lock()\n\tc.listeners[typ] = append(c.listeners[typ], cb)\n\tc.mu.Unlock()\n}", "title": "" }, { "docid": "c93891d2956cafb9e872bca68902e6f1", "score": "0.46292433", "text": "func logsAlertmanager() {\n\tlogPod(\"alertmanager\", \"seed\", \"alertmanager\") // TODO: TWO PODS ARE RUNNING\n}", "title": "" }, { "docid": "a307821e63a3883fbaf51fa8aa486dac", "score": "0.46288458", "text": "func (l *Loader) processEvents() {\n\tdefer close(l.watcherDone)\n\tfor event := range l.w.Events() {\n\t\tswitch event := event.(type) {\n\t\tcase watcher.DeleteEvent:\n\t\t\tglog.Infof(\"delete prog %s\", event.Pathname)\n\t\t\tl.UnloadProgram(event.Pathname)\n\t\tcase watcher.UpdateEvent:\n\t\t\tglog.Infof(\"update prog %s\", event.Pathname)\n\t\t\tl.LoadProg(event.Pathname)\n\t\tcase watcher.CreateEvent:\n\t\t\tl.w.Add(event.Pathname)\n\t\tdefault:\n\t\t\tglog.V(1).Infof(\"Unexected event type %+#v\", event)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "40799bb88c724af9c07c78ec3f9a0bc7", "score": "0.4624983", "text": "func (w *Watcher) Run(ctx context.Context) error {\n\tfmt.Printf(\"Watch ReviewDeployment objects\\n\")\n\n\t// Watch Example objects\n\thandler := eventHandler{\n\t\tclientset: w.clientset,\n\t\trdClient: w.reviewDeploymentClient,\n\t}\n\t_, err := watchReviewDeployments(ctx, w.reviewDeploymentClient, w.reviewDeploymentScheme, &handler)\n\tif err != nil {\n\t\tfmt.Printf(\"Failed to register watch for ReviewDeployment resource: %v\\n\", err)\n\t\treturn err\n\t}\n\n\t<-ctx.Done()\n\treturn ctx.Err()\n}", "title": "" }, { "docid": "87e69927e1944aedeb96158783a75da1", "score": "0.46192864", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"knativeeventingkafka-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource KnativeEventingKafka\n\terr = c.Watch(&source.Kind{Type: &eventingv1alpha1.KnativeEventingKafka{}}, &handler.EnqueueRequestForObject{}, predicate.GenerationChangedPredicate{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch child deployments for availability\n\terr = c.Watch(&source.Kind{Type: &appsv1.Deployment{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &eventingv1alpha1.KnativeEventingKafka{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "781eaf0be7b267da337cd1c52b25d44d", "score": "0.46130893", "text": "func (r *ReplicaSetsIncomingReflector) HandleEvent(obj interface{}) {\n\tevent, ok := obj.(watch.Event)\n\tif !ok {\n\t\tklog.Error(\"cannot cast object to event\")\n\t\treturn\n\t}\n\n\tpod, ok := event.Object.(*corev1.Pod)\n\tif !ok {\n\t\tklog.Error(\"INCOMING REFLECTION: wrong type, cannot cast object to pod\")\n\t\treturn\n\t}\n\n\tklog.V(3).Infof(\"INCOMING REFLECTION: received %v for pod %v/%v\", event.Type, pod.Namespace, pod.Name)\n\n\tswitch event.Type {\n\tcase watch.Added, watch.Modified:\n\t\tklog.V(4).Infof(\"INCOMING REFLECTION: event %v for object %v/%v ignored\", event.Type, pod.Namespace, pod.Name)\n\tcase watch.Deleted:\n\t\t// if the event is a delete we enqueue a shadow pod having all the containers status terminated,\n\t\t// for allowing the replicasetController to collect it\n\t\tr.PushToInforming(pod)\n\t\tklog.V(3).Infof(\"INCOMING REFLECTION: delete for replicaset related to home pod %v/%v processed\", pod.Namespace, pod.Name)\n\t}\n}", "title": "" }, { "docid": "e48150a31048380ad2088833e38ab1fa", "score": "0.46128476", "text": "func (p *Plugin) processPodEvent(event containeridx.ChangeEvent) {\n\tp.Lock()\n\tdefer p.Unlock()\n\n\tvar err error\n\tif !event.Del {\n\t\treturn\n\t}\n\tnsmap, exists := p.podIfs[event.Value.PodNamespace]\n\tif !exists {\n\t\treturn\n\t}\n\tifs, exists := nsmap[event.Value.PodName]\n\tif !exists {\n\t\treturn\n\t}\n\tfor _, key := range ifs {\n\t\tentry, exists := p.ifStats[key]\n\t\tif exists && entry != nil {\n\t\t\t// remove gauge with corresponding labels from each vector\n\t\t\tfor _, vec := range p.gaugeVecs {\n\t\t\t\tvec.Delete(prometheus.Labels{\n\t\t\t\t\tpodNameLabel: entry.podName,\n\t\t\t\t\tpodNamespaceLabel: entry.podNamespace,\n\t\t\t\t\tinterfaceNameLabel: entry.data.Name,\n\t\t\t\t})\n\t\t\t\tif err != nil {\n\t\t\t\t\tp.Log.Error(err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tdelete(p.ifStats, key)\n\t}\n}", "title": "" }, { "docid": "9a5e3c3de44939c7bfd834cb1a36d37f", "score": "0.4604876", "text": "func (m *Manager) OnUpdate(_, newObj interface{}) {\n\tm.OnAdd(newObj)\n}", "title": "" }, { "docid": "98ec3cb56b3bfb43ecbb0cf81e1da98e", "score": "0.45930433", "text": "func (s *OsdServer) Start(ctx context.Context) error {\n\n\t//workersCtx := context.Background()\n\tworkersCtx := s.AnnotateCtx(ctx)\n\t//s.stopper.RunWorker(workersCtx, func(context.Context) {\n\t//\t<-s.stopper.ShouldQuiesce()\n\t//\t// TODO(bdarnell): Do we need to also close the other listeners?\n\t//\tln.Close()\n\t//\t<-s.stopper.ShouldStop()\n\t//\ts.grpc.Stop()\n\t//})\n\n\t//s.pgMaps\n\tpgmaps, err := getPgMaps(0)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.pgMaps = pgmaps\n\thelper.Println(5, \"pgmaps.epoch:\", pgmaps.Epoch, \" pool count:\", len(pgmaps.Pgmaps))\n\n\tpoolMap, err := s.GetPoolMap()\n\tif err != nil {\n\t\thelper.Check(err)\n\t}\n\tfor _, pool := range poolMap.Pools {\n\t\thelper.Println(5, \"pool name:\", pool.Name, \" size:\", pool.Size_)\n\t}\n\ts.poolMap = poolMap\n\n\t//s.initPGState(pgmaps)\n\ts.createOrRemoveReplica(pgmaps)\n\n\ts.stopper.RunWorker(workersCtx, func(context.Context) {\n\t\ttime.Sleep(1 * time.Second)\n\t\ts.grpc.Serve(Listener)\n\t})\n\n\ts.stopper.RunWorker(workersCtx, func(context.Context) {\n\t\treportTicker := time.NewTicker(OSD_STATUS_REPORT_PERIOD)\n\t\tdefer reportTicker.Stop()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-reportTicker.C:\n\t\t\t\tmon := memberlist.GetLeaderMon()\n\t\t\t\tif mon == nil {\n\t\t\t\t\thelper.Println(5, \"can not get primary mon addr yet!\")\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\ts.sendOsdStatusToMon(mon.Addr)\n\t\t\tcase <-s.stopper.ShouldStop():\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t})\n\n\treturn nil\n}", "title": "" }, { "docid": "f2ece236fff9bcf46d8d09d63c300864", "score": "0.4586835", "text": "func (p *Playlist) watch(plr *Player) {\n\tdefer p.watcher.Close()\n\tsend := plr.ConnControl.getChanSend()\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-p.watcher.Events:\n\t\t\t// This means a file changed in the folder.\n\t\t\tif !ok {\n\t\t\t\tlog.Println(\"issue getting file change event. Stopping watcher.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif plr.conf.Debug {\n\t\t\t\tlog.Println(\"file change event:\", event)\n\t\t\t}\n\t\t\t// Send a message to the viewer to get new items.\n\t\t\tmsg := wsMessage{\n\t\t\t\tComponent: \"playlist\",\n\t\t\t\tEvent: \"newItems\",\n\t\t\t\tMessage: \"detected file change. Get new items.\",\n\t\t\t}\n\t\t\tsend <- msg\n\t\tcase err, ok := <-p.watcher.Errors:\n\t\t\tif !ok {\n\t\t\t\tlog.Println(\"issue getting file change error. Stopping watcher.\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Println(\"error:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3d0236015aed5c615c93dc7c6625ecce", "score": "0.45864123", "text": "func (c *Controller) updateEvent(e *utils.Event) {\n\n\tif e.Reason == \"deleted\" {\n\t\tif e.Kind == \"pod\" {\n\t\t\tpod := c.Pods[e.Name]\n\t\t\tpod.Service.Pods = utils.DeletePodNameOnce(pod.Service.Pods, e.Name)\n\t\t\tpod.Node.Pods = utils.DeletePodNameOnce(pod.Node.Pods, e.Name)\n\t\t\tdelete(c.Pods, e.Name)\n\t\t} else if e.Kind == \"service\" {\n\t\t\tdelete(c.Services, e.Name)\n\t\t} else if e.Kind == \"machine\" {\n\t\t\tdelete(c.Nodes, e.Name)\n\t\t}\n\t} else if e.Reason == \"created\" {\n\t\tatomic.StoreInt32(&c.UpdateRequest, 1)\n\t\tif e.Kind == \"machine\" {\n\t\t\te.Message = \"A new machine has been created: \" + e.Name\n\t\t}\n\t} else if e.Reason == \"updated\" {\n\t\tatomic.StoreInt32(&c.UpdateRequest, 1)\n\t}\n\n\tc.checkTriggers()\n}", "title": "" }, { "docid": "72c31b75427d7ffac18264d04a85c2bf", "score": "0.45770887", "text": "func (mr *MockSnapshotMockRecorder) Pods() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Pods\", reflect.TypeOf((*MockSnapshot)(nil).Pods))\n}", "title": "" }, { "docid": "25bfc2701c770cd8d01dffbaeaa2ca06", "score": "0.45764503", "text": "func (pc *PodController) handleAddUpdatePod(obj interface{}) error {\n\tvar err error\n\tvar podCNIInfo *cnipodcache.CNIConfigInfo\n\tpod := obj.(*corev1.Pod)\n\tif len(pod.Status.PodIPs) == 0 {\n\t\t// Primary network configuration is not complete yet.\n\t\t// Note: Return nil here to unqueue Pod add event. Secondary network configuration will be handled with Pod update event.\n\t\treturn nil\n\t}\n\tsecondaryNetwork, ok := checkForPodSecondaryNetworkAttachement(pod)\n\tif !ok {\n\t\t// NOTE: We do not handle Pod annotation deletion/update scenario at present.\n\t\tklog.InfoS(\"Pod does not have a NetworkAttachmentDefinition\", \"Pod\", klog.KObj(pod))\n\t\treturn nil\n\t}\n\t// Retrieve Pod specific cache entry which has \"PodCNIDeleted = false\"\n\tif podCNIInfo = pc.podCache.GetValidCNIConfigInfoPerPod(pod.Name, pod.Namespace); podCNIInfo == nil {\n\t\treturn nil\n\t}\n\t// Valid cache entry retrieved from cache and we received a Pod add or update event.\n\t// Avoid processing Pod annotation, if we already have at least one secondary network successfully configured on this Pod.\n\t// We do not support/handle Annotation updates yet.\n\tif len(podCNIInfo.NetworkConfig) > 0 {\n\t\tklog.InfoS(\"Secondary network already configured on this Pod and annotation update not supported, skipping update\", \"pod\", klog.KObj(pod))\n\t\treturn nil\n\t}\n\t// Parse Pod annotation and proceed with the secondary network configuration.\n\tnetworklist, err := netdefutils.ParseNetworkAnnotation(secondaryNetwork, pod.Namespace)\n\tif err != nil {\n\t\tklog.ErrorS(err, \"Error when parsing network annotation\", \"annotation\", secondaryNetwork)\n\t\t// Do not return an error as a retry is not appropriate.\n\t\t// When the annotation is fixed, the Pod will be enqueued again.\n\t\treturn nil\n\t}\n\n\terr = pc.configureSecondaryNetwork(pod, networklist, podCNIInfo)\n\t// We do not return error to retry, if at least one secondary network is configured.\n\tif (err != nil) && (len(podCNIInfo.NetworkConfig) == 0) {\n\t\t// Return error to requeue and retry.\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3679c7179cceb4c9e43ece3db82b005b", "score": "0.4575588", "text": "func WatchPodStatus(podNamespace string, labelKey string, labelValue string, timeout int, checkOp string) (string, error) {\n\tif checkOp != string(watch.Deleted) && checkOp != string(watch.Added) {\n\t\tfmt.Errorf(\"Params checkOp err, checkOp: %v\", checkOp)\n\t}\n\n\t//opts := api.ListOptions{FieldSelector: fields.Set{\"kind\": \"pod\"}.AsSelector()}\n\topts := api.ListOptions{LabelSelector: labels.Set{labelKey: labelValue}.AsSelector()}\n\n\tw, err := CLIENT.Pods(podNamespace).Watch(opts)\n\tif err != nil {\n\t\tfmt.Errorf(\"Get watch interface err\")\n\t\treturn \"\", err\n\t}\n\n\tt := time.NewTimer(time.Second * time.Duration(timeout))\n\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-w.ResultChan():\n\t\t\t//fmt.Println(event.Type)\n\t\t\tif !ok {\n\t\t\t\tfmt.Errorf(\"Watch err\\n\")\n\t\t\t\treturn \"\", errors.New(\"error occours from watch chanle\")\n\t\t\t}\n\t\t\t//fmt.Println(event.Type)\n\t\t\t// Pod have phase, so we have to wait for the phase change to the right status when added\n\t\t\tif string(event.Type) == checkOp {\n\t\t\t\tif (checkOp == string(watch.Deleted)) || ((checkOp != string(watch.Deleted)) &&\n\t\t\t\t\t(event.Object.(*api.Pod).Status.Phase == \"running\")) {\n\t\t\t\t\treturn \"OK\", nil\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase <-t.C:\n\t\t\treturn \"TIMEOUT\", nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b32c0ba31170a9fd849f48b7c8384560", "score": "0.45751193", "text": "func checkPods(client kubernetes.Interface, cr *storageosv1.Job, recorder record.EventRecorder) (bool, error) {\n\tpodListOpts := metav1.ListOptions{\n\t\tLabelSelector: cr.Spec.GetLabelSelector(),\n\t}\n\n\tpods, err := client.CoreV1().Pods(cr.GetNamespace()).List(context.TODO(), podListOpts)\n\tif err != nil {\n\t\tlog.Info(\"Failed to get pods\", \"error\", err)\n\t\treturn false, err\n\t}\n\n\ttotalPods := len(pods.Items)\n\tcompletedPods := 0\n\n\t// Skip if there are no daemonset-job pods.\n\tif totalPods == 0 {\n\t\tlog.Info(\"No DaemonSets found\")\n\t\treturn false, nil\n\t}\n\n\topts := &corev1.PodLogOptions{}\n\n\tfor _, p := range pods.Items {\n\t\treq := client.CoreV1().Pods(p.GetNamespace()).GetLogs(p.GetName(), opts)\n\t\tlogText, err := getPlainLogs(req)\n\t\tif err != nil {\n\t\t\tlog.Info(\"Failed to get logs from pod\", \"pod\", p.GetName(), \"error\", err)\n\t\t\t// Continue checking other pods.\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.Contains(logText, cr.Spec.CompletionWord) {\n\t\t\tcompletedPods++\n\t\t}\n\t}\n\n\tif totalPods == completedPods {\n\t\trecorder.Event(cr, corev1.EventTypeNormal, \"JobCompleted\", \"Job Completed. Safe to delete.\")\n\t\treturn true, nil\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "3c5dd521acd119de2fdf810c28d51597", "score": "0.45704687", "text": "func pgListen() {\n\tfor notif := range listener.Notify {\n\t\t//log.Debug(\"message recieved\")\n\t\tpr := &publisherRequest{\n\t\t\tchanName: notif.Channel,\n\t\t\tresponse: make(chan *publisher),\n\t\t}\n\t\tpublishers.get <- pr\n\t\tpub := <-pr.response\n\t\tif pr != nil {\n\t\t\tpub.publish <- []byte(notif.Extra)\n\t\t}\n\t}\n\n\tlog.Error(\"Lost database connection ?!\")\n}", "title": "" }, { "docid": "ea6e838dad75cc62c1e6f267754bf2f8", "score": "0.4564919", "text": "func (i *NodeInfo) Pods() []*v1.Pod {\n\ti.lock.RLock()\n\tdefer i.lock.RUnlock()\n\n\treturn i.pods\n}", "title": "" }, { "docid": "f63eb1a7348791dd4bf63cbf4d79ff07", "score": "0.45567328", "text": "func PodsRunning(podList *corev1.PodList) (bool, error) {\n\tvar names []string\n\tfor _, p := range podList.Items {\n\t\tnames = append(names, p.Name)\n\t}\n\tlog.Printf(\"Checking pods: %v\", names)\n\tfor _, pod := range podList.Items {\n\t\tif pod.Status.Phase != corev1.PodRunning && pod.Status.Phase != corev1.PodSucceeded {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "80931a386ec0b3cf53925f1dd32af2e6", "score": "0.45566308", "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": "efd13514a9568145b124dd7c58770392", "score": "0.45518115", "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": "4cedf8e7fbb63133afabda099dfcbbb6", "score": "0.45489097", "text": "func GetPodEvents(client kubernetes.Interface, namespace, podName string) ([]v1.Event, error) {\n\n\tchannels := &common.ResourceChannels{\n\t\tPodList: common.GetPodListChannel(client,\n\t\t\tcommon.NewSameNamespaceQuery(namespace),\n\t\t\t1),\n\t\tEventList: common.GetEventListChannel(client, common.NewSameNamespaceQuery(namespace), 1),\n\t}\n\n\tpodList := <-channels.PodList.List\n\tif err := <-channels.PodList.Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\teventList := <-channels.EventList.List\n\tif err := <-channels.EventList.Error; err != nil {\n\t\treturn nil, err\n\t}\n\n\tl := make([]v1.Pod, 0)\n\tfor _, pi := range podList.Items {\n\t\tif pi.Name == podName {\n\t\t\tl = append(l, pi)\n\t\t}\n\t}\n\n\tevents := filterEventsByPodsUID(eventList.Items, l)\n\treturn FillEventsType(events), nil\n}", "title": "" }, { "docid": "8828cc498fba6e63bd06481ff503f331", "score": "0.45473507", "text": "func (st *StoreImpl) WatchForDeletablePods(ctx context.Context) <-chan string {\n\tq := st.machinesCollection.Where(\"ScheduledForDeletion\", \">\", \"\").Where(\"RunningSwarmingTask\", \"==\", false)\n\tch := make(chan string)\n\tgo func() {\n\t\tdefer close(ch)\n\t\tfor qsnap := range firestore.QuerySnapshotChannel(ctx, q) {\n\t\t\tfor {\n\t\t\t\tsnap, err := qsnap.Documents.Next()\n\t\t\t\tif err == iterator.Done {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\tsklog.Errorf(\"Failed to read document snapshot: %s\", err)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvar storeDescription storeDescription\n\t\t\t\tif err := snap.DataTo(&storeDescription); err != nil {\n\t\t\t\t\tsklog.Errorf(\"Failed to read data from snapshot: %s\", err)\n\t\t\t\t\tst.watchForDeletablePodsDataToErrorCounter.Inc(1)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tmachineDescription := convertFSDescription(storeDescription)\n\t\t\t\tst.watchForDeletablePodsReceiveSnapshotCounter.Inc(1)\n\t\t\t\tch <- machineDescription.PodName\n\t\t\t}\n\t\t}\n\t}()\n\treturn ch\n}", "title": "" }, { "docid": "573e38ea5995e4006cc765a15e23d836", "score": "0.45469958", "text": "func rotatePods(cs k8s.Client, events chan string, pods []k8s.Pod, labelSelector map[string]string) error {\n\tfor podIndex, pod := range pods {\n\t\tevents <- fmt.Sprintf(\"rotating %s on %s\", pod.Name, pod.Status.HostIP)\n\t\tif err := cs.DeletePod(pod.Namespace, pod.Name); err != nil {\n\t\t\treturn maskAny(err)\n\t\t}\n\t\tisNewPodRunning := false\n\t\tstart := time.Now()\n\t\tfor !isNewPodRunning {\n\t\t\tlist, err := cs.ListPods(pod.Namespace, &k8s.ListOptions{LabelSelector: k8s.LabelSelector{MatchLabels: labelSelector}})\n\t\t\tif err != nil {\n\t\t\t\treturn maskAny(err)\n\t\t\t}\n\t\t\tfor _, newPod := range list.Items {\n\t\t\t\tif newPod.Status.HostIP != pod.Status.HostIP || newPod.Name == pod.Name {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tswitch newPod.Status.Phase {\n\t\t\t\tcase k8s.PodPending:\n\t\t\t\t\tevents <- fmt.Sprintf(\"pod (%d/%d) %s on %s is pending\", podIndex+1, len(pods), newPod.Name, newPod.Status.HostIP)\n\t\t\t\tcase k8s.PodRunning:\n\t\t\t\t\tisNewPodRunning = true\n\t\t\t\t\tevents <- fmt.Sprintf(\"pod (%d/%d) %s on %s is running\", podIndex+1, len(pods), newPod.Name, newPod.Status.HostIP)\n\t\t\t\tcase k8s.PodSucceeded:\n\t\t\t\t\tisNewPodRunning = true\n\t\t\t\t\tevents <- fmt.Sprintf(\"pod (%d/%d) %s on %s has finished\", podIndex+1, len(pods), newPod.Name, newPod.Status.HostIP)\n\t\t\t\tcase k8s.PodFailed:\n\t\t\t\t\treturn maskAny(fmt.Errorf(\"Pod %s failed: %s\", newPod.Name, newPod.Status.Message))\n\t\t\t\tdefault:\n\t\t\t\t}\n\t\t\t}\n\t\t\tif time.Since(start) > daemonSetPodStartTimeout {\n\t\t\t\treturn maskAny(fmt.Errorf(\"Pod start timeout on %s\", pod.Status.HostIP))\n\t\t\t}\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t\t// Wait a bit more\n\t\ttime.Sleep(time.Second * 5)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f961d905605991af8b7129aed0e1305", "score": "0.4545675", "text": "func (c *CoreV1Client) Pods(namespace string) PodInterface {\n\treturn newPods(c, namespace)\n}", "title": "" }, { "docid": "4775ccdb0d0e524cf9a03b5a39d554d7", "score": "0.45449978", "text": "func (p *PodLogs) followRun(pods []corev1.Pod) {\n\tignored := ignoredPods(p.Ignored)\n\tfor _, pod := range pods {\n\t\tif ok, watcher, err := p.IsWatcherInTheDB(pod.Name); !ok && err == nil &&\n\t\t\tpod.Status.Phase == \"Running\" &&\n\t\t\t!ignored.isIgnored(pod) && !checkAnnotation(pod.Annotations) {\n\t\t\tch, err := p.AddWatcherToDb(pod.Name)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tgo p.Run(pod.Name, ch, \"\")\n\t\t} else if ok && err == nil && pod.Status.Phase != \"Running\" || ok && ignored.isIgnored(pod) {\n\t\t\tp.Stop(watcher.Chan)\n\t\t} else if err != nil {\n\t\t\tlog.Error(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cb79367740e8fec6f8dc952e43d7e1ef", "score": "0.45448318", "text": "func (r *ReconcileSnatLocalInfo) handlePodEvent(request reconcile.Request) (reconcile.Result, error) {\n\t// Podname: name of the pod for which loop was triggered\n\t// PolicyName: name of the snatPolicy for respective pod\n\tpodName, snatPolicyName, resType, snatIp := GetPodNameFromReoncileRequest(request.Name)\n\t// This is to match the Service\n\t// Query this pod using k8s client\n\tfoundPod := &corev1.Pod{}\n\terr := r.client.Get(context.TODO(), types.NamespacedName{Name: podName, Namespace: request.Namespace}, foundPod)\n\tif err != nil && errors.IsNotFound(err) {\n\t\tlog.V(1).Info(\"Deleted\", \"Pod: \", request.Name)\n\t\treturn reconcile.Result{}, nil\n\t} else if err != nil {\n\t\treturn reconcile.Result{}, err\n\t}\n\tsnatPolicy, err := utils.GetSnatPolicyCR(r.client, snatPolicyName)\n\tif err != nil {\n\t\tlog.Error(err, \"not matching snatpolicy\")\n\t\treturn reconcile.Result{}, err\n\t}\n\tif snatPolicy.GetDeletionTimestamp() != nil {\n\t\treturn reconcile.Result{}, nil\n\t}\n\n\tlocalInfo, err := utils.GetLocalInfoCR(r.client, foundPod.Spec.NodeName, os.Getenv(\"ACI_SNAT_NAMESPACE\"))\n\tif err != nil {\n\t\tlog.Error(err, \"localInfo error\")\n\t}\n\tif foundPod.GetObjectMeta().GetDeletionTimestamp() != nil {\n\t\tif _, ok := localInfo.Spec.LocalInfos[string(foundPod.ObjectMeta.UID)]; ok {\n\t\t\tnodeName := foundPod.Spec.NodeName\n\t\t\tsnatIp := localInfo.Spec.LocalInfos[string(foundPod.ObjectMeta.UID)].SnatIp\n\t\t\tdelete(localInfo.Spec.LocalInfos, string(foundPod.ObjectMeta.UID))\n\t\t\tlog.V(1).Info(\"Delete being processed for\", \"Pod: \", request.Name)\n\t\t\tif len(localInfo.Spec.LocalInfos) == 0 {\n\t\t\t\tlog.Info(\"SnatLocalInfo is deleted: \", \"Update Snat Policy Status: \", nodeName)\n\t\t\t\tif utils.UpdateSnatPolicyStatus(nodeName, &snatPolicy, snatIp, r.client) {\n\t\t\t\t\tif snatPolicy.Status.State == aciv1.IpPortsExhausted {\n\t\t\t\t\t\tsnatPolicy.Status.State = aciv1.Ready\n\t\t\t\t\t}\n\t\t\t\t\terr = r.client.Status().Update(context.TODO(), &snatPolicy)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Error(err, \"Policy status update failed\")\n\t\t\t\t\t\treturn reconcile.Result{}, err\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn utils.UpdateLocalInfoCR(r.client, localInfo)\n\t\t}\n\t\treturn reconcile.Result{}, nil\n\t} else if _, ok := localInfo.Spec.LocalInfos[string(foundPod.ObjectMeta.UID)]; ok {\n\t\tif resType == POD || localInfo.Spec.LocalInfos[string(foundPod.ObjectMeta.UID)].SnatScope == POD {\n\t\t\tif utils.MatchLabels(snatPolicy.Spec.Selector.Labels, foundPod.ObjectMeta.Labels) == false {\n\t\t\t\tlog.Info(\"Label delete being processed for\", \"Pod: \", request.Name)\n\t\t\t\tnodeName := foundPod.Spec.NodeName\n\t\t\t\tsnatIp := localInfo.Spec.LocalInfos[string(foundPod.ObjectMeta.UID)].SnatIp\n\t\t\t\tdelete(localInfo.Spec.LocalInfos, string(foundPod.ObjectMeta.UID))\n\t\t\t\trefpolicy := false\n\t\t\t\t// check for refrences for this any policy in localinfo\n\t\t\t\tfor _, local := range localInfo.Spec.LocalInfos {\n\t\t\t\t\tif local.SnatPolicyName == snatPolicyName {\n\t\t\t\t\t\trefpolicy = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !refpolicy {\n\t\t\t\t\tlog.Info(\"SnatLocalInfo is deleted: \", \"Update snat policy status:\", nodeName)\n\t\t\t\t\tif snatPolicy.Status.State == aciv1.IpPortsExhausted {\n\t\t\t\t\t\tsnatPolicy.Status.State = aciv1.Ready\n\t\t\t\t\t}\n\t\t\t\t\tif utils.UpdateSnatPolicyStatus(nodeName, &snatPolicy, snatIp, r.client) {\n\t\t\t\t\t\terr = r.client.Status().Update(context.TODO(), &snatPolicy)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Error(err, \"Policy status update failed\")\n\t\t\t\t\t\t\treturn reconcile.Result{}, err\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn utils.UpdateLocalInfoCR(r.client, localInfo)\n\t\t\t}\n\t\t}\n\t}\n\tif foundPod.Status.Phase == \"Running\" {\n\t\tportinuse := make(map[string][]aciv1.NodePortRange)\n\t\tif len(snatPolicy.Status.SnatPortsAllocated) != 0 {\n\t\t\tportinuse = snatPolicy.Status.SnatPortsAllocated\n\t\t}\n\t\tportrange := aciv1.PortRange{}\n\t\texists := false\n\t\tif snatIp == \"\" {\n\t\t\tsnatIp, portrange, exists =\n\t\t\t\tutils.GetIPPortRangeForPod(r.client, foundPod.Spec.NodeName, &snatPolicy)\n\t\t} else {\n\t\t\tportrange, exists =\n\t\t\t\tutils.GetPortRangeForServiceIP(r.client, foundPod.Spec.NodeName, &snatPolicy, snatIp)\n\t\t}\n\t\tif exists == false && !reflect.DeepEqual(portrange, aciv1.PortRange{}) {\n\t\t\tvar nodePortRnage aciv1.NodePortRange\n\t\t\tnodePortRnage.NodeName = foundPod.Spec.NodeName\n\t\t\tnodePortRnage.PortRange = portrange\n\t\t\tportinuse[snatIp] = append(portinuse[snatIp], nodePortRnage)\n\t\t\tsnatPolicy.Status.SnatPortsAllocated = portinuse\n\t\t\tlog.V(1).Info(\"Port range updated\", \"List of ports inuse: \", portinuse)\n\t\t\terr = r.client.Status().Update(context.TODO(), &snatPolicy)\n\t\t\tif err != nil {\n\t\t\t\treturn reconcile.Result{}, err\n\t\t\t}\n\t\t}\n\t\t_, updated, err1 := r.addLocalInfo(&localInfo, foundPod, &snatPolicy, resType, snatIp)\n\t\tif err1 != nil {\n\t\t\tlog.Error(err, \"Adding localInfo error\")\n\t\t\treturn reconcile.Result{}, err\n\t\t}\n\t\tif updated {\n\t\t\tlog.V(1).Info(\"SnatLocalInfo update for\", \"Pod: \", foundPod.ObjectMeta.Name)\n\t\t\treturn utils.UpdateLocalInfoCR(r.client, localInfo)\n\t\t}\n\t}\n\treturn reconcile.Result{}, nil\n}", "title": "" }, { "docid": "2acfa338a317e85305a0c880c021d517", "score": "0.45392594", "text": "func (kc *KubernetesPodController) enqueuePodChange(obj interface{}) {\n\tkey, err := controller.KeyFunc(obj)\n\tif err != nil {\n\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get key for object %#v: %v\", obj, err))\n\t\treturn\n\t}\n\n\tpod, ok := obj.(*v1.Pod)\n\tif !ok {\n\t\tdeletedState, ok := obj.(cache.DeletedFinalStateUnknown)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"received unexpected obj: %#v\", obj))\n\t\t\treturn\n\t\t}\n\n\t\t// use the last known state, to enqueue, dependent objects\n\t\tpod, ok = deletedState.Obj.(*v1.Pod)\n\t\tif !ok {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"DeletedFinalStateUnknown contained invalid object: %#v\", deletedState.Obj))\n\t\t\treturn\n\t\t}\n\t}\n\n\tfor _, v := range pod.Spec.Volumes {\n\t\tif v.VolumeSource.PersistentVolumeClaim == nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tpvc, err := kc.ds.GetPersistentVolumeClaimRO(pod.Namespace, v.VolumeSource.PersistentVolumeClaim.ClaimName)\n\t\tif datastore.ErrorIsNotFound(err) {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"couldn't get key for object %#v: %v\", pvc, err))\n\t\t\treturn\n\t\t}\n\n\t\tpv, err := kc.getAssociatedPersistentVolume(pvc)\n\t\tif datastore.ErrorIsNotFound(err) {\n\t\t\tcontinue\n\t\t}\n\t\tif err != nil {\n\t\t\tutilruntime.HandleError(fmt.Errorf(\"error getting Persistent Volume for PVC: %v\", pvc))\n\t\t\treturn\n\t\t}\n\n\t\tif pv.Spec.CSI != nil && pv.Spec.CSI.Driver == types.LonghornDriverName {\n\t\t\tkc.queue.Add(key)\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3f431bac96c0b866e06c5be77aa39349", "score": "0.45388746", "text": "func (client *RoClient) WatchDSCRolloutUpdates() error {\n\tclient.Lock()\n\tdefer client.Unlock()\n\tclient.Add(1)\n\t// start watching objects\n\tclient.watcherRunning = true\n\tgo client.runDSCRolloutWatcher(client.watchCtx)\n\treturn nil\n}", "title": "" }, { "docid": "96b7382b174ba8f656bc0be01ae1d730", "score": "0.4538549", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"weatherservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource WeatherService\n\terr = c.Watch(&source.Kind{Type: &weatherservicev1alpha1.WeatherService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner WeatherService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &weatherservicev1alpha1.WeatherService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "93ccf008b484c255a90a987acc533910", "score": "0.45334262", "text": "func (s *service) Listen(req *pb.ListenRequest, server pb.API_ListenServer) error {\n\tst, err := s.getStore(req.StoreID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toptions := make([]store.ListenOption, len(req.GetFilters()))\n\tfor i, filter := range req.GetFilters() {\n\t\tvar listenActionType store.ListenActionType\n\t\tswitch filter.GetAction() {\n\t\tcase pb.ListenRequest_Filter_ALL:\n\t\t\tlistenActionType = store.ListenAll\n\t\tcase pb.ListenRequest_Filter_CREATE:\n\t\t\tlistenActionType = store.ListenCreate\n\t\tcase pb.ListenRequest_Filter_DELETE:\n\t\t\tlistenActionType = store.ListenDelete\n\t\tcase pb.ListenRequest_Filter_SAVE:\n\t\t\tlistenActionType = store.ListenSave\n\t\tdefault:\n\t\t\treturn status.Errorf(codes.InvalidArgument, \"invalid filter action %v\", filter.GetAction())\n\t\t}\n\t\toptions[i] = store.ListenOption{\n\t\t\tType: listenActionType,\n\t\t\tModel: filter.GetModelName(),\n\t\t\tID: corestore.EntityID(filter.EntityID),\n\t\t}\n\t}\n\n\tl, err := st.Listen(options...)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer l.Close()\n\n\tfor {\n\t\terr = nil\n\t\tselect {\n\t\tcase <-server.Context().Done():\n\t\t\treturn nil\n\t\tcase action, ok := <-l.Channel():\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t\tvar replyAction pb.ListenReply_Action\n\t\t\tvar entity []byte\n\t\t\tswitch action.Type {\n\t\t\tcase store.ActionCreate:\n\t\t\t\treplyAction = pb.ListenReply_CREATE\n\t\t\t\tentity, err = s.entityForAction(st, action)\n\t\t\tcase store.ActionDelete:\n\t\t\t\treplyAction = pb.ListenReply_DELETE\n\t\t\tcase store.ActionSave:\n\t\t\t\treplyAction = pb.ListenReply_SAVE\n\t\t\t\tentity, err = s.entityForAction(st, action)\n\t\t\tdefault:\n\t\t\t\terr = status.Errorf(codes.Internal, \"unknown action type %v\", action.Type)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treply := &pb.ListenReply{\n\t\t\t\tModelName: action.Model,\n\t\t\t\tEntityID: action.ID.String(),\n\t\t\t\tAction: replyAction,\n\t\t\t\tEntity: entity,\n\t\t\t}\n\t\t\tif err := server.Send(reply); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5eb951ba18fc4d409455a05194f04c8d", "score": "0.45316392", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"hadoopservice-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource HadoopService\n\terr = c.Watch(&source.Kind{Type: &alicek106v1alpha1.HadoopService{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner HadoopService\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &alicek106v1alpha1.HadoopService{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab942bc7facf7111b8a754c3afabab33", "score": "0.45306388", "text": "func (s *Server) updatePodStatuses() {\n\t// Update all the pods with the provider status.\n\tpods := s.resourceManager.GetPods()\n\tfor _, pod := range pods {\n\t\tif pod.DeletionTimestamp != nil && pod.Status.Phase == corev1.PodSucceeded {\n\t\t\tcontinue\n\t\t}\n\n\t\tstatus, err := s.provider.GetPodStatus(pod.Namespace, pod.Name)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error retrieving pod '%s' status from provider: %s\\n\", pod.Name, err)\n\t\t\treturn\n\t\t}\n\n\t\t// Update the pod's status\n\t\tif status != nil {\n\t\t\tpod.Status = *status\n\t\t\ts.k8sClient.CoreV1().Pods(pod.Namespace).UpdateStatus(pod)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ef523008c3fbe85ae1c21dd2b867831b", "score": "0.45274687", "text": "func (s *State) Listen(ctxw context.Context) error {\n\t// First loop over already known containers\n\tctx := context.Background()\n\tctxCont := context.Background()\n\tcontainers, err := s.watcher.Container.Containers(ctx, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, container := range containers {\n\t\tgo func(docker *client.Client, id string) {\n\t\t\tctx := context.Background()\n\t\t\tcontc, err := s.watcher.Container.LoadContainer(ctxCont, id)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tinfo, err := contc.Info(ctxCont)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfmt.Println(\"info spec: \", info.Spec)\n\t\t\tcont, err := docker.ContainerInspect(ctx, id)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfor _, h := range s.watcher.startHandlers {\n\t\t\t\th.handler(&cont, nil)\n\t\t\t}\n\t\t}(s.watcher.Docker, container.ID())\n\t}\n\t// Then watch for docker events\n\ts.watcher.Listen(ctxw)\n\treturn nil\n}", "title": "" }, { "docid": "7fb3ce276e5099d4eac3c427a9b348ab", "score": "0.4523608", "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": "c7459bc199817d41141f4d70155bdbce", "score": "0.45187083", "text": "func (e *evtServices) startWatcher(cl apiclient.Services) {\n\tvar watcher kvstore.Watcher\n\n\tii := 0\nrolloutActionWatcher:\n\tfor {\n\t\tselect {\n\t\tcase <-e.ctx.Done():\n\t\t\treturn\n\t\tdefault:\n\t\t\trolloutActions, err := cl.RolloutV1().RolloutAction().List(e.ctx, &api.ListWatchOptions{})\n\t\t\tif err != nil {\n\t\t\t\te.logger.Errorf(\"failed to list rollout action, err: %v\", err)\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif len(rolloutActions) == 0 { // no rollout action object found\n\t\t\t\te.setMaintenanceMode(false)\n\t\t\t}\n\n\t\t\tif watcher, err = cl.RolloutV1().RolloutAction().Watch(e.ctx, &api.ListWatchOptions{}); err == nil {\n\t\t\t\tbreak rolloutActionWatcher\n\t\t\t}\n\n\t\t\tii++\n\t\t\tif ii%10 == 0 {\n\t\t\t\te.logger.Errorf(\"waiting for rollout action watch to succeed for %v seconds\", ii)\n\n\t\t\t}\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}\n\te.logger.Info(\"rollout action watcher established\")\n\n\t// handle rollout watcher events\n\tfor {\n\t\tselect {\n\t\tcase <-e.ctx.Done():\n\t\t\treturn\n\t\tcase event, ok := <-watcher.EventChan():\n\t\t\tif !ok { // restart\n\t\t\t\te.logger.Errorf(\"error receiving from rollout action watch channel, exiting watcher\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\trolloutAcObj, ok := event.Object.(*rollout.RolloutAction)\n\t\t\tif !ok {\n\t\t\t\te.logger.Info(\"watcher failed to get rollout action object\")\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\te.logger.Infof(\"received rollout action watch event: %v, %v\", event.Type, rolloutAcObj)\n\t\t\tswitch event.Type {\n\t\t\tcase kvstore.Created, kvstore.Updated:\n\t\t\t\tswitch rollout.RolloutStatus_RolloutOperationalState(rollout.RolloutStatus_RolloutOperationalState_vvalue[rolloutAcObj.Status.OperationalState]) {\n\t\t\t\tcase rollout.RolloutStatus_PROGRESSING, rollout.RolloutStatus_SUSPEND_IN_PROGRESS:\n\t\t\t\t\te.setMaintenanceMode(true)\n\t\t\t\tcase rollout.RolloutStatus_SUCCESS, rollout.RolloutStatus_SUSPENDED, rollout.RolloutStatus_FAILURE, rollout.RolloutStatus_DEADLINE_EXCEEDED:\n\t\t\t\t\te.setMaintenanceMode(false)\n\t\t\t\tcase rollout.RolloutStatus_SCHEDULED, rollout.RolloutStatus_PRECHECK_IN_PROGRESS:\n\t\t\t\t\te.setMaintenanceMode(false)\n\t\t\t\t}\n\t\t\tcase kvstore.Deleted:\n\t\t\t\te.setMaintenanceMode(false)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e3c51d3bfe525085ed33329665d9f3ca", "score": "0.45168018", "text": "func c_inotify_add_watch(fd _C_int, pathname *byte, mask uint32) _C_int", "title": "" }, { "docid": "9716ad7f99b069e7512131bee8042683", "score": "0.45160833", "text": "func add(mgr manager.Manager, r reconcile.Reconciler) error {\n\t// Create a new controller\n\tc, err := controller.New(\"appengine-controller\", mgr, controller.Options{Reconciler: r})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Watch for changes to primary resource Appengine\n\terr = c.Watch(&source.Kind{Type: &knapv1alpha1.Appengine{}}, &handler.EnqueueRequestForObject{})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(user): Modify this to be the types you create that are owned by the primary resource\n\t// Watch for changes to secondary resource Pods and requeue the owner Appengine\n\terr = c.Watch(&source.Kind{Type: &corev1.Pod{}}, &handler.EnqueueRequestForOwner{\n\t\tIsController: true,\n\t\tOwnerType: &knapv1alpha1.Appengine{},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" } ]
e94a4a7d35559db2cd69a92a73feb546
SetLimit : Allow user to set Limit
[ { "docid": "3dd94100c2417cfc0a65f0e0ffdc5bb1", "score": "0.6774543", "text": "func (_options *ListCatalogAuditsOptions) SetLimit(limit int64) *ListCatalogAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" } ]
[ { "docid": "eeda0e34522111be3d105992b7036610", "score": "0.7820183", "text": "func (in *ActionUserPublicKeyIndexInput) SetLimit(value int64) *ActionUserPublicKeyIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "5fced7e94cc15323cb0f5c3030c6086b", "score": "0.76835227", "text": "func (_Gods *GodsTransactor) SetLimit(opts *bind.TransactOpts, id uint16, limit uint64) (*types.Transaction, error) {\n\treturn _Gods.contract.Transact(opts, \"setLimit\", id, limit)\n}", "title": "" }, { "docid": "deb9e6e923f3a2cb820900780d817538", "score": "0.75809157", "text": "func (l *Limiter) SetLimit(limit int) {\n\tl.adjustLimit <- limit\n}", "title": "" }, { "docid": "8e88a4fb38973763ebed33815fc76db1", "score": "0.75788414", "text": "func SetLimit(l []string) func() private {\n\treturn func() private {\n\t\tpronom.limit = l\n\t\treturn private{}\n\t}\n}", "title": "" }, { "docid": "f93e983d4510ab435b77e0363a714b82", "score": "0.75264335", "text": "func (in *ActionUserOutageIndexInput) SetLimit(value int64) *ActionUserOutageIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "f1ad74a4c2cb1aa58bf8f2963f41be42", "score": "0.74782246", "text": "func (_Gods *GodsSession) SetLimit(id uint16, limit uint64) (*types.Transaction, error) {\n\treturn _Gods.Contract.SetLimit(&_Gods.TransactOpts, id, limit)\n}", "title": "" }, { "docid": "2d1f3ff1777bc9e86e32139735e0ae73", "score": "0.7454925", "text": "func (_Gods *GodsTransactorSession) SetLimit(id uint16, limit uint64) (*types.Transaction, error) {\n\treturn _Gods.Contract.SetLimit(&_Gods.TransactOpts, id, limit)\n}", "title": "" }, { "docid": "47d8a62c4a13b91435440029e0d28a1b", "score": "0.73408103", "text": "func (in *ActionMonitoredEventIndexInput) SetLimit(value int64) *ActionMonitoredEventIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "6fa0d58770550767cee03d7715c23913", "score": "0.7318766", "text": "func SetLimits() error {\n\treturn nil\n}", "title": "" }, { "docid": "f6443a9efbf9c6688446529c1bfb1cff", "score": "0.7297644", "text": "func (in *ActionSystemConfigIndexInput) SetLimit(value int64) *ActionSystemConfigIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "a788325787e37d874dcdab0ab9d0195c", "score": "0.72758347", "text": "func (in *ActionOsTemplateIndexInput) SetLimit(value int64) *ActionOsTemplateIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "1c6c0838c90161698c2145b1ceeb7189", "score": "0.72754925", "text": "func (cli *condition) SetLimit(limit int64) {\n\tcli.limit = limit\n}", "title": "" }, { "docid": "0def00378935f77a2965dcb3d74bc8b6", "score": "0.723372", "text": "func (cur *Cursor) SetLimit(limit int) {\n C.mongo_cursor_set_limit(cur.cursor, C.int(limit))\n}", "title": "" }, { "docid": "292e79fa92bb3aaf3e4b5d7ffe148b79", "score": "0.7179409", "text": "func (l *Limiter) SetLimit(newL time.Duration) {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\tl.limit = newL\n}", "title": "" }, { "docid": "4b1b4bd4274616d2e8f891930de93b51", "score": "0.7149371", "text": "func (w *Waiter) SetLimit(limit time.Duration) {\n\tw.limiter = time.Tick(limit)\n}", "title": "" }, { "docid": "f5ad870dbde5a37831b63b0c9ba1e021", "score": "0.71334505", "text": "func (in *ActionMigrationPlanVpsMigrationIndexInput) SetLimit(value int64) *ActionMigrationPlanVpsMigrationIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "c1f2b0b84e26d3bd945f061320e6a2f8", "score": "0.7125047", "text": "func (in *ActionOutageUpdateIndexInput) SetLimit(value int64) *ActionOutageUpdateIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "a558cf96ad0b405c2dba0057bfb3a2b1", "score": "0.71202123", "text": "func (in *ActionOutageEntityIndexInput) SetLimit(value int64) *ActionOutageEntityIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "2ec451011b4cc0577e1e4f5e837b9dab", "score": "0.7089379", "text": "func (in *ActionVpsStatusIndexInput) SetLimit(value int64) *ActionVpsStatusIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "dccd3f8db8fde554c5cd224334f9fbac", "score": "0.7088641", "text": "func (in *ActionExportIndexInput) SetLimit(value int64) *ActionExportIndexInput {\n\tin.Limit = value\n\n\tif in._selectedParameters == nil {\n\t\tin._selectedParameters = make(map[string]interface{})\n\t}\n\n\tin._selectedParameters[\"Limit\"] = nil\n\treturn in\n}", "title": "" }, { "docid": "188595f9de3ac02ccc1b1ebc940037a5", "score": "0.70624363", "text": "func (_options *ListProvidersOptions) SetLimit(limit int64) *ListProvidersOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "9ddbc9c008ff3c2b8157b8c2771165b9", "score": "0.70439595", "text": "func (s *Session) Limit(limit int64) *Session {\n\ts.limit = &limit\n\treturn s\n}", "title": "" }, { "docid": "66562e2482b44805d0ab020ee19c18b0", "score": "0.7035565", "text": "func (_options *GetProfileControlsOptions) SetLimit(limit int64) *GetProfileControlsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "e6538ccebaf79b651896e5344a611a29", "score": "0.6981906", "text": "func (o *ScanResult) SetLimit(v int32) {\n\to.Limit = &v\n}", "title": "" }, { "docid": "208cd8e7f9df46b85944b75ef309ffdc", "score": "0.69759184", "text": "func (_options *GetGroupProfileControlsOptions) SetLimit(limit int64) *GetGroupProfileControlsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "1fe38f8c849745c355703ca29e530234", "score": "0.6955507", "text": "func (_options *ListCredentialsOptions) SetLimit(limit int64) *ListCredentialsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "497a33d475ece03a42933123e8717e20", "score": "0.69441724", "text": "func (_options *GetOfferingAccessListOptions) SetLimit(limit int64) *GetOfferingAccessListOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "d11e7bfa539d2afdcface25f623ef12b", "score": "0.6939413", "text": "func (_options *GetObjectAccessListDeprecatedOptions) SetLimit(limit int64) *GetObjectAccessListDeprecatedOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "d3282c3c8b7e8244ea6b9a90023f78fc", "score": "0.6924431", "text": "func (_options *ListObjectAuditsOptions) SetLimit(limit int64) *ListObjectAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "f568900671752579225000dfd6b6bdf6", "score": "0.6922422", "text": "func (_options *ListLatestScansOptions) SetLimit(limit int64) *ListLatestScansOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "f568900671752579225000dfd6b6bdf6", "score": "0.6922422", "text": "func (_options *ListLatestScansOptions) SetLimit(limit int64) *ListLatestScansOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "cc6db95f8cdce718b45d1bdbb7c9c55e", "score": "0.6921376", "text": "func (_options *ListOfferingInstanceAuditsOptions) SetLimit(limit int64) *ListOfferingInstanceAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "8e59860c9b4de345d809847d8e7d933e", "score": "0.692101", "text": "func (o *User) SetLimit(v UserLimit) {\n\to.Limit = &v\n}", "title": "" }, { "docid": "cae45a3ee77fb96d05050e549e50bcca", "score": "0.68976736", "text": "func (e *Xnodes) SetLimit(times interface{}) float64 {\n e.limit = conver.Float64Must(times)\n return e.limit\n}", "title": "" }, { "docid": "0b6cca8255196a6a708f36c1d5304754", "score": "0.6885167", "text": "func (s *appQuotaService) ChangeLimit(appName string, limit int) error {\n\tq, err := s.storage.FindByAppName(appName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif limit < 0 {\n\t\tlimit = -1\n\t} else if limit < q.InUse {\n\t\treturn quota.ErrLimitLowerThanAllocated\n\t}\n\treturn s.storage.SetLimit(appName, limit)\n}", "title": "" }, { "docid": "96c3a8cfca5e618551cbb07b1bac845c", "score": "0.68842906", "text": "func (s *SearchAccounts) Limit(limit uint64) *SearchAccounts {\n\ts.p.Limit = limit\n\treturn s\n}", "title": "" }, { "docid": "bfb90ab8257b1cdd73dd47f92c4fd758", "score": "0.6855087", "text": "func (_options *ListProfilesOptions) SetLimit(limit int64) *ListProfilesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "bfb90ab8257b1cdd73dd47f92c4fd758", "score": "0.6855087", "text": "func (_options *ListProfilesOptions) SetLimit(limit int64) *ListProfilesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "97918c117f6d3caf1f6c4466a5a75c8e", "score": "0.6825609", "text": "func (f *IssueFinder) Limit(limit int) *IssueFinder {\n\tf.lim = limit\n\treturn f\n}", "title": "" }, { "docid": "ac2cd3bb310a3215178bbeaddb089ba6", "score": "0.6808172", "text": "func (_options *ListEnterpriseAuditsOptions) SetLimit(limit int64) *ListEnterpriseAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "b532a644c0b2b0ac8e670793f7d5361b", "score": "0.6807843", "text": "func (b UpdateBuilder) Limit(limit uint64) UpdateBuilder {\n\treturn builder.Set(b, \"Limit\", fmt.Sprintf(\"%d\", limit)).(UpdateBuilder)\n}", "title": "" }, { "docid": "4838dff66a7cec6a1b5de52fca2c2cda", "score": "0.6804161", "text": "func (_options *ListObjectsOptions) SetLimit(limit int64) *ListObjectsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "ec5d90b9fb28c6394bfe70d8f0da99df", "score": "0.67925525", "text": "func (_options *ListOfferingAuditsOptions) SetLimit(limit int64) *ListOfferingAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "ca5ba57a97fe53d3ba56fdc715d2637e", "score": "0.6789143", "text": "func SetLimits(cpu, mem float64) {\n\trw.Lock()\n\tcpuLimit = cpu\n\tmemLimit = mem\n\trw.Unlock()\n}", "title": "" }, { "docid": "3029c7ddfdd4530cf76253a6ce62c5b8", "score": "0.678804", "text": "func (t *Request) Limit(limit int) *Request {\n\tt.isEmpty = limit == 0\n\tt.limit = fmt.Sprintf(limitTpl, limit)\n\treturn t\n}", "title": "" }, { "docid": "2483754304692f737a19f80f6feb1830", "score": "0.67851424", "text": "func (dc *TidbController) Limit() {\n\tuser := dc.GetString(\":user\")\n\tif len(user) < 1 {\n\t\tdc.CustomAbort(403, \"user id is nil\")\n\t}\n\tac := &operator.ApprovalConditions{}\n\tb := dc.Ctx.Input.RequestBody\n\tif len(b) < 1 {\n\t\tdc.CustomAbort(403, \"body is empty\")\n\t}\n\tif err := json.Unmarshal(b, ac); err != nil {\n\t\tdc.CustomAbort(400, fmt.Sprintf(\"Parse body error: %v\", err))\n\t}\n\tlimit := operator.NeedApproval(user, ac.KvReplicas, ac.DbReplicas)\n\tdc.Data[\"json\"] = limit\n\tdc.ServeJSON()\n}", "title": "" }, { "docid": "4f2798dd24fdfcbd82a5359a10a52507", "score": "0.6783839", "text": "func (_options *ListCatalogAccountAuditsOptions) SetLimit(limit int64) *ListCatalogAccountAuditsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "e7d5ff3bca6444980217d334c633096e", "score": "0.6763851", "text": "func (options *ListRulesOptions) SetLimit(limit int64) *ListRulesOptions {\n\toptions.Limit = core.Int64Ptr(limit)\n\treturn options\n}", "title": "" }, { "docid": "985a220dba9450cd0dac8bd4142662e6", "score": "0.674722", "text": "func (_options *GetObjectAccessListOptions) SetLimit(limit int64) *GetObjectAccessListOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "671dcaf3ce4b0880f54f9a86631f7d24", "score": "0.67469275", "text": "func (ruq *RoleUKMQuery) Limit(limit int) *RoleUKMQuery {\n\truq.limit = &limit\n\treturn ruq\n}", "title": "" }, { "docid": "deb68f0d27c6fb5ce7e76d51f5619dbd", "score": "0.6729026", "text": "func (u *inputSetUtility) Limit(min, max float64) {\n\tu.min, u.max = min, max\n\n\t// Update any already initialized members\n\tfor _, util := range u.members {\n\t\tutil.Limit(min, max)\n\t}\n}", "title": "" }, { "docid": "1376783a896086f2fd8adaaa63e36767", "score": "0.6726813", "text": "func (s *AssetDividendService) Limit(limit int) *AssetDividendService {\n\ts.limit = &limit\n\treturn s\n}", "title": "" }, { "docid": "84cb05ecea79ef91551c536cb82b38ea", "score": "0.672609", "text": "func (srq *SysRoleQuery) Limit(limit int) *SysRoleQuery {\n\tsrq.limit = &limit\n\treturn srq\n}", "title": "" }, { "docid": "97fd6a7053b8d2c6733c672d25d500f9", "score": "0.6721852", "text": "func (q *query) Limit(amount uint) {\n\tq.limit = amount\n}", "title": "" }, { "docid": "623db71b576266da5bd1457276cf5c86", "score": "0.6720929", "text": "func (o *AdminQuerySessionParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "b854da73bd94a408ef9bfe20073622f7", "score": "0.67086416", "text": "func (_options *ListOfferingsOptions) SetLimit(limit int64) *ListOfferingsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "2c808ecff4f946023b9f926d9fff4bbf", "score": "0.67080826", "text": "func (lc *LimitedConnection) SetLimit(bytesPerSec int) {\n\tif bytesPerSec > 0 {\n\t\tlimiter := rate.NewLimiter(rate.Limit(bytesPerSec), 32768)\n\t\tlc.listener.limits.connection = bytesPerSec\n\t\tlc.limiter = limiter\n\t}\n}", "title": "" }, { "docid": "9a9680a2fb80a1bd61c1d8577f2fec9a", "score": "0.66897875", "text": "func (_options *ScanSummariesOptions) SetLimit(limit int64) *ScanSummariesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "9a9680a2fb80a1bd61c1d8577f2fec9a", "score": "0.66897875", "text": "func (_options *ScanSummariesOptions) SetLimit(limit int64) *ScanSummariesOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "2fe12c8b76b11bbdba2fdc3456ed776d", "score": "0.66836643", "text": "func (_options *SearchObjectsOptions) SetLimit(limit int64) *SearchObjectsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "f06645a0e00fa7a185c77e1eaa287a1f", "score": "0.66653794", "text": "func (vq *ViewQuery) Limit(num uint) *ViewQuery {\n\tvq.options.Set(\"limit\", strconv.FormatUint(uint64(num), 10))\n\treturn vq\n}", "title": "" }, { "docid": "94cf7566a53800c47dbafd24496457f9", "score": "0.6654653", "text": "func (o *QueryUserSubscriptionsParams) SetLimit(limit *int32) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "14a37d9cc128d414a3984e9b9c53a406", "score": "0.6653926", "text": "func ModifyClientLimit(limit int64) func(args *ahpb.ApiModifyHuntArgs) {\n\treturn func(args *ahpb.ApiModifyHuntArgs) {\n\t\targs.ClientLimit = proto.Int64(limit)\n\t}\n}", "title": "" }, { "docid": "99680b2351a558ce5bfa119850e7b6da", "score": "0.6652254", "text": "func (o *SearchResults) SetLimit(v int32) {\n\to.Limit = v\n}", "title": "" }, { "docid": "8ff2ac2a00e9a6c42f293af236ea7ed2", "score": "0.6642372", "text": "func (_options *GetConsumptionOfferingsOptions) SetLimit(limit int64) *GetConsumptionOfferingsOptions {\n\t_options.Limit = core.Int64Ptr(limit)\n\treturn _options\n}", "title": "" }, { "docid": "ea9511f0589bced569430816897e52e8", "score": "0.6638715", "text": "func (_m *MongoSession) SetPoolLimit(limit int) {\n\t_m.Called(limit)\n}", "title": "" }, { "docid": "53e9777a5f43edf5f3d04cbcbccd225d", "score": "0.6626649", "text": "func (srq *StatusReserveQuery) Limit(limit int) *StatusReserveQuery {\n\tsrq.limit = &limit\n\treturn srq\n}", "title": "" }, { "docid": "04db3d90391602958d127b42bff873c8", "score": "0.66229165", "text": "func (s *DescribeLDAPSSettingsInput) SetLimit(v int64) *DescribeLDAPSSettingsInput {\n\ts.Limit = &v\n\treturn s\n}", "title": "" }, { "docid": "4b51e27333c0616c326fba75ab47fcd2", "score": "0.6580406", "text": "func (self *SelectManager) Limit(take int) *SelectManager {\n\tself.Tree.Limit = Limit(take)\n\treturn self\n}", "title": "" }, { "docid": "d1286c0bbfbb024df201be2bf77b11ea", "score": "0.6574587", "text": "func (aq *AccountQuery) Limit(limit int) *AccountQuery {\n\taq.ctx.Limit = &limit\n\treturn aq\n}", "title": "" }, { "docid": "5554ead863438444a3d173800aadf1c1", "score": "0.6568876", "text": "func Limit(limit int) QueryMod {\n\treturn func(q *queries.Query) {\n\t\tqueries.SetLimit(q, limit)\n\t}\n}", "title": "" }, { "docid": "8bdec2f87f85b4d3e6b722c416aff1a5", "score": "0.65614474", "text": "func (o *ProcessesRanOnParams) SetLimit(limit *string) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "c1e24d07bebabc124e14e2e7202d4a59", "score": "0.65518534", "text": "func (s *FSelect) Limit(l uint64) *FSelect {\n\ts.limit = l\n\treturn s\n}", "title": "" }, { "docid": "5a397923747719df5aa07d18dbfdabc8", "score": "0.6547215", "text": "func (r *RateLimit) Limit(f request.EndpointLimit) error {\n\tif f == request.Auth {\n\t\ttime.Sleep(r.Orders.Reserve().Delay())\n\t\treturn nil\n\t}\n\ttime.Sleep(r.GlobalRate.Reserve().Delay())\n\treturn nil\n}", "title": "" }, { "docid": "1703a6ddcfaad1d4fadec2311d52d788", "score": "0.6545525", "text": "func (rtq *RequestTargetQuery) Limit(limit int) *RequestTargetQuery {\n\trtq.ctx.Limit = &limit\n\treturn rtq\n}", "title": "" }, { "docid": "38ad642e3a165497933fd6ba4404490d", "score": "0.65394235", "text": "func (r ApiApiImagesGetRequest) Limit(limit string) ApiApiImagesGetRequest {\n\tr.limit = &limit\n\treturn r\n}", "title": "" }, { "docid": "8285e30cb8704ccfd1fbcd015f141136", "score": "0.65373194", "text": "func (o *GetSubaccountParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "1fd769a920faeff3fefd55361182bf4a", "score": "0.6521146", "text": "func (o *TemplateLimitConfig) SetLimit(v float32) {\n\to.Limit = v\n}", "title": "" }, { "docid": "4382fd478bbb831d8c9d02559aed28c0", "score": "0.65138453", "text": "func (K *APIClient) SetLimiter(max_calls int) {\n\tif max_calls <= 0 {\n\t\tmax_calls = 1\n\t}\n\tif K.limiter == nil {\n\t\tK.limiter = make(chan struct{}, max_calls)\n\t}\n}", "title": "" }, { "docid": "f364c3e30f0b2a928bd372d98ce6c459", "score": "0.6512991", "text": "func (o *GetTimeTrackingsParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "794737ba4901305574195cf5e33b97db", "score": "0.6508527", "text": "func (o *RetrieveAllUsersByPolicyVersion1Params) SetLimit(limit *int32) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "c934f592853bafc89f0035cb99dc6e31", "score": "0.65035665", "text": "func (db *DB) Limit(limit int) (tx *DB) {\n\ttx = db.getInstance()\n\ttx.Statement.AddClause(clause.Limit{Limit: &limit})\n\treturn\n}", "title": "" }, { "docid": "6f94b3f6987b8f9d8b2045df129897fc", "score": "0.65022534", "text": "func Limit(lim int64) QueryOption {\n\treturn limit{\n\t\tval: lim,\n\t}\n}", "title": "" }, { "docid": "da850d3644bb0e04707964395c40b75d", "score": "0.65021604", "text": "func (o *GetUsersParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "ad873e9c668916bb52dbdddd561277b3", "score": "0.64965564", "text": "func (r ApiGetApiKeysRequest) Limit(limit int32) ApiGetApiKeysRequest {\n\tr.limit = &limit\n\treturn r\n}", "title": "" }, { "docid": "35176978c0efba70222726553bd15948", "score": "0.64758664", "text": "func (_u *_usersQueryBuilder) Limit(limit int64) *_usersQueryBuilder {\n\tif _u.err != nil {\n\t\treturn _u\n\t}\n\t_u.builder.Limit(limit)\n\treturn _u\n}", "title": "" }, { "docid": "4f7f210f6e795980fad9ec2a503db6f9", "score": "0.6474347", "text": "func (i *invocationLimit) SetLimitCapacity(seconds, capacity int64) {\n\to, _ := i.limits.LoadOrStore(seconds, &singleLimit{\n\t\tcapacity: capacity,\n\t\tquantity: capacity,\n\t})\n\to.(*singleLimit).SetCapacity(capacity)\n}", "title": "" }, { "docid": "b8ec57c7a0f4c6d7bc98f56d7cbe03da", "score": "0.6472016", "text": "func ChangeQuota(app *App, limit int) error {\n\tif limit < 0 {\n\t\tlimit = -1\n\t} else if limit < app.Quota.InUse {\n\t\treturn errors.New(\"new limit is lesser than the current allocated value\")\n\t}\n\tconn, err := db.Conn()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer conn.Close()\n\terr = conn.Apps().Update(\n\t\tbson.M{\"name\": app.Name},\n\t\tbson.M{\"$set\": bson.M{\"quota.limit\": limit}},\n\t)\n\tif err != nil {\n\t\treturn err\n\t}\n\tapp.Quota.Limit = limit\n\treturn nil\n}", "title": "" }, { "docid": "0ef01132d7fbc8214b92a776268ad4a1", "score": "0.64665633", "text": "func (wq *WalletQuery) Limit(limit int) *WalletQuery {\n\twq.limit = &limit\n\treturn wq\n}", "title": "" }, { "docid": "ba3d4f2cca4cd62d339e4e5fdead8f22", "score": "0.6456816", "text": "func (r *RateLimit) Limit(f request.EndpointLimit) error {\n\tswitch f {\n\tcase request.Auth:\n\t\ttime.Sleep(r.Auth.Reserve().Delay())\n\tcase orders:\n\t\tres := r.Auth.Reserve()\n\t\ttime.Sleep(r.Order.Reserve().Delay())\n\t\ttime.Sleep(res.Delay())\n\tcase lowVolume:\n\t\tauthShell := r.Auth.Reserve()\n\t\torderShell := r.Order.Reserve()\n\t\ttime.Sleep(r.LowVolume.Reserve().Delay())\n\t\ttime.Sleep(orderShell.Delay())\n\t\ttime.Sleep(authShell.Delay())\n\tdefault:\n\t\ttime.Sleep(r.UnAuth.Reserve().Delay())\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7811dde29cbe988579c0b0ba4cc25ad", "score": "0.6454269", "text": "func Limit(n int) func(*config) error {\n\treturn func(cfg *config) error {\n\t\tcfg.limit = n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "74f9551843a2015ec23ed96c7972dfe8", "score": "0.6452247", "text": "func (o *ListAuthUsersParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "9826e12d14d2f61d201d8cc8679ed0f1", "score": "0.6443915", "text": "func (d *Device) SetCurrentLimit(limit uint8) {\n\tif limit > 140 {\n\t\tlimit = 140\n\t}\n\trawLimit := uint8(float32(limit) / 2.5)\n\tp := []uint8{rawLimit}\n\td.WriteRegister(SX126X_REG_OCP_CONFIGURATION, p[:])\n}", "title": "" }, { "docid": "6b5499ef984f0114f6cefa526c4fa995", "score": "0.64374137", "text": "func (o *Quota) SetLimit(v QuotaLimit) {\n\to.Limit = &v\n}", "title": "" }, { "docid": "0c416e4cc25f092fde1bc52c44502225", "score": "0.64331037", "text": "func (o *GetUserFriendsUpdatedParams) SetLimit(limit *int64) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "8c0aa51987083100c35e67f5bcf18e56", "score": "0.64234805", "text": "func (q *Query) Limit(amount int) *Query {\n\tif amount < 0 {\n\t\tpanic(\"Limit must be set to a positive number\")\n\t}\n\n\tif q.limit != 0 {\n\t\tpanic(fmt.Sprintf(\"Limit has already been set to %d\", q.limit))\n\t}\n\n\tq.limit = amount\n\n\treturn q\n}", "title": "" }, { "docid": "4a6d0da34658af9870efe52993629e36", "score": "0.6420806", "text": "func (v *Visitors) Limit(next http.Handler) http.Handler {\n\t// initialization\n\t//go v.cleanupVisitors()\n\tv.register = make(map[string]*visitor)\n\n\treturn http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tlimiter := v.getVisitor(r.RemoteAddr)\n\t\tif limiter.Allow() == false {\n\t\t\thttp.Error(w, http.StatusText(429), http.StatusTooManyRequests)\n\t\t\treturn\n\t\t}\n\t\tnext.ServeHTTP(w, r)\n\t})\n}", "title": "" }, { "docid": "7394dbe9b4b1b7ae96a2d74d76781588", "score": "0.6420383", "text": "func (o *QueryPaymentProviderConfigParams) SetLimit(limit *int32) {\n\to.Limit = limit\n}", "title": "" }, { "docid": "744791abc0b8bb370ea7b1e74ec55722", "score": "0.64182705", "text": "func (uarq *UserActiveRecordQuery) Limit(limit int) *UserActiveRecordQuery {\n\tuarq.limit = &limit\n\treturn uarq\n}", "title": "" }, { "docid": "3c25f70646fbe8c916c0fb1c8c82f26a", "score": "0.64133173", "text": "func (rq *ReplyQuery) Limit(limit int) *ReplyQuery {\n\trq.ctx.Limit = &limit\n\treturn rq\n}", "title": "" } ]
623d82c94fe99dafe7b0bf76a77b2833
/ medium Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that: Only one letter can be changed at a time. Each transformed word must exist in the word list. Note that beginWord is not a transformed word. Note: Return 0 if there is no such transformation sequence. All words have the same length. All words contain only lowercase alphabetic characters. You may assume no duplicates in the word list. You may assume beginWord and endWord are nonempty and are not the same. Example 1: Input: beginWord = "hit", endWord = "cog", wordList = ["hot","dot","dog","lot","log","cog"] Output: 5 Explanation: As one shortest transformation is "hit" > "hot" > "dot" > "dog" > "cog", return its length 5. Example 2: Input: beginWord = "hit" endWord = "cog" wordList = ["hot","dot","dog","lot","log"] Output: 0 Explanation: The endWord "cog" is not in wordList, therefore no possible transformation.
[ { "docid": "a83b3f642d5ee6bdb5f9d6409a29a61b", "score": "0.5060103", "text": "func word_ladder(beginWord string, endWord string, wordList []string) int {\n\tif !isSolvable(wordList, endWord) {\n\t\treturn 0\n\t}\n\t// instantiate necessary data structures\n\twordWild, wildWord := makeAdjList(append(wordList, beginWord))\n\tvisited := make(map[string]bool)\n\tdepthqueue := newSlice(1, 1)\n\t// instantiate initial variables\n\tqueue := []string{beginWord}\n\tfor len(queue) != 0 {\n\t\t// unshift\n\t\tcurrNode := queue[0]\n\t\tqueue = queue[1:]\n\t\t// unshift\n\t\tcurrDepth := depthqueue[0]\n\t\tdepthqueue = depthqueue[1:]\n\t\t// if we've traversed this node already, skip it\n\t\tif _, has := visited[currNode]; has {\n\t\t\tcontinue\n\t\t}\n\t\tvisited[currNode] = true\n\t\tif currNode == endWord {\n\t\t\treturn currDepth\n\t\t}\n\t\t// add children to the queue\n\t\twildCards := wordWild[currNode]\n\t\tfor _, wildCard := range wildCards {\n\t\t\tqueue = append(queue, wildWord[wildCard]...)\n\t\t\tdepthqueue = append(depthqueue, newSlice(len(wildWord[wildCard]), currDepth+1)...)\n\t\t}\n\t}\n\treturn 0\n}", "title": "" } ]
[ { "docid": "fb076a42c48e420dad6bdd1364781def", "score": "0.67954", "text": "func ladderLength(beginWord string, endWord string, wordList []string) int {\n\tif beginWord == \"\" || endWord == \"\" || len(wordList) <= 0 {\n\t\treturn 0\n\t}\n\n\twordLength := len(beginWord)\n\tcombines := make(map[string][]string)\n\n\tfor _, word := range wordList {\n\t\tfor i := 0; i < wordLength; i ++ {\n\t\t\tnewWord := word[:i] + \"*\"+word[i + 1:]\n\n\t\t\tif wordArray, ok := combines[newWord]; ok {\n\t\t\t\twordArray = append(wordArray, word)\n\t\t\t\tcombines[newWord] = wordArray\n\t\t\t}else {\n\t\t\t\twordArray = make([]string, 1)\n\t\t\t\twordArray[0] = word\n\t\t\t\tcombines[newWord] = wordArray\n\t\t\t}\n\t\t}\n\t}\n\n\tqueue := make([]wordPair, 0)\n\tqueue = append(queue, wordPair{beginWord, 1})\n\tvisited := make(map[string]bool)\n\tvisited[beginWord] = true\n\n\tfor len(queue) > 0 {\n\t\tnode := queue[0]\n\t\tqueue = queue[1:]\n\t\tfor i := 0; i < wordLength;i ++ {\n\t\t\tnewWord := node.word[:i] + \"*\" + node.word[i+1:]\n\t\t\tfor _, adjWord := range combines[newWord] {\n\t\t\t\tif adjWord == endWord {\n\t\t\t\t\treturn node.idx + 1\n\t\t\t\t}\n\t\t\t\tif !visited[adjWord] {\n\t\t\t\t\tvisited[adjWord] = true\n\t\t\t\t\tqueue = append(queue, wordPair{adjWord, node.idx + 1})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n\n\treturn 0\n}", "title": "" }, { "docid": "fa73c877789796eb7d15e2aaf9d05a09", "score": "0.6206466", "text": "func ladderLength(beginWord string, endWord string, wordList []string) int {\n \n}", "title": "" }, { "docid": "7a1e9b2ca14e56a221e6756def8b0907", "score": "0.60030615", "text": "func minInsertions(word string, start int, end int) int {\n\n\tif start > end {\n\t\treturn math.MaxInt64\n\t}\n\n\tif start == end {\n\t\treturn 0\n\t}\n\tif start == end-1 {\n\t\tif word[start] == word[end] {\n\t\t\treturn 0\n\t\t} else {\n\t\t\treturn 1\n\t\t}\n\t}\n\tif word[start] == word[end] {\n\t\treturn minInsertions(word, start+1, end-1)\n\t}\n\treturn min(minInsertions(word, start, end-1)+1, minInsertions(word, start+1, end)+1)\n}", "title": "" }, { "docid": "2b08cb9f56a19589f1db80822428f9da", "score": "0.5683706", "text": "func commonPrefixWordLength(a, b string) int {\n\t// re-order so len(a) <= len(b) always\n\tif len(a) > len(b) {\n\t\tb, a = a, b\n\t}\n\tlastWhite := 0\n\tfor i := 0; i < len(a); i++ {\n\t\tch := a[i]\n\t\tif ch != b[i] {\n\t\t\tif lastWhite == 0 {\n\t\t\t\treturn 0\n\t\t\t}\n\t\t\treturn min(lastWhite+1, len(a))\n\t\t}\n\t\tif isWhite(ch) {\n\t\t\tlastWhite = i\n\t\t}\n\n\t}\n\treturn len(a)\n}", "title": "" }, { "docid": "965962da08670e0c4147865711028245", "score": "0.54604566", "text": "func minDistance(word1 string, word2 string) int {\n\tdp := make([][]int, 0)\n\tfor i := 0; i <= len(word1); i ++ {\n\t\ttmp := make([]int, len(word2)+1, len(word2)+1)\n\t\tdp = append(dp, tmp)\n\t}\n\n\tfor i := 0; i <= len(word1); i ++ {\n\t\tdp[i][0] = i\n\t}\n\n\tfor j := 1; j <= len(word2); j ++ {\n\t\tdp[0][j] = j\n\t}\n\n\tfor i := 1; i <= len(word1); i ++ {\n\t\tfor j := 1; j <= len(word2); j ++ {\n\t\t\tif word1[i-1] == word2[j-1] {\n\t\t\t\tdp[i][j] = utils.Min(dp[i-1][j-1], dp[i][j-1] + 1, dp[i-1][j] + 1)\n\t\t\t} else{\n\t\t\t\tdp[i][j] = utils.Min(dp[i-1][j-1] + 1, dp[i][j-1] + 1, dp[i-1][j] + 1)\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len(word1)][len(word2)]\n}", "title": "" }, { "docid": "84fdd85538ff7436cba4a24145372ece", "score": "0.5455246", "text": "func minDistance(word1 string, word2 string) int {\n\tm := len(word1)\n\tn := len(word2)\n\n\tif m == 0 {\n\t\treturn n\n\t}\n\n\tif n == 0 {\n\t\treturn m\n\t}\n\n\td := make([][]int, 0, m+1)\n\n\tfor i := 0; i <= m+1; i++ {\n\t\td = append(d, make([]int, n+1))\n\t}\n\n\tfor i := 0; i < n+1; i++ {\n\t\td[0][i] = i\n\t}\n\n\tfor j := 0; j < m+1; j++ {\n\t\td[j][0] = j\n\t}\n\n\tfor i := 1; i < m+1; i++ {\n\t\tfor j := 1; j < n+1; j++ {\n\t\t\tif word1[i-1] == word2[j-1]{\n\t\t\t\td[i][j] = d[i-1][j-1]\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\td[i][j] = min3(d[i-1][j-1] + 1, d[i-1][j] +1, d[i][j-1] + 1)\n\t\t}\n\t}\n\n\treturn d[m][n]\n}", "title": "" }, { "docid": "aed645da8b3d977edc11651a570ff880", "score": "0.54141545", "text": "func minWindow(s string, t string) string {\n\tif t == \"\" || len(s) < len(t) {\n\t\treturn \"\"\n\t}\n\ttarget := buildDict(t)\n\tdict := map[byte]int{}\n\tfor i := 0; i < len(t) - 1; i++ {\n\t\tif _, exist := target[s[i]]; exist {\n\t\t\tif _, exist := dict[s[i]]; exist {\n\t\t\t\tdict[s[i]] += 1\n\t\t\t} else {\n\t\t\t\tdict[s[i]] = 1\n\t\t\t}\n\t\t}\n\t}\n\tfound := false\n\tresult := s\n\ti := 0\n\tj := len(t) - 1\n\tfor j < len(s) {\n\t\tfor j < len(s) && !equal(dict, target) {\n\t\t\tj += 1\n\t\t\tif _, exist := target[s[j-1]]; exist {\n\t\t\t\tif _, exist2 := dict[s[j-1]]; exist2 {\n\t\t\t\t\tdict[s[j-1]] += 1\n\t\t\t\t} else {\n\t\t\t\t\tdict[s[j-1]] = 1\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor j <= len(s) && i < j && equal(dict, target) {\n\t\t\tfound = true\n\t\t\tif len(result) > j - i {\n\t\t\t\tresult = s[i:j]\n\t\t\t}\n\t\t\tif _, exist := target[s[i]]; exist {\n\t\t\t\tdict[s[i]] -= 1\n\t\t\t\tif dict[s[i]] == 0 {\n\t\t\t\t\tdelete(dict, s[i])\n\t\t\t\t}\n\t\t\t}\n\t\t\ti += 1\n\t\t}\n\t}\n\tif found {\n\t\treturn result\n\t} else {\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "a274afffbbd2873bb87aa5cf126ca6a3", "score": "0.5403292", "text": "func minDistance(word1 string, word2 string) int {\n\tdp := make([][]int, 0)\n\tfor i := 0; i <= len(word1); i++ {\n\t\tdp = append(dp, make([]int, len(word2)+1))\n\t}\n\tfor i := 0; i <= len(word1); i++ {\n\t\tfor j := 0; j <= len(word2); j++ {\n\t\t\tif i == 0 || j == 0 {\n\t\t\t\tdp[i][j] = i + j\n\t\t\t} else if word1[i-1] == word2[j-1] {\n\t\t\t\tdp[i][j] = dp[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tdp[i][j] = 1 + min(dp[i-1][j], dp[i][j-1])\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len(word1)][len(word2)]\n}", "title": "" }, { "docid": "a70864ecb152f39d1bfba2c1b06b7a26", "score": "0.53473383", "text": "func minDistance(word1 string, word2 string) int {\n\tm, n := len(word1), len(word2)\n\tdp := make([][]int, m+1)\n\tfor i := range dp {\n\t\tdp[i] = make([]int, n+1)\n\t}\n\n\tfor i := 0; i <= m; i++ {\n\t\tdp[i][0] = i\n\t}\n\tfor j := 0; j <= n; j++ {\n\t\tdp[0][j] = j\n\t}\n\n\tfor i := 1; i <= m; i++ {\n\t\tfor j := 1; j <= n; j++ {\n\t\t\tif word1[i-1] == word2[j-1] {\n\t\t\t\tdp[i][j] = dp[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tdp[i][j] = util.Min(dp[i-1][j], dp[i][j-1], dp[i-1][j-1]) + 1\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len(word1)][len(word2)]\n}", "title": "" }, { "docid": "dba457523f3e4a60e67bca6e62704e73", "score": "0.53057593", "text": "func Levenshtein(w1, w2 []byte) int {\n\t// TODO: reduce space usage\n\n\tn, m := len(w1), len(w2)\n\tdist := make([][]int, n+1)\n\tfor i, c1 := range w1 {\n\t\tif i == 0 {\n\t\t\tdist[i] = make([]int, m+1)\n\t\t}\n\t\tdist[i+1] = make([]int, m+1)\n\n\t\tfor j, c2 := range w2 {\n\t\t\tif i == 0 || j == 0 {\n\t\t\t\tdist[i][j] = i + j\n\t\t\t}\n\n\t\t\tdist[i+1][j+1] = min(\n\t\t\t\tdist[i][j]+letterDist(c1, c2), // Change\n\t\t\t\tdist[i+1][j]+1, // Delete\n\t\t\t\tdist[i][j+1]+1, // Insert\n\t\t\t)\n\t\t}\n\t}\n\n\treturn dist[n][m]\n}", "title": "" }, { "docid": "83e78954056afb3858327257881c3771", "score": "0.52959895", "text": "func countWord(word string, tempMap map[string]int) Result {\n\t_, ok := tempMap[word]\n\tif ok {\n\t\ttempMap[word]++\n\t\treturn Result{word, tempMap[word] + 1}\n\n\t}\n\treturn Result{word, 1}\n\n}", "title": "" }, { "docid": "62c37f6c69d508afeeb6c73cbd672e72", "score": "0.527334", "text": "func MinWordDistance(m map[string][]int, w1, w2 string) (int, error) {\n\tidx1, ok1 := m[w1]\n\tidx2, ok2 := m[w2]\n\n\tif !ok1 && !ok2 {\n\t\treturn 0, fmt.Errorf(\"neither %s or %s appear in the file\", w1, w2)\n\t}\n\tif !ok1 {\n\t\treturn 0, fmt.Errorf(\"%s does not appear in the file\", w1)\n\t}\n\tif !ok2 {\n\t\treturn 0, fmt.Errorf(\"%s does not appear in the file\", w2)\n\t}\n\n\treturn closestPair(idx1, idx2), nil\n}", "title": "" }, { "docid": "5a5e70ea359004eeef81f30df5b81b89", "score": "0.52380806", "text": "func DamerauLevenshteinDistance(a, b []rune) int {\n\tif len(a) == 0 {\n\t\treturn len(b)\n\t} else if len(b) == 0 {\n\t\treturn len(a)\n\t}\n\n\t// make the shorter string a can speed up by just running the inner loop\n\t// swap the two\n\tif len(a) > len(b) {\n\t\ta, b = b, a\n\t}\n\n\taLen := len(a)\n\tbLen := len(b)\n\n\t// ignore suffix that are the same\n\tfor aLen > 0 && a[aLen-1] == b[bLen-1] {\n\t\taLen--\n\t\tbLen--\n\t}\n\n\tstart := 0\n\tif a[0] == b[0] || aLen == 0 {\n\t\t// prefix common to both strings can be ignored\n\t\tfor start < aLen && a[start] == b[start] {\n\t\t\tstart++\n\t\t}\n\t\t// length of the part excluding common prefix and suffix\n\t\taLen -= start\n\t\tbLen -= start\n\t\t// if all of shorter string matches prefix and/or suffix of longer string, then\n\t\t// edit distance is just the delete of additional characters present in longer string\n\t\tif aLen == 0 {\n\t\t\treturn bLen\n\t\t}\n\n\t\t// faster than b[start+j] in inner loop below\n\t\t// this is if there is only one char different\n\t\t//if bLen == 1 {\n\t\t// b = string(b[start])\n\t\t//} else {\n\t\tb = b[start : bLen+start]\n\t\t//}\n\t}\n\n\tv0 := make([]int, bLen)\n\tv2 := make([]int, bLen)\n\n\tfor j := 0; j < bLen; j++ {\n\t\tv0[j] = j + 1\n\t}\n\n\taChar := a[0]\n\tcurrent := 0\n\tfor i := 0; i < aLen; i++ {\n\t\tprevaChar := aChar\n\t\taChar = a[start+i]\n\t\tbChar := b[0]\n\t\tleft := i\n\t\tcurrent = i + 1\n\t\tnextTransCost := 0\n\t\tfor j := 0; j < bLen; j++ {\n\t\t\tabove := current\n\t\t\tthisTransCost := nextTransCost\n\t\t\tnextTransCost = v2[j]\n\t\t\tcurrent = left\n\t\t\tv2[j] = current\n\t\t\tleft = v0[j]\n\t\t\tprevbChar := bChar\n\t\t\tbChar = b[j]\n\t\t\tif aChar != bChar {\n\t\t\t\tif left < current {\n\t\t\t\t\tcurrent = left\n\t\t\t\t}\n\t\t\t\tif above < current {\n\t\t\t\t\tcurrent = above\n\t\t\t\t}\n\t\t\t\tcurrent++\n\t\t\t\tif i != 0 && j != 0 && aChar == prevbChar && prevaChar == bChar {\n\t\t\t\t\tthisTransCost++\n\t\t\t\t\tif thisTransCost < current {\n\t\t\t\t\t\tcurrent = thisTransCost\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tv0[j] = current\n\t\t}\n\t}\n\treturn current\n}", "title": "" }, { "docid": "795aa31e8bc68c78231b6a92e92883b5", "score": "0.5205586", "text": "func minDistance(word1 string, word2 string) int {\n\tlen1 := len(word1)\n\tlen2 := len(word2)\n\tvar dp [][]int = make([][]int, len1+1)\n\tfor i := 0; i <= len1; i++ {\n\t\tdp[i] = make([]int, len2+1)\n\t}\n\tfor i := 0; i <= len1; i++ {\n\t\tdp[i][0] = i\n\t}\n\tfor j := 0; j <= len2; j++ {\n\t\tdp[0][j] = j\n\t}\n\tfor i := 1; i <= len1; i++ {\n\t\tfor j := 1; j <= len2; j++ {\n\t\t\tif word1[i-1] == word2[j-1] {\n\t\t\t\tdp[i][j] = dp[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tdp[i][j] = 1 + min(\n\t\t\t\t\tdp[i-1][j],\n\t\t\t\t\tdp[i][j-1],\n\t\t\t\t\tdp[i-1][j-1],\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len1][len2]\n}", "title": "" }, { "docid": "6438a350384d8c020fcc67ca3431483b", "score": "0.50910765", "text": "func maxProduct(words []string) int {\n\twordCountList := make([]wordCount, 0)\n\tfor _, word := range words {\n\t\tl := len(word)\n\t\tcharBit := 0\n\t\tfor i := 0; i < l; i++ {\n\t\t\tchar := word[i]\n\t\t\tcharBit = charBit | (1 << (char - 'a'))\n\t\t}\n\t\twordCountList = append(wordCountList, wordCount{length: len(word), charBit: charBit})\n\t}\n\tresult := 0\n\tl := len(wordCountList)\n\tfor i := 0; i < l; i++ {\n\t\tfor j := i + 1; j < l; j++ {\n\t\t\tw1, w2 := wordCountList[i], wordCountList[j]\n\t\t\tif w1.charBit&w2.charBit == 0 {\n\t\t\t\tresult = utils.Max(w1.length*w2.length, result)\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c38244c0c61574014889a86606085a12", "score": "0.5070581", "text": "func Calculate(s1, s2 string) float64 {\n\n\ts1, s2 = order(strings.ToLower(s1), strings.ToLower(s2))\n\n\t// This avoids the function to return NaN.\n\tif strings.Count(s1, \"\") == 1 || strings.Count(s2, \"\") == 1 {\n\t\treturn float64(0)\n\t}\n\n\t// m as `matching characters`\n\t// t as `transposition`\n\t// l as `the length of common prefix at the start of the string up to a maximum of 4 characters`.\n\t// See more: https://en.wikipedia.org/wiki/Jaro%E2%80%93Winkler_distance\n\tm := 0\n\tt := 0\n\tl := 0\n\n\twindow := math.Floor(float64(math.Max(float64(len(s1)), float64(len(s2)))/2) - 1)\n\n\t//debug:\n\t//fmt.Println(\"s1:\", s1, \"s2:\", s2)\n\t//fmt.Println(\"Match window:\", window)\n\t//fmt.Println(\"len(s1):\", len(s1), \"len(s2):\", len(s2))\n\n\tfor i := 0; i < len(s1); i++ {\n\t\t// Exact match\n\t\tif s1[i] == s2[i] {\n\t\t\tm++\n\t\t\t// Common prefix limitter\n\t\t\tif i == l && i < 4 {\n\t\t\t\tl++\n\t\t\t}\n\t\t} else {\n\t\t\tif strings.Contains(s2, string(s1[i])) {\n\t\t\t\t// The character is also considered matching if the amount of characters between the occurances in s1 and s2\n\t\t\t\t// is less than match window\n\t\t\t\tgap := strings.Index(s2, string(s1[i])) - strings.Index(s1, string(s1[i]))\n\t\t\t\tif gap <= int(window) {\n\t\t\t\t\tm++\n\t\t\t\t\t// Check if transposition is in reach of window\n\t\t\t\t\tfor k := i; k < len(s1); k++ {\n\t\t\t\t\t\tif strings.Index(s2, string(s1[k])) <= i {\n\t\t\t\t\t\t\tt++\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\tdistance := (float64(m)/float64(len(s1)) + float64(m)/float64(len(s2)) + (float64(m)-math.Floor(float64(t)/float64(2)))/float64(m)) / float64(3)\n\tjwd := distance + (float64(l) * float64(0.1) * (float64(1) - distance))\n\n\t//debug:\n\t//fmt.Println(\"- transpositions:\", t)\n\t//fmt.Println(\"- matches:\", m)\n\t//fmt.Println(\"- l:\", l)\n\t//fmt.Println(jwd)\n\n\treturn jwd\n\n}", "title": "" }, { "docid": "e3d563d896b8ecea150fafc0cdc77fa7", "score": "0.5051738", "text": "func TransformWord(dictionary []string, source string, target string) []string {\n\tdict := map[string]*graphNode{}\n\n\tfor _, word := range dictionary {\n\t\tdict[word] = nil\n\t}\n\n\tdict[source] = nil\n\tdict[target] = nil\n\n\tfor key := range dict {\n\t\tdict[key] = newWordGraphNode(key)\n\t}\n\n\tfor key := range dict {\n\t\tfor otherKey := range dict {\n\t\t\tif hasOneWordDifference(key, otherKey) {\n\t\t\t\tdict[key].addEdge(dict[otherKey])\n\t\t\t}\n\t\t}\n\t}\n\n\tdepth := 1\n\tvisited := map[string]bool{dict[source].name: true}\n\tpaths := []namedPath{newNamedPath(dict[source].name, []string{dict[source].name}, depth)}\n\tqueue := []*graphNode{dict[source]}\n\n\tfor len(queue) > 0 {\n\t\tvar newQueue []*graphNode\n\t\tfor _, node := range queue {\n\t\t\tfor _, childNode := range node.neighbours {\n\t\t\t\tif childNode.name == target {\n\t\t\t\t\treturn append(lastNodeEndingIn(paths, depth, node.name), target)\n\t\t\t\t}\n\n\t\t\t\tif _, ok := visited[childNode.name]; !ok {\n\t\t\t\t\tnewQueue = append(newQueue, childNode)\n\t\t\t\t\tpaths = addToPath(paths, depth, node.name, childNode.name)\n\t\t\t\t\tvisited[childNode.name] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tdepth++\n\t\tqueue = newQueue\n\t\tpaths = cleanOldNodes(paths, depth)\n\t}\n\n\treturn []string{}\n}", "title": "" }, { "docid": "e79145835c3dadc63bb5be96c3be2a30", "score": "0.5048749", "text": "func countFromWordList(wordList []string, wordMap map[string]int) {\n\t//Iterate word list\n\tfor _, word := range wordList {\n\t\tif len(word) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif _, ok := wordMap[word]; ok {\n\t\t\t//If the word exists in word map\n\t\t\twordMap[word]++\n\t\t} else {\n\t\t\t//Not exists in word map\n\t\t\twordMap[word] = 1\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c7a7eda10e9460d82bbf4c1224270d2b", "score": "0.5044177", "text": "func SolutionTwo() int {\n\t// just want the single line, aka element 0\n\tpolymer := sidwtrw.SliceOfStrings(\"day05/input.txt\")[0]\n\n\tshortestPolymerLen := 50000 // length of full polymer\n\n\t// for every letter in the alphabet ...\n\tfor l := 65; l <= 90; l++ {\n\t\t// remove all instances from the polymer\n\t\tnewPolymer := \"\"\n\t\tfor _, c := range polymer {\n\t\t\tif int(c) == l || int(c) == l+32 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnewPolymer += string(c)\n\t\t}\n\n\t\t// see the polymer length\n\t\tshortPolymer := reactPolymer(newPolymer)\n\t\tif len(shortPolymer) < shortestPolymerLen {\n\t\t\tshortestPolymerLen = len(shortPolymer)\n\t\t}\n\n\t}\n\t// report the shortest length\n\tfmt.Printf(\"Answer: %d\\n\", shortestPolymerLen)\n\treturn shortestPolymerLen\n}", "title": "" }, { "docid": "805f1427241382fc85a9e0d4405c736e", "score": "0.50257236", "text": "func Build(input string, wordMap map[string]map[string]*Node) map[string]map[string]*Node {\n\t// first replace all newlines with spaces\n\ttext := strings.Replace(input, \"\\n\", \" \", -1)\n\twords := strings.Split(text, \" \")\n\n\t// create our map\n\taddOrUpdateMap := func(where, word string) {\n\t\t// create child map if necessary\n\t\tif _, ok := wordMap[where]; !ok {\n\t\t\twordMap[where] = make(map[string]*Node)\n\t\t}\n\t\t// see if this word is already in the map\n\t\tif _, found := wordMap[where][word]; found {\n\t\t\twordMap[where][word].Count++\n\t\t} else {\n\t\t\twordMap[where][word] = &Node{\n\t\t\t\tCount: 1,\n\t\t\t}\n\t\t}\n\t}\n\n\tatSentenceStart := false\n\tfor idx, w := range words {\n\t\t// trim and lowercase all words\n\t\tword := strings.ToLower(strings.TrimSpace(w))\n\n\t\t// if word is empty skip it\n\t\tif len(word) < 1 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// if at beginning of sentence, we want to\n\t\t// consider the first words children of __start__\n\t\tif idx == 0 || atSentenceStart {\n\t\t\taddOrUpdateMap(sentenceStart, word)\n\t\t\tatSentenceStart = false\n\t\t}\n\n\t\t// if we are at the end of a sentence, deal with that in a similar way, and set a flag\n\t\tif idx == len(words)-1 || isEndOfSentence(word) {\n\t\t\taddOrUpdateMap(sentenceEnd, word)\n\t\t\tatSentenceStart = true\n\t\t}\n\n\t\t// confirm we aren't at the end of the word list\n\t\tif idx+1 == len(words) {\n\t\t\tbreak\n\t\t}\n\n\t\taddOrUpdateMap(word, strings.ToLower(strings.TrimSpace(words[idx+1])))\n\t}\n\n\t// now need to update Weights of each word\n\tfor word, nextWords := range wordMap {\n\t\tsum := 0\n\t\tfor _, props := range nextWords {\n\t\t\tsum += props.Count\n\t\t}\n\t\tfor nextWord, props := range nextWords {\n\t\t\twordMap[word][nextWord].Weight = float64(props.Count) / float64(sum)\n\t\t}\n\t}\n\n\treturn wordMap\n}", "title": "" }, { "docid": "81a5c8f9e8ce013efe728f73e3b6f22a", "score": "0.5003266", "text": "func findLongestWord(s string, d []string) string {\n\tif len(d) == 0 || len(s) == 0 {\n\t\treturn \"\"\n\t}\n\tcandidateList := make([]string, 0)\n\t// find which word is in s\n\tfor i := 0; i < len(d); i++ {\n\t\tword := d[i]\n\t\tpointS := 0\n\t\tpointW := 0\n\t\tfor pointW < len(word) && pointS < len(s) {\n\t\t\tif pointW == len(word)-1 && s[pointS] == word[pointW] {\n\t\t\t\tcandidateList = append(candidateList, word)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif s[pointS] == word[pointW] {\n\t\t\t\tpointS++\n\t\t\t\tpointW++\n\t\t\t\tcontinue\n\t\t\t} else {\n\t\t\t\t// s 剩下的比word里的还少了 就没必要继续循环了\n\t\t\t\tif (len(s) - pointS) < (len(word) - pointW) {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tpointS++\n\t\t\t}\n\t\t}\n\t}\n\t// find out the result\n\tif len(candidateList) == 0 {\n\t\treturn \"\"\n\t}\n\tres := \"\"\n\tfor i := 0; i < len(candidateList); i++ {\n\t\tword := candidateList[i]\n\t\tif len(word) > len(res) {\n\t\t\tres = word\n\t\t\tcontinue\n\t\t}\n\t\tif len(word) == len(res) {\n\t\t\tres = checkLex(word, res)\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "eb2af8b7ef41cb49ddadb62e12d2b828", "score": "0.4982292", "text": "func commonPrefixLength(text1, text2 []rune) int {\n\t// Linear search. See comment in commonSuffixLength.\n\tn := 0\n\tfor ; n < len(text1) && n < len(text2); n++ {\n\t\tif text1[n] != text2[n] {\n\t\t\treturn n\n\t\t}\n\t}\n\treturn n\n}", "title": "" }, { "docid": "fc1a3f84176ac34fe839c4b7f55a69e5", "score": "0.49462113", "text": "func longestCommonSequence(s1, s2 string) int {\n\t// Initialization.\n\tlcs := make([][]int, len(s1)+1)\n\tfor i := 0; i <= len(s1); i++ {\n\t\tlcs[i] = make([]int, len(s2)+1)\n\t}\n\n\tfor i := 0; i <= len(s1); i++ {\n\t\tfor j := 0; j <= len(s2); j++ {\n\t\t\tif i == 0 || j == 0 {\n\t\t\t\t// Boundary of dynamic programming array.\n\t\t\t\t// lcs[0][j] or lcs[i][0] means:\n\t\t\t\t// Not choosing any characters from s1 or s2,\n\t\t\t\t// thus the length of LCS must be zero.\n\t\t\t\tlcs[i][j] = 0\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif s1[i-1] == s2[j-1] {\n\t\t\t\t// If last characters of s1 and s2 substrings are equal,\n\t\t\t\t// then the length of longest common sequence of current\n\t\t\t\t// s1 and s2 substrings must be the length of s1 and s2\n\t\t\t\t// without current last characters' longest common sequence plus 1.\n\t\t\t\t// (1 for current common character.)\n\t\t\t\t// i.e. lcs[i-1][j-1] + 1.\n\t\t\t\tlcs[i][j] = lcs[i-1][j-1] + 1\n\t\t\t} else {\n\t\t\t\t// If last characters of s1, s2 substrings are not equal,\n\t\t\t\t// then the length of LCS of s1, s2 substrings must be\n\t\t\t\t// the maximum length of:\n\t\t\t\t// s1[0->i-2] substring vs. s2[0->j-1] substring\n\t\t\t\t// s1[0->i-1] substring vs. s2[0->j-2] substring\n\t\t\t\t// i.e. Max(lcs[i-1][j], lcs[i][j-1].\n\t\t\t\tif lcs[i-1][j] >= lcs[i][j-1] {\n\t\t\t\t\tlcs[i][j] = lcs[i-1][j]\n\t\t\t\t} else {\n\t\t\t\t\tlcs[i][j] = lcs[i][j-1]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn lcs[len(s1)][len(s2)]\n}", "title": "" }, { "docid": "a3e3f37695375f439232c0185660ae2e", "score": "0.4946162", "text": "func (h Hyphenator) hypthnateWord(word string) []string {\n\t// Don't hyphenate short words\n\tif len(word) < 5 {\n\t\treturn []string{word}\n\t}\n\tvar points []int\n\t// Handle exceptions to the patterns\n\tif _, exist := h.Exceptions[strings.ToLower(word)]; exist {\n\t\tpoints = h.Exceptions[strings.ToLower(word)]\n\t} else {\n\t\t// Otherwise, perform the general algorithm\n\t\tmodifiedWord := \".\" + strings.ToLower(word) + \".\"\n\t\tpoints = make([]int, len(modifiedWord)+1)\n\t\tfor i := 0; i < len(modifiedWord); i++ {\n\t\t\tt := h.Tree\n\t\t\tfor _, c := range modifiedWord[i:] {\n\t\t\t\tif _, exist = t[string(c)]; exist {\n\t\t\t\t\tt = t[string(c)].(recursiveMap)\n\t\t\t\t\tif _, exist = t[\"\"]; exist {\n\t\t\t\t\t\tp := t[\"\"].([]int)\n\t\t\t\t\t\tfor j := 0; j < len(p); j++ {\n\t\t\t\t\t\t\tpoints[i+j] = max(points[i+j], p[j])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// No hyphens in first or last two chars\n\t\tpoints[1], points[2], points[len(points)-2], points[len(points)-3] = 0, 0, 0, 0\n\t}\n\tpieces := []string{\"\"}\n\t// First two points aren't useful for hyphenation\n\tclippedPoints := points[2:]\n\tfor x := 0; x < len(word); x++ {\n\t\tpieces[len(pieces)-1] += string(word[x])\n\t\tif clippedPoints[x]%2 != 0 {\n\t\t\tpieces = append(pieces, \"\")\n\t\t}\n\t}\n\treturn pieces\n}", "title": "" }, { "docid": "a3b3948c9c2282e205381407743c179b", "score": "0.49398366", "text": "func substringDiff(k int32, s1 string, s2 string) int32 {\n\tlength := len(s1)\n\tbest := 0\n\tfor i := 0; i < length; i++ {\n\t\tbest = max(best, maxLengthDiff(0, i, int(k), s1, s2), maxLengthDiff(i, 0, int(k), s1, s2))\n\n\t}\n\treturn int32(best)\n}", "title": "" }, { "docid": "ae345ffbb1f6ebd42ecf1c79304863ab", "score": "0.4905884", "text": "func maxProduct2(words []string) int {\n\tmax := 0\n\tfor i := 0; i < len(words); i++ {\n\t\tfor j := i + 1; j < len(words); j++ {\n\t\t\tif shareCommonLetter(words[i], words[j]) == false {\n\t\t\t\tif max < len(words[i])*len(words[j]) {\n\t\t\t\t\tmax = len(words[i]) * len(words[j])\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn max\n}", "title": "" }, { "docid": "d785b502fed98d3164c8f7408a56d4fc", "score": "0.49024326", "text": "func ld(s, t string, ignoreCase bool) int {\n\tif ignoreCase {\n\t\ts = strings.ToLower(s)\n\t\tt = strings.ToLower(t)\n\t}\n\td := make([][]int, len(s)+1)\n\tfor i := range d {\n\t\td[i] = make([]int, len(t)+1)\n\t}\n\tfor i := range d {\n\t\td[i][0] = i\n\t}\n\tfor j := range d[0] {\n\t\td[0][j] = j\n\t}\n\tfor j := 1; j <= len(t); j++ {\n\t\tfor i := 1; i <= len(s); i++ {\n\t\t\tif s[i-1] == t[j-1] {\n\t\t\t\td[i][j] = d[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tmin := d[i-1][j]\n\t\t\t\tif d[i][j-1] < min {\n\t\t\t\t\tmin = d[i][j-1]\n\t\t\t\t}\n\t\t\t\tif d[i-1][j-1] < min {\n\t\t\t\t\tmin = d[i-1][j-1]\n\t\t\t\t}\n\t\t\t\td[i][j] = min + 1\n\t\t\t}\n\t\t}\n\n\t}\n\treturn d[len(s)][len(t)]\n}", "title": "" }, { "docid": "d785b502fed98d3164c8f7408a56d4fc", "score": "0.49024326", "text": "func ld(s, t string, ignoreCase bool) int {\n\tif ignoreCase {\n\t\ts = strings.ToLower(s)\n\t\tt = strings.ToLower(t)\n\t}\n\td := make([][]int, len(s)+1)\n\tfor i := range d {\n\t\td[i] = make([]int, len(t)+1)\n\t}\n\tfor i := range d {\n\t\td[i][0] = i\n\t}\n\tfor j := range d[0] {\n\t\td[0][j] = j\n\t}\n\tfor j := 1; j <= len(t); j++ {\n\t\tfor i := 1; i <= len(s); i++ {\n\t\t\tif s[i-1] == t[j-1] {\n\t\t\t\td[i][j] = d[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tmin := d[i-1][j]\n\t\t\t\tif d[i][j-1] < min {\n\t\t\t\t\tmin = d[i][j-1]\n\t\t\t\t}\n\t\t\t\tif d[i-1][j-1] < min {\n\t\t\t\t\tmin = d[i-1][j-1]\n\t\t\t\t}\n\t\t\t\td[i][j] = min + 1\n\t\t\t}\n\t\t}\n\n\t}\n\treturn d[len(s)][len(t)]\n}", "title": "" }, { "docid": "d785b502fed98d3164c8f7408a56d4fc", "score": "0.49024326", "text": "func ld(s, t string, ignoreCase bool) int {\n\tif ignoreCase {\n\t\ts = strings.ToLower(s)\n\t\tt = strings.ToLower(t)\n\t}\n\td := make([][]int, len(s)+1)\n\tfor i := range d {\n\t\td[i] = make([]int, len(t)+1)\n\t}\n\tfor i := range d {\n\t\td[i][0] = i\n\t}\n\tfor j := range d[0] {\n\t\td[0][j] = j\n\t}\n\tfor j := 1; j <= len(t); j++ {\n\t\tfor i := 1; i <= len(s); i++ {\n\t\t\tif s[i-1] == t[j-1] {\n\t\t\t\td[i][j] = d[i-1][j-1]\n\t\t\t} else {\n\t\t\t\tmin := d[i-1][j]\n\t\t\t\tif d[i][j-1] < min {\n\t\t\t\t\tmin = d[i][j-1]\n\t\t\t\t}\n\t\t\t\tif d[i-1][j-1] < min {\n\t\t\t\t\tmin = d[i-1][j-1]\n\t\t\t\t}\n\t\t\t\td[i][j] = min + 1\n\t\t\t}\n\t\t}\n\n\t}\n\treturn d[len(s)][len(t)]\n}", "title": "" }, { "docid": "fa5e1d19d0d749f018c99736ffe64ec8", "score": "0.48750013", "text": "func dist(str1, str2 string) int {\n\tif max(len(str1), len(str2)) > 200 {\n\t\tif str1 == str2 {\n\t\t\treturn 0\n\t\t}\n\t\treturn max(len(str1), len(str2))\n\t}\n\tdp := [][]int{}\n\tfor i:=0; i <= len(str1); i++ {\n\t\trow := []int{}\n\t\tfor j:=0; j <= len(str2); j++ {\n\t\t\trow = append(row, 0)\n\t\t}\n\t\tdp = append(dp, row)\n\t}\n\tfor i:=0; i <= len(str1); i++ {\n\t\tfor j:=0; j <= len(str2); j++ {\n\t\t\tif min(i,j) == 0 {\n\t\t\t\tdp[i][j] = j+i\n\t\t\t}else if str1[i-1] == str2[j-1] {\n\t\t\t\tdp[i][j] = dp[i-1][j-1]\n\t\t\t}else{\n\t\t\t\tdp[i][j] = 1 + min(dp[i][j-1], min(dp[i-1][j], dp[i-1][j-1]))\n\t\t\t}\n\t\t}\n\t}\n\treturn dp[len(str1)][len(str2)]\n}", "title": "" }, { "docid": "e4433d62aa86cb2d37c771df49354611", "score": "0.4863253", "text": "func levenshtein(a, b string) int {\n\n\t// Find the length of the strings\n\tla, lb := len(a), len(b)\n\n\t// Create array to store distance\n\tcol := make([]int, la+1)\n\n\tvar lastdiag, olddiag, i, j int\n\tvar temp1, temp2, temp3 int\n\n\tfor i = 1; i <= la; i++ {\n\t\tcol[i] = i\n\t}\n\n\tfor i = 1; i <= lb; i++ {\n\t\tcol[0] = i\n\n\t\tfor j, lastdiag = 1, i-1; j <= la; j++ {\n\t\t\tolddiag = col[j]\n\t\t\ttemp1 = col[j] + 1\n\t\t\ttemp2 = col[j-1] + 1\n\t\t\tif a[j-1] == b[i-1] {\n\t\t\t\ttemp3 = lastdiag + 0\n\t\t\t} else {\n\t\t\t\ttemp3 = lastdiag + 1\n\t\t\t}\n\n\t\t\tcol[j] = min(temp1, temp2, temp3)\n\t\t\tlastdiag = olddiag\n\t\t}\n\t}\n\n\treturn col[la]\n}", "title": "" }, { "docid": "57d113ccd59f8a013334e032c6029b5c", "score": "0.48614624", "text": "func myFindLadders(beginWord string, endWord string, wordList []string) [][]string {\n\twords := make(map[string]struct{})\n\tfor i := range wordList {\n\t\twords[wordList[i]] = struct{}{}\n\t}\n\tif _, ok := words[endWord]; !ok {\n\t\treturn nil\n\t}\n\tresult := make([][]string, 0)\n\tqueue := [][]string{{beginWord}}\n\tvisited := make(map[string]struct{})\n\tlevel := 1\n\tlength := len(wordList) + 1\n\tfor len(queue) != 0 {\n\t\tladder := queue[0]\n\t\tqueue = queue[1:]\n\t\tif len(ladder) > level {\n\t\t\tfor w := range visited {\n\t\t\t\tdelete(words, w)\n\t\t\t}\n\t\t\tvisited = make(map[string]struct{})\n\t\t\tlevel = len(ladder)\n\t\t}\n\t\tif len(ladder) > length {\n\t\t\tbreak\n\t\t} else {\n\t\t\tif ladder[len(ladder)-1] == endWord {\n\t\t\t\tresult = append(result, ladder)\n\t\t\t\tlength = len(ladder)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tprev := ladder[len(ladder)-1]\n\t\tfor i := range prev {\n\t\t\tfor j := 'a'; j <= 'z'; j++ {\n\t\t\t\tnewWord := prev[:i] + string(j) + prev[i+1:]\n\t\t\t\tif _, ok := words[newWord]; !ok || newWord == prev {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvisited[newWord] = struct{}{}\n\t\t\t\tqueue = append(queue, append(append([]string{}, ladder...), newWord))\n\t\t\t}\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "a3ab8453a41fd38e4ed0522154cb29b8", "score": "0.48253432", "text": "func findRange(strtBound, endBound string) ([]string, error) {\n\t// Read dictionary file\n\tfile, err := openDictionary()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\t// Scan each line from the dictionary\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\t\n\t// Check order of start and end words and reverse their positions if reversed\n\tif !orderInput(strtBound, endBound) {\n\t\tstrtBound, endBound = endBound, strtBound\n\t}\n\n\tstrtBoundByts, endBoundByts := []byte(strtBound), []byte(endBound)\n\n\tvar words []string\n\tvar startIsSet, endIsSet bool\n\t\n\t// Read words from dictionary line by line\n\tfor scanner.Scan() {\n\t\t// Set up initial word bound\n\t\tif startIsSet {\n\t\t\tgoto FindEndBound\n\t\t}\n\n\t\t// If the first byte of both words is not the same\n\t\t// proceed with the next word from the dictionary\n\t\tif strtBoundByts[0] != scanner.Bytes()[0] {\n\t\t\t// If the search moved to the next letter -> no match if found for the provided\n\t\t\t// starting word\n\t\t\tif strtBoundByts[0] < scanner.Bytes()[0] {\n\t\t\t\t// \n\t\t\t\treturn nil, ErrBoundNotFound(strtBound)\n\t\t\t}\n\n\t\t\tgoto End\n\t\t}\n\n\t\t// First bytes are the same:\n\t\t// Compare lengths - go to next loop at first mismatch\n\t\tif len(strtBoundByts) != len(scanner.Bytes()) {\n\t\t\tgoto End\n\t\t}\n\n\t\t// Compare bytes from second position\n\t\t// Go to next loop at first mismatch\n\t\tfor i := 1; i < len(strtBoundByts); i++ {\n\t\t\tif strtBoundByts[i] != scanner.Bytes()[i] {\n\t\t\t\tgoto End\n\t\t\t}\n\t\t}\n\n\t\tstartIsSet = true\n\t\tgoto AddToRange\n\t\n// Set up the ending word bound\n// Mirror the steps\nFindEndBound:\n\n\t\t// If lengths of bound and scanned word are not the same, move to the next round\n\t\t// Here we check lengths first because words with non-matching first bytes are added\n\t\t// to the range\n\t\tif len(endBoundByts) != len(scanner.Bytes()) {\n\t\t\tgoto End\n\t\t}\n\n\t\t// Compare first bytes\n\t\t// If mismatch - add to the range\n\t\tif endBoundByts[0] != scanner.Bytes()[0] {\n\t\t\t// If the search moved to the next letter -> no match if found for the provided\n\t\t\t// ending word\n\t\t\tif endBoundByts[0] < scanner.Bytes()[0] {\n\t\t\t\t// \n\t\t\t\treturn nil, ErrBoundNotFound(endBound)\n\t\t\t}\n\t\t\tgoto AddToRange\n\t\t}\n\n\t\t// Loop over the bytes of endBound in order\n\t\t// stop at the first mismatch and add the current record to the range\n\t\tfor i := 1; i < len(endBoundByts); i++ {\n\t\t\t\n\t\t\t// If no match - continue adding to the range\n\t\t\tif endBoundByts[i] != scanner.Bytes()[i] {\n\t\t\t\tgoto AddToRange\n\t\t\t}\n\t\t}\n\n\t\t// Set endIsSet to true as anchor for breaking out of the loop\n\t\tendIsSet = true\n\nAddToRange:\n\t\twords = append(words, scanner.Text())\n\nEnd:\n\t\t// If end bound is set we break out of the loop\n\t\tif endIsSet {\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn words, nil\n}", "title": "" }, { "docid": "06d340d98cf14e585ac250479fb3b3b3", "score": "0.4806091", "text": "func countSubwords(word string, trie *Trie) (int, error) {\n\tcount := 0\n\tprefixes, err := trie.Prefixes(word)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tfor _, prefix := range prefixes {\n\t\tif prefix == word && count == 0 {\n\t\t\tcount = 1\n\t\t\tcontinue\n\t\t}\n\t\tsuffix := word[len(prefix):]\n\t\tsuffixes, err := countSubwords(suffix, trie)\n\t\tif err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t\tif suffixes > 0 && suffixes >= count {\n\t\t\tcount = suffixes + 1\n\t\t}\n\t}\n\treturn count, nil\n}", "title": "" }, { "docid": "b2c0fff666e0a2fe2a2b0ee0e9522573", "score": "0.47999", "text": "func Distance(s, t string) int {\n\tif s == t {\n\t\treturn 0\n\t}\n\tlen_s := len(s)\n\tlen_t := len(t)\n\tif len_s == 0 {\n\t\treturn len_t\n\t}\n\tif len_t == 0 {\n\t\treturn len_s\n\t}\n\tv0 := make([]int, len_t+1)\n\tv1 := make([]int, len_t+1)\n\tfor i := range v0 {\n\t\tv0[i] = int(i)\n\t}\n\tvar cost int = 0\n\tfor i := range s {\n\t\tv1[0] = int(i) + 1\n\t\tfor j := range t {\n\t\t\tif string(s[i]) == string(t[j]) {\n\t\t\t\tcost = 0\n\t\t\t} else {\n\t\t\t\tcost = 1\n\t\t\t}\n\t\t\tv1[j+1] = min(v1[j]+1, v0[j+1]+1, v0[j]+cost)\n\t\t}\n\t\tfor j := range v0 {\n\t\t\tv0[j] = v1[j]\n\t\t}\n\t}\n\treturn int(v1[len_t])\n}", "title": "" }, { "docid": "684e3ca1a4c8dec7c5ee96d20b214971", "score": "0.47857463", "text": "func longestCommonPrefix(strs []string) string {\n if len(strs) == 0 {\n \treturn \"\"\n }\n\n if len(strs) == 1 {\n \treturn strs[0]\n }\n\n maxLength := len(strs[0])\n\n\tfor _, str := range strs {\n\t\tmaxLength = min(maxLength, len(str))\n\t}\n\n\n\tsubstringMap := make(map[string]int)\n\n\tvar longestSubstring string\n\tvar longestLength int\n\t// populate the map\n\tfor _, str := range strs {\n\t\tfor j := 1; j <= maxLength; j++ {\n\t\t\tsubstring := str[:j]\n\t\t\tsubstringMap[substring] += 1\n\n\t\t\tif substringMap[substring] == len(strs) && len(substring) > longestLength {\n\t\t\t\tlongestLength = len(substring)\n\t\t\t\tlongestSubstring = substring\n\t\t\t}\n\t\t}\n\t}\n\n\treturn longestSubstring\n}", "title": "" }, { "docid": "799b21c0ceda3453ecd0c5eedada4090", "score": "0.47815043", "text": "func levenshtein(str1, str2 []rune) int {\n\ts1len := len(str1)\n\ts2len := len(str2)\n\tcolumn := make([]int, len(str1)+1)\n\n\tfor y := 1; y <= s1len; y++ {\n\t\tcolumn[y] = y\n\t}\n\tfor x := 1; x <= s2len; x++ {\n\t\tcolumn[0] = x\n\t\tlastkey := x - 1\n\t\tfor y := 1; y <= s1len; y++ {\n\t\t\toldkey := column[y]\n\t\t\tvar incr int\n\t\t\tif str1[y-1] != str2[x-1] {\n\t\t\t\tincr = 1\n\t\t\t}\n\n\t\t\tcolumn[y] = minimum(column[y]+1, column[y-1]+1, lastkey+incr)\n\t\t\tlastkey = oldkey\n\t\t}\n\t}\n\treturn column[s1len]\n}", "title": "" }, { "docid": "a4109195a47c21f3dab8d630f9174708", "score": "0.47692668", "text": "func buildMapFromWord(word string) map[rune]int {\n\tm := make(map[rune]int)\n\tfor _, l := range word {\n\t\tm[l]++\n\t}\n\treturn m\n}", "title": "" }, { "docid": "b42e67b38b13d05a4234b9994f2e3c91", "score": "0.47622362", "text": "func LevenshteinDistance(source, destination string) int {\n\tvec1 := make([]int, len(destination) + 1)\n\tvec2 := make([]int, len(destination) + 1)\n\n\tw1 := []rune(source)\n\tw2 := []rune(destination)\n\n\t// initializing vec1\n\tfor i := 0; i < len(vec1); i++ {\n\t\tvec1[i] = i\n\t}\n\n\t// initializing the matrix\n\tfor i := 0; i < len(w1); i++ {\n\t\tvec2[0] = i + 1;\n\n\t\tfor j := 0; j < len(w2); j++ {\n\t\t\tcost := 1\n\t\t\tif (w1[i] == w2[j]) {\n\t\t\t\tcost = 0\n\t\t\t}\n\t\t\tmin := minimum(vec2[j] + 1,\n\t\t\t\tvec1[j + 1] + 1,\n\t\t\t\tvec1[j] + cost)\n\t\t\tvec2[j + 1] = min\n\t\t}\n\n\t\tfor j := 0; j < len(vec1); j++ {\n\t\t\tvec1[j] = vec2[j]\n\t\t}\n\t}\n\n\treturn vec2[len(w2)]\n}", "title": "" }, { "docid": "f1a82d834764ab4ca1dfdb70ddf3886b", "score": "0.47520688", "text": "func minWindow(s string, t string) string {\n\ttHits := make(map[byte]int)\n\tfor i := 0; i < len(t); i++ {\n\t\ttHits[t[i]]++\n\t}\n\tl, h, hitCounts := 0, 0, 0\n\tml, mh, mLen := 0, 0, len(s)+1\n\tfor h < len(s) || hitCounts >= len(t) {\n\n\t\tif hitCounts < len(t) {\n\t\t\tfor h < len(s) {\n\t\t\t\tif _, ok := tHits[s[h]]; ok {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\th++\n\t\t\t}\n\t\t\tif h < len(s) {\n\t\t\t\tif tHits[s[h]] > 0 {\n\t\t\t\t\thitCounts++\n\t\t\t\t}\n\t\t\t\ttHits[s[h]]--\n\t\t\t}\n\t\t\th++\n\t\t} else {\n\t\t\tif v, ok := tHits[s[l]]; ok {\n\t\t\t\tif v >= 0 {\n\t\t\t\t\thitCounts--\n\t\t\t\t}\n\t\t\t\ttHits[s[l]]++\n\t\t\t\tl++\n\t\t\t}\n\t\t\tfor l < len(s) {\n\t\t\t\tif _, ok := tHits[s[l]]; ok {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tl++\n\t\t\t}\n\t\t}\n\t\tif hitCounts == len(t) && (h-l) < mLen {\n\t\t\tml, mh = l, h\n\t\t\tmLen = h - l\n\t\t}\n\t\tif mh-ml == len(t) {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn string([]byte(s)[ml:mh])\n}", "title": "" }, { "docid": "4343c1d3a8943c305aaf135ec6e10b3b", "score": "0.4750151", "text": "func sentencesIntersectedWordsCount(sent1 string, sent2 string) float32 {\n\t// split the sentence into words/tokens\n\tvar words1 = splitWordsToMap(sent1)\n\tvar words2 = splitWordsToMap(sent2)\n\n\t// If there is not intersection, just return 0\n\tif len(words1) == 0 && len(words2) == 0 {\n\t\treturn 0\n\t}\n\n\tvar intersectionCount = 0\n\tfor word1 := range words1 {\n\t\tvar _, exists = words2[word1]\n\t\tif exists {\n\t\t\tintersectionCount++\n\t\t}\n\t}\n\n\t// We normalize the result by the average number of words\n\tvar numerator = float32(intersectionCount)\n\tvar denominator = float32((len(words1) + len(words2)) / 2)\n\tvar result = numerator / denominator\n\treturn result\n}", "title": "" }, { "docid": "8381dcb5941003df0cb8292f24806559", "score": "0.47494033", "text": "func countWord(tokens map[string][]prose.Token, tokenParsers ...func(token string) string) (map[string]map[string]int, map[string]map[string][]int) {\n\t//itemName -> word -> count\n\tli := make(map[string]map[string]int)\n\t//itemName -> word -> location\n\toc := make(map[string]map[string][]int)\n\n\tfor key, value := range tokens {\n\t\tli[key] = make(map[string]int)\n\t\toc[key] = make(map[string][]int)\n\tOUTER:\n\t\tfor _, token := range value {\n\t\t\tword := token.Text\n\t\t\tfor _, fn := range tokenParsers {\n\t\t\t\tif strings.Compare(word, \"\") == 0 {\n\t\t\t\t\tcontinue OUTER\n\t\t\t\t}\n\t\t\t\tword = fn(word)\n\t\t\t}\n\t\t\tif _, ok := li[key][word]; ok {\n\t\t\t\tli[key][word] += 1\n\t\t\t\toc[key][word] = append(oc[key][word], token.Index)\n\t\t\t} else {\n\t\t\t\tli[key][word] = 1\n\t\t\t\toc[key][word] = []int{token.Index}\n\t\t\t}\n\t\t}\n\t}\n\treturn li, oc\n}", "title": "" }, { "docid": "36f156bef50791518f6d2cf6db5ad67d", "score": "0.47385412", "text": "func eDist(A, B string) int {\n\n\tvar minNum int\n\tlookup = make([]int, utf8.RuneCountInString(B)+1)\n\n\tfor i := range lookup {\n\t\tlookup[i] = i\n\t}\n\n\t// d_i*\n\tfor _, valA := range A {\n\t\tj, temp := 1, lookup[0]\n\t\tlookup[0]++\n\n\t\tfor _, valB := range B {\n\t\t\t// delete, insert\n\t\t\tminNum = min(lookup[j]+1, lookup[j-1]+1)\n\n\t\t\tif valA != valB {\n\t\t\t\t// substitute\n\t\t\t\tminNum = min(minNum, temp+1)\n\t\t\t} else {\n\t\t\t\t// update\n\t\t\t\tminNum = min(minNum, temp)\n\t\t\t}\n\n\t\t\ttemp, lookup[j] = lookup[j], minNum\n\t\t\tj++\n\t\t}\n\t}\n\n\treturn lookup[len(lookup)-1]\n}", "title": "" }, { "docid": "4be22099a98c701b1fc85d22911a2c2d", "score": "0.47331238", "text": "func rmin(s []byte) int {\n\tfmt.Println(string(s))\n\n\t// check from the solution store\n\tif m, ok := mem[string(s)]; ok {\n\t\treturn m\n\t}\n\n\tif len(s) == 1 {\n\t\treturn 1\n\t}\n\n\tif len(s) == 2 {\n\t\tif s[0] != s[1] {\n\t\t\treturn 1\n\t\t} else {\n\t\t\treturn 2\n\t\t}\n\t}\n\n\t// len(s) > 2\n\tm := len(s) // minimum length\n\n\t// m < 2 бол дахин цааш шалгах шаардлагагүй, үүнээс цааш багасах боломжгүй\n\tfor i := 0; i < len(s)-1 && m > 2; i++ {\n\n\t\tif s[i] != s[i+1] {\n\n\t\t\t// replace letters at position (i, i+1)\n\t\t\td := byte('?')\n\t\t\tif s[i] == byte('a') && s[i+1] == byte('b') {\n\t\t\t\td = byte('c')\n\t\t\t} else if s[i] == byte('a') && s[i+1] == byte('c') {\n\t\t\t\td = byte('b')\n\t\t\t} else if s[i] == byte('b') && s[i+1] == byte('a') {\n\t\t\t\td = byte('c')\n\t\t\t} else if s[i] == byte('b') && s[i+1] == byte('c') {\n\t\t\t\td = byte('a')\n\t\t\t} else if s[i] == byte('c') && s[i+1] == byte('a') {\n\t\t\t\td = byte('b')\n\t\t\t} else if s[i] == byte('c') && s[i+1] == byte('b') {\n\t\t\t\td = byte('a')\n\t\t\t}\n\n\t\t\tvar t []byte\n\t\t\tt = append(t, s[:i]...)\n\t\t\tt = append(t, d)\n\t\t\tt = append(t, s[i+2:]...)\n\n\t\t\t// concate strings and create a new copy\n\t\t\trm := rmin(t)\n\t\t\tif m > rm {\n\t\t\t\tm = rm\n\t\t\t}\n\t\t}\n\t}\n\n\t// store solution\n\tmem[string(s)] = m\n\n\treturn m\n}", "title": "" }, { "docid": "83f5ea85c1e9144faa65974e5bb61075", "score": "0.47098184", "text": "func CheckWords(word1 string, word2 string) (int, error) {\n\n\tlen1 := len(word1)\n\tlen2 := len(word2)\n\n\tif (len1 != len2) || (len1 == 0) {\n\t\treturn 0, errors.New(\"invalid words: \" + word1 + \", \" + word2)\n\t}\n\treturn len1, nil\n}", "title": "" }, { "docid": "b58c09b871b981800d229117f0908c20", "score": "0.47055113", "text": "func minLength(a, b []string) int {\n\tif len(a) <= len(b) {\n\t\treturn len(a)\n\t}\n\treturn len(b)\n}", "title": "" }, { "docid": "9d0c2d762e091f7db5f0c8de5cb145a3", "score": "0.47050452", "text": "func AllLegalSubstrings(words []string, phrasing Phrasing) map[string]bool {\n\tif len(words) != 1 {\n\t\tpanic(\"Word must be [1]string\")\n\t}\n\tlength := Sum(phrasing.Lengths)\n\tsubs := map[string]bool{}\n\tword := strings.ToLower(words[0])\n\tif len(word) <= 1 {\n\t\treturn subs\n\t}\n\tif strings.Contains(word, \"_\") {\n\t\tword = strings.Replace(word, \"_\", \"\", -1)\n\t}\n\tif len(word) > length {\n\t\tfor i := 1; i < len(word)-length; i++ {\n\t\t\ts := word[i : i+length]\n\t\t\tif _, ok := (SYNONYMS)[s]; ok {\n\t\t\t\tsubs[s] = true\n\t\t\t}\n\t\t}\n\t}\n\tfor l := 1; l <= min(len(word)-1, length, 3); l++ {\n\t\tsubs[word[:l]] = true // first l letters\n\t}\n\tsubs[word[len(word)-1:]] = true // last letter\n\tif len(word) > 2 {\n\t\tsubs[word[:1]+word[len(word)-1:]] = true // outside\n\t\tif len(word)%2 == 0 {\n\t\t\tsubs[word[len(word)/2-1:len(word)/2+1]] = true // center\n\t\t\tsubs[word[:len(word)/2-1]+word[len(word)/2+1:]] = true // all but center\n\t\t} else {\n\t\t\tsubs[word[len(word)/2:len(word)/2+1]] = true // center\n\t\t\tsubs[word[:len(word)/2]+word[len(word)/2+1:]] = true // all but center\n\t\t}\n\t\tsubs[word[1:]] = true // all but first\n\t\tsubs[word[:len(word)-1]] = true // all but last\n\t\tsubs[word[1:len(word)-1]] = true // all but edges\n\t}\n\treturn bigram_filter(subs, phrasing.Lengths, 1)\n}", "title": "" }, { "docid": "84b730a2e86b6227eda51faf487d6e2d", "score": "0.4700375", "text": "func (_wm Wordmap) Compare(a, b string) int {\n\taMatches := _wm.WordsContaining(a)\n\tbMatches := _wm.WordsContaining(b)\n\tif len(aMatches) > len(bMatches) {\n\t\treturn 1\n\t} else if len(aMatches) < len(bMatches) {\n\t\treturn -1\n\t} else {\n\t\t// Compare by character length\n\t\tif len(a) > len(b) {\n\t\t\treturn 1\n\t\t} else if len(a) < len(b) {\n\t\t\treturn -1\n\t\t} else {\n\t\t\t// Lastly compare alphabetically\n\t\t\treturn strings.Compare(b, a)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f9f3151e3061a287258cc0abe83df8fb", "score": "0.4689774", "text": "func Distance(a, b string) (int, error) {\n\tcount := 0\n\n\tif len(a) != len(b) {\n\t\treturn count, fmt.Errorf(\"Not possible to calculate the Hamming distance between sequences of different lengths\")\n\t}\n\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "b037d710ff7e44e81ba8f2114eb29a9a", "score": "0.4667002", "text": "func Distance(a, b string) (int, error) {\n\tvar lenA = len([]rune(a))\n\tif lenA != len([]rune(b)) {\n\t\treturn 0, errors.New(\"strand should have the same longer\")\n\t}\n\n\tvar ct = 0\n\tfor i := 0; i < lenA; i++ {\n\t\tif a[i] != b[i] {\n\t\t\tct++\n\t\t}\n\t}\n\treturn ct, nil\n}", "title": "" }, { "docid": "d8cf27b55e590e1a1bab1d7b8d920ab1", "score": "0.4656246", "text": "func Levenshtein(str1, str2 []rune) int {\n\ts1len := len(str1)\n\ts2len := len(str2)\n\tcolumn := make([]int, len(str1)+1)\n\n\tfor y := 1; y <= s1len; y++ {\n\t\tcolumn[y] = y\n\t}\n\tfor x := 1; x <= s2len; x++ {\n\t\tcolumn[0] = x\n\t\tlastkey := x - 1\n\t\tfor y := 1; y <= s1len; y++ {\n\t\t\toldkey := column[y]\n\t\t\tvar incr int\n\t\t\tif str1[y-1] != str2[x-1] {\n\t\t\t\tincr = 1\n\t\t\t}\n\n\t\t\tcolumn[y] = minimum(column[y]+1, column[y-1]+1, lastkey+incr)\n\t\t\tlastkey = oldkey\n\t\t}\n\t}\n\treturn column[s1len]\n}", "title": "" }, { "docid": "cf142ea97cff851d80915197d7842808", "score": "0.46497822", "text": "func minLen(input []string) int {\n\tm := 0\n\tfor _, s := range input {\n\t\tif m == 0 || len(s) < m {\n\t\t\tm = len(s)\n\t\t}\n\t}\n\treturn m\n}", "title": "" }, { "docid": "44aeb4238eb006534c74b7eb34ef3d9d", "score": "0.46386653", "text": "func longestPrefix(k1, k2 string) int {\n\tmax := len(k1)\n\tif l := len(k2); l < max {\n\t\tmax = l\n\t}\n\tvar i int\n\tfor i = 0; i < max; i++ {\n\t\tif k1[i] != k2[i] {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "44aeb4238eb006534c74b7eb34ef3d9d", "score": "0.46386653", "text": "func longestPrefix(k1, k2 string) int {\n\tmax := len(k1)\n\tif l := len(k2); l < max {\n\t\tmax = l\n\t}\n\tvar i int\n\tfor i = 0; i < max; i++ {\n\t\tif k1[i] != k2[i] {\n\t\t\tbreak\n\t\t}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "f35c4365cda238042b6bd80e9b784968", "score": "0.46382716", "text": "func applyConstraints(hash string, size int, nonalphanumeric bool) string {\n\tstartingSize := size - 4\n\tresult := make([]byte, startingSize, size)\n\tcopy(result, hash[:startingSize])\n\textras := []byte(hash[startingSize:])\n\tnext := extras[0]\n\textras = extras[1:]\n\tif bytes.IndexFunc(result, unicode.IsUpper) < 0 {\n\t\tnext = 'A' + next%26\n\t}\n\tresult = append(result, next)\n\tnext = extras[0]\n\textras = extras[1:]\n\tif bytes.IndexFunc(result, unicode.IsLower) < 0 {\n\t\tnext = 'a' + next%26\n\t}\n\tresult = append(result, next)\n\tnext = extras[0]\n\textras = extras[1:]\n\tif bytes.IndexFunc(result, unicode.IsDigit) < 0 {\n\t\tnext = '0' + next%10\n\t}\n\tresult = append(result, next)\n\tif !nonalphanumeric || nonWord.FindIndex(result) == nil {\n\t\tnext = '+'\n\t} else {\n\t\tnext = extras[0]\n\t\textras = extras[1:]\n\t}\n\tresult = append(result, next)\n\n\tif !nonalphanumeric {\n\t\tloc := nonWord.FindIndex(result)\n\t\tfor ; loc != nil; loc = nonWord.FindIndex(result) {\n\t\t\tnext = extras[0]\n\t\t\textras = extras[1:]\n\t\t\tresult[loc[0]] = 'A' + next%26\n\t\t}\n\t}\n\tnext = extras[0] % byte(len(result))\n\trotated := append(result[next:], result[:next]...)\n\treturn string(rotated)\n}", "title": "" }, { "docid": "7f2836b2fa3ed3fa7a09f6c87df9902e", "score": "0.4630938", "text": "func phraseToInt(p Phrase, did DictionaryID) (*big.Int, error) {\n\t// Determine which dictionary to use based on the input language.\n\tvar dict Dictionary\n\tvar prefixLen int\n\tswitch {\n\tcase did == English:\n\t\tdict = englishDictionary\n\t\tprefixLen = EnglishUniquePrefixLen\n\tcase did == German:\n\t\tdict = germanDictionary\n\t\tprefixLen = GermanUniquePrefixLen\n\tcase did == Japanese:\n\t\tdict = japaneseDictionary\n\t\tprefixLen = JapaneseUniquePrefixLen\n\tdefault:\n\t\treturn nil, errUnknownDictionary\n\t}\n\n\tbase := big.NewInt(1626)\n\texp := big.NewInt(1)\n\tresult := big.NewInt(-1)\n\tfor _, word := range p {\n\t\t// Normalize the input.\n\t\tword = norm.NFC.String(word)\n\n\t\t// Get the first prefixLen runes from the string.\n\t\tvar prefix []byte\n\t\tvar runeCount int\n\t\tfor _, r := range word {\n\t\t\tencR := make([]byte, utf8.RuneLen(r))\n\t\t\tutf8.EncodeRune(encR, r)\n\t\t\tprefix = append(prefix, encR...)\n\n\t\t\truneCount++\n\t\t\tif runeCount == prefixLen {\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// Find the index associated with the phrase.\n\t\tvar tmp *big.Int\n\t\tfound := false\n\t\tfor j, word := range dict {\n\t\t\tif strings.HasPrefix(word, string(prefix)) {\n\t\t\t\ttmp = big.NewInt(int64(j))\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 nil, errUnknownWord\n\t\t}\n\n\t\t// Add the index to the int.\n\t\ttmp.Add(tmp, big.NewInt(1))\n\t\ttmp.Mul(tmp, exp)\n\t\texp.Mul(exp, base)\n\t\tresult.Add(result, tmp)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "3a303b6ff7a5667ea4093610da3b726d", "score": "0.4629326", "text": "func minWindow(s string, t string) string {\n\tif len(s) < len(t) || len(t) == 0 {\n\t\treturn \"\"\n\t}\n\n\t// 统计t的字符频率\n\tcharCnts := make([]int, 256)\n\tfor i := 0; i < len(t); i++ {\n\t\tcharCnts[t[i]]++\n\t}\n\n\t// 滑动处理s\n\tl, count, minL, minR := 0, len(t), 0, len(s)\n\tfor r := 0; r < len(s); r++ {\n\t\t// 尝试对当前字符的计数器减1\n\t\tcharCnts[s[r]]--\n\t\t// 如果计数器值大于等于0,则说明这个字符是目标字符,更新count\n\t\tif charCnts[s[r]] >= 0 {\n\t\t\tcount--\n\t\t}\n\n\t\t// 尝试移动左侧\n\t\tfor l < r && charCnts[s[l]] < 0 {\n\t\t\tcharCnts[s[l]]++\n\t\t\tl++\n\t\t}\n\n\t\t// 看看当前是否是一个有效地解\n\t\tif count == 0 && minR-minL > r-l {\n\t\t\tminL, minR = l, r\n\t\t}\n\t}\n\tif minR == len(s) {\n\t\treturn \"\"\n\t}\n\treturn s[minL : minR+1]\n}", "title": "" }, { "docid": "c012d997dca2efcb1c09d56ef11777f2", "score": "0.46276614", "text": "func Distance(a, b string) (int, error) {\n\td := 0\n\tif len(a) != len(b) {\n\t\treturn d, errors.New(\"sequences must be equal length\")\n\t}\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\td++\n\t\t}\n\t}\n\n\treturn d, nil\n}", "title": "" }, { "docid": "1eee170b5db1e2f3a9a4d7a7bc44e3e6", "score": "0.46260974", "text": "func min(len1, len2 int) int {\n\n\tif len1 < len2 {\n\t\treturn len1\n\t} else {\n\t\treturn len2\n\t}\n}", "title": "" }, { "docid": "e0fa4130a8ed9d6f29620dc0d98651d1", "score": "0.46211505", "text": "func ProcessPhrase(phrase string) (string, error) {\n\n\t// maintain information about which indices denote words\n\t// prevWord denotes information about which index before i was a word\n\tvar isWord []bool\n\tvar prevWord []int\n\n\tfor i := 0; i < len(phrase); i++ {\n\t\tisWord = append(isWord, false)\n\t\tprevWord = append(prevWord, -1)\n\n\t\t// for single letters, only letter i is a valid pronoun, rest are not considered\n\t\tif ((i == 0 || isWord[i-1] == true) && (string(phrase[i]) == \"i\" || string(phrase[i]) == \"I\")) {\n\t\t\tisWord[i] = true\n\t\t\tprevWord[i] = i-1\n\t\t\tcontinue\n\t\t}\n\n\t\t// if first letter was not an \"i\", go to next letter\n\t\tif i == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// find the complete word nearest to the left of index i, ignoring single letters\n\t\tfor j := i-2; j > -2; j-- {\n\t\t\tif j == -1 || isWord[j] == true {\n\n\t\t\t\t// if a word is found till index j, check if phrase[j+1:i+1] is a word\n\t\t\t\texists, error := oxforddict.ConnectAndCheck(phrase[j+1:i+1])\n\n\t\t\t\tif error != nil {\n\t\t\t\t\treturn \"\", error\n\t\t\t\t}\n\t\t\t\tif exists == true {\n\t\t\t\t\tisWord[i] = true\n\t\t\t\t\tif i > 0 {\n\t\t\t\t\t\tprevWord[i] = j\n\t\t\t\t\t}\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// find capitalized letter indices\n\tcapitals := findWordIndices(phrase, isWord, prevWord)\n\t// Capitalize the letters\n\tresPhrase := makeCamelCase(phrase, capitals)\n\n\treturn resPhrase, nil\n}", "title": "" }, { "docid": "5554526fee38e0a4f9a4bc2ad2bae98f", "score": "0.46043313", "text": "func solution(a, b []rune) bool {\n\t//1. brute force, generate all permutations and search if is the same as B\n\t//2. check if all the letters and their occurrences count are the same\n\t//3. sorting the characters and compare directly\n\n\tsort.Slice(a, func(i, j int) bool {\n\t\treturn a[i] < a[j]\n\t})\n\tsort.Slice(b, func(i, j int) bool {\n\t\treturn b[i] < b[j]\n\t})\n\treturn string(a) == string(b)\n}", "title": "" }, { "docid": "19de7736e804f6214405b01160b7ec93", "score": "0.46015066", "text": "func findSubstring(s string, words []string) []int {\n\tif len(s) == 0 || len(words) == 0 {\n\t\treturn nil\n\t}\n\n\twordsCnt := genWordsMap(words)\n\ttotalLen := charsLen(words)\n\twordLen := len(words[0])\n\tvar ans []int\n\n\tfor i := 0; i <= len(s)-totalLen; i++ {\n\t\tsub := s[i : i+totalLen]\n\t\tsubWordsCnt := make(map[string]int)\n\t\tfor j := 0; j < len(sub); j += wordLen {\n\t\t\tsubWordsCnt[sub[j:j+wordLen]] += subWordsCnt[sub[j:j+wordLen]] + 1\n\t\t}\n\t\tif equalWordsCnt(wordsCnt, subWordsCnt) {\n\t\t\tans = append(ans, i)\n\t\t}\n\t}\n\n\treturn ans\n}", "title": "" }, { "docid": "52ddd2211a6b4ee889657243e39bd959", "score": "0.45985478", "text": "func WordLength(dict [][]string, length int) string {\n\tif length > len(dict) - 1 || len( dict[length] ) == 0 {\t\t\n\t// if the word length exceeds the size of the hash table or the bucket is empty\n\t\tfmt.Printf(\"Generated password: None\\n\")\n\t\tfmt.Printf(\"word of length %d does not exist\\n\", length)\n\t\tos.Exit(-1)\n\t\treturn \"-1\"\n\t} else {\n\t\tindex := rand.Intn( len(dict[length]) )\n\t\treturn dict[length][index]\n\t}\n}", "title": "" }, { "docid": "e70b1bc932e6c8cc7696aae2c714f086", "score": "0.4587527", "text": "func commonSuffixLength(text1, text2 []rune) int {\n\t// Use linear search rather than the binary search discussed at\n\t// https://neil.fraser.name/news/2007/10/09/. See discussion at\n\t// https://github.com/sergi/go-diff/issues/54.\n\ti1, i2 := len(text1), len(text2)\n\tfor n := 0; ; n++ {\n\t\ti1--\n\t\ti2--\n\t\tif i1 < 0 || i2 < 0 || text1[i1] != text2[i2] {\n\t\t\treturn n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fdf28982d13aa60a99b8b764b2b4c9b3", "score": "0.45873418", "text": "func WordCount(phrase string) Frequency {\n\tre := regexp.MustCompile(\"[[:punct:]]\")\n\tf := Frequency{}\n\tw := strings.Fields(strings.ToLower(phrase))\n\tfor _, v := range w {\n\t\tv = re.ReplaceAllString(v, \"\")\n\t\tif v != \"\" {\n\t\t\tf[v]++\n\t\t}\n\n\t}\n\treturn f\n}", "title": "" }, { "docid": "b1159a0fb81027192d40570f19613484", "score": "0.45853367", "text": "func (d Dictionary) Lengthen(v string) (o uint) {\n\to = 0\n\tfor i, chr := range v {\n\t\to += d.valueOf(chr, uint(i))\n\t}\n\treturn\n}", "title": "" }, { "docid": "79cff6a9f74ba88b43aee9d64cd750bd", "score": "0.45756334", "text": "func WordPatternMatching(pattern, words, originalPattern string, dict *map[string]string) {\n\tif len(pattern) == 0 {\n\t\tif len(words) == 0 {\n\t\t\talreadyPrinted := make(map[string]bool) // to avoid duplicate printing\n\t\t\tfor i := 0; i < len(originalPattern); i++ {\n\t\t\t\tcurrent := string(originalPattern[i])\n\t\t\t\t_, found := alreadyPrinted[current]\n\t\t\t\tif found == false {\n\t\t\t\t\tfmt.Println(current, (*dict)[current])\n\t\t\t\t\talreadyPrinted[current] = true\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn\n\t}\n\n\tcurrentPattern := string(pattern[0])\n\tpattern = pattern[1:]\n\t_, found := (*dict)[currentPattern]\n\tif found {\n\t\tpreviousMapped := (*dict)[currentPattern]\n\t\tif len(words) >= len(previousMapped) {\n\t\t\tcheck := words[:len(previousMapped)]\n\t\t\tright := words[len(previousMapped):]\n\t\t\tif check == previousMapped {\n\t\t\t\tWordPatternMatching(pattern, right, originalPattern, dict)\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tfor j := 0; j < len(words); j++ {\n\t\t\tleft := words[0 : j+1]\n\t\t\tright := words[j+1:]\n\t\t\t(*dict)[currentPattern] = left\n\t\t\tWordPatternMatching(pattern, right, originalPattern, dict)\n\t\t\tdelete(*(dict), currentPattern)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3c48b5884e55c89c20adbcc7c3eb27bb", "score": "0.457503", "text": "func longestCommonSubsequence(s, t string) int {\n\tsr, tr := []rune(s), []rune(t)\n\n\tsame := func(a, b rune) int {\n\t\tif a == b {\n\t\t\treturn 1\n\t\t}\n\t\treturn 0\n\t}\n\n\tmax := func(x, y, z int) int {\n\t\tif x < y {\n\t\t\tx = y\n\t\t}\n\t\tif x < z {\n\t\t\tx = z\n\t\t}\n\t\treturn x\n\t}\n\n\tmaxLen := make([][]int, len(sr)+1)\n\tfor i := 0; i < len(sr)+1; i++ {\n\t\tmaxLen[i] = make([]int, len(tr)+1)\n\t}\n\n\tfor x, xr := range sr {\n\t\tx += 1\n\t\tfor y, yr := range tr {\n\t\t\ty += 1\n\t\t\tmaxLen[x][y] = max(maxLen[x-1][y-1]+same(xr, yr), maxLen[x-1][y], maxLen[x][y-1])\n\t\t}\n\t}\n\n\treturn maxLen[len(sr)][len(tr)]\n}", "title": "" }, { "docid": "5c25222f8648511e463d7d82571e1fcd", "score": "0.45714584", "text": "func LevenshteinDistance(s string, t string) int {\n\tslen := len(s)\n\ttlen := len(t)\n\n\t/* degenerate cases */\n\tif s == t {\n\t\treturn 0\n\t}\n\tif slen == 0 {\n\t\treturn tlen\n\t}\n\tif tlen == 0 {\n\t\treturn slen\n\t}\n\n\tsr := []rune(s)\n\ttr := []rune(t)\n\t/* create two work vectors of integer distances */\n\n\tv0 := make([]int, tlen+1)\n\tv1 := make([]int, tlen+1)\n\n\t/* initialize v0 (the previous row of distances) */\n\t/* this row is A[0][i]: edit distance for an empty s */\n\t/* the distance is just the number of characters to delete from t */\n\tfor n := range v0 {\n\t\tv0[n] = n\n\t}\n\n\tfor i, y := range sr {\n\t\t/* calculate v1 (current row distances) from the previous row v0 */\n\n\t\t/* first element of v1 is A[i+1][0] */\n\t\t/* edit distance is delete (i+1) chars from s to match empty t */\n\t\tv1[0] = i + 1\n\n\t\t/* use formula to fill in the rest of the row */\n\n\t\tfor j, x := range tr {\n\t\t\t// calculating costs for A[i+1][j+1]\n\t\t\tsubstitutionCost := 0\n\t\t\tdeletionCost := v0[j+1] + 1\n\t\t\tinsertionCost := v1[j] + 1\n\t\t\tif x == y {\n\t\t\t\tsubstitutionCost = v0[j]\n\t\t\t} else {\n\t\t\t\tsubstitutionCost = v0[j] + 1\n\t\t\t}\n\t\t\tv1[j+1] = minimum(deletionCost, insertionCost, substitutionCost)\n\n\t\t}\n\t\t// copy v1 (current row) to v0 (previous row) for next iteration\n\t\t// since data in v1 is always invalidated, a swap without copy could be more efficient\n\t\tv0, v1 = v1, v0\n\n\t}\n\treturn v0[tlen]\n}", "title": "" }, { "docid": "7a33a68fc1618c2dfcd73f83a01c115d", "score": "0.4557064", "text": "func Distance(a, b string) (int, error) {\n\tvar HammingCount int = 0\n\tar, br := []rune(a), []rune(b)\n\n\tif len(ar) != len(br) {\n\t\treturn 0, errors.New(\"strings are not same length\")\n\t}\n\n\tfor i := range ar {\n\t\tif ar[i] != br[i] {\n\t\t\tHammingCount++\n\t\t}\n\t}\n\treturn HammingCount, nil\n}", "title": "" }, { "docid": "53fd5240770a82b4caf7bf14c7ebb95a", "score": "0.45554262", "text": "func calculateDifference(old, new *[]byte) (start, end int, replacement string) {\n\tcommonPrefix := 0 // length of the common prefix\n\tfor i, b := range *old {\n\t\tif i >= len(*new) || b != (*new)[i] {\n\t\t\tbreak\n\t\t}\n\t\tcommonPrefix++\n\t}\n\n\tcommonSuffix := 0 // length of the common suffix\n\tfor i := range *old {\n\t\tb := (*old)[len(*old)-1-i]\n\t\tif i >= len(*new) || b != (*new)[len(*new)-1-i] {\n\t\t\tbreak\n\t\t}\n\t\tcommonSuffix++\n\t}\n\n\t// In some cases common suffix and prefix can overlap. E.g. consider the following case:\n\t// old = \"abc\"\n\t// new = \"abdbc\"\n\t// In this case the common prefix is \"ab\" and the common suffix is \"bc\".\n\t// If they overlap, just shorten the suffix so that they don't.\n\t// The new suffix will be just \"c\".\n\tif commonPrefix+commonSuffix > len(*old) {\n\t\tcommonSuffix = len(*old) - commonPrefix\n\t}\n\tif commonPrefix+commonSuffix > len(*new) {\n\t\tcommonSuffix = len(*new) - commonPrefix\n\t}\n\treturn commonPrefix, len(*old) - commonSuffix, string((*new)[commonPrefix:(len(*new) - commonSuffix)])\n}", "title": "" }, { "docid": "08118db026037716ee32ceb374ab35bf", "score": "0.45479706", "text": "func lookupWord(lang, s string) (int, error) {\n\twordlist, ok := wordlists[lang]\n\tif !ok {\n\t\treturn 0, errors.New(\"invalid language code\")\n\t}\n\t// do a binary search for the word\n\t// loop invariant - min <= s < max\n\tmin := 0\n\tmax := len(wordlist)\n\tfor {\n\t\tif min >= max {\n\t\t\treturn 0, errors.New(\"word not found in wordlist\")\n\t\t}\n\t\tn := (min + max) / 2\n\t\tswitch strings.Compare(s, wordlist[n]) {\n\t\tcase 0:\n\t\t\treturn n, nil\n\t\tcase -1:\n\t\t\tmax = n\n\t\tcase 1:\n\t\t\tmin = n + 1\n\t\t}\n\t}\n}", "title": "" }, { "docid": "97977687d2808637cba59fcd4c8766d0", "score": "0.4547576", "text": "func Distance(a, b string) (int, error) {\n\n\tif len(a) != len(b) {\n\t\treturn 0, errors.New(\"different length\")\n\t}\n\n\truneA := []rune(a)\n\truneB := []rune(b)\n\tvar length int\n\n\tfor i := range runeA {\n\t\tif runeA[i] != runeB[i] {\n\t\t\tlength++\n\t\t}\n\t}\n\n\treturn length, nil\n}", "title": "" }, { "docid": "f84ba8c67f9c1e0d8022723d30d05766", "score": "0.45444712", "text": "func longestCommonSubsequence(text1 string, text2 string) int {\n\tm := len(text1)\n\tdp := make([][]int, 2)\n\n\t// much start with 0 (means empty string),\n\t// otherwise, the logic will be very clumsy\n\tdp[0] = make([]int, m+1)\n\tdp[1] = make([]int, m+1)\n\n\tfor _, y := range text2 {\n\t\tfor i, x := range text1 {\n\t\t\tif x == y {\n\t\t\t\tdp[1][i+1] = dp[0][i] + 1\n\t\t\t} else {\n\t\t\t\ta, b := dp[1][i], dp[0][i+1]\n\t\t\t\tif a < b {\n\t\t\t\t\ta = b\n\t\t\t\t}\n\t\t\t\tdp[1][i+1] = a\n\t\t\t}\n\t\t}\n\n\t\tdp[0], dp[1] = dp[1], dp[0]\n\t}\n\n\treturn dp[0][m]\n}", "title": "" }, { "docid": "47355ef01acd3a53ea52db9e34409702", "score": "0.45327193", "text": "func MostCommonWord(paragraph string, banned []string) string {\n\twordEndings := map[byte]bool{\n\t\t'.': true,\n\t\t',': true,\n\t\t';': true,\n\t\t'!': true,\n\t\t' ': true,\n\t\t'\\t': true,\n\t\t'\\n': true,\n\t\t'?': true,\n\t\t'\\'': true,\n\t}\n\n\tbannedLkup := make(map[string]bool, len(banned))\n\n\tfor _, ban := range banned {\n\t\tbannedLkup[ban] = true\n\t}\n\n\tvar maxWord string\n\tvar maxWordCount int\n\twordsCount := make(map[string]int, 10)\n\tvar currWord string\n\n\tfor i := 0; i <= len(paragraph); i++ {\n\t\tvar letter byte\n\n\t\tif i < len(paragraph) {\n\t\t\tletter = paragraph[i]\n\t\t}\n\n\t\tif _, wordEnded := wordEndings[letter]; wordEnded || i == len(paragraph) {\n\t\t\tif _, baned := bannedLkup[currWord]; len(currWord) > 0 && !baned {\n\t\t\t\twordCount := wordsCount[currWord]\n\t\t\t\twordsCount[currWord] = wordCount + 1\n\n\t\t\t\tif wordCount+1 > maxWordCount {\n\t\t\t\t\tmaxWordCount = wordCount + 1\n\t\t\t\t\tmaxWord = currWord\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tcurrWord = \"\"\n\t\t} else {\n\t\t\tcurrWord = fmt.Sprintf(\"%s%c\", currWord, unicode.ToLower(rune(letter)))\n\t\t}\n\t}\n\n\treturn maxWord\n}", "title": "" }, { "docid": "631bf403d99fa189a6bdd725f71b4cf6", "score": "0.45262682", "text": "func makeAnagram(a string, b string) int32 {\n\ta_map, b_map := make(map[rune]int32), make(map[rune]int32)\n\n\tfor _, letter := range a {\n\t\t_, exists := a_map[letter]\n\t\tif exists {\n\t\t\ta_map[letter]++\n\t\t} else {\n\t\t\ta_map[letter] = 1\n\t\t}\n\t}\n\n\tfor _, letter := range b {\n\t\t_, exists := b_map[letter]\n\t\tif exists {\n\t\t\tb_map[letter]++\n\t\t} else {\n\t\t\tb_map[letter] = 1\n\t\t}\n\t}\n\n\tremoved := int32(0)\n\tfor key := 'a'; key <= 'z'; key++ {\n\t\ta_val, a_exists := a_map[key]\n\t\tb_val, b_exists := b_map[key]\n\t\tif a_exists && b_exists {\n\t\t\tremoved += int32(math.Abs(float64(a_val - b_val)))\n\t\t} else if a_exists {\n\t\t\tremoved += a_val\n\t\t} else if b_exists {\n\t\t\tremoved += b_val\n\t\t}\n\t}\n\n\treturn removed\n}", "title": "" }, { "docid": "6725319f9eec30c94670bf237fe990a3", "score": "0.45246315", "text": "func lengthOfLongestSubstring(s string) int {\r\n idxMap := make(map[rune](int))\r\n start := 0\r\n end := -1\r\n maxLen := 0\r\n for idx, ele := range s {\r\n if oldIdx, ok := idxMap[ele]; ok{\r\n idxMap[ele] = idx\r\n if oldIdx >= start {\r\n curLen := end - start + 1\r\n if curLen > maxLen {\r\n maxLen = curLen\r\n }\r\n start = oldIdx + 1\r\n end = idx\r\n continue\r\n }\r\n }else{\r\n idxMap[ele] = idx\r\n }\r\n end = idx\r\n }\r\n curLen := end - start + 1\r\n if curLen > maxLen {\r\n maxLen = curLen\r\n }\r\n return maxLen\r\n}", "title": "" }, { "docid": "89e7724fc527a5b2445091501d0c2beb", "score": "0.45221767", "text": "func Distance(a, b string) (int, error) {\n\tif len(a) != len(b) {\n\t\treturn -1, errors.New(\"cannot compute hamming distance on different length sequences\")\n\t}\n\n\tdistance := 0\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\tdistance++\n\t\t}\n\t}\n\n\treturn distance, nil\n}", "title": "" }, { "docid": "3b4b5ed423f71048baeda4b1e3fea0d1", "score": "0.45190853", "text": "func main() {\n\tfmt.Println(minDistance(\"ros\", \"horse\"))\n\tfmt.Println(minDistance(\"horse\", \"ros\"))\n}", "title": "" }, { "docid": "12a1ecc76340f986b42c12c5bd49b587", "score": "0.45158222", "text": "func Transform(given map[int][]string) map[string]int {\n\tcount := make(map[string]int)\n\tfor val, result := range given {\n\t\tfor _, char := range result {\n\t\t\tchar := []rune(char)\n\t\t\tletter := unicode.ToLower(char[0])\n\t\t\tcount[string(letter)] = val\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "efbc72736d70b86bbb6458f34a39b3ff", "score": "0.45153242", "text": "func WordCount(input string) Frequency {\n\tfreq := make(Frequency)\n\n\twordStartIndex := -1\n\tfor peakIndex, r := range input {\n\t\tif unicode.IsLetter(r) || unicode.IsDigit(r) || r == '\\'' {\n\t\t\tif wordStartIndex < 0 {\n\t\t\t\twordStartIndex = peakIndex\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif wordStartIndex < 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tcountWord(freq, input[wordStartIndex:peakIndex])\n\t\twordStartIndex = -1\n\t}\n\tif wordStartIndex >= 0 && wordStartIndex < len(input) {\n\t\tcountWord(freq, input[wordStartIndex:])\n\t}\n\n\treturn freq\n}", "title": "" }, { "docid": "9fd040f6bb22d4802f95dd1dfbc19267", "score": "0.45111555", "text": "func (c *corpus) wordFreq(w []string) {\n out := make(map[string]int)\n\n var total int\n for _, x := range w {\n if _, ok := out[x]; ok {\n out[x]++\n total++\n } else {\n out[x] = 1\n total++\n }\n }\n\n c.words = out\n c.total = float64(total)\n}", "title": "" }, { "docid": "58b0cce8cf1a825a65f5ec137fdfde16", "score": "0.45086554", "text": "func LongestCompoundWord(words []string) (string, []string, error) {\n\tmatch := \"\"\n\tlongest := 0\n\tskipped := 0\n\ttrie, err := toTrie(words)\n\tif err != nil {\n\t\treturn \"\", nil, err\n\t}\n\tfor _, word := range words {\n\t\tif len(word) >= longest {\n\t\t\tlength, err := countSubwords(word, trie)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", nil, err\n\t\t\t}\n\t\t\tif length > 1 && length > longest {\n\t\t\t\tmatch = word\n\t\t\t\tlongest = length\n\t\t\t}\n\t\t} else {\n\t\t\tskipped++\n\t\t}\n\t}\n\tvar subwords []string\n\tif longest > 1 {\n\t\tif subwords, err = decompose(match, trie); err != nil {\n\t\t\treturn \"\", nil, err\n\t\t}\n\t}\n\treturn match, subwords, nil\n}", "title": "" }, { "docid": "b4a4c7f0e52cb28108bdce286cbfeb28", "score": "0.45039123", "text": "func WordCount(s string) map[string]int {\n\tm := make(map[string]int)\n\n\tfor _, w := range strings.Fields(s) {\n\t\t// if elem, ok := m[w]; ok == true {\n\t\t// \tm[w]++\n\t\t// } else {\n\t\t// \tm[w] = elem + 1\n\t\t// }\n\t\tm[w]++\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "3adb63724708631e07f899066def8bb5", "score": "0.45037526", "text": "func Distance(str1, str2 string) int {\n\tvar cost, lastdiag, olddiag, p int\n\n\ts1 := []rune(str1)\n\ts2 := []rune(str2)\n\n\tlen1 := len(s1)\n\tlen2 := len(s2)\n\n\tfor ; p < len1 && p < len2; p++ {\n\t\tif s2[p] != s1[p] {\n\t\t\tbreak\n\t\t}\n\t}\n\ts1, s2 = s1[p:], s2[p:]\n\tlen1 -= p\n\tlen2 -= p\n\n\tfor 0 < len1 && 0 < len2 {\n\t\tif s1[len1-1] != s2[len2-1] {\n\t\t\ts1, s2 = s1[:len1], s2[:len2]\n\t\t\tbreak\n\t\t}\n\t\tlen1--\n\t\tlen2--\n\t}\n\n\tif len1 == 0 {\n\t\treturn len2\n\t}\n\n\tif len2 == 0 {\n\t\treturn len1\n\t}\n\n\tcolumn := make([]int, len1+1)\n\n\tfor y := 1; y <= len1; y++ {\n\t\tcolumn[y] = y\n\t}\n\n\tfor x := 1; x <= len2; x++ {\n\t\tcolumn[0] = x\n\t\tlastdiag = x - 1\n\t\tfor y := 1; y <= len1; y++ {\n\t\t\tolddiag = column[y]\n\t\t\tcost = 0\n\t\t\tif s1[y-1] != s2[x-1] {\n\t\t\t\tcost = 1\n\t\t\t}\n\t\t\tcolumn[y] = min(\n\t\t\t\tcolumn[y]+1,\n\t\t\t\tcolumn[y-1]+1,\n\t\t\t\tlastdiag+cost)\n\t\t\tlastdiag = olddiag\n\t\t}\n\t}\n\treturn column[len1]\n}", "title": "" }, { "docid": "0dd3ea022ed5d96440831420ab6ee423", "score": "0.45003754", "text": "func FindAnag(d *[][]byte, letters string, minLen int) (map[int][]string, string) {\n\n\twords := make(map[int][]string, len(letters))\n\n\tmaxLen := len(letters)\n\tbase := make([]int, 256)\n\tfor _, v := range []byte(letters) {\n\t\tbase[v]++\n\t}\n\n\tfor _, w := range *d {\n\t\tdebugPrint(\"Word: \" + string(w))\n\t\tif len(w) > maxLen {\n\t\t\tdebugPrint(\"Word too long\")\n\t\t\tcontinue\n\t\t}\n\t\tif len(w) < minLen {\n\t\t\tdebugPrint(\"Word too short\")\n\t\t\tcontinue\n\t\t}\n\t\tcount := make([]int, 256)\n\t\tfail := false\n\t\tfor _, l := range w {\n\t\t\tdebugPrint(\"Letter: \" + string(l))\n\t\t\tif count[l] >= base[l] {\n\t\t\t\tdebugPrint(\"Too many of letter\")\n\t\t\t\tfail = true\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tcount[l]++\n\t\t\t}\n\t\t}\n\t\tif !fail {\n\t\t\twords[len(w)] = append(words[len(w)], string(w))\n\t\t}\n\t}\n\n\treturn words, debugBuffer.String()\n}", "title": "" }, { "docid": "5bbfc3d2bd3c3132759c2b88b6a401cd", "score": "0.44995618", "text": "func genWordLen() int {\n\tf := rand.Float32() * 100\n\t// a table of word lengths and their frequencies.\n\tswitch {\n\tcase f < 1.939:\n\t\treturn 1\n\tcase f < 19.01:\n\t\treturn 2\n\tcase f < 38.00:\n\t\treturn 3\n\tcase f < 50.41:\n\t\treturn 4\n\tcase f < 61.00:\n\t\treturn 5\n\tcase f < 70.09:\n\t\treturn 6\n\tcase f < 78.97:\n\t\treturn 7\n\tcase f < 85.65:\n\t\treturn 8\n\tcase f < 90.87:\n\t\treturn 9\n\tcase f < 95.05:\n\t\treturn 10\n\tcase f < 97.27:\n\t\treturn 11\n\tcase f < 98.67:\n\t\treturn 12\n\tcase f < 100.0:\n\t\treturn 13\n\t}\n\treturn 2 // shouldn't get here\n}", "title": "" }, { "docid": "2282fc93da08c79bc6da1e7b9c0cb80c", "score": "0.4487691", "text": "func (seg *Segmenter) SuggestFreq(words ...string) float64 {\n\tfreq := 1.0\n\ttotal := seg.Dict.totalFreq\n\n\tif len(words) > 1 {\n\t\tfor _, word := range words {\n\t\t\tv, _, ok := seg.Find(word)\n\t\t\tif ok {\n\t\t\t\tfreq *= v\n\t\t\t}\n\n\t\t\tfreq /= total\n\t\t}\n\n\t\tfreq, _ = math.Modf(freq * total)\n\t\twordFreq := 0.0\n\t\tv, _, ok := seg.Find(strings.Join(words, \"\"))\n\t\tif ok {\n\t\t\twordFreq = v\n\t\t}\n\n\t\tif wordFreq < freq {\n\t\t\tfreq = wordFreq\n\t\t}\n\n\t\treturn freq\n\t}\n\n\tword := words[0]\n\tfor _, segment := range seg.Cut(word, false) {\n\t\tv, _, ok := seg.Find(segment)\n\t\tif ok {\n\t\t\tfreq *= v\n\t\t}\n\n\t\tfreq /= total\n\t}\n\n\tfreq, _ = math.Modf(freq * total)\n\tfreq += 1.0\n\twordFreq := 1.0\n\n\tv, _, ok := seg.Find(word)\n\tif ok {\n\t\twordFreq = v\n\t}\n\n\tif wordFreq > freq {\n\t\tfreq = wordFreq\n\t}\n\n\treturn freq\n}", "title": "" }, { "docid": "4afdb1504c878fb9c08bebf3273712b9", "score": "0.44875544", "text": "func solution2(input1, input2 string) bool {\n\tif len(input1) != len(input2) {\n\t\treturn false\n\t}\n\n\tcounts := make(map[rune]int)\n\n\tfor _, r := range input1 {\n\t\tcounts[r]++\n\t}\n\n\tfor _, r := range input2 {\n\t\tcounts[r]--\n\t}\n\n\tfor _, val := range counts {\n\t\tif val != 0 {\n\t\t\treturn false\n\t\t}\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "88bcb4ba0a16a99f62213530f159423d", "score": "0.4486146", "text": "func main() {\n\t//wordFilter := Constructor([]string{\"cabaabaaaa\", \"ccbcababac\", \"bacaabccba\", \"bcbbcbacaa\", \"abcaccbcaa\", \"accabaccaa\", \"cabcbbbcca\", \"ababccabcb\", \"caccbbcbab\", \"bccbacbcba\"})\n\twordFilter := Constructor([]string{\"apple\"})\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"app\", \"lica\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"bccbacbcba\", \"a\"))\n\tfmt.Printf(\"%+v\\n\", wordFilter.F(\"ap\", \"le\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"a\", \"aa\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"cabaaba\",\"abaaaa\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"cacc\", \"accbbcbab\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"ccbcab\", \"bac\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"bac\", \"cba\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"ac\", \"accabaccaa\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"bcbb\",\"aa\"))\n\t//fmt.Printf(\"%+v\\n\", wordFilter.F(\"ccbca\", \"cbcababac\"))\n\n}", "title": "" }, { "docid": "6fbb402642946493a9e087b3d6fb7344", "score": "0.44834435", "text": "func makeAnagram(a string, b string) int32 {\n\thashA := make(map[rune]int32)\n\tfor _, charA := range a {\n\t\thashA[charA]++\n\t}\n\thashB := make(map[rune]int32)\n\tfor _, charB := range b {\n\t\thashB[charB]++\n\t}\n\tcount := int32(0)\n\tfor charA, countA := range hashA {\n\t\tif _, found := hashB[charA]; found {\n\t\t\tif countA == hashB[charA] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif countA-hashB[charA] > 0 {\n\t\t\t\tcount += int32(countA - hashB[charA])\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcount += countA\n\t}\n\tfor charB, countB := range hashB {\n\t\tif _, found := hashA[charB]; found {\n\t\t\tif countB == hashA[charB] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif countB-hashA[charB] > 0 {\n\t\t\t\tcount += int32(countB - hashA[charB])\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcount += countB\n\t}\n\treturn count\n}", "title": "" }, { "docid": "ff57ba279e73a8cd6269ea0b54151883", "score": "0.44605", "text": "func minInputLen(re *syntax.Regexp) int {\n\tswitch re.Op {\n\tdefault:\n\t\treturn 0\n\tcase syntax.OpAnyChar, syntax.OpAnyCharNotNL, syntax.OpCharClass:\n\t\treturn 1\n\tcase syntax.OpLiteral:\n\t\tl := 0\n\t\tfor _, r := range re.Rune {\n\t\t\tif r == utf8.RuneError {\n\t\t\t\tl++\n\t\t\t} else {\n\t\t\t\tl += utf8.RuneLen(r)\n\t\t\t}\n\t\t}\n\t\treturn l\n\tcase syntax.OpCapture, syntax.OpPlus:\n\t\treturn minInputLen(re.Sub[0])\n\tcase syntax.OpRepeat:\n\t\treturn re.Min * minInputLen(re.Sub[0])\n\tcase syntax.OpConcat:\n\t\tl := 0\n\t\tfor _, sub := range re.Sub {\n\t\t\tl += minInputLen(sub)\n\t\t}\n\t\treturn l\n\tcase syntax.OpAlternate:\n\t\tl := minInputLen(re.Sub[0])\n\t\tvar lnext int\n\t\tfor _, sub := range re.Sub[1:] {\n\t\t\tlnext = minInputLen(sub)\n\t\t\tif lnext < l {\n\t\t\t\tl = lnext\n\t\t\t}\n\t\t}\n\t\treturn l\n\t}\n}", "title": "" }, { "docid": "3e0e4ad805f50e67f8721a4a2fcb0811", "score": "0.44553006", "text": "func (master *Master) WordCount(in WordCountInput, out *[]string) error {\n\n\tvar mapperConnection []*rpc.Client // stores connection established with mapper nodes\n\tvar reducerConnection []*rpc.Client // stores connection established with reducer nodes\n\tvar mapperCalls []*rpc.Call // stores asynchronous call to mappers\n\tvar reducerCalls []*rpc.Call // stores asynchronous call to reducers\n\tvar m int // number of total mappers\n\tvar r int // number of total reducers\n\tvar activeMappers int // number of working mappers\n\tvar tempFiles [][]string // temporary files used to store the intermediate results of computation\n\n\n\t// Retrieve mappers address\n\tmappers := in.Config.Mapper\n\tm = len(mappers)\n\n\t//Retrieve reducers address\n\treducers := in.Config.Reducer\n\tr = len(reducers)\n\n\t// Connect to mappers\n\tmapperConnection, err := connectTo(mappers)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Assign map\n\tif len(in.Files) >= m {\n\t\tactiveMappers = m\n\t\tfor idx := 0; idx < m; idx++ {\n\t\t\tlower := idx * len(in.Files) / m\n\t\t\tupper := (idx + 1) * len(in.Files) / m\n\t\t\ttemps, err := createTempFiles(r)\n\t\t\tif err != nil {\n\t\t\t\tremoveTempFiles(tempFiles)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempFiles = append(tempFiles, temps)\n\t\t\tinput := MapperArgs{InputFiles: in.Files[lower:upper], OutputFiles: temps}\n\t\t\tcall := mapperConnection[idx].Go(\"Worker.Map\", &input, nil, nil)\n\t\t\tmapperCalls = append(mapperCalls, call)\n\t\t}\n\t} else {\n\t\tactiveMappers = len(in.Files)\n\t\tfor idx := 0; idx < activeMappers; idx++ {\n\t\t\ttemps, err := createTempFiles(r)\n\t\t\tif err != nil {\n\t\t\t\tremoveTempFiles(tempFiles)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\ttempFiles = append(tempFiles, temps)\n\t\t\tinput := MapperArgs{InputFiles: in.Files[idx:idx + 1], OutputFiles:temps}\n\t\t\tcall := mapperConnection[idx].Go(\"Worker.Map\", &input, nil, nil)\n\t\t\tmapperCalls = append(mapperCalls, call)\n\t\t}\n\t}\n\n\t// Wait for mappers completion\n\terr = waitWorkers(mapperCalls)\n\tif err != nil {\n\t\tremoveTempFiles(tempFiles)\n\t\treturn err\n\t}\n\n\t// Connect to reducers\n\treducerConnection, err = connectTo(reducers)\n\tif err != nil {\n\t\tremoveTempFiles(tempFiles)\n\t\treturn err\n\t}\n\n\t// Create output files\n\toutputFiles, err := createOutputFiles(r, in.Config.OutDir)\n\tif err != nil {\n\t\tremoveTempFiles(tempFiles)\n\t\treturn err\n\t}\n\n\t// Assign reduce\n\tfor h := 0; h < r; h++ {\n\t\tvar inputFiles []string\n\t\tfor k := 0; k < activeMappers; k++ {\n\t\t\tinputFiles = append(inputFiles, tempFiles[k][h])\n\t\t}\n\t\tinput := ReducerArgs{InputFiles:inputFiles, OutputFile:outputFiles[h]}\n\t\tcall := reducerConnection[h].Go(\"Worker.Reduce\", &input, nil, nil)\n\t\treducerCalls = append(reducerCalls, call)\n\t}\n\n\t// Wait for reducers completion\n\terr = waitWorkers(reducerCalls)\n\tif err != nil {\n\t\tremoveTempFiles(tempFiles)\n\t\treturn err\n\t}\n\n\t// Remove intermediate files\n\terr = removeTempFiles(tempFiles)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Close connections\n\tdisconnectFrom(mapperConnection)\n\tdisconnectFrom(reducerConnection)\n\n\t// Return output files to client\n\t*out = outputFiles\n\n\treturn nil\n}", "title": "" }, { "docid": "3655d98ac7f7d3a975b18e6be720fb75", "score": "0.4455147", "text": "func Distance(a, b string) (int, error) {\n\tif len(a) != len(b) {\n\t\treturn -1, errors.New(\"strings are not the same length\")\n\t}\n\n\thammingDistance := 0\n\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\thammingDistance++\n\t\t}\n\t}\n\treturn hammingDistance, nil\n}", "title": "" }, { "docid": "8439abc1cf9a5095e49759a129fca7ba", "score": "0.44533128", "text": "func lengthOfLongestSubstring(s string) int {\n\tvar length, curr int\n\n\tmapChar := make(map[rune]int)\n\tfor pos, char := range s {\n\t\tif _, ok := mapChar[char]; !ok {\n\t\t\tcurr++\n\t\t} else {\n\t\t\tcurr = min(pos-mapChar[char], curr+1)\n\t\t}\n\t\tlength = max(length, curr)\n\t\tmapChar[char] = pos\n\t}\n\n\treturn length\n}", "title": "" }, { "docid": "665001ac3badc89ebd38d7b475c662f2", "score": "0.44509262", "text": "func Distance(a, b string) (int, error) {\n\t// Validate if lenght of both entry are equal\n\tif len(a) != len(b) {\n\t\t// If length are different, we return an error\n\t\terr := \"Both of the sequences must have the same lenght\"\n\t\treturn -1, errors.New(err)\n\t}\n\n\t// If they are equal, we do not need to iterate them and return this scenario\n\tif a == b {\n\t\treturn 0, nil\n\t}\n\n\t// diff will be the output of how many chars are different\n\tdiff := 0\n\t// Iterate one string and validate char by char if there are equal.\n\tfor index := 0; index < len(a); index++ {\n\t\t// For each char, we compare both strins using runes\n\t\tif a[index] != b[index] {\n\t\t\t// If they are different, we will increment the return value by 1\n\t\t\tdiff = diff + 1\n\t\t}\n\t}\n\t// Return the diff result\n\treturn diff, nil\n}", "title": "" }, { "docid": "dadb6d912c84224ea82929b7582148fe", "score": "0.44454986", "text": "func CloseStrings(word1 string, word2 string) bool {\n\tvar len1 int = len(word1)\n\tvar len2 int = len(word2)\n\tif len1 != len2{\n\t\treturn false\n\t}\n\tvar record1 [26]int\n\tvar record2 [26]int\n\tfor _,c := range word1{\n\t\trecord1[c - 'a']++\n\t}\n\tfor _,c := range word2{\n\t\trecord2[c - 'a']++\n\t}\n\tvar freq1 []int\n\tvar freq2 []int\n\tfor i := 0;i < 26;i++{\n\t\tif (record1[i] == 0 && record2[i] != 0) || (record1[i] != 0 && record2[i] == 0){\n\t\t\treturn false\n\t\t}\n\t\tif record1[i] == 0{\n\t\t\tcontinue\n\t\t}\n\t\tfreq1 = append(freq1,int(record1[i]))\n\t\tfreq2 = append(freq2,int(record2[i]))\n\t}\n\tsort.Ints(freq1)\n\tsort.Ints(freq2)\n\tfor i := 0;i < len(freq1);i++ {\n\t\tif freq1[i] != freq2[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "0397b3e5e3b6fc29ae7db3ba9bbe6bad", "score": "0.4444751", "text": "func calcDistance(a, b string) int {\n\tvar count = 0\n\tfor i := range a {\n\t\tif a[i] != b[i] {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "ae5c1d56a6fee9bab5c2c1ddc60a8a5e", "score": "0.44412193", "text": "func MinimumEntropyMatchSequence(password string, matches []match.Match) MinEntropyMatch {\n\tbruteforceCardinality := float64(entropy.CalcBruteForceCardinality(password))\n\tupToK := make([]float64, len(password))\n\tbackPointers := make([]match.Match, len(password))\n\n\tfor k := 0; k < len(password); k++ {\n\t\tupToK[k] = get(upToK, k-1) + math.Log2(bruteforceCardinality)\n\n\t\tfor _, match := range matches {\n\t\t\tif match.J != k {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\ti, j := match.I, match.J\n\t\t\t//see if best entropy up to i-1 + entropy of match is less that current min at j\n\t\t\tupTo := get(upToK, i-1)\n\t\t\tcandidateEntropy := upTo + match.Entropy\n\n\t\t\tif candidateEntropy < upToK[j] {\n\t\t\t\tupToK[j] = candidateEntropy\n\t\t\t\tmatch.Entropy = candidateEntropy\n\t\t\t\tbackPointers[j] = match\n\t\t\t}\n\t\t}\n\t}\n\n\t//walk backwards and decode the best sequence\n\tvar matchSequence []match.Match\n\tpasswordLen := len(password)\n\tpasswordLen--\n\tfor k := passwordLen; k >= 0; {\n\t\tmatch := backPointers[k]\n\t\tif match.Pattern != \"\" {\n\t\t\tmatchSequence = append(matchSequence, match)\n\t\t\tk = match.I - 1\n\n\t\t} else {\n\t\t\tk--\n\t\t}\n\n\t}\n\tsort.Sort(match.Matches(matchSequence))\n\n\tmakeBruteForceMatch := func(i, j int) match.Match {\n\t\treturn match.Match{Pattern: \"bruteforce\",\n\t\t\tI: i,\n\t\t\tJ: j,\n\t\t\tToken: password[i : j+1],\n\t\t\tEntropy: math.Log2(math.Pow(bruteforceCardinality, float64(j-i)))}\n\n\t}\n\n\tk := 0\n\tvar matchSequenceCopy []match.Match\n\tfor _, match := range matchSequence {\n\t\ti, j := match.I, match.J\n\t\tif i-k > 0 {\n\t\t\tmatchSequenceCopy = append(matchSequenceCopy, makeBruteForceMatch(k, i-1))\n\t\t}\n\t\tk = j + 1\n\t\tmatchSequenceCopy = append(matchSequenceCopy, match)\n\t}\n\n\tif k < len(password) {\n\t\tmatchSequenceCopy = append(matchSequenceCopy, makeBruteForceMatch(k, len(password)-1))\n\t}\n\tvar minEntropy float64\n\tif len(password) == 0 {\n\t\tminEntropy = float64(0)\n\t} else {\n\t\tminEntropy = upToK[len(password)-1]\n\t}\n\n\tcrackTime := roundToXDigits(entropyToCrackTime(minEntropy), 3)\n\treturn MinEntropyMatch{Password: password,\n\t\tEntropy: roundToXDigits(minEntropy, 3),\n\t\tMatchSequence: matchSequenceCopy,\n\t\tCrackTime: crackTime,\n\t\tCrackTimeDisplay: displayTime(crackTime),\n\t\tScore: crackTimeToScore(crackTime)}\n\n}", "title": "" }, { "docid": "00c97b8405bb8bc319684b964badd28f", "score": "0.4436841", "text": "func Distance(a, b string) (int, error) {\n\tif len(a) != len(b) {\n\t\treturn 0, errors.New(\n\t\t\tfmt.Sprintf(\"Sequences with different length, %d != %d.\", len(a), len(b)))\n\t}\n\n\td := 0\n\tfor i := 0; i < len(a); i++ {\n\t\tif a[i] != b[i] {\n\t\t\td += 1\n\t\t}\n\t}\n\treturn d, nil\n}", "title": "" } ]
7a1fa7bcd5c131bc6f144cbd2d3ec538
The patterns to look for in the JSON body. You must specify exactly one setting: either `all` or `includedPaths`. See [JsonMatchPattern]( for details.
[ { "docid": "f23cb264860024bd72e089bd4b8daa72", "score": "0.0", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyPtrOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBody) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternPtrOutput)\n}", "title": "" } ]
[ { "docid": "cfd720f6abe5de4e1b02eb35a0a35519", "score": "0.57035756", "text": "func MatchingJsonPath(param string) ParamMatcher {\n\treturn ParamMatcher{\n\t\tstrategy: ParamMatchesJsonPath,\n\t\tvalue: param,\n\t}\n}", "title": "" }, { "docid": "977cb2e824b12f89e3ad962e654d59ba", "score": "0.5412192", "text": "func SetupJSONByPaths(r *mux.Router, handler http.Handler, endpoint string) {\n\tr.Path(endpoint).Methods(\"POST\").Headers(\"Content-Type\", \"application/json\").Handler(handler)\n\tr.Path(endpoint).Methods(\"POST\").Headers(\"Content-Type\", \"application/json; charset=UTF-8\").Handler(handler)\n\tr.Path(endpoint).Methods(\"POST\").Headers(\"Content-Type\", \"application/json; charset=utf-8\").Handler(handler)\n\tr.Path(endpoint).Methods(\"POST\").Headers(\"Content-Type\", \"\").HandlerFunc(web.InvalidContentType)\n\tr.Path(endpoint).Methods(\"POST\").Handler(handler)\n}", "title": "" }, { "docid": "a4ba892a5b9c22d508a67bc172fa440e", "score": "0.5373707", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "6a166a671d4b7cdcc4cff63b3c0a9e75", "score": "0.536978", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "5a68d3fbad73077622dcb25e906f61bc", "score": "0.5363059", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "02dc0bf32de9eb9864edf08324abe5e3", "score": "0.5357411", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "d5574ec4ab4385100682d3781f1a6876", "score": "0.5347734", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "eb0a87beee882f4430625486fd6cfb8e", "score": "0.5345404", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a66759e9c4e3a72d98bed3384067edd4", "score": "0.5343499", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "9ff6711f6eab51e3f257c25290bd3121", "score": "0.5336975", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "7686a8f95395ab1ac71ba839bcf5c460", "score": "0.53338367", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "18f299dc2d02a164a56d1f25ed88920e", "score": "0.5322181", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "b1fdf22ec28282bdd4edbcb2c454d37c", "score": "0.5316972", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "0942bc3132dee0ebc67fd65937009ccc", "score": "0.53071856", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "6203079f51a3bb4841ec09886a62d9b2", "score": "0.53066576", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "b32e65b689cf81a1901973f44316d375", "score": "0.5303244", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "20d71a0b30c92322cad467037c840d8e", "score": "0.52989185", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "fa83c2a7c554ea2d405ac61e8356fe1b", "score": "0.5297011", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a30eb9ddf25804db1035b35a244df4ca", "score": "0.52944607", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "1e1603c66cd907e078002a660035400c", "score": "0.52920747", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "ddbb7fecc79a279d07466fba604a8a38", "score": "0.5288074", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "007b9482ba25f436d76a14932846778f", "score": "0.5288068", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "10e0a3a71550cec65053451a2a2b49f6", "score": "0.5287346", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "acb63899eba3406131433aed49bd0805", "score": "0.5285486", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "46830f3ffa44b988ec0f69918d70dbe9", "score": "0.5280582", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "4effba1cdc9cdfc1ed5f5f13e786b4fb", "score": "0.52791506", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "c2a1d1891440326484aac12417f9783b", "score": "0.52777505", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "285984582a3e533db32b3491b7e76155", "score": "0.527128", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "5acb1d528c9651058d9c548c468905a3", "score": "0.5270498", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "e70239e27ef68534b3c5e54fe9d301af", "score": "0.52669954", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a1fde56d1e0649142d040aa041c47b5e", "score": "0.525691", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "6ab89326f0409f13530ffea8f4d1f344", "score": "0.5254179", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "41f0e790dae0216347e57b4a597f94b1", "score": "0.5254007", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "2b5ced5bc6425a96666c6e6ba0887aed", "score": "0.52537006", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "75b0e49ff966dbdceb641388ee5beef9", "score": "0.52520883", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "7860787a33df9bc2ab827d0d67351f1f", "score": "0.5251986", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "90bcc34f30c4da6aafefb5094ad64ed3", "score": "0.5249664", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "ac4e7ed08a5710c168dc290232008ff5", "score": "0.5247845", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "13fdb73c5da80364d7dd1be9315822e3", "score": "0.52457964", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "ea6ce107bacad2829c2f3cdfd07358fa", "score": "0.5239627", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "a4c3eff0daebf3ba8fc117832e216fcb", "score": "0.5239586", "text": "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "c2a5f6590e8f80fe4ea4fcd2993a3f08", "score": "0.52380943", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "430c145f68d5765aa60de64ed8cd9529", "score": "0.52374834", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "5c82209bbeee58c89bb11e5c1993dc8d", "score": "0.5237152", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "c556b9192e5bedefbb3c4e6454101ad5", "score": "0.52360505", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "c0b79bac6df152baeea159a5a31a9de4", "score": "0.52333325", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "5c912f8356b12364b5f24ca5768d35e7", "score": "0.52330244", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "dd1b280fe19ad2cc48c4627887bf9074", "score": "0.5232857", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "d049838be73c37acbe2b80299b19ec61", "score": "0.5226788", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "2c769370cda9049b418c59c41c650239", "score": "0.5224496", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "8fd36a18110a6d40ce642344016c1879", "score": "0.52202994", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "8e716fa5047a7e9664dc8a70857222ab", "score": "0.5219824", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "7af9f785546375445a1dd3760ecea519", "score": "0.52134866", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "cf97ba14750e5c19e164d009ded45d51", "score": "0.52126735", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "040cefa9e25ce015b7fde71b4ae1d430", "score": "0.5211565", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "f2822d3c0c6c61fcf51753821877e4ad", "score": "0.5211557", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "0d1d343078c8aaf42befe936d2e19539", "score": "0.52104485", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "93e0a01355e0669687685037cf4cf271", "score": "0.5209107", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "743ec5986def156f3981d13739466dca", "score": "0.5208641", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "6d52b9b3e90ddfc5a18b6f8e707b6b08", "score": "0.5205689", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "6dba042d0e0b6b9a69236fc0c95e372d", "score": "0.5204778", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "841cb7472ef89a185a7b550eb1d83417", "score": "0.52043283", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "cdb2fa8609a3f3ab6cac5e8b61ca7e96", "score": "0.52016014", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a172f2f27154168075be65eb45f76615", "score": "0.52013856", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "8bc71f119528491f6ccd58ee6d3d7519", "score": "0.520085", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "8ba64b31e813ecbf09a769a3a910ec4f", "score": "0.5200742", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "544a93686a3f06664668c27e96358017", "score": "0.52006036", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementNotStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "4fc856edc68ba09f3fea78f9ba3cfd41", "score": "0.5196761", "text": "func (o WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementOrStatementStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a1db971b08d8e051ee818a9730f412fc", "score": "0.51959443", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "4086ee77d9ba2c480094ac5fa9a7a03a", "score": "0.519482", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "471cc265354edac8ca14b7003cb8e066", "score": "0.51944226", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "84493232de8b518f3b67b1edf6ace08b", "score": "0.51936543", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "6f94892a5033543a31c58eab4b380d0c", "score": "0.5193298", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "bd435fd40046a4b318df2cbbafd55514", "score": "0.51923585", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "9ed8899c983bb4d5c1322ae9163647c0", "score": "0.5189673", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "1e2564a22e1782f672ee23faee439796", "score": "0.51886004", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "26cd7635a4e5c670925125a22bd425a3", "score": "0.5188304", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "953c9954f6e49f60776df939252c9e36", "score": "0.5185454", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "fd012c724fd1cac402733f5ac05f8f0a", "score": "0.518537", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "6685648e6508971629f90f09612c9fc4", "score": "0.51853275", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "b7f35aa0718085ff902f22540c4b6bf1", "score": "0.51773113", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "80bfedd374c138d41708bf5017971c00", "score": "0.5174855", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "dfa21b42f96804a70db9088835a0a5ba", "score": "0.51736516", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "bf65ee6eec937b49122c309f701e4e62", "score": "0.51727515", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "fb169363ea659ce4efd9b00e84683647", "score": "0.5170162", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementNotStatementStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "1f19e55fb2d74b0d99116cf484df66ed", "score": "0.5165028", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "4ce4752ace2d96e92ef56659a89df079", "score": "0.516467", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "aea358beeaeea0e35fa55a1bf766d0eb", "score": "0.516411", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "f0702cfa549da1875ca97c0effb43cce", "score": "0.51629055", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "a0f98fe75709c0424a02469b4dca3f42", "score": "0.5162234", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "3ab25288be9619a178cd07d081eb7f9a", "score": "0.5161816", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementXssMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "55e51f2ef0a72d36b77e23f845c125ac", "score": "0.516089", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "87d0e33812638fc07f30b82caf5347da", "score": "0.5156645", "text": "func TestGetHandlerMoreSpecificPath(t *testing.T) {\n\ttbl := []struct {\n\t\tPattern string\n\t\tSpecificPath string\n\t\tWildcardPath string\n\t\tResourceName string\n\t}{\n\t\t{\"\", \"model\", \"$type\", \"model\"},\n\t\t{\"\", \"model.foo\", \"model.$id\", \"model.foo\"},\n\t\t{\"\", \"model.foo\", \"$type.foo\", \"model.foo\"},\n\t\t{\"\", \"model.$id\", \"model.>\", \"model.42\"},\n\t\t{\"\", \"model.$id.foo\", \"model.$id.$type\", \"model.42.foo\"},\n\t\t{\"\", \"model.$id.foo\", \"model.$id.>\", \"model.42.foo\"},\n\t\t{\"\", \"model.$id.foo\", \"model.>\", \"model.42.foo\"},\n\t\t{\"\", \"model.>\", \">\", \"model.foo\"},\n\t\t{\"\", \"model.>\", \"$type.>\", \"model.foo\"},\n\t\t{\"\", \"model.$id.>\", \"model.>\", \"model.42.foo\"},\n\t\t{\"\", \"model.$id.>\", \"$type.>\", \"model.42.foo\"},\n\t\t{\"\", \"model.$id.>\", \">\", \"model.42.foo\"},\n\t\t{\"test\", \"model\", \"$type\", \"test.model\"},\n\t\t{\"test\", \"model.foo\", \"model.$id\", \"test.model.foo\"},\n\t\t{\"test\", \"model.foo\", \"$type.foo\", \"test.model.foo\"},\n\t\t{\"test\", \"model.$id\", \"model.>\", \"test.model.42\"},\n\t\t{\"test\", \"model.$id.foo\", \"model.$id.$type\", \"test.model.42.foo\"},\n\t\t{\"test\", \"model.$id.foo\", \"model.$id.>\", \"test.model.42.foo\"},\n\t\t{\"test\", \"model.$id.foo\", \"model.>\", \"test.model.42.foo\"},\n\t\t{\"test\", \"model.>\", \">\", \"test.model.foo\"},\n\t\t{\"test\", \"model.>\", \"$type.>\", \"test.model.foo\"},\n\t\t{\"test\", \"model.$id.>\", \"model.>\", \"test.model.42.foo\"},\n\t\t{\"test\", \"model.$id.>\", \"$type.>\", \"test.model.42.foo\"},\n\t\t{\"test\", \"model.$id.>\", \">\", \"test.model.42.foo\"},\n\t}\n\n\tfor i, l := range tbl {\n\t\tspecificCalled := 0\n\t\twildcardCalled := 0\n\t\tm := res.NewMux(l.Pattern)\n\t\tm.Handle(l.SpecificPath, res.GetResource(func(r res.GetRequest) { specificCalled++ }))\n\t\tm.Handle(l.WildcardPath, res.GetResource(func(r res.GetRequest) { wildcardCalled++ }))\n\t\th, _, _, err := m.GetHandler(l.ResourceName)\n\t\tAssertNoError(t, err, \"test \", i)\n\t\th.Get(nil)\n\t\tAssertEqual(t, \"specificCalled\", specificCalled, 1, \"test \", i)\n\t\tAssertEqual(t, \"wildcardCalled\", wildcardCalled, 0, \"test \", i)\n\t}\n}", "title": "" }, { "docid": "9b355e1adee3973aa416d3b8105d9edf", "score": "0.51548874", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "95e268bac4219e4770944af609a900cb", "score": "0.51532805", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementByteMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "76180971fadc48c8a9a595596d639783", "score": "0.51530004", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "007e852d344e3ddf907c22691b749a2d", "score": "0.51496136", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "9beb5a234a2cf2224e190a0a28c4f4da", "score": "0.5147421", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementNotStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "333f8291be06e78b704262cd9994c713", "score": "0.5146375", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternOutput) All() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPattern) *WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAll {\n\t\treturn v.All\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchJsonBodyMatchPatternAllPtrOutput)\n}", "title": "" }, { "docid": "dce87e1b5fc1cf327a3ce2c2d2ba7b4f", "score": "0.5145482", "text": "func (o WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBody) WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementManagedRuleGroupStatementScopeDownStatementAndStatementStatementSizeConstraintStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" }, { "docid": "2d554472fea828ef6d2bc0b8337fe000", "score": "0.5145241", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyOutput) MatchPattern() WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBody) WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPattern {\n\t\treturn v.MatchPattern\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementOrStatementStatementRegexPatternSetReferenceStatementFieldToMatchJsonBodyMatchPatternOutput)\n}", "title": "" } ]
4691c0bf6363b0a4bcddc53a512de7f3
GetUser ... /\ \
[ { "docid": "f9758c0b6568739548f4aa2077573f66", "score": "0.6845489", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\r\n\tlog.Println(\"===>userHandlers.GetUser()\")\r\n\tw.Header().Add(\"Content-Type\", \"application/json\")\r\n\tlog.Printf(\" w.Header=%v\\n\", w.Header())\r\n\tlog.Printf(\" hostName=%v\\n\", hostName)\r\n\r\n\tparams := mux.Vars(r)\r\n\tlog.Printf(\" params=%v\\n\", params)\r\n\tmyDB := db.Connect()\r\n\tmyUser := &User{}\r\n\tparamInt, paramErr := strconv.Atoi(params[\"id\"])\r\n\tif paramErr == nil {\r\n\t\tmyUser.ID = paramInt\r\n\t\tuser, sqlErr := myUser.GetByID(myDB)\r\n\t\tif sqlErr == nil {\r\n\t\t\tlog.Printf(\"Successful select in service.GetUsers() user=%v\\n\", user)\r\n\t\t\tjson.NewEncoder(w).Encode(user)\r\n\t\t\treturn\r\n\t\t}\r\n\t\tlog.Printf(\"Error with database select in service.GetUser()\\n\")\r\n\t\tlog.Printf(\"Reason: %v\\n\", sqlErr)\r\n\t}\r\n\tlog.Printf(\"Error with Paramerer in userHandlers.GetUser()\\n\")\r\n\tlog.Printf(\"Reason: %v\\n\", paramErr)\r\n}", "title": "" } ]
[ { "docid": "f1dc5e00419844bd966570e819d8fdd6", "score": "0.7555243", "text": "func (u User) Get(ctx *gw.Context) {\n\n}", "title": "" }, { "docid": "f7bbc8dec750e38b43ac55f91b02a582", "score": "0.74267477", "text": "func (s *Service) GetUser(id string) (*User, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "370c110dd34e2fbf51d225f0fa7d6a1d", "score": "0.7384536", "text": "func UserGet(c *gin.Context) {\n id := c.Param(\"id\")\n Id, err := strconv.Atoi(id)\n if err != nil {\n c.JSON(http.StatusUnprocessableEntity, common.NewError(\"user get\", errors.New(\"DB: Invalid Id\")))\n return\n }\n\n user, err := FindOneUser(&UserModel{ID: Id}) // models.go function\n\n if err != nil {\n c.JSON(http.StatusUnprocessableEntity, common.NewError(\"user get\", errors.New(\"DB: Invalid Id\")))\n return\n }\n\n UpdateContextUserModel(c, user.ID)\n serializer := UnthSerializer{c} // serializer struct for working with a different user's data.\n c.JSON(http.StatusOK, gin.H{\"user\": serializer.Response()})\n}", "title": "" }, { "docid": "723a76ee5d396b603a6ee1241a5721e3", "score": "0.7362848", "text": "func getUser(name string)(string,error){\n\tresponse := `{\"id\": 1234, \"name\":\"mua\"}`\n\treturn response, nil\n}", "title": "" }, { "docid": "9057a5bacae7af3c36ebfac5b61181eb", "score": "0.73599875", "text": "func (s *Obj) GetUser(ctx context.Context, in *sea.GetUserRequest) (*sea.User, error) {\n\tvar(\n\t\tid int64\n\t)\n\n\tid, err := strconv.ParseInt(in.GetId(), 10, 64)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\tuser, err := user.Get(s.DB, id)\n\tif err != nil{\n\t\treturn nil, err\n\t}\n\n\tout := userToRpcUser(user)\n\n\treturn &out, nil\n}", "title": "" }, { "docid": "561cceacd8d5ff55af6b8f1e930a8991", "score": "0.7337523", "text": "func GetUser(username string) (authenticate.User, error) {\r\n\tdefer func() {\r\n\t\tif err := recover(); err != nil {\r\n\t\t\tfmt.Println(\">> Panic:\", err)\r\n\t\t}\r\n\t}()\r\n\r\n\t// Instantiate user\r\n\tvar (\r\n\t\tuser authenticate.User\r\n\t\trepid int\r\n\t\tpassword string\r\n\t\tfirstname string\r\n\t\tlastname string\r\n\t\temail string\r\n\t\tcontactno string\r\n\t\torganisation string\r\n\t\tlastloginDT time.Time\r\n\t)\r\n\tquery := \"SELECT RepID, Password, \" +\r\n\t\t\"FirstName, LastName, Email, \" +\r\n\t\t\"ContactNo, Organisation, LastLogin_dt \" +\r\n\t\t\"FROM Representatives WHERE UserName=?\"\r\n\r\n\tresults, err := DB.Query(query, username)\r\n\tif err != nil {\r\n\t\tpanic(\"error executing sql select in GetUser - \" + err.Error())\r\n\t} else {\r\n\t\tif results.Next() {\r\n\t\t\terr := results.Scan(&repid, &password, &firstname, &lastname,\r\n\t\t\t\t&email, &contactno, &organisation, &lastloginDT)\r\n\r\n\t\t\tif err != nil {\r\n\t\t\t\tpanic(\"error getting results from sql select\")\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tresults.Close()\r\n\t\t\treturn user, errors.New(\"user not found\")\r\n\t\t}\r\n\r\n\t\tisAdmin, isRequester, isHelper := IsMemberType(username)\r\n\r\n\t\tuser = authenticate.User{\r\n\t\t\tRepID: repid,\r\n\t\t\tUserName: username,\r\n\t\t\tPassword: password,\r\n\t\t\tFirstName: firstname,\r\n\t\t\tLastName: lastname,\r\n\t\t\tEmail: email,\r\n\t\t\tContactNo: contactno,\r\n\t\t\tOrganisation: organisation,\r\n\t\t\tLastLoginDT: lastloginDT,\r\n\t\t\tIsAdmin: isAdmin,\r\n\t\t\tIsRequester: isRequester,\r\n\t\t\tIsHelper: isHelper,\r\n\t\t}\r\n\t\tresults.Close()\r\n\t\treturn user, nil\r\n\t}\r\n}", "title": "" }, { "docid": "660b63309bdce2b34d6f50fa436f0617", "score": "0.73168325", "text": "func GetUser(context *gin.Context) {\n\t// Get model if exist\n\tvar user models.User\n\tif err := datasource.DB.Where(\"id = ?\", context.Param(\"id\")).First(&user).Error; err != nil {\n\t\tresponse.ERROR(context, http.StatusBadRequest)\n\t\t// c.JSON(http.StatusBadRequest, gin.H{\"error\": \"Record not found!\"})\n\t\treturn\n\t}\n\n\tresponse.JSON(context, http.StatusOK, user)\n}", "title": "" }, { "docid": "9d740e7bd6e5ad8d3c2edb00b56b814e", "score": "0.7301222", "text": "func (s *hyUsersrvc) GetUser(ctx context.Context, p *hyuser.GetUserPayload) (res *hyuser.User, view string, err error) {\n\tlog.Info().Msg(\"hyUser.getUser\")\n\n\tuser, err := s.userRepo.GetUser(p.UserID)\n\tif err != nil {\n\t\t// Not Found\n\t\tif strings.Contains(err.Error(), \"no rows in result set\") {\n\t\t\treturn nil, \"\", hyuser.MakeNotFound(errors.New(\"user not found\"))\n\t\t}\n\t\treturn nil, \"\", errors.Wrapf(err, \"fail to call userRepo.GetUser(%d)\", p.UserID)\n\t}\n\tres = user\n\tview = \"default\"\n\n\treturn\n}", "title": "" }, { "docid": "2d795142885da2e4b126f075d51c158d", "score": "0.7299411", "text": "func (ct *Controller) GetUser(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tfmt.Println(id)\n\n\tusers := &models.User{}\n\n\tresult := ct.db.Where(\"id = ?\", id).First(&users)\n\t// result := ct.db.Where(\"first_name = ?\", \"Jhonny\").First(users)\n\tif result.Error != nil {\n\t\tc.AbortWithStatus(404)\n\t\tfmt.Println(result.Error.Error())\n\t} else {\n\t\tc.JSON(200, &users)\n\t}\n}", "title": "" }, { "docid": "95e9ca45b4077a0afc202e6f350c4e35", "score": "0.7276215", "text": "func GetUser(db *gorm.DB, User *User, id string) (err error) {\n\terr = db.Where(\"id = ?\", id).First(User).Error\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f2976cadbeadf5ea975d6f73e83a8d57", "score": "0.72749025", "text": "func (s SecurityServiceOp) GetUser(n string) (User, error) {\n\n\tvar u User\n\n\turl := securityBasePath + \"/user/\" + n\n\n\treq, err := s.client.NewRequest(url, \"GET\", nil)\n\n\tif err != nil {\n\t\treturn u, err\n\t}\n\n\tresp, err := s.client.Do(req, &u)\n\n\tif err != nil {\n\t\treturn u, err\n\t}\n\tdefer resp.Body.Close()\n\n\treturn u, nil\n}", "title": "" }, { "docid": "82d37cc7d78b1d66837a879ea10ec92e", "score": "0.7268514", "text": "func (u *UserHandler) GetUser(ctx context.Context, req *user.GetUserRequest, resp *user.UserInfo) error {\n\t//\tvar user models.User\n\t// user.ID = req.UserId\n\n\t// _, err := u.srv.Login()\n\t// if err != nil {\n\t// \tlogger.Error(err)\n\t// \treturn err\n\t// }\n\n\treturn nil\n}", "title": "" }, { "docid": "9e478b2ea22967fbb049d0568be10e21", "score": "0.7266756", "text": "func GetUser(c *gin.Context) {\n\tvar err error\n\tvar output *user.Basic\n\tusrEmail := c.Param(\"userEmail\")\n\tctx, _ := authcontext.NewAuthContext(c)\n\n\tif output, err = user.GetByEmail(ctx, usrEmail); err == nil {\n\t\tc.JSON(http.StatusOK, output)\n\t}\n\tif err != nil {\n\t\tc.JSON(http.StatusPreconditionFailed, ResponseObject{\"error\": err.Error()})\n\t}\n}", "title": "" }, { "docid": "e50946dc63100637ce67517c0007df16", "score": "0.72559184", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "e50946dc63100637ce67517c0007df16", "score": "0.72559184", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\n}", "title": "" }, { "docid": "d44998b6005dcbcc9eb266878cf0d279", "score": "0.72548425", "text": "func GetUser_GET(c echo.Context, jwtWrapper *jwtsession.JwtWrapper, sessionMgr *session.Session) error {\r\n\t_, jwtContext, err := checkLoggedIn(c, jwtWrapper, sessionMgr, false)\r\n\tif err != nil {\r\n\t\treturn c.Redirect(http.StatusSeeOther, \"/\")\r\n\t}\r\n\r\n\tidParam := c.QueryParam(\"id\")\r\n\teditParam := c.QueryParam(\"edit\")\r\n\r\n\t// reuqesting the information for the user, using the post id\r\n\r\n\tdataPacket1, err1 := TapApi(http.MethodGet, \"\", \"db/info?id=\"+idParam+\"&db=UserInfo\", sessionMgr)\r\n\tfmt.Println(err1)\r\n\t// if error in fetching data\r\n\tif err1 != nil || (*dataPacket1)[\"ResBool\"] == \"false\" || len((*dataPacket1)[\"DataInfo\"].([]interface{})) == 0 {\r\n\t\t//if user id does not exist return to index page\r\n\t\tsession.UpdateJwt(\"error\", \"The detail: \"+idParam+\" cannot be found, please try another course\", jwtContext, c, jwtWrapper)\r\n\t\treturn c.Redirect(http.StatusSeeOther, \"/\")\r\n\t}\r\n\r\n\t// send data of post and its comments to the template for rendering\r\n\tuserData := (*dataPacket1)[\"DataInfo\"].([]interface{})[0]\r\n\tdataInsert := struct {\r\n\t\tUserData interface{}\r\n\t\tUserPersistInfo jwtsession.JwtContext\r\n\t\tOwner bool\r\n\t\tEdit bool\r\n\t}{\r\n\t\tuserData,\r\n\t\t*jwtContext,\r\n\t\tuserData.(map[string]interface{})[\"Username\"] == jwtContext.Username,\r\n\t\teditParam == \"true\",\r\n\t}\r\n\tsession.UpdateJwt(\"\", \"\", jwtContext, c, jwtWrapper)\r\n\treturn c.Render(http.StatusOK, \"updateuser.gohtml\", dataInsert)\r\n}", "title": "" }, { "docid": "131f0ee40e0d59a14597003b5efec880", "score": "0.7254188", "text": "func GetUser(c *gin.Context) {\n\n\tvar (\n\t\tUser models.Users\n\t)\n\n\tclaims := c.MustGet(\"decoded\").(*models.Claims)\n\n\tif claims.IsAdmin() {\n\t\tfmt.Println(\"You have permission for this access\")\n\t} else {\n\t\tc.JSON(500, gin.H{\n\t\t\t\"Message\": \"You don't have the permission \",\n\t\t})\n\t\treturn\n\t}\n\n\t_id, _ := primitive.ObjectIDFromHex(c.Param(\"id\"))\n\n\t// Memilih Tabel\n\tcollection := db.Collection(\"users\")\n\n\t// Menentukan waktu koneksi query\n\tctx, _ := context.WithTimeout(context.Background(), 30*time.Second)\n\n\tfilter := bson.D{{\"_id\", _id}}\n\terrSQL := collection.FindOne(ctx, filter).Decode(&User)\n\tif errSQL != nil {\n\t\t// If the structure of the body is wrong, return an HTTP error\n\t\tfmt.Println(errSQL)\n\t\tc.JSON(500, gin.H{\n\t\t\t\"Message\": \"Internal Server Error \",\n\t\t})\n\t\treturn\n\t}\n\n\tresult := gin.H{\n\t\t\"data\": User,\n\t}\n\tc.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "cdf7502edaa72564eba297d16ae925ab", "score": "0.7252198", "text": "func getUser(r *http.Request, db *sql.DB) (user.User, error) {\n\tauthKey := r.Header.Get(\"Authorization\")\n\tif authKey == \"\" {\n\t\treturn user.User{}, httputil.BadRequest\n\t}\n\tvar usr user.User\n\tquery := \"SELECT USER_NAME, KEY, VALID_TO FROM ACCESS_KEY WHERE KEY = $1\"\n\terr := db.QueryRow(query, authKey).Scan(&usr.Name, &usr.AccessKey.Key, &usr.AccessKey.ValidTo)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn user.User{}, httputil.InternalServerError\n\t}\n\treturn usr, nil\n}", "title": "" }, { "docid": "f0b913a7ac2d5c4e90f2cadd80afc16e", "score": "0.7240584", "text": "func (s *Service) GetUser(c *gin.Context) {\n\tmobile := c.GetString(\"mobile\")\n\n\tvar profile ebs_fields.UserProfile\n\tif res := s.Db.Model(&ebs_fields.User{}).Where(\"mobile = ?\", mobile).First(&profile); res.Error != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"message\": res.Error.Error(), \"code\": \"database_error\"})\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, profile)\n}", "title": "" }, { "docid": "a4942789e9158dc844e8a9dc37d654da", "score": "0.72340566", "text": "func (*Server) GetUser(ctx context.Context, r *user.GetUserRequest) (*user.GetUserResponse, error) {\n\tsingleUser, err := models.GetUser(r.ID)\n\tif err != nil {\n\t\tlog.Printf(\"An error occured: %v\", err)\n\t\treturn &user.GetUserResponse{}, err\n\t}\n\tvar test user.GetUserResponse\n\tcopier.Copy(&test, singleUser)\n\treturn &test, nil\n}", "title": "" }, { "docid": "fd109a423ea0e5da543ee9fd3cff92b4", "score": "0.7228241", "text": "func (m *Malscraper) GetUser(username string) (*model.User, int, error) {\n\treturn m.api.GetUser(username)\n}", "title": "" }, { "docid": "98da872a71cf4cacef645ca8082c7b13", "score": "0.7227916", "text": "func GetUser(ctx iris.Context) {\n\tmsisdn := ctx.Params().Get(\"msisdn\")\n\n\tresult := Models.User{}\n\terr := DB.FindOne(context.TODO(), bson.D{primitive.E{Key: \"msisdn\", Value: msisdn}}).Decode(&result)\n\tif err != nil {\n\t\thandleErr(ctx, err)\n\t\treturn\n\t}\n\tctx.JSON(iris.Map{\"response\": result})\n}", "title": "" }, { "docid": "3911a37eea4d6f655e44c36cae451d03", "score": "0.72195923", "text": "func getUser() (*user, error) {\n\treturn &user{1432, \"Betty\"}, nil\n}", "title": "" }, { "docid": "d2f3603282695af6b35e9444d88ab0f8", "score": "0.7215645", "text": "func GetUser(c *gin.Context) {\n\tdbmap := c.MustGet(\"DBmap\").(*gorp.DbMap)\n\tid := c.Params.ByName(\"id\")\n\n\tvar user User\n\terr := dbmap.SelectOne(&user, \"SELECT * FROM user WHERE id=? LIMIT 1\", id)\n\n\tif err == nil {\n\t\tc.JSON(200, user)\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"user not found\"})\n\t}\n\n\t// curl -i http://localhost:8080/api/v1/users/1\n}", "title": "" }, { "docid": "e471ceef3b27dc664e762e15c17ea0e1", "score": "0.72088253", "text": "func (d *Accessor) GetUser(id string, attrs []string) (user.User, error) {\n\tlog.Debugf(\"DB: Getting identity %s\", id)\n\n\terr := d.checkDB()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar userRec cadbuser.Record\n\terr = d.db.Get(\"GetUser\", &userRec, d.db.Rebind(getUser), id)\n\tif err != nil {\n\t\treturn nil, cadbutil.GetError(err, \"User\")\n\t}\n\n\treturn cadbuser.New(&userRec, d.db), nil\n}", "title": "" }, { "docid": "7701c6aaaffedabe2be35ba82a498624", "score": "0.720289", "text": "func (u UserController) GetUser(c *gin.Context) {\n\tparam := getUser{}\n\tif err := c.ShouldBindUri(&param); err != nil {\n\t\texception.BadRequest(\"Param must be of type integer, required\", \"INVALID_BODY\")\n\t}\n\n\tuser := entity.User{}\n\tdatabase.GetDB().Select(\"name, email, address, age\").First(&user, param.ID)\n\n\tif (user == entity.User{}) {\n\t\texception.Empty(\"User not found\", \"User with this ID not enough\", \"USER_NOT_FOUND\")\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Success get user\",\n\t\t\"result\": user,\n\t})\n}", "title": "" }, { "docid": "8e281be5aa75a7bdc1d405775d00e947", "score": "0.72021276", "text": "func GetUser(id uint) (*entity.User,error){\n\tclient := &http.Client{}\n\n\tURL := fmt.Sprintf(\"%s%d\",baseUserURL,id)\n\treq,_ := http.NewRequest(\"GET\",URL,nil)\n\t//DO return an http response\n\tres,err := client.Do(req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tuserdata := &entity.User{}\n\n\tbody, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(body,userdata)\n\tif err != nil{\n\t\treturn nil,err\n\t}\n\treturn userdata,nil\n}", "title": "" }, { "docid": "671738d5554fe134526302da0354363d", "score": "0.7194447", "text": "func APIGetUser(c *gin.Context) {\n\tvar User database.User\n\tif err := database.Db.Where(\"id = ?\", uuid.FromStringOrNil(c.Param(\"id\"))).Find(&User).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error(), \"object\": nil})\n\t} else {\n\t\tc.JSON(http.StatusOK, gin.H{\"error\": nil, \"object\": User})\n\t}\n}", "title": "" }, { "docid": "349dc474e56f40fef2dfd459b5d05833", "score": "0.7191797", "text": "func (s service) GetUser(uid string) (*entities.User, error) {\n\treturn s.repository.GetUser(uid)\n}", "title": "" }, { "docid": "48461043de31a847764a72c690e3d975", "score": "0.7173827", "text": "func GetUserDetail(c *gin.Context) {\n\tid := c.Params.ByName(\"id\")\n\tvar user models.User\n\terr := dbmap.SelectOne(&user, \"SELECT * FROM user WHERE id=? LIMIT 1\", id)\n\tif err == nil {\n\t\tuser_id, _ := strconv.ParseInt(id, 0, 64)\n\t\tcontent := &models.User{\n\t\t\tId: user_id,\n\t\t\tUsername: user.Username,\n\t\t\tPassword: user.Password,\n\t\t\tFirstname: user.Firstname,\n\t\t\tLastname: user.Lastname,\n\t\t}\n\t\tc.JSON(200, content)\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"user not found\"})\n\t}\n}", "title": "" }, { "docid": "a7d615c538a6298a2e21b683203327e0", "score": "0.7166413", "text": "func (u UserController) GetUser(c *gin.Context) {\n\tparam := validation.GetUserParamSchema{}\n\t_ = c.ShouldBindUri(&param)\n\n\tuser := userService.GetUser(int64(param.ID))\n\tc.JSON(http.StatusOK, gin.H{\n\t\t\"status\": http.StatusOK,\n\t\t\"message\": \"Success get user\",\n\t\t\"result\": user,\n\t})\n}", "title": "" }, { "docid": "c9218fe7436406767c42f1d77e3c416d", "score": "0.71632206", "text": "func (s *AutograderService) GetUser(ctx context.Context, in *pb.Void) (*pb.User, error) {\n\tusr, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed: authentication error: %v\", err)\n\t\treturn nil, ErrInvalidUserInfo\n\t}\n\tuserInfo, err := s.db.GetUserWithEnrollments(usr.GetID())\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetUser failed to get user with enrollments: %v \", err)\n\t}\n\treturn userInfo, nil\n}", "title": "" }, { "docid": "4b741dd36a817eb8ed02409a825bc942", "score": "0.7147699", "text": "func (u *UserDB) GetUser(email, mobile *string) (*models.User, error) {\n\tuser := &models.User{}\n\tmyData, err := u.DB.FindRecord(\"users\", primitive.M{\"mobile\": mobile, \"email\": email})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif err := mapstructure.Decode(myData, &user); err != nil {\n\t\treturn nil, err\n\t}\n\t//_id := myData.(map[string]interface{})[\"_id\"].(primitive.ObjectID).Hex()\n\t//user.ID = _id\n\treturn user, nil\n}", "title": "" }, { "docid": "236b158b0418d01450ca51381032a766", "score": "0.7137483", "text": "func getUser() (*user, error) {\n\treturn &user{65499, \"john\"}, nil\n}", "title": "" }, { "docid": "4beba850fde6fbe79b26c86c68f5e995", "score": "0.7133412", "text": "func (a *AApi) GetUser(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tentry := a.logger.WithField(\"func\", \"GetUser\")\n\tentry.Debugf(\"Request from %s, userID: %s\", r.RemoteAddr, vars[\"id\"])\n\n\tuser, err := a.sqlManager.GetUser(vars[\"id\"])\n\n\tif err != nil {\n\t\tentry.Errorf(\"Respond to %s, error: %v\", r.RemoteAddr, err)\n\t\tapi_common.RespondWithError(\n\t\t\tw,\n\t\t\thttp.StatusUnprocessableEntity,\n\t\t\tfmt.Sprintf(\"GetUser(): %v\", err),\n\t\t\ta.logger,\n\t\t)\n\n\t\treturn\n\t}\n\t// Id user is nil == doesn't exists\n\tif user == nil {\n\t\tentry.Warnf(\"Respond to %s, error: %v\", r.RemoteAddr, err)\n\t\tapi_common.RespondWithError(w, http.StatusNotFound, \"user doesn't exists\", a.logger)\n\n\t\treturn\n\t}\n\n\tentry.Debugf(\"Responding to %s with: %+v\", r.RemoteAddr, user)\n\tapi_common.RespondWithJson(w, http.StatusOK, &user, a.logger)\n}", "title": "" }, { "docid": "943857f092d29c3c13edf33eb83c5d44", "score": "0.7130468", "text": "func (u userSerivce) GetUser(userID int64) (*domain.User, *utils.ApplicationErr) {\n\treturn domain.UserDao.GetUser(userID)\n}", "title": "" }, { "docid": "a15ee2baf81ec99a6d71de40caa446c8", "score": "0.7128285", "text": "func (s ServiceImpl) GetUser(email string) (*models.User, error) {\n\treturn s.RetrieveRepo.GetUser(email)\n}", "title": "" }, { "docid": "f9403d4d7a2b2ab5b9f6c8ebbe191200", "score": "0.71262574", "text": "func GetUser(c *gin.Context) {\n\tID, err := strconv.Atoi(c.Param(\"id\"))\n\tif err != nil {\n\t\tcheckErr(err, 400, c)\n\t\treturn\n\t}\n\tselectedUser, _ := selectUserID(ID, c)\n\tc.JSON(200, selectedUser)\n}", "title": "" }, { "docid": "9e832185da14123d1e9514691cade957", "score": "0.71053636", "text": "func GetUser(c *fiber.Ctx) error {\n\tid := c.Params(\"id\")\n\tdb := database.DB\n\tvar user model.User\n\tdb.Find(&user, id)\n\tif user.Username == \"\" {\n\t\treturn c.Status(404).JSON(fiber.Map{\"status\": \"error\", \"message\": \"No user found with ID\", \"data\": nil})\n\t}\n\treturn c.JSON(fiber.Map{\"status\": \"success\", \"message\": \"User found\", \"data\": user})\n}", "title": "" }, { "docid": "3513d9c4866b4ef4bc27034364be9b4d", "score": "0.7101983", "text": "func GetUser(field string, value interface{}) (user User, err error) {\n\terr = store.GetDB().Get(\n\t\t&user,\n\t\tfmt.Sprintf(findUsers+\"LIMIT 1\", field),\n\t\tvalue,\n\t)\n\treturn\n}", "title": "" }, { "docid": "3cfc2e78572df6918cfacdd284364999", "score": "0.7096632", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"GET\" {\n http.Error(w, http.StatusText(405), 405)\n return\n }\n\n id := r.FormValue(\"id\")\n if id == \"\" {\n http.Error(w, http.StatusText(400), 400)\n\t\treturn\t\n }\n\n\tdb, err := sql.Open(\"postgres\", \"postgres://api_user:1234@localhost/users\")\n if err != nil {\n log.Fatal(err)\n\t}\n\n\tusr := new(User)\n\t\n\trow := db.QueryRow(\"SELECT * FROM users WHERE ID=$1\", id)\n\terr = row.Scan(&usr.ID, &usr.Name)\n\tif err == sql.ErrNoRows {\n http.NotFound(w, r)\n return\n } else if err != nil {\n http.Error(w, http.StatusText(500), 500)\n return\n }\n\n fmt.Fprintf(w, \"%s, %s\\n\", usr.ID, usr.Name)\n}", "title": "" }, { "docid": "7f73e450cdf1d5ee4160517b795ba33e", "score": "0.709444", "text": "func (t *Tyk) GetUser(userID string) (*User, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "010dc3b8cc8413ac7726aaaf305fc780", "score": "0.70882565", "text": "func (config *MockConn) GetUser(fname, lname, ID string) (models.UserSpaces, error) {\n\tif fname != \"\" && lname != \"\" {\n\t\tfor _, val := range detailedUsers {\n\t\t\tif fname == val.FirstName && lname == val.LastName {\n\t\t\t\treturn *val, nil\n\t\t\t}\n\t\t}\n\t} else if ID != \"\" {\n\t\tfor _, val := range detailedUsers {\n\t\t\tif ID == val.ID {\n\t\t\t\treturn *val, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn models.UserSpaces{}, nil\n}", "title": "" }, { "docid": "aaf1775779b6c75b951b4b11e3491f28", "score": "0.7079162", "text": "func GetUser(pgRepo users.Repository) fiber.Handler {\n\treturn func(c *fiber.Ctx) error {\n\t\tid, _ := strconv.Atoi(c.Params(\"id\"))\n\n\t\tuser, err := pgRepo.Get(id)\n\t\tif err != nil {\n\t\t\treturn c.Status(http.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\t\"error\": fiber.Map{\n\t\t\t\t\t\"message\": \"An error occured while retrieiving data\",\n\t\t\t\t\t\"details\": err,\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\tif user.ID == 0 {\n\t\t\treturn c.Status(http.StatusNotFound).JSON(fiber.Map{\n\t\t\t\t\"error\": fiber.Map{\n\t\t\t\t\t\"message\": \"User is invalid\",\n\t\t\t\t},\n\t\t\t})\n\t\t}\n\t\treturn c.Status(http.StatusOK).JSON(&user)\n\t}\n}", "title": "" }, { "docid": "c92f325eb83657c07c4ab7833420ba0f", "score": "0.7065135", "text": "func GetUser(id int) string {\n\tif users == nil {\n\t\tloadUsers()\n\t}\n\t\n\t/*\n\tloadOne.Do(loadUsers)\n\t*/\n\n\treturn users[id]\n}", "title": "" }, { "docid": "6e3a30a7fba9b0dc8e5e5c0b4d2f127e", "score": "0.706112", "text": "func GetUser(c *gin.Context) {\n\t// parsing param from URL\n\t// c.Query(\"caller\") if url like /users/:user_id?caller=123\n\tuserID, err := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\tif err != nil {\n\t\t// return the bad request to the client\n\t\tapiErr := &utils.ApplicationError{\n\t\t\tMessage: \"user id must be a number\",\n\t\t\tStatusCode: http.StatusBadRequest,\n\t\t\tCode: \"bad_request\",\n\t\t}\n\n\t\t// c.JSON(apiErr.StatusCode, apiErr)\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// calling user service\n\tuser, apiErr := services.UsersService.GetUser(userID)\n\n\tif apiErr != nil {\n\t\t// handle error and return to the client\n\t\t// c.JSON(apiErr.StatusCode, apiErr)\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// return user to client\n\t// c.JSON(http.StatusOK, user)\n\tutils.Respond(c, http.StatusOK, user)\n}", "title": "" }, { "docid": "2e7ee3149384bd1b0bdc996971218c0a", "score": "0.70544446", "text": "func GetUser(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tlogUrl(r)\n\n\t// get form value\n\tuser_id, _ := strconv.Atoi(r.FormValue(\"user_id\"))\n\tlogin_name := r.FormValue(\"login_name\")\n\n\tuser := User{}\n\tvar err error\n\n\t// get user\n\tif user_id != 0 {\n\t\tuser, err = getUser(user_id)\n\t} else if login_name != \"\" {\n\t\tuser, err = getUserWithLoginName(login_name)\n\t} else {\n\t\trespondError(w, \"invalid form value\")\n\t\treturn\n\t}\n\n\tif err != nil {\n\t\trespondError(w, \"failed to get user\")\n\t\treturn\n\t}\n\n\t// return json\n\trespondJson(w, user)\n}", "title": "" }, { "docid": "81b5af283c6ea6a08981ac228f3e7eca", "score": "0.7049143", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t// get the userid from he equest params, key is \"id\"\n\tparams := mux.Vars(r)\n\n\t// convert the id type from string to int\n\tid, err := strconv.Atoi(params[\"id\"])\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to convert the string to int. %v\", err)\n\t}\n\n\t// call the getUser function with user id to retrieve a single user\n\tuser, err := getUser(int64(id))\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to get ser. %v\", err)\n\t}\n\n\t// send he esponse\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "cc2919a7a8e1eac0c00bdd56ffec750b", "score": "0.7048254", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tparams := mux.Vars(r) // Get params\n\n\t// Test if user id exists in database\n\tvar testID sql.NullString\n\tDB.QueryRow(Queries[\"selectUserID\"], params[\"id\"]).Scan(&testID)\n\tif !testID.Valid {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\tw.Write([]byte(\"404 - ID not found\"))\n\t\treturn\n\t}\n\n\tresult, err := DB.Query(Queries[\"selectUserByID\"], params[\"id\"])\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tdefer result.Close()\n\n\tvar user User\n\n\tfor result.Next() {\n\t\terr := result.Scan(&user.ID, &user.Name, &user.Surmane, &user.Phone, &user.Lat, &user.Lng, &user.carID)\n\t\tif user.carID.Valid {\n\t\t\tuser.CarID = user.carID.String\n\t\t}\n\t\tif err != nil {\n\t\t\tpanic(err.Error())\n\t\t}\n\t}\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "03eae40347425571b9c0eac42182a0a9", "score": "0.7043856", "text": "func (_Sampel *SampelCaller) GetUser(opts *bind.CallOpts, _name string) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Sampel.contract.Call(opts, out, \"getUser\", _name)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6158417e3c18f25b852a6abf13a77ae8", "score": "0.70276076", "text": "func (p *UserStoreClient) GetUser(ctx context.Context, authenticationToken string) (_r *User, _err error) {\n var _args24 UserStoreGetUserArgs\n _args24.AuthenticationToken = authenticationToken\n var _result26 UserStoreGetUserResult\n var _meta25 thrift.ResponseMeta\n _meta25, _err = p.Client_().Call(ctx, \"getUser\", &_args24, &_result26)\n p.SetLastResponseMeta_(_meta25)\n if _err != nil {\n return\n }\n switch {\n case _result26.UserException!= nil:\n return _r, _result26.UserException\n case _result26.SystemException!= nil:\n return _r, _result26.SystemException\n }\n\n if _ret27 := _result26.GetSuccess(); _ret27 != nil {\n return _ret27, nil\n }\n return nil, thrift.NewTApplicationException(thrift.MISSING_RESULT, \"getUser failed: unknown result\")\n}", "title": "" }, { "docid": "f6691096c2620149b6cc8b8ae7881c56", "score": "0.7014833", "text": "func(helper *IAMHelper) GetUser() (*iam.GetUserOutput, error){\n\tinput := &iam.GetUserInput{\n\t}\n\tresult, err := helper.iamsvc.GetUser(input)\n\treturn result, err\n}", "title": "" }, { "docid": "0ea4b68f0de2acf85ed2efe8f3d9d468", "score": "0.70096594", "text": "func GetUser(rw http.ResponseWriter, r *http.Request, enc encoding.Encoder) string {\n\tqs, err := url.Parse(r.URL.String())\n\tif err != nil {\n\t\tapierror.GenerateError(\"err parsing url\", err, rw, r)\n\t\treturn \"\"\n\t}\n\n\tkey := qs.Query().Get(\"key\")\n\tif key == \"\" {\n\t\tkey = r.FormValue(\"key\")\n\t}\n\n\tuser, err := customer.GetCustomerUserFromKey(key)\n\tif err != nil {\n\t\tapierror.GenerateError(\"Trouble getting customer user\", err, rw, r)\n\t\treturn \"\"\n\t}\n\n\treturn encoding.Must(enc.Encode(user))\n}", "title": "" }, { "docid": "ee8191e1ab33d2513875191cf6d7a628", "score": "0.7005097", "text": "func (env *Env) GetUser(w http.ResponseWriter, r *http.Request) {\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\tparams := mux.Vars(r)\n\n\tvar user m.User\n\n\tuser, err := env.User.GetUserFromDB(params[\"userid\"])\n\n\tif err != nil {\n\t\tlog.Println(err)\n\t\thttp.Error(w, http.StatusText(500), 500)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "6151d0a7e7bd8d404dc7ffc7248ab5a5", "score": "0.7004324", "text": "func (sa *Authenticator) GetUser(r *requests.Request) error {\n\tsa.mux.Lock()\n\tdefer sa.mux.Unlock()\n\treturn sa.db.GetUser(r)\n}", "title": "" }, { "docid": "d954dd35c742947edb611ee05cf766c6", "score": "0.699977", "text": "func GetUser(c *gin.Context) {\n c.Header(\"Content-Type\", \"application/json\")\n if userid, err := strconv.Atoi(c.Param(\"id\")); err == nil {\n user, err := users.getUserByID(userid)\n glog.Info(\"userid: \", userid, user, err)\n if err != nil {\n c.JSON(http.StatusNotFound, gin.H{\"error\": err.Error()})\n return\n }\n\t\tc.JSON(http.StatusOK, user)\n\t} else {\n\t\t// User ID is invalid\n\t\tc.AbortWithStatus(http.StatusNotFound)\n\t}\n}", "title": "" }, { "docid": "facb95d41210f6da0fcd84ed7051a5d6", "score": "0.69971293", "text": "func (h *AuthHandler) GetUser(email string) (User, string) {\n\tterm.Write(\"Login user email\"+email, term.Debug)\n\tterm.Write(Config.UserName, term.Debug)\n\temail = strings.ToLower(email)\n\tbytes, err := client.Go(\"ignore\", \"com.duosoftware.auth\", \"users\").GetOne().ByUniqueKey(email).Ok()\n\tvar user User\n\tif err == \"\" {\n\t\tif bytes != nil {\n\t\t\tvar uList User\n\t\t\terr := json.Unmarshal(bytes, &uList)\n\t\t\tif err == nil {\n\t\t\t\t//uList.Password = \"-------------\"\n\t\t\t\t//uList.ConfirmPassword = \"-------------\"\n\t\t\t\treturn uList, \"\"\n\t\t\t} else {\n\t\t\t\tif err != nil {\n\t\t\t\t\tterm.Write(\"Login user Error \"+err.Error(), term.Error)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} else {\n\t\tterm.Write(\"Login user Error \"+err, term.Error)\n\t}\n\n\treturn user, \"Error Validating user\"\n}", "title": "" }, { "docid": "804a035c8cfe5a157ed04ce48364ef6d", "score": "0.6964571", "text": "func GetUser(c *gin.Context) {\n\tvar user []models.User\n\t_, err := dbmap.Select(&user, \"select * from user\")\n\tif err == nil {\n\t\tc.JSON(200, user)\n\t} else {\n\t\tc.JSON(404, gin.H{\"error\": \"user not found\"})\n\t}\n\n}", "title": "" }, { "docid": "ebff72edd97c9ad7fc5d095922a42170", "score": "0.6959596", "text": "func (loginModel UsernameLoginModel) GetUser(_id string) (*entites.User, error) {\n\tuser, err := loginModel.services.userRepo.GetUserByName(loginModel.username)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}", "title": "" }, { "docid": "febd0d6ac782855420d5e5bfc8f0c754", "score": "0.695521", "text": "func GetUser(c *gin.Context) {\n\tuserID, userErr := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\tif userErr != nil {\n\t\trestErr := errors.NewBadRequestError(\"Param User Id should be a number\")\n\t\tc.JSON(restErr.Status, restErr)\n\t\treturn\n\t}\n\n\tresult, getError := services.GetUser(userID)\n\n\tif getError != nil {\n\t\tc.JSON(getError.Status, getError)\n\t\treturn\n\t}\n\tc.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "bef6dc8649b6c75b24a21ee54d9f8cf6", "score": "0.69528747", "text": "func GetUser(id int64, o orm.Ormer) (ret *User, err error) {\n\tvar ok bool\n\n\tif ret, ok = moduleCache[CTL_M_USER].get(id).(*User); ok {\n\t\treturn ret, nil\n\t}\n\n\tret = &User{}\n\terr = o.Raw(\"select a.id, a.muid, a.uuid, a.name, a.cname, a.email, a.phone, a.qq, a.disabled, a.extra, a.avatarurl, b.name as mname from user a left join user b on a.muid = b.id where a.id = ?\", id).QueryRow(ret)\n\tif err == nil {\n\t\tmoduleCache[CTL_M_USER].set(id, ret)\n\t}\n\treturn\n}", "title": "" }, { "docid": "629e43316bf39fde4749476edc19a17f", "score": "0.6952124", "text": "func (db *DatabaseService) GetUser(user *models.User) error {\n\terr := db.db.Model(user).Where(\"id = ?\", user.ID).Select()\n\treturn err\n}", "title": "" }, { "docid": "647f8e4f1c5f7f9794e86fa9c70264fc", "score": "0.6946881", "text": "func GetUser(id string, jwt string) map[string]interface{} {\n\tisValid := helpers.ValidateToken(id, jwt)\n\t// Find and return user\n\tif isValid {\n\t\t\n\t\tuser := &interfaces.User{}\n\n\t\t// Check if this username exis\n\t\tif database.DB.Where(\"id = ?\", id).First(&user).RecordNotFound() {\n\t\t\treturn FailResponse(\"User not found\")\n\t\t}\n\n\t\t// Find accounts for the user\n\t\t// Return accounts if user.ID match with UserID of the Account\n\t\taccounts := []interfaces.ResponseAccount{}\n\t\tdatabase.DB.Table(\"accounts\").Select(\"id, name, balance\").Where(\"user_id = ? \", user.ID).Scan(&accounts)\n\n\t\tvar response, _ = prepareResponse(user, accounts, false) //\n\n\t\treturn response\n\t} \n\n\treturn FailResponse(\"Not valid token\")\n}", "title": "" }, { "docid": "f1cd34987f9230efd6f965f2a3948bd4", "score": "0.69440144", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tvar user model.User\n\tmodel.DB().Where(\"id = ?\", vars[\"id\"]).First(&user)\n\tif user.ID != uuid.Nil {\n\t\tjson.NewEncoder(w).Encode(singleUserResponse{\n\t\t\tID: user.ID.String(),\n\t\t\tFirstName: user.FirstName,\n\t\t\tLastName: user.LastName,\n\t\t\tUsername: user.Username,\n\t\t\tEmail: user.Email,\n\t\t\tPictureID: user.PictureID,\n\t\t\tIsCPU: user.IsCPU,\n\t\t\tCreatedAt: user.CreatedAt.Unix(),\n\t\t\tUpdatedAt: user.CreatedAt.Unix(),\n\t\t})\n\t} else {\n\t\trbody.JSONError(w, http.StatusNotFound, language.MustGetRest(\"error.userNotFound\", r))\n\t}\n}", "title": "" }, { "docid": "0fc62cd0fa2c2acfbd72865ca5c371c6", "score": "0.6942841", "text": "func (client *Client) GetUser(\n\tctx context.Context, name string,\n) (*graylog.User, *ErrorInfo, error) {\n\tif name == \"\" {\n\t\treturn nil, nil, errors.New(\"name is empty\")\n\t}\n\tuser := &graylog.User{}\n\tei, err := client.callGet(ctx, client.Endpoints().User(name), nil, user)\n\treturn user, ei, err\n}", "title": "" }, { "docid": "04f61cda73b56703b502956f57e8734b", "score": "0.6935754", "text": "func (a *authenticator) GetUser(r *http.Request) string {\n\treturn a.mockUser\n}", "title": "" }, { "docid": "008a9f49de9fbd100d398896ff0563ae", "score": "0.6933813", "text": "func (u *userService) GetUser(userId int64) (*users.User, *errors.RestErr){\n\tresult := &users.User{Id: userId}\n\tif err := result.Get(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "a8fe91f5eda10395ba1370525bfa729b", "score": "0.69285196", "text": "func (a *UserApiService) GetUser(ctx _context.Context, key string) (User, *_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 User\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/users/{key}\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"key\"+\"}\", _neturl.QueryEscape(parameterToString(key, \"\")), -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\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"X-Hiarc-Api-Key\"] = key\n\t\t}\n\t}\n\tr, err := a.client.prepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\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": "e94c9768e7f30ba939bd6122160d3afa", "score": "0.6927794", "text": "func (c *Client) GetUser(userID int) (User, error) {\n\treturnUser := User{}\n\terr := c.sendRequest(\"GET\", \"get_user/\"+strconv.Itoa(userID), nil, &returnUser)\n\treturn returnUser, err\n}", "title": "" }, { "docid": "f5837f5949b0e2cb4c2d2cd2cea3eb83", "score": "0.6918871", "text": "func GetUser(c web.C, w http.ResponseWriter, r *http.Request) {\n\tvar ctx = context.FromC(c)\n\tvar (\n\t\tuser = ToUser(c)\n\t\thost = c.URLParams[\"host\"]\n\t\tlogin = c.URLParams[\"login\"]\n\t)\n\n\tuser, err := datastore.GetUserLogin(ctx, host, login)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(user)\n}", "title": "" }, { "docid": "f71838451ead4d66f9243bbaacd038c0", "score": "0.6918371", "text": "func (r *UserRest) GetUser(w http.ResponseWriter, req *http.Request) {\n\tid := mux.Vars(req)[\"id\"]\n\tif id == \"\" {\n\t\tWriteErr(w, errors.New(\"please provide User id\"), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\trow := r.db.QueryRow(\"SELECT * FROM users WHERE id = ?\", id)\n\tvar uid int\n\tvar firstName string\n\tvar secondName string\n\tvar birthDate time.Time\n\terr := row.Scan(&uid, &firstName, &secondName, &birthDate)\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tWriteErr(w, errors.New(\"can't find user with id: \"+id), http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tWriteErr(w, err, http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tuser := User{ID: uid, FirstName: firstName, SecondName: secondName, BirthDate: birthDate}\n\n\tWriteJSON(w, user)\n}", "title": "" }, { "docid": "fbf8884b384daa75c5551c05c7c7fcf6", "score": "0.69155467", "text": "func (g *getter) GetUser(id string) (*sidebar.User, error) {\n\treturn g.DB.GetUser(id)\n}", "title": "" }, { "docid": "d36ad10dcddf8a6077d07a98d307256e", "score": "0.6906681", "text": "func (ud *UserDao) GetUser(username string) (*user.User, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "5eab819a53bd8f5033ab8ba8856f89c2", "score": "0.6888592", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tusernameQuery := r.URL.Query()[\"username\"]\n\tif len(usernameQuery) < 1 {\n\t\tGetCurrentUser(w, r)\n\t\treturn\n\t}\n\tusername := usernameQuery[0]\n\tGetUserByName(w, r, username)\n}", "title": "" }, { "docid": "960f7e6468ea48e961f5cb9e59e0c7df", "score": "0.68757415", "text": "func Getuser(c *gin.Context) {\n\tuser, err := lib.GetPerson(c.Param(\"personcd\"))\n\n\tswitch {\n\tcase err == sql.ErrNoRows:\n\t\tc.Status(http.StatusNoContent)\n\t\treturn\n\tcase err != nil:\n\t\tc.Status(http.StatusInternalServerError)\n\t\treturn\n\n\t}\n\tc.JSON(http.StatusOK, *user)\n}", "title": "" }, { "docid": "02a268fb6fe049cbace8fdceed8c7c97", "score": "0.68717545", "text": "func (db *sqlstore) GetUser(ID int64) (*models.User, error) {\n\tu := &models.User{}\n\tquery := db.Rebind(\"SELECT * FROM users WHERE id = ? LIMIT 1\")\n\terr := db.Get(u, query, ID)\n\n\tif err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn nil, ErrNoResults\n\t\t}\n\n\t\treturn nil, err\n\t}\n\n\treturn u, err\n}", "title": "" }, { "docid": "773c5ab5ac7c429cf284701ea9a049d3", "score": "0.6869765", "text": "func GetUser(ctx echo.Context) (*aaa.User, bool) {\n\trd, ok := ctx.Get(userData).(*aaa.User)\n\tif !ok {\n\t\treturn nil, false\n\t}\n\n\treturn rd, true\n}", "title": "" }, { "docid": "ae4397d7117a2664e67e35d94bc3262d", "score": "0.6869426", "text": "func GetUser(id string) (user *User, err error) {\n\tresp, err := Call(id, RequestMetadata)\n\tif err != nil {\n\t\treturn\n\t}\n\tvar value User\n\terr = json.Unmarshal(resp.Data, &value)\n\tuser = &value\n\treturn\n}", "title": "" }, { "docid": "3d41a9bb30ded0fdbe2663bd02f249e3", "score": "0.6867877", "text": "func GetUser(token, gameid string) (ulginfo.Result, messagehandle.ErrorMsg) {\n\tvar info ulginfo.Result\n\terr := messagehandle.New()\n\tpostData := map[string]string{\n\t\t\"token\": token,\n\t\t\"game_id\": gameid,\n\t}\n\tmessagehandle.LogPrintln(\"Ulg\", postData)\n\tjsbyte := myrestful.PostRawRequest(ulginfo.GetuserURL, foundation.ToJSONStr(postData))\n\tif jserr := json.Unmarshal(jsbyte, &info); jserr != nil {\n\t\terr.ErrorCode = code.GetUserError\n\t\terr.Msg = \"UserFormatError\"\n\t\tmessagehandle.ErrorLogPrintln(\"GetUser-1\", token, gameid, err)\n\t}\n\n\tif info.Result == 1 {\n\t\terr.ErrorCode = code.OK\n\t} else {\n\t\terr.ErrorCode = code.GetUserError\n\t\terr.Msg = info.ErrorMsg\n\t\tmessagehandle.ErrorLogPrintln(\"GetUser-2\", token, gameid, err)\n\t}\n\treturn info, err\n}", "title": "" }, { "docid": "3be3c8baa855c976cfa88e8a24942158", "score": "0.6864758", "text": "func GetUser(email string) (User, error) {\n\tu := User{}\n\trow := stmtGetUserByEmail.QueryRow(email)\n\terr := row.Scan(&u.Email, &u.passwordHash, &u.IsSuperUser, &u.IsActive)\n\treturn u, err\n}", "title": "" }, { "docid": "39540bd71c4d198f9f6c2ae31cf43564", "score": "0.6855533", "text": "func GetUser(w http.ResponseWriter, r *http.Request) {\n\tdb, err := models.GetDB()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvars := mux.Vars(r)\n\t// TODO: Fix types of id and discriminator\n\tdiscordID := vars[\"discordid\"]\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfilter := filters.GetUserByDiscordID(discordID)\n\n\tuser, err := db.ReadUser(filter)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tif err := json.NewEncoder(w).Encode(user); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "e6541213d6d3afab3f6b8319d8585ec9", "score": "0.68524534", "text": "func (sc *SC) GetUser(id int, fields ...string) (*User, error) {\n\tvar (\n\t\tresp userResp\n\t\tuser *User\n\t\treq = prepUserRequest(sc, id, -1, fields...)\n\t\tscResp, err = req.Do()\n\t)\n\n\tfmt.Println(\"get user\", id)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = json.Unmarshal(scResp.RespBody, &resp)\n\tif err != nil {\n\t\treturn &resp.Response, err\n\t}\n\n\tuser = &resp.Response\n\n\terr = user.readAttr()\n\n\treturn user, err\n}", "title": "" }, { "docid": "5d6c21d039e7f8a22527888d021f2745", "score": "0.6851719", "text": "func GetUser(r *repository.Repository) echo.HandlerFunc {\n\treturn func(c echo.Context) error {\n\t\tctx := context.TODO()\n\n\t\tid, err := strconv.ParseInt(c.Param(\"id\"), 10, 64)\n\t\tif err != nil {\n\t\t\treturn c.JSON(http.StatusBadRequest, map[string]string{\"message\": err.Error()})\n\t\t}\n\n\t\tfilter := make(map[string]interface{})\n\t\tfilter[\"_id\"] = id\n\n\t\tresult, err := r.GetUser(ctx, filter)\n\t\tif err != nil {\n\t\t\treturn c.JSON(http.StatusInternalServerError, map[string]string{\"message\": err.Error()})\n\t\t}\n\t\treturn c.JSON(http.StatusOK, result)\n\t}\n}", "title": "" }, { "docid": "f475b6854ad31a39a698bf2f598bc28d", "score": "0.68453896", "text": "func (db *Database) GetUser(r *requests.Request) error {\n\tdb.mu.RLock()\n\tdefer db.mu.RUnlock()\n\tuser, err := db.validateUserIdentity(r.User.Username, r.User.Email)\n\tif err != nil {\n\t\treturn errors.ErrGetUsers.WithArgs(err)\n\t}\n\tr.Response.Payload = user\n\treturn nil\n}", "title": "" }, { "docid": "8961cbf6944e54591a366d647954b8ec", "score": "0.68420434", "text": "func GetUser(w http.ResponseWriter, req *http.Request) {\n\tif req.Method != \"GET\" {\n\t\tsendString(w, http.StatusNotFound, \"Not Found\")\n\t\treturn\n\t}\n\tsendJson(w, http.StatusOK, user.Generate())\n}", "title": "" }, { "docid": "9ab07bb0a4345f8223d4223c53089304", "score": "0.6837553", "text": "func GetUser(c *gin.Context) *User {\n\tu, ok := c.Get(\"user\")\n\tif !ok {\n\t\treturn nil\n\t}\n\tuser, ok := u.(*User)\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn user\n}", "title": "" }, { "docid": "8b25ad45b3a5c0e5ec049548fa4d2841", "score": "0.68371195", "text": "func GetUser(c *gin.Context) {\n\n}", "title": "" }, { "docid": "4a5392f130a7f8f0a14e23b1f0cbbfcf", "score": "0.6832093", "text": "func GetUser(mobile string, db *gorm.DB) (*User, error) {\n\tvar user User\n\t// Get user model and preload Cards and order the model relation Cards.is_main\n\t// This trick is really super important: it will allow us to get a user's main card\n\t// with ease, without having to do a second fetch and then filter the main card\n\tresult := db.Model(&User{}).First(&user, \"mobile = ?\", mobile)\n\tuser.db = db\n\treturn &user, result.Error\n}", "title": "" }, { "docid": "13372c57f8698c84141abec80318b65f", "score": "0.68291867", "text": "func (rs *rpcServer) GetUser(ctx context.Context, req *charon.GetUserRequest) (*charon.GetUserResponse, error) {\n\th := &getUserHandler{\n\t\thandler: newHandler(rs, ctx, \"get_user\"),\n\t}\n\th.addRequest(1)\n\n\tresp, err := h.handle(ctx, req)\n\th.handler.handle(err, \"user has been retrieved\")\n\n\treturn resp, err\n}", "title": "" }, { "docid": "e1339e6560855a64f87c5da5cee9dac8", "score": "0.68253547", "text": "func (uh *UserHandler) GetUser(w http.ResponseWriter, r *http.Request) {\n\tparams := mux.Vars(r)\n\tuserID, err := uuid.Parse(params[\"id\"])\n\tCheckError(err)\n\tuser, err := uh.DB.GetUser(userID)\n\tCheckError(err)\n\tjson.NewEncoder(w).Encode(&user)\n}", "title": "" }, { "docid": "31bfa0d48da487aee7aa0ca64a77a523", "score": "0.6824932", "text": "func GetUser(username string, session *r.Session) ct.User {\n\tvar u ct.User\n\t// var user ct.User\n\tdb := os.Getenv(\"DB\")\n\ttable := os.Getenv(\"USERTABLE\")\n\t// userTable := os.Getenv(\"USERTABLE\")\n\tcur, _ := r.DB(db).Table(table).GetAllByIndex(\"username\", username).Run(session)\n\t_ = cur.One(&u)\n\tcur.Close()\n\t// fmt.Println(u)\n\t// mapstructure.Decode(u, &user)\n\treturn u\n}", "title": "" }, { "docid": "3ce0a3b559a28e934c6b838a9f483294", "score": "0.68197757", "text": "func (db *Database) GetUser(email string) (UserResponse, error) {\n\tvar userResponse UserResponse\n\n\trow := db.getConn().QueryRow(context.Background(), userDbMethod.getUser(), email).Scan(&userResponse.Email)\n\tif row == pgx.ErrNoRows {\n\t\treturn userResponse, fmt.Errorf(\"error getting user\")\n\t}\n\treturn userResponse, nil\n}", "title": "" }, { "docid": "25f636f5e66e252843984d98fd175f91", "score": "0.68182737", "text": "func GetUser(c *gin.Context) {\n\t// take the requested id from the URL query\n\tuserID, err := strconv.ParseInt(c.Param(\"user_id\"), 10, 64)\n\n\t// validate for errors\n\tif err != nil {\n\t\tapiErr := &utils.ApplicationError{\n\t\t\tMessage: \"user_id must be a positive number\",\n\t\t\tStatusCode: http.StatusNotFound,\n\t\t\tCode: \"bad_request\",\n\t\t}\n\t\t// encode request to json\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// now that we have a valid id, we\n\t// pass the requested id to the service\n\tuser, apiErr := services.UserService.GetUser(uint64(userID))\n\n\t// validate for errors from service\n\tif apiErr != nil {\n\t\tutils.RespondError(c, apiErr)\n\t\treturn\n\t}\n\n\t// return user to client\n\tutils.Respond(c, http.StatusOK, user)\n}", "title": "" }, { "docid": "ab84da23559649ded73730b4de272d60", "score": "0.6815564", "text": "func (e *Env) getUser (c *gin.Context) {\n var u models.User\n c.BindJSON(&u)\n //user, err := e.db.GetUser(&models.User{Username: \"john\", Password:\"123\"})\n user, err := e.db.GetUser(&u)\n if err != nil {\n if (err.Code == 404){\n fmt.Println(\"User doesn't exist\")\n }else {\n // TODO Definately dont panic here do c.thingy or whatever\n panic(err)\n }\n }\n fmt.Println(user)\n user.Print()\n}", "title": "" }, { "docid": "15fcdb308bdf383791685fd0cdab612d", "score": "0.68131715", "text": "func (store *Store) GetUser(uid string) (store.User, error) {\n\treturn store.User{\n\t\tUID: uid,\n\t\tEmail: uid + \"@anu.edu.au\",\n\t\tFirstName: \"Jonathan\",\n\t\tLastName: \"Smith\",\n\t\tPasswordHash: \"dummy-password-hash\",\n\t}, nil\n}", "title": "" }, { "docid": "7789c5633e33a3d4a6310f910584b227", "score": "0.68104386", "text": "func (repository *UserRepo) GetUser(c *gin.Context) {\n\tid, _ := c.Params.Get(\"id\")\n\tvar user entity.User\n\terr := entity.GetUser(repository.Db, &user, id)\n\tif err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\tc.AbortWithStatus(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\t//c.AbortWithStatusJSON(http.StatusInternalServerError, gin.H{\"error\": err})\n\t\tc.JSON(http.StatusOK, gin.H{\"message\": \"User not found\"})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, user)\n\n}", "title": "" }, { "docid": "fcbb1b5454d60ca5cd799a772c91943a", "score": "0.68101233", "text": "func (p userService) GetUser(user *entities.User, id string) error {\n\tif err := p.db.First(&user, &entities.User{Model: entities.Model{ID: id}}).Error; err != nil {\n\t\tif errors.Is(err, gorm.ErrRecordNotFound) {\n\t\t\treturn errors.New(\"user not found\")\n\t\t}\n\t\tlog.Error(\"GetUser\", err)\n\t\treturn errors.New(\"unknown error\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51877e629a7b6dcd3bfabe68fc5bc74a", "score": "0.68073344", "text": "func (s *DBBlogStore) GetUser(username string) (RequestUserData, error) {\n\tvar u RequestUserData\n\te := s.db.Get(&u, \"SELECT * FROM usr WHERE login=$1\", username)\n\treturn u, e\n}", "title": "" }, { "docid": "d8d2e5759718791de3a5973982b75440", "score": "0.68071514", "text": "func GetUser(c echo.Context) error {\n\tid := c.Param(\"id\")\n\n\ti, _ := strconv.Atoi(id)\n\tusers := m.GetUser(i)\n\treturn c.JSON(http.StatusCreated, users)\n}", "title": "" }, { "docid": "9f06153f9bff76d9a2ff3f81c0aff2cc", "score": "0.68038195", "text": "func (u *UserAppInterface) GetUser(userId uint64) (*entity.User, error) {\n\treturn u.GetUserFn(userId)\n}", "title": "" } ]
2aa0ed7c3ebc8c318cfc60a2de8729d5
SetEndpoint sets the Endpoint field's value.
[ { "docid": "ddccf9c878fc966e2f85c57a13be2d6a", "score": "0.8397992", "text": "func (s *Region) SetEndpoint(v string) *Region {\n\ts.Endpoint = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "b18b1612b7988851fc04b93be255d110", "score": "0.8674021", "text": "func (m *gerritListener) SetEndpoint(val string) {\n\tm.endpointField = val\n}", "title": "" }, { "docid": "60cc696bd9c5e92be9d98e28d530c20e", "score": "0.8662491", "text": "func (m *ContinuousDataExport) SetEndpoint(val Endpoint) {\n\tm.endpointField = val\n}", "title": "" }, { "docid": "064b988a867afc7abe4fb5378f8a56eb", "score": "0.85882056", "text": "func (m *gerritListenerSpec) SetEndpoint(val *string) {\n\tm.endpointField = val\n}", "title": "" }, { "docid": "482986e56bad7225c03db8f5128ed61d", "score": "0.85874355", "text": "func (s *Node) SetEndpoint(v *Endpoint) *Node {\n\ts.Endpoint = v\n\treturn s\n}", "title": "" }, { "docid": "f7056cc1f567193eb6174a3de36e70d4", "score": "0.85610926", "text": "func (o *PostBotRequest) SetEndpoint(v string) {\n\to.Endpoint = &v\n}", "title": "" }, { "docid": "7b8033a7e9dcc239eef06573e5d6141d", "score": "0.85551804", "text": "func (t *baseTransport) SetEndpoint(endpoint string) {\n\tt.Endpoint = endpoint\n}", "title": "" }, { "docid": "66f75e45ccc3887b4023b75695b8a16e", "score": "0.8533869", "text": "func (s *Server) SetEndpoint(ctx context.Context, endpoint *pb.Endpoint) (err error) {\n\t_, err = s.runQuery(ctx, \"SetEndpoint\", endpoint)\n\treturn\n}", "title": "" }, { "docid": "3c7bdace839502a6d7ed5d4a8741e81d", "score": "0.84296066", "text": "func (o *InventoryGenericInventoryHolderAllOf) SetEndpoint(v string) {\n\to.Endpoint = &v\n}", "title": "" }, { "docid": "57312dfc5d8e2d7298a9949c358941b0", "score": "0.8401589", "text": "func (s *Cluster) SetEndpoint(v string) *Cluster {\n\ts.Endpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "aff6b501f35cf5dc8a654d20480159db", "score": "0.83820915", "text": "func (t *AsyncTransport) SetEndpoint(endpoint string) {\n\tt.Endpoint = endpoint\n}", "title": "" }, { "docid": "35e38e22ec5a2134c1c3f7847bd4c8e6", "score": "0.83226687", "text": "func (s *NASInstance) SetEndpoint(v *Endpoint) *NASInstance {\n\ts.Endpoint = v\n\treturn s\n}", "title": "" }, { "docid": "7c703c844b8216901994df18d6f8dc68", "score": "0.8253505", "text": "func (a *Config) SetEndpoint(endpoint string) *Config {\n\tif len(endpoint) > 0 {\n\t\ta.Endpoint = endpoint\n\t} else {\n\t\tfmt.Println(\"No Endpoint specified in all to SetEndpoint(endpoint string)\")\n\t}\n\treturn a\n}", "title": "" }, { "docid": "6c4f26291dac59c5e7311cd5f4abae66", "score": "0.82273024", "text": "func (u *UpYun) SetEndpoint(ed int) error {\n\tif ed >= Auto && ed <= Ctt {\n\t\tu.endpoint = fmt.Sprintf(\"v%d.api.upyun.com\", ed)\n\t\treturn nil\n\t}\n\n\treturn errors.New(\"Invalid endpoint, pick from Auto, Telecom, Cnc, Ctt\")\n}", "title": "" }, { "docid": "8d699e9e299ccb8ee48bed213a0d0176", "score": "0.8214116", "text": "func (c *Cache) SetEndpoint(endpoint string) {\n\tc.baseEndpoint = endpoint\n}", "title": "" }, { "docid": "5a59561a6b009b480703cffa35a0690b", "score": "0.8160732", "text": "func (s *GetMessagingSessionEndpointOutput) SetEndpoint(v *MessagingSessionEndpoint) *GetMessagingSessionEndpointOutput {\n\ts.Endpoint = v\n\treturn s\n}", "title": "" }, { "docid": "8c707997c5124019aff9c2e79ae83847", "score": "0.81195563", "text": "func (s *EndpointDetails) SetEndpoint(v *DataflowEndpoint) *EndpointDetails {\n\ts.Endpoint = v\n\treturn s\n}", "title": "" }, { "docid": "efe7cd73f7a8c9b01088506273ec71eb", "score": "0.7537765", "text": "func (r *Reader) SetEndpoint(endpoint string) { r.MockEndpoint = endpoint }", "title": "" }, { "docid": "3ad8878c0ada32b67aa38bc45ff5f70d", "score": "0.745264", "text": "func (o *OrdererOrg) SetEndpoint(endpoint Address) error {\n\tordererAddrProto := &cb.OrdererAddresses{}\n\n\tif ordererAddrConfigValue, ok := o.orgGroup.Values[EndpointsKey]; ok {\n\t\terr := proto.Unmarshal(ordererAddrConfigValue.Value, ordererAddrProto)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed unmarshaling endpoints for orderer org %s: %v\", o.name, err)\n\t\t}\n\t}\n\n\tendpointToAdd := fmt.Sprintf(\"%s:%d\", endpoint.Host, endpoint.Port)\n\n\texistingOrdererEndpoints := ordererAddrProto.Addresses\n\tfor _, e := range existingOrdererEndpoints {\n\t\tif e == endpointToAdd {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\texistingOrdererEndpoints = append(existingOrdererEndpoints, endpointToAdd)\n\n\t// Add orderer endpoints config value back to orderer org\n\terr := setValue(o.orgGroup, endpointsValue(existingOrdererEndpoints), AdminsPolicyKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to add endpoint %v to orderer org %s: %v\", endpoint, o.name, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bece7acca598a7ab55d69621e9c80254", "score": "0.7146421", "text": "func (u *UpYun) SetEndpointStr(endpoint string) error {\n\tu.endpoint = endpoint\n\treturn nil\n}", "title": "" }, { "docid": "5c817c349ca25f5ae45c72ca50df6a26", "score": "0.7008324", "text": "func (c *Controller) setEndpoint(ep *v1alpha1.Endpoint, vnic *schema.VMNic, labels map[string]string) bool {\n\tvar epCopy = ep.DeepCopy()\n\n\tep.Name = vnic.ID\n\tep.Labels = labels\n\tep.Spec.ManagePlaneID = c.managePlaneID\n\tep.Spec.VID = uint32(vnic.Vlan.VlanID)\n\tep.Spec.Reference.ExternalIDName = externalIDName\n\tep.Spec.Reference.ExternalIDValue = vnic.InterfaceID\n\n\treturn !reflect.DeepEqual(ep, epCopy)\n}", "title": "" }, { "docid": "68df17c8ebdd76b8f561c5e5541f9a90", "score": "0.6922561", "text": "func WithEndpoint(endpoint string) Option {\n\treturn func(ops *optionParams) error {\n\t\tops.endpoint = endpoint\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "e9e65ea8c9aac186be9a1f298f9cb1f6", "score": "0.6882329", "text": "func Endpoint(endpoint *url.URL) Option {\n\treturn func(o *options) {\n\t\to.endpoint = endpoint\n\t}\n}", "title": "" }, { "docid": "16da84d10c6bea7e42e2de59cca74b0c", "score": "0.68619823", "text": "func (e *Endpoint) Set(value string) error {\n\tif value == \"\" {\n\t\treturn errors.New(\"endpoint can not be blank\")\n\t}\n\n\tif e == nil {\n\t\treturn errors.New(\"endpoint has not been initialized\")\n\t}\n\n\t// split for port\n\tendpointParts := strings.SplitN(value, \":\", 2)\n\tif len(endpointParts) > 1 {\n\t\t// check for blank port\n\t\tif endpointParts[1] == \"\" {\n\t\t\te.port = 0\n\t\t} else { // not blank, try and parse as number\n\t\t\ti, err := strconv.Atoi(endpointParts[1])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"error parsing port: \\\"%s\\\"\", endpointParts[1])\n\t\t\t}\n\t\t\te.port = i\n\t\t}\n\t}\n\n\te.address = endpointParts[0]\n\n\t// mark that the value has been set\n\te.set = true\n\n\treturn nil\n}", "title": "" }, { "docid": "3d71ad05efb6b5558078de8835dc00e4", "score": "0.67708987", "text": "func (c *Config) WithEndpoint(endpoint string) *Config {\n\tc.Endpoint = &endpoint\n\treturn c\n}", "title": "" }, { "docid": "99464058f568bd65e63beb285841ac6a", "score": "0.6738696", "text": "func (p *HTTPPostNode) Endpoint(endpoint string) *HTTPPostNode {\n\tp.Endpoints = append(p.Endpoints, endpoint)\n\treturn p\n}", "title": "" }, { "docid": "9c3e14f66dfcbcbbc7f47127b2689481", "score": "0.668078", "text": "func WithEndpoint(e string) Option {\n\treturn func(o *Options) {\n\t\to.Endpoint = e\n\t}\n}", "title": "" }, { "docid": "ee3daef366af86049ea4928b20d9eb13", "score": "0.6629946", "text": "func WithEndpoint(endpoint url.URL) Option {\n\treturn optionFunc(func(cfg *config) *config {\n\t\tcfg.endpoint = endpoint\n\t\treturn cfg\n\t})\n}", "title": "" }, { "docid": "2152c99a6e484ac5dc35161e9ab7f953", "score": "0.6563532", "text": "func (s *ExternalModel) SetModelEndpoint(v string) *ExternalModel {\n\ts.ModelEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "4801405afe1ee888dfca99395151188b", "score": "0.6558545", "text": "func WithEndpoint(endpoint string) Option {\n\treturn func(cfg *clientConfig) error {\n\t\tif endpoint != \"\" {\n\t\t\tcfg.endpoint = endpoint\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "a7cf8aa46add50c6ec599813a3d5742d", "score": "0.6518849", "text": "func (s *GetExternalModelsInput) SetModelEndpoint(v string) *GetExternalModelsInput {\n\ts.ModelEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "7e55251957f746ea20df770586af123c", "score": "0.64716727", "text": "func (rs *RandomStrategy) SetEndpoints(endpoints []url.URL) {\n\trs.endpoints = endpoints\n}", "title": "" }, { "docid": "6f2983e005217d344be346b666f9b04d", "score": "0.64489645", "text": "func (s *DescribedServer) SetEndpointType(v string) *DescribedServer {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "831c3d57882945a96a2165803ed1fafd", "score": "0.64305705", "text": "func WithEndpoint(value string) ClientOption {\n\treturn func(client *Client) {\n\t\tclient.endpoint = value\n\t}\n}", "title": "" }, { "docid": "a81a64dcd319fc0829773f7a62947b8e", "score": "0.6412889", "text": "func WithEndpoint(e endpoint.Endpoint) Option {\n\treturn func(c *pipelineBuilderOptions) {\n\t\tc.endpoint = e\n\t}\n}", "title": "" }, { "docid": "52c807aa767d2c0439aea4ca3185ca5e", "score": "0.6405695", "text": "func (s *ContactMethod) SetContactEndpoint(v string) *ContactMethod {\n\ts.ContactEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "85609109aad84075546582c53eea148e", "score": "0.63970566", "text": "func (s *SelfManagedEventSource) SetEndpoints(v map[string][]*string) *SelfManagedEventSource {\n\ts.Endpoints = v\n\treturn s\n}", "title": "" }, { "docid": "15153a35f2aa0036f840532ffc4ff7b6", "score": "0.63967556", "text": "func (o *TemplateSummaryNotificationRule) SetEndpointType(v string) {\n\to.EndpointType = v\n}", "title": "" }, { "docid": "68c1006b25ac33db55e380f7ad673131", "score": "0.63955534", "text": "func (s *ListedServer) SetEndpointType(v string) *ListedServer {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "b79869c6c40197952b7e96c539d8bf20", "score": "0.6362846", "text": "func (s *UpdateServerInput) SetEndpointType(v string) *UpdateServerInput {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "0730aaa9222346bc1ef0cc9c635d1102", "score": "0.6352817", "text": "func (muo *MetricUpdateOne) SetEndpointId(u uint) *MetricUpdateOne {\n\tmuo.mutation.ResetEndpointId()\n\tmuo.mutation.SetEndpointId(u)\n\treturn muo\n}", "title": "" }, { "docid": "39d0f1e52feca928c4377247587ebda3", "score": "0.63489103", "text": "func (s *PutExternalModelInput) SetModelEndpoint(v string) *PutExternalModelInput {\n\ts.ModelEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "e9d714ee3af7293c04d7985796dd5d2d", "score": "0.63276833", "text": "func (s *CreateContactMethodInput) SetContactEndpoint(v string) *CreateContactMethodInput {\n\ts.ContactEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "ebe6a545c86fb4339ddb5eb39dcdc41e", "score": "0.6311763", "text": "func (m *taskExecution) SetEndpoints(val map[string]string) {\n\tm.endpointsField = val\n}", "title": "" }, { "docid": "ffefd5de4e43b7a3fb289cead2f02d05", "score": "0.6303832", "text": "func (s *CreateServerInput) SetEndpointType(v string) *CreateServerInput {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "0126154b91f09fd0ee8b341e1f40eefa", "score": "0.62318546", "text": "func (m *MetricMutation) SetEndpointId(u uint) {\n\tm.endpointId = &u\n\tm.addendpointId = nil\n}", "title": "" }, { "docid": "66a9c417379be8e4ef95d57c986bad1f", "score": "0.62305826", "text": "func (s *ModifyVerifiedAccessTrustProviderOidcOptions) SetAuthorizationEndpoint(v string) *ModifyVerifiedAccessTrustProviderOidcOptions {\n\ts.AuthorizationEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "5c3ecde69f0632f3b138cdb1a607bfcc", "score": "0.61973107", "text": "func (s *Channel) SetIngestEndpoint(v string) *Channel {\n\ts.IngestEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "b7d93184ed5cb34b348e5d85c743820d", "score": "0.6196855", "text": "func (mu *MetricUpdate) SetEndpointId(u uint) *MetricUpdate {\n\tmu.mutation.ResetEndpointId()\n\tmu.mutation.SetEndpointId(u)\n\treturn mu\n}", "title": "" }, { "docid": "895d11b21cc3f4548fcdbbd7cabdf1de", "score": "0.616844", "text": "func (s *CreateVerifiedAccessTrustProviderOidcOptions) SetAuthorizationEndpoint(v string) *CreateVerifiedAccessTrustProviderOidcOptions {\n\ts.AuthorizationEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "0cb65a64ed747cac3272fc6eca6eb8bb", "score": "0.61485964", "text": "func (m *EventMutation) SetEndpointId(u uint) {\n\tm.endpointId = &u\n\tm.addendpointId = nil\n}", "title": "" }, { "docid": "70190cf520e73ce6ade1b385802585de", "score": "0.61234593", "text": "func (s *VerifiedAccessEndpoint) SetEndpointType(v string) *VerifiedAccessEndpoint {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "48eb8543830724e0e969fbed3c8598dd", "score": "0.61054367", "text": "func (s *CreateVerifiedAccessEndpointInput) SetEndpointType(v string) *CreateVerifiedAccessEndpointInput {\n\ts.EndpointType = &v\n\treturn s\n}", "title": "" }, { "docid": "211acba4ebf68d06c17140782643f167", "score": "0.609895", "text": "func (rrs *RoundRobinStrategy) SetEndpoints(endpoints []url.URL) {\n\trrs.endpoints = endpoints\n}", "title": "" }, { "docid": "56e23deb21d9afb5aa361b79f69df889", "score": "0.6092699", "text": "func (o *TemplateSummaryNotificationRule) SetEndpointID(v uint64) {\n\to.EndpointID = v\n}", "title": "" }, { "docid": "80f1be54a001e9bb8edc4d188ca3a1f1", "score": "0.6091805", "text": "func (bot *BotAPI) SetAPIEndpoint(apiEndpoint string) {\n\tbot.apiEndpoint = apiEndpoint\n}", "title": "" }, { "docid": "fb14d83c84ed91d1c979ab758cd7dc40", "score": "0.6091723", "text": "func SetFastCGIEndpoint(endpoint string) func(*Server) error {\n\treturn func(s *Server) error {\n\t\tu, err := url.Parse(endpoint)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to parse endpoint: %s\", endpoint)\n\t\t}\n\n\t\t//XXX: if using tcp, ensure we have a host and port?\n\t\ts.fastEndpoint = u\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "c5bacf62427df3f513c31b4c629840fe", "score": "0.6066448", "text": "func (o DbProxyEndpointOutput) Endpoint() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *DbProxyEndpoint) pulumi.StringOutput { return v.Endpoint }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9bc52ac86db634f82371d6d274f5efbb", "score": "0.6035721", "text": "func (m *K8sMetricMutation) SetEndpointId(u uint) {\n\tm.endpointId = &u\n\tm.addendpointId = nil\n}", "title": "" }, { "docid": "af036171aa948aec5f77fbee3a7261d3", "score": "0.6028387", "text": "func (s *Cluster) SetClusterEndpoint(v *Endpoint) *Cluster {\n\ts.ClusterEndpoint = v\n\treturn s\n}", "title": "" }, { "docid": "e23aa0cfceac264bb5a0946c6bca21af", "score": "0.60137796", "text": "func (mc *MetricCreate) SetEndpointId(u uint) *MetricCreate {\n\tmc.mutation.SetEndpointId(u)\n\treturn mc\n}", "title": "" }, { "docid": "f56eb8672f70cfe64dbb5a783ad01352", "score": "0.59966123", "text": "func (o *BulkCreateResponse) SetEndpoints(v []Endpoint) {\n\to.Endpoints = &v\n}", "title": "" }, { "docid": "02021b42d184e1f26e5a08d5937fd349", "score": "0.5986797", "text": "func (s *Store) MarkEndpointActive(endpointId interface{}) {\n\ts.markEndpointActive(endpointId)\n}", "title": "" }, { "docid": "16c576344290cfa4d4c503e053a0e118", "score": "0.59800047", "text": "func (hcc *HealthCheckConfig) SetCheckEndpoint(e string) {\n\thcc.CheckEndpoint = e\n}", "title": "" }, { "docid": "465e419807c9ed50f73b0b6fbb7d12b7", "score": "0.59771", "text": "func (o *EndpointsDiscoveryParams) SetEndpointType(endpointType *string) {\n\to.EndpointType = endpointType\n}", "title": "" }, { "docid": "48bbd7efb27c27ffd4391465df32dc53", "score": "0.59662753", "text": "func (s *ServerConfig) Endpoint(path string) string {\n\treturn fmt.Sprintf(\"/%s\", path)\n}", "title": "" }, { "docid": "1cbf9a6486619f2e9a1532374c3c6253", "score": "0.5964318", "text": "func (m *K8sEventMutation) SetEndpointId(u uint) {\n\tm.endpointId = &u\n\tm.addendpointId = nil\n}", "title": "" }, { "docid": "93d301d34f5edafda8d1056b6cb255d3", "score": "0.5963489", "text": "func (s *Explanation) SetVpcEndpoint(v *AnalysisComponent) *Explanation {\n\ts.VpcEndpoint = v\n\treturn s\n}", "title": "" }, { "docid": "f75fcbda29850356a3a003023edf5a16", "score": "0.5953354", "text": "func (service *Service) UpdateEndpoint(ID portainer.EndpointID, endpoint *portainer.Endpoint) error {\n\tidentifier := service.connection.ConvertToKey(int(ID))\n\treturn service.connection.UpdateObject(BucketName, identifier, endpoint)\n}", "title": "" }, { "docid": "d7cc2759037fa7f4790a4a778aa32793", "score": "0.5951135", "text": "func (hook *mmHookLogrus) Endpoint() (endpoint string) {\n\t_hookLocker.Lock()\n\tendpoint = hook.endpoint\n\t_hookLocker.Unlock()\n\treturn\n}", "title": "" }, { "docid": "e59e8958ac36cf2a9d55bd1283a584a1", "score": "0.5943904", "text": "func (o ServiceAttachmentConnectedEndpointOutput) Endpoint() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ServiceAttachmentConnectedEndpoint) *string { return v.Endpoint }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e26e55abbf86fd8b5272e162ec1e4301", "score": "0.59416515", "text": "func (p *Processor) SetEndpoints(endpoints []cfg.Endpoint) {\n\tp.endpoints = map[string][]cfg.Test{}\n\tfor _, endpoint := range endpoints {\n\t\tp.endpoints[endpoint.Name] = endpoint.Tests\n\t}\n}", "title": "" }, { "docid": "6dd38e309366c384a9509034446b2c8e", "score": "0.5928666", "text": "func NewEndpoint_Override(e Endpoint, address *string, port *float64) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"monocdk.aws_docdb.Endpoint\",\n\t\t[]interface{}{address, port},\n\t\te,\n\t)\n}", "title": "" }, { "docid": "3d20daed27c45ad030570ac2cae67a8e", "score": "0.591414", "text": "func (api *API) Endpoint() coreinformers.EndpointsInformer {\n\tif api.endpoint == nil {\n\t\tpanic(\"Endpoint informer not configured\")\n\t}\n\treturn api.endpoint\n}", "title": "" }, { "docid": "26028c01bb0d65ca8b03f1ae547c3552", "score": "0.5913832", "text": "func (s *ClusterScope) SetControlPlaneEndpoint(endpoint clusterv1.APIEndpoint) {\n\ts.GCPCluster.Spec.ControlPlaneEndpoint = endpoint\n}", "title": "" }, { "docid": "0f93baa169d6ddaf5c08e63c68b2819d", "score": "0.5902543", "text": "func (s *ModifyVerifiedAccessTrustProviderOidcOptions) SetTokenEndpoint(v string) *ModifyVerifiedAccessTrustProviderOidcOptions {\n\ts.TokenEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "98674e36d31934e186be67f09ee1427d", "score": "0.5885535", "text": "func (r *RandomStrategy) SetEndpoints(endpoints []url.URL) {\n\ts := rand.NewSource(time.Now().UnixNano())\n\tr.rand = rand.New(s)\n\n\tr.endpoints = endpoints\n}", "title": "" }, { "docid": "61e63f386b1f9e34d857b6c1a9d64caf", "score": "0.58817893", "text": "func EndpointOption(address string) Option {\n\treturn func(a *Application) {\n\t\ta.endpoint = address\n\t}\n}", "title": "" }, { "docid": "b364e202b7b51b90c7561daac01db33b", "score": "0.588036", "text": "func (s *GetServiceEndpointOutput) SetServiceEndpoint(v string) *GetServiceEndpointOutput {\n\ts.ServiceEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "d082cbe0dd6c7091eb53dc116c4d0b1c", "score": "0.5873366", "text": "func (app *App) SetAzureEndPoint(params azure.SetAzureEndpointParams) middleware.Responder {\n\tcreds := azureclient.Credentials{\n\t\tSubscriptionID: params.AccountParams.SubscriptionID,\n\t\tClientID: params.AccountParams.ClientID,\n\t\tClientSecret: params.AccountParams.ClientSecret,\n\t\tTenantID: params.AccountParams.TenantID,\n\t\tAzureCloud: params.AccountParams.AzureCloud,\n\t}\n\n\tclient, err := azureclient.New(&creds)\n\tif err != nil {\n\t\treturn azure.NewSetAzureEndpointInternalServerError().WithPayload(Err(err))\n\t}\n\n\terr = client.VerifyAccount(params.HTTPRequest.Context())\n\tif err != nil {\n\t\treturn azure.NewSetAzureEndpointInternalServerError().WithPayload(Err(err))\n\t}\n\n\tapp.azureClient = client\n\treturn azure.NewSetAzureEndpointCreated()\n}", "title": "" }, { "docid": "5198158d25c3efb128336465a17ad18e", "score": "0.5861921", "text": "func MountEndpoint(mux *http.ServeMux, endpoint string, handler http.Handler) {\n\tmux.Handle(endpoint, handler)\n\tlogrus.WithField(\"endpoint\", endpoint).Debug(\"mounting endpoint\")\n}", "title": "" }, { "docid": "5dd4e95597e5727539bd4fc5e51d4b2b", "score": "0.5860882", "text": "func (o *KubernetesCredentials) SetEndpointUrl(v string) {\n\to.EndpointUrl = v\n}", "title": "" }, { "docid": "deb8dad78ab1b051108df9af9d8eaa47", "score": "0.58581805", "text": "func (r *RemoteClient) RegisterEndpoint(endpoint string) {\n\tr.endpoint = endpoint\n}", "title": "" }, { "docid": "96fc0853c7a686d5e352291e59ad171a", "score": "0.5833592", "text": "func WithEndpoint(endpoint string) Config {\n\treturn func(r *RequestOptions) {\n\t\tr.Endpoint = endpoint\n\t}\n}", "title": "" }, { "docid": "8efa75161333525bd5dcabdc844891ee", "score": "0.58274615", "text": "func (s *CreateEndpointGroupOutput) SetEndpointGroup(v *EndpointGroup) *CreateEndpointGroupOutput {\n\ts.EndpointGroup = v\n\treturn s\n}", "title": "" }, { "docid": "1d8d1ae2891c15705bed9d6a0df7c049", "score": "0.5822052", "text": "func NewEndpoint(value string) (Endpoint, error) {\n\te := Endpoint{}\n\n\terr := e.Set(value)\n\n\treturn e, err\n}", "title": "" }, { "docid": "d8f0d450533adaf102b839946a24cedc", "score": "0.58220243", "text": "func SetupEndpoint(args *Arg, stats *stats.Stats, workerCount uint) (EndPoint, error) {\n\tvar purpose Purpose\n\n\tswitch args.Purpose {\n\tcase \"Source\":\n\t\tpurpose = source\n\tcase \"Destination\":\n\t\tpurpose = destination\n\tcase \"Manipulation\":\n\t\tpurpose = manipulation\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported Endpoint Purpose: \" + args.Purpose)\n\t}\n\n\tvar ep EndPoint\n\n\tswitch args.Type {\n\tcase TypeAzure:\n\t\tep = &azEndpoint{args: &args.Args.Azure,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t\tworkerCount: workerCount,\n\t\t}\n\tcase TypeDir:\n\t\tep = &dirEndpoint{args: &args.Args.Dir,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t\tworkerCount: workerCount,\n\t\t}\n\tcase TypeFake:\n\t\tep = &fakeEndpoint{args: &args.Args.Fake,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t}\n\tcase TypeFile:\n\t\tep = &fileEndpoint{args: &args.Args.File,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t}\n\tcase TypeGoogle:\n\t\tep = &gcEndpoint{args: &args.Args.Google,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t\tworkerCount: workerCount,\n\t\t}\n\tcase TypeNuvo:\n\t\tep = &nuvoEndpoint{args: &args.Args.Nuvo,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t}\n\tcase TypeAWS:\n\t\tep = &s3Endpoint{args: &args.Args.S3,\n\t\t\tstats: stats,\n\t\t\tpurpose: purpose,\n\t\t\tworkerCount: workerCount,\n\t\t}\n\tdefault:\n\t\treturn nil, errors.New(\"Unsupported Endpoint Type: \" + args.Type)\n\t}\n\n\terr := ep.Setup()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ep, nil\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "faa85da4ae388bc7068ce5067c6dc9b1", "score": "0.58047277", "text": "func (in *Endpoint) DeepCopy() *Endpoint {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(Endpoint)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "975bd987944d6dfd9bb0b8e02b2d92ad", "score": "0.57961047", "text": "func (s *UpdateEndpointGroupOutput) SetEndpointGroup(v *EndpointGroup) *UpdateEndpointGroupOutput {\n\ts.EndpointGroup = v\n\treturn s\n}", "title": "" }, { "docid": "3a7f1c931d3bcc315eae8140ea4eb74f", "score": "0.57909346", "text": "func (s *AuthorizationData) SetProxyEndpoint(v string) *AuthorizationData {\n\ts.ProxyEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "0424374cf8a05307b51c2bf637173066", "score": "0.57722956", "text": "func WithEndpoint(url string) ClientOption {\n\treturn wrapOpt{option.WithEndpoint(url)}\n}", "title": "" }, { "docid": "f44723fe6ea8f6ed56836450d1211e3d", "score": "0.5769783", "text": "func (s *CreateVerifiedAccessTrustProviderOidcOptions) SetTokenEndpoint(v string) *CreateVerifiedAccessTrustProviderOidcOptions {\n\ts.TokenEndpoint = &v\n\treturn s\n}", "title": "" }, { "docid": "2e04432eda9e8061f48781164dbd1f94", "score": "0.57623196", "text": "func InitEndpoint(en string) {\n\tHost = en\n\tskipReadConfig = true\n}", "title": "" } ]
98ee7fd001b741c3dfefc604e5648c25
ZipFloat64Float32Ptr takes two inputs: first list of type: []float64, second list of type: []float32. Then it merges two list and returns a new map of type: map[float64]float32
[ { "docid": "8bfa4638e52813963e7f2b7f5c7583cb", "score": "0.8418633", "text": "func ZipFloat64Float32Ptr(list1 []*float64, list2 []*float32) map[*float64]*float32 {\n\tnewMap := make(map[*float64]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" } ]
[ { "docid": "3543eba0d3ac3549f6a1bf875801a0a1", "score": "0.8429914", "text": "func ZipFloat32Float64Ptr(list1 []*float32, list2 []*float64) map[*float32]*float64 {\n\tnewMap := make(map[*float32]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "28638928c3cf4a0315a9d5e4063c919d", "score": "0.8335699", "text": "func ZipFloat32Ptr(list1 []*float32, list2 []*float32) map[*float32]*float32 {\n\tnewMap := make(map[*float32]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "11ee7e663a0732fbb9dcd19cc385be42", "score": "0.82749724", "text": "func ZipFloat32Uint64Ptr(list1 []*float32, list2 []*uint64) map[*float32]*uint64 {\n\tnewMap := make(map[*float32]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "00d54a17d91ebe1bd1cd1560bf3b0689", "score": "0.82376355", "text": "func ZipUint64Float32Ptr(list1 []*uint64, list2 []*float32) map[*uint64]*float32 {\n\tnewMap := make(map[*uint64]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f2540dff7d6c4708512b40f5f24d6e9c", "score": "0.8176531", "text": "func ZipUint32Float64Ptr(list1 []*uint32, list2 []*float64) map[*uint32]*float64 {\n\tnewMap := make(map[*uint32]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "29b900c162029ca69537a5c1b828e8cf", "score": "0.8175591", "text": "func ZipFloat64Uint32Ptr(list1 []*float64, list2 []*uint32) map[*float64]*uint32 {\n\tnewMap := make(map[*float64]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7f564697bee06ae549fe658933858114", "score": "0.81311154", "text": "func ZipInt64Float32Ptr(list1 []*int64, list2 []*float32) map[*int64]*float32 {\n\tnewMap := make(map[*int64]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8cd545f95f2e71d7fb16022b8befbedd", "score": "0.80830985", "text": "func ZipFloat32Int64Ptr(list1 []*float32, list2 []*int64) map[*float32]*int64 {\n\tnewMap := make(map[*float32]*int64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e8a608c1c1c8e4fb71af612a18f2d2f8", "score": "0.808037", "text": "func ZipInt32Float64Ptr(list1 []*int32, list2 []*float64) map[*int32]*float64 {\n\tnewMap := make(map[*int32]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "62b0f8db89e4ab1585013df7c77c1212", "score": "0.8061174", "text": "func ZipFloat32IntPtr(list1 []*float32, list2 []*int) map[*float32]*int {\n\tnewMap := make(map[*float32]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d93c38fb3a8d9bf8f268044d1f3b11bf", "score": "0.8012873", "text": "func ZipFloat32Uint32Ptr(list1 []*float32, list2 []*uint32) map[*float32]*uint32 {\n\tnewMap := make(map[*float32]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d35ff589fae5462033d2ce99e7c37180", "score": "0.79943824", "text": "func ZipFloat64Ptr(list1 []*float64, list2 []*float64) map[*float64]*float64 {\n\tnewMap := make(map[*float64]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0294676f6e1044b11e2508eaec1af352", "score": "0.79805225", "text": "func ZipUint32Float32Ptr(list1 []*uint32, list2 []*float32) map[*uint32]*float32 {\n\tnewMap := make(map[*uint32]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "147ce5311a6f46bf1ff40bb4ee33d5f3", "score": "0.7969612", "text": "func ZipUintFloat32Ptr(list1 []*uint, list2 []*float32) map[*uint]*float32 {\n\tnewMap := make(map[*uint]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1c4d2cee3f0ee1fde5f187e3badcacfa", "score": "0.7969158", "text": "func ZipFloat64Int32Ptr(list1 []*float64, list2 []*int32) map[*float64]*int32 {\n\tnewMap := make(map[*float64]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1d784bee10223f815df9e8ebdd086a6b", "score": "0.79685146", "text": "func ZipFloat32UintPtr(list1 []*float32, list2 []*uint) map[*float32]*uint {\n\tnewMap := make(map[*float32]*uint)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ebc2fbfc799c01150f8b949063f24b36", "score": "0.7936241", "text": "func ZipIntFloat32Ptr(list1 []*int, list2 []*float32) map[*int]*float32 {\n\tnewMap := make(map[*int]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d4c68a764aac1144f5cf4ad1a8527f96", "score": "0.78642964", "text": "func ZipInt32Float32Ptr(list1 []*int32, list2 []*float32) map[*int32]*float32 {\n\tnewMap := make(map[*int32]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "4551e572ca3f3c6e8e3083758d81d52f", "score": "0.78535587", "text": "func ZipFloat64IntPtr(list1 []*float64, list2 []*int) map[*float64]*int {\n\tnewMap := make(map[*float64]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c0770fe7dfd4cad2b9499f19fe36b58a", "score": "0.77833956", "text": "func ZipIntFloat64Ptr(list1 []*int, list2 []*float64) map[*int]*float64 {\n\tnewMap := make(map[*int]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8a9798d6c358a750502cec831f98d21e", "score": "0.7754046", "text": "func ZipFloat32Int32Ptr(list1 []*float32, list2 []*int32) map[*float32]*int32 {\n\tnewMap := make(map[*float32]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e46800f8848aa0ccd53ec877355a5ab8", "score": "0.76358217", "text": "func ZipInt64Float64Ptr(list1 []*int64, list2 []*float64) map[*int64]*float64 {\n\tnewMap := make(map[*int64]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "83bcfa43dcba2a9647c31533d251dbbc", "score": "0.75990933", "text": "func ZipFloat64Uint64Ptr(list1 []*float64, list2 []*uint64) map[*float64]*uint64 {\n\tnewMap := make(map[*float64]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "74090ab0564d7e83e8f1c46bc40a8ea2", "score": "0.7595983", "text": "func ZipFloat64Int64Ptr(list1 []*float64, list2 []*int64) map[*float64]*int64 {\n\tnewMap := make(map[*float64]*int64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6e93311e5ffcd4e053e4bba8e775ca94", "score": "0.75883657", "text": "func ZipUint64Float64Ptr(list1 []*uint64, list2 []*float64) map[*uint64]*float64 {\n\tnewMap := make(map[*uint64]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "11a346051d2db9d6ec915a24465f6e61", "score": "0.7563957", "text": "func ZipUint16Float32Ptr(list1 []*uint16, list2 []*float32) map[*uint16]*float32 {\n\tnewMap := make(map[*uint16]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "069d607451ad829d8f42dc02e9b455ed", "score": "0.754653", "text": "func ZipUintFloat64Ptr(list1 []*uint, list2 []*float64) map[*uint]*float64 {\n\tnewMap := make(map[*uint]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ce8d159ec364411a2ae72bf04005a695", "score": "0.7544757", "text": "func ZipInt16Float32Ptr(list1 []*int16, list2 []*float32) map[*int16]*float32 {\n\tnewMap := make(map[*int16]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0a44d004130c3a9bc4b616395626bdb1", "score": "0.7481259", "text": "func ZipFloat32StrPtr(list1 []*float32, list2 []*string) map[*float32]*string {\n\tnewMap := make(map[*float32]*string)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7f6d71394d74c31482b7d8fbe7738b63", "score": "0.74732494", "text": "func ZipFloat32Uint16Ptr(list1 []*float32, list2 []*uint16) map[*float32]*uint16 {\n\tnewMap := make(map[*float32]*uint16)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "b3bb63e46d7850c7c8aeaab0afa83269", "score": "0.7472632", "text": "func ZipFloat64UintPtr(list1 []*float64, list2 []*uint) map[*float64]*uint {\n\tnewMap := make(map[*float64]*uint)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "15084bda568c64eee5a9313da80dc447", "score": "0.7450746", "text": "func ZipFloat32Int16Ptr(list1 []*float32, list2 []*int16) map[*float32]*int16 {\n\tnewMap := make(map[*float32]*int16)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "63ded55941f40904f82f7cd7d0a61740", "score": "0.7421142", "text": "func ZipStrFloat32Ptr(list1 []*string, list2 []*float32) map[*string]*float32 {\n\tnewMap := make(map[*string]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "233737ba444b4ad5a232896577b4741e", "score": "0.7395403", "text": "func ZipInt16Float64Ptr(list1 []*int16, list2 []*float64) map[*int16]*float64 {\n\tnewMap := make(map[*int16]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3f1ed6ba0e4b7452af23c39b8d9c2cbf", "score": "0.7292019", "text": "func ZipFloat32BoolPtr(list1 []*float32, list2 []*bool) map[*float32]*bool {\n\tnewMap := make(map[*float32]*bool)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "aa7b65ee776080445dc9d91fd887b3aa", "score": "0.7287545", "text": "func ZipFloat64Int16Ptr(list1 []*float64, list2 []*int16) map[*float64]*int16 {\n\tnewMap := make(map[*float64]*int16)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2e9d458d57f213aea436e2246f9168c7", "score": "0.7249069", "text": "func ZipUint16Float64Ptr(list1 []*uint16, list2 []*float64) map[*uint16]*float64 {\n\tnewMap := make(map[*uint16]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "05045666e6de3c1e4fcfafca0db845a5", "score": "0.72369164", "text": "func ZipBoolFloat32Ptr(list1 []*bool, list2 []*float32) map[*bool]*float32 {\n\tnewMap := make(map[*bool]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7b04dc54d240de790d456a38eb86a40c", "score": "0.71689284", "text": "func MergeFloat64Float32(map1, map2 map[float64]float32) map[float64]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float64]float32{}\n\t}\n\n\tnewMap := make(map[float64]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ec9f27347dded2796f768ac6e944ecc0", "score": "0.71649796", "text": "func MergeFloat32Float64(map1, map2 map[float32]float64) map[float32]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]float64{}\n\t}\n\n\tnewMap := make(map[float32]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "471c2d23d0d16b532e3c759bc1e8f7ec", "score": "0.7155568", "text": "func ZipFloat32Uint8Ptr(list1 []*float32, list2 []*uint8) map[*float32]*uint8 {\n\tnewMap := make(map[*float32]*uint8)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f4f840ee352c8e7135d4723371f60ddc", "score": "0.7121318", "text": "func ZipUint8Float32Ptr(list1 []*uint8, list2 []*float32) map[*uint8]*float32 {\n\tnewMap := make(map[*uint8]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6b20471f4b3a5db29ea21d2d76a351d2", "score": "0.7098781", "text": "func ZipFloat64Uint16Ptr(list1 []*float64, list2 []*uint16) map[*float64]*uint16 {\n\tnewMap := make(map[*float64]*uint16)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c5c35190ca705c36ea3597fbbb3d33fd", "score": "0.7073705", "text": "func MergeFloat32Uint64(map1, map2 map[float32]uint64) map[float32]uint64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]uint64{}\n\t}\n\n\tnewMap := make(map[float32]uint64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "11daf01887ddad78c6b8bd69fe00da1a", "score": "0.70713824", "text": "func MergeFloat64Uint32(map1, map2 map[float64]uint32) map[float64]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float64]uint32{}\n\t}\n\n\tnewMap := make(map[float64]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c705cbf566fafd07b142fd7d190e4a54", "score": "0.7055822", "text": "func ZipFloat32Int8Ptr(list1 []*float32, list2 []*int8) map[*float32]*int8 {\n\tnewMap := make(map[*float32]*int8)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "4341b2cafbe662d784b8e1307b18164c", "score": "0.7052412", "text": "func ZipInt8Float32Ptr(list1 []*int8, list2 []*float32) map[*int8]*float32 {\n\tnewMap := make(map[*int8]*float32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "50890c62ab7d56c690eb1c63ac751d16", "score": "0.70310354", "text": "func ZipUint32Ptr(list1 []*uint32, list2 []*uint32) map[*uint32]*uint32 {\n\tnewMap := make(map[*uint32]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3e53ef6f9d545420a89018f0a4d06965", "score": "0.7018186", "text": "func ZipInt32Uint64Ptr(list1 []*int32, list2 []*uint64) map[*int32]*uint64 {\n\tnewMap := make(map[*int32]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d3c689ffb93251e9be403aa4c3397be9", "score": "0.7007426", "text": "func ZipUint32Int64Ptr(list1 []*uint32, list2 []*int64) map[*uint32]*int64 {\n\tnewMap := make(map[*uint32]*int64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "26ab6e2cae23e028e240fa7c40f3d6e8", "score": "0.7007024", "text": "func MergeInt64Float32(map1, map2 map[int64]float32) map[int64]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]float32{}\n\t}\n\n\tnewMap := make(map[int64]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "4bde616bb85844b17facfa0de5135e6c", "score": "0.69997716", "text": "func MergeUint64Float32(map1, map2 map[uint64]float32) map[uint64]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint64]float32{}\n\t}\n\n\tnewMap := make(map[uint64]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "edc0aeca9795044fe7d1bd75482087ca", "score": "0.69990295", "text": "func MergeFloat32Int64(map1, map2 map[float32]int64) map[float32]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]int64{}\n\t}\n\n\tnewMap := make(map[float32]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "01afa31cf7ce51d1c4d11d9095cba15f", "score": "0.69785005", "text": "func MergeFloat32(map1, map2 map[float32]float32) map[float32]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]float32{}\n\t}\n\n\tnewMap := make(map[float32]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "959c7699598e216ca513047ee77541ca", "score": "0.6975257", "text": "func ZipUint64Int32Ptr(list1 []*uint64, list2 []*int32) map[*uint64]*int32 {\n\tnewMap := make(map[*uint64]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a05d9296f4184b0d85194a12de7afd20", "score": "0.69720733", "text": "func ZipUint32Uint64Ptr(list1 []*uint32, list2 []*uint64) map[*uint32]*uint64 {\n\tnewMap := make(map[*uint32]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "46cc7c8f5637571a82957eb7a7750c17", "score": "0.69583315", "text": "func MergeInt32Float64(map1, map2 map[int32]float64) map[int32]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]float64{}\n\t}\n\n\tnewMap := make(map[int32]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c57a5a2dd7135c3e009b5d6528107329", "score": "0.69542485", "text": "func ZipInt64Uint32Ptr(list1 []*int64, list2 []*uint32) map[*int64]*uint32 {\n\tnewMap := make(map[*int64]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5ecf246bae06189b64a1605f22ad7d85", "score": "0.69503623", "text": "func MergeUint32Float64(map1, map2 map[uint32]float64) map[uint32]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]float64{}\n\t}\n\n\tnewMap := make(map[uint32]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "9b0a91b98739db985f3f45842f979391", "score": "0.6925225", "text": "func ZipInt8Float64Ptr(list1 []*int8, list2 []*float64) map[*int8]*float64 {\n\tnewMap := make(map[*int8]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7ca621eb5e010dfc7a940e742246d80b", "score": "0.69164866", "text": "func ZipUint64Uint32Ptr(list1 []*uint64, list2 []*uint32) map[*uint64]*uint32 {\n\tnewMap := make(map[*uint64]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e6edf3dd9265060792c77bf1abecb2dc", "score": "0.69100565", "text": "func ZipStrFloat64Ptr(list1 []*string, list2 []*float64) map[*string]*float64 {\n\tnewMap := make(map[*string]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e9214ddff14f15b6de97de14c300face", "score": "0.691001", "text": "func ZipFloat64StrPtr(list1 []*float64, list2 []*string) map[*float64]*string {\n\tnewMap := make(map[*float64]*string)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "0ec985ca213c7359cd38120a9a685655", "score": "0.6878779", "text": "func MergeFloat64Int32(map1, map2 map[float64]int32) map[float64]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float64]int32{}\n\t}\n\n\tnewMap := make(map[float64]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "6e6107a58c3dd6623b94929859bc242b", "score": "0.6863145", "text": "func ZipFloat64Int8Ptr(list1 []*float64, list2 []*int8) map[*float64]*int8 {\n\tnewMap := make(map[*float64]*int8)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "e6b79fae0ab0efb4a58958fd2bb83837", "score": "0.68365633", "text": "func ZipInt32Int64Ptr(list1 []*int32, list2 []*int64) map[*int32]*int64 {\n\tnewMap := make(map[*int32]*int64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "01b059df40e6a21da2df390a3d29937d", "score": "0.68311167", "text": "func ZipUint8Float64Ptr(list1 []*uint8, list2 []*float64) map[*uint8]*float64 {\n\tnewMap := make(map[*uint8]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "94fa6662a8c932923ed98be55d27680d", "score": "0.6804052", "text": "func ZipUint32IntPtr(list1 []*uint32, list2 []*int) map[*uint32]*int {\n\tnewMap := make(map[*uint32]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "55abe0b3dffba6140b64c16450443b4a", "score": "0.6800021", "text": "func ZipInt32Ptr(list1 []*int32, list2 []*int32) map[*int32]*int32 {\n\tnewMap := make(map[*int32]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2175e260abb234e02d3f16ff230331a4", "score": "0.67848736", "text": "func ZipFloat64BoolPtr(list1 []*float64, list2 []*bool) map[*float64]*bool {\n\tnewMap := make(map[*float64]*bool)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "265868d5d7a3b9ddf555bc117e9c67b4", "score": "0.6773339", "text": "func ZipInt32Uint32Ptr(list1 []*int32, list2 []*uint32) map[*int32]*uint32 {\n\tnewMap := make(map[*int32]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7bffe5d7cc4fd09bc66c81ff567f2476", "score": "0.6766954", "text": "func MergeFloat32Uint32(map1, map2 map[float32]uint32) map[float32]uint32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]uint32{}\n\t}\n\n\tnewMap := make(map[float32]uint32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1f507bbb1fb425d7ccb604265de6c4c8", "score": "0.6748283", "text": "func ZipUint32Int32Ptr(list1 []*uint32, list2 []*int32) map[*uint32]*int32 {\n\tnewMap := make(map[*uint32]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "1af8849dfbee4683f24b9721ad80fc76", "score": "0.67392164", "text": "func ZipInt64Int32Ptr(list1 []*int64, list2 []*int32) map[*int64]*int32 {\n\tnewMap := make(map[*int64]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a411faa1a2f4ca0d8060c1d0cac73132", "score": "0.6731922", "text": "func ZipUintInt32Ptr(list1 []*uint, list2 []*int32) map[*uint]*int32 {\n\tnewMap := make(map[*uint]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8acf709d68d7d01c1248d5ecaa288a39", "score": "0.67245656", "text": "func MergeFloat64(map1, map2 map[float64]float64) map[float64]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float64]float64{}\n\t}\n\n\tnewMap := make(map[float64]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "9b418d5600c247ebe4f0051c3db3c25c", "score": "0.6701431", "text": "func ZipBoolFloat64Ptr(list1 []*bool, list2 []*float64) map[*bool]*float64 {\n\tnewMap := make(map[*bool]*float64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "c9b69c40c1449a6292a2f10744ef693e", "score": "0.6678757", "text": "func ZipUintUint32Ptr(list1 []*uint, list2 []*uint32) map[*uint]*uint32 {\n\tnewMap := make(map[*uint]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3fb6a6d2c941fde6cab19b991d644ba8", "score": "0.6678563", "text": "func ZipIntUint32Ptr(list1 []*int, list2 []*uint32) map[*int]*uint32 {\n\tnewMap := make(map[*int]*uint32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "2a6ae99e04788da935ed3e2566b1b7fa", "score": "0.66773224", "text": "func ZipFloat64Uint8Ptr(list1 []*float64, list2 []*uint8) map[*float64]*uint8 {\n\tnewMap := make(map[*float64]*uint8)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "5d80adef042222b02cc149eb9e9f4854", "score": "0.6676748", "text": "func MergeUint32Float32(map1, map2 map[uint32]float32) map[uint32]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint32]float32{}\n\t}\n\n\tnewMap := make(map[uint32]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "d08608a11e8f6328f1ca0875d2a06684", "score": "0.66606647", "text": "func MergeInt32Float32(map1, map2 map[int32]float32) map[int32]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int32]float32{}\n\t}\n\n\tnewMap := make(map[int32]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ce513209d50c0aaa15569473ae05b056", "score": "0.6645439", "text": "func ZipInt32UintPtr(list1 []*int32, list2 []*uint) map[*int32]*uint {\n\tnewMap := make(map[*int32]*uint)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "8ffeb5b78d0f141b34a758f3195cc40c", "score": "0.662936", "text": "func MergeFloat32Uint(map1, map2 map[float32]uint) map[float32]uint {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]uint{}\n\t}\n\n\tnewMap := make(map[float32]uint)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a04d792556fdf7e90bdc65467d27b7af", "score": "0.6625189", "text": "func ZipInt32IntPtr(list1 []*int32, list2 []*int) map[*int32]*int {\n\tnewMap := make(map[*int32]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "feabf30d212dbfa18cf792594d7a2e9c", "score": "0.66200846", "text": "func MergeIntFloat32(map1, map2 map[int]float32) map[int]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]float32{}\n\t}\n\n\tnewMap := make(map[int]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "66ee846e1d062e5594c4f0b79891691b", "score": "0.65979195", "text": "func MergeFloat32Int32(map1, map2 map[float32]int32) map[float32]int32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]int32{}\n\t}\n\n\tnewMap := make(map[float32]int32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "b223d38941157442491d7d5b52ec607f", "score": "0.65894145", "text": "func MergeUintFloat32(map1, map2 map[uint]float32) map[uint]float32 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[uint]float32{}\n\t}\n\n\tnewMap := make(map[uint]float32)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "3897822a0da635beec32f600797ee28c", "score": "0.6566415", "text": "func ZipUint32UintPtr(list1 []*uint32, list2 []*uint) map[*uint32]*uint {\n\tnewMap := make(map[*uint32]*uint)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ddffc01bc07394766ef4f34ef4722a2c", "score": "0.656609", "text": "func ZipInt64Ptr(list1 []*int64, list2 []*int64) map[*int64]*int64 {\n\tnewMap := make(map[*int64]*int64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "624bf5eea36aa9462481d0296cdefb85", "score": "0.6517383", "text": "func ZipUint64Ptr(list1 []*uint64, list2 []*uint64) map[*uint64]*uint64 {\n\tnewMap := make(map[*uint64]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "f574209a6fce315165ce0d40edfc14c6", "score": "0.6510771", "text": "func ZipUint64IntPtr(list1 []*uint64, list2 []*int) map[*uint64]*int {\n\tnewMap := make(map[*uint64]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "9d24ba87b1a10faf450cde16c2bd53f0", "score": "0.6501729", "text": "func MergeIntFloat64(map1, map2 map[int]float64) map[int]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int]float64{}\n\t}\n\n\tnewMap := make(map[int]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "65e86c724bca4ca5dbe75c2bef3a52dc", "score": "0.65014267", "text": "func ZipIntInt32Ptr(list1 []*int, list2 []*int32) map[*int]*int32 {\n\tnewMap := make(map[*int]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "178f303d8c96c7052bf88972d60ee515", "score": "0.64891315", "text": "func ZipIntUint64Ptr(list1 []*int, list2 []*uint64) map[*int]*uint64 {\n\tnewMap := make(map[*int]*uint64)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "7fa68b4a003acfd7f15ad915f0e55614", "score": "0.64882714", "text": "func MergeFloat32Int(map1, map2 map[float32]int) map[float32]int {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float32]int{}\n\t}\n\n\tnewMap := make(map[float32]int)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "a02dc9baee84f185a26cd2a77868c43c", "score": "0.6464373", "text": "func ZipUint16Int32Ptr(list1 []*uint16, list2 []*int32) map[*uint16]*int32 {\n\tnewMap := make(map[*uint16]*int32)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "81d6cd39419a5d2cc1b9507070c587aa", "score": "0.64606786", "text": "func MergeInt64Float64(map1, map2 map[int64]float64) map[int64]float64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[int64]float64{}\n\t}\n\n\tnewMap := make(map[int64]float64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "71400c1f4ab9ca53474d49d321ad4394", "score": "0.6460175", "text": "func ZipInt64IntPtr(list1 []*int64, list2 []*int) map[*int64]*int {\n\tnewMap := make(map[*int64]*int)\n\n\tlen1 := len(list1)\n\tlen2 := len(list2)\n\n\tif len1 == 0 || len2 == 0 {\n\t\treturn newMap\n\t}\n\n\tminLen := len1\n\tif len2 < minLen {\n\t\tminLen = len2\n\t}\n\n\tfor i := 0; i < minLen; i++ {\n\t\tnewMap[list1[i]] = list2[i]\n\t}\n\n\treturn newMap\n}", "title": "" }, { "docid": "ccbc555812b3473486fd6e7664041337", "score": "0.6446073", "text": "func MergeFloat64Int64(map1, map2 map[float64]int64) map[float64]int64 {\n\tif map1 == nil && map2 == nil {\n\t\treturn map[float64]int64{}\n\t}\n\n\tnewMap := make(map[float64]int64)\n\n\tif map1 == nil {\n\t\tfor k, v := range map2 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tif map2 == nil {\n\t\tfor k, v := range map1 {\n\t\t\tnewMap[k] = v\n\t\t}\n\t\treturn newMap\n\t}\n\n\tfor k, v := range map1 {\n\t\tnewMap[k] = v\n\t}\n\n\tfor k, v := range map2 {\n\t\tnewMap[k] = v\n\t}\n\n\treturn newMap\n}", "title": "" } ]
c21a034b20a762a14fa678de5a15172d
ChineseScoreLT applies the LT predicate on the "chinese_score" field.
[ { "docid": "0d73c75b9714cbf9364330a38b8f6efe", "score": "0.83276415", "text": "func ChineseScoreLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" } ]
[ { "docid": "0e673b10d45fd865ab45dff0913d2fa3", "score": "0.71130395", "text": "func ChineseScoreLTE(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "7905de9d6fe320ee1c6d1a9586cf1c36", "score": "0.66914535", "text": "func EnglishScoreLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEnglishScore), v))\n\t})\n}", "title": "" }, { "docid": "ac12013d46af6daf3dffd30dcad8d0d8", "score": "0.61440516", "text": "func MathScoreLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldMathScore), v))\n\t})\n}", "title": "" }, { "docid": "d077d1b8a8e643ac52424d28cdba42ce", "score": "0.6049577", "text": "func ChineseScoreGT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "2680c9e2b8b887c262ff797df3b03600", "score": "0.60065776", "text": "func ChineseScore(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "896f3b97f4e93586ba3145f1f993b4b6", "score": "0.59201586", "text": "func TotalScoreLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTotalScore), v))\n\t})\n}", "title": "" }, { "docid": "7fa7e43a0e2a549ccd928e9cddcf8c7f", "score": "0.5808753", "text": "func EnglishScoreLTE(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldEnglishScore), v))\n\t})\n}", "title": "" }, { "docid": "046efd644293f4d96429d84bf1f3794b", "score": "0.56503874", "text": "func Lt(args ...interface{}) RqlTerm {\n\tenforceArgLength(2, -1, args)\n\n\treturn newRqlTerm(\"Lt\", p.Term_LT, args, map[string]interface{}{})\n}", "title": "" }, { "docid": "8af69dbdf352b781c4775c1ffca4cb40", "score": "0.5609653", "text": "func RuleLT(v string) predicate.HttpRule {\n\treturn predicate.HttpRule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldRule), v))\n\t})\n}", "title": "" }, { "docid": "d5151b59843969e47c1e40530773b2f6", "score": "0.5563912", "text": "func (t RqlTerm) Lt(args ...interface{}) RqlTerm {\n\tenforceArgLength(1, -1, args)\n\n\treturn newRqlTermFromPrevVal(t, \"Lt\", p.Term_LT, args, map[string]interface{}{})\n}", "title": "" }, { "docid": "c68fd4a3d1d6313e2aa59d3b705eac00", "score": "0.5488885", "text": "func ChineseScoreContains(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "07b1f037433f0dacef9389935d012bd7", "score": "0.5456508", "text": "func (f CustomField) Lt(field Field) Predicate {\n\treturn BinaryPredicate{\n\t\tOperator: PredicateLt,\n\t\tLeftField: f,\n\t\tRightField: field,\n\t}\n}", "title": "" }, { "docid": "89ad1bf5dea6766cf3d37cb9095e8fe9", "score": "0.5380682", "text": "func SchoolRateLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSchoolRate), v))\n\t})\n}", "title": "" }, { "docid": "dbae611a4da6416203cf10dc69cb46c3", "score": "0.5379579", "text": "func ChineseScoreContainsFold(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "ae8ae680f484933f11646e4a87c7b0e0", "score": "0.53682446", "text": "func ChineseScoreGTE(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "b4d88c048a6f54cd54bf7c0fa470384a", "score": "0.5366095", "text": "func (c *AlertCondition) LT(threshold float64) *AlertCondition {\n\treturn c.setEvaluator(\"lt\", threshold)\n}", "title": "" }, { "docid": "2675c4ee7f225134237b5458450911b9", "score": "0.5316372", "text": "func YLT(v int) predicate.Construction {\n\treturn predicate.Construction(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldY), v))\n\t})\n}", "title": "" }, { "docid": "e20af62d6b791820ae3279757c28b78d", "score": "0.530931", "text": "func lt(m interface{}, value interface{}) (hpredicate, error) {\n\tswitch mapper := m.(type) {\n\tcase toInt:\n\t\treturn intLT(mapper, value)\n\t}\n\treturn nil, fmt.Errorf(\"unsupported argument: %T\", m)\n}", "title": "" }, { "docid": "07bae1a70feeed0b2be9172544422a09", "score": "0.53003377", "text": "func LT(want interface{}) *Matcher {\n\treturn totalOrderPredicate(\n\t\tfmt.Sprintf(\"is < %s\", describe(want)),\n\t\tfmt.Sprintf(\"is not < %s\", describe(want)),\n\t\twant, func(c compareResult) bool { return c == cLT })\n}", "title": "" }, { "docid": "ffefa75b77bd1e1b9bea5a9b6402d72a", "score": "0.52747315", "text": "func (q *Query) Lt(field string, value interface{}) (Lt, error) {\n\tif field == \"\" {\n\t\treturn Lt{}, fmt.Errorf(\"field could not be empty\")\n\t}\n\tlt := Lt{}\n\tlt.Lt = make(map[string]interface{})\n\tlt.Lt[field] = value\n\treturn lt, nil\n}", "title": "" }, { "docid": "81889420e17df5fac5a1e3fc00fa7710", "score": "0.5273504", "text": "func LevelLT(v int) predicate.Construction {\n\treturn predicate.Construction(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLevel), v))\n\t})\n}", "title": "" }, { "docid": "f7f94865c82b1af97169dd9ad5a0cd65", "score": "0.52433056", "text": "func ContentLT(v string) predicate.Post {\n\treturn predicate.Post(sql.FieldLT(FieldContent, v))\n}", "title": "" }, { "docid": "2cffc2bbd21464baa3efe6a7ee8323d8", "score": "0.5243287", "text": "func ChineseScoreHasPrefix(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "083e295c525a707b100b609f772ddcb7", "score": "0.5224097", "text": "func CaloriesLT(v int) predicate.Menu {\n\treturn predicate.Menu(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCalories), v))\n\t})\n}", "title": "" }, { "docid": "ceb04ddfb405ee6fa4eb80a0c8d62e7d", "score": "0.52070135", "text": "func ContentLT(v string) predicate.Article {\n\treturn predicate.Article(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldContent), v))\n\t})\n}", "title": "" }, { "docid": "c7c1c10ae9b95fd6bbc48de37a938df3", "score": "0.51904523", "text": "func ContagionLT(v string) predicate.Disease {\n\treturn predicate.Disease(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldContagion), v))\n\t})\n}", "title": "" }, { "docid": "6152667361ec786f7ea6c4d8d3c55bce", "score": "0.5188438", "text": "func UseCaseCodeLT(v string) predicate.ClinicalTrialMetadata {\n\treturn predicate.ClinicalTrialMetadata(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUseCaseCode), v))\n\t})\n}", "title": "" }, { "docid": "977c17c4da814de0db9e4b0fa3ac4b4f", "score": "0.51744044", "text": "func CategoryTitleLT(v string) predicate.SurveyTemplateCategory {\n\treturn predicate.SurveyTemplateCategory(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCategoryTitle), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "7352ee6a1beaff050163f76370f802d1", "score": "0.517312", "text": "func AgeLT(v int32) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "554eccf5688ccc861e8dfb45bf039029", "score": "0.5147228", "text": "func HeaderTransforLT(v string) predicate.HttpRule {\n\treturn predicate.HttpRule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldHeaderTransfor), v))\n\t})\n}", "title": "" }, { "docid": "6a76e2bea2dac590d2b8f43fe3dfd6fc", "score": "0.5133278", "text": "func ChineseScoreEQ(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "2b0c12d2cf455f15d66500ce01248545", "score": "0.5114702", "text": "func MsgLT(v string) predicate.LogMsg {\n\treturn predicate.LogMsg(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldMsg), v))\n\t})\n}", "title": "" }, { "docid": "90dd98fba22ab22abcd88accce4ce9c5", "score": "0.510591", "text": "func ChineseScoreIn(vs ...string) predicate.Student {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.Student(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(FieldChineseScore), v...))\n\t})\n}", "title": "" }, { "docid": "93b7e2866c154ac2cf6df128434f1258", "score": "0.50968206", "text": "func ChineseScoreEqualFold(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldChineseScore), v))\n\t})\n}", "title": "" }, { "docid": "85684244bf9b03f08ad5038b3a22acdb", "score": "0.5093136", "text": "func ExamNumLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldExamNum), v))\n\t})\n}", "title": "" }, { "docid": "29aa93c6f3ec592b3a39a3df0a61e641", "score": "0.50836504", "text": "func (s *Condition) SetLt(v int64) *Condition {\n\ts.Lt = &v\n\treturn s\n}", "title": "" }, { "docid": "7469ec60c1cb8757a5ffd32076440e24", "score": "0.5080223", "text": "func CountryLT(v string) predicate.Tank {\n\treturn predicate.Tank(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCountry), v))\n\t})\n}", "title": "" }, { "docid": "ed55484b8d129db2cfd3d6461559e8c6", "score": "0.50679076", "text": "func ChatIDLT(v int64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldChatID), v))\n\t})\n}", "title": "" }, { "docid": "9e20a58fa867a948b58359f08c2cb5d9", "score": "0.50485885", "text": "func SpecificProblemLT(v string) predicate.Rule {\n\treturn predicate.Rule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSpecificProblem), v))\n\t})\n}", "title": "" }, { "docid": "540427ead19652133c1e478c1ded05be", "score": "0.5047671", "text": "func AgeLT(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "540427ead19652133c1e478c1ded05be", "score": "0.5047671", "text": "func AgeLT(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "f691e9f15a4f8bb8bca2855e3b08d898", "score": "0.50201833", "text": "func Lt(value interface{}, msgs ...string) Validator {\n\tmsg := getMsg(\"Lt\", \"is greater than or equal to given value\", msgs...)\n\treturn not(Gte(value), \"Lt\", msg)\n}", "title": "" }, { "docid": "24d7dc9abc6a171b749f7932cf53fbd5", "score": "0.5016557", "text": "func StrLT(v string) predicate.IssueX1355 {\n\treturn predicate.IssueX1355(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldStr), v))\n\t})\n}", "title": "" }, { "docid": "9a3ff95c1732d7208f4c8f60c906bb15", "score": "0.49828517", "text": "func AgeLT(v int) predicate.Carservice {\n\treturn predicate.Carservice(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "554543233d1cd668b66f5d25f6203ae0", "score": "0.49814036", "text": "func (q *Query) Lt(field string, value any) *Query {\n\tp := Property{}\n\terr := p.SetValue(value, ShouldIndex)\n\n\tif err == nil && q.ineqFiltHighSet {\n\t\tif q.ineqFiltHigh.Less(&p) {\n\t\t\treturn q\n\t\t} else if q.ineqFiltHigh.Equal(&p) && !q.ineqFiltHighIncl {\n\t\t\treturn q\n\t\t}\n\t}\n\n\treturn q.mod(func(q *Query) {\n\t\tif q.err = err; err != nil {\n\t\t\treturn\n\t\t}\n\t\tif q.ineqOK(field, p) {\n\t\t\tq.ineqFiltProp = field\n\t\t\tq.ineqFiltHighSet = true\n\t\t\tq.ineqFiltHigh = p\n\t\t\tq.ineqFiltHighIncl = false\n\t\t}\n\t})\n}", "title": "" }, { "docid": "9f4d6f00856bc8db2c9a21a200b90f4c", "score": "0.49781144", "text": "func SchlolarshipnameLT(v string) predicate.Scholarship {\n\treturn predicate.Scholarship(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSchlolarshipname), v))\n\t})\n}", "title": "" }, { "docid": "2c47479a76122ef5ac81b106f803828d", "score": "0.49741885", "text": "func (t1 *Real) LT(t2 *Real) *Real {\n\tval := &Real{\n\t\t&AST{\n\t\t\tZ3Context:\tt1.Z3Context,\n\t\t\tZ3AST:\t\tC.Z3_mk_lt(t1.Z3Context, t1.Z3AST, t2.Z3AST),\n\t\t},\n\t}\n\n\treturn val;\n}", "title": "" }, { "docid": "15ccd74f0f20310f5a9d339c4ba63ecb", "score": "0.4969093", "text": "func TitleLT(v string) predicate.Article {\n\treturn predicate.Article(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "299d0e33036443a4c9c3377ce9b6c9d9", "score": "0.49664858", "text": "func (i BigInt) LT(i2 BigInt) bool {\n\treturn lt(i.i, i2.i)\n}", "title": "" }, { "docid": "1c5db86de9c87f687760aff582e4db32", "score": "0.49634045", "text": "func CodeLT(v int) predicate.Group {\n\treturn predicate.Group(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCode), v))\n\t})\n}", "title": "" }, { "docid": "2b91362cebd446f12b95b00225f31158", "score": "0.4953856", "text": "func WorkplaceLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldWorkplace), v))\n\t})\n}", "title": "" }, { "docid": "3abfd72a1fcf6e0ae4697cbce618caa4", "score": "0.4950692", "text": "func (q *Query) Lt(name string, value interface{}) *Query {\n\tq.inner = q.inner.Filter(fmt.Sprintf(\"%s <\", name), value)\n\tq.statement = append(q.statement, fmt.Sprintf(\"%s < %s\", name, value))\n\treturn q\n}", "title": "" }, { "docid": "e7b761e180b0927341c22c4982a81b78", "score": "0.4948714", "text": "func PlaysLT(v int64) predicate.Song {\n\treturn predicate.Song(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPlays), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "827a4ac6563c9fd2dd927a7811434dac", "score": "0.49463138", "text": "func PriorityLT(v string) predicate.WorkOrder {\n\treturn predicate.WorkOrder(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPriority), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "1d287584036d1e2443eb722ebdfa8cd2", "score": "0.493741", "text": "func TitleLT(v string) predicate.Post {\n\treturn predicate.Post(sql.FieldLT(FieldTitle, v))\n}", "title": "" }, { "docid": "28723fec2fd60259f25e0c3f09e974b3", "score": "0.49246132", "text": "func (e Exp) Lt(operand interface{}) Exp {\n\treturn naryOperator(lessThanKind, e, operand)\n}", "title": "" }, { "docid": "e8ad4ad89e0db088a092e648c0bc2806", "score": "0.49102515", "text": "func ClassRateLT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldClassRate), v))\n\t})\n}", "title": "" }, { "docid": "1905cb88ceffac5e3c415d0223bf4da8", "score": "0.49095643", "text": "func TelegramUsernameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTelegramUsername), v))\n\t})\n}", "title": "" }, { "docid": "d1b4700680e6a29e69deb7ea470829ef", "score": "0.49051383", "text": "func AdditionalInfoLT(v string) predicate.Rule {\n\treturn predicate.Rule(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAdditionalInfo), v))\n\t})\n}", "title": "" }, { "docid": "01b0acccd603f2dcf93b8b96d7a1a00a", "score": "0.49022812", "text": "func PhoneLT(v string) predicate.Song {\n\treturn predicate.Song(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPhone), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "0cc89cc49808a818132800dade8c1cb2", "score": "0.48899314", "text": "func EnglishScoreGT(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldEnglishScore), v))\n\t})\n}", "title": "" }, { "docid": "66418911c6a1e506c1fa05c1d97abe10", "score": "0.48851207", "text": "func (m *Model) WherePrefixLT(prefix string, column string, value interface{}) *Model {\n\treturn m.callWhereBuilder(m.whereBuilder.WherePrefixLT(prefix, column, value))\n}", "title": "" }, { "docid": "d497ad70d2b46defce8454be4309d6e9", "score": "0.48754522", "text": "func CodeLT(v string) predicate.DNSBLResponse {\n\treturn predicate.DNSBLResponse(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCode), v))\n\t})\n}", "title": "" }, { "docid": "51271ecc88d80298f21fffd29012395a", "score": "0.48739377", "text": "func LfStarsLt(val int) LfStarsCriteria {\n\treturn func(x int) bool {\n\t\treturn x < val\n\t}\n}", "title": "" }, { "docid": "32e404257ff3e3f805ed9a5cc343763a", "score": "0.48654795", "text": "func (s byScore) Less(i, j int) bool {\n\ta := s.entries[i].Score\n\tb := s.entries[j].Score\n\treturn a.Compare(b) > 0\n}", "title": "" }, { "docid": "a85a1b60960b582156bed339ff1850c9", "score": "0.4863852", "text": "func SortLT(v int32) predicate.SysMenu {\n\treturn predicate.SysMenu(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSort), v))\n\t})\n}", "title": "" }, { "docid": "03ac62819ff385132001adc50f890345", "score": "0.48576888", "text": "func CategoryDescriptionLT(v string) predicate.SurveyTemplateCategory {\n\treturn predicate.SurveyTemplateCategory(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCategoryDescription), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "70966985ea0ef4ea6b1d49685e464c41", "score": "0.48453242", "text": "func (w walkResult) LessThan(v walkResult) bool {\n\tswitch {\n\tcase w.Score < v.Score:\n\t\treturn false\n\tcase w.Score > v.Score:\n\t\treturn true\n\tcase w.NodeRPath < v.NodeRPath:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "ece1a7837bb7f9d6caa24b33d6149e08", "score": "0.48283222", "text": "func LT(binding interface{}) (exp Expression) {\n\treturn &PrefixedExp{\" < \", []Expression{Exp(\"?\", binding)}, \"\", nil}\n}", "title": "" }, { "docid": "782806f48ce56ab93bcc4c255bea14c2", "score": "0.48257893", "text": "func TagValueLT(v string) predicate.ClinicalTrialMetadata {\n\treturn predicate.ClinicalTrialMetadata(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTagValue), v))\n\t})\n}", "title": "" }, { "docid": "37ca21bbd1a8824284f1989c28d381e1", "score": "0.4812355", "text": "func PhoneLT(v string) predicate.Roomdetail {\n\treturn predicate.Roomdetail(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "5898464a99af48c4d04c084dd0304a69", "score": "0.4812344", "text": "func CurrencyLT(v string) predicate.Account {\n\treturn predicate.Account(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCurrency), v))\n\t})\n}", "title": "" }, { "docid": "970182942fccd085b9bbe1c0d37f77ac", "score": "0.4796697", "text": "func ValueLT(v string) predicate.Tag {\n\treturn predicate.Tag(sql.FieldLT(FieldValue, v))\n}", "title": "" }, { "docid": "2b06bf7e7278911d87c32037afc3eda6", "score": "0.47892356", "text": "func CompanyLT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCompany), v))\n\t})\n}", "title": "" }, { "docid": "fadedfeaeb30f684cc8d78d77b51b6a1", "score": "0.47872594", "text": "func SkuLT(v string) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSku), v))\n\t})\n}", "title": "" }, { "docid": "f0705940041f77a55395cff6f112ac7b", "score": "0.47823167", "text": "func TitleLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTitle), v))\n\t})\n}", "title": "" }, { "docid": "70375d5d5ed595b78a6e11c5e58bd6b1", "score": "0.4775987", "text": "func TitleLT(v string) predicate.Book {\n\treturn predicate.Book(sql.FieldLT(FieldTitle, v))\n}", "title": "" }, { "docid": "cf58ea769a86d749bba901c1697b84a8", "score": "0.47752416", "text": "func WagesLT(v float64) predicate.EmployeeWorkingHours {\n\treturn predicate.EmployeeWorkingHours(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldWages), v))\n\t})\n}", "title": "" }, { "docid": "84e912f6a42219854fd899f569f809aa", "score": "0.4772551", "text": "func SymptomLT(v string) predicate.Transport {\n\treturn predicate.Transport(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSymptom), v))\n\t})\n}", "title": "" }, { "docid": "9d3998f4bab60030928eab40502a0234", "score": "0.4770235", "text": "func HLT()", "title": "" }, { "docid": "34cd78f7768c6ea88097f04a25337461", "score": "0.4763475", "text": "func (validator *ValidatorString[T]) LessThan(value T, template ...string) *ValidatorString[T] {\n\tvalidator.context.AddWithValue(\n\t\tfunc() bool {\n\t\t\treturn isStringLessThan(validator.context.Value().(T), value)\n\t\t},\n\t\tErrorKeyLessThan, value, template...)\n\n\treturn validator\n}", "title": "" }, { "docid": "adb0fde1680b14d5122d817449c7cb7c", "score": "0.47629154", "text": "func HostLT(v string) predicate.Node {\n\treturn predicate.Node(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldHost), v))\n\t})\n}", "title": "" }, { "docid": "e68cffb60def4aa54ecc787e907271e9", "score": "0.47547168", "text": "func PhoneLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "e68cffb60def4aa54ecc787e907271e9", "score": "0.47547168", "text": "func PhoneLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "e6674bd175a3a72eb1abb4eb34cac89a", "score": "0.47311652", "text": "func CountLT(v int) predicate.Group {\n\treturn predicate.Group(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCount), v))\n\t})\n}", "title": "" }, { "docid": "6f2a7a86b4a1d288433d26bc6ea5ccae", "score": "0.47256947", "text": "func (qs UsersQuerySet) LevelLt(level int) UsersQuerySet {\n\treturn qs.w(qs.db.Where(\"level < ?\", level))\n}", "title": "" }, { "docid": "487261619d8e430d945d77870c959d3a", "score": "0.47207797", "text": "func OfficialTitleLT(v string) predicate.ClinicalTrial {\n\treturn predicate.ClinicalTrial(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOfficialTitle), v))\n\t})\n}", "title": "" }, { "docid": "42764e6f67c77eb5055540f80767050c", "score": "0.47193983", "text": "func IdentitycardLT(v string) predicate.Checksymptom {\n\treturn predicate.Checksymptom(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldIdentitycard), v))\n\t})\n}", "title": "" }, { "docid": "e8f6f9112a91dbcb637614ffb600456b", "score": "0.47188747", "text": "func PhoneLT(v string) predicate.Checksymptom {\n\treturn predicate.Checksymptom(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPhone), v))\n\t})\n}", "title": "" }, { "docid": "ad421e2324bd4b205cc98f44efcd8d9f", "score": "0.4711741", "text": "func MathScoreLTE(v string) predicate.Student {\n\treturn predicate.Student(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldMathScore), v))\n\t})\n}", "title": "" }, { "docid": "2eb95b67bbff44583f2a8bdd26f069e9", "score": "0.47064334", "text": "func TLT(v time.Time) predicate.LogMsg {\n\treturn predicate.LogMsg(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldT), v))\n\t})\n}", "title": "" }, { "docid": "f29610dc8a0d967b8add367e75ea9d2d", "score": "0.47052994", "text": "func Lt(col string, val interface{}) Pred { return Pred{Col: col, Op: \"<\", Val: val} }", "title": "" }, { "docid": "802059f559623e1755ad9254da9bdb24", "score": "0.4696235", "text": "func CategoryIDLT(v int) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCategoryID), v))\n\t})\n}", "title": "" }, { "docid": "de1277da9be6fee8a8ed4125d09d6aca", "score": "0.46959203", "text": "func CountLT(v uint16) predicate.OrderField {\n\treturn predicate.OrderField(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldCount), v))\n\t})\n}", "title": "" }, { "docid": "84e37bb9c53d7d9744ec520a1363e1aa", "score": "0.4694808", "text": "func (c *ConditionList) FilterLT(key string, val interface{}) {\n\tc.setFilter(conditionLT, key, val)\n}", "title": "" }, { "docid": "ef894643f542cf60f30ea129b5b38216", "score": "0.46937582", "text": "func MenunameLT(v string) predicate.Menu {\n\treturn predicate.Menu(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldMenuname), v))\n\t})\n}", "title": "" }, { "docid": "d22437cc9a09f69496354d8ea86a1eaa", "score": "0.4691741", "text": "func LT(l abstraction.Ref, r abstraction.Ref) (b abstraction.Ref, err error) {\n\treturn arithmeticCompare(gvm_builtin.Less, l, r)\n}", "title": "" }, { "docid": "9a1b78981e2420ef553e84cdc3150cd9", "score": "0.46884674", "text": "func AddedAtLT(v time.Time) predicate.TweetTag {\n\treturn predicate.TweetTag(sql.FieldLT(FieldAddedAt, v))\n}", "title": "" }, { "docid": "68b171928c1f16a083f4cd1936fd1f09", "score": "0.46858016", "text": "func LT(fieldName string, value interface{}) string {\n\treturn fmt.Sprintf(\"Row(%s<%s)\", fieldName, formatValue(value))\n}", "title": "" }, { "docid": "3d47b756b21185a551a40df8f7013ba4", "score": "0.46836823", "text": "func ToiletsLT(v int) predicate.Roomtype {\n\treturn predicate.Roomtype(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldToilets), v))\n\t})\n}", "title": "" } ]
ed90a20ed82b07410ac9f1343fc72080
GetHomeNodeOk returns a tuple with the HomeNode field value if set, nil otherwise and a boolean to check if the value has been set.
[ { "docid": "6e0e18dca3a2e07e5a9a74ae1826eb22", "score": "0.82685417", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetHomeNodeOk() (*string, bool) {\n\tif o == nil || o.HomeNode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HomeNode, true\n}", "title": "" } ]
[ { "docid": "9f56409749a855b16d94176586770019", "score": "0.7277638", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) HasHomeNode() bool {\n\tif o != nil && o.HomeNode != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9bd1ccf070eb32e99f61f21beb366f86", "score": "0.69164604", "text": "func (o *Contact) GetHomeAddressOk() (AnyOfmicrosoftGraphPhysicalAddress, bool) {\n\tif o == nil || o.HomeAddress == nil {\n\t\tvar ret AnyOfmicrosoftGraphPhysicalAddress\n\t\treturn ret, false\n\t}\n\treturn *o.HomeAddress, true\n}", "title": "" }, { "docid": "9aec0cb70e02db5364172e55f09c0b3d", "score": "0.69012135", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetIsHomeOk() (*bool, bool) {\n\tif o == nil || o.IsHome == nil {\n\t\treturn nil, false\n\t}\n\treturn o.IsHome, true\n}", "title": "" }, { "docid": "c3d364bea028d604143575d711060969", "score": "0.6885853", "text": "func (o *NetInterfaceInfoType) HomeNode() string {\n\tvar r string\n\tif o.HomeNodePtr == nil {\n\t\treturn r\n\t}\n\tr = *o.HomeNodePtr\n\treturn r\n}", "title": "" }, { "docid": "028dfc2eac522c103d8c4bcbe6170d6c", "score": "0.685368", "text": "func (o *IncomeVerificationPrecheckUser) GetHomeAddressOk() (*SignalAddressData, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HomeAddress.Get(), o.HomeAddress.IsSet()\n}", "title": "" }, { "docid": "2fb07f1355227913de22292116ab592d", "score": "0.6741636", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetHomeNode() string {\n\tif o == nil || o.HomeNode == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.HomeNode\n}", "title": "" }, { "docid": "cd9b04444514a114eba241fd46c7d33d", "score": "0.67285514", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetHomePortOk() (*string, bool) {\n\tif o == nil || o.HomePort == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HomePort, true\n}", "title": "" }, { "docid": "1336f28967aea99dd930742dc4ccd737", "score": "0.65868604", "text": "func (o *NetInterfaceInfoType) IsHome() bool {\n\tvar r bool\n\tif o.IsHomePtr == nil {\n\t\treturn r\n\t}\n\tr = *o.IsHomePtr\n\treturn r\n}", "title": "" }, { "docid": "abdf912949668eaad1abc50f58a7952c", "score": "0.6532288", "text": "func (o *PeopleJsonPerson) GetPhoneNumberHomeOk() (*string, bool) {\n\tif o == nil || o.PhoneNumberHome == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneNumberHome, true\n}", "title": "" }, { "docid": "9be2099edb2c63a2bdb893b08858f987", "score": "0.6504035", "text": "func (m Model) HomeNode() string {\n\th, _ := getHomeNode(m.Domain, m.Request)\n\treturn h\n}", "title": "" }, { "docid": "f996eda93425ebf4f7fcab3a26d6ad38", "score": "0.6493911", "text": "func (o *PeopleSpecificPerson) GetPhoneNumberHomeOk() (*string, bool) {\n\tif o == nil || o.PhoneNumberHome == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PhoneNumberHome, true\n}", "title": "" }, { "docid": "cfa4d9de704d0f38675ac49ce56a79b8", "score": "0.646263", "text": "func (o *NetInterfaceInfoType) SetHomeNode(newValue string) *NetInterfaceInfoType {\n\to.HomeNodePtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "d274334fa44aaa273d6a0dddf39f942b", "score": "0.6323518", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) SetHomeNode(v string) {\n\to.HomeNode = &v\n}", "title": "" }, { "docid": "edd465a1f7ad902fea6fc142a1533066", "score": "0.60626817", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetIsHome() bool {\n\tif o == nil || o.IsHome == nil {\n\t\tvar ret bool\n\t\treturn ret\n\t}\n\treturn *o.IsHome\n}", "title": "" }, { "docid": "87e7d720c2c8b167c78c90937f13ea9f", "score": "0.60427606", "text": "func (o *CIAppPipelineEventPipeline) GetNodeOk() (*CIAppHostInfo, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Node.Get(), o.Node.IsSet()\n}", "title": "" }, { "docid": "8bf519a5f56f4f2d47a2a3e803b0396a", "score": "0.60016125", "text": "func (o *IncomeVerificationPrecheckUser) HasHomeAddress() bool {\n\tif o != nil && o.HomeAddress.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ec00e1e544c371b9ca440dc53ad58550", "score": "0.5983381", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetInterfaceIsHomeOk() (*string, bool) {\n\tif o == nil || o.InterfaceIsHome == nil {\n\t\treturn nil, false\n\t}\n\treturn o.InterfaceIsHome, true\n}", "title": "" }, { "docid": "74dd04ba748ab31bb3c3ee1f06cccda9", "score": "0.59399474", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) HasHomePort() bool {\n\tif o != nil && o.HomePort != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "53ebe7632efa1974783f206fca404d43", "score": "0.5902482", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) HasIsHome() bool {\n\tif o != nil && o.IsHome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "465e844a8fd4e2df6284974a8529bcdc", "score": "0.58565515", "text": "func (o *Contact) GetBusinessHomePageOk() (string, bool) {\n\tif o == nil || o.BusinessHomePage == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.BusinessHomePage, true\n}", "title": "" }, { "docid": "58a341061ea1d765abe264d6c561cf62", "score": "0.58435744", "text": "func (o *PeopleJsonPerson) HasPhoneNumberHome() bool {\n\tif o != nil && o.PhoneNumberHome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "933fb7c9d96e10d0ccbadb8db55bbd42", "score": "0.5805334", "text": "func (o *Contact) HasHomeAddress() bool {\n\tif o != nil && o.HomeAddress != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aed9ef99894144d4b34847bd7e2e9f91", "score": "0.5740881", "text": "func (o *Contact) GetHomeAddress() AnyOfmicrosoftGraphPhysicalAddress {\n\tif o == nil || o.HomeAddress == nil {\n\t\tvar ret AnyOfmicrosoftGraphPhysicalAddress\n\t\treturn ret\n\t}\n\treturn *o.HomeAddress\n}", "title": "" }, { "docid": "ef1660e3b201db2e13e01396428002f1", "score": "0.57356346", "text": "func (o *PeopleSpecificPerson) HasPhoneNumberHome() bool {\n\tif o != nil && o.PhoneNumberHome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c2782f80d81ddadc6269606d57903912", "score": "0.56233585", "text": "func (o *NetInterfaceInfoType) SetIsHome(newValue bool) *NetInterfaceInfoType {\n\to.IsHomePtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "44e5c6f9bc622fdea1ff58ab32770643", "score": "0.55702543", "text": "func (o *Contact) GetHomePhonesOk() ([]string, bool) {\n\tif o == nil || o.HomePhones == nil {\n\t\tvar ret []string\n\t\treturn ret, false\n\t}\n\treturn *o.HomePhones, true\n}", "title": "" }, { "docid": "cf9b8e5ed6861c04d62144349f73b100", "score": "0.5541204", "text": "func (o *IncomeVerificationPrecheckUser) GetHomeAddress() SignalAddressData {\n\tif o == nil || o.HomeAddress.Get() == nil {\n\t\tvar ret SignalAddressData\n\t\treturn ret\n\t}\n\treturn *o.HomeAddress.Get()\n}", "title": "" }, { "docid": "5b0fa2e4da0341c1fc4ffe16bf354c91", "score": "0.5530078", "text": "func (o *NetInterfaceInfoType) HomePort() string {\n\tvar r string\n\tif o.HomePortPtr == nil {\n\t\treturn r\n\t}\n\tr = *o.HomePortPtr\n\treturn r\n}", "title": "" }, { "docid": "d3353c92c6c3e30f247386e3b7119795", "score": "0.5526165", "text": "func (o *NiatelemetryNetworkInfoAllOf) GetStandbyNodeOk() (*NiatelemetryNode, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.StandbyNode.Get(), o.StandbyNode.IsSet()\n}", "title": "" }, { "docid": "9805f6930c81eb60402ce2ff0261dbee", "score": "0.55075294", "text": "func (o *UiNodeAnchorAttributes) GetNodeTypeOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.NodeType, true\n}", "title": "" }, { "docid": "3545146fa3c7850807cbc89f04041309", "score": "0.54809916", "text": "func (o *IncomeVerificationPrecheckUser) SetHomeAddressNil() {\n\to.HomeAddress.Set(nil)\n}", "title": "" }, { "docid": "3aedebc10d06cb3c3c628fa940b2c1ee", "score": "0.54395676", "text": "func (e *EngineConfig) GetNoHome() bool {\n\treturn e.JSON.NoHome\n}", "title": "" }, { "docid": "56c610dcbe37ccbd9beddf221b656b7c", "score": "0.540254", "text": "func (o *V1OrganismCounts) GetNodeOk() (*int32, bool) {\n\tif o == nil || o.Node == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Node, true\n}", "title": "" }, { "docid": "85474f9917c8f49ded9585cc0e7675b0", "score": "0.53513426", "text": "func NewHeadNodeOK() *HeadNodeOK {\n\treturn &HeadNodeOK{}\n}", "title": "" }, { "docid": "9a9f4ae8023f3d1335077c9cd81fc7eb", "score": "0.5339476", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetCurrentNodeOk() (*string, bool) {\n\tif o == nil || o.CurrentNode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.CurrentNode, true\n}", "title": "" }, { "docid": "dbb12beae66105ae4f74dbaf75ed7af6", "score": "0.5329024", "text": "func (o *VirtualizationVmwareNetworkAllOf) GetHostOk() (*VirtualizationVmwareHostRelationship, bool) {\n\tif o == nil || o.Host == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Host, true\n}", "title": "" }, { "docid": "f4c04c0f4a7f3bc8bef035d566846897", "score": "0.5306392", "text": "func (o *NetworkIPInterfacesGetParams) SetLocationHomeNodeName(locationHomeNodeName *string) {\n\to.LocationHomeNodeName = locationHomeNodeName\n}", "title": "" }, { "docid": "1490e02bdadc077dd871d2e0902b60c0", "score": "0.5288326", "text": "func GetHomeOpt(opts []*Opt) string {\n\tif o := Get(opts, HomeOptKey); o != nil {\n\t\tif val, ok := o.Val.(string); ok {\n\t\t\treturn val\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "f9a485db3f10f4a9c163ee34565d839b", "score": "0.5279322", "text": "func (o *V1Organism) GetBlastNodeOk() (*bool, bool) {\n\tif o == nil || o.BlastNode == nil {\n\t\treturn nil, false\n\t}\n\treturn o.BlastNode, true\n}", "title": "" }, { "docid": "aad0e9ec37a2313686f3172efbe3f371", "score": "0.5270145", "text": "func (me TxsdKeycapFunction) IsHome() bool { return me == \"home\" }", "title": "" }, { "docid": "62b6d3930f27771e5f95e54dc4f26d7c", "score": "0.5263058", "text": "func (o *HeadNodeOK) IsSuccess() bool {\n\treturn true\n}", "title": "" }, { "docid": "f4c5372520e16a4a5ade8063408a274d", "score": "0.52434033", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) SetIsHome(v bool) {\n\to.IsHome = &v\n}", "title": "" }, { "docid": "b31079124f057eb77cc97bfe5f2fc24e", "score": "0.5224772", "text": "func (o *Contact) HasHomePhones() bool {\n\tif o != nil && o.HomePhones != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "beade1b269e7e5be4aed80dc2d3ee7d7", "score": "0.5191602", "text": "func (o *NiatelemetryApicPerformanceDataAllOf) GetNodeHealthOk() (*int64, bool) {\n\tif o == nil || o.NodeHealth == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeHealth, true\n}", "title": "" }, { "docid": "8ab1e5178421d355b34ce51085ae05d1", "score": "0.5183099", "text": "func (o *NiatelemetryNetworkInfoAllOf) GetActiveNodeOk() (*NiatelemetryNode, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ActiveNode.Get(), o.ActiveNode.IsSet()\n}", "title": "" }, { "docid": "909cdd7faeba4f3b69b9fe91d23c8f9c", "score": "0.51796156", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) HasInterfaceIsHome() bool {\n\tif o != nil && o.InterfaceIsHome != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "1522082e74646d279a24b897f8ad4977", "score": "0.5173881", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetInterfaceIsHome() string {\n\tif o == nil || o.InterfaceIsHome == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.InterfaceIsHome\n}", "title": "" }, { "docid": "8b28f80cd2d723fe03cf5d80bed35a4f", "score": "0.51632166", "text": "func (js *JoinServer) GetHomeNetwork(ctx context.Context, joinEUI, devEUI types.EUI64, authorizer Authorizer) (*EndDeviceHomeNetwork, error) {\n\tif err := authorizer.RequireAuthorized(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdev, err := js.devices.GetByEUI(ctx, joinEUI, devEUI,\n\t\t[]string{\n\t\t\t\"net_id\",\n\t\t\t\"network_server_address\",\n\t\t},\n\t)\n\tif err != nil {\n\t\treturn nil, errRegistryOperation.WithCause(err)\n\t}\n\tctx = dev.Context\n\tif entityAuth, ok := authorizer.(EntityAuthorizer); ok {\n\t\tif err := entityAuth.RequireEntityContext(ctx); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tnetID := dev.NetId\n\n\tif netID == nil {\n\t\tsets, err := js.applicationActivationSettings.GetByID(ctx, dev.Ids.ApplicationIds, []string{\n\t\t\t\"home_net_id\",\n\t\t})\n\t\tif err != nil {\n\t\t\tif !errors.IsNotFound(err) {\n\t\t\t\treturn nil, errGetApplicationActivationSettings.WithCause(err)\n\t\t\t}\n\t\t\treturn nil, nil\n\t\t}\n\t\tnetID = sets.HomeNetId\n\t}\n\t// TODO: Return NSID (https://github.com/TheThingsNetwork/lorawan-stack/issues/4741).\n\treturn &EndDeviceHomeNetwork{\n\t\tNetID: types.MustNetID(netID),\n\t\tNetworkServerAddress: dev.NetworkServerAddress,\n\t}, nil\n}", "title": "" }, { "docid": "33fba1142d9e62ffba536ef68d7c423e", "score": "0.5154847", "text": "func (o *PeopleJsonPerson) GetPhoneNumberHome() string {\n\tif o == nil || o.PhoneNumberHome == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneNumberHome\n}", "title": "" }, { "docid": "2aaaa6c751c461d33e39e5bcd82be984", "score": "0.51091576", "text": "func (o *Contact) SetHomeAddressExplicitNull(b bool) {\n\to.HomeAddress = nil\n\to.isExplicitNullHomeAddress = b\n}", "title": "" }, { "docid": "cc61f6da90ee428eed080bab493e82a4", "score": "0.5104928", "text": "func (o *VirtualizationEsxiVmConfiguration) GetFolderOk() (*string, bool) {\n\tif o == nil || o.Folder == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Folder, true\n}", "title": "" }, { "docid": "80a3de58c0c41d5ba3c63e0871f83a2d", "score": "0.51043063", "text": "func (o *PeopleJsonPerson) SetPhoneNumberHome(v string) {\n\to.PhoneNumberHome = &v\n}", "title": "" }, { "docid": "68c42ea8a66d51f94ebd68525b103514", "score": "0.5079788", "text": "func (o *FcInterfaceCollectionGetParams) SetLocationHomeNodeName(locationHomeNodeName *string) {\n\to.LocationHomeNodeName = locationHomeNodeName\n}", "title": "" }, { "docid": "e6ba4c5f994134120a0d3226d42acf1f", "score": "0.5064515", "text": "func (o *VmediaMappingAllOf) GetHostNameOk() (*string, bool) {\n\tif o == nil || o.HostName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HostName, true\n}", "title": "" }, { "docid": "af0b5d789af84bfaac5b96ae625f5334", "score": "0.50639516", "text": "func (h *Node) IsHostPathNode() bool { return h.hostPathNode }", "title": "" }, { "docid": "5fe96ad8ecee2cf6902ba0979c18e490", "score": "0.50434285", "text": "func (o *MicrosoftGraphIosHomeScreenFolder) GetDisplayNameOk() (string, bool) {\n\tif o == nil || o.DisplayName == nil {\n\t\tvar ret string\n\t\treturn ret, false\n\t}\n\treturn *o.DisplayName, true\n}", "title": "" }, { "docid": "f25d88c083c3492bf9f0d48b0a4c8668", "score": "0.50384074", "text": "func (o *PodInfo) GetHostOk() (*string, bool) {\n\tif o == nil || IsNil(o.Host) {\n\t\treturn nil, false\n\t}\n\treturn o.Host, true\n}", "title": "" }, { "docid": "bc0eda4e099508fa4fef0e199504be24", "score": "0.5026731", "text": "func (o *NetworkIPInterfacesGetParams) SetLocationHomePortNodeName(locationHomePortNodeName *string) {\n\to.LocationHomePortNodeName = locationHomePortNodeName\n}", "title": "" }, { "docid": "ffbb3b1d3ebfb86cdb9906bb71a332ae", "score": "0.5010238", "text": "func (o *StorageNetAppBaseEvent) GetNodeUuidOk() (*string, bool) {\n\tif o == nil || o.NodeUuid == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeUuid, true\n}", "title": "" }, { "docid": "a2cc989ede2f7125e935b9ff32b11566", "score": "0.49975076", "text": "func (o *PeopleSpecificPerson) SetPhoneNumberHome(v string) {\n\to.PhoneNumberHome = &v\n}", "title": "" }, { "docid": "50ad4ead10b83e04f2d55295346be3c2", "score": "0.49944606", "text": "func (t *LighthouseBeaconNode) HomeDir() string {\n\treturn LighthouseHomeDir\n}", "title": "" }, { "docid": "b1333f8358cc94a0e94af2eb730be966", "score": "0.4988101", "text": "func (o *Contact) SetHomeAddress(v AnyOfmicrosoftGraphPhysicalAddress) {\n\to.HomeAddress = &v\n}", "title": "" }, { "docid": "324d37b1839743b02268cd55b76dffc3", "score": "0.49877813", "text": "func (o *StorageNetAppFcPortAllOf) GetNodeNameOk() (*string, bool) {\n\tif o == nil || o.NodeName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeName, true\n}", "title": "" }, { "docid": "e34ed3ee784ffe90e3deead4c039f176", "score": "0.4983544", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) GetHomePort() string {\n\tif o == nil || o.HomePort == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.HomePort\n}", "title": "" }, { "docid": "077db0be5203d1e208b3ddce239ef28a", "score": "0.49802157", "text": "func (o *PeopleSpecificPerson) GetPhoneNumberHome() string {\n\tif o == nil || o.PhoneNumberHome == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.PhoneNumberHome\n}", "title": "" }, { "docid": "a63063ee72616296ac7c1511b7e2f5d3", "score": "0.49631962", "text": "func (o *PeeringNodeStatusResponse) GetPublicKeyOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PublicKey, true\n}", "title": "" }, { "docid": "3c0c5136a0d28a9d14651140c766df44", "score": "0.49611342", "text": "func (o *StorageNetAppDataIpInterface) GetTenantOk() (*StorageNetAppStorageVmRelationship, bool) {\n\tif o == nil || o.Tenant == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tenant, true\n}", "title": "" }, { "docid": "05a39e03fbc9b28b02b0228ac26bd965", "score": "0.4959717", "text": "func (h *hopHintsConfigMock) IsPublicNode(pubKey [33]byte) (bool, error) {\n\targs := h.Mock.Called(pubKey)\n\treturn args.Bool(0), args.Error(1)\n}", "title": "" }, { "docid": "7a7b1b712fb75f12ea3e96e7290b940a", "score": "0.49464723", "text": "func (o *VirtualizationEsxiVmConfigurationAllOf) GetFolderOk() (*string, bool) {\n\tif o == nil || o.Folder == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Folder, true\n}", "title": "" }, { "docid": "c4bd3dc79a47c0ea0ff422ce710e416e", "score": "0.4946178", "text": "func (o *StorageNetAppFcInterface) GetTenantOk() (*StorageNetAppStorageVmRelationship, bool) {\n\tif o == nil || o.Tenant == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Tenant, true\n}", "title": "" }, { "docid": "1e7d634109e1220f77deccbbbd580f10", "score": "0.49427852", "text": "func (lxdf bFolder) GetHomeFolder() (string, error) {\n\tusr, err := user.Current()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\t// User can set a custom KUBE_KNARK_HOME from environment variable\n\tusrHome := GetEnv(common.LxdProbeHomeEnvVar, usr.HomeDir)\n\treturn path.Join(usrHome, \".lxd-probe\"), nil\n}", "title": "" }, { "docid": "a052548048e968d2d16b1058648ecc2f", "score": "0.4942113", "text": "func HomeOpt(val string) *Opt {\n\treturn &Opt{Key: HomeOptKey, Val: val}\n}", "title": "" }, { "docid": "88722484fd5fa3fb6dcdbb14da73aadd", "score": "0.49375135", "text": "func (o *StorageNetAppBaseIpInterfaceAllOf) SetHomePort(v string) {\n\to.HomePort = &v\n}", "title": "" }, { "docid": "369011951af12c69f6150f09ac13f81a", "score": "0.49365473", "text": "func (o *Contact) HasBusinessHomePage() bool {\n\tif o != nil && o.BusinessHomePage != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f102442175284b53a7106d6e14b2c57e", "score": "0.49038526", "text": "func (o *ManagementInterfaceAllOf) GetHostNameOk() (*string, bool) {\n\tif o == nil || o.HostName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.HostName, true\n}", "title": "" }, { "docid": "8e076c7569abd9adaf42c8084503fb2f", "score": "0.4903141", "text": "func (o *AppApplicationDataData) GetApplicationTotalNodesOk() (*string, bool) {\n\tif o == nil || o.ApplicationTotalNodes == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ApplicationTotalNodes, true\n}", "title": "" }, { "docid": "5fadbd8e4be99987f5a2c249045b2195", "score": "0.48957413", "text": "func (o *NetInterfaceInfoType) SetHomePort(newValue string) *NetInterfaceInfoType {\n\to.HomePortPtr = &newValue\n\treturn o\n}", "title": "" }, { "docid": "266e51e41440f888909df48a32296f37", "score": "0.48922786", "text": "func TestHomeDir(t *testing.T) {\n\n\tassert := assert.New(t)\n\thomeDir := client.HomeDir()\n\tfmt.Printf(\"Retrieving %s\\n\", homeDir)\n\tassert.True(homeDir == os.Getenv(\"USERPROFILE\") || homeDir == os.Getenv(\"HOME\"))\n}", "title": "" }, { "docid": "1ec4de54dbc3024c449be248264494f0", "score": "0.48813257", "text": "func (o *KubernetesNodeAllOf) GetNodeInfoOk() (*KubernetesNodeInfo, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeInfo.Get(), o.NodeInfo.IsSet()\n}", "title": "" }, { "docid": "1704fbcb93eabbd9095cf5fc9bbf9190", "score": "0.4876722", "text": "func (o *ClientGateway) GetPublicIpOk() (*string, bool) {\n\tif o == nil || o.PublicIp == nil {\n\t\treturn nil, false\n\t}\n\treturn o.PublicIp, true\n}", "title": "" }, { "docid": "a9a4effadbfa316617817d38dfc0e4ac", "score": "0.48643196", "text": "func (e *EngineConfig) GetCustomHome() bool {\n\treturn e.JSON.CustomHome\n}", "title": "" }, { "docid": "afc51cc10970498257c6d1c6f2fe6ad8", "score": "0.48606184", "text": "func Home() (string, error) {\n\tif isNT {\n\t\treturn HomeNT()\n\t}\n\treturn HomePosix()\n}", "title": "" }, { "docid": "d8320558bf935c77086275e3e9a6b799", "score": "0.48546124", "text": "func (o *DnsViewAddInput) GetServerHostaddrOk() (*string, bool) {\n\tif o == nil || o.ServerHostaddr == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ServerHostaddr, true\n}", "title": "" }, { "docid": "9012ca9b4d5f973261b5caab6a6e6961", "score": "0.48544312", "text": "func getHomeTree(home helmpath.Home) []string {\n\treturn []string{\n\t\thome.String(),\n\t\thome.Repository(),\n\t\thome.Cache(),\n\t\thome.LocalRepository(),\n\t\thome.Plugins(),\n\t\thome.Starters(),\n\t\thome.Archive(),\n\t}\n}", "title": "" }, { "docid": "7f626983d6ab9be4522a54f02ce57df8", "score": "0.48528153", "text": "func (o *HeadNodeNotFound) IsSuccess() bool {\n\treturn false\n}", "title": "" }, { "docid": "96fd184956efb5ae29e32a653574c13e", "score": "0.48423165", "text": "func (o *DatacenterMember) GetNodeIdOk() (*int32, bool) {\n\tif o == nil || o.NodeId == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeId, true\n}", "title": "" }, { "docid": "fdbbd6489650d67ac18b2177e6e527de", "score": "0.48378608", "text": "func (o *NiaapiHardwareEolAllOf) GetHeadlineOk() (*string, bool) {\n\tif o == nil || o.Headline == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Headline, true\n}", "title": "" }, { "docid": "0e3564dbed29dd72eceda3edc3833b42", "score": "0.48288894", "text": "func (o *MicrosoftGraphIosHomeScreenFolder) GetPagesOk() ([]MicrosoftGraphIosHomeScreenFolderPage, bool) {\n\tif o == nil || o.Pages == nil {\n\t\tvar ret []MicrosoftGraphIosHomeScreenFolderPage\n\t\treturn ret, false\n\t}\n\treturn *o.Pages, true\n}", "title": "" }, { "docid": "54a63e2e21df42ad2b3347a4d18d96cb", "score": "0.48196474", "text": "func (self *Node) IsLeaf() bool {\n\treturn len(self.idx) == 0\n}", "title": "" }, { "docid": "3d97bb5e205794aa056ee97557a30aff", "score": "0.48098025", "text": "func HomeOptExists(opts []*Opt) bool {\n\treturn Exists(opts, HomeOptKey)\n}", "title": "" }, { "docid": "0e82de42374327fd28c3a609424dc29f", "score": "0.48069093", "text": "func (o *NodeOwnerCertificateRequest) GetPublicKeyOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.PublicKey, true\n}", "title": "" }, { "docid": "3e441763c14ab030a547417561618bfe", "score": "0.48060814", "text": "func (o *JsonDiskConfig) GetRoothashOffsetOk() (*int32, bool) {\n\tif o == nil || o.RoothashOffset == nil {\n\t\treturn nil, false\n\t}\n\treturn o.RoothashOffset, true\n}", "title": "" }, { "docid": "16a622493046c402a73560c1e053149d", "score": "0.48060745", "text": "func (o *StorageNetAppAggregate) GetNodeNameOk() (*string, bool) {\n\tif o == nil || o.NodeName == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeName, true\n}", "title": "" }, { "docid": "5bb71080591936f9e5addfaf691c40f0", "score": "0.48030216", "text": "func (o *NiatelemetryNetworkInfoAllOf) GetHostnameOk() (*string, bool) {\n\tif o == nil || o.Hostname == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Hostname, true\n}", "title": "" }, { "docid": "0fd56b65421db917e7041306749a3593", "score": "0.47970638", "text": "func (o *DatacenterMember) GetNodeIpOk() (*string, bool) {\n\tif o == nil || o.NodeIp == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeIp, true\n}", "title": "" }, { "docid": "6cf359576748332f32b37bc924ebe9f7", "score": "0.4781824", "text": "func (o *NiatelemetryNetworkInfoAllOf) HasStandbyNode() bool {\n\tif o != nil && o.StandbyNode.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a415205af542d6549c930a0d33be284c", "score": "0.47806826", "text": "func (o *NetworkIPInterfacesGetParams) SetLocationHomeNodeUUID(locationHomeNodeUUID *string) {\n\to.LocationHomeNodeUUID = locationHomeNodeUUID\n}", "title": "" }, { "docid": "4ba1ed73411b84148802a33b83cfcb31", "score": "0.47627696", "text": "func (o *KubernetesNodeAllOf) GetNodeAddressesOk() ([]KubernetesNodeAddress, bool) {\n\tif o == nil || o.NodeAddresses == nil {\n\t\treturn nil, false\n\t}\n\treturn o.NodeAddresses, true\n}", "title": "" }, { "docid": "037d373ba4d4fc219594d0500212cff2", "score": "0.47604367", "text": "func (o *HyperflexBaseCluster) GetComputeNodeCountOk() (*int64, bool) {\n\tif o == nil || o.ComputeNodeCount == nil {\n\t\treturn nil, false\n\t}\n\treturn o.ComputeNodeCount, true\n}", "title": "" }, { "docid": "7e5b70b70a8dd9857bea77b7a95d034a", "score": "0.47497797", "text": "func (n *MerkleNode) IsLeaf() bool {\n\treturn n.Left == nil && n.Right == nil\n}", "title": "" } ]
1f4264d4f4c04dac603e08e511752186
loopCalmly is the body of a service loop with panic protection and error reporting
[ { "docid": "344e1356956390f007c10b5fbd2c61ef", "score": "0.62746906", "text": "func loopCalmly(l *Lifecycle, f Manageable, name string) (err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = PanicError{r, debug.Stack()}\n\t\t}\n\t\truntime.Gosched() // break up panic hotloops\n\t}()\n\terr = f(l)\n\treturn\n}", "title": "" } ]
[ { "docid": "0c21bf6954ff049ad6d419e668aab1db", "score": "0.6184131", "text": "func (a *Agent) Loop(ctx context.Context) error {\n\tfor {\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 := a.Tick(ctx); err != nil {\n\t\t\tif e, ok := err.(*goa.ServiceError); ok && e.ErrorName() == \"record_not_found\" {\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t} else if err != nil {\n\t\t\t\tlog.Println(\"ERROR:\", err)\n\t\t\t\ttime.Sleep(time.Second)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bfd971805a2d76462eb02fff91452c7e", "score": "0.5599609", "text": "func (e *endpoint) dispatchLoop(inboundDispatcher linkDispatcher) *tcpip.Error {\n\tfor {\n\t\tcont, err := inboundDispatcher.dispatch()\n\t\tif err != nil || !cont {\n\t\t\tif e.closed != nil {\n\t\t\t\t// TODO: disconnect\n\t\t\t\te.closed(err)\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2859206321178da8a4c4782ef8c63874", "score": "0.55939305", "text": "func (LGTMHandler) EachLoop() error { return nil }", "title": "" }, { "docid": "92c81c7a852cd5b3a0f9f5b6c7a7bd92", "score": "0.55215806", "text": "func (c *Loop) LoopStart(sidekick ldk.Sidekick) error {\n\tc.logger.Info(\"loopStart called\")\n\tc.ctx, c.cancel = context.WithCancel(context.Background())\n\tc.sidekick = sidekick\n\n\tgo func() {\n\t\terr := c.sidekick.Whisper().List(c.ctx, &ldk.WhisperContentList{\n\t\t\tLabel: \"MCMG Location\",\n\t\t\tMarkdown: \"\",\n\t\t\tElements: map[string]ldk.WhisperContentListElement{\n\t\t\t\t\"topMessage\": &ldk.WhisperContentListElementMessage{\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleNone,\n\t\t\t\t\tHeader: \"Hello World, I am a subitle\",\n\t\t\t\t\tBody: \"This is what body copy looks like. Just a bit, don’t overdo it!\",\n\t\t\t\t\tAlign: ldk.WhisperContentListElementAlignLeft,\n\t\t\t\t\tOrder: 0,\n\t\t\t\t},\n\t\t\t\t\"successMessage\": &ldk.WhisperContentListElementMessage{\n\t\t\t\t\tAlign: ldk.WhisperContentListElementAlignCenter,\n\t\t\t\t\tHeader: \"This is an alert message!\",\n\t\t\t\t\tBody: \"It should be highlighted green.\",\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleSuccess,\n\t\t\t\t\tOrder: 1,\n\t\t\t\t},\n\t\t\t\t\"sectionDivider\": &ldk.WhisperContentListElementDivider{\n\t\t\t\t\tOrder: 2,\n\t\t\t\t},\n\t\t\t\t\"sectionTitle\": &ldk.WhisperContentListElementMessage{\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleNone,\n\t\t\t\t\tHeader: \"Let’s set the table\",\n\t\t\t\t\tAlign: ldk.WhisperContentListElementAlignCenter,\n\t\t\t\t\tOrder: 3,\n\t\t\t\t},\n\t\t\t\t\"name\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tLabel: \"Name\",\n\t\t\t\t\tOrder: 4,\n\t\t\t\t\tValue: \"David Simon MD\",\n\t\t\t\t},\n\t\t\t\t\"shoeSize\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tLabel: \"Shoe Size\",\n\t\t\t\t\tOrder: 5,\n\t\t\t\t\tValue: \"38\",\n\t\t\t\t},\n\t\t\t\t\"birthDate\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleWarning,\n\t\t\t\t\tLabel: \"Birth Date\",\n\t\t\t\t\tOrder: 6,\n\t\t\t\t\tValue: \"Feb 30th, 1999\",\n\t\t\t\t},\n\t\t\t\t\"favoriteColor\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"FavoriteColor\",\n\t\t\t\t\tOrder: 7,\n\t\t\t\t\tValue: \"Greige\",\n\t\t\t\t},\n\t\t\t\t\"favoriteAnimal\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Dogs or Cats\",\n\t\t\t\t\tOrder: 8,\n\t\t\t\t\tValue: \"Bats\",\n\t\t\t\t},\n\t\t\t\t\"streetName\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Street Name\",\n\t\t\t\t\tOrder: 9,\n\t\t\t\t\tValue: \"Main Street\",\n\t\t\t\t},\n\t\t\t\t\"zipCode\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Zip Code\",\n\t\t\t\t\tOrder: 10,\n\t\t\t\t\tValue: \"10000\",\n\t\t\t\t},\n\t\t\t\t\"city\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"City\",\n\t\t\t\t\tOrder: 11,\n\t\t\t\t\tValue: \"Townsville\",\n\t\t\t\t},\n\t\t\t\t\"phone\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Phone\",\n\t\t\t\t\tOrder: 12,\n\t\t\t\t\tValue: \"123-456-7890\",\n\t\t\t\t},\n\t\t\t\t\"favoriteCondiment\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleWarning,\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Favorite Condiment\",\n\t\t\t\t\tOrder: 13,\n\t\t\t\t\tValue: \"Pizza\",\n\t\t\t\t},\n\t\t\t\t\"100MeterDashTime\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"100m Dash Time\",\n\t\t\t\t\tOrder: 14,\n\t\t\t\t\tValue: \"4 minutes\",\n\t\t\t\t},\n\t\t\t\t\"nickname\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Nickname\",\n\t\t\t\t\tOrder: 15,\n\t\t\t\t\tValue: \"Old Greg\",\n\t\t\t\t},\n\t\t\t\t\"notes\": &ldk.WhisperContentListElementPair{\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tLabel: \"Notes\",\n\t\t\t\t\tOrder: 16,\n\t\t\t\t\tValue: \"Lorem ipsum sit amet dolor why does this always feel like a decree by the ancient Romans? It’s just filler text.\",\n\t\t\t\t},\n\t\t\t\t\"failureMessage\": &ldk.WhisperContentListElementMessage{\n\t\t\t\t\tAlign: ldk.WhisperContentListElementAlignCenter,\n\t\t\t\t\tBody: \"It should be highlighted red.\",\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tHeader: \"This is an alert message!\",\n\t\t\t\t\tOrder: 17,\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleError,\n\t\t\t\t},\n\t\t\t\t\"link\": &ldk.WhisperContentListElementLink{\n\t\t\t\t\tAlign: ldk.WhisperContentListElementAlignCenter,\n\t\t\t\t\tExtra: true,\n\t\t\t\t\tHref: \"https://isitchristmas.com/\",\n\t\t\t\t\tOrder: 18,\n\t\t\t\t\tStyle: ldk.WhisperContentListElementStyleNone,\n\t\t\t\t\tText: \"IsItChristmas.com\",\n\t\t\t\t},\n\t\t\t},\n\t\t})\n\t\tif err != nil {\n\t\t\tc.logger.Error(\"failed to emit whisper\", \"error\", err)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "cd996f92388c3c075061c4c35c056cdc", "score": "0.5500843", "text": "func (c *Client) Loop() (prop interface{}, err error) {\n\treturn c.GetProperty(\"loop\")\n}", "title": "" }, { "docid": "90c8fe44c47e7dcffeb5fd8e9852df73", "score": "0.53786445", "text": "func (a *Agent) gatherLoop(\n\tctx context.Context,\n\tacc pip.Accumulator,\n\tinput *models.RunningInput,\n) {\n\n}", "title": "" }, { "docid": "521aba48885c7fe2b3a4c4ab84249469", "score": "0.5366039", "text": "func (c *client) loop() {\n\tfor op := range c.sendErr {\n\t\top()\n\t}\n}", "title": "" }, { "docid": "521aba48885c7fe2b3a4c4ab84249469", "score": "0.5366039", "text": "func (c *client) loop() {\n\tfor op := range c.sendErr {\n\t\top()\n\t}\n}", "title": "" }, { "docid": "bfbdfbf7fd036debb86ee9a8aac8a287", "score": "0.53628755", "text": "func RenderLoop(dry *Dry, screen *ui.Screen) {\n\tif ok, _ := dry.Ok(); !ok {\n\t\treturn\n\t}\n\n\tkeyboardQueue, done := ui.EventChannel()\n\ttimestampQueue := time.NewTicker(1 * time.Second)\n\n\tviewClosed := make(chan struct{}, 1)\n\trenderChan := make(chan struct{})\n\n\tkeyboardQueueForView := make(chan termbox.Event)\n\tdryOutputChan := dry.OuputChannel()\n\tstatusBar := ui.NewStatusBar(0, screen.Width)\n\n\tdefer timestampQueue.Stop()\n\tdefer close(done)\n\tdefer close(keyboardQueueForView)\n\tdefer close(viewClosed)\n\tdefer close(renderChan)\n\n\t//renders dry on message\n\tgo func() {\n\t\tfor {\n\t\t\t_, stillOpen := <-renderChan\n\t\t\tif stillOpen {\n\t\t\t\tscreen.Clear()\n\t\t\t\tRender(dry, screen, statusBar)\n\t\t\t} else {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\trenderChan <- struct{}{}\n\n\t//tracks if the main loop has the focus (and responds to events),\n\t//or if events have to be delegated.\n\t//creation belongs outside the loop\n\tfocus := &focusTracker{&sync.Mutex{}, true}\n\n\tgo func(focus *focusTracker) {\n\t\tfor {\n\t\t\tdryMessage, ok := <-dryOutputChan\n\t\t\tif ok {\n\t\t\t\tif focus.hasFocus() {\n\t\t\t\t\tstatusBar.StatusMessage(dryMessage, 10*time.Second)\n\t\t\t\t\tif dry.Changed() {\n\t\t\t\t\t\trenderChan <- struct{}{}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatusBar.Render()\n\t\t\t\t\t}\n\t\t\t\t\tscreen.Flush()\n\t\t\t\t} else {\n\t\t\t\t\t//stop the status bar until the focus is retrieved\n\t\t\t\t\tstatusBar.Stop()\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}(focus)\n\n\t//loop handles input and timer events until a closing event happens\nloop:\n\tfor {\n\t\t//Used for refresh-forcing events happening outside dry\n\t\tvar refresh = false\n\t\tselect {\n\t\tcase <-timestampQueue.C:\n\t\t\tif focus.hasFocus() {\n\t\t\t\ttimestamp := time.Now().Format(`15:04:05`)\n\t\t\t\tscreen.RenderLine(0, 0, `<right><white>`+timestamp+`</></right>`)\n\t\t\t\tscreen.Flush()\n\t\t\t}\n\t\tcase <-viewClosed:\n\t\t\tfocus.set(true)\n\t\t\tdry.ShowMainView()\n\t\t\trefresh = true\n\t\tcase event := <-keyboardQueue:\n\t\t\tswitch event.Type {\n\t\t\tcase termbox.EventKey:\n\t\t\t\tif event.Key == termbox.KeyCtrlC { //Ctrl+C breaks the loop (and exits dry) no matter what\n\t\t\t\t\tbreak loop\n\t\t\t\t}\n\t\t\t\tif focus.hasFocus() {\n\t\t\t\t\tif event.Ch == 'q' || event.Ch == 'Q' {\n\t\t\t\t\t\tbreak loop\n\t\t\t\t\t} else {\n\t\t\t\t\t\thandler := eventHandlerFactory(dry, screen, keyboardQueueForView, viewClosed)\n\t\t\t\t\t\tif handler != nil {\n\t\t\t\t\t\t\tr, f := handler.handle(event)\n\t\t\t\t\t\t\trefresh = r\n\t\t\t\t\t\t\tfocus.set(f)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tlog.Panic(\"There is no event handler\")\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\t//Whoever has the focus, handles the event\n\t\t\t\t\tkeyboardQueueForView <- event\n\t\t\t\t}\n\t\t\tcase termbox.EventResize:\n\t\t\t\tscreen.Resize()\n\t\t\t\trefresh = true\n\t\t\t}\n\t\t}\n\t\tif focus.hasFocus() && refresh {\n\t\t\trenderChan <- struct{}{}\n\t\t}\n\t}\n\n\tlog.Debug(\"something broke the loop. Time to die\")\n}", "title": "" }, { "docid": "66d3238d5ccba6c0dd7822be6e8dbc67", "score": "0.5334219", "text": "func RunLoop(\n\tctx context.Context,\n\twatchFn WatchServiceInstanceFunc,\n\tupdateFn UpdateServiceInstanceFunc,\n\tgetServiceClassFn refs.ServiceClassGetterFunc,\n\tgetServiceBrokerFn refs.ServiceBrokerGetterFunc,\n\tlifecycler framework.Lifecycler,\n) error {\n\t// TODO: We should watch ALL namespaces; this is temporary.\n\t// See https://github.com/deis/steward-framework/issues/29\n\twatcher, err := watchFn(\"default\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tch := watcher.ResultChan()\n\tdefer watcher.Stop()\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ErrCancelled\n\t\tcase evt, open := <-ch:\n\t\t\tif !open {\n\t\t\t\twatcher, err = watchFn(\"default\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tlogger.Errorf(\"service instance loop watch channel was closed\")\n\t\t\t\t\treturn ErrWatchClosed\n\t\t\t\t}\n\t\t\t\tch = watcher.ResultChan()\n\t\t\t}\n\t\t\tlogger.Debugf(\"service instance loop received event\")\n\t\t\tswitch evt.Type {\n\t\t\tcase watch.Added:\n\t\t\t\tif err := handleAddServiceInstance(\n\t\t\t\t\tctx,\n\t\t\t\t\tlifecycler,\n\t\t\t\t\tupdateFn,\n\t\t\t\t\tgetServiceClassFn,\n\t\t\t\t\tgetServiceBrokerFn,\n\t\t\t\t\tevt,\n\t\t\t\t); err != nil {\n\t\t\t\t\t// TODO: try the handler again.\n\t\t\t\t\t// See https://github.com/deis/steward-framework/issues/26\n\t\t\t\t\tlogger.Errorf(\"add service instance event handler failed (%s)\", err)\n\t\t\t\t}\n\t\t\tcase watch.Deleted:\n\t\t\t\tif err := handleDeleteServiceInstance(\n\t\t\t\t\tctx,\n\t\t\t\t\tlifecycler,\n\t\t\t\t\tgetServiceClassFn,\n\t\t\t\t\tgetServiceBrokerFn,\n\t\t\t\t\tevt,\n\t\t\t\t); err != nil {\n\t\t\t\t\t// TODO: try the handler again.\n\t\t\t\t\t// See https://github.com/deis/steward-framework/issues/26\n\t\t\t\t\tlogger.Errorf(\"delete service instance event handler failed (%s)\", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0ec3bdd82c50f24ed057e8c02b5e52e6", "score": "0.528358", "text": "func (t *MyServer) HelloFromInfitineLoop(context.Context, *gw.StringMessage) (*gw.StringMessage, error){\n\n\tsum := 1\n\tfor sum < 1000 {\n\t\tsum =1\n\t}\n\n\tv := gw.StringMessage{\n\t\tValue : \"Hello from infinite loop\",\n\t}\n\treturn &v , nil\n}", "title": "" }, { "docid": "3ba8e6d88f4eff176e3f1288416bc44d", "score": "0.5235353", "text": "func (a action) loop() error {\n\tvar (\n\t\tarbiter = a.Arbiter\n\t\tstart = time.Now()\n\t)\n\tif arbiter == nil {\n\t\tarbiter = DefaultArbiter\n\t}\n\n\tif a.First != nil {\n\t\terr := a.First()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tfor count := uint(1); ; count++ {\n\t\t// Perform action\n\t\terr := a.Run()\n\n\t\t// Collects the result of the try\n\t\ttry := Try{\n\t\t\tStart: start,\n\t\t\tCount: count,\n\t\t\tErr: err,\n\t\t}\n\n\t\t// Asks what to do now\n\t\tv, retryErr := arbiter(try)\n\n\t\t// Notify to interested parties\n\t\tif a.Notify != nil {\n\t\t\ta.Notify(try, v)\n\t\t}\n\n\t\tswitch v {\n\t\tcase verdict.Done:\n\t\t\t// Returns the error if no retry is wanted\n\t\t\tvar errLast error\n\t\t\tif a.Last != nil {\n\t\t\t\terrLast = a.Last()\n\t\t\t\tif errLast != nil {\n\t\t\t\t\treturn fail.ErrListError([]error{errLast, retryErr})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn retryErr\n\t\tcase verdict.Abort:\n\t\t\t// Abort wanted, returns an error explaining why\n\t\t\tvar errLast error\n\t\t\tif a.Last != nil {\n\t\t\t\terrLast = a.Last()\n\t\t\t\tif errLast != nil {\n\t\t\t\t\treturn fail.ErrListError([]error{errLast, retryErr})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn retryErr\n\t\tdefault:\n\t\t\t// Retry is wanted, so blocks the loop the amount of time needed\n\t\t\tif a.Officer != nil {\n\t\t\t\ta.Officer.Block(try)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ba5bab5eac4e411f9902c50a1bed3981", "score": "0.52092505", "text": "func (bc *basicController) loopForRestoreDeadStatus() {\n\t// Generate random timer duration\n\trd := func() time.Duration {\n\t\treturn longLoopInterval + time.Duration(rand.Int31n(shortInterval))*time.Second\n\t}\n\n\tdefer func() {\n\t\tlogger.Info(\"Status restoring loop is stopped\")\n\t\tbc.wg.Done()\n\t}()\n\n\t// Initialize the timer\n\ttm := time.NewTimer(shortInterval * time.Second)\n\tdefer tm.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-tm.C:\n\t\t\t// Reset timer\n\t\t\ttm.Reset(rd())\n\n\t\t\t// Retry the items in the list\n\t\t\tbc.retryLoop()\n\t\tcase <-bc.context.Done():\n\t\t\treturn // terminated\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e7f29b65dc93ca74600619d2571252da", "score": "0.51984483", "text": "func (e *serverEndpoint) dispatchLoop(d stack.NetworkDispatcher) {\n\tfor e.stopRequested.Load() == 0 {\n\t\tb := e.rx.receive()\n\t\tif b == nil {\n\t\t\te.rx.EnableNotification()\n\t\t\t// Now pull again to make sure we didn't receive any packets\n\t\t\t// while notifications were not enabled.\n\t\t\tfor {\n\t\t\t\tb = e.rx.receive()\n\t\t\t\tif b != nil {\n\t\t\t\t\t// Disable notifications as we only need to be notified when we are going\n\t\t\t\t\t// to block on eventFD. This should prevent the peer from needlessly\n\t\t\t\t\t// writing to eventFD when this end is already awake and processing\n\t\t\t\t\t// packets.\n\t\t\t\t\te.rx.DisableNotification()\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\te.rx.waitForPackets()\n\t\t\t}\n\t\t}\n\t\tpkt := stack.NewPacketBuffer(stack.PacketBufferOptions{\n\t\t\tPayload: buffer.MakeWithView(b),\n\t\t})\n\t\tif e.virtioNetHeaderRequired {\n\t\t\t_, ok := pkt.VirtioNetHeader().Consume(header.VirtioNetHeaderSize)\n\t\t\tif !ok {\n\t\t\t\tpkt.DecRef()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tvar proto tcpip.NetworkProtocolNumber\n\t\tif len(e.addr) != 0 {\n\t\t\tif !e.parseHeader(pkt) {\n\t\t\t\tpkt.DecRef()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tproto = header.Ethernet(pkt.LinkHeader().Slice()).Type()\n\t\t} else {\n\t\t\t// We don't get any indication of what the packet is, so try to guess\n\t\t\t// if it's an IPv4 or IPv6 packet.\n\t\t\t// IP version information is at the first octet, so pulling up 1 byte.\n\t\t\th, ok := pkt.Data().PullUp(1)\n\t\t\tif !ok {\n\t\t\t\tpkt.DecRef()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tswitch header.IPVersion(h) {\n\t\t\tcase header.IPv4Version:\n\t\t\t\tproto = header.IPv4ProtocolNumber\n\t\t\tcase header.IPv6Version:\n\t\t\t\tproto = header.IPv6ProtocolNumber\n\t\t\tdefault:\n\t\t\t\tpkt.DecRef()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\t// Send packet up the stack.\n\t\td.DeliverNetworkPacket(proto, pkt)\n\t\tpkt.DecRef()\n\t}\n\n\te.mu.Lock()\n\tdefer e.mu.Unlock()\n\n\t// Clean state.\n\te.tx.cleanup()\n\te.rx.cleanup()\n\n\te.completed.Done()\n}", "title": "" }, { "docid": "c009f366e367b2437fe66d8f50b29ecc", "score": "0.5163124", "text": "func (m *Broadcaster) loop() {\n\t// Deliberately not catching crashes here. Yes, bring down the process if there's a\n\t// bug in watch.Broadcaster.\n\tfor event := range m.incoming {\n\t\tif event.Type == internalRunFunctionMarker {\n\t\t\tevent.Object.(functionFakeRuntimeObject)()\n\t\t\tcontinue\n\t\t}\n\t\tm.distribute(event)\n\t}\n\tm.closeAll()\n\tm.distributing.Done()\n}", "title": "" }, { "docid": "1f8729c762a1d1ce46acec4adc8762e9", "score": "0.5152124", "text": "func (m *Monitor) Loop(sig chan os.Signal, msg chan string) {\n\tvar ipList []string\n\tvar sleepyTime time.Duration\n\tsleepyTime = time.Duration(m.interval) * time.Millisecond * 1000\n\tfor !m.stop {\n\t\t// Lets get the ip list\n\t\tlist, err := m.balancer.GetIPList()\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"Error getting ip list: %s\", err)\n\t\t}\n\t\t// Do we have new list\n\t\tif !testEq(ipList, list) {\n\t\t\tlog.Infoln(\"IP List updated, writing new configuration\")\n\t\t\tipList = list\n\t\t\tm.configWriter.WriteConfig(ipList)\n\t\t\tretVal, err := m.dbusConn.ReloadOrRestartUnit(\"nginx.service\", \"fail\", nil)\n\t\t\tif err != nil {\n\t\t\t\tlog.Errorf(\"Error restarting or reloading the nginx unit: retval: %d: %s\", retVal, err)\n\t\t\t}\n\t\t\tmsg <- \"Updated and reloaded configuration\"\n\t\t} else {\n\t\t\tlog.Debugln(\"No changes detected\")\n\t\t}\n\t\t// Check for signals from outside\n\t\tselect {\n\t\tcase s := <-sig:\n\t\t\tswitch s {\n\t\t\tcase syscall.SIGHUP:\n\t\t\t\tretVal, err := m.dbusConn.ReloadOrRestartUnit(\"nginx.service\", \"fail\", nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Errorf(\"Error restarting or reloading the nginx unit: retval: %d: %s\", retVal, err)\n\t\t\t\t}\n\t\t\t\tlog.Info(\"Reloaded nginx by signal\")\n\t\t\t\tmsg <- \"Reloaded configuration\"\n\t\t\t\tbreak\n\t\t\tcase os.Interrupt:\n\t\t\t\tlog.Info(\"Exiting by request\")\n\t\t\t\tm.stop = true\n\t\t\t\tmsg <- \"Exit\"\n\t\t\t}\n\t\tdefault:\n\t\t\tlog.Debugln(\"No signal\")\n\t\t}\n\t\tif m.stop {\n\t\t\t// Break immediately on signal\n\t\t\tbreak\n\t\t}\n\t\t// Wait for a bit\n\t\tlog.Debugf(\"Sleeping for %v seconds\", m.interval)\n\t\ttime.Sleep(sleepyTime)\n\t}\n}", "title": "" }, { "docid": "d7a7ac618ac6b0f70da8a9ca98fb038b", "score": "0.51311845", "text": "func NewLoop(logger *ldk.Logger) (*Loop, error) {\n\treturn &Loop{\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "04f91fc056cccd830f42bbfc4b61ea08", "score": "0.51289827", "text": "func (d *driver) applicationLoop() {\n\tfor ev := range d.pendingApp {\n\t\tev()\n\t}\n}", "title": "" }, { "docid": "0dd501be054be5c96fad02fbc5a82185", "score": "0.5105422", "text": "func (e *loopTestingT) FailNow() { panic(errLoopFailNow) }", "title": "" }, { "docid": "13ffd5fa8565d108cc04f55517168d03", "score": "0.51048774", "text": "func NewLoopContext(appName common.Name, appNamespace common.Namespace, log logr.Logger, scheme *runtime.Scheme, client sigs_client.Client) *LoopContext {\n\tthis := &LoopContext{\n\t\tappName: appName,\n\t\tappNamespace: appNamespace,\n\t\trequeue: false,\n\t\trequeueDelay: 0,\n\t}\n\tthis.log = log.WithValues(\"app\", appName.Str(), \"namespace\", appNamespace.Str())\n\n\tthis.client = client\n\tthis.scheme = scheme\n\n\tthis.resourceCache = resources.NewResourceCache()\n\n\tthis.envCache = env.NewEnvCache()\n\n\treturn this\n}", "title": "" }, { "docid": "9abd0d21a2669ba3008fbe7bcaf550ae", "score": "0.50998664", "text": "func (svc *Service) recvEventsLoop() {\n\tfor {\n\t\tvar (\n\t\t\tevent *orchestrator.MetricChangeEvent\n\t\t\terr error\n\t\t)\n\t\tevent, err = svc.metricEventStream.Recv()\n\n\t\tif errors.Is(err, io.EOF) {\n\t\t\tlog.Debugf(\"no more responses from orchestrator stream: EOF\")\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\tlog.Errorf(\"error receiving response from orchestrator stream: %v\", err)\n\t\t\tbreak\n\t\t}\n\n\t\tsvc.handleMetricEvent(event)\n\t}\n}", "title": "" }, { "docid": "fb3187cfa259214ef3f3b99437ea62cd", "score": "0.5097989", "text": "func (p *Printer) loopData(fn actOnContext) error {\n\tfor env, ctxs := range p.data {\n\t\tfor _, ctx := range ctxs {\n\t\t\tif err := fn(p.logger, env, ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7982e94ee5059fbd0a2c8b270b0a5e13", "score": "0.509418", "text": "func (s *StepRequest) Loop(times int) *StepRequest {\n\ts.step.Loops = times\n\treturn s\n}", "title": "" }, { "docid": "9f6e0e91dd2cf7f8d0f6a07e17e118bd", "score": "0.506637", "text": "func (a *Analog) Mainloop() {\n\tC.vrpn_Analog_Web_Mainloop(a.c)\n}", "title": "" }, { "docid": "231c5bc23fce945636d45af8d3f5e264", "score": "0.5065754", "text": "func (a *App) Loop() {\n\tif err := a.gui.MainLoop(); err != nil && err != gocui.ErrQuit {\n\t\tlog.Panicln(err)\n\t}\n}", "title": "" }, { "docid": "c445373d3935a77552ef92880de6313a", "score": "0.50632125", "text": "func (this *Client) Loop(timeout_ms int) error {\n\tif err := Error(C.mosquitto_loop((*C.struct_mosquitto)(this), C.int(timeout_ms), C.int(1))); err != MOSQ_ERR_SUCCESS {\n\t\treturn err\n\t} else {\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "37964808c046cc2adf97062f2cbc0807", "score": "0.5049005", "text": "func (c *Client) readLoop(ctx context.Context) error {\n\tc.debug.Print(\"starting readLoop\")\n\tdefer c.debug.Print(\"closing readLoop\")\n\n\tvar de decodedEvent\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t\t_ = c.conn.sock.SetReadDeadline(time.Now().Add(300 * time.Second))\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tcase de = <-c.conn.decode():\n\t\t\t}\n\n\t\t\tif de.err != nil {\n\t\t\t\treturn de.err\n\t\t\t}\n\n\t\t\t// Check if it's an echo-message.\n\t\t\tif !c.Config.disableTracking {\n\t\t\t\tde.event.Echo = (de.event.Command == PRIVMSG || de.event.Command == NOTICE) &&\n\t\t\t\t\tde.event.Source != nil && de.event.Source.ID() == c.GetID()\n\t\t\t}\n\n\t\t\tc.receive(de.event)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3bb4aae51a085b5f5a27640f191c8d94", "score": "0.50470084", "text": "func (r *XactPut) mainLoop(ticker *time.Ticker) {\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tif r.config.FastV(4, cos.SmoduleEC) {\n\t\t\t\tif s := fmt.Sprintf(\"%v\", r.Snap()); s != \"\" {\n\t\t\t\t\tnlog.Infoln(s)\n\t\t\t\t}\n\t\t\t}\n\t\tcase <-r.IdleTimer():\n\t\t\t// It's OK not to notify ecmanager, it'll just have stopped xctn in a map.\n\t\t\tr.stop()\n\t\t\treturn\n\t\tcase msg := <-r.controlCh:\n\t\t\tif msg.Action == ActEnableRequests {\n\t\t\t\tr.setEcRequestsEnabled()\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tdebug.Assert(msg.Action == ActClearRequests, msg.Action)\n\n\t\t\tr.setEcRequestsDisabled()\n\t\t\tr.stop()\n\t\t\treturn\n\t\tcase <-r.ChanAbort():\n\t\t\tr.stop()\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "48360023c564689ed52fa32aec97bdba", "score": "0.50456876", "text": "func (t *udp) readLoop(unhandled chan<- ReadPacket) {\n\tdefer t.conn.Close()\n\tif unhandled != nil {\n\t\tdefer close(unhandled)\n\t}\n\t// Discovery packets are defined to be no larger than 1280 bytes.\n\t// Packets larger than this size will be cut at the end and treated\n\t// as invalid because their hash won't match.\n\tbuf := make([]byte, 1280)\n\tfor {\n\t\tnbytes, from, err := t.conn.ReadFromUDP(buf)\n\t\tif netutil.IsTemporaryError(err) {\n\t\t\t// Ignore temporary read errors.\n\t\t\tlog.Debug(\"Temporary UDP read error\", \"err\", err)\n\t\t\tcontinue\n\t\t} else if err != nil {\n\t\t\t// Shut down the loop for permament errors.\n\t\t\tlog.Debug(\"UDP read error\", \"err\", err)\n\t\t\treturn\n\t\t}\n\t\tif t.handlePacket(from, buf[:nbytes]) != nil && unhandled != nil {\n\t\t\tselect {\n\t\t\tcase unhandled <- ReadPacket{buf[:nbytes], from}:\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2ef443f04501f7442f0765aefec5b134", "score": "0.5043173", "text": "func (dws *DWS) Loop(ctx context.Context) {\n\ttimer := time.NewTimer((DWSTime * 9) / 10)\n\tdefer func() {\n\t\ttimer.Stop()\n\t\tlog.Info(\"EXIT DWS LOOP\")\n\t}()\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase <-timer.C:\n\t\t\tdws.Send <- []byte(\"ping\")\n\t\t\ttimer.Reset((DWSTime * 9) / 10)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5557f1f2dda8a0d76f11d47808e0bf3c", "score": "0.50364286", "text": "func (p *PodAction) WatchLoop() error {\n\tstopc := make(chan struct{})\n\terrc := make(chan error)\n\tvar wg sync.WaitGroup\n\n\twg.Add(1)\n\tgo func() {\n\t\tgo p.podInformer.Run(stopc)\n\t\t<-stopc\n\t\twg.Done()\n\t}()\n\n\tterm := make(chan os.Signal)\n\tsignal.Notify(term, os.Interrupt, syscall.SIGTERM)\n\tselect {\n\tcase <-term:\n\t\tfmt.Fprintln(os.Stderr)\n\t\tfmt.Println(\"Received SIGTERM, exiting gracefully...\")\n\t\tclose(stopc)\n\t\twg.Wait()\n\tcase err := <-errc:\n\t\tfmt.Printf(\"Unexpected error received: %v\\n\", err)\n\t\tclose(stopc)\n\t\twg.Wait()\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "98daa31cfc3b732122027595e20fe506", "score": "0.5028355", "text": "func (i *downstreamICS) runRecvLoop(stream proto.AuthService_InventoryControlStreamClient) {\n\tfor {\n\t\toneOf, err := stream.Recv()\n\t\tif err != nil {\n\t\t\t// preserve EOF to help distinguish \"ok\" closure.\n\t\t\tif !errors.Is(err, io.EOF) {\n\t\t\t\terr = trace.Errorf(\"inventory control stream closed: %v\", trace.Wrap(err))\n\t\t\t}\n\t\t\ti.CloseWithError(err)\n\t\t\treturn\n\t\t}\n\n\t\tvar msg proto.DownstreamInventoryMessage\n\n\t\tswitch {\n\t\tcase oneOf.GetHello() != nil:\n\t\t\tmsg = *oneOf.GetHello()\n\t\tcase oneOf.GetPing() != nil:\n\t\t\tmsg = *oneOf.GetPing()\n\t\tcase oneOf.GetUpdateLabels() != nil:\n\t\t\tmsg = *oneOf.GetUpdateLabels()\n\t\tdefault:\n\t\t\t// TODO: log unknown message variants once we have a better story around\n\t\t\t// logging in api/* packages.\n\t\t\tcontinue\n\t\t}\n\n\t\tselect {\n\t\tcase i.recvC <- msg:\n\t\tcase <-i.Done():\n\t\t\t// stream closed by other goroutine\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9cfaaa43dbee1b87d0b1801cb7b4936e", "score": "0.5019368", "text": "func (gs *GenServerSys) GenProcLoop(args ...Term) (err error) {\n\n\tpid := gs.Self()\n\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\terr = fmt.Errorf(\"%v\", r)\n\n\t\t\ttrace := make([]byte, 4096)\n\t\t\tn := runtime.Stack(trace, false)\n\n\t\t\tfmt.Println(time.Now().Truncate(time.Microsecond), gs.Self(),\n\t\t\t\t\"crashed with reason:\", r, n, \"bytes stack:\",\n\t\t\t\tstring(trace[:n]))\n\n\t\t\tTraceCall(gs.Tracer(), gs.Self(), \"GenServerSysLoop crashed\", err)\n\t\t}\n\n\t\tgs.doTerminate(err.Error())\n\t}()\n\n\tsys := pid.GetSysChannel()\n\tusr := pid.GetUsrChannel()\n\n\tvar timeout <-chan time.Time\n\n\tif timeout, err = gs.doInit(args...); err != nil {\n\t\treturn\n\t}\n\n\tfor {\n\n\t\t//\n\t\t// check sys messages first\n\t\t//\n\t\tselect {\n\t\tcase m := <-sys:\n\t\t\tif err = gs.HandleSysMsg(m); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t}\n\n\t\tselect {\n\n\t\tcase m := <-sys:\n\t\t\tif err = gs.HandleSysMsg(m); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\tcase m := <-usr:\n\n\t\t\tswitch m := m.(type) {\n\n\t\t\tcase *SyncReq:\n\n\t\t\t\tif timeout, err = gs.doCall(m.Data, m.ReplyChan); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\tcase *AsyncReq:\n\n\t\t\t\tif timeout, err = gs.doCast(m.Data); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\tdefault:\n\n\t\t\t\tif timeout, err = gs.doInfo(m); err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t} // switch m.(type)\n\n\t\tcase <-timeout:\n\n\t\t\tif timeout, err = gs.doInfo(gsTimeout); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t} // select\n\t} // for\n}", "title": "" }, { "docid": "ea3bb3737ed306275cfc740abe693883", "score": "0.50092524", "text": "func recoverLoopFailNow() {\n\tswitch p := recover(); p {\n\tcase nil, errLoopFailNow:\n\t\t// Ignore nil (success) and our sentinel value.\n\t\treturn\n\tdefault:\n\t\t// Re-panic on any other value.\n\t\tpanic(p)\n\t}\n}", "title": "" }, { "docid": "22e227b8b3dd674d646d0e73ffedab78", "score": "0.50018907", "text": "func (c *Client) SetLoop(value interface{}) error {\n\treturn c.SetProperty(\"loop\", value)\n}", "title": "" }, { "docid": "d25c3f866bd7c0d2fbd073c65ada7986", "score": "0.498873", "text": "func loop(wg *sync.WaitGroup, dying *barrier.Barrier, options Options, events chan UpdateEvent) {\n\tclient, err := dockerConnect()\n\tif err != nil {\n\t\tdying.Fall()\n\t\tlog.Println(\"Connecting to Docker failed:\", err)\n\t\treturn\n\t}\n\n\twd, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tbaseName := path.Base(wd)\n\n\tvar i uint64\n\tgetName := func() string {\n\t\tn := atomic.AddUint64(&i, 1)\n\t\treturn fmt.Sprint(baseName, \"_\", n)\n\t}\n\n\tenv := makeEnv(options.env)\n\n\tvar liveMutex sync.Mutex\n\tvar live *Container\n\n\tlastEvent := <-events\n\n\tfor {\n\n\t\tc := NewContainer(client, getName(), wg)\n\t\tc.Args = options.containerArgs\n\t\tc.Env = env\n\n\t\t// Global exit should cause container exit\n\t\tdying.Forward(&c.Closing)\n\n\t\twg.Add(1)\n\t\tgo func(c *Container) {\n\t\t\tdefer wg.Done()\n\n\t\t\tgo func() {\n\t\t\t\tfor err := range c.Errors {\n\t\t\t\t\tlog.Println(\"BUG: Async container error:\", err)\n\t\t\t\t\t// TODO(pwaller): If this case is hit we might not want to\n\t\t\t\t\t// tear the container down really.\n\t\t\t\t\tc.Failed.Fall()\n\t\t\t\t}\n\t\t\t}()\n\n\t\t\tstatus, err := c.Run(lastEvent)\n\t\t\tif err != nil {\n\t\t\t\tswitch err := err.(type) {\n\t\t\t\tcase *docker.Error:\n\t\t\t\t\t// (name) Conflict\n\t\t\t\t\tif err.Status == 409 {\n\t\t\t\t\t\t// retry\n\t\t\t\t\t\tlog.Printf(\"Container with name %q exists, using a new name...\", c.Name)\n\t\t\t\t\t\tevents <- lastEvent\n\t\t\t\t\t\tc.Failed.Fall()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlog.Println(\"Container run failed:\", strings.TrimSpace(err.Error()))\n\t\t\t\tc.Failed.Fall()\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlog.Println(\"container\", c.Name, \"quit, exit status:\", status)\n\t\t}(c)\n\n\t\tgo func(c *Container) {\n\n\t\t\tlog.Println(\"Awaiting container fate:\", c.Name)\n\t\t\tselect {\n\t\t\tcase <-c.Failed.Barrier():\n\t\t\t\tlog.Println(\"Container failed before going live:\", c.Name)\n\t\t\t\tc.Closing.Fall()\n\t\t\t\treturn\n\t\t\tcase <-c.Superceded.Barrier():\n\t\t\t\tlog.Println(\"Container superceded before going live:\", c.Name)\n\t\t\t\tc.Closing.Fall()\n\t\t\t\treturn\n\t\t\tcase <-c.Closing.Barrier():\n\t\t\t\tlog.Println(\"Container closed before going live:\", c.Name)\n\t\t\t\treturn\n\n\t\t\tcase <-c.Ready.Barrier():\n\t\t\t}\n\n\t\t\tlog.Println(\"Container going live:\", c.Name)\n\n\t\t\tliveMutex.Lock()\n\t\t\tdefer liveMutex.Unlock()\n\t\t\tpreviousLive := live\n\n\t\t\t// Block main exit until the firewall rule has been placed\n\t\t\t// (and removed)\n\t\t\twg.Add(1)\n\t\t\tdefer wg.Done()\n\n\t\t\t// get the public port for an internal one\n\t\t\tgetMappedPort := func(p int) (int, bool) {\n\t\t\t\tfor _, m := range c.container.NetworkSettings.PortMappingAPI() {\n\t\t\t\t\tif int(m.PrivatePort) == p {\n\t\t\t\t\t\treturn int(m.PublicPort), true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn -1, false\n\t\t\t}\n\n\t\t\tremoval := []func(){}\n\n\t\t\tdefer func() {\n\t\t\t\t// Block main exit until firewall rule has been removed\n\t\t\t\twg.Add(1)\n\t\t\t\tgo func() {\n\t\t\t\t\tdefer wg.Done()\n\n\t\t\t\t\t<-c.Closing.Barrier()\n\t\t\t\t\tfor _, remove := range removal {\n\t\t\t\t\t\tremove()\n\t\t\t\t\t}\n\t\t\t\t}()\n\t\t\t}()\n\n\t\t\tfor internalPort, bindings := range options.portBindings {\n\t\t\t\tif mappedPort, ok := getMappedPort(internalPort.Int()); ok {\n\t\t\t\t\tfor _, binding := range bindings {\n\t\t\t\t\t\tvar public int\n\t\t\t\t\t\t_, err := fmt.Sscan(binding.HostPort, &public)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t// If no public port specified, use same port as internal port\n\t\t\t\t\t\t\tpublic = internalPort.Int()\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tipAddress := c.container.NetworkSettings.IPAddress\n\t\t\t\t\t\tremove, err := ConfigureRedirect(public, mappedPort, ipAddress)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\t// Firewall rule didn't get applied.\n\t\t\t\t\t\t\tc.err(fmt.Errorf(\"Firewall rule application failed: %q (public: %v, private: %v)\", err, public, internalPort))\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tremoval = append(removal, remove)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tc.err(fmt.Errorf(\"Docker image not exposing port %v!\", internalPort))\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlive = c\n\t\t\tif previousLive != nil {\n\t\t\t\tpreviousLive.Closing.Fall()\n\t\t\t}\n\n\t\t}(c)\n\n\t\tlastEvent = <-events\n\n\t\tc.Superceded.Fall()\n\n\t\tlog.Println(\"Signalled!\")\n\t}\n}", "title": "" }, { "docid": "a08faba339a60d3293a355c1b8024bd6", "score": "0.49785066", "text": "func (s *Session) readLoop(readTimeout time.Duration) {\n\tfor {\n\t\tif readTimeout > 0 {\n\t\t\tif err := s.conn.SetReadDeadline(time.Now().Add(readTimeout)); err != nil {\n\t\t\t\tLog.Tracef(\"set read deadline err: %s\", err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tentry, err := s.packer.Unpack(s.conn)\n\t\tif err != nil {\n\t\t\tLog.Tracef(\"unpack incoming message err: %s\", err)\n\t\t\tif e, ok := err.(Error); ok && e.Fatal() {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif !s.safelyPushReqQueue(entry) {\n\t\t\tbreak\n\t\t}\n\t}\n\tLog.Tracef(\"read loop exit\")\n\ts.Close()\n}", "title": "" }, { "docid": "f6cb2f99fa8237175a335ea2fddec5d2", "score": "0.496095", "text": "func main() {\n\t// Let me introduce myself - I'm Remindabot\n\tstartMsg := fmt.Sprintf(\"Starting service [%s] build=%s PID=%d OS=%s\", AppId, BuildTime, os.Getpid(), runtime.GOOS)\n\tlogger.Println(startMsg)\n\n\t// configure delegates most of the work to envconfig\n\tconfig := configure()\n\n\t// Kafka event support\n\tkClient := topkapi.NewClientWithId(AppId)\n\tdefer kClient.Close()\n\tkClient.Enable(config.KafkaSupport) // suppress events\n\tif _, _, err := kClient.PublishEvent(kClient.NewEvent(\"runjob:\"+AppId, startMsg), \"system\"); err != nil {\n\t\tlogger.Fatalf(\"Error publish event to %s: %v\", \"system\", err)\n\t}\n\n\treminderResponse, err := fetchReminders(config.ApiUrl, config.ApiToken, config.ApiTokenHeader)\n\t// for whatsoever reason this might fail the first time with timeout, so we retry once\n\t// err=Get ...: context deadline exceeded (Client.Timeout exceeded while awaiting headers)\n\tif err != nil {\n\t\tlogger.Printf(\"First fetch did not succeed: %s, trying one more time\", err)\n\t\treminderResponse, err = fetchReminders(config.ApiUrl, config.ApiToken, config.ApiTokenHeader)\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"2nd Attempt also failed: %s, giving up\", err)\n\t\t}\n\t}\n\n\tdefer reminderResponse.Close()\n\t// Parse JSON body into a list of notes\n\tvar notes []Note // var notes []interface{} is now a concrete struct\n\terr = json.NewDecoder(reminderResponse).Decode(&notes)\n\tif err != nil {\n\t\tlogger.Fatalf(\"Error get %s: %v\", config.ApiUrl, err)\n\t}\n\n\t// we only send out a reminderMail if we have at least one reminder to notify\n\tif len(notes) < 1 {\n\t\tlogger.Printf(\"WARNING: No notes due today - we should call it a day and won't sent out any reminderMail\")\n\t\treturn\n\t}\n\n\t// with i,n n would just be a copy, use index to access the actual list item https://yourbasic.org/golang/gotcha-change-value-range/\n\tfor i := range notes {\n\t\tif strings.Contains(notes[i].UserName, \" \") {\n\t\t\tnames := strings.Split(notes[i].UserName, \" \")\n\t\t\tif len(names[1]) >= 1 {\n\t\t\t\tnotes[i].UserShortName = fmt.Sprintf(\"%s %s.\", names[0], names[1][0:1])\n\t\t\t} else {\n\t\t\t\tnotes[i].UserShortName = names[0]\n\t\t\t}\n\t\t} else {\n\t\t\tnotes[i].UserShortName = notes[i].UserName\n\t\t}\n\t\tmyDate, dateErr := time.Parse(\"2006-01-02\", notes[i].DueDate)\n\t\tif dateErr != nil {\n\t\t\tfmt.Printf(\"WARN: Cannot parse date %s: %v \", notes[i].DueDate, dateErr)\n\t\t} else {\n\t\t\tnotes[i].DueDateHuman = humanize.Time(myDate)\n\t\t}\n\t}\n\n\t// Pull recent events from topic to create a digest\n\tactions := make(map[string]int)\n\tkClient.Config.ConsumerTimeout = 5 * time.Second\n\tconsumeEvents(kClient, actions)\n\tlogger.Printf(\"Received actions %v\", actions)\n\n\t// Prepare and send reminderMail\n\ttestFrom := \"remindabot@\" + os.Getenv(\"CERTBOT_DOMAIN_NAME\")\n\ttestTo := strings.Replace(os.Getenv(\"CERTBOT_MAIL\"), \"@\", \"+ses@\", 1)\n\tvar buf bytes.Buffer\n\ttmpl, _ := template.New(\"\").Parse(mailTemplate())\n\tnoteMailBody := &NoteMailBody{\n\t\tNotes: notes,\n\t\tEventStats: actions,\n\t\tImageUrl: config.ImageUrl,\n\t\tFooter: mailFooter(),\n\t}\n\n\t// render the mail body\n\tif err := tmpl.Execute(&buf, &noteMailBody); err != nil {\n\t\tlogger.Fatal(err)\n\t}\n\n\t// Compose mail structure and send it\n\treminderMail := &Mail{\n\t\tFrom: mail.Address{Address: testFrom, Name: \"TiMaFe Remindabot\"},\n\t\tTo: mail.Address{Address: testTo},\n\t\tSubject: mailSubject(),\n\t\tBody: buf.String(),\n\t}\n\tsendMail(reminderMail, config)\n\n\tmsg := fmt.Sprintf(\"Sent mail with %d due notes\", len(notes))\n\tif _, _, err := kClient.PublishEvent(kClient.NewEvent(\"create:mail\", msg), \"system\"); err != nil {\n\t\tlogger.Fatalf(\"Error publish event to %s: %v\", \"system\", err)\n\t}\n}", "title": "" }, { "docid": "1b4c3fd14abbe5c83d9e2839d2553759", "score": "0.49596077", "text": "func (c *Client) messageLoop() {\n\tfor {\n\t\tselect {\n\t\tcase <-c.closedCh:\n\t\t\treturn\n\t\tcase reply := <-c.Transport.Receive():\n\t\t\tc.addToCache(append(reply.Answer, reply.Extra...))\n\t\t\tc.signal.raise()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "967f016bfd3f38b7bb22787fbc2f76a6", "score": "0.4956486", "text": "func (r *Requester) readLoop() {\n\tbuf := make([]byte, MaxDataGramSize)\n\tfor {\n\t\tcount, raddr, err := r.unicastConn.ReadFrom(buf)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error reading from MulticastGroup: %v\", err)\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"error\": err,\n\t\t\t}).Error(\"Error reading from udp socket, closing\")\n\t\t\tbreak\n\t\t}\n\t\tpayload := make([]byte, count)\n\t\tcopy(payload, buf)\n\n\t\tr.ReceiveChan <- Response{\n\t\t\tClientAddr: raddr,\n\t\t\tPayload: payload,\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d542bc627d900df060ad742390c5dcca", "score": "0.49529257", "text": "func (bc *basicController) retryLoop() {\n\t// Get connection\n\tconn := bc.pool.Get()\n\tdefer func() {\n\t\t// Return redis connection\n\t\tif err := conn.Close(); err != nil {\n\t\t\tlogger.Errorf(\"Failed to close redis connection: %v : %s\", err, \"retry loop: lcm\")\n\t\t}\n\t}()\n\n\t// Check the list\n\tbc.retryList.Iterate(func(ele interface{}) bool {\n\t\tif change, ok := ele.(job.SimpleStatusChange); ok {\n\t\t\terr := retry(conn, bc.namespace, change)\n\t\t\tif err != nil {\n\t\t\t\t// Log the error\n\t\t\t\tlogger.Errorf(\"Failed to retry the status update action: %v : %s\", err, \"retry loop: lcm\")\n\t\t\t}\n\n\t\t\tif err == nil || errs.IsStatusMismatchError(err) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t})\n}", "title": "" }, { "docid": "1188cbb2083a3a9b505aaa6159551eaf", "score": "0.4950385", "text": "func (es *EventSystem) eventLoop() {\n\tvar (\n\t\terr error\n\t\tcancelPendingTxsSubs, cancelLogsSubs, cancelPendingLogsSubs, cancelHeaderSubs context.CancelFunc\n\t)\n\n\t// Subscribe events\n\tes.txsSub, cancelPendingTxsSubs, err = es.SubscribePendingTxs()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to subscribe pending txs: %w\", err))\n\t}\n\n\tdefer cancelPendingTxsSubs()\n\n\tes.logsSub, cancelLogsSubs, err = es.SubscribeLogs(filters.FilterCriteria{})\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to subscribe logs: %w\", err))\n\t}\n\n\tdefer cancelLogsSubs()\n\n\tes.pendingLogsSub, cancelPendingLogsSubs, err = es.subscribePendingLogs(filters.FilterCriteria{})\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to subscribe pending logs: %w\", err))\n\t}\n\n\tdefer cancelPendingLogsSubs()\n\n\tes.chainSub, cancelHeaderSubs, err = es.SubscribeNewHeads()\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"failed to subscribe headers: %w\", err))\n\t}\n\n\tdefer cancelHeaderSubs()\n\n\t// Ensure all subscriptions get cleaned up\n\tdefer func() {\n\t\tes.txsSub.Unsubscribe(es)\n\t\tes.logsSub.Unsubscribe(es)\n\t\tes.pendingLogsSub.Unsubscribe(es)\n\t\tes.chainSub.Unsubscribe(es)\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase txEvent := <-es.txsSub.eventCh:\n\t\t\tes.handleTxsEvent(txEvent)\n\t\tcase headerEv := <-es.chainSub.eventCh:\n\t\t\tes.handleChainEvent(headerEv)\n\t\tcase logsEv := <-es.logsSub.eventCh:\n\t\t\tes.handleLogs(logsEv)\n\t\tcase logsEv := <-es.pendingLogsSub.eventCh:\n\t\t\tes.handleLogs(logsEv)\n\n\t\tcase f := <-es.install:\n\t\t\tif f.typ == filters.MinedAndPendingLogsSubscription {\n\t\t\t\t// the type are logs and pending logs subscriptions\n\t\t\t\tes.index[filters.LogsSubscription][f.id] = f\n\t\t\t\tes.index[filters.PendingLogsSubscription][f.id] = f\n\t\t\t} else {\n\t\t\t\tes.index[f.typ][f.id] = f\n\t\t\t}\n\t\t\tclose(f.installed)\n\n\t\tcase f := <-es.uninstall:\n\t\t\tif f.typ == filters.MinedAndPendingLogsSubscription {\n\t\t\t\t// the type are logs and pending logs subscriptions\n\t\t\t\tdelete(es.index[filters.LogsSubscription], f.id)\n\t\t\t\tdelete(es.index[filters.PendingLogsSubscription], f.id)\n\t\t\t} else {\n\t\t\t\tdelete(es.index[f.typ], f.id)\n\t\t\t}\n\t\t\tclose(f.err)\n\t\t\t// System stopped\n\t\tcase <-es.txsSub.Err():\n\t\t\treturn\n\t\tcase <-es.logsSub.Err():\n\t\t\treturn\n\t\tcase <-es.pendingLogsSub.Err():\n\t\t\treturn\n\t\tcase <-es.chainSub.Err():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "74f74adb2e3248f00b51acdd49fa85f4", "score": "0.49490395", "text": "func (i *Indexer) dealLoop() {\n\tfor {\n\t\tselect {\n\t\tcase <-i.shutdownCh:\n\t\t\tlog.Println(\"Indexer stopped\")\n\t\t\treturn\n\t\tcase batch := <-i.dealCh:\n\t\t\terr := i.checkDeals(batch)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"Error sending to price server: %v\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a79ccee29d57157994af477924417348", "score": "0.494075", "text": "func (handler *Handler) DomainLoop(domain *godns.Domain, panicChan chan<- godns.Domain) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Printf(\"Recovered in %v: %v\\n\", err, debug.Stack())\n\t\t\tpanicChan <- *domain\n\t\t}\n\t}()\n\n\tvar lastIP string\n\tfor {\n\t\tcurrentIP, err := godns.GetCurrentIP(handler.Configuration)\n\t\tif err != nil {\n\t\t\tlog.Println(\"Error in GetCurrentIP:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tlog.Println(\"Current IP is:\", currentIP)\n\t\t//check against locally cached IP, if no change, skip update\n\t\tif currentIP == lastIP {\n\t\t\tlog.Printf(\"IP is the same as cached one. Skip update.\\n\")\n\t\t} else {\n\t\t\tlastIP = currentIP\n\n\t\t\tlog.Println(\"Checking IP for domain\", domain.DomainName)\n\t\t\tzoneID := handler.getZone(domain.DomainName)\n\t\t\tif zoneID != \"\" {\n\t\t\t\trecords := handler.getDNSRecords(zoneID)\n\n\t\t\t\t// update records\n\t\t\t\tfor _, rec := range records {\n\t\t\t\t\tif !recordTracked(domain, &rec) {\n\t\t\t\t\t\tlog.Println(\"Skiping record:\", rec.Name)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif rec.IP != currentIP {\n\t\t\t\t\t\tlog.Printf(\"IP mismatch: Current(%+v) vs Cloudflare(%+v)\\r\\n\", currentIP, rec.IP)\n\t\t\t\t\t\thandler.updateRecord(rec, currentIP)\n\n\t\t\t\t\t\t// Send mail notification if notify is enabled\n\t\t\t\t\t\tif handler.Configuration.Notify.Enabled {\n\t\t\t\t\t\t\tlog.Print(\"Sending notification to:\", handler.Configuration.Notify.SendTo)\n\t\t\t\t\t\t\tif err := godns.SendNotify(handler.Configuration, rec.Name, currentIP); err != nil {\n\t\t\t\t\t\t\t\tlog.Println(\"Failed to send notification\")\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tlog.Printf(\"Record OK: %+v - %+v\\r\\n\", rec.Name, rec.IP)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Println(\"Failed to find zone for domain:\", domain.DomainName)\n\t\t\t}\n\t\t}\n\t\t// Sleep with interval\n\t\tlog.Printf(\"Going to sleep, will start next checking in %d seconds...\\r\\n\", handler.Configuration.Interval)\n\t\ttime.Sleep(time.Second * time.Duration(handler.Configuration.Interval))\n\t}\n}", "title": "" }, { "docid": "6092a54bac3458ebf5b2e86fa644a231", "score": "0.4917006", "text": "func Loop(c *RootCommand, quit func()) error {\n\n\tc.dbg(\"loop start\")\n\nDance:\n\tfor {\n\t\tc.dbg(\"readline wait\")\n\n\t\ttext, err := c.Ctx.Readline()\n\t\tif err == io.EOF {\n\t\t\t// Quit without error on Ctrl^D\n\t\t\tc.dbg(\"error %s\", err)\n\t\t}\n\t\tif err != nil {\n\t\t\tc.dbg(\"error %s\", err)\n\t\t\tif quit != nil {\n\t\t\t\tquit()\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tc.dbg(\"text %q\", text)\n\t\terr = c.Dispatch(text)\n\t\tif err == io.EOF {\n\t\t\tbreak Dance\n\t\t}\n\t\tif err != nil {\n\t\t\tc.dbg(\"dispatch error %s\\n\", err)\n\t\t}\n\t}\n\tc.dbg(\"loop exit\")\n\n\treturn nil\n}", "title": "" }, { "docid": "e4a177f5455a9a79a54b7d6100427781", "score": "0.49119028", "text": "func Run(ctx context.Context, opts *options.Options) error {\n\tlogs.InitLogs()\n\tdefer logs.FlushLogs()\n\n\tconfig, err := controllerruntime.GetConfig()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\thookManager, err := controllerruntime.NewManager(config, controllerruntime.Options{\n\t\tScheme: gclient.NewSchema(),\n\t\tHost: opts.BindAddress,\n\t\tPort: opts.SecurePort,\n\t\tCertDir: opts.CertDir,\n\t\tLeaderElection: false,\n\t\tLeaderElectionID: \"webhook.karmada.io\",\n\t})\n\tif err != nil {\n\t\tklog.Errorf(\"failed to build webhook server: %v\", err)\n\t\treturn err\n\t}\n\n\tklog.Info(\"registering webhooks to the webhook server\")\n\thookServer := hookManager.GetWebhookServer()\n\thookServer.Register(\"/validate-cluster\", &webhook.Admission{Handler: &cluster.ValidatingAdmission{}})\n\thookServer.Register(\"/mutate-propagationpolicy\", &webhook.Admission{Handler: &propagationpolicy.MutatingAdmission{}})\n\thookServer.Register(\"/validate-propagationpolicy\", &webhook.Admission{Handler: &propagationpolicy.ValidatingAdmission{}})\n\thookServer.Register(\"/mutate-clusterpropagationpolicy\", &webhook.Admission{Handler: &clusterpropagationpolicy.MutatingAdmission{}})\n\thookServer.Register(\"/validate-clusterpropagationpolicy\", &webhook.Admission{Handler: &clusterpropagationpolicy.ValidatingAdmission{}})\n\thookServer.Register(\"/mutate-overridepolicy\", &webhook.Admission{Handler: &overridepolicy.MutatingAdmission{}})\n\thookServer.Register(\"/mutate-work\", &webhook.Admission{Handler: &work.MutatingAdmission{}})\n\thookServer.WebhookMux.Handle(\"/readyz/\", http.StripPrefix(\"/readyz/\", &healthz.Handler{}))\n\n\t// blocks until the stop channel is closed.\n\tif err := hookManager.Start(ctx); err != nil {\n\t\tklog.Errorf(\"webhook server exits unexpectedly: %v\", err)\n\t\treturn err\n\t}\n\n\t// never reach here\n\treturn nil\n}", "title": "" }, { "docid": "d0008e0142242b06721b8d4fe5db738b", "score": "0.49036944", "text": "func startEventLoop(ctx context.Context, errHandler func(err error), c *clientset.Clientset, syncer v1.DiscoverySyncer) error {\n\tmeshDiscoveryEmitter := v1.NewDiscoverySimpleEmitter(wrapper.AggregatedWatchFromClients(\n\t\twrapper.ClientWatchOpts{\n\t\t\tBaseClient: c.Input.Pod.BaseClient(),\n\t\t},\n\t\twrapper.ClientWatchOpts{\n\t\t\tBaseClient: c.Input.Install.BaseClient(),\n\t\t},\n\t\t// only need to watch for the appmesh configmap\n\t\twrapper.ClientWatchOpts{\n\t\t\tBaseClient: c.Input.ConfigMap.BaseClient(),\n\t\t\tNamespace: appmesh.AwsConfigMapNamespace,\n\t\t\tResourceName: appmesh.AwsConfigMapName,\n\t\t},\n\t))\n\n\tmeshDiscoveryEventLoop := v1.NewDiscoverySimpleEventLoop(meshDiscoveryEmitter, syncer)\n\n\tmeshDiscoveryErrs, err := meshDiscoveryEventLoop.Run(ctx)\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 err := <-meshDiscoveryErrs:\n\t\t\t\terrHandler(err)\n\t\t\tcase <-ctx.Done():\n\t\t\t}\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "4dd20d3d16422b6f20134d9ad94eafc7", "score": "0.4897939", "text": "func CallLoop(f func(), restartAfter time.Duration, handlers ...PanicHandler) {\n\tfor {\n\t\tval, stack := Call(f)\n\t\tif val == nil {\n\t\t\treturn\n\t\t}\n\t\tfor _, h := range handlers {\n\t\t\th(val, stack)\n\t\t}\n\t\ttime.Sleep(restartAfter)\n\t}\n}", "title": "" }, { "docid": "17396ba81b475c2b5ebb30b6ff6882df", "score": "0.48965138", "text": "func (w *Session) checkLoopCondition(msg *dipper.Message) bool {\n\tswitch {\n\tcase w.workflow.WhileMatch != nil:\n\t\tenvData := w.buildEnvData(msg)\n\t\tscenario := dipper.Interpolate(w.workflow.WhileMatch, envData)\n\n\t\treturn dipper.CompareAll(w.ctx, scenario)\n\tcase w.workflow.UntilMatch != nil:\n\t\tenvData := w.buildEnvData(msg)\n\t\tscenario := dipper.Interpolate(w.workflow.UntilMatch, envData)\n\t\tif scenario != nil && reflect.ValueOf(scenario).Len() > 0 {\n\t\t\treturn !dipper.CompareAll(w.ctx, scenario)\n\t\t}\n\n\t\treturn true\n\tcase len(w.workflow.While) > 0:\n\t\tenvData := w.buildEnvData(msg)\n\t\tfor _, c := range w.workflow.While {\n\t\t\tc = dipper.InterpolateStr(c, envData)\n\t\t\tif !isTruthy(c) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\tcase len(w.workflow.WhileAny) > 0:\n\t\tenvData := w.buildEnvData(msg)\n\t\tfor _, c := range w.workflow.WhileAny {\n\t\t\tc = dipper.InterpolateStr(c, envData)\n\t\t\tif isTruthy(c) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\tcase len(w.workflow.Until) > 0:\n\t\tenvData := w.buildEnvData(msg)\n\t\tfor _, c := range w.workflow.Until {\n\t\t\tc = dipper.InterpolateStr(c, envData)\n\t\t\tif isTruthy(c) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\n\t\treturn true\n\tcase len(w.workflow.UntilAll) > 0:\n\t\tenvData := w.buildEnvData(msg)\n\t\tfor _, c := range w.workflow.UntilAll {\n\t\t\tc = dipper.InterpolateStr(c, envData)\n\t\t\tif !isTruthy(c) {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\n\t\treturn false\n\t}\n\n\treturn true // not a loop\n}", "title": "" }, { "docid": "1bd83e2d1caf59ec981c429be2de1b7b", "score": "0.4887854", "text": "func ForeverLoop() {\n\tfmt.Printf(\"\\n****Running flowcontrol.ForForever(), go infinte for loop\")\n\tfor {\n\t}\n}", "title": "" }, { "docid": "6cbd1ed629b5e8af0dac544a70563dac", "score": "0.48876834", "text": "func Loop(f func() error, blocking bool) error {\n\treturn StartCtx(func(ctx Context) error {\n\n\t\trunning := true\n\n\t\tgo func() {\n\t\t\tfor evt := range ctx.Env().Events {\n\t\t\t\tif evt == EventShutdown {\n\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\tfor running {\n\t\t\terr := f()\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}, blocking)\n}", "title": "" }, { "docid": "24b42dcef11888a1addf37ad43d45831", "score": "0.4882214", "text": "func (c *Config) OracleFeederLoop(goctx context.Context, cancel context.CancelFunc, clientCtx client.Context) error {\n\tvar (\n\t\ttxEventsChan, blEventsChan <-chan ctypes.ResultEvent\n\t\ttxCancel, blCancel context.CancelFunc\n\t)\n\n\tcoord := &Coordinator{clientCtx: clientCtx}\n\n\tdefer cancel()\n\tkey, err := clientCtx.Keyring.Key(config.SigningKey)\n\tif err != nil || key == nil {\n\t\treturn fmt.Errorf(\"configured key %s not found in keyring\", config.SigningKey)\n\t}\n\n\tcoord.delegatorAddr = key.GetAddress()\n\n\tcoord.validatorAddr, err = GetValFromDel(clientCtx, coord.delegatorAddr)\n\tif err != nil || coord.validatorAddr == nil {\n\t\treturn fmt.Errorf(\"configured address %s not delegated to a validator: %w\", coord.delegatorAddr, err)\n\t}\n\n\ttimeout := 5 * time.Second\n\n\trpcClient, err := c.NewRPCClient(timeout)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := rpcClient.Start(); err != nil {\n\t\treturn err\n\t}\n\n\t// subscribe to tx events\n\ttxEventsChan, txCancel, err = c.Subscribe(goctx, rpcClient, txEvents)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer txCancel()\n\n\t// subscribe to block events\n\tblEventsChan, blCancel, err = c.Subscribe(goctx, rpcClient, blEvents)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer blCancel()\n\n\tfor {\n\t\tselect {\n\t\tcase txEvent := <-txEventsChan:\n\t\t\tif err = coord.handleTx(txEvent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase blockEvent := <-blEventsChan:\n\t\t\tif err = coord.handleBlock(blockEvent); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase <-goctx.Done():\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6a7124b6a569bd644d918e608378261c", "score": "0.48818815", "text": "func LoopTest(myPanel Panel, myCageManager CageManager) {\n\tRequestGenerator(myPanel)\n\tAssignElevator(myCageManager)\n\tMoveElevators(myCageManager)\n\tCleanUpQueue()\n}", "title": "" }, { "docid": "5e1778c6ab9f04a0329def17e4c55456", "score": "0.48799375", "text": "func (conn_p *Connector) readloop() {\n\tfor {\n\t\tvar cmdr []byte\n\t\t_, addr_p, err := conn_p.conn.ReadFromUDP(cmdr)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error in reading: %s\\n\", err)\n\t\t\tbreak\n\t\t}\n\t\tvar packet pkt.Packet = pkt.Packet{}\n\t\terr = json.Unmarshal(cmdr, &packet)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error in unmarshalling: %s\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tvar env pkt.Envelope = pkt.Envelope{Pkt: packet, Addr: *addr_p}\n\t\t// BUG: This might make the application panic if DeInit on Connector is called while\n\t\t// receive channel is being written to with a new packet.\n\t\tconn_p.rch <- env\n\t}\n}", "title": "" }, { "docid": "902280f01ea87d74de4c3225ae5952e6", "score": "0.4875648", "text": "func (agent *Agent) TimerLoop() {\n\tticker := time.NewTicker(10 * time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-ticker.C:\n\t\t\tlog.Info(\"agent IOLoop for every 10s\")\n\t\t\tagent.CheckReady()\n\t\t\tagent.ConsumeReady()\n\t\t\tagent.ConsumeRunning()\n\t\tcase <-agent.QuitChan:\n\t\t\tgoto quit\n\t\t}\n\t}\nquit:\n\tticker.Stop()\n\tlog.Warning(\"receive quit chan, quit TimerLoop\")\n}", "title": "" }, { "docid": "6c6ecdbdd172b6c53fc89f54e77838a2", "score": "0.4872758", "text": "func (t *transport) reportLoop(reportInterval time.Duration, log SomeLogger) {\n\tdefer t.shutdownWg.Done()\n\n\treportTicker := time.NewTicker(reportInterval)\n\tdefer reportTicker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-t.shutdown:\n\t\t\treturn\n\t\tcase <-reportTicker.C:\n\t\t\tlostPeriod := atomic.SwapInt64(&t.lostPacketsPeriod, 0)\n\t\t\tif lostPeriod > 0 {\n\t\t\t\tlog.Printf(\"[STATSD] %d packets lost (overflow)\", lostPeriod)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "149138fdd5d92ee3d813e6f6dcad53b5", "score": "0.48704642", "text": "func (c *Loop) LoopStop() error {\n\tc.logger.Info(\"loopStop called\")\n\tc.cancel()\n\n\treturn nil\n}", "title": "" }, { "docid": "0d343d587b3c62bff394bcbcb2bb634d", "score": "0.48652", "text": "func MainLoop(ctx context.Context){\n\n\tH.SignPost(&ctx,\"MainLoop start\").\n\t\tPartOf(H.NR(\"main\",\"function\"))\n\n\t// Adaptive loop to update context by sensor/input activity\n\t// Context changes as a result of new environment detected\n\n // ...other stuff happens\n\tmk := H.SignPost(&ctx,\"Beginning of test code\").\n\t\tNote(\"Start process\").\n\t\tAttributes(H.NR(\"cellibrium\",\"go package\"),H.N(\"example code\"))\n\t// ...\n\tmk.Note(\"look up a name\")\n\n\t// ...\n\tH.SignPost(&ctx,\"code signpost X\"). // what you intended\n\tIntent(\"open file X\").\n\t\tReliesOn(H.NR(\"/etc/passed\",\"file\")).\n\t\tDetermines(H.NR(\"123.456.789.123\",\"dns lookup\")).\n\t\tFailedBecause(\"xxx\").\n\t\tPartOf(H.NR(\"main\",\"coroutine\"))\n\n\t// Pass ctx down for logging in lower levels\n\tgo Test1(ctx)\n\t\n\tScanSystem(ctx)\n\n\tH.SignPost(&ctx,\"Commence testing\")\n\n\tConceptConeGeneralizations(ctx)\n\n\tDataPipelineExample(ctx)\n\t\n\t// End loop\n\tH.SignPost(&ctx,\"The end!\")\n\n\tH.SignPost(&ctx,\"Show the signposts\")\n\tShowMap()\n\n\ttime.Sleep(3 * time.Second)\n}", "title": "" }, { "docid": "df36a521d9f5d94590729532f81868af", "score": "0.4863085", "text": "func CreateApplicationTickerLoop(ctx context.Context, config *configs.EdgeCloudConfig) {\n\tduration := time.Duration(config.Portal.ApplicationCheckerInterval) * time.Second\n\tcheckTicker := time.NewTimer(duration)\n\tdefer checkTicker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\tlogger.Infof(\"CreateApplicationTickerLoop was terminated\")\n\t\t\treturn\n\t\tcase <-checkTicker.C:\n\t\t\tApplicationTicker(config)\n\t\t\tcheckTicker.Reset(duration)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1347921503bc8a117486273d257da923", "score": "0.48576114", "text": "func (p *K8sMgr) loop(timed time.Duration, getlbfn func(link string) net.IP) {\n\tvar err error\n\tfor {\n\t\tselect {\n\t\tcase <-p.stopch:\n\t\t\tklog.Info(\"receive stop signal, exit!\")\n\t\t\treturn\n\t\tcase <-time.NewTimer(timed).C:\n\t\t\tp.mu.RLock()\n\t\t\tfor link, val := range p.lbinfo {\n\t\t\t\tif !val.existip {\n\t\t\t\t\tval.lbip = getlbfn(link)\n\t\t\t\t}\n\t\t\t\tif val.lbip == nil {\n\t\t\t\t\tklog.Infof(\"load balance ip not found, link:%v\", val.link)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\thashid := p.hashinfo(val)\n\t\t\t\tif val.hashid == hashid {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tklog.V(4).Infof(\"start sync k8s service, link:%v\", val.link)\n\n\t\t\t\terr = p.updateService(val.lbip, val)\n\t\t\t\tif err != nil {\n\t\t\t\t\tklog.Infof(\"update service failed:%v\", err)\n\t\t\t\t}\n\t\t\t\tif val.isdelete == true {\n\t\t\t\t\tdelete(p.lbinfo, link)\n\t\t\t\t}\n\t\t\t\tval.hashid = hashid\n\t\t\t\tklog.V(4).Infof(\"sync k8s service done, delete:%v, link:%v\", val.isdelete, val.link)\n\t\t\t}\n\t\t\tp.mu.RUnlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e7bb0008fb13a8d4621f463b94661d0a", "score": "0.4854724", "text": "func (c *Channel) handleLoop(wg *sync.WaitGroup) {\n\tvar (\n\t\thash uint32\n\t)\n\tctx := c.ctx\n\tif c.connID == 0 {\n\t\thash = hashCode(c.Name())\n\t} else {\n\t\thash = hashCode(c.connID)\n\t}\n\n\tdefer func() {\n\t\tif p := recover(); p != nil {\n\t\t\tc.logger.Warnf(\"#%d (%s) handle panic err %s\", c.connID, c.conn.RemoteAddr(), p)\n\t\t\tprintStack()\n\t\t}\n\t\twg.Done()\n\t\tc.Close()\n\t}()\n\n\tfor {\n\t\tselect {\n\t\tcase <-c.ctx.Done(): // connectin closed\n\t\t\treturn\n\t\tcase <-c.parentCtx.Done(): // server closed\n\t\t\treturn\n\t\tcase msgHandler := <-c.handlerCh:\n\t\t\tvar handleFunc func()\n\t\t\tcode := hash\n\t\t\tmsg, handler, handlerType := msgHandler.message, msgHandler.handler, msgHandler.handlerType\n\t\t\tif handler != nil {\n\t\t\t\thandleFunc = func() { handler(NewContextWithMessage(ctx, msg), c.realChannel); c.wg.Done() }\n\t\t\t} else {\n\t\t\t\tif c.opts.onMessage == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\thandleFunc = func() { c.opts.onMessage(msg, c.realChannel); c.wg.Done() }\n\t\t\t\thandlerType = c.opts.onMessagePoolType\n\t\t\t}\n\t\t\tif handlerType == HandlePooledRandom {\n\t\t\t\tcode = 0\n\t\t\t}\n\t\t\tc.wg.Add(1)\n\t\t\tswitch handlerType {\n\t\t\tcase HandlePoolNewRoutine:\n\t\t\t\tgo func() {\n\t\t\t\t\tdefer func() {\n\t\t\t\t\t\tif err := recover(); err != nil {\n\t\t\t\t\t\t\tc.logger.Warnf(\"#%d (%s) handle panic err %s\", c.connID, c.conn.RemoteAddr(), err)\n\t\t\t\t\t\t\tprintStack()\n\t\t\t\t\t\t}\n\t\t\t\t\t}()\n\t\t\t\t\thandleFunc()\n\t\t\t\t}()\n\t\t\tcase HandlePooledRandom, HandlePooledStick:\n\t\t\t\terr := WorkerPoolInstance().Put(code, handleFunc)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.wg.Done()\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\tdefault:\n\t\t\t\thandleFunc()\n\t\t\t}\n\n\t\tcase ctx := <-c.timerCh:\n\t\t\tif ctx == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\ton := ctx.Value().(*OnTimeOut)\n\t\t\thandleFunc := func() { on.Callback(time.Now(), c.realChannel); c.wg.Done() }\n\t\t\tc.wg.Add(1)\n\t\t\tif on.AskForWorkers {\n\t\t\t\terr := WorkerPoolInstance().Put(hash, handleFunc)\n\t\t\t\tif err != nil {\n\t\t\t\t\tc.wg.Done()\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\thandleFunc()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9d90ca8fd59202585b4a5030bfc2b701", "score": "0.484409", "text": "func Loop(ctx context.Context) {\n\tvar closeSignal chan os.Signal\n\tm := meta.Get(ctx)\n\tlog := logger.Get(ctx).GetLogger(m.Name, nil)\n\n\texit := make(chan struct{})\n\tcloseSignal = make(chan os.Signal, 1)\n\tsignal.Notify(closeSignal, os.Interrupt, syscall.SIGTERM)\n\n\tgo func() {\n\t\t<-closeSignal\n\t\t_ = Shutdown(ctx)\n\t\tlog.Info().Msg(\"Exit program\")\n\t\tclose(exit)\n\t}()\n\n\t// Exit app if chan is closed\n\t<-exit\n}", "title": "" }, { "docid": "8c266d0370dd31884b1c8df29e869b03", "score": "0.4841578", "text": "func (i *upstreamICS) runRecvLoop(stream proto.AuthService_InventoryControlStreamServer) {\n\tfor {\n\t\toneOf, err := stream.Recv()\n\t\tif err != nil {\n\t\t\t// preserve eof errors\n\t\t\tif !errors.Is(err, io.EOF) {\n\t\t\t\terr = trace.Errorf(\"inventory control stream recv failed: %v\", trace.Wrap(err))\n\t\t\t}\n\t\t\ti.CloseWithError(err)\n\t\t\treturn\n\t\t}\n\n\t\tvar msg proto.UpstreamInventoryMessage\n\n\t\tswitch {\n\t\tcase oneOf.GetHello() != nil:\n\t\t\tmsg = *oneOf.GetHello()\n\t\tcase oneOf.GetHeartbeat() != nil:\n\t\t\tmsg = *oneOf.GetHeartbeat()\n\t\tcase oneOf.GetPong() != nil:\n\t\t\tmsg = *oneOf.GetPong()\n\t\tcase oneOf.GetAgentMetadata() != nil:\n\t\t\tmsg = *oneOf.GetAgentMetadata()\n\t\tdefault:\n\t\t\t// TODO: log unknown message variants once we have a better story around\n\t\t\t// logging in api/* packages.\n\t\t\tcontinue\n\t\t}\n\n\t\tselect {\n\t\tcase i.recvC <- msg:\n\t\tcase <-i.Done():\n\t\t\t// stream closed by other goroutine\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "647bd3c5528c0753ba7baad3f6fd6b01", "score": "0.4839034", "text": "func Start(contextContext context.Context, config *Config) ([]*logical.Loop, func(), error) {\n\tscriptConfig, err := logical.ProvideUserScriptConfig(config)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tloader, err := script.ProvideLoader(scriptConfig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tbaseConfig, err := logical.ProvideBaseConfig(config, loader)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstagingPool, cleanup, err := logical.ProvideStagingPool(contextContext, baseConfig)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstagingSchema, err := logical.ProvideStagingDB(baseConfig)\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\tconfigs, cleanup2, err := applycfg.ProvideConfigs(contextContext, stagingPool, stagingSchema)\n\tif err != nil {\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\ttargetSchema := logical.ProvideUserScriptTarget(baseConfig)\n\ttargetPool, cleanup3, err := logical.ProvideTargetPool(contextContext, baseConfig)\n\tif err != nil {\n\t\tcleanup2()\n\t\tcleanup()\n\t\treturn nil, nil, err\n\t}\n\twatchers, cleanup4 := schemawatch.ProvideFactory(targetPool)\n\tuserScript, err := script.ProvideUserScript(contextContext, configs, loader, stagingPool, targetSchema, watchers)\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\tclient, cleanup5, err := ProvideFirestoreClient(contextContext, config, userScript)\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\tappliers, cleanup6 := apply.ProvideFactory(configs, targetPool, watchers)\n\tmemoMemo, err := memo.ProvideMemo(contextContext, stagingPool, stagingSchema)\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\tchecker := version.ProvideChecker(stagingPool, memoMemo)\n\tfactory, cleanup7, err := logical.ProvideFactory(contextContext, appliers, config, memoMemo, stagingPool, targetPool, userScript, watchers, checker)\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\ttombstones, err := ProvideTombstones(contextContext, config, client, factory, userScript)\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\tv, cleanup8, err := ProvideLoops(contextContext, config, client, factory, memoMemo, stagingPool, tombstones, userScript)\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\treturn v, func() {\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": "abb232b26b93040d0b1797a5f9e02b54", "score": "0.48360887", "text": "func (e *EventSocket) readLoop() {\n\n\tfor e.readOne() {\n\n\t}\n\te.Disconnect()\n\t//return\n}", "title": "" }, { "docid": "3157281cfd2f48d94b9452247da00a44", "score": "0.4825006", "text": "func (p *Probe) echoLoop(ctx context.Context, msgChan chan *echoMsg) {\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\tcase msg := <-msgChan:\n\t\t\tn, err := p.conn.WriteToUDP(msg.buf, msg.addr)\n\t\t\tif err == io.EOF { // socket closed. exit the loop.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\tp.l.Errorf(\"Error writing echo response to %v: %v\", msg.addr, err)\n\t\t\t} else if n < msg.bufLen {\n\t\t\t\tp.l.Warningf(\"Reply truncated: sent %d out of %d bytes to %v.\", n, msg.bufLen, msg.addr)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "dd8def72783e35cf2c293951e724f0d5", "score": "0.48179707", "text": "func (cl *Client) Loop() {\n\trequest := make(chan []byte)\n\n\t// Ping timer\n\tpingTicker := time.NewTicker(time.Second * otClientPingInterval)\n\tdefer pingTicker.Stop()\n\n\t// Reader routine\n\treadstop := make(chan struct{})\n\tdefer func() { close(readstop) }()\n\tgo func() {\n\t\tdefer func() { close(request) }()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-readstop:\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t\t_, msg, err := cl.conn.ReadMessage()\n\t\t\t\tif err != nil {\n\t\t\t\t\t// Closed\n\t\t\t\t\tif websocket.IsCloseError(err, websocket.CloseNormalClosure, websocket.CloseGoingAway, websocket.CloseNoStatusReceived, websocket.CloseAbnormalClosure) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tlog.Printf(\"OT client error: read error: %v\\n\", err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\trequest <- msg\n\t\t\t}\n\t\t}\n\n\t}()\n\n\tsendSvResponse := func(s2cmsg otWSMessage) bool {\n\t\tresraw, err := convertToMsg(s2cmsg.Event, s2cmsg.Data)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"OT client error: response error: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\terr = cl.conn.SetWriteDeadline(time.Now().Add(time.Second * 10))\n\t\tif err != nil {\n\t\t\tlog.Printf(\"OT client error: websockest error: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\terr = cl.conn.WriteMessage(websocket.TextMessage, resraw)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"OT client error: websocket error: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\terr = cl.conn.SetWriteDeadline(time.Time{})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"OT client error: websockest error: %v\\n\", err)\n\t\t\treturn false\n\t\t}\n\t\treturn true\n\t}\n\nmain:\n\tfor {\n\t\tselect {\n\t\tcase s2cmsg, ok := <-cl.sv2cl:\n\t\t\t// Server response is high priority so check the first\n\t\t\tif !ok {\n\t\t\t\t// Closed by server and notification is not needed.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !sendSvResponse(s2cmsg) {\n\t\t\t\tbreak main\n\t\t\t}\n\t\tdefault:\n\t\t}\n\t\t// If no server response, check all response including server response\n\t\tselect {\n\t\tcase <-pingTicker.C:\n\t\t\terr := cl.conn.SetWriteDeadline(time.Now().Add(time.Second * 10))\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"OT client error: websockest error: %v\\n\", err)\n\t\t\t\tbreak main\n\t\t\t}\n\t\t\terr = cl.conn.WriteMessage(websocket.PingMessage, []byte{})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"OT client error: websocket error: %v\\n\", err)\n\t\t\t\tbreak main\n\t\t\t}\n\t\t\terr = cl.conn.SetWriteDeadline(time.Time{})\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"OT client error: websockest error: %v\\n\", err)\n\t\t\t\tbreak main\n\t\t\t}\n\t\tcase s2cmsg, ok := <-cl.sv2cl:\n\t\t\tif !ok {\n\t\t\t\t// Closed by server and notification is not needed.\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif !sendSvResponse(s2cmsg) {\n\t\t\t\tbreak main\n\t\t\t}\n\t\tcase req, ok := <-request:\n\t\t\tif !ok {\n\t\t\t\tbreak main\n\t\t\t}\n\t\t\tif cl.readOnly {\n\t\t\t\tlog.Printf(\"OT client error: permission denied\\n\")\n\t\t\t\tbreak main\n\t\t\t}\n\t\t\tmtype, dat, err := parseMsg(req)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"OT client error: %v\\n\", err)\n\t\t\t\tbreak main\n\t\t\t}\n\t\t\tif mtype == WSMsgTypeOp {\n\t\t\t\topdat, ok := dat.(OpData)\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"OT client error: invalid request data\\n\")\n\t\t\t\t\tbreak main\n\t\t\t\t}\n\t\t\t\tcl.sendC2S(otC2SMessageTypeWSMsg, otWSMessage{Event: WSMsgTypeOp, Data: opdat})\n\t\t\t} else if mtype == WSMsgTypeSel {\n\t\t\t\topdat, ok := dat.(Ranges)\n\t\t\t\tif !ok {\n\t\t\t\t\tlog.Printf(\"OT client error: invalid request data\\n\")\n\t\t\t\t\tbreak main\n\t\t\t\t}\n\t\t\t\tcl.sendC2S(otC2SMessageTypeWSMsg, otWSMessage{Event: WSMsgTypeSel, Data: opdat})\n\t\t\t}\n\t\t}\n\t}\n\t// Discard all server response data\n\tclear := false\n\tfor !clear {\n\t\tselect {\n\t\tcase _, ok := <-cl.sv2cl:\n\t\t\tif !ok {\n\t\t\t\tclear = true\n\t\t\t}\n\t\tdefault:\n\t\t\tclear = true\n\t\t}\n\t}\n\t// Closed by client\n\tcl.sendC2S(otC2SMessageTypeClose, nil)\n\t// Wait server close\n\t_, ok := <-cl.sv2cl\n\tfor ok {\n\t\t_, ok = <-cl.sv2cl\n\t}\n}", "title": "" }, { "docid": "8e2450e93d81e9c438e4b23078b33f2d", "score": "0.48109785", "text": "func (driver *ExecutorDriver) recvLoop(response *http.Response) {\n\tdefer response.Body.Close()\n\n\tvar err error\n\tjsonDecoder := json.NewDecoder(NewReader(response.Body))\n\tfor {\n\t\tselect {\n\t\tcase <-driver.cxt.Done():\n\t\t\tblog.Infof(\"stop recvLoop mesos response\")\n\t\t\treturn\n\t\tdefault:\n\t\t\tevent := new(protoExec.Event)\n\t\t\terr = jsonDecoder.Decode(event)\n\t\t\tif err != nil {\n\t\t\t\tdriver.Lock()\n\t\t\t\tdriver.connected = false\n\t\t\t\tgo driver.loopSubcribedMesosSlave()\n\t\t\t\tdriver.Unlock()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tswitch event.GetType() {\n\t\t\tcase protoExec.Event_SUBSCRIBED:\n\t\t\t\tdriver.subscribed(nil, event.GetSubscribed())\n\n\t\t\tcase protoExec.Event_UNKNOWN:\n\t\t\t\tblog.Infof(\"recv event type UNKNOWN\")\n\n\t\t\tcase protoExec.Event_LAUNCH_GROUP:\n\t\t\t\tdriver.launchTaskgroup(nil, event.GetLaunchGroup())\n\n\t\t\tcase protoExec.Event_SHUTDOWN:\n\t\t\t\tblog.Infof(\"driver receive event shutdown\")\n\t\t\t\tdriver.executor.Shutdown()\n\n\t\t\tcase protoExec.Event_ACKNOWLEDGED:\n\t\t\t\tdriver.acknowledged(nil, event.GetAcknowledged())\n\n\t\t\tdefault:\n\t\t\t\tblog.Errorf(\"event type %s is invalid\", event.GetType().String())\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "27b1704a14f940eeedf1dbc65c119dba", "score": "0.48099312", "text": "func (w *Worker) loop() {\n\t// TODO: instead of loop and sleep to connection to the event server should just\n\t// stay open so it can push new events as they appear.\n\tfor {\n\t\tw.doWork()\n\t\tif w.shouldStop() {\n\t\t\tbreak\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n\tw.stopped <- struct{}{}\n}", "title": "" }, { "docid": "1e765eb3961fdd8d2e41269e0934fe97", "score": "0.48014176", "text": "func (pool *ElectionPool) loop() {\r\n\tdefer pool.wg.Done()\r\n\r\n\t// Start the stats reporting and election eviction tickers\r\n\tvar prevPending, prevQueued int\r\n\r\n\treport := time.NewTicker(statsReportInterval)\r\n\tdefer report.Stop()\r\n\r\n\t//evict := time.NewTicker(evictionInterval)\r\n\t//defer evict.Stop()\r\n\r\n\tjournal := time.NewTicker(pool.config.Rejournal)\r\n\tdefer journal.Stop()\r\n\r\n\t// Track the previous head headers for election reorgs\r\n\thead := pool.chain.CurrentBlock()\r\n\r\n\t// Keep waiting for and reacting to the various events\r\n\tfor {\r\n\t\tselect {\r\n\t\t// Handle ChainHeadEvent\r\n\t\t// 新区块头通知\r\n\t\tcase ev := <-pool.chainHeadCh:\r\n\t\t\tif ev.Block != nil {\r\n\t\t\t\tpool.mu.Lock()\r\n\r\n\t\t\t\t// 用新区块头替换旧区块头,需要重整 pool\r\n\t\t\t\tpool.reset(head.Header(), ev.Block.Header())\r\n\t\t\t\thead = ev.Block\r\n\r\n\t\t\t\tpool.mu.Unlock()\r\n\t\t\t}\r\n\t\t// Be unsubscribed due to system stopped\r\n\t\tcase <-pool.chainHeadSub.Err():\r\n\t\t\treturn\r\n\r\n\t\t// Handle stats reporting ticks\r\n\t\tcase <-report.C:\r\n\t\t\tpool.mu.RLock()\r\n\t\t\tpending, queued := pool.statsSealers()\r\n\t\t\t//stales := pool.priced.stales\r\n\t\t\tpool.mu.RUnlock()\r\n\r\n\t\t\tif pending != prevPending || queued != prevQueued {\r\n\t\t\t\tlog.Debug(\"election pool status report\", \"executable\", pending, \"queued\", queued)\r\n\t\t\t\tprevPending, prevQueued = pending, queued\r\n\t\t\t}\r\n\r\n\t\t// Handle local election journalSealers rotation\r\n\t\tcase <-journal.C:\r\n\t\t\tif pool.journalSealers != nil {\r\n\t\t\t\tpool.mu.Lock()\r\n\t\t\t\tif err := pool.journalSealers.rotate(pool.storedSealers()); err != nil {\r\n\t\t\t\t\tlog.Warn(\"Failed to rotate sealers election journalSealers\", \"err\", err)\r\n\t\t\t\t}\r\n\t\t\t\tpool.mu.Unlock()\r\n\t\t\t}\r\n\t\t\tif pool.journalPolice != nil {\r\n\t\t\t\tpool.mu.Lock()\r\n\t\t\t\tif err := pool.journalPolice.rotate(pool.storedPolice()); err != nil {\r\n\t\t\t\t\tlog.Warn(\"Failed to rotate police election journalSealers\", \"err\", err)\r\n\t\t\t\t}\r\n\t\t\t\tpool.mu.Unlock()\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "7eea90e772fde445b87fe6bf7004d3b7", "score": "0.4797564", "text": "func DeliveryLoop(ctx context.Context, c Client, inbox, pattern string, deliver DeliverFunc, outbox, errbox string, logger logr.Logger) error {\n\tif inbox == \"\" {\n\t\tinbox = \"INBOX\"\n\t}\n\tfor {\n\t\t// nosemgrep: trailofbits.go.invalid-usage-of-modified-variable.invalid-usage-of-modified-variable\n\t\tn, err := one(ctx, c, inbox, pattern, deliver, outbox, errbox, logger)\n\t\tif err != nil {\n\t\t\tlogger.Error(err, \"DeliveryLoop one round\", \"count\", n)\n\t\t} else {\n\t\t\tlogger.Info(\"DeliveryLoop one round\", \"count\", n)\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tdefault:\n\t\t}\n\n\t\tdur := ShortSleep\n\t\tif n == 0 || err != nil {\n\t\t\tdur = LongSleep\n\t\t}\n\n\t\tdelay := time.NewTimer(dur)\n\t\tselect {\n\t\tcase <-delay.C:\n\t\tcase <-ctx.Done():\n\t\t\tif !delay.Stop() {\n\t\t\t\t<-delay.C\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cfee0086ca7a810953867eda801e84f4", "score": "0.47900876", "text": "func (kl *kubeletExecutor) GarbageCollectLoop() {\n\tutil.Forever(func() {\n\t\tif err := kl.GarbageCollectContainers(); err != nil {\n\t\t\tlog.Errorf(\"Garbage collect failed: %v\", err)\n\t\t}\n\t}, time.Minute*1)\n}", "title": "" }, { "docid": "3309c60974bbf05b4c0dfaf5332a1355", "score": "0.47845", "text": "func (dtimer *DeadlineTimer) AsLoop(on bool) {\n\tdtimer.loop = on\n}", "title": "" }, { "docid": "c1a80b3e8b516e680168e39eae6e559e", "score": "0.47832885", "text": "func (m *EventMonitor) loop() {\n\tfor {\n\t\tresult, err := m.processBlock(m.currentBlock)\n\t\tswitch result {\n\t\tcase statusSuccess:\n\t\t\tlog.Printf(\"processed block %d for events\", m.currentBlock)\n\t\t\tm.currentBlock++\n\t\t\tbreak\n\t\tcase statusError:\n\t\t\tlog.Printf(\"error processing block %d for events: %s\", m.currentBlock, err.Error())\n\t\t\ttime.Sleep(time.Second * 10)\n\t\t\tbreak\n\t\tcase statusNoSuchBlock:\n\t\t\ttime.Sleep(time.Second)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db9071516ad63c6a9e9c5495bdef6130", "score": "0.47788018", "text": "func (loop *EventLoop) RunOnLoop(fn func(*goja.Runtime)) {\n\tloop.addAuxJob(func() { fn(loop.vm) })\n}", "title": "" }, { "docid": "48d142f6cd895046cd0265eaa5e8c49f", "score": "0.47782815", "text": "func (self *Lifecycle) Service(f Manageable, name string) {\n\t// we pass a channel back to the Lifecycle registration goroutine\n\t// over which we communicate the name of the registering service.\n\t// closure of this channel is used to indicate clean termination\n\timFinished := make(chan string)\n\tself.serviceRegistration <- imFinished\n\timFinished <- name\n\tself.wg.Add(1)\n\tdefer self.wg.Done()\n\tdefer close(imFinished)\n\t// services should be restarted if they stop running for any reason\n\t// hopefully f itself is a loop that is also reading from the interrupt\n\t// channel; we should only hit the top of this loop on errors/panics\n\tec := NewErrorCounter(5)\n\tfor !self.IsInterrupted() {\n\t\ttime.Sleep(ec.CalculateDelay())\n\t\terr := loopCalmly(self, f, name)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error in service %s: %s\", name, err)\n\t\t\tec.AddTimestamp(time.Now())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "aa517d1caf509ee515c7d8d4db79665f", "score": "0.47601354", "text": "func (s *sub) loop() {...}", "title": "" }, { "docid": "3622716e36d83bdc0d3187d17b494273", "score": "0.47459683", "text": "func (c *Conn) GetLoops(ec chan<- interface{}) (err error) {\n\t// The preferred exit condition is sensing a new archive record so\n\t// try to get 30 seconds beyond that.\n\tnumLoops := (int(archInt.Seconds()) + 30) / 2\n\n\tInfo.Printf(\"Retrieving %d loop packets\", numLoops)\n\n\t// Start a stream of LOOP1&2 packets, loop through, decode, and\n\t// send each one to the loops channel.\n\t_, err = c.writeCmd([]byte(\"LPS 3 \"+strconv.Itoa(numLoops)+\"\\n\"), []byte{ack}, 0)\n\tif err != nil {\n\t\tError.Printf(\"LPS command error: %s, aborting\", err.Error())\n\t\treturn\n\t}\n\n\tp := make([]byte, 99)\n\tvar l data.Loop\n\tnextArcRec := -1\n\tfor loopNum := 0; loopNum < numLoops; loopNum++ {\n\t\t_, err = c.d.ReadFull(p)\n\t\tif err != nil {\n\t\t\t// LOOP stream was interrupted before we received all of the\n\t\t\t// expected packets.\n\t\t\tWarn.Printf(\"Loop stream %d/%d read interrupted: %s, aborting\",\n\t\t\t\tloopNum, numLoops, err.Error())\n\t\t\tbreak\n\t\t}\n\n\t\terr = l.UnmarshalBinary(p)\n\t\tif err != nil {\n\t\t\t// Most likely a CRC error. We are probably out of sync with the\n\t\t\t// steam of 99-byte LOOP packets so the safest action is to abort.\n\t\t\tError.Printf(\"Loop stream %d/%d decode error: %s, aborting\",\n\t\t\t\tloopNum, numLoops, err.Error())\n\t\t\tbreak\n\t\t}\n\n\t\t// We have a valid decoded packet\n\t\tTrace.Println(\"Valid loop\")\n\t\tTrace.Printf(\"Packet\\n%s\", hex.Dump(p))\n\t\tTrace.Printf(\"Decoded\\n%s\", Sdump(l))\n\n\t\t// Since our Loop is combiation of LOOP1&2 don't start emitting until we have\n\t\t// at least one of each or some values will still be zeroed resulting in\n\t\t// inaccurate data.\n\t\tif loopNum > 0 {\n\t\t\tselect {\n\t\t\tcase ec <- l:\n\t\t\tdefault:\n\t\t\t\tWarn.Println(\"Event channel is full, discarding latest loop\")\n\t\t\t}\n\t\t}\n\n\t\t// A LOOP1 decode includes the next archive record indicator and if it changes\n\t\t// a new archive record is ready to be read.\n\t\tif nextArcRec < 0 {\n\t\t\tnextArcRec = l.NextArcRec\n\t\t} else if nextArcRec != l.NextArcRec {\n\t\t\tDebug.Printf(\"New archive record is available (%d->%d)\", nextArcRec, l.NextArcRec)\n\t\t\tc.NewArcRec = true\n\t\t\treturn\n\t\t}\n\n\t\t// Loops are low priority so if something else is waiting to run then exit.\n\t\tif len(c.Q) > 0 {\n\t\t\tDebug.Println(\"Command queue is not empty, cancelling get loops\")\n\t\t\tc.softReset()\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "b293504b415d0a0c1eb0a243dc64e6eb", "score": "0.47455066", "text": "func (n *natsServiceTTransport) heartbeatLoop() {\n\tmissed := uint(0)\n\tfor {\n\t\tselect {\n\t\tcase <-time.After(n.heartbeatTimeoutPeriod()):\n\t\t\tmissed++\n\t\t\tif missed >= n.maxMissedHeartbeats {\n\t\t\t\tlog.Warn(\"frugal: server heartbeat expired\")\n\t\t\t\tn.Close()\n\t\t\t\treturn\n\t\t\t}\n\t\tcase <-n.recvHeartbeatChan():\n\t\t\tmissed = 0\n\t\tcase <-n.closedChan():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4294a0cb056bcee15a98a6fa9bfcd545", "score": "0.47358808", "text": "func LoopLog(r Registry, d time.Duration, w *syslog.Writer) {\n\tfor range time.Tick(d) {\n\t\tLog(r, w)\n\t}\n}", "title": "" }, { "docid": "f6260c741ecf94df0436e76fa38bf252", "score": "0.4730321", "text": "func (r *Runner) Loop(ctx context.Context) error {\n\tvar (\n\t\ttick = time.NewTicker(10 * time.Second)\n\t\tnworker int\n\t\tndone, nfail, nstarted int\n\t\tworkerc = make(chan *worker)\n\n\t\t// Sessions stores the current set of bigmachine\n\t\t// sessions maintained by the runner, keyed by the\n\t\t// diviner system represented by the session.\n\t\tsessions = make(map[*diviner.System]*session)\n\t)\n\tdefer func() {\n\t\tfor _, sess := range sessions {\n\t\t\tfor _, w := range sess.Idle {\n\t\t\t\tw.Cancel()\n\t\t\t}\n\t\t\tsess.Idle = nil\n\t\t}\n\t}()\n\tupdateCounters := func() {\n\t\tr.mu.Lock()\n\t\tr.counters[\"nworker\"] = nworker\n\t\tr.counters[\"ndone\"] = ndone\n\t\tr.counters[\"nfail\"] = nfail\n\t\tr.counters[\"nstarted\"] = nstarted\n\t\tr.mu.Unlock()\n\t}\n\treply := func(r *request, w *worker) {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\tcase r.replyc <- w:\n\t\t}\n\t}\nouter:\n\tfor {\n\t\tupdateCounters()\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-tick.C:\n\t\t\tfor _, sess := range sessions {\n\t\t\t\tfor len(sess.Idle) > 0 && time.Since(sess.Idle[0].IdleTime) > idleTime {\n\t\t\t\t\tvar w *worker\n\t\t\t\t\tw, sess.Idle = sess.Idle[0], sess.Idle[1:]\n\t\t\t\t\tLogger.Printf(\"worker %s idled out from pool\", w)\n\t\t\t\t\tif w.Session != sess {\n\t\t\t\t\t\tpanic(w)\n\t\t\t\t\t}\n\t\t\t\t\tw.Cancel()\n\t\t\t\t\tsess.release()\n\t\t\t\t\tnworker--\n\t\t\t\t}\n\t\t\t}\n\t\tcase req := <-r.requestc:\n\t\t\tif len(req.sessions) > 0 {\n\t\t\t\tpanic(req)\n\t\t\t}\n\t\t\tvar reqSessions []*session\n\t\t\tfor _, sys := range req.sys {\n\t\t\t\tsess, ok := sessions[sys]\n\t\t\t\tif !ok {\n\t\t\t\t\tsess = &session{\n\t\t\t\t\t\tSystem: sys,\n\t\t\t\t\t\tB: bigmachine.Start(sys, bigmachine.Name(sys.ID)),\n\t\t\t\t\t\tRequests: map[*request]struct{}{},\n\t\t\t\t\t}\n\t\t\t\t\tif sess.System.Name() != \"testsystem\" {\n\t\t\t\t\t\tsess.B.HandleDebugPrefix(fmt.Sprintf(\"/debug/%s/\", sess.System.ID), http.DefaultServeMux)\n\t\t\t\t\t}\n\t\t\t\t\tsessions[sys] = sess\n\t\t\t\t}\n\t\t\t\treq.attach(sess)\n\t\t\t\tif len(sess.Idle) > 0 {\n\t\t\t\t\tvar w *worker\n\t\t\t\t\tw, sess.Idle = sess.Idle[0], sess.Idle[1:]\n\t\t\t\t\treq.detach()\n\t\t\t\t\tgo reply(req, w)\n\t\t\t\t\tcontinue outer\n\t\t\t\t}\n\t\t\t\treqSessions = append(reqSessions, sess)\n\t\t\t}\n\t\t\tif len(reqSessions) == 0 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tw := &worker{\n\t\t\t\tCandidates: reqSessions,\n\t\t\t\treturnc: workerc,\n\t\t\t}\n\t\t\tnworker++\n\t\t\tnstarted++\n\t\t\tgo w.Start(ctx)\n\t\tcase w := <-workerc:\n\t\t\tif err := w.Err(); err != nil {\n\t\t\t\tif w.Session != nil {\n\t\t\t\t\tw.Session.release()\n\t\t\t\t}\n\t\t\t\tnworker--\n\t\t\t\tlog.Error.Printf(\"worker %s error: %v\", w, err)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tif w.Session == nil {\n\t\t\t\tpanic(fmt.Sprintf(\"nil session, %v %v\", w, w.Err()))\n\t\t\t}\n\t\t\tsess := w.Session\n\t\t\tif len(sess.Requests) > 0 {\n\t\t\t\tfor req := range sess.Requests {\n\t\t\t\t\treq.detach()\n\t\t\t\t\tgo reply(req, w)\n\t\t\t\t\tcontinue outer\n\t\t\t\t}\n\t\t\t\tpanic(\"should not reach here\")\n\t\t\t}\n\t\t\t// Otherwise we put it on a watch list. We don't reap the instance\n\t\t\t// right away because of the race between dataset completion and\n\t\t\t// runs starting.\n\t\t\tw.IdleTime = time.Now()\n\t\t\tsess.Idle = append(sess.Idle, w)\n\t\t}\n\t}\n\tupdateCounters()\n\treturn nil\n}", "title": "" }, { "docid": "1867f6447e95118cb9af53b9cba0ee87", "score": "0.47241402", "text": "func (*ApprovalHandler) EachLoop() error { return nil }", "title": "" }, { "docid": "f2f48116c9197d3d57f95b6abd9e553d", "score": "0.47195342", "text": "func (r *Deployer) WatchLoop(w watch.Interface, fn func(watch.Event) bool) {\n\tfor {\n\t\tselect {\n\t\tcase event, ok := <-w.ResultChan():\n\t\t\tif !ok {\n\t\t\t\tlog.Info(\"No more events\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif stop := fn(event); stop {\n\t\t\t\tw.Stop()\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f16151153c0bb36c7bf527caf2dea5ef", "score": "0.47169214", "text": "func (p *PCC) readLoop() {\n\tscanner := bufio.NewScanner(p.conn)\n\tscanner.Split(SplitPcepMessage)\n\t// read from socket until it is closed\n\tfor scanner.Scan() {\n\t\tmsg, err := parseMessage(scanner.Bytes())\n\t\tif err != nil {\n\t\t\tswitch err := err.(type) {\n\t\t\tcase error:\n\t\t\t\tglog.V(4).Infof(\"Error parsing msg: %s\", err.Error())\n\t\t\tcase PcepError:\n\t\t\t\tp.sendMsg <- NewErrorMsg(err.ErrorType, err.ErrorValue, []int{})\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tp.recvMsg <- msg\n\t}\n\tvar errMsg string\n\tif err := scanner.Err(); err != nil {\n\t\terrMsg = err.Error()\n\t} else {\n\t\terrMsg = \"EOF\"\n\t}\n\tglog.V(4).Infof(\"Readloop for peer %s closed due to %s\", p.Name, errMsg)\n\tclose(p.StopSignal)\n}", "title": "" }, { "docid": "4cf7e5e3a6e92e6c4f8cc164360fb82f", "score": "0.47168064", "text": "func logCollectorMainLoop(ctx context.Context, rt *daemonRuntime, conf *daemonConfig, errChan chan<- error, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tlogCollectorCtx, logCollectorCancel := context.WithCancel(ctx)\n\tdefer logCollectorCancel()\n\n\tfor {\n\t\tselect {\n\t\t// If one of the other loops returns an error (which causes the main routine to call cancel()), we hit this\n\t\t// case and exit. Does not block.\n\t\tcase <-logCollectorCtx.Done():\n\t\t\tDBG(\"logCollectorLoop canceled by the main routine!\")\n\t\t\treturn\n\t\t// We've received a result. This will block when the result channel is empty, until our timeout case below.\n\t\tcase lastResult := <-rt.GetResult():\n\t\t\tif lastResult == -1 || lastResult == 18 {\n\t\t\t\t// We haven't received a result yet.\n\t\t\t\t// Or return code 18 - AIDE ran prior to there being an aide database.\n\t\t\t\tDBG(\"No scan result available\")\n\t\t\t} else if lastResult == 17 {\n\t\t\t\t// This is an AIDE config line error. We need to report this with an ERROR configMap without uploading\n\t\t\t\t// a log.\n\t\t\t\tlogAndTryReportingDaemonError(logCollectorCtx, rt, conf, \"AIDE error: %v\", fmt.Errorf(\"17 Invalid configureline error\"))\n\t\t\t} else if lastResult == 0 {\n\t\t\t\t// The check passed!\n\t\t\t\tif err := reportOK(logCollectorCtx, conf, rt); err != nil {\n\t\t\t\t\t// Considering this a non-fatal error right now.\n\t\t\t\t\tLOG(\"failed reporting scan result: %v\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Locking of the AIDE files is done in handleFailedResult()\n\t\t\t\tif !handleFailedResult(logCollectorCtx, rt, conf, errChan) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t// Since the result channel blocks when there is no result, this is our timeout case to continue\n\t\tcase <-time.After(time.Duration(conf.Interval) * time.Second):\n\t\t\t// Just continue looping.\n\t\t}\n\t}\n}", "title": "" }, { "docid": "63b9df862f6d3e1ba57c07fe5b624f46", "score": "0.47097784", "text": "func (p *Probe) probeLoop(ctx context.Context, resultsChan chan<- probeutils.ProbeResult) {\n\tvar wg sync.WaitGroup\n\n\t// Output Loop for metrics\n\twg.Add(1)\n\tgo func() {\n\t\tp.outputLoop(ctx, resultsChan)\n\t\twg.Done()\n\t}()\n\n\t// Echo loop to respond to incoming messages in echo mode.\n\tvar echoChan chan *echoMsg\n\tif p.echoMode {\n\t\techoChan = make(chan *echoMsg, maxTargets)\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tp.echoLoop(ctx, echoChan)\n\t\t\twg.Done()\n\t\t}()\n\t}\n\n\tp.recvLoop(ctx, echoChan)\n\twg.Wait()\n}", "title": "" }, { "docid": "7073fe98b948a618852ea60f2fa4ce91", "score": "0.47050872", "text": "func (a action) loopWithTimeout(timeout time.Duration) error {\n\tvar (\n\t\tarbiter = a.Arbiter\n\t\tstart = time.Now()\n\t)\n\tif arbiter == nil {\n\t\tarbiter = DefaultArbiter\n\t}\n\n\tif a.First != nil {\n\t\terr := a.First()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdesist := time.After(timeout)\n\tfor count := uint(1); ; count++ {\n\t\tvar err error\n\n\t\t// Perform action\n\t\tch := make(chan error)\n\t\tgo func() {\n\t\t\tch <- a.Run()\n\t\t}()\n\n\t\tselect {\n\t\tcase response := <-ch:\n\t\t\terr = response\n\t\tcase <-time.After(timeout):\n\t\t\t// call timed out\n\t\t\terr = fail.TimeoutError(\"operation timeout\", timeout, nil)\n\t\tcase <-desist:\n\t\t\terr = fail.TimeoutError(\"desist timeout\", timeout, nil)\n\t\t}\n\n\t\t// Collects the result of the try\n\t\ttry := Try{\n\t\t\tStart: start,\n\t\t\tCount: count,\n\t\t\tErr: err,\n\t\t}\n\n\t\t// Asks what to do now\n\t\tv, retryErr := arbiter(try)\n\t\tif a.Notify != nil {\n\t\t\ta.Notify(try, v)\n\t\t}\n\n\t\tswitch v {\n\t\tcase verdict.Done:\n\t\t\t// Returns the error if no retry is wanted\n\t\t\tvar errLast error\n\t\t\tif a.Last != nil {\n\t\t\t\terrLast = a.Last()\n\t\t\t\tif errLast != nil {\n\t\t\t\t\treturn fail.ErrListError([]error{errLast, retryErr})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn retryErr\n\t\tcase verdict.Abort:\n\t\t\t// Abort wanted, returns an error explaining why\n\t\t\tvar errLast error\n\t\t\tif a.Last != nil {\n\t\t\t\terrLast = a.Last()\n\t\t\t\tif errLast != nil {\n\t\t\t\t\treturn fail.ErrListError([]error{errLast, retryErr})\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn retryErr\n\t\tdefault:\n\t\t\t// Retry is wanted, so blocks the loop the amount of time needed\n\t\t\tif a.Officer != nil {\n\t\t\t\tgo func() {\n\t\t\t\t\ta.Officer.Block(try)\n\t\t\t\t\tch <- nil\n\t\t\t\t}()\n\n\t\t\t\tselect {\n\t\t\t\tcase response := <-ch:\n\t\t\t\t\terr = response\n\t\t\t\t\t_ = err\n\t\t\t\tcase <-desist:\n\t\t\t\t\terr = fail.TimeoutError(\"desist timeout\", timeout, nil)\n\t\t\t\t\t_ = err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0599ffeb4f9b8b6e453adbae5585ff7b", "score": "0.4698083", "text": "func loop(client *ngdb.GraphClient, c cli.Cli) error {\n\tfor {\n\t\tline, err, exit := c.ReadLine()\n\t\tlineString := string(line)\n\t\tif exit {\n\t\t\treturn err\n\t\t}\n\t\tif len(line) == 0 {\n\t\t\tfmt.Println()\n\t\t\tcontinue\n\t\t}\n\n\t\t// Client side command\n\t\tif clientCmd(lineString) {\n\t\t\t// Quit\n\t\t\treturn nil\n\t\t}\n\n\t\tstart := time.Now()\n\t\tresp, err := client.Execute(lineString)\n\t\tduration := time.Since(start)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Execute error, %s\", err.Error())\n\t\t}\n\t\tprintResp(resp, duration)\n\t\tfmt.Println(time.Now().In(time.Local).Format(time.RFC1123))\n\t\tc.SetSpace(string(resp.SpaceName))\n\t\tc.SetisErr(resp.GetErrorCode() != graph.ErrorCode_SUCCEEDED)\n\t\tfmt.Println()\n\t}\n}", "title": "" }, { "docid": "193d2d52ee53b4ba6707d7a7fa7283c7", "score": "0.46957383", "text": "func (c relayCommander) loop(fromChainID, fromChainNode, toChainID, toChainNode string) {\n\n\tctx := context.NewCoreContextFromViper()\n\t// get password\n\tpassphrase, err := ctx.GetPassphraseFromStdin(ctx.FromAddressName)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tingressSequenceKey := ibc.IngressSequenceKey(fromChainID)\n\tegressSequenceKey := ibc.EgressSequenceKey(toChainID)\n\nOUTER:\n\tfor {\n\t\ttime.Sleep(10 * time.Second)\n\n\t\tingressSequencebz, err := query(toChainNode, ingressSequenceKey, c.ibcStore)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tvar ingressSequence int64\n\t\tif ingressSequencebz == nil {\n\t\t\tingressSequence = 0\n\t\t} else if err = c.cdc.UnmarshalBinary(ingressSequencebz, &ingressSequence); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t\n\t\tlog := fmt.Sprintf(\"query chain : %s, ingress : %s, number : %d\", toChainID, ingressSequenceKey, ingressSequence)\n\t\tc.logger.Info(\"log\", \"string\", log)\n\n\t\tegressSequencebz, err := query(fromChainNode, egressSequenceKey, c.ibcStore)\n\t\tif err != nil {\n\t\t\tc.logger.Error(\"error querying outgoing packet list length\", \"err\", err)\n\t\t\tcontinue OUTER //TODO replace with continue (I think it should just to the correct place where OUTER is now)\n\t\t}\n\t\tvar egressSequence int64\n\t\tif egressSequencebz == nil {\n\t\t\tegressSequence = 0\n\t\t} else if err = c.cdc.UnmarshalBinary(egressSequencebz, &egressSequence); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\t\n\t\tlog = fmt.Sprintf(\"query chain : %s, egress : %s, number : %d\", fromChainID, egressSequenceKey, egressSequence)\n\t\tc.logger.Info(\"log\", \"string\", log)\t\n\t\t\n\t\tif egressSequence > ingressSequence {\n\t\t\tc.logger.Info(\"Detected IBC packet\", \"total\", egressSequence - ingressSequence)\n\t\t}\n\n\t\tseq := (c.getSequence(toChainNode))\n\t\t//c.logger.Info(\"broadcast tx seq\", \"number\", seq)\n\n\t\tfor i := ingressSequence; i < egressSequence; i++ {\n\t\t\tres, err := queryWithProof(fromChainNode, ibc.EgressKey(toChainID, i), c.ibcStore)\n\t\t\tif err != nil {\n\t\t\t\tc.logger.Error(\"error querying egress packet\", \"err\", err)\n\t\t\t\tcontinue OUTER // TODO replace to break, will break first loop then send back to the beginning (aka OUTER)\n\t\t\t}\n\t\t\t\n\t\t\t// get the from address\n\t\t\tfrom, err := ctx.GetFromAddress()\n\t\t\tif err != nil {\n\t\t\t\tpanic(err) \n\t\t\t}\n\t\t\t\n\t\t\tcommit_res, err := commitWithProof(fromChainNode, res.Height + 1, c.ibcStore)\n\t\t\tcommit_update := ibc.CommitUpdate{\n\t\t\t\tHeader: *commit_res.Header,\n\t\t\t\tCommit: *commit_res.Commit,\n\t\t\t}\n\t\t\tbz, err := c.cdc.MarshalBinary(commit_update)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\n\t\t\tcommit_msg := ibc.IBCRelayMsg{\n\t\t\t\tSrcChain: fromChainID,\n\t\t\t\tDestChain: toChainID,\n\t\t\t\tRelayer: from,\n\t\t\t\tPayload: bz,\n\t\t\t\tMsgType: ibc.COMMITUPDATE,\n\t\t\t}\n\t\t\t\n\t\t\tnew_ctx := context.NewCoreContextFromViper().WithDecoder(authcmd.GetAccountDecoder(c.cdc)).WithSequence(i)\n\t\t\t//ctx = ctx.WithNodeURI(viper.GetString(FlagHubChainNode))\n\t\t\t//ctx := context.NewCoreContextFromViper().WithDecoder(authcmd.GetAccountDecoder(c.cdc))\n\t\t\tnew_ctx, err = new_ctx.Ensure(ctx.FromAddressName)\n\t\t\tnew_ctx = new_ctx.WithSequence(seq)\n\t\t\txx_res, err := new_ctx.SignAndBuild(ctx.FromAddressName, passphrase, []sdk.Msg{commit_msg}, c.cdc)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\t//\n\t\t\tc.logger.Info(\"broadcast tx, type : commitupdate, sequence : \", \"int\", seq)\n\t\t\t\n\t\t\t//\n\t\t\terr = c.broadcastTx(seq, toChainNode, xx_res)\n\t\t\tseq++\n\t\t\tif err != nil {\n\t\t\t\tc.logger.Error(\"error broadcasting ingress packet\", \"err\", err)\n\t\t\t\tcontinue OUTER // TODO replace to break, will break first loop then send back to the beginning (aka OUTER)\n\t\t\t}\n\n new_ibcpacket := ibc.NewIBCPacket {\n \tPacket: res.Value,\n \tProof: res.Proof,\n \tSequence: i,\n }\n \n bz, err = c.cdc.MarshalBinary(new_ibcpacket)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t\t\n\t\t\t//\n\t\t\tmsg := ibc.IBCRelayMsg{\n\t\t\t\tSrcChain: fromChainID,\n\t\t\t\tDestChain: toChainID,\n\t\t\t\tRelayer: from,\n\t\t\t\tPayload: bz,\n\t\t\t\tMsgType: ibc.NEWIBCPACKET,\n\t\t\t}\n\t\t\t\n\t\t\tnew_ctx = context.NewCoreContextFromViper().WithDecoder(authcmd.GetAccountDecoder(c.cdc)).WithSequence(i)\n\t\t\t//ctx = ctx.WithNodeURI(viper.GetString(FlagHubChainNode))\n\t\t\t//ctx := context.NewCoreContextFromViper().WithDecoder(authcmd.GetAccountDecoder(c.cdc))\n\t\t\tnew_ctx, err = new_ctx.Ensure(ctx.FromAddressName)\n\t\t\tnew_ctx = new_ctx.WithSequence(seq)\n\t\t\txx_res, err = new_ctx.SignAndBuild(ctx.FromAddressName, passphrase, []sdk.Msg{msg}, c.cdc)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\t//\n\t\t\tc.logger.Info(\"broadcast tx, type : newibcpacket, sequence : \", \"int\", seq)\n\t\t\t\n\t\t\t//\n\t\t\terr = c.broadcastTx(seq, toChainNode, xx_res)\n\t\t\tseq++\n\t\t\tif err != nil {\n\t\t\t\tc.logger.Error(\"error broadcasting ingress packet\", \"err\", err)\n\t\t\t\tcontinue OUTER // TODO replace to break, will break first loop then send back to the beginning (aka OUTER)\n\t\t\t}\n\n\t\t\tc.logger.Info(\"Relayed IBC packet\", \"index\", i)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "28b5ad7f0caeeddafad35cf83f0fc1b9", "score": "0.46855727", "text": "func loop() {\n\tlog.Trace.Println(\"Loop started\")\n\tfor i := 0; i < 10; i++ {\n\t\tlog.Info.Println(\"Counter value is:\", i)\n\t}\n\tlog.Warning.Println(\"The counter variable is not being used\")\n\tlog.Trace.Println(\"Loop completed\")\n}", "title": "" }, { "docid": "a92a05b49ced8d3532efa41c0c797871", "score": "0.4683936", "text": "func (c *Client) loop() {\n\tfor {\n\t\tselect {\n\t\tcase b := <-c.Backlog:\n\t\t\tif err := c.put(b); err != nil {\n\t\t\t\tlog.Printf(\"error: %s\", err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "3e0ed51b94b557941117c780ee3b72aa", "score": "0.46790066", "text": "func main() {\n\n\t// 1. test cellibrium - need an invariant name (non trivial in cloud)\n\n\tctx := context.Background()\n\tctx = H.SetLocationInfo(ctx, map[string]string{\n\t\t\"Pod\": \"A_pod_named_foo\",\n\t\t\"Deployment\": \"myApp_name2\", // insert instance data from env?\n\t\t\"Version\": \"1.2.3\",\n\t})\n\n\tMainLoop(ctx)\n\n\t// 2. test koalja, reads pipeline/container_description\n\n // go routine ...several parallel with same name\n\n}", "title": "" }, { "docid": "02ab5c61f5536da84429a726de8e3e02", "score": "0.46740645", "text": "func (s *Service) run() {\n\tfor i := 0; i < config.AddMachineNo; i++ {\n\t\ts.addMachines[i] = true\n\t\ts.addMachinesFixStatus[i] = false\n\t\ts.addMachinesLog[i] = 0\n\t}\n\tfor i := 0; i < config.MulMachineNo; i++ {\n\t\ts.mulMachines[i] = true\n\t\ts.mulMachinesFixStatus[i] = false\n\t\ts.mulMachinesLog[i] = 0\n\t}\n\n\ts.response = make(chan *ComplainOp)\n\n\tfor {\n\t\tselect {\n\t\tcase response := <-s.response:\n\t\t\tswitch response.machineType {\n\t\t\tcase ADDMACHINE:\n\t\t\t\ts.addMachines[response.machineIndex] = true\n\t\t\t\ts.addMachinesFixStatus[response.machineIndex] = false\n\t\t\tcase MULMACHINE:\n\t\t\t\ts.mulMachines[response.machineIndex] = true\n\t\t\t\ts.mulMachinesFixStatus[response.machineIndex] = false\n\t\t\t}\n\t\tcase complain := <-s.complains:\n\t\t\tnumber := complain.collisionNo\n\t\t\tswitch complain.machineType {\n\t\t\tcase ADDMACHINE:\n\t\t\t\tif s.addMachinesLog[complain.machineIndex] < number && s.addMachines[complain.machineIndex] {\n\t\t\t\t\ts.addMachines[complain.machineIndex] = false\n\t\t\t\t\ts.addMachinesLog[complain.machineIndex] = number\n\t\t\t\t}\n\t\t\tcase MULMACHINE:\n\t\t\t\tif s.mulMachinesLog[complain.machineIndex] < number && s.mulMachines[complain.machineIndex] {\n\t\t\t\t\ts.mulMachines[complain.machineIndex] = false\n\t\t\t\t\ts.mulMachinesLog[complain.machineIndex] = number\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tworker := s.checkAvailability()\n\n\t\tif worker != nil {\n\t\t\tfor i := 0; i < config.AddMachineNo; i++ {\n\t\t\t\tif !s.addMachines[i] && !s.addMachinesFixStatus[i] {\n\t\t\t\t\tworker.isBusy = true\n\t\t\t\t\ts.addMachinesFixStatus[i] = true\n\t\t\t\t\tgo worker.fix(&ComplainOp{machineType: ADDMACHINE, machineIndex: i}, s.response)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tworker = s.checkAvailability()\n\n\t\tif worker != nil {\n\t\t\tfor i := 0; i < config.MulMachineNo; i++ {\n\t\t\t\tif !s.mulMachines[i] && !s.mulMachinesFixStatus[i] {\n\t\t\t\t\tworker.isBusy = true\n\t\t\t\t\ts.mulMachinesFixStatus[i] = true\n\t\t\t\t\tgo worker.fix(&ComplainOp{machineType: MULMACHINE, machineIndex: i}, s.response)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "559e68742a39bb4b74089d47de99b36c", "score": "0.46737558", "text": "func (c *Client) AbLoopA() (prop interface{}, err error) {\n\treturn c.GetProperty(\"ab-loop-a\")\n}", "title": "" }, { "docid": "6dd5978d9f89735181244a2874b78330", "score": "0.4672832", "text": "func MainLoop() {\n\tRefreshScreen()\n\n\teventQueue := make(chan term.Event)\n\tgo func() {\n\t\tfor {\n\t\t\teventQueue <- term.PollEvent()\n\t\t}\n\t}()\n\n\tfor {\n\t\tRefreshScreen()\n\n\t\tselect {\n\t\tcase ev := <-eventQueue:\n\t\t\tswitch ev.Type {\n\t\t\tcase term.EventError:\n\t\t\t\tpanic(ev.Err)\n\t\t\tdefault:\n\t\t\t\tProcessEvent(termboxEventToLocal(ev))\n\t\t\t}\n\t\tcase cmd := <-loop.channel:\n\t\t\tif cmd.Type == EventQuit {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tProcessEvent(cmd)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8b561ba71a0fe8d3854bcbd97dc41d42", "score": "0.46696588", "text": "func killContainer(experimentsDetails *experimentTypes.ExperimentDetails, clients clients.ClientSets, eventsDetails *types.EventDetails, chaosDetails *types.ChaosDetails, resultDetails *types.ResultDetails) error {\n\n\t//ChaosStartTimeStamp contains the start timestamp, when the chaos injection begin\n\tChaosStartTimeStamp := time.Now()\n\tduration := int(time.Since(ChaosStartTimeStamp).Seconds())\n\n\tfor duration < experimentsDetails.ChaosDuration {\n\n\t\t//getRestartCount return the restart count of target container\n\t\trestartCountBefore, err := getRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//Obtain the container ID through Pod\n\t\t// this id will be used to select the container for the kill\n\t\tcontainerID, err := common.GetContainerID(experimentsDetails.AppNS, experimentsDetails.TargetPods, experimentsDetails.TargetContainer, clients)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"Unable to get the container id, %v\", err)\n\t\t}\n\n\t\tlog.InfoWithValues(\"[Info]: Details of application under chaos injection\", logrus.Fields{\n\t\t\t\"PodName\": experimentsDetails.TargetPods,\n\t\t\t\"ContainerName\": experimentsDetails.TargetContainer,\n\t\t\t\"RestartCountBefore\": restartCountBefore,\n\t\t})\n\n\t\t// record the event inside chaosengine\n\t\tif experimentsDetails.EngineName != \"\" {\n\t\t\tmsg := \"Injecting \" + experimentsDetails.ExperimentName + \" chaos on application pod\"\n\t\t\ttypes.SetEngineEventAttributes(eventsDetails, types.ChaosInject, msg, \"Normal\", chaosDetails)\n\t\t\tevents.GenerateEvents(eventsDetails, clients, chaosDetails, \"ChaosEngne\")\n\t\t}\n\n\t\tswitch experimentsDetails.ContainerRuntime {\n\t\tcase \"docker\":\n\t\t\tif err := stopDockerContainer(containerID, experimentsDetails.SocketPath, experimentsDetails.Signal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase \"containerd\", \"crio\":\n\t\t\tif err := stopContainerdContainer(containerID, experimentsDetails.SocketPath, experimentsDetails.Signal); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.Errorf(\"%v container runtime not supported\", experimentsDetails.ContainerRuntime)\n\t\t}\n\n\t\t//Waiting for the chaos interval after chaos injection\n\t\tif experimentsDetails.ChaosInterval != 0 {\n\t\t\tlog.Infof(\"[Wait]: Wait for the chaos interval %vs\", experimentsDetails.ChaosInterval)\n\t\t\tcommon.WaitForDuration(experimentsDetails.ChaosInterval)\n\t\t}\n\n\t\t//Check the status of restarted container\n\t\terr = common.CheckContainerStatus(experimentsDetails.AppNS, experimentsDetails.TargetPods, clients)\n\t\tif err != nil {\n\t\t\treturn errors.Errorf(\"application container is not in running state, %v\", err)\n\t\t}\n\n\t\t// It will verify that the restart count of container should increase after chaos injection\n\t\terr = verifyRestartCount(experimentsDetails, experimentsDetails.TargetPods, clients, restartCountBefore)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tduration = int(time.Since(ChaosStartTimeStamp).Seconds())\n\t}\n\tif err := result.AnnotateChaosResult(resultDetails.Name, chaosDetails.ChaosNamespace, \"targeted\", \"pod\", experimentsDetails.TargetPods); err != nil {\n\t\treturn err\n\t}\n\tlog.Infof(\"[Completion]: %v chaos has been completed\", experimentsDetails.ExperimentName)\n\treturn nil\n}", "title": "" }, { "docid": "23fc0809c3b8243eb74cb8f09b304f1c", "score": "0.46670586", "text": "func (notifier *Notifier) Start() {\n\tloop := func() error {\n\t\treq, err := http.NewRequest(\"GET\", fmt.Sprintf(\"%s/notifications\", srv.APIEndpoint), nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tresp, err := notifier.cl.Do(req)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif resp.StatusCode != http.StatusOK {\n\t\t\treturn fmt.Errorf(\"/v1/notifications returned unexpected status code: %d\", resp.StatusCode)\n\t\t}\n\t\tvar data = make([]byte, 1000)\n\n\t\tfor !notifier.shouldStop {\n\t\t\tn, extra, err := notifier.read(resp.Body, data)\n\t\t\tif err != nil {\n\t\t\t\tresp.Body.Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif extra != nil {\n\t\t\t\terr = notifier.handleMessage(extra)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif n != 0 {\n\t\t\t\terr = notifier.handleMessage(data)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t}\n\twrapper := func() {\n\t\terr := loop()\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tgo wrapper()\n}", "title": "" }, { "docid": "c43a9628eb8a89f21da41845ad0fe894", "score": "0.46650192", "text": "func (s *CollectionService) Run() {\n\tfor req := range s.RequestChan {\n\t\tif req, ok := req.(colStopRequest); ok {\n\t\t\ts.IsRunning = false\n\t\t\treq.responseChan <- struct{}{}\n\t\t\tbreak\n\t\t} else {\n\t\t\tlog.Printf(\"Unknown request type: %v\", req)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "126fb75a094e73d80eca008c221a07c8", "score": "0.46561956", "text": "func (c *Connection) healthCheckLoop() backgroundLoopStatus {\n\t// create a separate API channel for health check probes\n\tch, err := c.newAPIChannel(1, 1)\n\tif err != nil {\n\t\tlog.Error(\"Failed to create health check API channel, health check will be disabled:\", err)\n\t\treturn terminate\n\t}\n\tdefer ch.Close()\n\n\tvar (\n\t\tsinceLastReply time.Duration\n\t\tfailedChecks int\n\t)\n\n\t// send health check probes until an error or timeout occurs\n\tprobeInterval := time.NewTicker(HealthCheckProbeInterval)\n\tdefer probeInterval.Stop()\n\nHealthCheck:\n\tfor {\n\t\tselect {\n\t\tcase <-c.healthCheckDone:\n\t\t\t// Terminate the health check loop on connection disconnect\n\t\t\tlog.Debug(\"Disconnected on request, exiting health check loop.\")\n\t\t\treturn terminate\n\t\tcase <-probeInterval.C:\n\t\t\t// try draining probe replies from previous request before sending next one\n\t\t\tselect {\n\t\t\tcase <-ch.replyChan:\n\t\t\t\tlog.Debug(\"drained old probe reply from reply channel\")\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\t// send the control ping request\n\t\t\tch.reqChan <- &vppRequest{msg: c.msgControlPing}\n\n\t\t\tfor {\n\t\t\t\t// expect response within timeout period\n\t\t\t\tselect {\n\t\t\t\tcase vppReply := <-ch.replyChan:\n\t\t\t\t\terr = vppReply.err\n\n\t\t\t\tcase <-time.After(HealthCheckReplyTimeout):\n\t\t\t\t\terr = ErrProbeTimeout\n\n\t\t\t\t\t// check if time since last reply from any other\n\t\t\t\t\t// channel is less than health check reply timeout\n\t\t\t\t\tc.lastReplyLock.Lock()\n\t\t\t\t\tsinceLastReply = time.Since(c.lastReply)\n\t\t\t\t\tc.lastReplyLock.Unlock()\n\n\t\t\t\t\tif sinceLastReply < HealthCheckReplyTimeout {\n\t\t\t\t\t\tlog.Warnf(\"VPP health check probe timing out, but some request on other channel was received %v ago, continue waiting!\", sinceLastReply)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tif err == ErrProbeTimeout {\n\t\t\t\tfailedChecks++\n\t\t\t\tlog.Warnf(\"VPP health check probe timed out after %v (%d. timeout)\", HealthCheckReplyTimeout, failedChecks)\n\t\t\t\tif failedChecks > HealthCheckThreshold {\n\t\t\t\t\t// in case of exceeded failed check threshold, assume VPP unresponsive\n\t\t\t\t\tlog.Errorf(\"VPP does not responding, the health check exceeded threshold for timeouts (>%d)\", HealthCheckThreshold)\n\t\t\t\t\tc.sendConnEvent(ConnectionEvent{Timestamp: time.Now(), State: NotResponding})\n\t\t\t\t\tbreak HealthCheck\n\t\t\t\t}\n\t\t\t} else if err != nil {\n\t\t\t\t// in case of error, assume VPP disconnected\n\t\t\t\tlog.Errorf(\"VPP health check probe failed: %v\", err)\n\t\t\t\tc.sendConnEvent(ConnectionEvent{Timestamp: time.Now(), State: Disconnected, Error: err})\n\t\t\t\tbreak HealthCheck\n\t\t\t} else if failedChecks > 0 {\n\t\t\t\t// in case of success after failed checks, clear failed check counter\n\t\t\t\tfailedChecks = 0\n\t\t\t\tlog.Infof(\"VPP health check probe OK\")\n\t\t\t}\n\t\t}\n\t}\n\n\t// cleanup\n\tc.disconnectVPP()\n\n\treturn resume\n}", "title": "" }, { "docid": "1de79aa6076cd4bb7e840009171dd326", "score": "0.46541852", "text": "func inLoop(c *Channel, m *methods) error {\n\tfor {\n\t\tpkg, err := c.conn.GetMessage()\n\t\tif err != nil {\n\t\t\treturn closeChannel(c, m, err)\n\t\t}\n\t\tmsg, err := protocol.Decode(pkg)\n\t\tif err != nil {\n\t\t\tcloseChannel(c, m, protocol.ErrorWrongPacket)\n\t\t\treturn err\n\t\t}\n\n\t\tswitch msg.Type {\n\t\tcase protocol.MessageTypeOpen:\n\t\t\tif err := json.Unmarshal([]byte(msg.Source[1:]), &c.header); err != nil {\n\t\t\t\tcloseChannel(c, m, ErrorWrongHeader)\n\t\t\t}\n\t\t\tm.callLoopEvent(c, OnConnection)\n\t\tcase protocol.MessageTypePing:\n\t\t\tc.out <- protocol.PongMessage\n\t\tcase protocol.MessageTypePong:\n\t\tdefault:\n\t\t\tgo m.processIncomingMessage(c, msg)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" } ]
3cd3d5cda5baafff0dc0cb1b6dd6ec97
result is the default implementation for ExpressRouteCrossConnectionsListArpTableFuture.Result.
[ { "docid": "e34213460fac0764ccc8deb7d4915a48", "score": "0.8039605", "text": "func (future *ExpressRouteCrossConnectionsListArpTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListArpTableFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercatlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionsListArpTableFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListArpTableFuture\", \"Result\", ercatlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "bc345b34cdf6134abfca037469fef206", "score": "0.74762887", "text": "func (future *ExpressRouteCircuitsListArpTableFuture) result(client ExpressRouteCircuitsClient) (ercatlr ExpressRouteCircuitsArpTableListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListArpTableFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercatlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitsListArpTableFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercatlr.Response.Response, err = future.GetResult(sender); err == nil && ercatlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercatlr, err = client.ListArpTableResponder(ercatlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListArpTableFuture\", \"Result\", ercatlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a757c3394b92bfbf32c7ad090aab9c8f", "score": "0.691043", "text": "func (future *ExpressRouteCrossConnectionsListRoutesTableFuture) result(client ExpressRouteCrossConnectionsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListRoutesTableFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercrtlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionsListRoutesTableFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListRoutesTableFuture\", \"Result\", ercrtlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "af8c316ea45ed8877753bf120ea2c242", "score": "0.6673146", "text": "func (future *ExpressRouteCrossConnectionsListRoutesTableSummaryFuture) result(client ExpressRouteCrossConnectionsClient) (erccrtslr ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terccrtslr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erccrtslr.Response.Response, err = future.GetResult(sender); err == nil && erccrtslr.Response.Response.StatusCode != http.StatusNoContent {\n\t\terccrtslr, err = client.ListRoutesTableSummaryResponder(erccrtslr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsListRoutesTableSummaryFuture\", \"Result\", erccrtslr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "beea9d1151437a14147923c883df41d2", "score": "0.6458208", "text": "func (future *ExpressRouteCrossConnectionsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercc, err = client.CreateOrUpdateResponder(ercc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsCreateOrUpdateFuture\", \"Result\", ercc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6c32b66d447b46134c8fda0844d2f868", "score": "0.63760614", "text": "func (future *ExpressRouteCircuitsListRoutesTableFuture) result(client ExpressRouteCircuitsClient) (ercrtlr ExpressRouteCircuitsRoutesTableListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListRoutesTableFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercrtlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitsListRoutesTableFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercrtlr.Response.Response, err = future.GetResult(sender); err == nil && ercrtlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercrtlr, err = client.ListRoutesTableResponder(ercrtlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListRoutesTableFuture\", \"Result\", ercrtlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "14568a70d7df860ba92d05ed71010b75", "score": "0.6163444", "text": "func (future *ExpressRouteCircuitsListRoutesTableSummaryFuture) result(client ExpressRouteCircuitsClient) (ercrtslr ExpressRouteCircuitsRoutesTableSummaryListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListRoutesTableSummaryFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercrtslr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitsListRoutesTableSummaryFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercrtslr.Response.Response, err = future.GetResult(sender); err == nil && ercrtslr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercrtslr, err = client.ListRoutesTableSummaryResponder(ercrtslr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsListRoutesTableSummaryFuture\", \"Result\", ercrtslr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f38df19ac6429c8c94de239629dbdce7", "score": "0.6117631", "text": "func (client ExpressRouteCrossConnectionsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, 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": "26819b9495e56ee7f5da45bb811de28b", "score": "0.60122544", "text": "func (future *InterfacesGetEffectiveRouteTableFuture) result(client InterfacesClient) (erlr EffectiveRouteListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.InterfacesGetEffectiveRouteTableFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.InterfacesGetEffectiveRouteTableFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erlr.Response.Response, err = future.GetResult(sender); err == nil && erlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\terlr, err = client.GetEffectiveRouteTableResponder(erlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.InterfacesGetEffectiveRouteTableFuture\", \"Result\", erlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3a798c073083c12a1260f1944dd1a74a", "score": "0.5913085", "text": "func (client ExpressRouteCrossConnectionsClient) ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListArpTableFuture, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ExpressRouteCrossConnectionsClient.ListArpTable\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.FutureAPI != nil && result.FutureAPI.Response() != nil {\n\t\t\t\tsc = result.FutureAPI.Response().StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\treq, err := client.ListArpTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"ListArpTable\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresult, err = client.ListArpTableSender(req)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"ListArpTable\", result.Response(), \"Failure sending request\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "d2574a393a907f2232af698040d87304", "score": "0.5869286", "text": "func (future *RouteTablesCreateOrUpdateFuture) result(client RouteTablesClient) (rt RouteTable, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.RouteTablesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.RouteTablesCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent {\n\t\trt, err = client.CreateOrUpdateResponder(rt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.RouteTablesCreateOrUpdateFuture\", \"Result\", rt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "28d8073f6172226be7c03d2545ffbe8b", "score": "0.58124864", "text": "func (future *ExpressRouteCircuitConnectionsCreateOrUpdateFuture) result(client ExpressRouteCircuitConnectionsClient) (ercc ExpressRouteCircuitConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercc, err = client.CreateOrUpdateResponder(ercc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitConnectionsCreateOrUpdateFuture\", \"Result\", ercc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4d86a3289f6d0947e40c6439e73d50a", "score": "0.58087784", "text": "func (future *ExpressRouteConnectionsCreateOrUpdateFuture) result(client ExpressRouteConnectionsClient) (erc ExpressRouteConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteConnectionsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteConnectionsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent {\n\t\terc, err = client.CreateOrUpdateResponder(erc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteConnectionsCreateOrUpdateFuture\", \"Result\", erc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "a47f65edb5740feed5bbab65064fc2f6", "score": "0.57796156", "text": "func (future *ExpressRouteCrossConnectionsUpdateTagsFuture) result(client ExpressRouteCrossConnectionsClient) (ercc ExpressRouteCrossConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsUpdateTagsFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionsUpdateTagsFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercc.Response.Response, err = future.GetResult(sender); err == nil && ercc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercc, err = client.UpdateTagsResponder(ercc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsUpdateTagsFuture\", \"Result\", ercc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "f885fb7977f37e6fabee055dcc67b2b8", "score": "0.57177484", "text": "func (client ExpressRouteCrossConnectionsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListArpTableFuture, err error) {\n\tvar resp *http.Response\n\tfuture.FutureAPI = &azure.Future{}\n\tresp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client))\n\tif err != nil {\n\t\treturn\n\t}\n\tvar azf azure.Future\n\tazf, err = azure.NewFutureFromResponse(resp)\n\tfuture.FutureAPI = &azf\n\tfuture.Result = future.result\n\treturn\n}", "title": "" }, { "docid": "06cdd69d6fefb60e1363447547900b24", "score": "0.5605571", "text": "func (future *DatabaseAccountsFailoverPriorityChangeFuture) Result(client DatabaseAccountsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"documentdb.DatabaseAccountsFailoverPriorityChangeFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"documentdb.DatabaseAccountsFailoverPriorityChangeFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "0e9f27d9348c0bd4bc46ab9714de1801", "score": "0.56051564", "text": "func (arc *azureRecordsClient) Result(ctx context.Context, future azureautorest.FutureAPI, futureType string) (result interface{}, err error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "d3059fd378bdb2ab207b63bfbff056e5", "score": "0.55971193", "text": "func (future *ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (erccp ExpressRouteCrossConnectionPeering, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terccp.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erccp.Response.Response, err = future.GetResult(sender); err == nil && erccp.Response.Response.StatusCode != http.StatusNoContent {\n\t\terccp, err = client.CreateOrUpdateResponder(erccp.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionPeeringsCreateOrUpdateFuture\", \"Result\", erccp.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eefeba4c9661c56410228815be306c99", "score": "0.5582173", "text": "func (future *RouteTablesDeleteFuture) result(client RouteTablesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.RouteTablesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.RouteTablesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "5b0bf6fd08992901c0d788cc8814739c", "score": "0.55643076", "text": "func (future *ReplicationFabricsMigrateToAadFuture) result(client ReplicationFabricsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationFabricsMigrateToAadFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"siterecovery.ReplicationFabricsMigrateToAadFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "9c59b27971e9a75a46da4ae88d017a76", "score": "0.55491763", "text": "func (future *VpnConnectionsCreateOrUpdateFuture) result(client VpnConnectionsClient) (vc VpnConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VpnConnectionsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tvc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VpnConnectionsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tvc, err = client.CreateOrUpdateResponder(vc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VpnConnectionsCreateOrUpdateFuture\", \"Result\", vc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "3238d8b451fdc6096c1104a7f05266db", "score": "0.5500007", "text": "func (future *RouteTablesUpdateTagsFuture) result(client RouteTablesClient) (rt RouteTable, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.RouteTablesUpdateTagsFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.RouteTablesUpdateTagsFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rt.Response.Response, err = future.GetResult(sender); err == nil && rt.Response.Response.StatusCode != http.StatusNoContent {\n\t\trt, err = client.UpdateTagsResponder(rt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.RouteTablesUpdateTagsFuture\", \"Result\", rt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "5e387b06cc7724a108ab059d4a68734f", "score": "0.5488122", "text": "func (future *AppsApproveOrRejectPrivateEndpointConnectionSlotFuture) result(client AppsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trpecar.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent {\n\t\trpecar, err = client.ApproveOrRejectPrivateEndpointConnectionSlotResponder(rpecar.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsApproveOrRejectPrivateEndpointConnectionSlotFuture\", \"Result\", rpecar.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ad6ab6bf24aef4c5005838e0ae98a3fa", "score": "0.5476908", "text": "func (future *AppServiceEnvironmentsChangeVnetAllFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsChangeVnetAllFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tacp.ac.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceEnvironmentsChangeVnetAllFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent {\n\t\tacp, err = client.ChangeVnetResponder(acp.ac.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsChangeVnetAllFuture\", \"Result\", acp.ac.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2af1ba1f10928edb26c143cbfd05aba5", "score": "0.5451005", "text": "func (future *ReplicationLinksFailoverFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.ReplicationLinksFailoverFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.ReplicationLinksFailoverFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "c85fdf3761be0eb7b8d0497c65d448bc", "score": "0.5446917", "text": "func (future *ExpressRouteConnectionsDeleteFuture) result(client ExpressRouteConnectionsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteConnectionsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteConnectionsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "156c79764c6d038d452dc9deb3243b4f", "score": "0.5414313", "text": "func (future *ExpressRouteCircuitConnectionsDeleteFuture) result(client ExpressRouteCircuitConnectionsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitConnectionsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitConnectionsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "27fc4c1f67a8de18fba0e68ca2ba6c15", "score": "0.54067636", "text": "func (future *PrivateEndpointConnectionsCreateFuture) result(client PrivateEndpointConnectionsClient) (pec PrivateEndpointConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"iotcentral.PrivateEndpointConnectionsCreateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tpec.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"iotcentral.PrivateEndpointConnectionsCreateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif pec.Response.Response, err = future.GetResult(sender); err == nil && pec.Response.Response.StatusCode != http.StatusNoContent {\n\t\tpec, err = client.CreateResponder(pec.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"iotcentral.PrivateEndpointConnectionsCreateFuture\", \"Result\", pec.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a03188a051ccc070659fdabc2a0b00c", "score": "0.5401476", "text": "func (future *AppsApproveOrRejectPrivateEndpointConnectionFuture) result(client AppsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trpecar.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsApproveOrRejectPrivateEndpointConnectionFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent {\n\t\trpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", rpecar.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7a11016eba5b0cfe6e27b0669b5ed87f", "score": "0.5390249", "text": "func (future *VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture) result(client VirtualNetworkGatewaysClient) (vcchdlr VpnClientConnectionHealthDetailListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tvcchdlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif vcchdlr.Response.Response, err = future.GetResult(sender); err == nil && vcchdlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tvcchdlr, err = client.GetVpnclientConnectionHealthResponder(vcchdlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewaysGetVpnclientConnectionHealthFuture\", \"Result\", vcchdlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6d954ab8bb5e77a5b5716c1f225191cb", "score": "0.5382897", "text": "func (future *ExpressRouteCrossConnectionsListArpTableFuture) 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": "eeac35dde74f3e49918011686b406c8d", "score": "0.5360986", "text": "func (future *ServersFailoverFuture) result(client ServersClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersFailoverFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersFailoverFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "897e0da461ce0c76041e48a006c43e29", "score": "0.53481984", "text": "func (future *InboundNatRulesDeleteFuture) result(client InboundNatRulesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.InboundNatRulesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.InboundNatRulesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "9768ca8daae5c597ef177c942abd37f8", "score": "0.5345935", "text": "func (future RedisImportDataFuture) Result(client Client) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\treturn\n\t}\n\tif !done {\n\t\treturn ar, autorest.NewError(\"redis.RedisImportDataFuture\", \"Result\", \"asynchronous operation has not completed\")\n\t}\n\tif future.PollingMethod() == azure.PollingLocation {\n\t\tar, err = client.ImportDataResponder(future.Response())\n\t\treturn\n\t}\n\tvar resp *http.Response\n\tresp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif err != nil {\n\t\treturn\n\t}\n\tar, err = client.ImportDataResponder(resp)\n\treturn\n}", "title": "" }, { "docid": "1cc4633268921ff2a21a2e0b4926f6df", "score": "0.53422403", "text": "func (future *InboundNatRulesCreateOrUpdateFuture) result(client InboundNatRulesClient) (inr InboundNatRule, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.InboundNatRulesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tinr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.InboundNatRulesCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif inr.Response.Response, err = future.GetResult(sender); err == nil && inr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tinr, err = client.CreateOrUpdateResponder(inr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.InboundNatRulesCreateOrUpdateFuture\", \"Result\", inr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "4d61d930f8e51e59f33f6cb399903054", "score": "0.5341774", "text": "func (future *StaticSitesApproveOrRejectPrivateEndpointConnectionFuture) result(client StaticSitesClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trpecar.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent {\n\t\trpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.StaticSitesApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", rpecar.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "ca0738a74479e53e28d37d5a6e4ab240", "score": "0.53347236", "text": "func (future *ExpressRouteCrossConnectionPeeringsDeleteFuture) result(client ExpressRouteCrossConnectionPeeringsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionPeeringsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCrossConnectionPeeringsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "f222953bc4820cc7ac3a5b9096df0204", "score": "0.5332835", "text": "func (future *VirtualNetworkGatewayConnectionsCreateOrUpdateFuture) result(client VirtualNetworkGatewayConnectionsClient) (vngc VirtualNetworkGatewayConnection, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tvngc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif vngc.Response.Response, err = future.GetResult(sender); err == nil && vngc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tvngc, err = client.CreateOrUpdateResponder(vngc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewayConnectionsCreateOrUpdateFuture\", \"Result\", vngc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c470161c802f8eb934425a7946ce6e83", "score": "0.5328934", "text": "func (client ExpressRouteCrossConnectionsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) {\n\treq, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx)\n\tif err != nil {\n\t\treturn result, autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"listNextResults\", nil, \"Failure preparing next results request\")\n\t}\n\tif req == nil {\n\t\treturn\n\t}\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.Response = autorest.Response{Response: resp}\n\t\treturn result, autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"listNextResults\", resp, \"Failure sending next results request\")\n\t}\n\tresult, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"listNextResults\", resp, \"Failure responding to next results request\")\n\t}\n\treturn\n}", "title": "" }, { "docid": "80d4e0129c71d92fe777b0098c18224f", "score": "0.5320796", "text": "func (future *AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture) result(client AppServiceEnvironmentsClient) (rpecar RemotePrivateEndpointConnectionARMResource, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trpecar.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rpecar.Response.Response, err = future.GetResult(sender); err == nil && rpecar.Response.Response.StatusCode != http.StatusNoContent {\n\t\trpecar, err = client.ApproveOrRejectPrivateEndpointConnectionResponder(rpecar.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionFuture\", \"Result\", rpecar.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "193c59d4d0b304348f83631c532a84c0", "score": "0.5320128", "text": "func (future *AppsRestoreFromDeletedAppSlotFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsRestoreFromDeletedAppSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsRestoreFromDeletedAppSlotFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "33e207cdc48604e16210ff9f15d4b4f6", "score": "0.53089577", "text": "func (future *ExpressRouteCircuitsCreateOrUpdateFuture) result(client ExpressRouteCircuitsClient) (erc ExpressRouteCircuit, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erc.Response.Response, err = future.GetResult(sender); err == nil && erc.Response.Response.StatusCode != http.StatusNoContent {\n\t\terc, err = client.CreateOrUpdateResponder(erc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsCreateOrUpdateFuture\", \"Result\", erc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6ba5b3d0fe7c484866056814b4751a5e", "score": "0.52969104", "text": "func (future *AppsStartNetworkTraceSlotFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartNetworkTraceSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tlnt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsStartNetworkTraceSlotFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlnt, err = client.StartNetworkTraceSlotResponder(lnt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartNetworkTraceSlotFuture\", \"Result\", lnt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "6c20915a74b86e3ea867e87f613ae905", "score": "0.52925736", "text": "func (client ExpressRouteCrossConnectionsClient) List(ctx context.Context) (result ExpressRouteCrossConnectionListResultPage, err error) {\n\tif tracing.IsEnabled() {\n\t\tctx = tracing.StartSpan(ctx, fqdn+\"/ExpressRouteCrossConnectionsClient.List\")\n\t\tdefer func() {\n\t\t\tsc := -1\n\t\t\tif result.ercclr.Response.Response != nil {\n\t\t\t\tsc = result.ercclr.Response.Response.StatusCode\n\t\t\t}\n\t\t\ttracing.EndSpan(ctx, sc, err)\n\t\t}()\n\t}\n\tresult.fn = client.listNextResults\n\treq, err := client.ListPreparer(ctx)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"List\", nil, \"Failure preparing request\")\n\t\treturn\n\t}\n\n\tresp, err := client.ListSender(req)\n\tif err != nil {\n\t\tresult.ercclr.Response = autorest.Response{Response: resp}\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"List\", resp, \"Failure sending request\")\n\t\treturn\n\t}\n\n\tresult.ercclr, err = client.ListResponder(resp)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCrossConnectionsClient\", \"List\", resp, \"Failure responding to request\")\n\t\treturn\n\t}\n\tif result.ercclr.hasNextLink() && result.ercclr.IsEmpty() {\n\t\terr = result.NextWithContext(ctx)\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "bcfe9f21ed17cf7e3c7c437f1e059d21", "score": "0.52781487", "text": "func (future *WatchersCheckConnectivityFuture) result(client WatchersClient) (ci ConnectivityInformation, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.WatchersCheckConnectivityFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tci.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.WatchersCheckConnectivityFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ci.Response.Response, err = future.GetResult(sender); err == nil && ci.Response.Response.StatusCode != http.StatusNoContent {\n\t\tci, err = client.CheckConnectivityResponder(ci.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.WatchersCheckConnectivityFuture\", \"Result\", ci.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2d5f9e11ac9bef18f35ae1061e251caa", "score": "0.52770746", "text": "func (future *VirtualNetworkTapsCreateOrUpdateFuture) result(client VirtualNetworkTapsClient) (vnt VirtualNetworkTap, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkTapsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tvnt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkTapsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif vnt.Response.Response, err = future.GetResult(sender); err == nil && vnt.Response.Response.StatusCode != http.StatusNoContent {\n\t\tvnt, err = client.CreateOrUpdateResponder(vnt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkTapsCreateOrUpdateFuture\", \"Result\", vnt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "10de7c00d4845a642ecad7d61a3c1656", "score": "0.5258071", "text": "func (future *PrivateEndpointConnectionsDeleteFuture) result(client PrivateEndpointConnectionsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"iotcentral.PrivateEndpointConnectionsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"iotcentral.PrivateEndpointConnectionsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "fc1ee964dc5ad31db49338ebbd8695d2", "score": "0.5255585", "text": "func (future *VpnConnectionsDeleteFuture) result(client VpnConnectionsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VpnConnectionsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VpnConnectionsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "aa42f6b8ad945e9793ed444669bd011c", "score": "0.5253326", "text": "func (future *AppsMigrateMySQLFuture) result(client AppsClient) (o Operation, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsMigrateMySQLFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\to.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsMigrateMySQLFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif o.Response.Response, err = future.GetResult(sender); err == nil && o.Response.Response.StatusCode != http.StatusNoContent {\n\t\to, err = client.MigrateMySQLResponder(o.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsMigrateMySQLFuture\", \"Result\", o.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "24f91f97c978c923e473ba2e356c2c5e", "score": "0.52320117", "text": "func (future *ExpressRouteCircuitsDeleteFuture) result(client ExpressRouteCircuitsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "71b25cf169ff8f6da47f2f6393a7b134", "score": "0.5214553", "text": "func (future *AppsStartWebSiteNetworkTraceOperationSlotFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartWebSiteNetworkTraceOperationSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tlnt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsStartWebSiteNetworkTraceOperationSlotFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlnt, err = client.StartWebSiteNetworkTraceOperationSlotResponder(lnt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartWebSiteNetworkTraceOperationSlotFuture\", \"Result\", lnt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "42227a22100bf63e92b7ec8968f32bc0", "score": "0.5197639", "text": "func (future *AppServiceEnvironmentsChangeVnetFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsChangeVnetFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tacp.ac.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceEnvironmentsChangeVnetFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent {\n\t\tacp, err = client.ChangeVnetResponder(acp.ac.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsChangeVnetFuture\", \"Result\", acp.ac.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "eefd7be6789f767bfc2b4e699cf11669", "score": "0.51958627", "text": "func (future *AppServiceCertificateOrdersCreateOrUpdateFuture) result(client AppServiceCertificateOrdersClient) (asco AppServiceCertificateOrder, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tasco.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceCertificateOrdersCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif asco.Response.Response, err = future.GetResult(sender); err == nil && asco.Response.Response.StatusCode != http.StatusNoContent {\n\t\tasco, err = client.CreateOrUpdateResponder(asco.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersCreateOrUpdateFuture\", \"Result\", asco.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c9392f097298afbc839a4af51c75f34b", "score": "0.5193065", "text": "func (future *JobResumeFuture) Result(client JobClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.JobResumeFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"microsoftazuremanagementaisupercomputer.JobResumeFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "title": "" }, { "docid": "feda58c2e7cea79c64b44408ca6bb8d4", "score": "0.5172574", "text": "func (future *AppsRestoreFromBackupBlobSlotFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsRestoreFromBackupBlobSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsRestoreFromBackupBlobSlotFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "3a53e9b7599fe9134bcfa1640ddd90c1", "score": "0.516797", "text": "func (future *ExpressRoutePortsDeleteFuture) result(client ExpressRoutePortsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRoutePortsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRoutePortsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "ef18302afedc764c2649fb1dad327a62", "score": "0.51638585", "text": "func (future *DatabasesResumeFuture) Result(client DatabasesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.DatabasesResumeFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.DatabasesResumeFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "a141afa1c9c66b13c9290727af4986cd", "score": "0.515658", "text": "func (future *AppServiceCertificateOrdersCreateOrUpdateCertificateFuture) result(client AppServiceCertificateOrdersClient) (ascr AppServiceCertificateResource, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tascr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ascr.Response.Response, err = future.GetResult(sender); err == nil && ascr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tascr, err = client.CreateOrUpdateCertificateResponder(ascr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceCertificateOrdersCreateOrUpdateCertificateFuture\", \"Result\", ascr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "89e54e426fdda156409f4af83d128d1d", "score": "0.5152462", "text": "func (future *InterfacesDeleteFuture) result(client InterfacesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.InterfacesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.InterfacesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "cc326af98f49c6dcabfc276f515341b4", "score": "0.5149647", "text": "func (future *AppsStartNetworkTraceFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartNetworkTraceFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tlnt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsStartNetworkTraceFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlnt, err = client.StartNetworkTraceResponder(lnt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartNetworkTraceFuture\", \"Result\", lnt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "deafde6828e437cc50ecc64e7413a7bb", "score": "0.514772", "text": "func (future *ExpressRoutePortsCreateOrUpdateFuture) result(client ExpressRoutePortsClient) (erp ExpressRoutePort, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRoutePortsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terp.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRoutePortsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erp.Response.Response, err = future.GetResult(sender); err == nil && erp.Response.Response.StatusCode != http.StatusNoContent {\n\t\terp, err = client.CreateOrUpdateResponder(erp.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRoutePortsCreateOrUpdateFuture\", \"Result\", erp.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c41613a5ddb784b38a19021ab8a52199", "score": "0.51410776", "text": "func (future *AppsDeletePrivateEndpointConnectionSlotFuture) result(client AppsClient) (so SetObject, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsDeletePrivateEndpointConnectionSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tso.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsDeletePrivateEndpointConnectionSlotFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {\n\t\tso, err = client.DeletePrivateEndpointConnectionSlotResponder(so.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsDeletePrivateEndpointConnectionSlotFuture\", \"Result\", so.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "9d511969bfb976a163c1e31ff2672aad", "score": "0.5139931", "text": "func (future RedisCreateFuture) Result(client Client) (rt ResourceType, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\treturn\n\t}\n\tif !done {\n\t\treturn rt, autorest.NewError(\"redis.RedisCreateFuture\", \"Result\", \"asynchronous operation has not completed\")\n\t}\n\tif future.PollingMethod() == azure.PollingLocation {\n\t\trt, err = client.CreateResponder(future.Response())\n\t\treturn\n\t}\n\tvar resp *http.Response\n\tresp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif err != nil {\n\t\treturn\n\t}\n\trt, err = client.CreateResponder(resp)\n\treturn\n}", "title": "" }, { "docid": "c5f5d151663ee95eb92bc9305f909122", "score": "0.5134766", "text": "func (future *VirtualNetworkGatewaysGetAdvertisedRoutesFuture) result(client VirtualNetworkGatewaysClient) (grlr GatewayRouteListResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tgrlr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif grlr.Response.Response, err = future.GetResult(sender); err == nil && grlr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tgrlr, err = client.GetAdvertisedRoutesResponder(grlr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewaysGetAdvertisedRoutesFuture\", \"Result\", grlr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "b42b8d079149ae016a1a3ea32689df4e", "score": "0.512575", "text": "func (future *AppsRestoreFromDeletedAppFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsRestoreFromDeletedAppFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsRestoreFromDeletedAppFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "2a2a03de6544086098bc357f7f406f77", "score": "0.51246285", "text": "func (future RedisExportDataFuture) Result(client Client) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\treturn\n\t}\n\tif !done {\n\t\treturn ar, autorest.NewError(\"redis.RedisExportDataFuture\", \"Result\", \"asynchronous operation has not completed\")\n\t}\n\tif future.PollingMethod() == azure.PollingLocation {\n\t\tar, err = client.ExportDataResponder(future.Response())\n\t\treturn\n\t}\n\tvar resp *http.Response\n\tresp, err = autorest.SendWithSender(client, autorest.ChangeToGet(future.req),\n\t\tautorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif err != nil {\n\t\treturn\n\t}\n\tar, err = client.ExportDataResponder(resp)\n\treturn\n}", "title": "" }, { "docid": "23e2b44968467e33edb152b8204d3a6f", "score": "0.51099074", "text": "func (future *JobApproveFuture) Result(client JobClient) (ar autorest.Response, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.JobApproveFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"microsoftazuremanagementaisupercomputer.JobApproveFuture\")\n return\n }\n ar.Response = future.Response()\n return\n }", "title": "" }, { "docid": "f71fff70fdb44c2f09aabc0e75cc4b13", "score": "0.51079303", "text": "func (future *ReplicationLinksFailoverAllowDataLossFuture) Result(client ReplicationLinksClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"sql.ReplicationLinksFailoverAllowDataLossFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"sql.ReplicationLinksFailoverAllowDataLossFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "78cc11e387e807e0df340fde81170130", "score": "0.5099515", "text": "func (future *VirtualNetworkGatewayConnectionsDeleteFuture) result(client VirtualNetworkGatewayConnectionsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewayConnectionsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkGatewayConnectionsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "46f6c725e907b675c80e2f4a511224e3", "score": "0.50776327", "text": "func (future *AppServiceEnvironmentsResumeAllFuture) result(client AppServiceEnvironmentsClient) (acp AppCollectionPage, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsResumeAllFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tacp.ac.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppServiceEnvironmentsResumeAllFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif acp.ac.Response.Response, err = future.GetResult(sender); err == nil && acp.ac.Response.Response.StatusCode != http.StatusNoContent {\n\t\tacp, err = client.ResumeResponder(acp.ac.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppServiceEnvironmentsResumeAllFuture\", \"Result\", acp.ac.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "d4e0d4466a1fbd8086b0759db6a1c1d5", "score": "0.5064395", "text": "func (future *ConnectionMonitorsStartFuture) result(client ConnectionMonitorsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ConnectionMonitorsStartFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ConnectionMonitorsStartFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "13f4a649c87ddbc93c414de955df34c2", "score": "0.50625277", "text": "func (future *ServersRestartFuture) result(client ServersClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"mysqlflexibleservers.ServersRestartFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.ServersRestartFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "7bb965eb20f2a09f82e2f6d46be283cd", "score": "0.50597936", "text": "func (future *AppsSwapSlotSlotFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsSwapSlotSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsSwapSlotSlotFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "718f3c8d47297c2ca0100cd19c7f093b", "score": "0.5053485", "text": "func (future *ExpressRouteCircuitsListArpTableFuture) 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": "d17cc4e796e70dc75f03146a43986c81", "score": "0.5053023", "text": "func (future *AppsDeletePrivateEndpointConnectionFuture) result(client AppsClient) (so SetObject, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsDeletePrivateEndpointConnectionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tso.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsDeletePrivateEndpointConnectionFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif so.Response.Response, err = future.GetResult(sender); err == nil && so.Response.Response.StatusCode != http.StatusNoContent {\n\t\tso, err = client.DeletePrivateEndpointConnectionResponder(so.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsDeletePrivateEndpointConnectionFuture\", \"Result\", so.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "2a104f3babf4f710dd21ff236d57a6e8", "score": "0.5038709", "text": "func (future *AppsRestoreSlotFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsRestoreSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsRestoreSlotFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "15d69100d123e4b13c6d46fa2665ba5c", "score": "0.501396", "text": "func (future *ApplicationGatewaysStartFuture) result(client ApplicationGatewaysClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ApplicationGatewaysStartFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ApplicationGatewaysStartFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "24ba35eab69fdbd77179cb5f0086eb5c", "score": "0.5012015", "text": "func (future *AccountCreateOrUpdateFuture) Result(client AccountClient) (ard AccountResourceDescription, err error) {\n var done bool\n done, err = future.DoneWithContext(context.Background(), client)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.AccountCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n return\n }\n if !done {\n err = azure.NewAsyncOpIncompleteError(\"microsoftazuremanagementaisupercomputer.AccountCreateOrUpdateFuture\")\n return\n }\n sender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n if ard.Response.Response, err = future.GetResult(sender); err == nil && ard.Response.Response.StatusCode != http.StatusNoContent {\n ard, err = client.CreateOrUpdateResponder(ard.Response.Response)\n if err != nil {\n err = autorest.NewErrorWithError(err, \"microsoftazuremanagementaisupercomputer.AccountCreateOrUpdateFuture\", \"Result\", ard.Response.Response, \"Failure responding to request\")\n }\n }\n return\n }", "title": "" }, { "docid": "c9a07b4020e01a0d140d72e313a07b03", "score": "0.49861035", "text": "func (future *AppsSwapSlotWithProductionFuture) result(client AppsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsSwapSlotWithProductionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsSwapSlotWithProductionFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "a4c56cec945ee03fbcec7e8a41923282", "score": "0.49778306", "text": "func (future *FirewallRulesDeleteFuture) result(client FirewallRulesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"mysqlflexibleservers.FirewallRulesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"mysqlflexibleservers.FirewallRulesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "d123de1214adb0ac399c9b2fd937cf3a", "score": "0.49728456", "text": "func (future *DatabaseAccountsOnlineRegionFuture) Result(client DatabaseAccountsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.Done(client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"documentdb.DatabaseAccountsOnlineRegionFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terr = azure.NewAsyncOpIncompleteError(\"documentdb.DatabaseAccountsOnlineRegionFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "c86fa625ba0f28119059fe6f99c478da", "score": "0.4972663", "text": "func (future *ReplicationRecoveryPlansTestFailoverFuture) result(client ReplicationRecoveryPlansClient) (rp RecoveryPlan, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationRecoveryPlansTestFailoverFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trp.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"siterecovery.ReplicationRecoveryPlansTestFailoverFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent {\n\t\trp, err = client.TestFailoverResponder(rp.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationRecoveryPlansTestFailoverFuture\", \"Result\", rp.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "36ecc66bce5e00f8f68f0c1218892a36", "score": "0.49704182", "text": "func (future *ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture) result(client ExpressRouteCircuitAuthorizationsClient) (erca ExpressRouteCircuitAuthorization, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\terca.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif erca.Response.Response, err = future.GetResult(sender); err == nil && erca.Response.Response.StatusCode != http.StatusNoContent {\n\t\terca, err = client.CreateOrUpdateResponder(erca.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitAuthorizationsCreateOrUpdateFuture\", \"Result\", erca.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c32c62affe2c16e4056afdf79121dc4f", "score": "0.4970381", "text": "func (future *NatGatewaysDeleteFuture) result(client NatGatewaysClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.NatGatewaysDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.NatGatewaysDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "555bf369f059af4a937ceae9014dc14b", "score": "0.49699965", "text": "func (client ExpressRouteCrossConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) {\n\terr = autorest.Respond(\n\t\tresp,\n\t\tazure.WithErrorUnlessStatusCode(http.StatusOK),\n\t\tautorest.ByUnmarshallingJSON(&result),\n\t\tautorest.ByClosing())\n\tresult.Response = autorest.Response{Response: resp}\n\treturn\n}", "title": "" }, { "docid": "0cfc4edb5fd80d699f156873c0789d0d", "score": "0.4969494", "text": "func (future *ReplicationRecoveryPlansUnplannedFailoverFuture) result(client ReplicationRecoveryPlansClient) (rp RecoveryPlan, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationRecoveryPlansUnplannedFailoverFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\trp.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"siterecovery.ReplicationRecoveryPlansUnplannedFailoverFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif rp.Response.Response, err = future.GetResult(sender); err == nil && rp.Response.Response.StatusCode != http.StatusNoContent {\n\t\trp, err = client.UnplannedFailoverResponder(rp.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationRecoveryPlansUnplannedFailoverFuture\", \"Result\", rp.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "c97d5419c73c07ce13cf2cb778cda19d", "score": "0.49688485", "text": "func (future *VirtualNetworkGatewayConnectionsSetSharedKeyFuture) result(client VirtualNetworkGatewayConnectionsClient) (csk ConnectionSharedKey, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tcsk.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif csk.Response.Response, err = future.GetResult(sender); err == nil && csk.Response.Response.StatusCode != http.StatusNoContent {\n\t\tcsk, err = client.SetSharedKeyResponder(csk.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkGatewayConnectionsSetSharedKeyFuture\", \"Result\", csk.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e1da0b528b1e3bdf59cef112aed230da", "score": "0.49625832", "text": "func (future *ReplicationvCentersCreateFuture) result(client ReplicationvCentersClient) (vc VCenter, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationvCentersCreateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tvc.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"siterecovery.ReplicationvCentersCreateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif vc.Response.Response, err = future.GetResult(sender); err == nil && vc.Response.Response.StatusCode != http.StatusNoContent {\n\t\tvc, err = client.CreateResponder(vc.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"siterecovery.ReplicationvCentersCreateFuture\", \"Result\", vc.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "7afba36b7cdb14205cccb7a7ecb88dcf", "score": "0.49559802", "text": "func (future *AppliancesDeleteFuture) result(client AppliancesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"resourceconnector.AppliancesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"resourceconnector.AppliancesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "15fdaf6a3ab078678d585bf726c39a5c", "score": "0.4951059", "text": "func (future *BastionHostsDeleteFuture) result(client BastionHostsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.BastionHostsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.BastionHostsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "ae6d34e448036d90849444fd89183dcc", "score": "0.49464855", "text": "func (future *ExpressRouteCircuitPeeringsDeleteFuture) result(client ExpressRouteCircuitPeeringsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitPeeringsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitPeeringsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "b42990d3c7d008719aa73438960646ad", "score": "0.49448526", "text": "func (future *VirtualNetworksDeleteFuture) result(client VirtualNetworksClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworksDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworksDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "578e213acae128d08e5b3b25dc1e1d62", "score": "0.49446493", "text": "func (future *VirtualNetworkTapsDeleteFuture) result(client VirtualNetworkTapsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.VirtualNetworkTapsDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.VirtualNetworkTapsDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "50c291ea6dba2f1ab8c83d6bed862112", "score": "0.49406242", "text": "func (future *PublicIPPrefixesDeleteFuture) result(client PublicIPPrefixesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.PublicIPPrefixesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.PublicIPPrefixesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "f2f851f3bbb115bf2f3ac2201ff6c839", "score": "0.49358603", "text": "func (future *PublicIPAddressesCreateOrUpdateFuture) result(client PublicIPAddressesClient) (pia PublicIPAddress, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.PublicIPAddressesCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tpia.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.PublicIPAddressesCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif pia.Response.Response, err = future.GetResult(sender); err == nil && pia.Response.Response.StatusCode != http.StatusNoContent {\n\t\tpia, err = client.CreateOrUpdateResponder(pia.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.PublicIPAddressesCreateOrUpdateFuture\", \"Result\", pia.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "bfbb2e3b604c6becad20ed97120e444b", "score": "0.49322507", "text": "func (future *ConnectionMonitorsQueryFuture) result(client ConnectionMonitorsClient) (cmqr ConnectionMonitorQueryResult, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ConnectionMonitorsQueryFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tcmqr.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ConnectionMonitorsQueryFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif cmqr.Response.Response, err = future.GetResult(sender); err == nil && cmqr.Response.Response.StatusCode != http.StatusNoContent {\n\t\tcmqr, err = client.QueryResponder(cmqr.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ConnectionMonitorsQueryFuture\", \"Result\", cmqr.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "690027b02bdc7013069fdf0cb5308f87", "score": "0.4923079", "text": "func (future *PublicIPAddressesDeleteFuture) result(client PublicIPAddressesClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.PublicIPAddressesDeleteFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.PublicIPAddressesDeleteFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "62c3be5763d3ed577e72667186a1ad66", "score": "0.49219677", "text": "func (future *AppsCreateInstanceFunctionSlotFuture) result(client AppsClient) (fe FunctionEnvelope, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsCreateInstanceFunctionSlotFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tfe.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsCreateInstanceFunctionSlotFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif fe.Response.Response, err = future.GetResult(sender); err == nil && fe.Response.Response.StatusCode != http.StatusNoContent {\n\t\tfe, err = client.CreateInstanceFunctionSlotResponder(fe.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsCreateInstanceFunctionSlotFuture\", \"Result\", fe.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "76ecbbb0db2267e7e94f51e4936f829a", "score": "0.49202004", "text": "func (future *AppsStartWebSiteNetworkTraceOperationFuture) result(client AppsClient) (lnt ListNetworkTrace, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartWebSiteNetworkTraceOperationFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tlnt.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"web.AppsStartWebSiteNetworkTraceOperationFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif lnt.Response.Response, err = future.GetResult(sender); err == nil && lnt.Response.Response.StatusCode != http.StatusNoContent {\n\t\tlnt, err = client.StartWebSiteNetworkTraceOperationResponder(lnt.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"web.AppsStartWebSiteNetworkTraceOperationFuture\", \"Result\", lnt.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "47c10694491363f31cd98efa8dafb63a", "score": "0.49183547", "text": "func (future *SubnetsPrepareNetworkPoliciesFuture) result(client SubnetsClient) (ar autorest.Response, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.SubnetsPrepareNetworkPoliciesFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tar.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.SubnetsPrepareNetworkPoliciesFuture\")\n\t\treturn\n\t}\n\tar.Response = future.Response()\n\treturn\n}", "title": "" }, { "docid": "c072dc2ab834e2430c36c3323dea8c1b", "score": "0.49129418", "text": "func (future *ExpressRouteCircuitPeeringsCreateOrUpdateFuture) result(client ExpressRouteCircuitPeeringsClient) (ercp ExpressRouteCircuitPeering, err error) {\n\tvar done bool\n\tdone, err = future.DoneWithContext(context.Background(), client)\n\tif err != nil {\n\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture\", \"Result\", future.Response(), \"Polling failure\")\n\t\treturn\n\t}\n\tif !done {\n\t\tercp.Response.Response = future.Response()\n\t\terr = azure.NewAsyncOpIncompleteError(\"network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture\")\n\t\treturn\n\t}\n\tsender := autorest.DecorateSender(client, autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n\tif ercp.Response.Response, err = future.GetResult(sender); err == nil && ercp.Response.Response.StatusCode != http.StatusNoContent {\n\t\tercp, err = client.CreateOrUpdateResponder(ercp.Response.Response)\n\t\tif err != nil {\n\t\t\terr = autorest.NewErrorWithError(err, \"network.ExpressRouteCircuitPeeringsCreateOrUpdateFuture\", \"Result\", ercp.Response.Response, \"Failure responding to request\")\n\t\t}\n\t}\n\treturn\n}", "title": "" } ]
24c7de50c381d7364d7026c5e7428e53
Execute starts pseudo terminal. It reads incoming message from data channel and writes to pty.stdin. It reads message from pty.stdout and writes to data channel
[ { "docid": "9f0d533f5aa48827bbc8339a5ec7dac4", "score": "0.5346151", "text": "func (p *ShellPlugin) Execute(context context.T,\n\tconfig agentContracts.Configuration,\n\tcancelFlag task.CancelFlag,\n\toutput iohandler.IOHandler,\n\tdataChannel datachannel.IDataChannel) {\n\n\tlog := context.Log()\n\tp.dataChannel = dataChannel\n\tdefer func() {\n\t\tif err := Stop(log); err != nil {\n\t\t\tlog.Errorf(\"Error occured while closing pty: %v\", err)\n\t\t}\n\t\tif err := recover(); err != nil {\n\t\t\tlog.Errorf(\"Error occurred while executing plugin %s: \\n%v\", p.name(), err)\n\t\t\tlog.Flush()\n\t\t\tos.Exit(1)\n\t\t}\n\t}()\n\n\tif cancelFlag.ShutDown() {\n\t\toutput.MarkAsShutdown()\n\t} else if cancelFlag.Canceled() {\n\t\toutput.MarkAsCancelled()\n\t} else {\n\t\tp.execute(context, config, cancelFlag, output)\n\t}\n}", "title": "" } ]
[ { "docid": "459c2a502481d7b5278768373b016415", "score": "0.680286", "text": "func (p *Pty) Run() error {\n\tif err := p.Start(); err != nil {\n\t\treturn err\n\t}\n\n\tgo io.Copy(p.TTY, p.Ptm)\n\n\t// The 1 byte for IO may seem weird, but ptys are for human interaction\n\t// and, let's face it, we don't all type fast.\n\tgo func() {\n\t\tvar data [1]byte\n\t\tfor {\n\t\t\tif _, err := p.TTY.Read(data[:]); err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\t// Log the error but it may be transient.\n\t\t\tif _, err := p.Ptm.Write(data[:]); err != nil {\n\t\t\t\tfmt.Fprintf(p.C.Stderr, \"Error writing input to ptm: %v: give up\\n\", err)\n\t\t\t}\n\t\t}\n\t}()\n\treturn p.Wait()\n}", "title": "" }, { "docid": "ff89f9f78d857a5c6e4dac4b7bc5c080", "score": "0.66776973", "text": "func (t *Terminal) Run() error {\n\n\tif os.Getenv(\"SHOX\") != \"\" {\n\t\treturn fmt.Errorf(\"shox is already running in this terminal\")\n\t}\n\n\t_ = os.Setenv(\"SHOX\", \"1\")\n\n\tt.proxy.Start()\n\tdefer t.proxy.Close()\n\tt.proxy.Write([]byte(\"\\033c\")) // reset term\n\n\t// Create arbitrary command.\n\tc := exec.Command(t.shell)\n\n\t// Start the command with a pty.\n\tptmx, err := pty.Start(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Make sure to close the pty at the end.\n\tdefer func() { _ = ptmx.Close() }() // Best effort.\n\n\t// Handle pty size.\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGWINCH)\n\tgo func() {\n\t\tfor range ch {\n\n\t\t\tsize, err := pty.GetsizeFull(os.Stdin)\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\trows, cols := t.proxy.HandleResize(size.Rows, size.Cols)\n\t\t\tsize.Rows = rows\n\t\t\tsize.Cols = cols\n\n\t\t\tif err := pty.Setsize(ptmx, size); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// successful resize\n\t\t}\n\t}()\n\tch <- syscall.SIGWINCH // Initial resize.\n\n\t// Set stdin in raw mode.\n\toldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer func() { _ = terminal.Restore(int(os.Stdin.Fd()), oldState) }() // Best effort.\n\n\t// Copy stdin to the pty and the pty to stdout.\n\tgo func() { _, _ = io.Copy(ptmx, os.Stdin) }()\n\tgo func() { _, _ = io.Copy(os.Stdout, t.proxy) }()\n\t_, _ = io.Copy(t.proxy, ptmx)\n\tfmt.Printf(\"\\r\\n\")\n\treturn nil\n}", "title": "" }, { "docid": "491b0b9391bc966e323e0932d692bd9a", "score": "0.63530606", "text": "func RunCommandInPseudoTerminal(name string, args ...string) ([]byte, error) {\n\tvar errors = []error{}\n\n\t// Convenience hack in case command contains a space, for example in case\n\t// typical construct like \"foo | grep\" are used.\n\tif strings.Contains(name, \" \") {\n\t\targs = []string{\n\t\t\t\"-c\",\n\t\t\tstrings.Join(append(\n\t\t\t\t[]string{name},\n\t\t\t\targs...,\n\t\t\t), \" \"),\n\t\t}\n\t\tname = \"/bin/sh\"\n\t}\n\n\tpt, err := pty.Start(exec.Command(name, args...))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer func() {\n\t\t_ = pt.Close()\n\t}()\n\n\t// Support terminal resizing\n\tch := make(chan os.Signal, 1)\n\tsignal.Notify(ch, syscall.SIGWINCH)\n\tgo func() {\n\t\tfor range ch {\n\t\t\tif err := pty.InheritSize(os.Stdin, pt); err != nil {\n\t\t\t\terrors = append(errors, wrap.Error(err, \"error resizing PTY\"))\n\t\t\t}\n\t\t}\n\t}()\n\tch <- syscall.SIGWINCH\n\n\t// Set RAW mode for stdin\n\toldState, err := terminal.MakeRaw(int(os.Stdin.Fd()))\n\tif err != nil {\n\t\treturn nil, wrap.Errorf(err, \"failed to enable RAW mode for stdin\")\n\t}\n\n\t// Make sure to restore the original mode\n\tdefer func() {\n\t\t_ = terminal.Restore(int(os.Stdin.Fd()), oldState)\n\t}()\n\n\tgo func() {\n\t\tif _, err := io.Copy(pt, os.Stdin); err != nil {\n\t\t\terrors = append(errors, err)\n\t\t}\n\t}()\n\n\tvar buf bytes.Buffer\n\t_, err = io.Copy(io.MultiWriter(os.Stdout, &buf), pt)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif len(errors) > 0 {\n\t\tfmt.Fprintf(os.Stderr, \"issues in backgroup tasks:\\n\")\n\t\tfor _, err := range errors {\n\t\t\tfmt.Fprintf(os.Stderr, \"- %v\\n\", err.Error())\n\t\t}\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "243209ef108dab1c5e31f62ad442a978", "score": "0.62175226", "text": "func (e *Command) StartPty(tm io.ReadWriteCloser, TERM string, resizeChan <-chan term.WindowSize) error {\n\te.m.Lock()\n\tdefer e.m.Unlock()\n\n\tif e.state != commandStateInit {\n\t\treturn errCommandNotInitialized\n\t}\n\tif !e.isPty {\n\t\treturn errCommandNotATerminal\n\t}\n\n\te.state = commandStateStart\n\n\t// protect against callers that pass resizeChan === nil.\n\tif resizeChan == nil {\n\t\tc := make(chan term.WindowSize)\n\t\tclose(c)\n\t\tresizeChan = c\n\t}\n\n\t// Start process on the terminal\n\tf, err := e.Process.Start(TERM, resizeChan, true)\n\tif err != nil {\n\t\treturn err\n\t}\n\te.pty = f\n\n\t// start copying both ways and close when done.\n\ttc := NewDualCloser(tm)\n\tgo func() {\n\t\tdefer tc.CloseWrite()\n\t\tio.Copy(tm, f.ReadWriteCloser())\n\t}()\n\tgo func() {\n\t\tdefer tc.Close()\n\t\tio.Copy(f.ReadWriteCloser(), tm)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "8741f6eeab651ae1b885c7e6738d7fcc", "score": "0.6118869", "text": "func (s *Shell) Execute() {\n\ts.startShell()\n\n\t//Stdin\n\tgo func() {\n\t\tfor {\n\t\t\tcommandInput := <-s.stdIn\n\t\t\tfmt.Println(\"Write data to stdin\")\n\t\t\t_, err := s.cmdStdinWriter.Write([]byte(commandInput))\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\t//Stdout\n\tstdoutData := make([]byte, 32767)\n\tgo func() {\n\t\tfor {\n\t\t\tn, err := s.cmdStdoutReader.Read(stdoutData)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\ts.stdOut <- stdoutData[:n]\n\t\t}\n\t}()\n}", "title": "" }, { "docid": "49a6945d4b3dd4ea532448a58caae1a7", "score": "0.6022501", "text": "func (tty *TTYAgent) Run() {\n\treader := bufio.NewReader(os.Stdin)\n\ttty.isActive = true\n\tfor tty.isActive {\n\t\tfor tty.block {\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\t\t}\n\t\tfmt.Printf(\"> \")\n\t\t// Read the keyboad input and check for validity\n\t\tinput, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Invalid command\\n\")\n\t\t\tcontinue\n\t\t}\n\t\treqSlice := strings.SplitN(strings.TrimSpace(input), \" \", 3)\n\t\tvar req string\n\t\tswitch reqSlice[0] {\n\t\tcase \"put\":\n\t\t\tif len(reqSlice) != 3 {\n\t\t\t\tfmt.Printf(\"Invalid command\\n\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treq = fmt.Sprintf(\"put %s %s\", reqSlice[1], reqSlice[2])\n\t\tcase \"get\":\n\t\t\tif len(reqSlice) != 2 {\n\t\t\t\tfmt.Printf(\"Invalid command\\n\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treq = fmt.Sprintf(\"get %s\", reqSlice[1])\n\t\tdefault:\n\t\t\tfmt.Printf(\"Invalid command\\n\")\n\t\t\tcontinue\n\t\t}\n\t\t// Command is valid. Send to client and wait for response\n\t\ttty.block = true\n\t\ttty.send(1, req)\n\t}\n}", "title": "" }, { "docid": "51c0ae06df6fdb0d7132a55cf72631d0", "score": "0.6003364", "text": "func main() {\n\tev := eval.NewEvaluator()\n\tcmdNum := 0\n\n\tusername := \"???\"\n\tuser, err := user.Current()\n\tif err == nil {\n\t\tusername = user.Username\n\t}\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\thostname = \"???\"\n\t}\n\trpromptStr := username + \"@\" + hostname\n\n\tsigch := make(chan os.Signal, sigchSize)\n\tsignal.Notify(sigch)\n\n\ted := edit.NewEditor(os.Stdin, ev, sigch)\n\n\tfor {\n\t\tcmdNum++\n\t\tname := fmt.Sprintf(\"<tty %d>\", cmdNum)\n\n\t\tprompt := func() string {\n\t\t\treturn util.Getwd() + \"> \"\n\t\t}\n\t\trprompt := func() string {\n\t\t\treturn rpromptStr\n\t\t}\n\n\t\tlr := ed.ReadLine(prompt, rprompt)\n\n\t\tif lr.EOF {\n\t\t\tbreak\n\t\t} else if lr.Err != nil {\n\t\t\tfmt.Println(\"Editor error:\", lr.Err)\n\t\t\tfmt.Println(\"My pid is\", os.Getpid())\n\t\t}\n\n\t\tn, pe := parse.Parse(name, lr.Line)\n\t\tif pe != nil {\n\t\t\tfmt.Print(pe.(*util.ContextualError).Pprint())\n\t\t\tcontinue\n\t\t}\n\n\t\tee := ev.Eval(name, lr.Line, n)\n\t\tif ee != nil {\n\t\t\tfmt.Print(ee.(*util.ContextualError).Pprint())\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b6fe52d41069a2d7a6449c7cd093b07f", "score": "0.5906768", "text": "func (e *Command) Start(Out, Err io.Writer, In io.Reader) error {\n\te.m.Lock()\n\tdefer e.m.Unlock()\n\n\tif e.state != commandStateInit {\n\t\treturn errCommandIsATerminal\n\t}\n\tif e.isPty {\n\t\treturn errCommandIsATerminal\n\t}\n\n\te.state = commandStateStart\n\n\t// fetch all the streams\n\tstdin, err := e.Process.Stdin()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstdout, err := e.Process.Stdout()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstderr, err := e.Process.Stderr()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// copy over input and output\n\tgo func() {\n\t\tdefer stdin.Close()\n\t\tio.Copy(stdin, In)\n\t}()\n\n\tgo func() {\n\t\tdefer stdout.Close()\n\t\tio.Copy(Out, stdout)\n\t}()\n\n\tgo func() {\n\t\tdefer stderr.Close()\n\t\tio.Copy(Err, stderr)\n\t}()\n\n\t// Start the process\n\t_, err = e.Process.Start(\"\", nil, false)\n\treturn err\n}", "title": "" }, { "docid": "303d4aa9d44b7d23d5305e5f75911f14", "score": "0.58061713", "text": "func serveTerminal(connection ssh.Channel) {\n\n\tif config.DEBUG {\n\t\tlog.Print(\"Spawning shell now\")\n\t}\n\n\t// run cmd on background and connect session to it\n\tcmd := exec.Command(\"cmd\")\n\tcmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}\n\n\t// stdin doesnt seem to get written to the shell...\n\tcmd.Stdin = connection\n\tcmd.Stdout = connection\n\tcmd.Stderr = connection\n\n\tcmd.Run()\n\n\tif config.DEBUG {\n\t\tlog.Printf(\"Cmd exited. closing connection\")\n\t}\n}", "title": "" }, { "docid": "88f748a2eebb515c332d8e36d4600b64", "score": "0.5779102", "text": "func (rs *RemoteShell) Start() error {\n\tsession, err := rs.client.NewSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\n\tif rs.stdin == nil {\n\t\tsession.Stdin = os.Stdin\n\t} else {\n\t\tsession.Stdin = rs.stdin\n\t}\n\tif rs.stdout == nil {\n\t\tsession.Stdout = os.Stdout\n\t} else {\n\t\tsession.Stdout = rs.stdout\n\t}\n\tif rs.stderr == nil {\n\t\tsession.Stderr = os.Stderr\n\t} else {\n\t\tsession.Stderr = rs.stderr\n\t}\n\n\tif rs.requestPty {\n\t\ttc := rs.terminalConfig\n\t\tif tc == nil {\n\t\t\ttc = &TerminalConfig{\n\t\t\t\tTerm: \"xterm\",\n\t\t\t\tHeight: 40,\n\t\t\t\tWeight: 80,\n\t\t\t}\n\t\t}\n\t\tif err := session.RequestPty(tc.Term, tc.Height, tc.Weight, tc.Modes); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := session.Shell(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := session.Wait(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6377971a4c0c2e1ee96017489a32a6c9", "score": "0.57710683", "text": "func (c *Communicator) Start(cmd *remote.Cmd) error {\n\tcmd.Init()\n\n\tsession, err := c.newSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Set up our session\n\tsession.Stdin = cmd.Stdin\n\tsession.Stdout = cmd.Stdout\n\tsession.Stderr = cmd.Stderr\n\n\tif !c.config.noPty && c.connInfo.TargetPlatform != TargetPlatformWindows {\n\t\t// Request a PTY\n\t\ttermModes := ssh.TerminalModes{\n\t\t\tssh.ECHO: 0, // do not echo\n\t\t\tssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud\n\t\t\tssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud\n\t\t}\n\n\t\tif err := session.RequestPty(\"xterm\", 80, 40, termModes); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tlog.Printf(\"[DEBUG] starting remote command: %s\", cmd.Command)\n\terr = session.Start(strings.TrimSpace(cmd.Command) + \"\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Start a goroutine to wait for the session to end and set the\n\t// exit boolean and status.\n\tgo func() {\n\t\tdefer session.Close()\n\n\t\terr := session.Wait()\n\t\texitStatus := 0\n\t\tif err != nil {\n\t\t\texitErr, ok := err.(*ssh.ExitError)\n\t\t\tif ok {\n\t\t\t\texitStatus = exitErr.ExitStatus()\n\t\t\t}\n\t\t}\n\n\t\tcmd.SetExitStatus(exitStatus, err)\n\t\tlog.Printf(\"[DEBUG] remote command exited with '%d': %s\", exitStatus, cmd.Command)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "4258a0c338e21cc5eb36d5b9b94284a3", "score": "0.5723552", "text": "func (p *Pty) Start() error {\n\ttty, err := termios.New()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif p.WS, err = tty.GetWinSize(); err != nil {\n\t\treturn err\n\t}\n\n\tif p.Restorer, err = tty.Raw(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := p.C.Start(); err != nil {\n\t\ttty.Set(p.Restorer)\n\t\treturn err\n\t}\n\tp.Kid = p.C.Process.Pid\n\n\t// We make a good faith effort to set the\n\t// WinSize of the Pts, but it's not a deal breaker\n\t// if we can't do it.\n\tif err := termios.SetWinSize(p.Pts.Fd(), p.WS); err != nil {\n\t\tfmt.Fprintf(p.C.Stderr, \"SetWinSize of Pts: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "10685c9d84fbb631942b797fc39f357b", "score": "0.5720802", "text": "func pseudoShell(so, se io.Reader, si io.Writer, done chan struct{}) (in chan command, out chan CommandResult, errch chan error) {\n\n\tin = make(chan command, 1)\n\tout = make(chan CommandResult)\n\terrch = make(chan error, 2)\n\tch := make(chan bool)\n\tinitch := make(chan struct{})\n\n\tcur := PS1\n\tin <- PS1\n\n\t// stdin\n\tgo func() {\n\t\t// fmt.Println(\"[DEBUG] STDIN Start\")\n\t\tdefer close(out)\n\t\tdefer func() {\n\t\t\t// fmt.Println(\"[DEBUG] STDIN Exit\")\n\t\t\t_, err := si.Write([]byte(fmt.Sprintf(\"exit\\n\")))\n\t\t\tif err != nil {\n\t\t\t\terrch <- err\n\t\t\t}\n\t\t}()\n\t\tselect {\n\t\tcase <-initch:\n\t\tcase <-done:\n\t\t\treturn\n\t\t}\n\t\t// defer fmt.Println(\"[DEBUG] STDIN EXIT\")\n\t\tfor cmd := range in {\n\t\t\tcur = cmd\n\t\t\t// fmt.Println(\"[DEBUG] STDIN Write:\", cmd.Cmd)\n\t\t\t_, err := si.Write([]byte(fmt.Sprintf(\"%s\\n\", cmd.Cmd)))\n\t\t\tif err != nil {\n\t\t\t\terrch <- err\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-done:\n\t\t\t\treturn\n\t\t\tcase _, ok := <-ch:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\t// stdout\n\tgo func() {\n\t\tdefer close(ch)\n\t\t// fmt.Println(\"[DEBUG] STDOUT Start\")\n\t\t// defer fmt.Println(\"[DEBUG] STDOUT Exit\")\n\t\tvar (\n\t\t\ttotal, prebuf []byte\n\t\t\tbuf []byte = make([]byte, 1024*1024)\n\t\t\tinit bool = false\n\t\t\tpn int\n\t\t)\n\n\t\tfor {\n\t\t\tn, err := so.Read(buf[0:])\n\t\t\tif err != nil {\n\t\t\t\tif err != io.EOF {\n\t\t\t\t\terrch <- err\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif n == 0 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif !init {\n\t\t\t\tclose(initch)\n\t\t\t\tinit = true\n\t\t\t}\n\t\t\t// fmt.Println(\"[DEBUG]OUTPUT:\", string(buf[:n]))\n\t\t\ttotal = append(total, buf[:n]...)\n\t\t\ttmp, code, err := handle(prebuf[:pn], buf[:n], cur, si)\n\t\t\tpn = len(tmp)\n\t\t\tprebuf = make([]byte, pn)\n\t\t\tcopy(prebuf, tmp)\n\t\t\tpn = len(prebuf)\n\t\t\tif code != -1 {\n\t\t\t\tif cur.Cmd != PS1.Cmd {\n\t\t\t\t\tselect {\n\t\t\t\t\tcase <-done:\n\t\t\t\t\t\treturn\n\t\t\t\t\tcase out <- cur.result(removeCommandAndPS1(total, cur.Cmd), code):\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ttotal = total[:0]\n\t\t\t\tprebuf = prebuf[:0]\n\t\t\t\tpn=0\n\t\t\t\tch <- true\n\t\t\t}\n\t\t}\n\t}()\n\n\t// stderr\n\tgo func() {\n\t\t// fmt.Println(\"[DEBUG] STDERR Start\")\n\t\t// defer fmt.Println(\"[DEBUG] STDERR EXIT\")\n\t\tvar s scanner.Scanner\n\t\ts.Init(se)\n\t\tvar tok rune\n\t\tfor tok != scanner.EOF {\n\t\t\ttok = s.Scan()\n\t\t\t// fmt.Println(\"At position\", s.Pos(), \":\", s.TokenText())\n\t\t}\n\t}()\n\treturn\n}", "title": "" }, { "docid": "90fdaf8856fa07fdfb0419d00d613d78", "score": "0.5679547", "text": "func PtyRun(c *exec.Cmd, tty *os.File) (err error) {\n\tdefer tty.Close()\n\tc.Stdout = tty\n\tc.Stdin = tty\n\tc.Stderr = tty\n\tc.SysProcAttr = &syscall.SysProcAttr{Setctty: true, Setsid: true}\n\treturn c.Start()\n}", "title": "" }, { "docid": "afbb052a9cdd9c5ed611847ba1620069", "score": "0.56541985", "text": "func StartPty(\n\tlog log.T,\n\tshellProps mgsContracts.ShellProperties,\n\tisSessionLogger bool,\n\tconfig agentContracts.Configuration) (stdin *os.File, stdout *os.File, err error) {\n\tlog.Info(\"Starting winpty\")\n\tif _, err := os.Stat(winptyDllFilePath); os.IsNotExist(err) {\n\t\treturn nil, nil, fmt.Errorf(\"Missing %s file.\", winptyDllFilePath)\n\t}\n\n\tvar finalCmd string\n\tif strings.TrimSpace(shellProps.Windows.Commands) == \"\" || isSessionLogger {\n\t\tfinalCmd = winptyCmd\n\t} else {\n\t\tfinalCmd = winptyCmd + \" \" + shellProps.Windows.Commands\n\t}\n\n\tappConfig, _ := appconfig.Config(false)\n\n\tif !shellProps.Windows.RunAsElevated && !isSessionLogger && !appConfig.Agent.ContainerMode {\n\t\t// Reset password for default ssm user\n\t\tvar newPassword string\n\t\tnewPassword, err = u.GeneratePasswordForDefaultUser()\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tvar userExists bool\n\t\tif userExists, err = u.ChangePassword(appconfig.DefaultRunAsUserName, newPassword); err != nil {\n\t\t\tlog.Errorf(\"Failed to generate new password for %s: %v\", appconfig.DefaultRunAsUserName, err)\n\t\t\treturn\n\t\t}\n\n\t\t// create ssm-user before starting a new session\n\t\tif !userExists {\n\t\t\tif newPassword, err = u.CreateLocalAdminUser(log); err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"Failed to create user %s: %v\", appconfig.DefaultRunAsUserName, err)\n\t\t\t}\n\t\t} else {\n\t\t\t// enable user\n\t\t\tif err = u.EnableLocalUser(log); err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"Failed to enable user %s: %v\", appconfig.DefaultRunAsUserName, err)\n\t\t\t}\n\t\t}\n\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(1)\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\terr = startPtyAsUser(log, appconfig.DefaultRunAsUserName, newPassword, finalCmd)\n\t\t}()\n\t\twg.Wait()\n\t} else {\n\t\tpty, err = winpty.Start(winptyDllFilePath, finalCmd, defaultConsoleCol, defaultConsoleRow, winpty.DEFAULT_WINPTY_FLAGS)\n\t}\n\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn pty.StdIn, pty.StdOut, err\n}", "title": "" }, { "docid": "a3676ec9983a771de7128d8583c641b8", "score": "0.56507105", "text": "func (ns *NodeSession) runCommand(ctx context.Context, cmd []string, callback ShellCreatedCallback, interactive bool) error {\n\t// If stdin is not a terminal, refuse to allocate terminal on the server and\n\t// fallback to non-interactive mode\n\tif interactive && ns.stdin == os.Stdin && !term.IsTerminal(os.Stdin.Fd()) {\n\t\tinteractive = false\n\t\tfmt.Fprintf(os.Stderr, \"TTY will not be allocated on the server because stdin is not a terminal\\n\")\n\t}\n\n\t// Start a interactive session (\"exec\" request with a TTY).\n\t//\n\t// Note that because a TTY was allocated, the terminal is in raw mode and any\n\t// keyboard based signals will be propogated to the TTY on the server which is\n\t// where all signal handling will occur.\n\tif interactive {\n\t\treturn ns.interactiveSession(func(s *ssh.Session, term io.ReadWriteCloser) error {\n\t\t\terr := s.Start(strings.Join(cmd, \" \"))\n\t\t\tif err != nil {\n\t\t\t\treturn trace.Wrap(err)\n\t\t\t}\n\t\t\tif callback != nil {\n\t\t\t\texit, err := callback(s, ns.NodeClient().Client, term)\n\t\t\t\tif exit {\n\t\t\t\t\treturn trace.Wrap(err)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t})\n\t}\n\n\t// Start a non-interactive session (\"exec\" request without TTY).\n\t//\n\t// Note that for non-interactive sessions upon receipt of SIGINT the client\n\t// should send a SSH_MSG_DISCONNECT and shut itself down as gracefully as\n\t// possible. This is what the RFC recommends and what OpenSSH does:\n\t//\n\t// * https://tools.ietf.org/html/rfc4253#section-11.1\n\t// * https://github.com/openssh/openssh-portable/blob/05046d907c211cb9b4cd21b8eff9e7a46cd6c5ab/clientloop.c#L1195-L1444\n\t//\n\t// Unfortunately at the moment the Go SSH library Teleport uses does not\n\t// support sending SSH_MSG_DISCONNECT. Instead we close the SSH channel and\n\t// SSH client, and try and exit as gracefully as possible.\n\treturn ns.regularSession(func(s *ssh.Session) error {\n\t\tvar err error\n\n\t\trunContext, cancel := context.WithCancel(context.Background())\n\t\tgo func() {\n\t\t\tdefer cancel()\n\t\t\terr = s.Run(strings.Join(cmd, \" \"))\n\t\t}()\n\n\t\tselect {\n\t\t// Run returned a result, return that back to the caller.\n\t\tcase <-runContext.Done():\n\t\t\treturn trace.Wrap(err)\n\t\t// The passed in context timed out. This is often due to the user hitting\n\t\t// Ctrl-C.\n\t\tcase <-ctx.Done():\n\t\t\terr = s.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Debugf(\"Unable to close SSH channel: %v\", err)\n\t\t\t}\n\t\t\terr = ns.NodeClient().Client.Close()\n\t\t\tif err != nil {\n\t\t\t\tlog.Debugf(\"Unable to close SSH client: %v\", err)\n\t\t\t}\n\t\t\treturn trace.ConnectionProblem(ctx.Err(), \"connection canceled\")\n\t\t}\n\t})\n}", "title": "" }, { "docid": "bcd43562766e9f0842dbd03e2bd3cc27", "score": "0.56497926", "text": "func (c *Console) Accept(channelRequest ssh.NewChannel) error {\n\tchannel, requests, err := channelRequest.Accept()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to accept channel: %w\", err)\n\t}\n\n\t// commands comes from \"exec\" requests or when a user enters them into the shell\n\tcommands := make(chan string)\n\n\t// handle \"shell\", \"pty-req\" and \"exec\" requests\n\tgo func(in <-chan *ssh.Request) {\n\t\tfor req := range in {\n\t\t\tif req.Type == \"exec\" {\n\t\t\t\t// parse exec request\n\t\t\t\texec := execCommand{}\n\t\t\t\terr := ssh.Unmarshal(req.Payload, &exec)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"unable to parse exec payload: %s\", err)\n\t\t\t\t\treq.Reply(false, nil)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\t// queue command which will be executed later\n\t\t\t\t// when the client opens a shell\n\t\t\t\tcommands <- exec.Command\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// reply false to everything other then shell and pty-req\n\t\t\treq.Reply(req.Type == \"shell\" || req.Type == \"pty-req\", nil)\n\t\t}\n\t}(requests)\n\n\t// setup this sessions terminal\n\tterm := terminal.NewTerminal(channel, \"$ \")\n\n\t// autocomplete and the actural command execution cannot access\n\t// the command at the same time\n\tvar lock sync.Mutex\n\tmain := DefaultCmd(c.session)\n\tmain.SetOut(term)\n\n\tterm.AutoCompleteCallback = func(line string, pos int, key rune) (newLine string, newPos int, ok bool) {\n\t\tlock.Lock()\n\t\tdefer lock.Unlock()\n\n\t\t// If we don't receive TAB, simply return without doing anything.\n\t\tif key != '\\t' {\n\t\t\treturn line, pos, false\n\t\t}\n\n\t\tprefix := line[:pos]\n\t\tpostfix := line[pos:]\n\n\t\tline = line[:pos] + string(key) + line[pos:]\n\n\t\twordBeforeCursor := prefix\n\n\t\tspacePos := strings.LastIndex(prefix, \" \")\n\t\tif spacePos >= 0 {\n\t\t\twordBeforeCursor = prefix[spacePos+1:]\n\t\t}\n\n\t\tvar suggestions []string\n\n\t\tcommand := main\n\t\targs := strings.Fields(line)\n\n\t\tif found, _, err := command.Find(args); err == nil {\n\t\t\tcommand = found\n\t\t}\n\n\t\t// If the cursor is placed at the end of a matched command, add a space. Like bash.\n\t\tif command.Name() == wordBeforeCursor {\n\t\t\treturn prefix + \" \" + postfix, pos + 1, true\n\t\t}\n\n\t\tif command.HasAvailableSubCommands() {\n\t\t\tfor _, c := range command.Commands() {\n\t\t\t\tname := c.Name()\n\n\t\t\t\tif !c.Hidden && strings.HasPrefix(name, wordBeforeCursor) {\n\t\t\t\t\tsuggestions = append(suggestions, name)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If we have exactly one match, simply use it.\n\t\tif len(suggestions) == 1 {\n\t\t\t// If the cursor is at the end, insert a space too like bash.\n\t\t\tif postfix == \"\" {\n\t\t\t\tpostfix = \" \"\n\t\t\t\tpos++\n\t\t\t}\n\n\t\t\treturn prefix + suggestions[0][len(wordBeforeCursor):] + postfix, pos + len(suggestions[0]) - len(wordBeforeCursor), true\n\t\t}\n\n\t\tif len(suggestions) > 1 {\n\t\t\twhiteSpace := \"\"\n\t\t\tfor i := 0; i < len(prefix)+2; i++ {\n\t\t\t\twhiteSpace += \" \"\n\t\t\t}\n\n\t\t\t// Trick term into keeping the current line.\n\t\t\tfmt.Fprintf(term, \"$ %s\\033[33m...\\033[0m%s\\n\\r\", prefix, postfix)\n\t\t\tfor _, s := range suggestions {\n\t\t\t\tfmt.Fprintf(term, \"\\033[33m%s%s\\033[0m\\n\", whiteSpace, s)\n\t\t\t}\n\t\t}\n\n\t\treturn prefix + postfix, pos, false\n\t}\n\n\t// read commands off the terminal and put them into commands channel\n\tgo func() {\n\t\tfor {\n\t\t\tline, err := term.ReadLine()\n\t\t\tif err != nil {\n\t\t\t\tclose(commands)\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcommands <- line\n\t\t}\n\t}()\n\n\tgo func() {\n\t\tdefer channel.Close()\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase cmd, ok := <-commands:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif strings.TrimSpace(cmd) == \"\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tlock.Lock()\n\n\t\t\t\tmain.SetArgs(strings.Fields(cmd))\n\t\t\t\t_ = main.Execute()\n\n\t\t\t\t// the main commands needs its flags reverted to their default value\n\t\t\t\t// for every invocation\n\t\t\t\tCommandReset(main)\n\n\t\t\t\tlock.Unlock()\n\t\t\tcase msg, ok := <-c.session.msgs:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfmt.Fprintf(term, \"%s\\n\", msg)\n\t\t\t}\n\n\t\t\tc.session.PokeTimeout()\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "b84d1302ee28da6c6a61737c57f2065c", "score": "0.55914503", "text": "func (c *Container) Run(command string) (Pty, error) {\n\tvar (\n\t\terr error\n\t\tpty Pty\n\t)\n\n\t// EXPORT set LINES=<number of lines in Terminal on frontend>\n\tpty.Cmd = exec.Command(\"docker\", \"run\", \"--name\", c.ID.String(), \"-it\", c.imageID.String(), command)\n\tif pty.Conn, err = pseudoterm.Start(pty.Cmd); err != nil {\n\t\treturn Pty{}, utils.Error(err, \"docker: pty not started\")\n\t}\n\n\tif c.OnStart != nil {\n\t\tif err = c.OnStart(); err != nil {\n\t\t\tpty.Stop()\n\t\t\treturn Pty{}, utils.Error(err, \"docker: onstart failed\")\n\t\t}\n\t}\n\n\treturn pty, nil\n}", "title": "" }, { "docid": "349489cd4c3cbeac405c5985e5c5dd8c", "score": "0.55137867", "text": "func main() {\n\t// usb create\n\n\tuCfg := newUsbCfg(0x0557, 0x2008, 1, 0, 0, 3, 2, 64)\n\n\tu, err := usbEPStart(uCfg)\n\tif err != nil {\n\t\tlog.Printf(\"%v\\n\", err)\n\t\treturn // TODO: Decide if we should return here, or other..\n\t}\n\tdefer usbEPStop(u)\n\n\t// pty create\n\n\tpt, tt, err := pty.Open()\n\tif err != nil {\n\t\tlog.Printf(\"error: failed to pty.Open: %v\\n\", err)\n\t}\n\tdefer pt.Close()\n\tdefer tt.Close()\n\n\tfmt.Printf(\"pty: %v\\n\", pt.Name())\n\tfmt.Printf(\"tty: %v\\n\", tt.Name())\n\n\t// --- read/write ---\n\n\t// usb -> pty\n\tgo func() {\n\t\tfor {\n\t\t\tb := make([]byte, uCfg.byteSize)\n\n\t\t\t// USB Read\n\t\t\tn, err := u.inEP.Read(b)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error: failed to read inEP: %v\\n\", err)\n\t\t\t\tlog.Printf(\"n = %v\\n\", n)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// write to pty\n\n\t\t\t{\n\t\t\t\tn, err := pt.Write(b)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Printf(\"error: writing to pty: %v\\n\", err)\n\t\t\t\t}\n\n\t\t\t\tfmt.Printf(\" * pty: wrote %v bytes\\n\", n)\n\t\t\t}\n\n\t\t}\n\t}()\n\n\t// pty -> usb\n\tfor {\n\t\tb := make([]byte, 64)\n\t\t_, err := pt.Read(b)\n\t\tif err != nil && err != io.EOF {\n\t\t\tlog.Printf(\"error: failed to read conn : %v\\n\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif err == io.EOF {\n\t\t\tlog.Printf(\"error: got io.EOF: %v\\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\t{\n\t\t\tfmt.Printf(\" * debug : read from pty: %v\\n\", b)\n\t\t\tn, err := u.outEP.Write(b)\n\t\t\tif err != nil {\n\t\t\t\tlog.Printf(\"error: writing to ep: %v\\n\", err)\n\t\t\t}\n\n\t\t\tfmt.Printf(\" * ep: wrote %v bytes\\n\", n)\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "88b86e25daa55b683ac9048ec02b85a9", "score": "0.5488128", "text": "func (c *ConsoleReader) Start() {\n\tfmt.Println(\"Starting console reader. ctrl+c to exit\")\n\treader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tselect {\n\t\tcase <-c.done:\n\t\t\treturn\n\t\tdefault:\n\t\t\tfmt.Print(\"> \")\n\t\t\ttext, _ := reader.ReadString('\\n')\n\t\t\ttext = strings.Replace(text, \"\\n\", \"\", -1)\n\t\t\tinstruction, err := c.CreateInstruction(text)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tc.queue <- instruction\n\t\t}\n\t}\n}", "title": "" }, { "docid": "67033f277f906546d6af74993400252c", "score": "0.5479641", "text": "func receiveCommand(communicationChannel chan error, serverConf *SSHServer, in writable, stream quic.Stream, commands chan []byte) {\n\tfor {\n\t\tvar msg []byte\n\t\treadBuffer := make([]byte, serverConf.conf.bufSize, serverConf.conf.bufSize)\n\t\tn, err := stream.Read(readBuffer)\n\t\tmsg = readBuffer[:n]\n\t\tif n > 0 {\n\t\t\t//this message should be transmitted to telnet\n\t\t\tin.Write(msg)\n\t\t\tif serverConf.conf.testMode {\n\t\t\t\tserverConf.conf.testOutput = serverConf.conf.testOutput + \"\\n\" + string(msg)\n\t\t\t}\n\t\t}\n\t\tif (err != nil) {\n\t\t\tcommunicationChannel <- err\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9afe7e796104a5e04613ab6948505be1", "score": "0.546771", "text": "func (p *Pty) Command(cmd string, args ...string) {\n\tp.C = exec.Command(cmd, args...)\n\tp.C.Stdin, p.C.Stdout, p.C.Stderr = p.Pts, p.Pts, p.Pts\n\tsys(p)\n}", "title": "" }, { "docid": "c2f3006a60265315fe8a9eecaf363faa", "score": "0.5455304", "text": "func (serviceClient *client) StartTerminal(options targetselector.Options, args []string, workDir string, interrupt chan error, wait bool) (int, error) {\n\tcommand := serviceClient.getCommand(args, workDir)\n\ttargetSelector := targetselector.NewTargetSelector(serviceClient.client)\n\tif wait == false {\n\t\toptions.Wait = &wait\n\t} else {\n\t\toptions.FilterPod = nil\n\t\toptions.FilterContainer = nil\n\t\toptions.WaitingStrategy = targetselector.NewUntilNewestRunningWaitingStrategy(time.Second * 2)\n\t}\n\toptions.Question = \"Which pod do you want to open the terminal for?\"\n\n\tcontainer, err := targetSelector.SelectSingleContainer(context.TODO(), options, serviceClient.log)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\twrapper, upgradeRoundTripper, err := serviceClient.client.GetUpgraderWrapper()\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\tserviceClient.log.Infof(\"Opening shell to pod:container %s:%s\", ansi.Color(container.Pod.Name, \"white+b\"), ansi.Color(container.Container.Name, \"white+b\"))\n\tgo func() {\n\t\tinterrupt <- serviceClient.client.ExecStreamWithTransport(&kubectl.ExecStreamWithTransportOptions{\n\t\t\tExecStreamOptions: kubectl.ExecStreamOptions{\n\t\t\t\tPod: container.Pod,\n\t\t\t\tContainer: container.Container.Name,\n\t\t\t\tCommand: command,\n\t\t\t\tTTY: true,\n\t\t\t\tStdin: os.Stdin,\n\t\t\t\tStdout: os.Stdout,\n\t\t\t\tStderr: os.Stderr,\n\t\t\t},\n\t\t\tTransport: wrapper,\n\t\t\tUpgrader: upgradeRoundTripper,\n\t\t\tSubResource: kubectl.SubResourceExec,\n\t\t})\n\t}()\n\n\terr = <-interrupt\n\tupgradeRoundTripper.Close()\n\tif err != nil {\n\t\tif exitError, ok := err.(kubectlExec.CodeExitError); ok {\n\t\t\treturn exitError.Code, nil\n\t\t}\n\n\t\treturn 0, err\n\t}\n\n\treturn 0, nil\n}", "title": "" }, { "docid": "9801640f153a866c6f95f121d8d0aa27", "score": "0.5452506", "text": "func main() {\n\t// Get PTYs up\n\tpty, _ := term.OpenPTY()\n\tdefer pty.Close()\n\t// Save the current Stdin attributes\n\tbackupTerm, _ := term.Attr(os.Stdin)\n\t// Copy attributes\n\tmyTerm := backupTerm\n\t// Change the Stdin term to RAW so we get everything\n\tmyTerm.Raw()\n\tmyTerm.Set(os.Stdin)\n\t// Set the backup attributes on our PTY slave\n\tbackupTerm.Set(pty.Slave)\n\t// Make sure we'll get the attributes back when exiting\n\tdefer backupTerm.Set(os.Stdin)\n\t// Get the snooping going\n\tgo Snoop(pty)\n\t// Handle changes in termsize\n\tsig := make(chan os.Signal, 2)\n\t// Notify if window size changes or shell dies\n\tsignal.Notify(sig, syscall.SIGWINCH, syscall.SIGCLD)\n\t// Start up the slaveshell\n\tcmd := exec.Command(os.Getenv(\"SHELL\"), \"\")\n\tcmd.Stdin, cmd.Stdout, cmd.Stderr = pty.Slave, pty.Slave, pty.Slave\n\tcmd.Args = nil\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetsid: true,\n\t\tSetctty: true}\n\tcmd.Start()\n\t// Get the initial winsize\n\tmyTerm.Winsz(os.Stdin)\n\tmyTerm.Winsz(pty.Slave)\n\t// If the termsize changes , propagate to our PTY\n\tfor {\n\t\tswitch <-sig {\n\t\tcase syscall.SIGWINCH:\n\t\t\tmyTerm.Winsz(os.Stdin)\n\t\t\tmyTerm.Setwinsz(pty.Slave)\n\t\tdefault:\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4341d45b80522e7eff7e1298374c74d9", "score": "0.5397101", "text": "func main() {\n\t// create a reader object to read data from stdin\n\t//reader := bufio.NewReader(os.Stdin)\n\terr := keyboard.Open()\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\tdefer keyboard.Close()\n\tvar input string\n\n\t// create a channel to notify us about SIGINT and SIGTERMs\n\tsigs := make(chan os.Signal, 1)\n\tsignal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)\n\n\tprofile := new(user.UserProfile)\n\tprofile.SetupUserProfile()\n\tfmt.Printf(\"%s@%s:%s$ \", profile.Username, profile.Hostname, profile.Path)\n\n\t// main input loop\n\tfor {\n\t\tprofile.SetupUserProfile()\n\n\t\t// OS signal was sent\n\t\tselect {\n\t\tcase sig := <-sigs:\n\t\t\tfmt.Println(sig)\n\t\t\tif sig == syscall.SIGQUIT || sig == syscall.SIGINT {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t// regular input\n\t\tdefault:\n\t\t\tchar, key, err := keyboard.GetKey()\n\t\t\tif err != nil {\n\t\t\t\tlog.Panic(err)\n\t\t\t}\n\n\t\t\tswitch key {\n\t\t\tcase keyboard.KeyEnter:\n\t\t\t\tfmt.Print(\"\\n\")\n\t\t\t\t// execute input command and log errors if any\n\t\t\t\tif err = utils.ExecInput(input); err != nil {\n\t\t\t\t\t_, err := fmt.Fprintln(os.Stderr, err)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tpanic(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfmt.Printf(\"%s@%s:%s$ \", profile.Username, profile.Hostname, profile.Path)\n\t\t\t\tinput = \"\"\n\t\t\t\tbreak\n\t\t\tcase keyboard.KeySpace:\n\t\t\t\tinput += \" \"\n\t\t\t\tfmt.Print(\" \")\n\t\t\tdefault:\n\t\t\t\tinput += string(char)\n\t\t\t\tfmt.Print(string(char))\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "534bc1f3f659a2698a6b5de48229aff0", "score": "0.5391293", "text": "func (cmd *cmd) Exec(input, output chan (string)) {\n\tstdout, _ := cmd.command.StdoutPipe()\n\tif input != nil {\n\t\tstdin, _ := cmd.command.StdinPipe()\n\t\tgo func() {\n\t\t\tdefer stdin.Close()\n\t\t\tfor i := range input {\n\t\t\t\tio.WriteString(stdin, i)\n\t\t\t}\n\t\t}()\n\t}\n\tgo func() {\n\t\tdefer stdout.Close()\n\t\tdefer close(output)\n\t\trd := bufio.NewReader(stdout)\n\t\tfor {\n\t\t\tstr, err := rd.ReadString('\\n')\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\toutput <- str\n\t\t}\n\t}()\n\terr := cmd.command.Run()\n\tif err != nil {\n\t\tlog.Println(\"Command : \", cmd.command.Path, \" Error :\", err)\n\t}\n}", "title": "" }, { "docid": "e50de449bef1b781eba5e12831ca2294", "score": "0.5366364", "text": "func (se *shellExecutor) doStart() (out error) {\n\tdefer func() {\n\t\tif err := recover(); err != nil {\n\t\t\tout = err.(error)\n\t\t\tse.handleErrors(out)\n\t\t}\n\t}()\n\n\t// init wait group fro StdOut and StdErr\n\tse.stdOutWg.Add(2)\n\n\tcommand := exec.Command(linuxBash)\n\tcommand.Dir = se.jobDir\n\tcommand.Env = append(os.Environ(), se.vars.ToStringArray()...)\n\tcommand.Env = append(command.Env, se.secretVars.ToStringArray()...)\n\tcommand.Env = append(command.Env, se.configVars.ToStringArray()...)\n\n\tstdin, err := command.StdinPipe()\n\tutil.PanicIfErr(err)\n\n\tstdout, err := command.StdoutPipe()\n\tutil.PanicIfErr(err)\n\n\tstderr, err := command.StderrPipe()\n\tutil.PanicIfErr(err)\n\n\tdefer func() {\n\t\t_ = stdin.Close()\n\t\t_ = stdout.Close()\n\t\t_ = stderr.Close()\n\t}()\n\n\tse.command = command\n\n\t// start command\n\tif err := command.Start(); err != nil {\n\t\treturn se.toErrorStatus(err)\n\t}\n\n\tse.writeLog(stdout, true, true)\n\tse.writeLog(stderr, true, true)\n\tse.writeCmd(stdin, se.setupBin, se.writeEnv, func(script string) string {\n\t\treturn script\n\t})\n\tse.toStartStatus(command.Process.Pid)\n\n\t// wait or timeout\n\t_ = command.Wait()\n\tutil.LogDebug(\"[Done]: Shell for %s\", se.inCmd.ID)\n\n\tse.exportEnv()\n\n\t// wait for tty if it's running\n\tif se.IsInteracting() {\n\t\tutil.LogDebug(\"Tty is running, wait..\")\n\t\t<-se.ttyCtx.Done()\n\t}\n\n\tif se.result.IsFinishStatus() {\n\t\treturn nil\n\t}\n\n\t// to finish status\n\tse.toFinishStatus(getExitCode(command))\n\treturn se.context.Err()\n}", "title": "" }, { "docid": "aa2dbb7bcbf732444845f81f5d48ca0a", "score": "0.5336765", "text": "func (e *Executor) Start() error {\n\te.command.Stdin = e.Stdin\n\n\te.startTime = time.Now()\n\te.terminateLogger = make(chan struct{}, 1)\n\n\tvar err error\n\n\te.stdout, err = e.command.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.stderr, err = e.command.StderrPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := e.command.Start(); err != nil {\n\t\te.LogFunc(\"Error executing %v: %v\", e, err)\n\t\treturn err\n\t}\n\n\tgo e.waitForStop()\n\n\tif e.timeout != 0 {\n\t\tgo e.terminateTimeout()\n\t}\n\n\tgo e.logInterval()\n\n\treturn nil\n}", "title": "" }, { "docid": "0170252427bbab6fab22ae769d0bbb01", "score": "0.5306104", "text": "func readCmd(command string) (output chan string, pid int) {\n\t// TODO: better shell command parsing here\n\tcmdChunks := strings.Split(command, \" \")\n\tcmd := exec.Command(cmdChunks[0], cmdChunks[1:]...)\n\tstderr, err := cmd.StdoutPipe()\n\tutils.Check(err)\n\tstdout, err := cmd.StderrPipe()\n\tutils.Check(err)\n\terr = cmd.Start()\n\tutils.Check(err)\n\n\ttextChan := make(chan string)\n\n\tscanners := []*bufio.Scanner{bufio.NewScanner(stdout), bufio.NewScanner(stderr)}\n\tcount := len(scanners)\n\tfor _, scanner := range scanners {\n\t\tgo func(scanner *bufio.Scanner) {\n\t\t\tdefer closeChannel(&count, textChan)\n\t\t\tfor scanner.Scan() {\n\t\t\t\ttextChan <- scanner.Text()\n\t\t\t}\n\t\t}(scanner)\n\t}\n\n\treturn textChan, cmd.Process.Pid\n}", "title": "" }, { "docid": "5b0ab08b2fab86115cf559b382d2211e", "score": "0.52915233", "text": "func main() {\n\tconn, err := net.Dial(\"tcp\", \"localhost:9999\")\n\tif err != nil {\n\t\tfmt.Println(\"Failed to start: \", err.Error())\n\t}\n\tinputReader := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tfmt.Println(\"Please input a command, type Q to quit!\")\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Command illegal!\")\n\t\t}\n\t\tinput, _ := inputReader.ReadString('\\n')\n\t\tcommand := strings.Trim(input, \"\\r\\n\")\n\t\tif command == \"Q\" {\n\t\t\treturn\n\t\t}\n\n\t\t_, err := conn.Write([]byte(command))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "09059eb7b972e9b0817d76ee6e6a89ed", "score": "0.5281307", "text": "func runCommand(cmdName string, ch *chan string) {\n fmt.Println(\"Running command [\", cmdName,\"]\")\n cmdArgs := strings.Fields(cmdName)\n cmd := exec.Command(cmdArgs[0], cmdArgs[1:len(cmdArgs)]...)\n stdout, _ := cmd.StdoutPipe()\n cmd.Start()\n num := 1\n for {\n r := bufio.NewReader(stdout)\n line, _ := r.ReadString('\\n')\n if string(line) != \"\" {\n *(ch) <- string(line)\n }\n num = num + 1\n }\n}", "title": "" }, { "docid": "afc6157baa232a47338db82485fe3276", "score": "0.5281214", "text": "func cmdRun(p *ptpProcess, stdoutToSocket bool) {\n\tglog.Infof(\"Starting %s...\", p.name)\n\tglog.Infof(\"%s cmd: %+v\", p.name, p.cmd)\n\tvar c net.Conn\n\tvar err error\n\tdefer func() {\n\t\tif stdoutToSocket && c != nil {\n\t\t\tif err := c.Close(); err != nil {\n\t\t\t\tglog.Errorf(\"closing connection returned error %s\", err)\n\t\t\t}\n\t\t}\n\t\tp.exitCh <- true\n\t}()\n\n\t//\n\t// don't discard process stderr output\n\t//\n\tp.cmd.Stderr = os.Stderr\n\tcmdReader, err := p.cmd.StdoutPipe()\n\tif err != nil {\n\t\tglog.Errorf(\"cmdRun() error creating StdoutPipe for %s: %v\", p.name, err)\n\t\treturn\n\t}\n\n\tdone := make(chan struct{})\n\n\tif !stdoutToSocket {\n\t\tscanner := bufio.NewScanner(cmdReader)\n\t\tgo func() {\n\t\t\tfor scanner.Scan() {\n\t\t\t\toutput := scanner.Text()\n\t\t\t\tfmt.Printf(\"%s\\n\", output)\n\t\t\t\textractMetrics(p.configName, p.name, p.ifaces, output)\n\t\t\t}\n\t\t\tdone <- struct{}{}\n\t\t}()\n\t} else {\n\t\tgo func() {\n\t\tconnect:\n\t\t\tselect {\n\t\t\tcase <-p.exitCh:\n\t\t\t\tdone <- struct{}{}\n\t\t\tdefault:\n\t\t\t\tc, err = net.Dial(\"unix\", eventSocket)\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Errorf(\"error trying to connect to event socket\")\n\t\t\t\t\ttime.Sleep(connectionRetryInterval)\n\t\t\t\t\tgoto connect\n\t\t\t\t}\n\t\t\t}\n\t\t\tscanner := bufio.NewScanner(cmdReader)\n\t\t\tfor scanner.Scan() {\n\t\t\t\toutput := scanner.Text()\n\t\t\t\tout := fmt.Sprintf(\"%s\\n\", output)\n\t\t\t\tfmt.Printf(\"%s\", out)\n\t\t\t\t_, err := c.Write([]byte(out))\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Errorf(\"Write error:\", err)\n\t\t\t\t\tgoto connect\n\t\t\t\t}\n\t\t\t}\n\t\t\tdone <- struct{}{}\n\t\t}()\n\t}\n\n\terr = p.cmd.Start()\n\tif err != nil {\n\t\tglog.Errorf(\"cmdRun() error starting %s: %v\", p.name, err)\n\t\treturn\n\t}\n\n\t<-done\n\n\terr = p.cmd.Wait()\n\tif err != nil {\n\t\tglog.Errorf(\"cmdRun() error waiting for %s: %v\", p.name, err)\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "0ccacd97194dfe58ab4395768d4ad45d", "score": "0.5277131", "text": "func (pty *UnixPTY) Start(c *exec.Cmd, rows, cols int) error {\n\tvar err error\n\tpty.ptmx, err = unixpty.StartWithSize(c, &unixpty.Winsize{\n\t\tRows: uint16(rows),\n\t\tCols: uint16(cols),\n\t})\n\treturn err\n}", "title": "" }, { "docid": "e3329dd8bf6ee7495e433cc7fe2e5aa3", "score": "0.52581817", "text": "func (e *GExpect) runcmd(res chan error) {\n\tif err := e.cmd.Start(); err != nil {\n\t\tres <- err\n\t\treturn\n\t}\n\t// Moving the go read/write functions here makes sure the command is started before first checking if it's running.\n\tclean := make(chan struct{})\n\tchDone := e.goIO(clean)\n\t// Signal command started\n\tres <- nil\n\tcErr := e.cmd.Wait()\n\tclose(chDone)\n\te.pty.Slave.Close()\n\t// make sure the read/send routines are done before closing the pty.\n\t<-clean\n\tres <- cErr\n}", "title": "" }, { "docid": "fff57af82c4e5bf5ea02222e1716edc1", "score": "0.52569765", "text": "func doWithPty(args ...string) (*exec.Cmd, *os.File, error) {\n\tlog.Printf(\"Running with pty: docker %s\\n\", args)\n\tcmd := exec.Command(\"docker\", args...)\n\tptmx, err := pty.Start(cmd)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error executing docker %s with a pty: %v\", args, err)\n\t}\n\treturn cmd, ptmx, nil\n}", "title": "" }, { "docid": "f990db4ec9b25c12a4822dc576870988", "score": "0.5240136", "text": "func startCmd(cmd *exec.Cmd, done chan error, sigchan chan os.Signal) {\n\tif stdout, err := cmd.StdoutPipe(); err == nil {\n\t\tgo attachToStdReadPipe(stdout, os.Stdout)\n\t} else {\n\t\tdone <- err\n\t}\n\tif stderr, err := cmd.StderrPipe(); err == nil {\n\t\tgo attachToStdReadPipe(stderr, os.Stderr)\n\t} else {\n\t\tdone <- err\n\t}\n\tif err := cmd.Start(); err != nil {\n\t\tdone <- err\n\t}\n\tgo handleSignals(cmd, sigchan, done)\n\n\tdone <- cmd.Wait()\n}", "title": "" }, { "docid": "f81a7a97168c92428fd893809397d481", "score": "0.5211001", "text": "func Init() {\n\trawMode := exec.Command(\"/bin/stty\", \"cbreak\", \"-echo\")\n\trawMode.Stdin = os.Stdin\n\t_ = rawMode.Run()\n\trawMode.Wait()\n}", "title": "" }, { "docid": "f1c9434d5c7c2a1bb36fbaad1cf5641f", "score": "0.5209668", "text": "func Send(cmd *integration.Cmd, s string) error {\n\tstdin := cmd.Stdin()\n\t_, err := io.WriteString(stdin, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = io.WriteString(stdin, \"\\n\")\n\treturn err\n}", "title": "" }, { "docid": "3e0d2e233f3139e69b17d9ca94ec3313", "score": "0.5206685", "text": "func Exec(user, pass, host, port, command string) error {\n\tsession, err := connect(user, pass, host, port)\n\tif err != nil {\n\t\treturn err\n\t}\n\tfd, state, err := handleKeys(session)\n\tdefer terminal.Restore(fd, state)\n\n\tif err := session.Run(command); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0b81fb5906cba810e310401b2189187d", "score": "0.51807827", "text": "func (r *Executor) Execute(ctx context.Context, pidChan, exitCodeCh chan<- int) OutputReceive {\n\tout, receiver := NewOutput()\n\tcommandCtx, cancelCommand := context.WithCancel(ctx)\n\n\tgo func() {\n\t\tdefer out.Close()\n\t\tcmd := r.buildCommand(commandCtx)\n\n\t\tillog.\n\t\t\tWithField(\"command\", r.Command).\n\t\t\tWithField(\"path\", cmd.Path).\n\t\t\t// TODO: creates weird failure on leaktest\n\t\t\t//WithField(\"args\", helpers.ObfuscateSensitiveDataFromArray(cmd.Args)).\n\t\t\tWithField(\"env\", helpers.ObfuscateSensitiveDataFromArray(cmd.Env)).\n\t\t\tDebug(\"Running command.\")\n\n\t\t// redirecting stdin and stdout for on-the-go scanning\n\t\tcmdOutput, err := cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\tout.Errors <- err\n\t\t\treturn\n\t\t}\n\t\tcmdError, err := cmd.StderrPipe()\n\t\tif err != nil {\n\t\t\tout.Errors <- err\n\t\t\treturn\n\t\t}\n\n\t\t// allows closing OutputSend only after the task is finished and all the data is read\n\t\tallOutputForwarded := sync.WaitGroup{}\n\t\tallOutputForwarded.Add(2)\n\n\t\t// scans standard output and error pipes and forwards individual lines to a channel\n\t\tgo func() {\n\t\t\tdefer allOutputForwarded.Done()\n\t\t\tforwardCmdOutput(cmdOutput, out.Stdout, out.Errors)\n\t\t}()\n\t\tgo func() {\n\t\t\tdefer allOutputForwarded.Done()\n\t\t\tforwardCmdOutput(cmdError, out.Stderr, out.Errors)\n\t\t}()\n\n\t\t// on normal output, when the output pipes are closed, we cancel the\n\t\t// command context so the parent goroutine can exit\n\t\tgo func() {\n\t\t\tallOutputForwarded.Wait()\n\t\t\tcancelCommand()\n\t\t}()\n\n\t\tif err = startProcess(cmd); err != nil {\n\t\t\tout.Errors <- err\n\t\t}\n\n\t\tif pidChan != nil {\n\t\t\tpidChan <- cmd.Process.Pid\n\t\t}\n\n\t\t// Waits for the command to finish (or be externally cancelled) and closes\n\t\t// the OutputSend channels when all the data has been submitted\n\t\t<-commandCtx.Done()\n\t\tif err := cmd.Wait(); err != nil {\n\t\t\tout.Errors <- err\n\t\t\tif exitCodeCh != nil {\n\t\t\t\tif exitError, ok := err.(*exec.ExitError); ok {\n\t\t\t\t\texitCodeCh <- gobackfill.ExitCode(exitError)\n\t\t\t\t} else {\n\t\t\t\t\texitCodeCh <- unknownErrExitCode\n\t\t\t\t}\n\t\t\t}\n\t\t} else if exitCodeCh != nil {\n\t\t\texitCodeCh <- 0\n\t\t}\n\n\t\tallOutputForwarded.Wait() // waiting again to avoid closing output before the data is received during cancellation\n\t}()\n\treturn receiver\n}", "title": "" }, { "docid": "867550724650ecb4e209387e4ee47e37", "score": "0.5162039", "text": "func main() {\n\tvar writeMode = flag.Bool(\"write\", false, \"write some demo data to stdout\")\n\tflag.Parse()\n\tif *writeMode {\n\t\twriteData()\n\t\treturn\n\t}\n\tStdinChannel := make(pipe.StdDataChannel)\n\tgo pipe.AsyncRead(pipe.Stdin, 1024, StdinChannel)\n\tfor {\n\t\tselect {\n\t\tcase stdin := <-StdinChannel:\n\t\t\tif stdin.Err != nil {\n\t\t\t\tif stdin.Err == io.EOF {\n\t\t\t\t\tfmt.Printf(\"stdin-> EOF \\r\\n\")\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t\tpanic(\"stdin panic->\" + stdin.Err.Error())\n\t\t\t}\n\t\t\tfmt.Printf(\"stdin-> `%s` \\r\\n\", stdin.Data)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4fdb114140011ba15396d01fa65ae7d9", "score": "0.51181626", "text": "func (t *Talker) Run() {\n\n\tkb := keyboard.NewKeyboard(false)\n\tgo kb.Start()\n\tdefer kb.Shutdown()\n\n\tt.writePrompt()\n\tfor {\n\t\tselect {\n\t\tcase in := <-kb.In:\n\t\t\tsequence := in.Input\n\t\t\tslen := len(sequence)\n\t\t\tinput := sequence[:slen]\n\t\t\tswitch slen {\n\t\t\tcase 1:\n\t\t\t\tt.handleCharacter(sequence[0])\n\t\t\tcase 3:\n\t\t\t\tt.handleEscapeSequenc(input)\n\t\t\tdefault:\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tselect {\n\t\tcase <-t.quit:\n\t\t\treturn\n\t\tdefault:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "50cd4784dde9b308c4ac06574b8f2764", "score": "0.51150936", "text": "func (sh *Shell) Interact(ctx context.Context) error {\n\tfor {\n\t\t// Write shell prompt:\n\t\tif _, err := sh.out.Write([]byte(sh.env[\"PS1\"])); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tscan := bufio.NewScanner(sh.in)\n\t\t// Read input command:\n\t\tif !scan.Scan() {\n\t\t\treturn scan.Err()\n\t\t}\n\n\t\t// Parse command in a totally janky way\n\t\tscanner := bufio.NewScanner(bytes.NewReader(scan.Bytes()))\n\t\tscanner.Split(bufio.ScanWords)\n\t\tif !scanner.Scan() {\n\t\t\tcontinue\n\t\t}\n\t\tcmd := scanner.Text()\n\n\t\targs := []string{cmd}\n\t\tfor scanner.Scan() {\n\t\t\targs = append(args, scanner.Text())\n\t\t}\n\n\t\tvar ret int\n\t\tvar err error\n\t\tif handler, ok := sh.handlers[cmd]; ok {\n\t\t\tret, err = handler(ctx, args, sh)\n\t\t} else {\n\t\t\tret, err = sh.Exec(ctx, args)\n\t\t}\n\n\t\tif err != nil {\n\t\t\t// Built-ins can cause us to exit:\n\t\t\tif errors.Is(err, ExitError{}) {\n\t\t\t\treturn nil\n\t\t\t} else {\n\t\t\t\tsh.out.Write([]byte(fmt.Sprintf(\"error running command: %v\", err)))\n\t\t\t}\n\t\t}\n\n\t\t// Store return value as $?\n\t\tsh.env[\"?\"] = fmt.Sprintf(\"%d\", ret)\n\t}\n}", "title": "" }, { "docid": "ed8a91d8175eb629ad437d829bf8fc1a", "score": "0.51055104", "text": "func Start(c *exec.Cmd) (term *Terminal, err error) {\n\tif term, err = NewTerminal(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn term, term.Start(c)\n}", "title": "" }, { "docid": "ad4c686e3c1f7e0df27a6a13f99abcd2", "score": "0.51025534", "text": "func Run() {\n\t// This shell is currently Unix only\n\tif runtime.GOOS == \"windows\" {\n\t\tfmt.Fprintf(os.Stderr, \"%s: Sorry - currently unavailable for Windows\\n\", shellName)\n\t\treturn\n\t}\n\n\t// Display a start message to the user\n\tfmt.Println(green + startMessage + reset)\n\n\tlineReader := bufio.NewReader(os.Stdin)\n\n\t// The main loop of requesting input and processing it\n\tfor {\n\t\tfmt.Printf(green+\"%s\"+reset, prompt)\n\t\tcmdLine, err := lineReader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t}\n\t\tprocessLine(cmdLine)\n\t}\n}", "title": "" }, { "docid": "a1762c3035b60f41675c1a66486f6b79", "score": "0.5098397", "text": "func (t *SSHClient) exec(cmd string, timeout int) {\n session, err := newSSHSession(t.conn)\n if err != nil {\n t.runOutput(nil, err)\n return\n }\n defer session.Close()\n t.running = true\n\n // Redirect stdout & stderr, stdin\n var stdout, stdin bytes.Buffer\n session.Stdout = &stdout\n session.Stderr = &stdout\n session.Stdin = &stdin\n if err := session.Start(cmd); err != nil { // Cmd start run\n t.runOutput(nil, err)\n return\n }\n\n // Listen the cmd stop signal\n stopChan := make(chan error)\n go func() {\n stopChan<- session.Wait()\n }()\n\n if timeout > 0 {\n timer := time.NewTimer(time.Duration(timeout) * time.Second) // exec timeout\n for t.running == true {\n select {\n case <-timer.C: // exec time up, send stop singal & stop cmd\n session.Signal(ssh.SIGINT)\n t.running = false\n case e := <-stopChan: // received the stop info, exit normal\n err = e\n t.running = false\n default:\n time.Sleep(10 * time.Microsecond)\n }\n }\n } else {\n for t.running == true {\n select {\n case e := <-stopChan: // received the stop info, exit normal\n err = e\n t.running = false\n default:\n time.Sleep(10 * time.Microsecond)\n }\n }\n }\n t.runOutput(t.outputFilter(stdout.Bytes()), err)\n}", "title": "" }, { "docid": "ea86f66ca472a4f195c3005e812b2046", "score": "0.5079951", "text": "func StartCmd(cmd *exec.Cmd) (terminalBytes *[]byte, done chan error) {\n\tstdout, _ := cmd.StdoutPipe()\n\tstderr, _ := cmd.StderrPipe()\n\toutputReader := io.MultiReader(stdout, stderr)\n\n\terr := cmd.Start()\n\tif err != nil {\n\t\tLogError(\"cmd.Start() err: \", err)\n\t}\n\n\tvar bytes []byte\n\tdone = make(chan error, 0)\n\tgo func() {\n\t\tvar buffer = make([]byte, terminalBufferSize)\n\t\tfor {\n\t\t\tn, readErr := outputReader.Read(buffer)\n\t\t\tif n > 0 {\n\t\t\t\tbytes = append(bytes, buffer[:n]...)\n\t\t\t}\n\t\t\t// I/O finished\n\t\t\tif readErr != nil {\n\t\t\t\tif readErr != io.EOF {\n\t\t\t\t\t// ignore error\n\t\t\t\t\tLogWarn(\"terminal output read err:\", readErr)\n\t\t\t\t}\n\t\t\t\tdone <- cmd.Wait() // Wait() will close the pipe.\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\t// passing pointer; the underlying array of slice may be changed.\n\treturn &bytes, done\n}", "title": "" }, { "docid": "be1cc73f1ae21a9231f78a170932c746", "score": "0.50796604", "text": "func (c *Client) Start(name string, arg ...string) error {\n\tsize, err := pty.GetsizeFull(os.Stdin)\n\tif err != nil {\n\t\tc.log.WithError(err).Warn(\"failed to obtain terminal size\")\n\t\tsize = nil\n\t}\n\treturn c.call(\"Start\", &CommandReq{Name: name, Arg: arg, Size: size}, empty)\n}", "title": "" }, { "docid": "c699ad209424b39766ce1877fdd9d55b", "score": "0.5078815", "text": "func (this *MainController) ConsoleHandler() {\n\tthis.activeContent(\"hosts\")\n\n\taction := this.Ctx.Input.Param(\":action\")\n\tid := this.Ctx.Input.Param(\":id\")\n\n\tif action == \"intro\" {\n\t\tc := make(chan bool)\n\t\tgo func() {\n\t\t\tcmd := defaultConfig.GottyPath + \"gotty --once -w -p 9999 docker exec -ti \" + id + \" bash\"\n\t\t\tout, err := defaultConfig.Ssh.Run(cmd)\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"Can't run remote command: \" + err.Error() + out)\n\t\t\t}\n\t\t\tc <- true\n\t\t}()\n\t\t// wait for the blocking function to finish if it hasn't already\n\t\t<-c\n\t} else if action == \"logs\" {\n\t\tc := make(chan bool)\n\t\tgo func() {\n\t\t\tcmd := defaultConfig.GottyPath + \"gotty --once -p 8888 docker logs -f \" + id\n\t\t\tout, err := defaultConfig.Ssh.Run(cmd)\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"Can't run remote command: \" + err.Error() + out + cmd)\n\t\t\t}\n\t\t\tc <- true\n\t\t}()\n\t\t// wait for the blocking function to finish if it hasn't already\n\t\t<-c\n\t} else if action == \"cmd\" {\n\t\tc := make(chan bool)\n\t\tgo func() {\n\t\t\tcmd := defaultConfig.GottyPath + \"gotty --once -w -p 7777 docker \" + id\n\t\t\tout, err := defaultConfig.Ssh.Run(cmd)\n\t\t\tif err != nil {\n\t\t\t\tpanic(\"Can't run remote command: \" + err.Error() + out + cmd)\n\t\t\t}\n\t\t\tc <- true\n\t\t}()\n\t\t// wait for the blocking function to finish if it hasn't already\n\t\t<-c\n\t}\n}", "title": "" }, { "docid": "bbda173c72a9512e52e4c2cc7d9836e1", "score": "0.5063703", "text": "func execCommand(ctx context.Context, command string, args ...string) error {\n\tcmd := exec.CommandContext(ctx, command, args...)\n\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\n\treturn cmd.Run()\n}", "title": "" }, { "docid": "616682b2bf7d3e8a869338d72cc69887", "score": "0.50584066", "text": "func (*Commander) RunCommand(cmd *exec.Cmd, stdin io.Reader) ([]byte, []byte, error) {\n\tlogrus.Debugf(\"Running command: %s\", cmd.Args)\n\tstdoutPipe, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif stdin != nil {\n\t\tstdinPipe, err := cmd.StdinPipe()\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tgo func() {\n\t\t\tdefer stdinPipe.Close()\n\t\t\tio.Copy(stdinPipe, stdin)\n\t\t}()\n\t}\n\n\tstderrPipe, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, nil, errors.Wrapf(err, \"starting command %v\", cmd)\n\t}\n\n\tstdout, err := ioutil.ReadAll(stdoutPipe)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstderr, err := ioutil.ReadAll(stderrPipe)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\terr = cmd.Wait()\n\tlogrus.Debugf(\"Command output: stdout %s, stderr: %s, err: %v\", string(stdout), string(stderr), err)\n\n\treturn stdout, stderr, err\n}", "title": "" }, { "docid": "d02ad35edb97a35a6fee6665c238e128", "score": "0.50560135", "text": "func (client *Client) Shell() error {\n\tvar (\n\t\ttermWidth, termHeight = 80, 24\n\t)\n\n\tclient.session.Stdout = os.Stdout\n\tclient.session.Stderr = os.Stderr\n\tclient.session.Stdin = os.Stdin\n\n\tmodes := ssh.TerminalModes{\n\t\tssh.ECHO: 1,\n\t}\n\n\tfd := int(os.Stdin.Fd())\n\n\tif terminal.IsTerminal(fd) {\n\t\toldState, err := terminal.MakeRaw(fd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdefer terminal.Restore(fd, oldState)\n\n\t\tw, h, err := terminal.GetSize(fd)\n\t\tif err == nil {\n\t\t\ttermWidth = w\n\t\t\ttermHeight = h\n\t\t}\n\t}\n\n\tif err := client.session.RequestPty(\"xterm\", termHeight, termWidth, modes); err != nil {\n\t\treturn err\n\t}\n\n\tif err := client.session.Shell(); err != nil {\n\t\treturn err\n\t}\n\n\t// monitor for sigwinch\n\tgo monWinCh(client.session, os.Stdout.Fd())\n\n\terr := client.WaitSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d920c7bbd5c25a6b7ab574628ed6984a", "score": "0.5053118", "text": "func (x *XCmd) Start() (xstdin circuit.X, xstdout, xstderr circuit.X, err error) {\n\t//\n\tstdin, err := x.cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\t//\n\tstdout, err := x.cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\t//\n\tstderr, err := x.cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\t//\n\tif err = x.cmd.Start(); err != nil {\n\t\treturn nil, nil, nil, err\n\t}\n\tdefer func() {\n\t\tgo x.cmd.Wait() // Calling wait is necessary, otherwise child remains zombie\n\t}()\n\treturn xyio.NewXWriteCloser(stdin), xyio.NewXReadCloser(stdout), xyio.NewXReadCloser(stderr), nil\n}", "title": "" }, { "docid": "ce14e4df7b2a7a5f7dfc8d23e8b79506", "score": "0.50509936", "text": "func (c *Cmd) Start() (chan Status, chan string) {\n\tstatusChan := make(chan Status)\n\tlogChan := make(chan string)\n\n\tgo func() {\n\t\tcmd := exec.Command(c.name, c.args...)\n\t\tcmd.Dir = c.dir\n\n\t\tif c.timeout > 0 {\n\t\t\t// Setpgid: true creates a new process group for cmd and its subprocesses\n\t\t\t// this way we can kill the whole process group\n\t\t\tcmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}\n\t\t}\n\n\t\tcombinedOut := newBuffer(c.secrets)\n\t\tcmd.Stdout = combinedOut\n\t\tcmd.Stderr = combinedOut\n\t\tcmd.Stdin = os.Stdin\n\n\t\tif err := cmd.Start(); err != nil {\n\t\t\tstatusChan <- Status{Code: exitStatus(err), Err: err}\n\t\t\treturn\n\t\t}\n\n\t\tc.pid = cmd.Process.Pid\n\n\t\tif c.timeout > 0 {\n\t\t\t// Setpgid: true creates a new process group for cmd and its subprocesses\n\t\t\t// this way cmd will not belong to its parent process group,\n\t\t\t// cmd will not be killed when you hit ^C in your terminal\n\t\t\t// to fix this, we listen and handle Interrupt signal manually\n\t\t\tc.listenOnInterrupt()\n\t\t}\n\n\t\t// Check Timeout\n\t\tvar timer *time.Timer\n\t\tif c.timeout > 0 {\n\t\t\ttimer = time.AfterFunc(c.timeout, func() {\n\t\t\t\tif err := c.Stop(); err != nil {\n\t\t\t\t\tlog.Warnf(\"Failed to kill process, error: %s\", err)\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// Fetch combinedOut periodically\n\t\tticker := time.NewTicker(time.Millisecond * 500)\n\t\tgo func() {\n\t\t\tfor range ticker.C {\n\t\t\t\tlines, err := combinedOut.ReadLines()\n\t\t\t\tif err != nil {\n\t\t\t\t\tstatusChan <- Status{Code: 1, Err: err}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif len(lines) == 0 && time.Since(combinedOut.lastWrite) > 2*time.Second {\n\t\t\t\t\t// may the command waits for user input\n\t\t\t\t\tif err := combinedOut.Flush(); err != nil {\n\t\t\t\t\t\tstatusChan <- Status{Code: 1, Err: err}\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tfor _, line := range lines {\n\t\t\t\t\t\tlogChan <- line\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}()\n\n\t\texitErr := cmd.Wait()\n\n\t\t// Stop timers\n\t\tif timer != nil {\n\t\t\ttimer.Stop()\n\t\t}\n\t\tticker.Stop()\n\n\t\t// Fetch remaining lines from combinedOut\n\t\tif err := combinedOut.Flush(); err != nil {\n\t\t\tstatusChan <- Status{Code: 1, Err: err}\n\t\t\treturn\n\t\t}\n\n\t\tlines, err := combinedOut.ReadLines()\n\t\tif err != nil {\n\t\t\tstatusChan <- Status{Code: 1, Err: err}\n\t\t\treturn\n\t\t}\n\t\tfor _, line := range lines {\n\t\t\tlogChan <- line\n\t\t}\n\n\t\t// notify the receiver that no more logs will be sent\n\t\tclose(logChan)\n\n\t\tstatusChan <- Status{Code: exitStatus(exitErr), Err: exitErr}\n\t}()\n\n\treturn statusChan, logChan\n}", "title": "" }, { "docid": "bb660ffceb95d6dc94cbc8fe90040626", "score": "0.5038678", "text": "func (h *HyperKit) execute() (*exec.Cmd, error) {\n\n\tcmd := exec.Command(h.HyperKit, h.Arguments...)\n\tif h.Argv0 != \"\" {\n\t\tcmd.Args[0] = h.Argv0\n\t}\n\tcmd.Env = os.Environ()\n\n\t// Plumb in stdin/stdout/stderr.\n\t//\n\t// If ConsoleStdio is configured and we are on a terminal,\n\t// just plugin stdio. If we are not on a terminal we have a\n\t// StateDir (as per checks above) and have configured HyperKit\n\t// to use a PTY in the statedir. In this case, we just open\n\t// the PTY slave and copy it to stdout (and ignore\n\t// stdin). This allows for redirecting of the VM output, used\n\t// for testing.\n\t//\n\t// If a logger is specified, use it for stdout/stderr\n\t// logging. Otherwise use the default /dev/null.\n\tif h.Console == ConsoleStdio {\n\t\tif isTerminal(os.Stdout) {\n\t\t\tcmd.Stdin = os.Stdin\n\t\t\tcmd.Stdout = os.Stdout\n\t\t\tcmd.Stderr = os.Stderr\n\t\t} else {\n\t\t\tgo func() {\n\t\t\t\ttty := h.openTTY()\n\t\t\t\tdefer tty.Close()\n\t\t\t\tio.Copy(os.Stdout, tty)\n\t\t\t}()\n\t\t}\n\t} else if log != nil {\n\t\tlog.Debugf(\"hyperkit: Redirecting stdout/stderr to logger\")\n\t\tstdout, err := cmd.StdoutPipe()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tstderr, err := cmd.StderrPipe()\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tgo logStream(stdout, \"stdout\")\n\t\tgo logStream(stderr, \"stderr\")\n\t}\n\n\tlog.Debugf(\"hyperkit: Starting %#v\", cmd)\n\terr := cmd.Start()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\th.Pid = cmd.Process.Pid\n\tlog.Debugf(\"hyperkit: Pid is %v\", h.Pid)\n\th.process = cmd.Process\n\terr = h.writeState()\n\tif err != nil {\n\t\tlog.Debugf(\"hyperkit: Cannot write state: %v, killing %v\", err, h.Pid)\n\t\th.process.Kill()\n\t\treturn nil, err\n\t}\n\treturn cmd, nil\n}", "title": "" }, { "docid": "43b9de3f6f2d9da20b555487218f4524", "score": "0.50295335", "text": "func (s *Shell) FetchStdin(r *net.Resolver) {\n\tfor {\n\t\t//get shell command using dns TXT record\n\t\tdata, err := r.LookupTXT(context.Background(), s.makeTimestamp()+s.domainCmd)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t\treturn\n\t\t}\n\t\tif len(data) > 0 && data[0] != \"\" {\n\t\t\tfmt.Printf(\"Received: %v, %d\\n\", data, len(data))\n\t\t\tcommand := base58.Decode(data[0])\n\n\t\t\t//Catch ctrl-c and signal the process\n\t\t\tif len(command) > 0 && command[0] == 0x03 {\n\t\t\t\tparent, err := process.NewProcess(int32(s.cmd.Process.Pid))\n\t\t\t\tif err == nil {\n\t\t\t\t\tchildren, err := parent.Children()\n\t\t\t\t\tif err == nil {\n\t\t\t\t\t\tfor _, child := range children {\n\t\t\t\t\t\t\tchild.Terminate()\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\tstrCommand := string(command)\n\t\t\t\tstrCommand += \"\\n\"\n\t\t\t\ts.stdIn <- strCommand\n\t\t\t}\n\t\t}\n\t\ttime.Sleep(1 * time.Second)\n\t}\n}", "title": "" }, { "docid": "0eb2892c7dc7cd03f8f9229e30816a5e", "score": "0.5027718", "text": "func (t *LinuxTerminal) CreateSession() error {\n\tsshSession, err := t.Cli.NewSession()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// we set stdin, then we can write data to ssh server via this stdin.\n\t// but, as for reading data from ssh server, we can set Session.Stdout and Session.Stderr\n\t// to receive data from ssh server, and write back to somewhere.\n\tstdinP, err := sshSession.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\tstdoutP, err := sshSession.StdoutPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcomboWriter := new(wsBufferWriter)\n\t//ssh.stdout and stderr will write output into comboWriter\n\tsshSession.Stdout = comboWriter\n\tsshSession.Stderr = comboWriter\n\n\tmodes := ssh.TerminalModes{\n\t\tssh.ECHO: 1, // disable echo\n\t\tssh.TTY_OP_ISPEED: 14400, // input speed = 14.4kbaud\n\t\tssh.TTY_OP_OSPEED: 14400, // output speed = 14.4kbaud\n\t}\n\n\t// Request pseudo terminal\n\tif err := sshSession.RequestPty(\"xterm\", 100, 100, modes); err != nil {\n\t\treturn err\n\t}\n\t// Start remote shell\n\tif err := sshSession.Shell(); err != nil {\n\t\treturn err\n\t}\n\tt.SshConn = &SshConn{StdinPipe: stdinP,StdoutPipe:stdoutP,Session: sshSession}\n\treturn nil\n}", "title": "" }, { "docid": "8323faa0c7b504741b8bfbf435d7bc3d", "score": "0.50177187", "text": "func start(cmd commander, proc osProcess) (_ io.ReadWriteCloser, err error) {\n\tin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tin.Close()\n\t\t}\n\t}()\n\tout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer func() {\n\t\tif err != nil {\n\t\t\tout.Close()\n\t\t}\n\t}()\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn ioPipe{out, in, proc}, nil\n}", "title": "" }, { "docid": "4d7885c2de52cba91d20adee7c25da6e", "score": "0.50169647", "text": "func (cmd *Cmd) ChannelStdin(stdin <-chan string) {\n\tcmd.Stdin = NewChanReader(stdin)\n}", "title": "" }, { "docid": "2492a234f33da1a4cff4afa64f9110b9", "score": "0.5012453", "text": "func SendCommand(msg string) {\n\tInput <- msg\n}", "title": "" }, { "docid": "4a7c133cc2c8c8bb3f38698d8954e986", "score": "0.49884972", "text": "func (s *Sender) Run(stopChannel chan bool) {\n\ts.StopChannel = stopChannel\n\n\ts.broadcastJoinMessage()\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tinputText := scanner.Text()\n\n\t\tif strings.HasPrefix(inputText, COMMAND_HEAD) {\n\t\t\ts.handleUserCommand(inputText, scanner)\n\t\t} else {\n\t\t\tmessage := s.buildMessage(inputText)\n\t\t\ts.sendMessage(message.String())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e08644c633b9345237441ae262c12d85", "score": "0.49817136", "text": "func interactive(p Process, in io.Reader, out, err io.Writer) error {\n\t// Make it interactive\n\tgo io.Copy(p.Stdin, in)\n\tgo io.Copy(out, p.Stdout)\n\tgo io.Copy(err, p.Stderr)\n\n\t// Wait for the process to exit\n\treturn p.Wait()\n}", "title": "" }, { "docid": "d50d50de87a9c7b3514d546e1280abca", "score": "0.49748978", "text": "func newSSHSession(client *ssh.Client) (*ssh.Session, error) {\n // Open new session that acts as an entry point to the remote terminal\n session, err := client.NewSession()\n if err != nil {\n return nil, fmt.Errorf(\"Failed to create session, %s\", err.Error())\n }\n\n // Before we will be able to run the command on the remote machine, we should create a pseudo\n // terminal on the remote machine. A pseudoterminal (or \"pty\") is a pair of virtual character\n // devices that provide a bidirectional communication channel.\n modes := ssh.TerminalModes{\n ssh.ECHO : 0,\n ssh.ISIG : 1,\n ssh.TTY_OP_ISPEED : 14400,\n ssh.TTY_OP_OSPEED : 14400,\n }\n\n if err := session.RequestPty(\"xterm\", 1366, 768, modes); err != nil {\n session.Close()\n return nil, fmt.Errorf(\"Request pseudo terminal failed, %s\", err.Error())\n }\n return session, nil\n}", "title": "" }, { "docid": "b0a2763edc09a0879aecb27c2597e047", "score": "0.49714178", "text": "func (e *MockExecutor) ExecuteCommandWithStdin(timeout time.Duration, command string, stdin *string, arg ...string) error {\n\tif e.MockExecuteCommand != nil {\n\t\treturn e.MockExecuteCommandWithStdin(timeout, command, stdin, arg...)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "86d1ad25fe85a9d6aed73a0fd3da451a", "score": "0.49667072", "text": "func stdInput(ch chan string){\n bio := bufio.NewReader(os.Stdin)\n for {\n bytes, _, err := bio.ReadLine()\n if err != nil{\n fmt.Println(\"stdin read error\") \n break\n }\n ch <- string(bytes)\n }\n}", "title": "" }, { "docid": "c3b5663a358384dbe00f12b3b660233d", "score": "0.49660012", "text": "func (c *Connect) Execute(\n\tctx context.Context,\n) error {\n\tif os.Getenv(warp.EnvWarp) == c.warp {\n\t\treturn errors.Trace(\n\t\t\terrors.Newf(\n\t\t\t\t\"You are attempting to connect to warp %s from inside itself. \"+\n\t\t\t\t\t\"You don't need to connect to a warp you opened.\",\n\t\t\t\tc.warp,\n\t\t\t),\n\t\t)\n\t}\n\n\tctx, cancel := context.WithCancel(ctx)\n\n\tvar conn net.Conn\n\tvar err error\n\n\tif c.noTLS {\n\t\tconn, err = net.Dial(\"tcp\", c.address)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(\n\t\t\t\terrors.Newf(\"Connection to warpd failed: %v.\", err),\n\t\t\t)\n\t\t}\n\t} else {\n\t\ttlsConfig := &tls.Config{\n\t\t\tInsecureSkipVerify: c.insecureTLS,\n\t\t}\n\n\t\tconn, err = tls.Dial(\"tcp\", c.address, tlsConfig)\n\t\tif err != nil {\n\t\t\treturn errors.Trace(\n\t\t\t\terrors.Newf(\"Connection to warpd failed: %v.\", err),\n\t\t\t)\n\t\t}\n\t}\n\tdefer conn.Close()\n\n\tc.ss, err = cli.NewSession(\n\t\tctx,\n\t\tc.session,\n\t\tc.warp,\n\t\twarp.SsTpShellClient,\n\t\tc.username,\n\t\tcancel,\n\t\tconn,\n\t)\n\tif err != nil {\n\t\treturn errors.Trace(err)\n\t}\n\t// Close and reclaims all session related state.\n\tdefer c.ss.TearDown()\n\n\tout.Normf(\"Connected to warp: \")\n\tout.Valuf(\"%s\\n\", c.warp)\n\n\t// Setup local term.\n\tstdin := int(os.Stdin.Fd())\n\tif !terminal.IsTerminal(stdin) {\n\t\treturn errors.Trace(\n\t\t\terrors.Newf(\"Not running in a terminal.\"),\n\t\t)\n\t}\n\n\told, err := terminal.MakeRaw(stdin)\n\tif err != nil {\n\t\treturn errors.Trace(\n\t\t\terrors.Newf(\"Unable to put terminal in raw mode: %v.\", err),\n\t\t)\n\t}\n\t// Restors the terminal once we're done.\n\tdefer terminal.Restore(stdin, old)\n\n\t// Main loops.\n\n\t// c.errC is used to capture user facing errors generated from the\n\t// goroutines.\n\tc.errC = make(chan error)\n\n\t// Wait for an user facing error on the c.errC channel.\n\tvar userErr error\n\tgo func() {\n\t\tuserErr = <-c.errC\n\t\tcancel()\n\t}()\n\n\t// Listen for state updates.\n\tgo func() {\n\tSTATELOOP:\n\t\tfor {\n\t\t\tif st, err := c.ss.DecodeState(ctx); err != nil {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tif err := c.ss.UpdateState(*st, false); err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\t// Update the terminal size.\n\t\t\t\tfmt.Printf(\"\\033[8;%d;%dt\", st.WindowSize.Rows, st.WindowSize.Cols)\n\t\t\t}\n\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tbreak STATELOOP\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\tcancel()\n\t}()\n\n\t// Listen for errors.\n\tgo func() {\n\t\tif e, err := c.ss.DecodeError(ctx); err == nil {\n\t\t\tc.errC <- errors.Newf(\n\t\t\t\t\"Received %s: %s\", e.Code, e.Message,\n\t\t\t)\n\t\t}\n\t}()\n\n\t// Multiplex Stdin to dataC.\n\tgo func() {\n\t\tplex.Run(ctx, func(data []byte) {\n\t\t\tc.ss.DataC().Write(data)\n\t\t}, os.Stdin)\n\t\tcancel()\n\t}()\n\n\t// Multiplex dataC to Stdout.\n\tgo func() {\n\t\tplex.Run(ctx, func(data []byte) {\n\t\t\tos.Stdout.Write(data)\n\t\t}, c.ss.DataC())\n\t\tc.errC <- errors.Newf(\n\t\t\t\"Lost connection to warpd. You can attempt to reconnect once you \" +\n\t\t\t\t\"regain connetivity.\",\n\t\t)\n\t}()\n\n\t// Wait for cancellation to return and clean up everything.\n\t<-ctx.Done()\n\n\treturn userErr\n}", "title": "" }, { "docid": "98ddd97364a70f7721e84645c45f7646", "score": "0.49592334", "text": "func setupIO(process *libcontainer.Process, rootuid int, console string, createTTY, detach bool) (*tty, error) {\n\t// detach and createTty will not work unless a console path is passed\n\t// so error out here before changing any terminal settings\n\tif createTTY && detach && console == \"\" {\n\t\treturn nil, fmt.Errorf(\"cannot allocate tty if runc will detach\")\n\t}\n\tif createTTY {\n\t\treturn createTty(process, rootuid, console)\n\t}\n\tif detach {\n\t\tif err := dupStdio(process, rootuid); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn &tty{}, nil\n\t}\n\treturn createStdioPipes(process, rootuid)\n}", "title": "" }, { "docid": "03a02a1ca024dbd8e58a0cac98a31482", "score": "0.4949811", "text": "func (q *QemuLauncher) Start() (conn Connector, returnErr error) {\n\trunning, err := q.IsRunning()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error checking run state: %s\", err)\n\t}\n\n\tif running {\n\t\treturn nil, fmt.Errorf(\"Start called but already running\")\n\t}\n\n\tpaths, err := q.build.Path(\"qemu\", \"kernel\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Error resolving qemu dependencies: %s\", err)\n\t}\n\tbinary, kernel := paths[0], paths[1]\n\n\tport, err := getFreePort()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't get free port: %s\", err)\n\t}\n\n\tif err := q.Prepare(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error while preparing to start: %s\", err)\n\t}\n\n\t// If we fail after this point, we need to make sure to clean up\n\tdefer func() {\n\t\tif returnErr != nil {\n\t\t\tq.cleanup()\n\t\t}\n\t}()\n\n\tinvocation, err := getQemuInvocation(qemuConfig{\n\t\tbinary: binary,\n\t\tkernel: kernel,\n\t\tinitrd: q.initrd,\n\t\tblk: q.extendedBlk,\n\t\tlogFile: q.logPath(),\n\t\tport: port})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"qemu configuration error: %s\", err)\n\t}\n\n\tcmd := NewCommand(invocation[0], invocation[1:]...)\n\n\tlogFile, err := os.Create(q.logPath())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error creating qemu log: %s\", err)\n\t}\n\tdefer logFile.Close()\n\n\t// Save output from QEMU itself in case of error. This should be very\n\t// minimal in size, if present at all.\n\t//\n\t// Watching for EOF on the pipe also doubles as a way of detecting\n\t// subprocess exit without having to call Wait(), which we can't do since\n\t// we intend to detach later.\n\tvar stdoutBuf bytes.Buffer\n\n\toutPipe, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error attaching stdout: %s\", err)\n\t}\n\tcmd.Stderr = cmd.Stdout // capture stderr too\n\n\t// Use buffered channels, so goroutines will not block writing to them even\n\t// if we never end up needing the result (i.e. because an error/success\n\t// condition was reported sooner by another goroutine).\n\tstdoutErrCh := make(chan error, 1)\n\tgo func() {\n\t\t// Copy() will block until either the subprocess exits or we close the\n\t\t// pipe before detaching.\n\t\tif _, err := io.Copy(&stdoutBuf, outPipe); err != nil {\n\t\t\tstdoutErrCh <- fmt.Errorf(\"error copying stdout: %s\", err)\n\t\t}\n\t\tstdoutErrCh <- fmt.Errorf(\"qemu exited early\")\n\t}()\n\n\tif err := cmd.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to start qemu: %s\", err)\n\t}\n\n\t// Storage for system boot log, i.e. early serial output.\n\tvar logBuf bytes.Buffer\n\tlogBuf.Grow(64 * 1024) // Preallocate 64KB, which should be plenty.\n\n\t// Since we ignore EOFs when monitoring the QEMU serial log, the only\n\t// straightforward way the goroutine below can know to exit is to be\n\t// notified externally. This is done with a Context, which will either\n\t// time out or be cancelled by the defer when this method returns.\n\tctx, cancel := context.WithTimeout(context.Background(), q.timeout)\n\tdefer cancel()\n\n\t// In the case of a successful boot, a nil error will be sent to the channel.\n\tbootErrCh := make(chan error, 1)\n\tgo func() {\n\t\tlogReader := bufio.NewReader(logFile)\n\n\t\t// Tail the QEMU log file\n\t\tfor {\n\t\t\t// Check for any early-exit conditions\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\t// The context.Context interface specifies that the\n\t\t\t\t// returned error will be either DeadlineExceeded or\n\t\t\t\t// Canceled. We should exit in both cases, but want to\n\t\t\t\t// report an error in the timeout case.\n\t\t\t\tif errors.Is(ctx.Err(), context.DeadlineExceeded) {\n\t\t\t\t\tbootErrCh <- fmt.Errorf(\"timeout waiting for boot\")\n\t\t\t\t}\n\t\t\t\treturn\n\t\t\tdefault:\n\t\t\t}\n\n\t\t\t// See if any input is available\n\t\t\tif _, err = logReader.Peek(1); err == io.EOF {\n\t\t\t\ttime.Sleep(100 * time.Millisecond)\n\t\t\t\tcontinue\n\t\t\t} else if err != nil {\n\t\t\t\tbootErrCh <- fmt.Errorf(\"log peek failed: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif _, err := logBuf.ReadFrom(logReader); err != nil {\n\t\t\t\tbootErrCh <- fmt.Errorf(\"log read failed: %s\", err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// This is not as performant as something like a Scanner, but those\n\t\t\t// can't recover from EOFs and it doesn't seem worth reimplementing.\n\t\t\tif bytes.Contains(logBuf.Bytes(), []byte(successfulBootMarker)) {\n\t\t\t\t// Early boot has finished\n\t\t\t\tbootErrCh <- nil\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}()\n\n\tglog.Info(\"Waiting for boot to complete...\")\n\n\tvar bootErr error\n\tselect {\n\tcase err := <-stdoutErrCh:\n\t\tbootErr = fmt.Errorf(\"error starting qemu: %s\", err)\n\tcase err := <-bootErrCh:\n\t\tif err != nil {\n\t\t\tbootErr = fmt.Errorf(\"error during boot: %s\", err)\n\t\t}\n\t}\n\n\tif bootErr != nil {\n\t\t// Kill the process, just in case this was an error other than early exit.\n\t\tcmd.Process.Kill()\n\n\t\t// Dump logs before calling Wait(), which will release resources.\n\t\tglog.Errorf(\"QEMU output: %s\", stdoutBuf.String())\n\t\tglog.Errorf(\"Boot log: %s\", logBuf.String())\n\n\t\t// Wait on the process to prevent it from becoming a zombie. Errors\n\t\t// don't matter here.\n\t\tcmd.Wait()\n\n\t\treturn nil, bootErr\n\t}\n\n\tglog.Info(\"Instance started.\")\n\tq.Pid = cmd.Process.Pid\n\n\t// Detach from the child, since we will never wait on it.\n\toutPipe.Close()\n\tcmd.Process.Release()\n\n\t// ffx requires IP addresses, so we can't use `localhost`\n\treturn NewSSHConnector(q.build, \"127.0.0.1\", port, q.sshKey, \"\"), nil\n}", "title": "" }, { "docid": "a0334b5402909e2a2e2f16bdcbd533f0", "score": "0.49426085", "text": "func (s *StartCommand) Run(args []string) {\n\tcontainer := args[0]\n\n\t// attach to io.\n\tvar wait chan struct{}\n\tif s.attach || s.stdin {\n\t\tin, out, err := setRawMode(s.stdin, false)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"failed to set raw mode\")\n\t\t\treturn\n\t\t}\n\t\tdefer func() {\n\t\t\tif err := restoreMode(in, out); err != nil {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"failed to restore term mode\")\n\t\t\t}\n\t\t}()\n\n\t\tconn, br, err := attachContainer(s.cli, container, s.stdin)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"failed to attach container: %v \\n\", err)\n\t\t\treturn\n\t\t}\n\n\t\twait = make(chan struct{})\n\t\tgo func() {\n\t\t\tio.Copy(os.Stdout, br)\n\t\t\tclose(wait)\n\t\t}()\n\t\tgo func() {\n\t\t\tio.Copy(conn, os.Stdin)\n\t\t\tclose(wait)\n\t\t}()\n\t}\n\n\tapiClient := s.cli.Client()\n\t// start container\n\tif err := apiClient.ContainerStart(container, \"\"); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to start container %s: %v\\n\", container, err)\n\t\treturn\n\t}\n\n\t// wait the io to finish.\n\tif s.attach || s.stdin {\n\t\t<-wait\n\t}\n}", "title": "" }, { "docid": "9ab0175064cad69585dcb85220c0bdac", "score": "0.49359393", "text": "func runCmd(baseDir string, env []string, command string, args ...string) error {\n\tcmd := exec.Command(command, args...)\n\tif baseDir != \"\" {\n\t\tcmd.Dir = baseDir\n\t}\n\tcmd.Env = env\n\n\t// print command being run\n\tfmt.Println(\"$\", strings.Join(cmd.Args, \" \"))\n\n\ttty, err := pty.Start(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscanner := bufio.NewScanner(tty)\n\tvar wg sync.WaitGroup\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tfor scanner.Scan() {\n\t\t\tout := scanner.Text()\n\t\t\tfmt.Printf(\"%s\\n\", fmtOutput(out))\n\t\t}\n\t}()\n\n\terr = cmd.Wait()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\twg.Wait()\n\n\treturn nil\n}", "title": "" }, { "docid": "b6240b1bdfcd3f0ac098f324f7171461", "score": "0.4921909", "text": "func SpawnSSHPTY(sshClient *ssh.Client, timeout time.Duration, term term.Termios, opts ...Option) (*GExpect, <-chan error, error) {\n\tif sshClient == nil {\n\t\treturn nil, nil, errors.New(\"*ssh.Client is nil\")\n\t}\n\tif timeout < 1 {\n\t\ttimeout = DefaultTimeout\n\t}\n\t// Setup interactive session\n\tsession, err := sshClient.NewSession()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\te := &GExpect{\n\t\trcv: make(chan struct{}),\n\t\tsnd: make(chan string),\n\t\tchk: func(e *GExpect) bool {\n\t\t\tif e.ssh == nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t_, err := e.ssh.SendRequest(\"dummy\", false, nil)\n\t\t\treturn err == nil\n\t\t},\n\t\tcls: func(e *GExpect) error {\n\t\t\tif e.ssh != nil {\n\t\t\t\treturn e.ssh.Close()\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tssh: session,\n\t\ttimeout: timeout,\n\t\tchkDuration: checkDuration,\n\t}\n\tfor _, o := range opts {\n\t\to(e)\n\t}\n\tif term.Wz.WsCol == 0 {\n\t\tterm.Wz.WsCol = sshTermWidth\n\t}\n\tif term.Wz.WsRow == 0 {\n\t\tterm.Wz.WsRow = sshTermHeight\n\t}\n\tif err := session.RequestPty(sshTerm, int(term.Wz.WsRow), int(term.Wz.WsCol), term.ToSSH()); err != nil {\n\t\treturn nil, nil, err\n\t}\n\tinPipe, err := session.StdinPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\toutPipe, err := session.StdoutPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\terrPipe, err := session.StderrPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tif err := session.Shell(); err != nil {\n\t\treturn nil, nil, err\n\t}\n\t// Shell started.\n\terrCh := make(chan error, 1)\n\tgo e.waitForSession(errCh, session.Wait, inPipe, outPipe, errPipe)\n\treturn e, errCh, nil\n}", "title": "" }, { "docid": "4bd4329e4c94a9efcd866407ad52dccc", "score": "0.4914469", "text": "func runCommand(command *exec.Cmd) {\n\tcommand.Stdin = os.Stdin\n\tcommand.Stdout = os.Stdout\n\tcommand.Run()\n}", "title": "" }, { "docid": "77810f5b088ea2e481d3ff67a51d900d", "score": "0.491351", "text": "func (ctr *ControllerAgent) Run() {\n\treader := bufio.NewReader(os.Stdin)\n\tctr.isActive = true\n\tfmt.Println(\"Paxos controller active. Enter your command\")\n\tfor ctr.isActive {\n\t\tfmt.Printf(\"> \")\n\t\t// Read the keyboad input.\n\t\tinput, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tctr.Halt()\n\t\t\tctr.fatalAgentErrorf(\"Invalid input %v in controller\\n\", input)\n\t\t\tos.Exit(0)\n\t\t}\n\t\tif len(strings.TrimSpace(input)) < 1 {\n\t\t\t// Ignore empty messages\n\t\t\tcontinue\n\t\t}\n\t\tinputSlice := strings.SplitN(strings.TrimSpace(input), \" \", 2)\n\t\tcommand := inputSlice[0]\n\t\tswitch command {\n\t\tcase \"exit\":\n\t\t\tfmt.Println(\"Terminating paxos cluster\")\n\t\t\tctr.Halt()\n\t\t\tos.Exit(0)\n\t\tcase \"start\":\n\t\t\t// Start a node\n\t\t\tif len(inputSlice) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpayload := strings.SplitN(inputSlice[1], \" \", 2)\n\t\t\tif len(payload) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnodePort, err := strconv.ParseUint(payload[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tloss, err := strconv.ParseFloat(payload[1], 64)\n\t\t\tif err != nil || loss < 0 || loss > 1 {\n\t\t\t\tfmt.Printf(\"Invalid input : %v\\n\", err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbox := fmt.Sprintf(\"127.0.0.1:%d\", nodePort)\n\t\t\tproc := exec.Command(\"./ovid\",\n\t\t\t\t\"-log\", fmt.Sprintf(\"-loss=%f\", loss), \"configs/paxos.json\", box)\n\t\t\tproc.Stdout = os.Stdout\n\t\t\terr = proc.Start()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to start 127.0.0.1:%d : %v\\n\", nodePort, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tctr.alive[c.PortNum(nodePort)] = proc.Process.Pid\n\t\t\tfmt.Printf(\"Started box 127.0.0.1:%d, pid = %d, loss=%f\\n\", nodePort, proc.Process.Pid, loss)\n\t\tcase \"req\":\n\t\t\t// Issue a client request\n\t\t\tif len(inputSlice) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpayload := strings.SplitN(inputSlice[1], \" \", 2)\n\t\t\tif len(payload) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdestUint, err := strconv.ParseUint(payload[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Invalid request destination %v\\n\", payload[0])\n\t\t\t}\n\t\t\tdest := c.ProcessID(destUint)\n\t\t\t_, ok := ctr.clients[dest]\n\t\t\tif !ok {\n\t\t\t\tfmt.Printf(\"Invalid client %v\\n\", dest)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tm := payload[1]\n\t\t\tctr.send(dest, fmt.Sprintf(\"issue %s\", m))\n\t\tcase \"kill\":\n\t\t\t// Issue a kill command\n\t\t\tif len(inputSlice) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tnodePort, err := strconv.ParseUint(inputSlice[1], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpid, ok := ctr.alive[c.PortNum(nodePort)]\n\t\t\tif !ok {\n\t\t\t\tfmt.Printf(\"Box 127.0.0.1:%d is already dead\\n\", nodePort)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// proc := exec.Command(\"./ovid\", \"-log\", \"configs/paxos.json\", box)\n\t\t\tproc := exec.Command(\"kill\", \"-9\", strconv.FormatInt(int64(pid), 10))\n\t\t\tproc.Stdout = os.Stdout\n\t\t\terr = proc.Start()\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Failed to kill 127.0.0.1:%d : %v\\n\", nodePort, err)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdelete(ctr.alive, c.PortNum(nodePort))\n\t\t\tfmt.Printf(\"Killed box 127.0.0.1:%d, pid = %d\\n\", nodePort, proc.Process.Pid)\n\t\tcase \"dump\":\n\t\t\tif len(inputSlice) > 1 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor rep := range ctr.replicas {\n\t\t\t\tctr.send(rep, fmt.Sprintf(\"dump\"))\n\t\t\t}\n\t\tcase \"skip\":\n\t\t\tif len(inputSlice) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tpayload := strings.SplitN(inputSlice[1], \" \", 2)\n\t\t\tif len(payload) < 2 {\n\t\t\t\tfmt.Println(\"Invalid input\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tdestUint, err := strconv.ParseUint(payload[0], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Invalid request destination %v\\n\", payload[0])\n\t\t\t}\n\t\t\tdest := c.ProcessID(destUint)\n\t\t\t_, ok := ctr.replicas[dest]\n\t\t\tif !ok {\n\t\t\t\tfmt.Printf(\"Invalid replica %v\\n\", dest)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tslot, err := strconv.ParseUint(payload[1], 10, 64)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Printf(\"Invalid slot %v\\n\", inputSlice[1])\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tctr.send(dest, fmt.Sprintf(\"skip %d\", slot))\n\t\tdefault:\n\t\t\tfmt.Println(\"Invalid command\")\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "67d5bb32bfb607cd3fc063229704d91a", "score": "0.48980057", "text": "func SpawnWithArgs(command []string, timeout time.Duration, opts ...Option) (*GExpect, <-chan error, error) {\n\tpty, err := term.OpenPTY()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tvar t term.Termios\n\tt.Raw()\n\tt.Set(pty.Slave)\n\n\tif timeout < 1 {\n\t\ttimeout = DefaultTimeout\n\t}\n\t// Get the command up and running\n\tcmd := exec.Command(command[0], command[1:]...)\n\t// This ties the commands Stdin,Stdout & Stderr to the virtual terminal we created\n\tcmd.Stdin, cmd.Stdout, cmd.Stderr = pty.Slave, pty.Slave, pty.Slave\n\t// New process needs to be the process leader and control of a tty\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tSetsid: true,\n\t\tSetctty: true}\n\te := &GExpect{\n\t\trcv: make(chan struct{}),\n\t\tsnd: make(chan string),\n\t\tcmd: cmd,\n\t\ttimeout: timeout,\n\t\tchkDuration: checkDuration,\n\t\tpty: pty,\n\t\tcls: func(e *GExpect) error {\n\t\t\tif e.cmd != nil {\n\t\t\t\treturn e.cmd.Process.Kill()\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t\tchk: func(e *GExpect) bool {\n\t\t\tif e.cmd.Process == nil {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\t// Sending Signal 0 to a process returns nil if process can take a signal , something else if not.\n\t\t\treturn e.cmd.Process.Signal(syscall.Signal(0)) == nil\n\t\t},\n\t}\n\tfor _, o := range opts {\n\t\to(e)\n\t}\n\n\tres := make(chan error, 1)\n\tgo e.runcmd(res)\n\t// Wait until command started\n\treturn e, res, <-res\n}", "title": "" }, { "docid": "39136f9cc6ed05f5fbbe7c43c47116ae", "score": "0.4897839", "text": "func newSSHSession(client *ssh.Client) (*ssh.Session, error) {\n // Open new session that acts as an entry point to the remote terminal\n session, err := client.NewSession()\n if err != nil {\n return nil, fmt.Errorf(\"Failed to create session, %s\", err.Error())\n }\n\n // Before we will be able to run the command on the remote machine, we should create a pseudo\n // terminal on the remote machine. A pseudoterminal (or \"pty\") is a pair of virtual character\n // devices that provide a bidirectional communication channel.\n modes := ssh.TerminalModes{\n ssh.ECHO : 0,\n ssh.ISIG : 1,\n ssh.TTY_OP_ISPEED : 14400,\n ssh.TTY_OP_OSPEED : 14400,\n }\n\n if err := session.RequestPty(\"xterm\", 80, 40, modes); err != nil {\n session.Close()\n return nil, fmt.Errorf(\"Request pseudo terminal failed, %s\", err.Error())\n }\n\n return session, nil\n}", "title": "" }, { "docid": "3a4a089c1a823949b28becc50a20e45e", "score": "0.48954937", "text": "func watchForConsoleInput(conn net.Conn) {\n\treader := bufio.NewReader(os.Stdin)\n\n\tfor true {\n\t\tmessage, err := reader.ReadString('\\n')\n\t\tutil.CheckForError(err, \"Perdida la conexion\")\n\n\t\tmessage = strings.TrimSpace(message)\n\t\tif message != \"\" {\n\t\t\tcommand := parseInput(message)\n\n\t\t\tif command.Command == \"\" {\n\t\t\t\t// un simple mensaje\n\t\t\t\tsendCommand(\"mensaje\", message, conn)\n\t\t\t} else {\n\t\t\t\tswitch command.Command {\n\n\t\t\t\t// entrar a una sala privada\n\t\t\t\tcase \"entrar\":\n\t\t\t\t\tsendCommand(\"entrar\", command.Body, conn)\n\n\t\t\t\t// ignorar a alguien\n\t\t\t\tcase \"ignorar\":\n\t\t\t\t\tsendCommand(\"ignorar\", command.Body, conn)\n\n\t\t\t\t// dejar la sala\n\t\t\t\tcase \"dejar\":\n\t\t\t\t\t// dejar la sala, no permite salas de salas\n\t\t\t\t\tsendCommand(\"dejar\", \"\", conn)\n\n\t\t\t\t// desconectar del servidor\n\t\t\t\tcase \"desconectar\":\n\t\t\t\t\tsendCommand(\"desconectar\", \"\", conn)\n\t\t\t\t\tclient()\n\n\t\t\t\tdefault:\n\t\t\t\t\tfmt.Printf(\"comando desconocido \\\"%s\\\"\\n\", command.Command)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5d72cc7c064ff4fe505aa6165aba94e3", "score": "0.48881215", "text": "func (c *Cmd) Run() {\n\tif c.stdin != nil {\n\t\tc.cmd.Stdin = c.stdin\n\t}\n\n\tif c.env != nil {\n\t\tc.cmd.Env = c.env\n\t} else {\n\t\tc.cmd.Env = os.Environ()\n\t}\n\n\tvar outBuf bytes.Buffer\n\tc.cmd.Stdout = &outBuf\n\n\tvar errBuf bytes.Buffer\n\tc.cmd.Stderr = &errBuf\n\n\tif err := c.cmd.Run(); err != nil {\n\t\tc.exitError = err\n\t}\n\tc.stdout = string(outBuf.Bytes())\n\tc.stderr = string(errBuf.Bytes())\n\tc.executed = true\n}", "title": "" }, { "docid": "5358f9b83d0fc756f345a12ea012b1ca", "score": "0.4885967", "text": "func (e *DefaultExecute) Execute(ctx context.Context, command []string, resultsFunc stdoutcallback.StdoutCallbackResultsFunc, options ...ExecuteOptions) error {\n\n\tvar (\n\t\terr error\n\t\tcmdStderr, cmdStdout io.ReadCloser\n\t\twg sync.WaitGroup\n\t)\n\n\texecErrChan := make(chan error)\n\n\t// apply all options to the executor\n\tfor _, opt := range options {\n\t\topt(e)\n\t}\n\n\tif resultsFunc == nil {\n\t\tresultsFunc = results.DefaultStdoutCallbackResults\n\t}\n\n\t// default stdout and stderr for the main process\n\tif e.Write == nil {\n\t\te.Write = os.Stdout\n\t}\n\n\tif e.WriterError == nil {\n\t\te.WriterError = os.Stderr\n\t}\n\n\tcmd := exec.CommandContext(ctx, command[0], command[1:]...)\n\n\tif len(e.CmdRunDir) > 0 {\n\t\tcmd.Dir = e.CmdRunDir\n\t}\n\n\tcmd.Stdin = os.Stdin // connects the main process' stdin to ansible's stdin\n\n\tcmdStdout, err = cmd.StdoutPipe()\n\tdefer cmdStdout.Close()\n\tif err != nil {\n\t\treturn errors.New(\"(DefaultExecute::Execute)\", \"Error creating stdout pipe\", err)\n\t}\n\n\tcmdStderr, err = cmd.StderrPipe()\n\tdefer cmdStderr.Close()\n\tif err != nil {\n\t\treturn errors.New(\"(DefaultExecute::Execute)\", \"Error creating stderr pipe\", err)\n\t}\n\n\ttimeInit := time.Now()\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn errors.New(\"(DefaultExecute::Execute)\", \"Error starting command\", err)\n\t}\n\n\t// Waig for stdout and stderr\n\twg.Add(2)\n\n\t// stdout management\n\tgo func() {\n\t\tdefer close(execErrChan)\n\n\t\ttrans := []results.TransformerFunc{}\n\n\t\tfor _, t := range e.Transformers {\n\t\t\ttrans = append(trans, t)\n\t\t}\n\n\t\t// when using the default results func DefaultStdoutCallbackResults,\n\t\t// reads from ansible's stdout and writes to main process' stdout\n\t\terr := resultsFunc(ctx, cmdStdout, e.Write, trans...)\n\t\twg.Done()\n\t\texecErrChan <- err\n\t}()\n\n\t// stderr management\n\tgo func() {\n\t\t// show stderr messages using default stdout callback results\n\t\tresults.DefaultStdoutCallbackResults(ctx, cmdStderr, e.WriterError, []results.TransformerFunc{}...)\n\t\twg.Done()\n\t}()\n\n\twg.Wait()\n\n\tif err := <-execErrChan; err != nil {\n\t\treturn errors.New(\"(DefaultExecute::Execute)\", \"Error managing results output\", err)\n\t}\n\n\terr = cmd.Wait()\n\tif err != nil {\n\n\t\tif ctx.Err() != nil {\n\t\t\tfmt.Fprintf(e.Write, \"%s\\n\", fmt.Sprintf(\"\\nWhoops! %s\\n\", ctx.Err()))\n\t\t} else {\n\t\t\terrorMessage := string(err.(*exec.ExitError).Stderr)\n\t\t\terrorMessage = fmt.Sprintf(\"Command executed: %s\\n%s\\n%s\", cmd.String(), errorMessage, err.Error())\n\n\t\t\texitError, exists := err.(*exec.ExitError)\n\t\t\tif exists {\n\t\t\t\tws := exitError.Sys().(syscall.WaitStatus)\n\t\t\t\tswitch ws.ExitStatus() {\n\t\t\t\tcase AnsiblePlaybookErrorCodeGeneralError:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageGeneralError, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeOneOrMoreHostFailed:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageOneOrMoreHostFailed, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeOneOrMoreHostUnreachable:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageOneOrMoreHostUnreachable, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeParserError:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageParserError, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeBadOrIncompleteOptions:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageBadOrIncompleteOptions, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeUserInterruptedExecution:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageUserInterruptedExecution, errorMessage)\n\t\t\t\tcase AnsiblePlaybookErrorCodeUnexpectedError:\n\t\t\t\t\terrorMessage = fmt.Sprintf(\"%s\\n\\n%s\", AnsiblePlaybookErrorMessageUnexpectedError, errorMessage)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn errors.New(\"(DefaultExecute::Execute)\", fmt.Sprintf(\"Error during command execution: %s\", errorMessage))\n\t\t}\n\t}\n\n\telapsedTime := time.Since(timeInit)\n\n\tif e.ShowDuration {\n\t\tfmt.Fprintf(e.Write, \"Duration: %s\\n\", elapsedTime.String())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "dfab0db52c0e9b5aa0b08eae6d750302", "score": "0.48855358", "text": "func (p *InteractiveCommandsPlugin) Execute(config agentContracts.Configuration,\n\tcancelFlag task.CancelFlag,\n\toutput iohandler.IOHandler,\n\tdataChannel datachannel.IDataChannel) {\n\n\tp.sessionPlugin.Execute(config, cancelFlag, output, dataChannel)\n}", "title": "" }, { "docid": "01f2d8f74eb4af06f4458ba3461c7281", "score": "0.48825914", "text": "func setRawTerminalOutput(fd uintptr) (*State, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "4683d232b59271b7a9c7a7a690765ae7", "score": "0.48745534", "text": "func (p *ShellPlugin) InputStreamMessageHandler(log log.T, streamDataMessage mgsContracts.AgentMessage) error {\n\tif p.stdin == nil || p.stdout == nil {\n\t\t// This is to handle scenario when cli/console starts sending size data but pty has not been started yet\n\t\t// Since packets are rejected, cli/console will resend these packets until pty starts successfully in separate thread\n\t\tlog.Tracef(\"Pty unavailable. Reject incoming message packet\")\n\t\treturn nil\n\t}\n\n\tswitch mgsContracts.PayloadType(streamDataMessage.PayloadType) {\n\tcase mgsContracts.Output:\n\t\tlog.Tracef(\"Output message received: %d\", streamDataMessage.SequenceNumber)\n\n\t\t// deal with powershell nextline issue https://github.com/lzybkr/PSReadLine/issues/579\n\t\tpayloadString := string(streamDataMessage.Payload)\n\t\tif strings.Contains(payloadString, \"\\r\\n\") {\n\t\t\t// From windows machine, do nothing\n\t\t} else if strings.Contains(payloadString, \"\\n\") {\n\t\t\t// From linux machine, replace \\n with \\r\n\t\t\tnum := strings.Index(payloadString, \"\\n\")\n\t\t\tpayloadString = strings.Replace(payloadString, \"\\n\", \"\\r\", num-1)\n\t\t}\n\n\t\tif _, err := p.stdin.Write([]byte(payloadString)); err != nil {\n\t\t\tlog.Errorf(\"Unable to write to stdin, err: %v.\", err)\n\t\t\treturn err\n\t\t}\n\tcase mgsContracts.Size:\n\t\tvar size mgsContracts.SizeData\n\t\tif err := json.Unmarshal(streamDataMessage.Payload, &size); err != nil {\n\t\t\tlog.Errorf(\"Invalid size message: %s\", err)\n\t\t\treturn err\n\t\t}\n\t\tlog.Tracef(\"Resize data received: cols: %d, rows: %d\", size.Cols, size.Rows)\n\t\tif err := SetSize(log, size.Cols, size.Rows); err != nil {\n\t\t\tlog.Errorf(\"Unable to set pty size: %s\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7cd295dba665683b6557fdc54c771d91", "score": "0.4872761", "text": "func AddExecBehaviour(s *SSHProtocol) {\n\tif shell == \"\" {\n\t\tshell = \"sh\"\n\t}\n\n\ts.Routes().Child(\"session/exec\").Sub(func(data *Request, s *flux.Sub) {\n\t\tlog.Println(\"receiving request:\", data.Paths)\n\n\t\tpayload, ok := data.Payload.(*PayloadRack)\n\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tpayload.Release().When(func(d interface{}, _ flux.ActionInterface) {\n\t\t\tcpay, ok := d.(*ChannelPayload)\n\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif cpay.Pty != nil {\n\t\t\t\tcpay.Do.Do(func() {\n\t\t\t\t\tlog.Println(\"Pty Exec command allowed!\")\n\t\t\t\t\tcommand := string(cpay.Req.Payload[4 : cpay.Req.Payload[3]+4])\n\t\t\t\t\tcmd := exec.Command(shell, []string{\"-c\", command}...)\n\n\t\t\t\t\tcmd.Stdout = cpay.Chan\n\t\t\t\t\tcmd.Stdin = cpay.Chan\n\t\t\t\t\tcmd.Stderr = cpay.Chan\n\n\t\t\t\t\terr := cmd.Start()\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Could not start command (%s)\", err)\n\t\t\t\t\t\tif cpay.Req.WantReply {\n\t\t\t\t\t\t\tcpay.Req.Reply(false, nil)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\t_, err := cmd.Process.Wait()\n\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tlog.Printf(\"Failed to exit shell (%s)\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcpay.Chan.Close()\n\t\t\t\t\t\tlog.Printf(\"Session closed\")\n\t\t\t\t\t}()\n\n\t\t\t\t\tif cpay.Req.WantReply {\n\t\t\t\t\t\tcpay.Req.Reply(true, nil)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t}\n\n\t\t})\n\t})\n}", "title": "" }, { "docid": "86276d31cb22a67b4d0ce2f5b80e91d1", "score": "0.48656243", "text": "func (c CommandExecutor) Read(p []byte) (int, error) {\n\treturn c.pipe.Read(p)\n}", "title": "" }, { "docid": "1eb1a7f91713a356023b3c75796d130a", "score": "0.48609906", "text": "func (c *Console) Run(stopChan chan bool) {\n\tif err := termui.Init(); err != nil {\n\t\tpanic(err)\n\t}\n\tdefer termui.Close()\n\n\ttermui.Body.AddRows(\n\t\ttermui.NewRow(),\n\t)\n\ttermui.Body.Align()\n\tsystemKeys := c.prepareGlobalKeys(stopChan)\n\ttermui.Handle(\"<Resize>\", func(termui.Event) {\n\t\ttermui.Body.Width = termui.TermWidth()\n\t\ttermui.Body.Align()\n\t\ttermui.Clear()\n\t\ttermui.Render(termui.Body)\n\t})\n\tc.registerAddOnEvents(systemKeys)\n\ttermui.Loop()\n}", "title": "" }, { "docid": "ce2a4b5a356e4419af3a40445c25abc2", "score": "0.4857006", "text": "func (s *sftp) Exec(command string) (string, error) {\n\tsession, err := s.conn.NewSession()\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tmodes := ssh.TerminalModes{\n\t\tssh.ECHO: 0,\n\t\tssh.TTY_OP_ISPEED: 14400,\n\t\tssh.TTY_OP_OSPEED: 14400,\n\t}\n\n\t// Request pseudo terminal.\n\tif err = session.RequestPty(\"xterm\", 80, 40, modes); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer session.Close()\n\n\tcmdout := &bytes.Buffer{}\n\tcmderr := &bytes.Buffer{}\n\tsession.Stdout = cmdout\n\tsession.Stderr = cmderr\n\n\tcommand = fmt.Sprintf(\"cd %s && %s\", s.basepath, command)\n\n\tif err = session.Run(command); err != nil {\n\t\t// stdErr is generally more informative, but if it's\n\t\t// empty and the command still failed, return the generic\n\t\t// error.\n\t\tif cmderr.String() == \"\" {\n\t\t\treturn \"\", err\n\t\t} else {\n\t\t\treturn \"\", fmt.Errorf(cmderr.String())\n\t\t}\n\t}\n\n\treturn cmdout.String(), nil\n}", "title": "" }, { "docid": "4da6e643bfa3c92f41818e511169f4ab", "score": "0.4856712", "text": "func NewTTY() (*TTY, error) {\n\tt, err := term.Open(\"/dev/tty\", term.RawMode, term.CBreakMode, term.ReadTimeout(defaultTimeout))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TTY{t, defaultTimeout}, nil\n}", "title": "" }, { "docid": "582988d96fe8f9290adc5308b5e90b45", "score": "0.4842024", "text": "func StartTerminal(client *kubernetes.Clientset, serviceNameOverride, containerNameOverride, labelSelectorOverride, namespaceOverride string, args []string, interrupt chan error, log log.Logger) error {\n\tvar command []string\n\tconfig := configutil.GetConfig()\n\n\tif len(args) == 0 && (config.DevSpace.Terminal.Command == nil || len(*config.DevSpace.Terminal.Command) == 0) {\n\t\tcommand = []string{\n\t\t\t\"sh\",\n\t\t\t\"-c\",\n\t\t\t\"command -v bash >/dev/null 2>&1 && exec bash || exec sh\",\n\t\t}\n\t} else {\n\t\tif len(args) > 0 {\n\t\t\tcommand = args\n\t\t} else {\n\t\t\tfor _, cmd := range *config.DevSpace.Terminal.Command {\n\t\t\t\tcommand = append(command, *cmd)\n\t\t\t}\n\t\t}\n\t}\n\n\tservice, namespace, labelSelector, err := getServiceNamespaceLabelSelector(serviceNameOverride, labelSelectorOverride, namespaceOverride)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Get first running pod\n\tlog.StartWait(\"Terminal: Waiting for pods...\")\n\tpod, err := kubectl.GetNewestRunningPod(client, labelSelector, namespace, time.Second*120)\n\tlog.StopWait()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error starting terminal: Cannot find running pod: %v\", err)\n\t}\n\n\t// Get container name\n\tcontainerName := pod.Spec.Containers[0].Name\n\tif containerNameOverride == \"\" {\n\t\tif service != nil && service.ContainerName != nil {\n\t\t\tcontainerName = *service.ContainerName\n\t\t} else {\n\t\t\tif config.DevSpace.Terminal.ContainerName != nil {\n\t\t\t\tcontainerName = *config.DevSpace.Terminal.ContainerName\n\t\t\t}\n\t\t}\n\t} else {\n\t\tcontainerName = containerNameOverride\n\t}\n\n\twrapper, upgradeRoundTripper, err := getUpgraderWrapper()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgo func() {\n\t\tterminalErr := kubectl.ExecStreamWithTransport(wrapper, upgradeRoundTripper, client, pod, containerName, command, true, os.Stdin, os.Stdout, os.Stderr)\n\t\tif terminalErr != nil {\n\t\t\tif _, ok := terminalErr.(kubectlExec.CodeExitError); ok == false {\n\t\t\t\tinterrupt <- fmt.Errorf(\"Unable to start terminal session: %v\", terminalErr)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\tinterrupt <- nil\n\t}()\n\n\terr = <-interrupt\n\tupgradeRoundTripper.Close()\n\treturn err\n}", "title": "" }, { "docid": "9aa26aa6b96e3fef75ec02fa932591cc", "score": "0.48400566", "text": "func (p *Process) start() error {\n\tcmd := exec.Command(\"/bin/bash\", \"-c\", p.Command)\n\tcmd.Stdin = p.Stdin\n\tcmd.Stdout = p.Stdout\n\tcmd.Stderr = p.Stderr\n\tcmd.Env = os.Environ()\n\tp.cmd = cmd\n\n\treturn cmd.Start()\n}", "title": "" }, { "docid": "063d3e6adfc23607b51251091280255c", "score": "0.48388875", "text": "func (s *Session) Connect() error {\n\ts.mutex.Lock()\n\tdefer s.mutex.Unlock()\n\n\tif s.stopped != nil {\n\t\treturn errors.New(\"a connection has already been established\")\n\t}\n\n\ts.log(\"Connecting\")\n\n\t// Acquire a user token for the session\n\ttoken, err := wtsapi.QueryUserToken(uint32(s.data.ID))\n\tif err != nil {\n\t\ts.log(\"Failed to acquire token: %v\", err)\n\t\treturn err\n\t}\n\n\t// Make sure the token is valid for the user we expect\n\tuserName := s.data.Info.UserName\n\tuserDomain := s.data.Info.UserDomain\n\tif err := validateTokenForUser(token, userName, userDomain); err != nil {\n\t\ttoken.Close()\n\t\ts.log(\"Failed to validate token: %v\", err)\n\t\treturn err\n\t}\n\n\ts.debug(\"Aquired Token: %s\\\\%s\", userDomain, userName)\n\n\tctx, kill := context.WithCancel(context.Background())\n\n\tcmd := exec.CommandContext(ctx, s.cmd.Path, s.cmd.Args...)\n\tcmd.SysProcAttr = &syscall.SysProcAttr{\n\t\tHideWindow: true,\n\t\tToken: token,\n\t}\n\n\twriter, err := cmd.StdinPipe()\n\tif err != nil {\n\t\ttoken.Close()\n\t\tkill()\n\t\ts.log(\"Failed to create stdin: %v\", err)\n\t\treturn err\n\t}\n\n\treader, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\ttoken.Close()\n\t\tkill()\n\t\twriter.Close()\n\t\ts.log(\"Failed to create stdin: %v\", err)\n\t\treturn err\n\t}\n\n\t// TODO: Use cmd.String() from Go 1.13\n\ts.debug(\"Starting UI Process: %s\", strings.Join(cmd.Args, \" \"))\n\n\tif err := cmd.Start(); err != nil {\n\t\ttoken.Close()\n\t\tkill()\n\t\twriter.Close()\n\t\treader.Close()\n\t\ts.log(\"Failed to start UI process: %v\", err)\n\t\treturn err\n\t}\n\n\tstopped := make(chan struct{})\n\n\ts.kill = kill\n\ts.stopped = stopped\n\n\t// Spawn the ui process\n\tgo func(kill context.CancelFunc, stopped chan<- struct{}) {\n\t\tdefer close(stopped)\n\t\tdefer kill()\n\t\tdefer token.Close()\n\t\t//defer reader.Close()\n\t\terr := cmd.Wait()\n\t\ts.mutex.Lock()\n\t\ts.kill = nil\n\t\ts.stopped = nil\n\t\tif err != nil {\n\t\t\ts.log(\"Disconnected: %v\", err)\n\t\t} else {\n\t\t\ts.log(\"Disconnected\")\n\t\t}\n\t\ts.mutex.Unlock()\n\t}(kill, stopped)\n\n\t// Send messages to the process\n\tgo func() {\n\t\tdefer writer.Close()\n\t\twriter := enforcerui.NewWriter(writer)\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\ts.debug(\"Send: %v\", ctx.Err())\n\t\t\t\treturn\n\t\t\tcase msg, ok := <-s.outbound:\n\t\t\t\tif !ok {\n\t\t\t\t\ts.debug(\"Send: EOF\")\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\ts.debug(\"Send: %s\", msg.Type)\n\t\t\t\twriter.Write(msg)\n\t\t\t}\n\n\t\t}\n\t}()\n\n\t// Receive messages from the process\n\tgo func() {\n\t\tscanner := bufio.NewScanner(reader)\n\t\tfor scanner.Scan() {\n\t\t\ts.debug(\"Received: %s\", scanner.Text())\n\t\t}\n\t\tif err := scanner.Err(); err != nil {\n\t\t\ts.debug(\"Receive: %v\", err)\n\t\t} else {\n\t\t\ts.debug(\"Receive: EOF\")\n\t\t}\n\t}()\n\n\ts.log(\"Process Started\")\n\treturn nil\n}", "title": "" }, { "docid": "c9b952aaeffe76cac40a56ea7fc79aa3", "score": "0.48216888", "text": "func Start(cmd *exec.Cmd) (Process, error) {\n\t// file descriptors\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn Process{}, err\n\t}\n\tstdout, err := cmd.StdoutPipe()\n\tif err != nil {\n\t\treturn Process{}, err\n\t}\n\tstderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn Process{}, err\n\t}\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn Process{}, err\n\t}\n\treturn Process{\n\t\tcmd: cmd,\n\t\tStdin: stdin,\n\t\tStdout: stdout,\n\t\tStderr: stderr,\n\t\t// the maximum line length to be used with ReadLine\n\t\tmaxLen: MaxLenDefault,\n\t}, nil\n}", "title": "" }, { "docid": "6439c98b966f37bef2bd3b237e1960d4", "score": "0.4813652", "text": "func AddShellBehaviour(s *SSHProtocol) {\n\tif shell == \"\" {\n\t\tshell = \"sh\"\n\t}\n\n\ts.Routes().Child(\"session/shell\").Sub(func(data *Request, s *flux.Sub) {\n\t\tlog.Println(\"Receiving Request:\", data.Paths)\n\n\t\tpayload, ok := data.Payload.(*PayloadRack)\n\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\tpayload.Release().When(func(d interface{}, _ flux.ActionInterface) {\n\t\t\tcpay, ok := d.(*ChannelPayload)\n\n\t\t\tif !ok {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif cpay.Pty != nil {\n\t\t\t\tcpay.Do.Do(func() {\n\t\t\t\t\tlog.Println(\"Pty allowed!\")\n\n\t\t\t\t\tcmd := exec.Command(shell)\n\t\t\t\t\tcmd.Env = []string{\"TERM=xterm\"}\n\n\t\t\t\t\terr := PtyRun(cmd, cpay.Pty.Tty)\n\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.Printf(\"Error running shell command %+v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\tteardown := new(sync.Once)\n\t\t\t\t\tcloser := func() {\n\t\t\t\t\t\tcpay.Chan.Close()\n\t\t\t\t\t\tlog.Printf(\"Closing session\")\n\t\t\t\t\t}\n\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tio.Copy(cpay.Chan, cpay.Pty.Pfd)\n\t\t\t\t\t\tteardown.Do(closer)\n\t\t\t\t\t}()\n\n\t\t\t\t\tgo func() {\n\t\t\t\t\t\tio.Copy(cpay.Pty.Pfd, cpay.Chan)\n\t\t\t\t\t\tteardown.Do(closer)\n\t\t\t\t\t}()\n\n\t\t\t\t\tif cpay.Req.WantReply {\n\t\t\t\t\t\t//For now commands are not being supported but still up for discussion\n\t\t\t\t\t\tif len(cpay.Req.Payload) == 0 {\n\t\t\t\t\t\t\tcpay.Req.Reply(true, nil)\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcpay.Req.Reply(false, nil)\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})\n\t})\n}", "title": "" }, { "docid": "8e67d07b829bc0e39137ba8358747eed", "score": "0.48113507", "text": "func handleInput(r *rcon.RCON, reader *bufio.Reader) {\n\tfor {\n\t\t// Wait for input\n\t\tfmt.Println(\"Waiting for input..\")\n\t\tinput, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\tr.Close()\n\t\t\tpanic(err)\n\t\t}\n\n\t\t// Remove trailing newline from input\n\t\tinput = strings.TrimSuffix(input, \"\\n\")\n\n\t\t// Send input to server\n\t\tfmt.Printf(\"Sending command '%v'..\\n\", input)\n\t\tcmd := rcon.NewPacket(rcon.ExecCommand, input)\n\t\tif err = r.WritePacket(cmd); err != nil {\n\t\t\tr.Close()\n\t\t\tpanic(err)\n\t\t}\n\t\tfmt.Println(\"Command sent!\")\n\t\t// response, err := r.Execute(input)\n\t\t// if err != nil {\n\t\t// \tr.Close()\n\t\t// \tpanic(err)\n\t\t// }\n\t\t// fmt.Println(\"Received a response:\", response.Body)\n\t}\n}", "title": "" }, { "docid": "bc3a073a5faf6b1fea7910847d61fa3a", "score": "0.4800531", "text": "func (g *Gouser) Run() {\n\tgo g.ListenForMessages()\n\tevs := termui.PollEvents()\n\tfor e := range evs {\n\t\tswitch e.Type {\n\t\tcase termui.KeyboardEvent:\n\t\t\tswitch e.ID {\n\t\t\tcase \"<C-c>\":\n\t\t\t\ttermui.Close()\n\t\t\t\treturn\n\t\t\tcase \"<Enter>\":\n\t\t\t\tg.server.BroadcastMessage(context.Background(), &chatpb.Message{Content: g.inputP.Text, Id: username, PeerUser: friend})\n\t\t\t\tg.chatP.AddLine(fmt.Sprintf(\"%s | %s: %s\", time.Now().Format(\"15:04:05\"), username, g.inputP.Text))\n\t\t\t\tg.inputP.Text = \"\"\n\t\t\t\ttermui.Render(g.inputP, g.chatP)\n\t\t\tcase \"<Space>\":\n\t\t\t\tg.inputP.Text += \" \"\n\t\t\t\ttermui.Render(g.inputP)\n\t\t\tcase \"<Up>\":\n\t\t\t\tg.chatP.ScrollUp()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<Down>\":\n\t\t\t\tg.chatP.ScrollDown()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<PageUp>\":\n\t\t\t\tg.chatP.ScrollHalfPageUp()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<PageDown>\":\n\t\t\t\tg.chatP.ScrollHalfPageDown()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<Home>\":\n\t\t\t\tg.chatP.ScrollTop()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<End>\":\n\t\t\t\tg.chatP.ScrollBottom()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<Backspace>\":\n\t\t\t\tif len(g.inputP.Text) > 0 {\n\t\t\t\t\tg.inputP.Text = g.inputP.Text[:len(g.inputP.Text)-1]\n\t\t\t\t\ttermui.Render(g.inputP)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tg.inputP.Text += e.ID\n\t\t\t\ttermui.Render(g.inputP)\n\t\t\t}\n\t\tcase termui.ResizeEvent:\n\t\t\tg.resize()\n\t\tcase termui.MouseEvent:\n\t\t\tswitch e.ID {\n\t\t\tcase \"<MouseWheelUp>\":\n\t\t\t\tg.chatP.ScrollUp()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\tcase \"<MouseWheelDown>\":\n\t\t\t\tg.chatP.ScrollDown()\n\t\t\t\ttermui.Render(g.chatP)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "be260bc2d2832ccec6a558da6006f2fb", "score": "0.47927645", "text": "func Term(args []string) {\n\tvar err error\n\tif len(args) == 0 {\n\t\terr = CurView().StartTerminal([]string{os.Getenv(\"SHELL\"), \"-i\"}, true, false, \"\")\n\t} else {\n\t\terr = CurView().StartTerminal(args, true, false, \"\")\n\t}\n\tif err != nil {\n\t\tmessenger.Alert(\"error\", err)\n\t}\n}", "title": "" }, { "docid": "862cafe7ba0381ae85b4ec44f6efddad", "score": "0.47847876", "text": "func (c *Cmd) Run(ctx context.Context) error {\n\tif err := c.startSession(ctx); err != nil {\n\t\treturn err\n\t}\n\n\treturn c.waitAndClose(ctx, func() error {\n\t\treturn c.sess.Run(c.buildCmd(c.Dir, c.Args))\n\t})\n}", "title": "" }, { "docid": "4e62450e144c35eae7076225cc7ac2d2", "score": "0.4783001", "text": "func Exec(cb PasswordCallback, cbData interface{}, script ...string) ([]byte, []byte, error) {\n\tcmd := exec.Command(sudoBinary, append(sudoArgs, script...)...)\n\n\tstderr, err := cmd.StderrPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// init vars, bind buffers and readers\n\tvar errOutput []byte\n\tcmdOutput := &bytes.Buffer{}\n\n\tcmd.Stdout = cmdOutput\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// execute the pass check\n\tsem := make(chan struct{})\n\tgo func() {\n\t\tbuf := make([]byte, readBufSz)\n\t\tdefer close(sem)\n\n\t\tfor {\n\t\t\t// read into the buffer from stdErr\n\t\t\tn, err := stderr.Read(buf)\n\t\t\tif err != nil || n == 0 {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// copy the error's output\n\t\t\terrOutput = append(errOutput, buf[:n]...)\n\n\t\t\t// check if stdErr contains the promt\n\t\t\tif len(errOutput) >= len(passwordPrompt) &&\n\t\t\t\tbytes.Equal(errOutput[len(errOutput)-len(passwordPrompt):], []byte(passwordPrompt)) {\n\n\t\t\t\t// trim prompt\n\t\t\t\terrOutput = errOutput[:len(errOutput)-len(passwordPrompt)]\n\n\t\t\t\tpwd := cb(cbData)\n\n\t\t\t\tif _, err = fmt.Fprintln(stdin, pwd); err != nil {\n\t\t\t\t\terrOutput = []byte(err.Error())\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}()\n\n\terr = cmd.Wait()\n\t// wait for the routine's exit\n\t<-sem\n\n\treturn cmdOutput.Bytes(), errOutput, nil\n}", "title": "" }, { "docid": "93bc206522b7ef20ee609430783e5d4f", "score": "0.47796416", "text": "func (c *TreelineCli) Run(cliConnection plugin.CliConnection, args []string) {\n\t// Ensure that we called the command treeline\n\tif args[0] == \"treeline\" {\n\t\t_, err := exec.LookPath(\"treeline\")\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Please install treeline using 'npm install -g treeline'\")\n\t\t\tos.Exit(1)\n\t\t}\n\n\t\tif args[1] == \"config-pws\" {\n\t\t\twriteDevelopmentConfig()\n\t\t\tif _, err := os.Stat(\".cfignore\"); os.IsNotExist(err) {\n\t\t\t\terr := os.Symlink(\".gitignore\", \".cfignore\")\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Println(\"Could not link .cfignore to .gitignore\", err)\n\t\t\t\t\tos.Exit(1)\n\t\t\t\t}\n\t\t\t}\n\t\t\tnpmInstalls()\n\t\t\tos.Exit(0)\n\t\t}\n\n\t\tif args[1] == \"deploy\" {\n\t\t\t_, err = cliConnection.CliCommand(\"push\", \"hackday-nc\", \"--no-start\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\t\t\t_, err = cliConnection.CliCommand(\"set-env\", \"hackday-nc\", \"NODE_ENV\", \"development\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tcreateServices(cliConnection)\n\n\t\t\t_, err = cliConnection.CliCommand(\"start\", \"hackday-nc\")\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(1)\n\t\t\t}\n\n\t\t\tos.Exit(0)\n\t\t}\n\n\t\tcmd := exec.Command(\"treeline\", args[1:]...)\n\t\tcmd.Stdin = os.Stdin\n\t\tcmd.Stdout = os.Stdout\n\n\t\terr = cmd.Start()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error starting command\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\terr = cmd.Wait()\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Error running command\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "020cd7fc5374edc9d664134c88622230", "score": "0.47755566", "text": "func (c *Cmd) Start(ctx context.Context) error {\n\tif err := c.startSession(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tif err := doAsync(ctx, func() error {\n\t\treturn c.sess.Start(c.buildCmd(c.Dir, c.Args))\n\t}, func() {\n\t\tc.sess.Close()\n\t}); err != nil {\n\t\tc.state = stateDone\n\t\tc.closePipes(io.EOF)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fbe8c26ed4a2052d86ba995e576d9316", "score": "0.47710803", "text": "func Execute(osArgs []string) {\n\tif len(osArgs) == 2 && osArgs[1] == \"-i\" {\n\t\tinteractive = true\n\t}\n\tif interactive {\n\t\tshell = ishell.NewWithConfig(\n\t\t\t&readline.Config{\n\t\t\t\tPrompt: fmt.Sprintf(\"%c[1;0;32m%s%c[0m\", 0x1B, \">> \", 0x1B),\n\t\t\t\tHistoryFile: \"/tmp/readline.tmp\",\n\t\t\t\t//AutoComplete: completer,\n\t\t\t\tInterruptPrompt: \"^C\",\n\t\t\t\tEOFPrompt: \"exit\",\n\t\t\t\tHistorySearchFold: true,\n\t\t\t\t//FuncFilterInputRune: filterInput,\n\t\t\t})\n\t\tshell.Println(\"QLC Chain Server\")\n\t\taddCommand()\n\t\tshell.Run()\n\t} else {\n\t\trootCmd = &cobra.Command{\n\t\t\tUse: \"gqlc\",\n\t\t\tShort: \"CLI for QLCChain Server\",\n\t\t\tLong: `QLC Chain is the next generation public block chain designed for the NaaS.`,\n\t\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\t\terr := start()\n\t\t\t\tif err != nil {\n\t\t\t\t\tcmd.Println(err)\n\t\t\t\t}\n\n\t\t\t},\n\t\t}\n\t\trootCmd.PersistentFlags().StringVar(&cfgPathP, \"config\", \"\", \"config file\")\n\t\trootCmd.PersistentFlags().StringVar(&accountP, \"account\", \"\", \"wallet address, if is nil,just run a node\")\n\t\trootCmd.PersistentFlags().StringVar(&passwordP, \"password\", \"\", \"password for wallet\")\n\t\trootCmd.PersistentFlags().StringVar(&seedP, \"seed\", \"\", \"seed for accounts\")\n\t\trootCmd.PersistentFlags().StringVar(&privateKeyP, \"privateKey\", \"\", \"seed for accounts\")\n\t\trootCmd.PersistentFlags().BoolVar(&isProfileP, \"profile\", false, \"enable profile\")\n\t\trootCmd.PersistentFlags().BoolVar(&noBootstrapP, \"nobootnode\", false, \"disable bootstrap node\")\n\t\trootCmd.PersistentFlags().StringSliceVar(&configParamsP, \"configParams\", []string{}, \"parameter set that needs to be changed\")\n\t\taddCommand()\n\t\tif err := rootCmd.Execute(); err != nil {\n\t\t\tfmt.Println(err)\n\t\t\tos.Exit(1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8f699ca9fd8e24ac4499584cb479ea5c", "score": "0.47663632", "text": "func runPrompt() (err error) {\n\tr := bufio.NewReader(os.Stdin)\n\tfor {\n\t\tfmt.Print(\"> \")\n\t\tline, _, err := r.ReadLine()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif len(line) == 0 {\n\t\t\tbreak\n\t\t}\n\t\trun(string(line))\n\t\thadError = false\n\t}\n\treturn\n}", "title": "" } ]
6be457b69f3c30e554bb65da8181a18f
/ ConnectTextRemove connects the callback to the 'textremove' signal for the Text. The returned value represents the connection, and may be passed to DisconnectTextRemove to remove it.
[ { "docid": "03655a723198a50048111d7e3aad7ed4", "score": "0.83210784", "text": "func (recv *Text) ConnectTextRemove(callback TextSignalTextRemoveCallback) int {\n\tsignalTextTextRemoveLock.Lock()\n\tdefer signalTextTextRemoveLock.Unlock()\n\n\tsignalTextTextRemoveId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_remove(instance, C.gpointer(uintptr(signalTextTextRemoveId)))\n\n\tdetail := signalTextTextRemoveDetail{callback, handlerID}\n\tsignalTextTextRemoveMap[signalTextTextRemoveId] = detail\n\n\treturn signalTextTextRemoveId\n}", "title": "" } ]
[ { "docid": "65aa10dc0726c3fb0e0390535e0592ab", "score": "0.73662984", "text": "func (recv *Text) DisconnectTextRemove(connectionID int) {\n\tsignalTextTextRemoveLock.Lock()\n\tdefer signalTextTextRemoveLock.Unlock()\n\n\tdetail, exists := signalTextTextRemoveMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextRemoveMap, connectionID)\n}", "title": "" }, { "docid": "712c7845ccef0a81d51cf649be0384bc", "score": "0.70347357", "text": "func (recv *Editable) ConnectDeleteText(callback EditableSignalDeleteTextCallback) int {\n\tsignalEditableDeleteTextLock.Lock()\n\tdefer signalEditableDeleteTextLock.Unlock()\n\n\tsignalEditableDeleteTextId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Editable_signal_connect_delete_text(instance, C.gpointer(uintptr(signalEditableDeleteTextId)))\n\n\tdetail := signalEditableDeleteTextDetail{callback, handlerID}\n\tsignalEditableDeleteTextMap[signalEditableDeleteTextId] = detail\n\n\treturn signalEditableDeleteTextId\n}", "title": "" }, { "docid": "03f935edd5907cdb07d54144e18d85f5", "score": "0.6719671", "text": "func (recv *TextBuffer) ConnectRemoveTag(callback TextBufferSignalRemoveTagCallback) int {\n\tsignalTextBufferRemoveTagLock.Lock()\n\tdefer signalTextBufferRemoveTagLock.Unlock()\n\n\tsignalTextBufferRemoveTagId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_remove_tag(instance, C.gpointer(uintptr(signalTextBufferRemoveTagId)))\n\n\tdetail := signalTextBufferRemoveTagDetail{callback, handlerID}\n\tsignalTextBufferRemoveTagMap[signalTextBufferRemoveTagId] = detail\n\n\treturn signalTextBufferRemoveTagId\n}", "title": "" }, { "docid": "d3c65764e3b4e8d7a963e5fde51d3c0f", "score": "0.6657077", "text": "func (recv *Editable) DisconnectDeleteText(connectionID int) {\n\tsignalEditableDeleteTextLock.Lock()\n\tdefer signalEditableDeleteTextLock.Unlock()\n\n\tdetail, exists := signalEditableDeleteTextMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalEditableDeleteTextMap, connectionID)\n}", "title": "" }, { "docid": "551d012571b34992274fdf323c2379c0", "score": "0.65190375", "text": "func (recv *Text) DisconnectTextInsert(connectionID int) {\n\tsignalTextTextInsertLock.Lock()\n\tdefer signalTextTextInsertLock.Unlock()\n\n\tdetail, exists := signalTextTextInsertMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextInsertMap, connectionID)\n}", "title": "" }, { "docid": "9ce6e64d21ec3a3c65263f98e7e8fcda", "score": "0.63539135", "text": "func (recv *TextBuffer) DisconnectInsertText(connectionID int) {\n\tsignalTextBufferInsertTextLock.Lock()\n\tdefer signalTextBufferInsertTextLock.Unlock()\n\n\tdetail, exists := signalTextBufferInsertTextMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferInsertTextMap, connectionID)\n}", "title": "" }, { "docid": "de75deaf5e4426dd6d55291ae8cbb908", "score": "0.623146", "text": "func (recv *Text) DisconnectTextAttributesChanged(connectionID int) {\n\tsignalTextTextAttributesChangedLock.Lock()\n\tdefer signalTextTextAttributesChangedLock.Unlock()\n\n\tdetail, exists := signalTextTextAttributesChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextAttributesChangedMap, connectionID)\n}", "title": "" }, { "docid": "fb38a865cb18cad617f9ccb01a357608", "score": "0.61894965", "text": "func (recv *EntryBuffer) ConnectDeletedText(callback EntryBufferSignalDeletedTextCallback) int {\n\tsignalEntryBufferDeletedTextLock.Lock()\n\tdefer signalEntryBufferDeletedTextLock.Unlock()\n\n\tsignalEntryBufferDeletedTextId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.EntryBuffer_signal_connect_deleted_text(instance, C.gpointer(uintptr(signalEntryBufferDeletedTextId)))\n\n\tdetail := signalEntryBufferDeletedTextDetail{callback, handlerID}\n\tsignalEntryBufferDeletedTextMap[signalEntryBufferDeletedTextId] = detail\n\n\treturn signalEntryBufferDeletedTextId\n}", "title": "" }, { "docid": "5b77b3d5196bfd10229679885fa40741", "score": "0.6175605", "text": "func (recv *EntryBuffer) DisconnectInsertedText(connectionID int) {\n\tsignalEntryBufferInsertedTextLock.Lock()\n\tdefer signalEntryBufferInsertedTextLock.Unlock()\n\n\tdetail, exists := signalEntryBufferInsertedTextMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalEntryBufferInsertedTextMap, connectionID)\n}", "title": "" }, { "docid": "6ee4792df3679a5ba9d5edbc6b56d854", "score": "0.61174494", "text": "func (recv *Text) DisconnectTextSelectionChanged(connectionID int) {\n\tsignalTextTextSelectionChangedLock.Lock()\n\tdefer signalTextTextSelectionChangedLock.Unlock()\n\n\tdetail, exists := signalTextTextSelectionChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextSelectionChangedMap, connectionID)\n}", "title": "" }, { "docid": "890cbe279166ed7bf9e089ab03ab3a10", "score": "0.6066263", "text": "func (recv *Text) DisconnectTextCaretMoved(connectionID int) {\n\tsignalTextTextCaretMovedLock.Lock()\n\tdefer signalTextTextCaretMovedLock.Unlock()\n\n\tdetail, exists := signalTextTextCaretMovedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextCaretMovedMap, connectionID)\n}", "title": "" }, { "docid": "0be8522da161869a831bf5ec63bbd38a", "score": "0.6045984", "text": "func (recv *EntryBuffer) DisconnectDeletedText(connectionID int) {\n\tsignalEntryBufferDeletedTextLock.Lock()\n\tdefer signalEntryBufferDeletedTextLock.Unlock()\n\n\tdetail, exists := signalEntryBufferDeletedTextMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalEntryBufferDeletedTextMap, connectionID)\n}", "title": "" }, { "docid": "639202f3214330d960aa32c1403bcc71", "score": "0.60294527", "text": "func (recv *Text) ConnectTextAttributesChanged(callback TextSignalTextAttributesChangedCallback) int {\n\tsignalTextTextAttributesChangedLock.Lock()\n\tdefer signalTextTextAttributesChangedLock.Unlock()\n\n\tsignalTextTextAttributesChangedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_attributes_changed(instance, C.gpointer(uintptr(signalTextTextAttributesChangedId)))\n\n\tdetail := signalTextTextAttributesChangedDetail{callback, handlerID}\n\tsignalTextTextAttributesChangedMap[signalTextTextAttributesChangedId] = detail\n\n\treturn signalTextTextAttributesChangedId\n}", "title": "" }, { "docid": "26cc43069e73cf8e4307510b3f69d4a3", "score": "0.6015734", "text": "func (recv *TextTagTable) ConnectTagRemoved(callback TextTagTableSignalTagRemovedCallback) int {\n\tsignalTextTagTableTagRemovedLock.Lock()\n\tdefer signalTextTagTableTagRemovedLock.Unlock()\n\n\tsignalTextTagTableTagRemovedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextTagTable_signal_connect_tag_removed(instance, C.gpointer(uintptr(signalTextTagTableTagRemovedId)))\n\n\tdetail := signalTextTagTableTagRemovedDetail{callback, handlerID}\n\tsignalTextTagTableTagRemovedMap[signalTextTagTableTagRemovedId] = detail\n\n\treturn signalTextTagTableTagRemovedId\n}", "title": "" }, { "docid": "7bc98112c3007af1bbbb9bb16f73df50", "score": "0.5963321", "text": "func (recv *Text) ConnectTextSelectionChanged(callback TextSignalTextSelectionChangedCallback) int {\n\tsignalTextTextSelectionChangedLock.Lock()\n\tdefer signalTextTextSelectionChangedLock.Unlock()\n\n\tsignalTextTextSelectionChangedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_selection_changed(instance, C.gpointer(uintptr(signalTextTextSelectionChangedId)))\n\n\tdetail := signalTextTextSelectionChangedDetail{callback, handlerID}\n\tsignalTextTextSelectionChangedMap[signalTextTextSelectionChangedId] = detail\n\n\treturn signalTextTextSelectionChangedId\n}", "title": "" }, { "docid": "b0b19178cd928a7b4bf6a24dbd5b9a86", "score": "0.59540516", "text": "func (recv *Text) ConnectTextCaretMoved(callback TextSignalTextCaretMovedCallback) int {\n\tsignalTextTextCaretMovedLock.Lock()\n\tdefer signalTextTextCaretMovedLock.Unlock()\n\n\tsignalTextTextCaretMovedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_caret_moved(instance, C.gpointer(uintptr(signalTextTextCaretMovedId)))\n\n\tdetail := signalTextTextCaretMovedDetail{callback, handlerID}\n\tsignalTextTextCaretMovedMap[signalTextTextCaretMovedId] = detail\n\n\treturn signalTextTextCaretMovedId\n}", "title": "" }, { "docid": "0967d052fef9096476e655b11847ffe3", "score": "0.5952855", "text": "func (recv *ComboBoxText) Remove(position int32) {\n\tc_position := (C.gint)(position)\n\n\tC.gtk_combo_box_text_remove((*C.GtkComboBoxText)(recv.native), c_position)\n\n\treturn\n}", "title": "" }, { "docid": "561e8100aea9e54fe4a838f565809657", "score": "0.5919271", "text": "func (recv *CellEditable) ConnectRemoveWidget(callback CellEditableSignalRemoveWidgetCallback) int {\n\tsignalCellEditableRemoveWidgetLock.Lock()\n\tdefer signalCellEditableRemoveWidgetLock.Unlock()\n\n\tsignalCellEditableRemoveWidgetId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.CellEditable_signal_connect_remove_widget(instance, C.gpointer(uintptr(signalCellEditableRemoveWidgetId)))\n\n\tdetail := signalCellEditableRemoveWidgetDetail{callback, handlerID}\n\tsignalCellEditableRemoveWidgetMap[signalCellEditableRemoveWidgetId] = detail\n\n\treturn signalCellEditableRemoveWidgetId\n}", "title": "" }, { "docid": "e37f86a3aa4c3c9088986f8188da4f18", "score": "0.5906939", "text": "func (recv *Text) ConnectTextInsert(callback TextSignalTextInsertCallback) int {\n\tsignalTextTextInsertLock.Lock()\n\tdefer signalTextTextInsertLock.Unlock()\n\n\tsignalTextTextInsertId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_insert(instance, C.gpointer(uintptr(signalTextTextInsertId)))\n\n\tdetail := signalTextTextInsertDetail{callback, handlerID}\n\tsignalTextTextInsertMap[signalTextTextInsertId] = detail\n\n\treturn signalTextTextInsertId\n}", "title": "" }, { "docid": "d0792f4d5743483a2f341e1edc684676", "score": "0.58183044", "text": "func (recv *Text) ConnectTextChanged(callback TextSignalTextChangedCallback) int {\n\tsignalTextTextChangedLock.Lock()\n\tdefer signalTextTextChangedLock.Unlock()\n\n\tsignalTextTextChangedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Text_signal_connect_text_changed(instance, C.gpointer(uintptr(signalTextTextChangedId)))\n\n\tdetail := signalTextTextChangedDetail{callback, handlerID}\n\tsignalTextTextChangedMap[signalTextTextChangedId] = detail\n\n\treturn signalTextTextChangedId\n}", "title": "" }, { "docid": "671170ed5d1e5efbc85dfc00a6cd1674", "score": "0.5796696", "text": "func (recv *Text) DisconnectTextChanged(connectionID int) {\n\tsignalTextTextChangedLock.Lock()\n\tdefer signalTextTextChangedLock.Unlock()\n\n\tdetail, exists := signalTextTextChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTextChangedMap, connectionID)\n}", "title": "" }, { "docid": "15cd71f1271545e0eca850cd823be357", "score": "0.57372", "text": "func (recv *Statusbar) DisconnectTextPushed(connectionID int) {\n\tsignalStatusbarTextPushedLock.Lock()\n\tdefer signalStatusbarTextPushedLock.Unlock()\n\n\tdetail, exists := signalStatusbarTextPushedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalStatusbarTextPushedMap, connectionID)\n}", "title": "" }, { "docid": "e54abea2710d6a3d5c23b138ad69191f", "score": "0.57299846", "text": "func (recv *Statusbar) ConnectTextPopped(callback StatusbarSignalTextPoppedCallback) int {\n\tsignalStatusbarTextPoppedLock.Lock()\n\tdefer signalStatusbarTextPoppedLock.Unlock()\n\n\tsignalStatusbarTextPoppedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Statusbar_signal_connect_text_popped(instance, C.gpointer(uintptr(signalStatusbarTextPoppedId)))\n\n\tdetail := signalStatusbarTextPoppedDetail{callback, handlerID}\n\tsignalStatusbarTextPoppedMap[signalStatusbarTextPoppedId] = detail\n\n\treturn signalStatusbarTextPoppedId\n}", "title": "" }, { "docid": "1b114dea4fe19886783dc82e94f5f47d", "score": "0.57147217", "text": "func (recv *Container) ConnectRemove(callback ContainerSignalRemoveCallback) int {\n\tsignalContainerRemoveLock.Lock()\n\tdefer signalContainerRemoveLock.Unlock()\n\n\tsignalContainerRemoveId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Container_signal_connect_remove(instance, C.gpointer(uintptr(signalContainerRemoveId)))\n\n\tdetail := signalContainerRemoveDetail{callback, handlerID}\n\tsignalContainerRemoveMap[signalContainerRemoveId] = detail\n\n\treturn signalContainerRemoveId\n}", "title": "" }, { "docid": "bfd5a364fc5093da8c36720d0359aaa8", "score": "0.56802106", "text": "func (recv *TextBuffer) ConnectInsertText(callback TextBufferSignalInsertTextCallback) int {\n\tsignalTextBufferInsertTextLock.Lock()\n\tdefer signalTextBufferInsertTextLock.Unlock()\n\n\tsignalTextBufferInsertTextId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_insert_text(instance, C.gpointer(uintptr(signalTextBufferInsertTextId)))\n\n\tdetail := signalTextBufferInsertTextDetail{callback, handlerID}\n\tsignalTextBufferInsertTextMap[signalTextBufferInsertTextId] = detail\n\n\treturn signalTextBufferInsertTextId\n}", "title": "" }, { "docid": "895a98849606cb80526629ad2178bbbd", "score": "0.5608356", "text": "func (recv *EntryBuffer) ConnectInsertedText(callback EntryBufferSignalInsertedTextCallback) int {\n\tsignalEntryBufferInsertedTextLock.Lock()\n\tdefer signalEntryBufferInsertedTextLock.Unlock()\n\n\tsignalEntryBufferInsertedTextId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.EntryBuffer_signal_connect_inserted_text(instance, C.gpointer(uintptr(signalEntryBufferInsertedTextId)))\n\n\tdetail := signalEntryBufferInsertedTextDetail{callback, handlerID}\n\tsignalEntryBufferInsertedTextMap[signalEntryBufferInsertedTextId] = detail\n\n\treturn signalEntryBufferInsertedTextId\n}", "title": "" }, { "docid": "06311e135c0df6bb101a098a1b9d1712", "score": "0.56048083", "text": "func (recv *TextBuffer) ConnectDeleteRange(callback TextBufferSignalDeleteRangeCallback) int {\n\tsignalTextBufferDeleteRangeLock.Lock()\n\tdefer signalTextBufferDeleteRangeLock.Unlock()\n\n\tsignalTextBufferDeleteRangeId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_delete_range(instance, C.gpointer(uintptr(signalTextBufferDeleteRangeId)))\n\n\tdetail := signalTextBufferDeleteRangeDetail{callback, handlerID}\n\tsignalTextBufferDeleteRangeMap[signalTextBufferDeleteRangeId] = detail\n\n\treturn signalTextBufferDeleteRangeId\n}", "title": "" }, { "docid": "458cb697f28863c3662e164bc15376ab", "score": "0.5589099", "text": "func (recv *EntryBuffer) DeleteText(position uint32, nChars int32) uint32 {\n\tc_position := (C.guint)(position)\n\n\tc_n_chars := (C.gint)(nChars)\n\n\tretC := C.gtk_entry_buffer_delete_text((*C.GtkEntryBuffer)(recv.native), c_position, c_n_chars)\n\tretGo := (uint32)(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "910046d5353be9ccbd3fa7e7a898e3a3", "score": "0.5576556", "text": "func (recv *Statusbar) DisconnectTextPopped(connectionID int) {\n\tsignalStatusbarTextPoppedLock.Lock()\n\tdefer signalStatusbarTextPoppedLock.Unlock()\n\n\tdetail, exists := signalStatusbarTextPoppedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalStatusbarTextPoppedMap, connectionID)\n}", "title": "" }, { "docid": "4dacf54e622c00723f60e559cdea1668", "score": "0.5553463", "text": "func (recv *TextTagTable) Remove(tag *TextTag) {\n\tc_tag := (*C.GtkTextTag)(C.NULL)\n\tif tag != nil {\n\t\tc_tag = (*C.GtkTextTag)(tag.ToC())\n\t}\n\n\tC.gtk_text_tag_table_remove((*C.GtkTextTagTable)(recv.native), c_tag)\n\n\treturn\n}", "title": "" }, { "docid": "3a6f3ae3ea4bf99ca150fbf421b44429", "score": "0.5499774", "text": "func (recv *TextView) ConnectDeleteFromCursor(callback TextViewSignalDeleteFromCursorCallback) int {\n\tsignalTextViewDeleteFromCursorLock.Lock()\n\tdefer signalTextViewDeleteFromCursorLock.Unlock()\n\n\tsignalTextViewDeleteFromCursorId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextView_signal_connect_delete_from_cursor(instance, C.gpointer(uintptr(signalTextViewDeleteFromCursorId)))\n\n\tdetail := signalTextViewDeleteFromCursorDetail{callback, handlerID}\n\tsignalTextViewDeleteFromCursorMap[signalTextViewDeleteFromCursorId] = detail\n\n\treturn signalTextViewDeleteFromCursorId\n}", "title": "" }, { "docid": "5951d4c3f3f85a24a2d28244296cffaf", "score": "0.5449683", "text": "func (jbobject *CustomStyledTextContent) RemoveTextChangeListener(a CustomTextChangeListenerInterface) {\n\tconv_a := javabind.NewGoToJavaCallable()\n\tif err := conv_a.Convert(a); err != nil {\n\t\tpanic(err)\n\t}\n\t_, err := jbobject.CallMethod(javabind.GetEnv(), \"removeTextChangeListener\", javabind.Void, conv_a.Value().Cast(\"org/eclipse/swt/custom/TextChangeListener\"))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tconv_a.CleanUp()\n\n}", "title": "" }, { "docid": "fbd2dba496950a15ebbc4aa7e084d0cf", "score": "0.54095316", "text": "func (recv *Statusbar) ConnectTextPushed(callback StatusbarSignalTextPushedCallback) int {\n\tsignalStatusbarTextPushedLock.Lock()\n\tdefer signalStatusbarTextPushedLock.Unlock()\n\n\tsignalStatusbarTextPushedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Statusbar_signal_connect_text_pushed(instance, C.gpointer(uintptr(signalStatusbarTextPushedId)))\n\n\tdetail := signalStatusbarTextPushedDetail{callback, handlerID}\n\tsignalStatusbarTextPushedMap[signalStatusbarTextPushedId] = detail\n\n\treturn signalStatusbarTextPushedId\n}", "title": "" }, { "docid": "c150564bf90afd8fe370908dc35a3a2f", "score": "0.5342945", "text": "func (recv *TextBuffer) DisconnectRemoveTag(connectionID int) {\n\tsignalTextBufferRemoveTagLock.Lock()\n\tdefer signalTextBufferRemoveTagLock.Unlock()\n\n\tdetail, exists := signalTextBufferRemoveTagMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferRemoveTagMap, connectionID)\n}", "title": "" }, { "docid": "fadf47548059202bcfc353dcb370b4ef", "score": "0.53159267", "text": "func (recv *Editable) DeleteText(startPos int32, endPos int32) {\n\tc_start_pos := (C.gint)(startPos)\n\n\tc_end_pos := (C.gint)(endPos)\n\n\tC.gtk_editable_delete_text((*C.GtkEditable)(recv.native), c_start_pos, c_end_pos)\n\n\treturn\n}", "title": "" }, { "docid": "d0ed640392b5b79c92acbc626b8064b4", "score": "0.5253002", "text": "func (ti *Input) Remove() {\n\tif len(ti.Text) == 0 {\n\t\treturn\n\t}\n\tti.Text = ti.Text[:len(ti.Text)-1]\n\tti.Render()\n}", "title": "" }, { "docid": "032ec5b84100428227b8fa118457e9da", "score": "0.5247641", "text": "func (recv *CellArea) ConnectRemoveEditable(callback CellAreaSignalRemoveEditableCallback) int {\n\tsignalCellAreaRemoveEditableLock.Lock()\n\tdefer signalCellAreaRemoveEditableLock.Unlock()\n\n\tsignalCellAreaRemoveEditableId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.CellArea_signal_connect_remove_editable(instance, C.gpointer(uintptr(signalCellAreaRemoveEditableId)))\n\n\tdetail := signalCellAreaRemoveEditableDetail{callback, handlerID}\n\tsignalCellAreaRemoveEditableMap[signalCellAreaRemoveEditableId] = detail\n\n\treturn signalCellAreaRemoveEditableId\n}", "title": "" }, { "docid": "fa641ada3b3326325ff8beb188e7ee3c", "score": "0.5201526", "text": "func (recv *CellRendererText) DisconnectEdited(connectionID int) {\n\tsignalCellRendererTextEditedLock.Lock()\n\tdefer signalCellRendererTextEditedLock.Unlock()\n\n\tdetail, exists := signalCellRendererTextEditedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalCellRendererTextEditedMap, connectionID)\n}", "title": "" }, { "docid": "063c7951c059b8105362be7a47dba298", "score": "0.518176", "text": "func (w *TextTagTable) Remove(tag *TextTag) {\n\tw.Candy().Guify(\"gtk_text_tag_table_remove\", w, tag)\n}", "title": "" }, { "docid": "d02b810e1f68958d3a716dd5ebef7191", "score": "0.5171112", "text": "func (m *CirconusMetrics) RemoveText(metric string) {\n\tm.tm.Lock()\n\tdefer m.tm.Unlock()\n\tdelete(m.text, metric)\n}", "title": "" }, { "docid": "9c69a874b406de08e702978254c56a2b", "score": "0.51657116", "text": "func (recv *EditableText) DeleteText(startPos int32, endPos int32) {\n\tc_start_pos := (C.gint)(startPos)\n\n\tc_end_pos := (C.gint)(endPos)\n\n\tC.atk_editable_text_delete_text((*C.AtkEditableText)(recv.native), c_start_pos, c_end_pos)\n\n\treturn\n}", "title": "" }, { "docid": "6478187b426154d281347328adeead92", "score": "0.51002604", "text": "func (recv *TextView) DisconnectDeleteFromCursor(connectionID int) {\n\tsignalTextViewDeleteFromCursorLock.Lock()\n\tdefer signalTextViewDeleteFromCursorLock.Unlock()\n\n\tdetail, exists := signalTextViewDeleteFromCursorMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextViewDeleteFromCursorMap, connectionID)\n}", "title": "" }, { "docid": "2cce085fad93fdcf3e6a69ea3c55a6c9", "score": "0.50547725", "text": "func (recv *TextBuffer) ConnectChanged(callback TextBufferSignalChangedCallback) int {\n\tsignalTextBufferChangedLock.Lock()\n\tdefer signalTextBufferChangedLock.Unlock()\n\n\tsignalTextBufferChangedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_changed(instance, C.gpointer(uintptr(signalTextBufferChangedId)))\n\n\tdetail := signalTextBufferChangedDetail{callback, handlerID}\n\tsignalTextBufferChangedMap[signalTextBufferChangedId] = detail\n\n\treturn signalTextBufferChangedId\n}", "title": "" }, { "docid": "3e737e656767109cf2094b0180fb3476", "score": "0.5044873", "text": "func (recv *TextBuffer) DisconnectChanged(connectionID int) {\n\tsignalTextBufferChangedLock.Lock()\n\tdefer signalTextBufferChangedLock.Unlock()\n\n\tdetail, exists := signalTextBufferChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferChangedMap, connectionID)\n}", "title": "" }, { "docid": "2f03e6f03beb55c4fa67bd634d9c94d7", "score": "0.5033594", "text": "func (s *textStore) removeText (t *Text) {\n Assert (nilTextStore, s != nil)\n Assert (nilText, t != nil)\n Assert (nilTextIdStore, s != nil)\n \n if (t.Id != 0){ // if the id is zero, it was never saved\n \n // give the id back to the id store so it can be recycled\n rows := calculateTextRows(t.length)\n id := newTextId(t.Id, rows)\n s.idStore.addId(id)\n \n t.Id = 0\n \n // TODO do we need to write it or do we just wait for it to be overwritten ??\n \n }\n}", "title": "" }, { "docid": "6e9735adfbf7fb5a16bbeee13eba71e0", "score": "0.50106263", "text": "func (recv *TextView) DisconnectPreeditChanged(connectionID int) {\n\tsignalTextViewPreeditChangedLock.Lock()\n\tdefer signalTextViewPreeditChangedLock.Unlock()\n\n\tdetail, exists := signalTextViewPreeditChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextViewPreeditChangedMap, connectionID)\n}", "title": "" }, { "docid": "0f2c0bc4da3a028027adf7da9ebc87a3", "score": "0.5007442", "text": "func (recv *TextTagTable) DisconnectTagRemoved(connectionID int) {\n\tsignalTextTagTableTagRemovedLock.Lock()\n\tdefer signalTextTagTableTagRemovedLock.Unlock()\n\n\tdetail, exists := signalTextTagTableTagRemovedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTagTableTagRemovedMap, connectionID)\n}", "title": "" }, { "docid": "66154cc7c7d2eb0aef11d8ac202777ef", "score": "0.4991506", "text": "func (recv *TextTagTable) DisconnectTagAdded(connectionID int) {\n\tsignalTextTagTableTagAddedLock.Lock()\n\tdefer signalTextTagTableTagAddedLock.Unlock()\n\n\tdetail, exists := signalTextTagTableTagAddedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTagTableTagAddedMap, connectionID)\n}", "title": "" }, { "docid": "ac1e951a379680c2617c12c1026671d8", "score": "0.49673796", "text": "func (recv *TextBuffer) DisconnectDeleteRange(connectionID int) {\n\tsignalTextBufferDeleteRangeLock.Lock()\n\tdefer signalTextBufferDeleteRangeLock.Unlock()\n\n\tdetail, exists := signalTextBufferDeleteRangeMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferDeleteRangeMap, connectionID)\n}", "title": "" }, { "docid": "28c0e397baa817fe8e9f30cd8f5b2603", "score": "0.49128535", "text": "func (recv *CellRendererText) ConnectEdited(callback CellRendererTextSignalEditedCallback) int {\n\tsignalCellRendererTextEditedLock.Lock()\n\tdefer signalCellRendererTextEditedLock.Unlock()\n\n\tsignalCellRendererTextEditedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.CellRendererText_signal_connect_edited(instance, C.gpointer(uintptr(signalCellRendererTextEditedId)))\n\n\tdetail := signalCellRendererTextEditedDetail{callback, handlerID}\n\tsignalCellRendererTextEditedMap[signalCellRendererTextEditedId] = detail\n\n\treturn signalCellRendererTextEditedId\n}", "title": "" }, { "docid": "956aba8bf408b609630d4581c993bef2", "score": "0.48877504", "text": "func (recv *TextView) DisconnectInsertAtCursor(connectionID int) {\n\tsignalTextViewInsertAtCursorLock.Lock()\n\tdefer signalTextViewInsertAtCursorLock.Unlock()\n\n\tdetail, exists := signalTextViewInsertAtCursorMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextViewInsertAtCursorMap, connectionID)\n}", "title": "" }, { "docid": "7ba7ae1ad56cd9b8c901a338401a1442", "score": "0.48875433", "text": "func (recv *TextBuffer) Delete(start *TextIter, end *TextIter) {\n\tc_start := (*C.GtkTextIter)(C.NULL)\n\tif start != nil {\n\t\tc_start = (*C.GtkTextIter)(start.ToC())\n\t}\n\n\tc_end := (*C.GtkTextIter)(C.NULL)\n\tif end != nil {\n\t\tc_end = (*C.GtkTextIter)(end.ToC())\n\t}\n\n\tC.gtk_text_buffer_delete((*C.GtkTextBuffer)(recv.native), c_start, c_end)\n\n\treturn\n}", "title": "" }, { "docid": "c0114897e3e8edde7e9431298b975de7", "score": "0.4875698", "text": "func (m *CirconusMetrics) RemoveTextFunc(metric string) {\n\tm.tfm.Lock()\n\tdefer m.tfm.Unlock()\n\tdelete(m.textFuncs, metric)\n}", "title": "" }, { "docid": "2088c1615e6506e706b316f903aa94a8", "score": "0.4863307", "text": "func (recv *TextBuffer) DisconnectApplyTag(connectionID int) {\n\tsignalTextBufferApplyTagLock.Lock()\n\tdefer signalTextBufferApplyTagLock.Unlock()\n\n\tdetail, exists := signalTextBufferApplyTagMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferApplyTagMap, connectionID)\n}", "title": "" }, { "docid": "33fe9c6c60726d55872028bc1395c03c", "score": "0.4837713", "text": "func (recv *CellEditable) DisconnectRemoveWidget(connectionID int) {\n\tsignalCellEditableRemoveWidgetLock.Lock()\n\tdefer signalCellEditableRemoveWidgetLock.Unlock()\n\n\tdetail, exists := signalCellEditableRemoveWidgetMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalCellEditableRemoveWidgetMap, connectionID)\n}", "title": "" }, { "docid": "851340550730b9633534215433365b8b", "score": "0.48317516", "text": "func DeleteText(w http.ResponseWriter, r *http.Request) {\n\tfmt.Fprintln(w, \"not implemented yet !\")\n}", "title": "" }, { "docid": "049832a554f65506c244d4a5eff10b15", "score": "0.48306945", "text": "func (np *NotePad) TextChanged() {\n\t_o, _ := np.builder.GetObject(\"bt_close\")\n\tb := _o.(*gtk.Button)\n\tb.SetLabel(\"Cancel\")\n\tif np.noteSearch != nil {\n\t\tnp.noteSearch.ResetIter()\n\t}\n}", "title": "" }, { "docid": "9ad7d45bff45aee7061b227f3c819018", "score": "0.48306054", "text": "func (ele Element) ClearText() error {\n\tconfig := ele.ua.GetConfig()\n\tif err := ele.WaitForExists(config.WaitForExistsDuration, config.WaitForExistsMaxRetry); err != nil {\n\t\treturn err\n\t}\n\n\treturn ele.ua.post(\n\t\t&RPCOptions{\n\t\t\tMethod: \"clearTextField\",\n\t\t\tParams: []interface{}{getParams(ele.selector)},\n\t\t},\n\t\tnil,\n\t\tnil,\n\t)\n}", "title": "" }, { "docid": "ddd1b153b4446aa6ad578d37e11cb98f", "score": "0.48024508", "text": "func (n *Node) TrimText() string {\n\tif n.Type != TextNode {\n\t\treturn \"\"\n\t}\n\tans := strings.Builder{}\n\tgot_whitespace := false\n\tfor _, c := range n.Data {\n\t\tif unicode.IsSpace(c) {\n\t\t\tgot_whitespace = true\n\t\t\tcontinue\n\t\t}\n\t\tif got_whitespace && ans.Len() > 0 {\n\t\t\t_, err := ans.WriteRune(' ')\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\t\t}\n\t\tgot_whitespace = false\n\t\t_, err := ans.WriteRune(c)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\treturn ans.String()\n}", "title": "" }, { "docid": "4d7556752be3e1aaea0019e9d8c0641b", "score": "0.48004863", "text": "func (ftu *FieldTypeUpdate) ClearText() *FieldTypeUpdate {\n\tftu.mutation.ClearText()\n\treturn ftu\n}", "title": "" }, { "docid": "d64982c4b930265522ef4d6f276f6c2f", "score": "0.47915047", "text": "func (v *Editable) DeleteText(startPos, endPos int) {\n\tC.gtk_editable_delete_text(v.native(), C.gint(startPos), C.gint(endPos))\n}", "title": "" }, { "docid": "84c97491f99df84c7c9b68b22337d68e", "score": "0.47848424", "text": "func (self *BitmapText) CleanText(text string) string{\n return self.Object.Call(\"cleanText\", text).String()\n}", "title": "" }, { "docid": "f9da1b5c4fffa6a50f8c9d114fdffe8f", "score": "0.4774952", "text": "func DeleteTextModel(userID string, fileID string) string {\n\tdb := database.DBConnect\n\tdb.Debug().Where(\"id = ?\", fileID).Delete(&Text{})\n\treturn \"OK\"\n}", "title": "" }, { "docid": "5697340f16aad6db79c717c0a0e5a24f", "score": "0.47736806", "text": "func (recv *TextView) ConnectCutClipboard(callback TextViewSignalCutClipboardCallback) int {\n\tsignalTextViewCutClipboardLock.Lock()\n\tdefer signalTextViewCutClipboardLock.Unlock()\n\n\tsignalTextViewCutClipboardId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextView_signal_connect_cut_clipboard(instance, C.gpointer(uintptr(signalTextViewCutClipboardId)))\n\n\tdetail := signalTextViewCutClipboardDetail{callback, handlerID}\n\tsignalTextViewCutClipboardMap[signalTextViewCutClipboardId] = detail\n\n\treturn signalTextViewCutClipboardId\n}", "title": "" }, { "docid": "656cab2843696263f4587c51f6f4a373", "score": "0.4768604", "text": "func (recv *TextBuffer) ConnectMarkDeleted(callback TextBufferSignalMarkDeletedCallback) int {\n\tsignalTextBufferMarkDeletedLock.Lock()\n\tdefer signalTextBufferMarkDeletedLock.Unlock()\n\n\tsignalTextBufferMarkDeletedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_mark_deleted(instance, C.gpointer(uintptr(signalTextBufferMarkDeletedId)))\n\n\tdetail := signalTextBufferMarkDeletedDetail{callback, handlerID}\n\tsignalTextBufferMarkDeletedMap[signalTextBufferMarkDeletedId] = detail\n\n\treturn signalTextBufferMarkDeletedId\n}", "title": "" }, { "docid": "ec4bbdd01f769afcb3e65ff4513772d4", "score": "0.475678", "text": "func (recv *ComboBoxText) RemoveAll() {\n\tC.gtk_combo_box_text_remove_all((*C.GtkComboBoxText)(recv.native))\n\n\treturn\n}", "title": "" }, { "docid": "ff52b85a85f39d009bc1517830687024", "score": "0.47558263", "text": "func (o *ContentText) Delete(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tif o == nil {\n\t\treturn 0, errors.New(\"sqlboilermodel: no ContentText provided for delete\")\n\t}\n\n\tif err := o.doBeforeDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\targs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(o)), contentTextPrimaryKeyMapping)\n\tsql := \"DELETE FROM \\\"content_text\\\" WHERE \\\"id\\\"=$1\"\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"sqlboilermodel: unable to delete from content_text\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"sqlboilermodel: failed to get rows affected by delete for content_text\")\n\t}\n\n\tif err := o.doAfterDeleteHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "3f47ce5f40895a183a41d15d9cd11485", "score": "0.4723506", "text": "func (recv *EditableText) CutText(startPos int32, endPos int32) {\n\tc_start_pos := (C.gint)(startPos)\n\n\tc_end_pos := (C.gint)(endPos)\n\n\tC.atk_editable_text_cut_text((*C.AtkEditableText)(recv.native), c_start_pos, c_end_pos)\n\n\treturn\n}", "title": "" }, { "docid": "2488a83bb672f22e3bae937a40f6f219", "score": "0.47216988", "text": "func (recv *Notebook) ConnectPageRemoved(callback NotebookSignalPageRemovedCallback) int {\n\tsignalNotebookPageRemovedLock.Lock()\n\tdefer signalNotebookPageRemovedLock.Unlock()\n\n\tsignalNotebookPageRemovedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Notebook_signal_connect_page_removed(instance, C.gpointer(uintptr(signalNotebookPageRemovedId)))\n\n\tdetail := signalNotebookPageRemovedDetail{callback, handlerID}\n\tsignalNotebookPageRemovedMap[signalNotebookPageRemovedId] = detail\n\n\treturn signalNotebookPageRemovedId\n}", "title": "" }, { "docid": "af311f3c32ba2dee854b101375056726", "score": "0.471063", "text": "func (mH *TextEnteredHandler) RemoveTextEnteredObserver(mO TextEnteredObserver) {\n\tfor i, o := range mH.observers {\n\t\tif o == mO {\n\t\t\tmH.observers = append(mH.observers[:i], mH.observers[i+1:]...)\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "91552325953749889b0536b77aa8e076", "score": "0.46904266", "text": "func (recv *TextBuffer) RemoveTag(tag *TextTag, start *TextIter, end *TextIter) {\n\tc_tag := (*C.GtkTextTag)(C.NULL)\n\tif tag != nil {\n\t\tc_tag = (*C.GtkTextTag)(tag.ToC())\n\t}\n\n\tc_start := (*C.GtkTextIter)(C.NULL)\n\tif start != nil {\n\t\tc_start = (*C.GtkTextIter)(start.ToC())\n\t}\n\n\tc_end := (*C.GtkTextIter)(C.NULL)\n\tif end != nil {\n\t\tc_end = (*C.GtkTextIter)(end.ToC())\n\t}\n\n\tC.gtk_text_buffer_remove_tag((*C.GtkTextBuffer)(recv.native), c_tag, c_start, c_end)\n\n\treturn\n}", "title": "" }, { "docid": "477172c1a844ec85bd2cc9ea60812cdf", "score": "0.46723002", "text": "func (recv *TextView) ConnectBackspace(callback TextViewSignalBackspaceCallback) int {\n\tsignalTextViewBackspaceLock.Lock()\n\tdefer signalTextViewBackspaceLock.Unlock()\n\n\tsignalTextViewBackspaceId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextView_signal_connect_backspace(instance, C.gpointer(uintptr(signalTextViewBackspaceId)))\n\n\tdetail := signalTextViewBackspaceDetail{callback, handlerID}\n\tsignalTextViewBackspaceMap[signalTextViewBackspaceId] = detail\n\n\treturn signalTextViewBackspaceId\n}", "title": "" }, { "docid": "f1067591dc662911061c753c13e2932a", "score": "0.4667829", "text": "func (recv *Text) RemoveSelection(selectionNum int32) bool {\n\tc_selection_num := (C.gint)(selectionNum)\n\n\tretC := C.atk_text_remove_selection((*C.AtkText)(recv.native), c_selection_num)\n\tretGo := retC == C.TRUE\n\n\treturn retGo\n}", "title": "" }, { "docid": "8d6350e3f252117a2e15a28088250ec4", "score": "0.4661", "text": "func (recv *TextTagTable) DisconnectTagChanged(connectionID int) {\n\tsignalTextTagTableTagChangedLock.Lock()\n\tdefer signalTextTagTableTagChangedLock.Unlock()\n\n\tdetail, exists := signalTextTagTableTagChangedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTagTableTagChangedMap, connectionID)\n}", "title": "" }, { "docid": "0bb81a006f72d3e4e6396bb2b986383b", "score": "0.46485516", "text": "func ConnectionsRemove(address *string) ClientFunc {\n\treturn gen(\"connections/remove\", Values{\n\t\t\"address\": address,\n\t})\n}", "title": "" }, { "docid": "001377ba1645285f1c2029138d31ce00", "score": "0.46475163", "text": "func (ftuo *FieldTypeUpdateOne) ClearText() *FieldTypeUpdateOne {\n\tftuo.mutation.ClearText()\n\treturn ftuo\n}", "title": "" }, { "docid": "0d5889a45c9398ef06771de69b4a0f40", "score": "0.46416837", "text": "func (recv *TextTag) ConnectEvent(callback TextTagSignalEventCallback) int {\n\tsignalTextTagEventLock.Lock()\n\tdefer signalTextTagEventLock.Unlock()\n\n\tsignalTextTagEventId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextTag_signal_connect_event(instance, C.gpointer(uintptr(signalTextTagEventId)))\n\n\tdetail := signalTextTagEventDetail{callback, handlerID}\n\tsignalTextTagEventMap[signalTextTagEventId] = detail\n\n\treturn signalTextTagEventId\n}", "title": "" }, { "docid": "c82156fab167670547ea2d381647f3db", "score": "0.46365666", "text": "func (recv *TextBuffer) DisconnectInsertPixbuf(connectionID int) {\n\tsignalTextBufferInsertPixbufLock.Lock()\n\tdefer signalTextBufferInsertPixbufLock.Unlock()\n\n\tdetail, exists := signalTextBufferInsertPixbufMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferInsertPixbufMap, connectionID)\n}", "title": "" }, { "docid": "90ab187090ce842fb71351410252db64", "score": "0.46357584", "text": "func (recv *ComboBoxText) AppendText(text string) {\n\tc_text := C.CString(text)\n\tdefer C.free(unsafe.Pointer(c_text))\n\n\tC.gtk_combo_box_text_append_text((*C.GtkComboBoxText)(recv.native), c_text)\n\n\treturn\n}", "title": "" }, { "docid": "ddb4d89d5a30740ebbbb0a6069f2eb73", "score": "0.46276492", "text": "func (c *TextConn) Quit() error {\n\t// quit\\r\\n\n\t// NOTE: noreply option is not allowed.\n\tc.write([]byte(\"quit\\r\\n\"))\n\tc.flush()\n\treturn c.Err()\n}", "title": "" }, { "docid": "8e689b253ec249177ee9c50d35134e3a", "score": "0.46216273", "text": "func (recv *Widget) ConnectDestroy(callback WidgetSignalDestroyCallback) int {\n\tsignalWidgetDestroyLock.Lock()\n\tdefer signalWidgetDestroyLock.Unlock()\n\n\tsignalWidgetDestroyId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Widget_signal_connect_destroy(instance, C.gpointer(uintptr(signalWidgetDestroyId)))\n\n\tdetail := signalWidgetDestroyDetail{callback, handlerID}\n\tsignalWidgetDestroyMap[signalWidgetDestroyId] = detail\n\n\treturn signalWidgetDestroyId\n}", "title": "" }, { "docid": "d49e16be21b54e298f2b9015b35cdf5f", "score": "0.46193862", "text": "func (o *SmsInboundMessage) GetCleanText() string {\n\tif o == nil || o.CleanText == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.CleanText\n}", "title": "" }, { "docid": "08f0e0fa42d65664726e4e98a50f2412", "score": "0.46146694", "text": "func (v Text) Close() error {\n\treturn nil\n}", "title": "" }, { "docid": "eb3d20d4192319088af222ae8ede9069", "score": "0.46127", "text": "func (recv *TextBuffer) DisconnectMarkDeleted(connectionID int) {\n\tsignalTextBufferMarkDeletedLock.Lock()\n\tdefer signalTextBufferMarkDeletedLock.Unlock()\n\n\tdetail, exists := signalTextBufferMarkDeletedMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextBufferMarkDeletedMap, connectionID)\n}", "title": "" }, { "docid": "474318269cb5d8fa23d5d72cd83f67c5", "score": "0.46112278", "text": "func (recv *TextTag) DisconnectEvent(connectionID int) {\n\tsignalTextTagEventLock.Lock()\n\tdefer signalTextTagEventLock.Unlock()\n\n\tdetail, exists := signalTextTagEventMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextTagEventMap, connectionID)\n}", "title": "" }, { "docid": "6347fedbdfaa129f2bb71b2d29c82be9", "score": "0.46052387", "text": "func (recv *Application) ConnectWindowRemoved(callback ApplicationSignalWindowRemovedCallback) int {\n\tsignalApplicationWindowRemovedLock.Lock()\n\tdefer signalApplicationWindowRemovedLock.Unlock()\n\n\tsignalApplicationWindowRemovedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.Application_signal_connect_window_removed(instance, C.gpointer(uintptr(signalApplicationWindowRemovedId)))\n\n\tdetail := signalApplicationWindowRemovedDetail{callback, handlerID}\n\tsignalApplicationWindowRemovedMap[signalApplicationWindowRemovedId] = detail\n\n\treturn signalApplicationWindowRemovedId\n}", "title": "" }, { "docid": "a71e1c35813f6f5a59ab12f2e05917a9", "score": "0.4594934", "text": "func (recv *TextView) DisconnectMoveCursor(connectionID int) {\n\tsignalTextViewMoveCursorLock.Lock()\n\tdefer signalTextViewMoveCursorLock.Unlock()\n\n\tdetail, exists := signalTextViewMoveCursorMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextViewMoveCursorMap, connectionID)\n}", "title": "" }, { "docid": "d6a95f59203e919ac2ed948ea528368d", "score": "0.45887047", "text": "func (recv *Container) DisconnectRemove(connectionID int) {\n\tsignalContainerRemoveLock.Lock()\n\tdefer signalContainerRemoveLock.Unlock()\n\n\tdetail, exists := signalContainerRemoveMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalContainerRemoveMap, connectionID)\n}", "title": "" }, { "docid": "b8d6129013db6068760d5258b27d8993", "score": "0.45744917", "text": "func (s *BaseRCSListener) ExitDeltatext_text(ctx *Deltatext_textContext) {}", "title": "" }, { "docid": "01dc7c39bcc5b34aeb2407668235b709", "score": "0.45635784", "text": "func (recv *TextView) DisconnectCutClipboard(connectionID int) {\n\tsignalTextViewCutClipboardLock.Lock()\n\tdefer signalTextViewCutClipboardLock.Unlock()\n\n\tdetail, exists := signalTextViewCutClipboardMap[connectionID]\n\tif !exists {\n\t\treturn\n\t}\n\n\tinstance := C.gpointer(recv.native)\n\tC.g_signal_handler_disconnect(instance, detail.handlerID)\n\tdelete(signalTextViewCutClipboardMap, connectionID)\n}", "title": "" }, { "docid": "d98ba21f08bdaa9675280fd2f4ea5fea", "score": "0.45629114", "text": "func (recv *ComboBoxText) InsertText(position int32, text string) {\n\tc_position := (C.gint)(position)\n\n\tc_text := C.CString(text)\n\tdefer C.free(unsafe.Pointer(c_text))\n\n\tC.gtk_combo_box_text_insert_text((*C.GtkComboBoxText)(recv.native), c_position, c_text)\n\n\treturn\n}", "title": "" }, { "docid": "9d14bdd18a014d4f05f25ce9a4ed4341", "score": "0.45530292", "text": "func (o *OptionalFontSelect) Remove() askew.Component {\n\tif o.αcur != nil {\n\t\tret := o.αcur\n\t\tret.Extract()\n\t\to.αcur = nil\n\t\treturn ret\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b510df205a7c1d049724d3b5fc30b3f", "score": "0.45441297", "text": "func (t *Text) Delete(ctx context.Context) *spanner.Mutation {\n\tvalues, _ := t.columnsToValues(TextPrimaryKeys())\n\treturn spanner.Delete(\"Texts\", spanner.Key(values))\n}", "title": "" }, { "docid": "2907d120c2947eb522c8c030ad333e6f", "score": "0.45164552", "text": "func (recv *TextIter) GetText(end *TextIter) string {\n\tc_end := (*C.GtkTextIter)(C.NULL)\n\tif end != nil {\n\t\tc_end = (*C.GtkTextIter)(end.ToC())\n\t}\n\n\tretC := C.gtk_text_iter_get_text((*C.GtkTextIter)(recv.native), c_end)\n\tretGo := C.GoString(retC)\n\tdefer C.free(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "a8267ad08ee3afc3126ebe70ef454ed9", "score": "0.4506718", "text": "func (recv *TextTagTable) ConnectTagChanged(callback TextTagTableSignalTagChangedCallback) int {\n\tsignalTextTagTableTagChangedLock.Lock()\n\tdefer signalTextTagTableTagChangedLock.Unlock()\n\n\tsignalTextTagTableTagChangedId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextTagTable_signal_connect_tag_changed(instance, C.gpointer(uintptr(signalTextTagTableTagChangedId)))\n\n\tdetail := signalTextTagTableTagChangedDetail{callback, handlerID}\n\tsignalTextTagTableTagChangedMap[signalTextTagTableTagChangedId] = detail\n\n\treturn signalTextTagTableTagChangedId\n}", "title": "" }, { "docid": "d05a80d38f2ad934a614c1e76eb4e21d", "score": "0.45064256", "text": "func (conn *Conn) RemoveMatchSignal(options ...MatchOption) error {\n\treturn conn.RemoveMatchSignalContext(context.Background(), options...)\n}", "title": "" }, { "docid": "9633fba655e8d10d679a182484591ea8", "score": "0.45017284", "text": "func (recv *EntryBuffer) EmitDeletedText(position uint32, nChars uint32) {\n\tc_position := (C.guint)(position)\n\n\tc_n_chars := (C.guint)(nChars)\n\n\tC.gtk_entry_buffer_emit_deleted_text((*C.GtkEntryBuffer)(recv.native), c_position, c_n_chars)\n\n\treturn\n}", "title": "" }, { "docid": "f3eafaef9f6cdb96612c994fae435d74", "score": "0.44969028", "text": "func (sc *SimConnect) Text(t uint32, fTimeSeconds float32, EventID uint32, pDataSet string) (error, uint32) {\n\tstr := convGoStringtoBytes(pDataSet)\n\tsize := len(str)\n\terr := sc.syscallSC.Text(sc.hSimConnect, uintptr(t), uintptr(fTimeSeconds), uintptr(EventID), uintptr(size), uintptr(unsafe.Pointer(&str[0])))\n\tid := new(uint32)\n\tsc.GetLastSentPacketID(id)\n\treturn err, *id\n}", "title": "" }, { "docid": "9b60b863212607143f185702b026afc6", "score": "0.4496234", "text": "func (recv *TextBuffer) ConnectApplyTag(callback TextBufferSignalApplyTagCallback) int {\n\tsignalTextBufferApplyTagLock.Lock()\n\tdefer signalTextBufferApplyTagLock.Unlock()\n\n\tsignalTextBufferApplyTagId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_apply_tag(instance, C.gpointer(uintptr(signalTextBufferApplyTagId)))\n\n\tdetail := signalTextBufferApplyTagDetail{callback, handlerID}\n\tsignalTextBufferApplyTagMap[signalTextBufferApplyTagId] = detail\n\n\treturn signalTextBufferApplyTagId\n}", "title": "" }, { "docid": "b961784999979d5fee6e0706b2c9253b", "score": "0.44942716", "text": "func (recv *TextBuffer) ConnectPasteDone(callback TextBufferSignalPasteDoneCallback) int {\n\tsignalTextBufferPasteDoneLock.Lock()\n\tdefer signalTextBufferPasteDoneLock.Unlock()\n\n\tsignalTextBufferPasteDoneId++\n\tinstance := C.gpointer(recv.native)\n\thandlerID := C.TextBuffer_signal_connect_paste_done(instance, C.gpointer(uintptr(signalTextBufferPasteDoneId)))\n\n\tdetail := signalTextBufferPasteDoneDetail{callback, handlerID}\n\tsignalTextBufferPasteDoneMap[signalTextBufferPasteDoneId] = detail\n\n\treturn signalTextBufferPasteDoneId\n}", "title": "" } ]
b0ee9b75d5a5dc5031edd8f7332e3842
NewWithClient creates a new instance of the accounts resource API This client requires a dependency injected http client and retry sleeper
[ { "docid": "0bba07f184e7100fda8e5ba359de277b", "score": "0.68523246", "text": "func NewWithClient(c client.HTTPClient, s client.RetrySleeper) (*Resource, error) {\n\tif c == nil {\n\t\treturn nil, fmt.Errorf(\"accounts.NewWithClient: nil client.HTTPClient\")\n\t}\n\tif s == nil {\n\t\treturn nil, fmt.Errorf(\"accounts.NewWithClient: nil client.RetrySleeper\")\n\t}\n\n\t// DEBT: The base URL needs to be exposed so as to override it\n\treturn &Resource{\n\t\tBaseURL: defultBaseURL,\n\t\tclient: c,\n\t\tretrySleeper: s,\n\t}, nil\n}", "title": "" } ]
[ { "docid": "b57281a19c0a94243cda32f0b9b1b5b4", "score": "0.6752985", "text": "func NewClient() (AccountServiceClient, func() error, error) {\n\n}", "title": "" }, { "docid": "526a96e86c97ac35572b4b0a5967abe9", "score": "0.6570737", "text": "func NewClient(ctx context.Context, account, key string, opts ...ClientOption) (*Client, error) {\n\tc := &Client{\n\t\tbackend: &beRoot{\n\t\t\tb2i: &b2Root{},\n\t\t},\n\t\tsMethods: []methodCounter{\n\t\t\tnewMethodCounter(time.Minute, time.Second),\n\t\t\tnewMethodCounter(time.Minute*5, time.Second),\n\t\t\tnewMethodCounter(time.Hour, time.Minute),\n\t\t\tnewMethodCounter(0, 0), // forever\n\t\t},\n\t}\n\topts = append(opts, client(c))\n\tfor _, f := range opts {\n\t\tf(&c.opts)\n\t}\n\tif err := c.backend.authorizeAccount(ctx, account, key, c.opts); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "687d3c79547f4003c5deebb461f7227f", "score": "0.6562601", "text": "func NewAccountsClient(accountsHostAndPort string, clientId string, clientSecret string) (Client, error) {\n\tmlog.Info(\"NewAccountsClient\")\n\n\t// If no host and port provided, attempt to get default value.\n\tif accountsHostAndPort == \"\" {\n\t\tmlog.Info(\"Getting Accounts Host and Port from environment variable.\")\n\n\t\tif accountsHostAndPort = os.Getenv(\"ACCOUNTS_HOST_PORT\"); accountsHostAndPort == \"\" {\n\t\t\tmlog.Error(\"Error, failed to get Accounts Host and Port.\")\n\t\t\treturn nil, errors.New(\"Error, Accounts Host and Port environment variable not found or invalid\")\n\t\t}\n\t}\n\n\t// Create the Accounts User Client.\n\taccountsClient := &AccountsClient{\n\t\tBaseClient: BaseClient{\n\t\t\thttpClient: management.NewHttpClient(),\n\t\t\tbaseUrl: fmt.Sprintf(\"http://%s\", accountsHostAndPort),\n\t\t},\n\t\tauthClient: NewNSAuthClient(accountsHostAndPort),\n\t\tclientId: clientId,\n\t\tclientSecret: clientSecret,\n\t}\n\n\treturn accountsClient, nil\n}", "title": "" }, { "docid": "d3d6860231505f1333a3e6d63a6f610e", "score": "0.64499474", "text": "func NewAccountClient(client *rest.Client) (*AccountClient, error) {\n\treturn &AccountClient{\n\t\tclient: client,\n\t}, nil\n}", "title": "" }, { "docid": "29ad650f0c32b1449715e7ef95281807", "score": "0.6380656", "text": "func newClient() Client {\n\tc := &client{}\n\n\tuuid, _ := uuid.NewV4()\n\tc.instanceID = \"client-\" + uuid.String()\n\tc.responses = &inflight{m: make(map[string]chan *Response)}\n\tc.defaults = Options{\"retries\": 2}\n\tc.timeout = NewTimeout(c)\n\n\tc.hostname, _ = os.Hostname()\n\tc.az, _ = plutil.GetAwsAZName()\n\n\treturn c\n}", "title": "" }, { "docid": "e75b51a601a89d2438e4e5642ff65150", "score": "0.63170123", "text": "func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient {\n\tcp := arm.ClientOptions{}\n\tif options != nil {\n\t\tcp = *options\n\t}\n\tif len(cp.Endpoint) == 0 {\n\t\tcp.Endpoint = arm.AzurePublicCloud\n\t}\n\tclient := &AccountsClient{\n\t\tsubscriptionID: subscriptionID,\n\t\thost: string(cp.Endpoint),\n\t\tpl: armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, &cp),\n\t}\n\treturn client\n}", "title": "" }, { "docid": "3aea4b64eba483db83d4b99fbd6a3382", "score": "0.6256717", "text": "func NewClient(ctx context.Context, account, key string) (*Client, error) {\n\tc := &Client{\n\t\tbackend: &beRoot{\n\t\t\tb2i: &b2Root{},\n\t\t},\n\t}\n\tif err := c.backend.authorizeAccount(ctx, account, key); err != nil {\n\t\treturn nil, err\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "1e755e399e8e0a77e06a7e77f464f12a", "score": "0.62523305", "text": "func New(config Config, withClient *http.Client) Client {\n\tcl := &client{\n\t\tConfig: config,\n\t\tErrLog: []ErrEntry{},\n\t\twg: &sync.WaitGroup{},\n\t\tRetryOnHTTP429: false,\n\t}\n\n\tif withClient != nil {\n\t\tcl.hc = withClient\n\t}\n\treturn cl\n}", "title": "" }, { "docid": "b0e22fb3d38fdf848a8746563208bbfd", "score": "0.624885", "text": "func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountsClient, error) {\n\tcl, err := arm.NewClient(moduleName+\".AccountsClient\", moduleVersion, credential, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tclient := &AccountsClient{\n\t\tsubscriptionID: subscriptionID,\n\t\tinternal: cl,\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "8d9d21d0cf0f0426019c5fb33182ba94", "score": "0.62435204", "text": "func (m *Manager) NewClient(accName string, client int) {\n\taccount, _ := m.GetAccByName(accName)\n\taccount.ClientType(client)\n\n\tswitch client {\n\tcase ent.BINANCE:\n\t\tbinance := &ent.Binance{}\n\t\tbinance.AccessExchange(account)\n\t\tfmt.Println(\"Access: \", binance.GetName())\n\t\tm.clients = append(m.clients, binance)\n\n\t// Comented for tests binance cli first\n\tcase ent.BITFINEX:\n\t\tbitfinex := &ent.Bitfinex{}\n\t\tbitfinex.AccessExchange(account)\n\t\tm.clients = append(m.clients, bitfinex)\n\t}\n}", "title": "" }, { "docid": "ed1f1600dcf6a46abe853c94acd4937a", "score": "0.6163552", "text": "func New(hostURL string) (*AccountRestClient, error) {\n\tc := resty.New()\n\n\tif v, err := validation.ValidateURL(hostURL); !v || err != nil {\n\t\treturn nil, errors.Wrap(err, \"validate host URL\")\n\t}\n\n\tc.SetHostURL(hostURL)\n\n\trc := AccountRestClient{\n\t\tclient: c,\n\t}\n\n\treturn &rc, nil\n}", "title": "" }, { "docid": "f1e9dce7e0e114a3aef0023eb46d43a9", "score": "0.61570954", "text": "func New(email, apiKey string) *Client {\n\tbucket := ratelimit.NewBucketWithQuantum(rateLimitReloadInterval, rateLimitMaxAmount, rateLimitReloadAmount)\n\n\treturn &Client{\n\t\temail: email,\n\t\tapiKey: apiKey,\n\t\trateLimitBucket: bucket,\n\t}\n}", "title": "" }, { "docid": "9d603f54a4deb10f5fcd6f2fa09f373a", "score": "0.61477363", "text": "func (s *WebhookTrigger) newClient() (*http.Client, error) {\n\ttimeout, err := s.getTimeout()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &http.Client{\n\t\tTimeout: timeout,\n\t}, nil\n}", "title": "" }, { "docid": "9aaa5bb61759c6104555710f0dda7933", "score": "0.6085708", "text": "func New(h *http.Client, accountID, username, password, developerID string) (*Client, error) {\n\tif accountID == \"\" || username == \"\" || password == \"\" || developerID == \"\" {\n\t\treturn nil, errorMissingCredentials\n\t}\n\tc := Client{\n\t\tClient: h,\n\t\tAccountID: accountID,\n\t\tUsername: username,\n\t\tPassword: password,\n\t\tDevID: developerID,\n\t\tbaseURL: DefaultBaseURL,\n\t\tuserAgent: DefaultUserAgent,\n\t}\n\treturn &c, nil\n}", "title": "" }, { "docid": "e2ec4271155907ce4d2d6eea7f5961e5", "score": "0.6079005", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "e2ec4271155907ce4d2d6eea7f5961e5", "score": "0.6079005", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "382310fbda0da10d68e1267e83eb6eed", "score": "0.60669994", "text": "func NewClient(httpClient *http.Client) *Client {\n\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBase)\n\n\tclient := &Client{\n\t\tclient: retryablehttp.NewClient(),\n\t\tBaseURL: baseURL,\n\t\tUserAgent: userAgent,\n\t}\n\n\tclient.client.HTTPClient = httpClient\n\tclient.client.Logger = nil\n\tclient.client.ErrorHandler = client.vultrErrorHandler\n\tclient.SetRetryLimit(retryLimit)\n\tclient.SetRateLimit(rateLimit)\n\n\tclient.Account = &AccountServiceHandler{client}\n\tclient.Application = &ApplicationServiceHandler{client}\n\tclient.Backup = &BackupServiceHandler{client}\n\tclient.BareMetalServer = &BareMetalServerServiceHandler{client}\n\tclient.Billing = &BillingServiceHandler{client}\n\tclient.BlockStorage = &BlockStorageServiceHandler{client}\n\tclient.Domain = &DomainServiceHandler{client}\n\tclient.DomainRecord = &DomainRecordsServiceHandler{client}\n\tclient.FirewallGroup = &FireWallGroupServiceHandler{client}\n\tclient.FirewallRule = &FireWallRuleServiceHandler{client}\n\tclient.Instance = &InstanceServiceHandler{client}\n\tclient.ISO = &ISOServiceHandler{client}\n\tclient.Kubernetes = &KubernetesHandler{client}\n\tclient.LoadBalancer = &LoadBalancerHandler{client}\n\tclient.Network = &NetworkServiceHandler{client}\n\tclient.ObjectStorage = &ObjectStorageServiceHandler{client}\n\tclient.OS = &OSServiceHandler{client}\n\tclient.Plan = &PlanServiceHandler{client}\n\tclient.Region = &RegionServiceHandler{client}\n\tclient.ReservedIP = &ReservedIPServiceHandler{client}\n\tclient.Snapshot = &SnapshotServiceHandler{client}\n\tclient.SSHKey = &SSHKeyServiceHandler{client}\n\tclient.StartupScript = &StartupScriptServiceHandler{client}\n\tclient.User = &UserServiceHandler{client}\n\tclient.VPC = &VPCServiceHandler{client}\n\n\treturn client\n}", "title": "" }, { "docid": "0232a0413abd3d4eaabfc4b36bb8af18", "score": "0.60536665", "text": "func NewClient(url string, username string, password string, account string, role string) (*Client, error) {\n\tcreds := Basic{Username: username, Password: password}\n\n\tclient := Client{\n\t\tCredentials: &creds,\n\t\tAccountDetails: AccountDetails{Account: account, Role: role},\n\t\tBaseURL: url,\n\t\thttp: cleanhttp.DefaultClient(),\n\t\tuserAgent: \"alks-go\",\n\t}\n\n\treturn &client, nil\n}", "title": "" }, { "docid": "e5db9ae4253de04d71141686af6f7ac9", "score": "0.6042821", "text": "func New(AppId int) (*Client, error) {\n\tendPoint, err := url.Parse(DefaultEndpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\trl := ratelimit.New(1, time.Duration(2)*time.Second)\n\tc := &Client{\n\t\tEndpoint: endPoint,\n\t\tHTTPClient: http.DefaultClient,\n\t\trl: rl,\n\t\tAppId: AppId,\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "f725a488177f871bd3f22a421a56aa14", "score": "0.6036946", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\tlistEndpoint, _ := url.Parse(defaultListEndpoint)\n\taccountEndpoint, _ := url.Parse(defaultAccountEndpoint)\n\tanimeAddEndpoint, _ := url.Parse(defaultAnimeAddEndpoint)\n\tanimeUpdateEndpoint, _ := url.Parse(defaultAnimeUpdateEndpoint)\n\tanimeDeleteEndpoint, _ := url.Parse(defaultAnimeDeleteEndpoint)\n\tanimeSearchEndpoint, _ := url.Parse(defaultAnimeSearchEndpoint)\n\tmangaAddEndpoint, _ := url.Parse(defaultMangaAddEndpoint)\n\tmangaUpdateEndpoint, _ := url.Parse(defaultMangaUpdateEndpoint)\n\tmangaDeleteEndpoint, _ := url.Parse(defaultMangaDeleteEndpoint)\n\tmangaSearchEndpoint, _ := url.Parse(defaultMangaSearchEndpoint)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tUserAgent: defaultUserAgent,\n\t\tBaseURL: baseURL,\n\t}\n\n\tc.Account = &AccountService{\n\t\tclient: c,\n\t\tEndpoint: accountEndpoint,\n\t}\n\n\tc.Anime = &AnimeService{\n\t\tclient: c,\n\t\tListEndpoint: listEndpoint,\n\t\tAddEndpoint: animeAddEndpoint,\n\t\tUpdateEndpoint: animeUpdateEndpoint,\n\t\tDeleteEndpoint: animeDeleteEndpoint,\n\t\tSearchEndpoint: animeSearchEndpoint,\n\t}\n\n\tc.Manga = &MangaService{\n\t\tclient: c,\n\t\tListEndpoint: listEndpoint,\n\t\tAddEndpoint: mangaAddEndpoint,\n\t\tUpdateEndpoint: mangaUpdateEndpoint,\n\t\tDeleteEndpoint: mangaDeleteEndpoint,\n\t\tSearchEndpoint: mangaSearchEndpoint,\n\t}\n\treturn c\n}", "title": "" }, { "docid": "ee23a6792e28bec8c9540fad903996a2", "score": "0.6034669", "text": "func NewClient(httpClient *http.Client, baseURL, token string) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\t// Create the client\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t\tToken: token,\n\t\tVersion: defaultVersion,\n\t}\n\n\t// Add the endpoints\n\tc.Access = &Endpoint{client: c}\n\tc.Analytics = &Endpoint{client: c}\n\tc.Ariel = &Endpoint{client: c}\n\tc.Auth = &Endpoint{client: c}\n\tc.AssetModel = &Endpoint{client: c}\n\tc.BackupAndRestore = &Endpoint{client: c}\n\tc.BandwithManager = &Endpoint{client: c}\n\tc.Config = &Endpoint{client: c}\n\tc.DataClassification = &Endpoint{client: c}\n\tc.DisasterRecovery = &Endpoint{client: c}\n\tc.DynamicSearch = &Endpoint{client: c}\n\tc.Forensics = &Endpoint{client: c}\n\tc.GUIAppFramework = &Endpoint{client: c}\n\tc.HealthData = &Endpoint{client: c}\n\tc.Help = &Endpoint{client: c}\n\tc.Qni = &Endpoint{client: c}\n\tc.Qrm = &Endpoint{client: c}\n\tc.Qvm = &Endpoint{client: c}\n\tc.ReferenceData = &Endpoint{client: c}\n\tc.Scanner = &Endpoint{client: c}\n\tc.Services = &Endpoint{client: c}\n\tc.SIEM = &Endpoint{client: c}\n\tc.StagedConfig = &Endpoint{client: c}\n\tc.System = &Endpoint{client: c}\n\n\treturn c\n}", "title": "" }, { "docid": "d99f8a7f3330ae47079e9347d50fbf5b", "score": "0.60299426", "text": "func NewClient(apiKey string) *Client {\n\tc := &Client{}\n\tc.common.client = c\n\n\tc.apiKey = apiKey\n\tc.HTTPClient = &http.Client{\n\t\tTimeout: 5 * time.Second,\n\t}\n\tc.BaseURL = baseURL\n\tc.AccountAPI = (*AccountAPI)(&c.common)\n\tc.SignatureRequestAPI = (*SignatureRequestAPI)(&c.common)\n\tc.TeamAPI = (*TeamAPI)(&c.common)\n\treturn c\n}", "title": "" }, { "docid": "a44dfecfe92cef15d6fd5739f7b7fc67", "score": "0.60146034", "text": "func NewClient(baseClient *http.Client, conf *Config) (mollie *Client, err error) {\n\tif baseClient == nil {\n\t\tbaseClient = http.DefaultClient\n\t}\n\n\turi, _ := url.Parse(BaseURL)\n\n\tmollie = &Client{\n\t\tBaseURL: uri,\n\t\tclient: baseClient,\n\t\tconfig: conf,\n\t\tidempotencyKeyProvider: nil,\n\t}\n\n\tmollie.common.client = mollie\n\n\tif mollie.config.reqIdempotency {\n\t\tmollie.common.client.idempotencyKeyProvider = idempotency.NewStdGenerator()\n\t}\n\n\t// services for resources\n\tmollie.Payments = (*PaymentsService)(&mollie.common)\n\tmollie.Chargebacks = (*ChargebacksService)(&mollie.common)\n\tmollie.PaymentMethods = (*PaymentMethodsService)(&mollie.common)\n\tmollie.Invoices = (*InvoicesService)(&mollie.common)\n\tmollie.Organizations = (*OrganizationsService)(&mollie.common)\n\tmollie.Profiles = (*ProfilesService)(&mollie.common)\n\tmollie.Refunds = (*RefundsService)(&mollie.common)\n\tmollie.Shipments = (*ShipmentsService)(&mollie.common)\n\tmollie.Orders = (*OrdersService)(&mollie.common)\n\tmollie.Captures = (*CapturesService)(&mollie.common)\n\tmollie.Settlements = (*SettlementsService)(&mollie.common)\n\tmollie.Subscriptions = (*SubscriptionsService)(&mollie.common)\n\tmollie.Customers = (*CustomersService)(&mollie.common)\n\tmollie.Miscellaneous = (*MiscellaneousService)(&mollie.common)\n\tmollie.Mandates = (*MandatesService)(&mollie.common)\n\tmollie.Permissions = (*PermissionsService)(&mollie.common)\n\tmollie.Onboarding = (*OnboardingService)(&mollie.common)\n\tmollie.PaymentLinks = (*PaymentLinksService)(&mollie.common)\n\tmollie.Partners = (*PartnerService)(&mollie.common)\n\tmollie.Balances = (*BalancesService)(&mollie.common)\n\tmollie.ClientLinks = (*ClientLinksService)(&mollie.common)\n\tmollie.Terminals = (*TerminalsService)(&mollie.common)\n\n\tmollie.userAgent = strings.Join([]string{\n\t\truntime.GOOS,\n\t\truntime.GOARCH,\n\t\truntime.Version(),\n\t}, \";\")\n\n\t// Parse authorization from specified environment variable\n\ttkn, ok := os.LookupEnv(mollie.config.auth)\n\tif ok {\n\t\tmollie.authentication = tkn\n\t}\n\n\treturn mollie, nil\n}", "title": "" }, { "docid": "beb06303c99de88d9dd991d10c42638d", "score": "0.6003209", "text": "func NewAccountClient(tracer opentracing.Tracer, logger logrus.FieldLogger, accountURL string) *AccountClient {\n\treturn &AccountClient{\n\t\tlogger: logger,\n\t\tclient: &http.Client{\n\t\t\tTransport: trace.NewTransport(tracer,\n\t\t\t\ttrace.TransportComponentName(\"Customer Client\"))},\n\t\taccountURL: accountURL,\n\t}\n}", "title": "" }, { "docid": "a00306752dfa50ed01078759fa831900", "score": "0.60004395", "text": "func NewClient(accountName string, apiKey string) (*Client, error) {\n\tif accountName == \"\" {\n\t\treturn nil, errors.New(\"credentials missing: accountName\")\n\t}\n\n\tif apiKey == \"\" {\n\t\treturn nil, errors.New(\"credentials missing: apiKey\")\n\t}\n\n\tbaseURL, err := url.Parse(defaultBaseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\taccountName: accountName,\n\t\tapiKey: apiKey,\n\t\tbaseURL: baseURL,\n\t\tHTTPClient: &http.Client{Timeout: 5 * time.Second},\n\t}, nil\n}", "title": "" }, { "docid": "263d2c407cecc61c3c84ba957c6b04d9", "score": "0.5985063", "text": "func NewAccountsClient(environment *azureclient.AROEnvironment, subscriptionID string, authorizer autorest.Authorizer) AccountsClient {\n\tclient := mgmtstorage.NewAccountsClientWithBaseURI(environment.ResourceManagerEndpoint, subscriptionID)\n\tclient.Authorizer = authorizer\n\treturn &accountsClient{\n\t\tAccountsClient: client,\n\t}\n}", "title": "" }, { "docid": "5a4a61120d0edb625a55b583be84e995", "score": "0.59705794", "text": "func NewClient(apiUrl string, accountId string, keyId string, token string) *Client {\n\treturn &Client{\n\t\tapiUrl: apiUrl,\n\t\taccountId: accountId,\n\t\tkeyId: keyId,\n\t\ttoken: token,\n\t\thttp: &http.Client{},\n\t}\n}", "title": "" }, { "docid": "0e6a88dbb4ba275e9fb716f2982c938e", "score": "0.5907617", "text": "func NewAccountClientFactory(t thrift.TTransport, f thrift.TProtocolFactory) *AccountClient {\n return &AccountClient{\n c: thrift.NewTStandardClient(f.GetProtocol(t), f.GetProtocol(t)),\n }\n}", "title": "" }, { "docid": "50ab39de1f71a08cd12ae7e8aa8babf8", "score": "0.5896321", "text": "func NewClient(cfg ClientConfig) (Service, error) {\n\terr := cfg.validate()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbaseURL, err := url.Parse(cfg.ServiceURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\toptions := []kithttp.ClientOption{\n\t\tkithttp.SetClient(&http.Client{\n\t\t\tTimeout: cfg.Timeout,\n\t\t}),\n\t}\n\n\tc := &client{\n\t\tgetAccountEndpoint: kithttp.NewClient(\n\t\t\thttp.MethodGet,\n\t\t\tbaseURL,\n\t\t\tencodeGetAccountRequest,\n\t\t\tdecodeGetAccountResponse,\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t\tgetPaymentsEndpoint: kithttp.NewClient(\n\t\t\thttp.MethodGet,\n\t\t\tbaseURL,\n\t\t\tencodeGetPaymentsRequest,\n\t\t\tdecodeGetPaymentsResponse,\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t\tapplyPaymentEndpoint: kithttp.NewClient(\n\t\t\thttp.MethodPost,\n\t\t\tbaseURL,\n\t\t\tencodeApplyPaymentRequest,\n\t\t\tdecodeApplyPaymentResponse,\n\t\t\toptions...,\n\t\t).Endpoint(),\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "1293f8a96b39d0b98ad180731aeb99e4", "score": "0.58939546", "text": "func NewClient(httpClient *http.Client, apiKey string) *Client {\n\tbase := sling.New().Client(httpClient)\n\tbase.SetBasicAuth(apiKey, \"\")\n\n\treturn &Client{\n\t\tapiKey: apiKey,\n\t\tAutocomplete: newAutocompleteService(base.New()),\n\t\tPerson: newPersonService(base.New()),\n\t\tCompany: newCompanyService(base.New()),\n\t\tDiscovery: newDiscoveryService(base.New()),\n\t\tProspector: newProspectorService(base.New()),\n\t\tReveal: newRevealService(base.New()),\n\t}\n}", "title": "" }, { "docid": "e8242141ec047aee5e435269ade18330", "score": "0.5877934", "text": "func NewClient(apiKey string) *Client {\n\tc := &Client{\n\t\tclient: &http.Client{},\n\t\tApiKey: apiKey,\n\t}\n\tc.TimeEntries = &TimeEntriesService{client: c}\n\tc.Me = &MeService{client: c}\n\treturn c\n}", "title": "" }, { "docid": "049dc0384c4f420dd1b09393814e4292", "score": "0.58731985", "text": "func NewClient(httpClient *http.Client) *Client {\n\tbase := sling.New().Client(httpClient).Base(apiURL)\n\n\treturn &Client{\n\t\tsling: base,\n\t\tProjects: newProjectService(base.New()),\n\t\tDatabaseUsers: newDatabaseUserService(base.New()),\n\t}\n}", "title": "" }, { "docid": "81be516854f4a3b77d6297c692bfbdf7", "score": "0.585291", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseurl, err := url.Parse(viper.GetString(\"INTERVALS_URL\"))\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tc := &Client{client: httpClient}\n\tc.common.client = c\n\tc.PersonService = (*PersonService)(&c.common)\n\tc.TimeService = (*TimeService)(&c.common)\n\tc.BaseURL = baseurl\n\tc.APIKey = viper.GetString(\"INTERVALS_APIKEY\")\n\n\treturn c\n}", "title": "" }, { "docid": "8b4f729af100e8d018da03fc200248a0", "score": "0.5836598", "text": "func NewClient(url, username, password string, httpClients ...*http.Client) *Client {\n\tvar httpClient *http.Client\n\n\tif len(httpClients) > 0 {\n\t\thttpClient = httpClients[0]\n\t} else {\n\t\t// httpClient = http.DefaultClient\n\t\thttpClient = &http.Client{\n\t\t\tTransport: httplogger.NewLoggedTransport(http.DefaultTransport, newLogger()),\n\t\t}\n\t}\n\tbase := sling.New().Client(httpClient).SetBasicAuth(username, password).Base(url + \"/admin\")\n\n\treturn &Client{\n\t\tMail: NewMailService(base.New(), httpClient),\n\t}\n}", "title": "" }, { "docid": "6c822f6293e84d31a8f720900bb3767d", "score": "0.5831648", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent, Authorization: authorizationToken}\n\tc.common.client = c\n\tc.Memberships = (*MembershipsService)(&c.common)\n\tc.Messages = (*MessagesService)(&c.common)\n\tc.People = (*PeopleService)(&c.common)\n\tc.Rooms = (*RoomsService)(&c.common)\n\tc.TeamMemberships = (*TeamMembershipsService)(&c.common)\n\tc.Teams = (*TeamsService)(&c.common)\n\tc.Webhooks = (*WebhooksService)(&c.common)\n\tc.Organizations = (*OrganizationsService)(&c.common)\n\tc.Licenses = (*LicensesService)(&c.common)\n\tc.Roles = (*RolesService)(&c.common)\n\n\treturn c\n}", "title": "" }, { "docid": "1772914005fa1eba3ba1913f9e9f8bdf", "score": "0.58283365", "text": "func NewClient(conn *grpc.ClientConn) *Client {\n\treturn &Client{\n\t\tclient: NewAccountsServiceClient(conn),\n\t}\n\n}", "title": "" }, { "docid": "261210cadd8ea7cd3092334e7c0f6f34", "score": "0.582294", "text": "func NewClient(httpClient *http.Client, username string, token string, domain string) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tc := &Client{\n\t\tclient: &soap.Client{\n\t\t\tClient: httpClient,\n\t\t\tUserAgent: userAgent,\n\t\t\tDebug: false,\n\t\t},\n\t}\n\n\tauthHeader := auth.NewAuthHeaderWithDomain()\n\tauthHeader.Username = username\n\tauthHeader.Token = token\n\tauthHeader.Domain = domain\n\n\t// CompanyService\n\tc.Companies = companies.NewService(authHeader)\n\tc.Companies.Client = c.client\n\tc.CostCenters = costcenters.NewService(authHeader)\n\tc.CostCenters.Client = c.client\n\tc.FileExplorer = fileexplorer.NewService(authHeader)\n\tc.FileExplorer.Client = c.client\n\tc.Address = address.NewService(authHeader)\n\tc.Address.Client = c.client\n\n\t// EmployeeService\n\tc.Employees = employees.NewService(authHeader)\n\tc.Employees.Client = c.client\n\tc.Days = days.NewService(authHeader)\n\tc.Days.Client = c.client\n\tc.Hours = hours.NewService(authHeader)\n\tc.Hours.Client = c.client\n\tc.Wages = wages.NewService(authHeader)\n\tc.Wages.Client = c.client\n\tc.HourCodes = hourcodes.NewService(authHeader)\n\tc.HourCodes.Client = c.client\n\tc.Schedules = schedules.NewService(authHeader)\n\tc.Schedules.Client = c.client\n\tc.CostCenter = costcenter.NewService(authHeader)\n\tc.CostCenter.Client = c.client\n\n\t// DebtorService\n\tc.Debtors = debtors.NewService(authHeader)\n\tc.Debtors.Client = c.client\n\n\t// ReportsService\n\tc.Reports = reports.NewService(authHeader)\n\tc.Reports.Client = c.client\n\n\treturn c\n}", "title": "" }, { "docid": "a695a44933599d49bb5bca1a8772a3e7", "score": "0.58120877", "text": "func (c *config) newClient(ctx context.Context, u *model.User) *internal.Client {\n\tif u == nil {\n\t\treturn c.newClientToken(ctx, \"\", \"\")\n\t}\n\treturn c.newClientToken(ctx, u.Token, u.Secret)\n}", "title": "" }, { "docid": "f558c66709fe6bb07b5172c2728cef5f", "score": "0.5811777", "text": "func New(apiKey string) *Client { return NewWithClient(apiKey, newDefaultHTTPClient()) }", "title": "" }, { "docid": "45d169a58776e49daa6e25f7ef327dc9", "score": "0.5808407", "text": "func NewClient(httpClient *http.Client) (*Client, error) {\n\tclient := Client{\n\t\thttpClient: httpClient,\n\t\tversion: v2,\n\t\ttoken: \"\",\n\t}\n\terr := client.refreshToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &client, nil\n}", "title": "" }, { "docid": "5ad2c774501d49b3031de215c5b8c049", "score": "0.5806817", "text": "func New(c *http.Client, apiKey string) *client {\n\treturn &client{\n\t\tClient: c,\n\t\tapiKey: apiKey,\n\t}\n}", "title": "" }, { "docid": "240630a848097aaec4511d129555ddba", "score": "0.5804431", "text": "func NewClient() (*Client, error) {\n\n\treqInterval := 1000 * time.Millisecond / time.Duration(conf.MaxRequestsSec)\n\n\tclient := http.Client{\n\t\tTimeout: time.Duration(conf.HTTPClientTimeoutSec) * time.Second,\n\t}\n\n\tif len(conf.ApiKey) == 0 || len(conf.ApiSecret) == 0 {\n\n\t\terr := errors.New(\"new trading client: wrong apikey and/or apisecret\")\n\t\treturn nil, err\n\t}\n\n\ttc := Client{\n\t\tconf.ApiKey,\n\t\tconf.ApiSecret,\n\t\t&client,\n\t\ttime.Tick(reqInterval),\n\t}\n\n\treturn &tc, nil\n}", "title": "" }, { "docid": "dd9d5defd527ebdf851f1dc54581e7a9", "score": "0.5799356", "text": "func NewClient(ctx context.Context, ClientID, ClientSecret, TenantName string) *Client {\r\n conf := &clientcredentials.Config{\r\n ClientID: ClientID,\r\n ClientSecret: ClientSecret,\r\n TokenURL: \"https://api.\"+TenantName+\".luminatesec.com/v1/oauth/token\",\r\n Scopes: []string{\"luminate-scope\"},\r\n EndpointParams: nil,\r\n }\r\n\r\n OAuth2Client := conf.Client(ctx)\r\n\r\n baseEndpoint, err := url.Parse(\"https://api.\"+TenantName+\".luminatesec.com/\")\r\n if err != nil {\r\n return nil\r\n }\r\n\r\n c := &Client{client: OAuth2Client, BaseURL: baseEndpoint, UserAgent: userAgent}\r\n c.BaseURL = baseEndpoint\r\n return c\r\n\r\n}", "title": "" }, { "docid": "1e26e37ee32e0510e7d2f983ea345023", "score": "0.5793239", "text": "func NewWithClient(apiKey string, c *http.Client) *Client {\n\treturn &Client{\n\t\tbaseURL: \"https://api.climacell.co/v3/\",\n\t\tapiKey: apiKey,\n\t\tc: c,\n\t}\n}", "title": "" }, { "docid": "5a0e8197d43a2b5674564dd313f6455d", "score": "0.57747746", "text": "func New(baseUrl string, opts ...ClientOption) *Client {\n\thttpClient := &http.Client{Timeout: DEFAULT_TIMEOUT}\n\tclient := &Client{httpClient: httpClient, baseUrl: baseUrl, timeout: DEFAULT_TIMEOUT}\n\n\tfor _, opt := range opts {\n\t\topt(client)\n\t}\n\n\treturn client\n}", "title": "" }, { "docid": "3255b90861cd16da68ffc2f79f70d661", "score": "0.5769406", "text": "func newHTTPClient() *http.Client {\n\tretryClient := retryablehttp.NewClient()\n\tretryClient.Logger = nil\n\tretryClient.RetryMax = 10\n\tretryClient.CheckRetry = rateLimitPolicy\n\n\treturn retryClient.StandardClient()\n}", "title": "" }, { "docid": "5ff055efd2f96ea4cefbc613135ba87a", "score": "0.5769134", "text": "func New(c *http.Client) *Client {\n\treturn &Client{\n\t\tClient: goaclient.New(c),\n\t\tSignerJWT: &goaclient.JWTSigner{},\n\t}\n}", "title": "" }, { "docid": "8ecffbf2fd15e45b56ea3359b35a512d", "score": "0.576666", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{client: httpClient, BaseURL: baseURL, UserAgent: userAgent}\n\t// c.Account = &AccountServiceOp{client: c}\n\t// c.Actions = &ActionsServiceOp{client: c}\n\t// c.Domains = &DomainsServiceOp{client: c}\n\t// c.Droplets = &DropletsServiceOp{client: c}\n\t// c.DropletActions = &DropletActionsServiceOp{client: c}\n\t// c.FloatingIPs = &FloatingIPsServiceOp{client: c}\n\t// c.FloatingIPActions = &FloatingIPActionsServiceOp{client: c}\n\t// c.Images = &ImagesServiceOp{client: c}\n\t// c.ImageActions = &ImageActionsServiceOp{client: c}\n\t// c.Keys = &KeysServiceOp{client: c}\n\t// c.Regions = &RegionsServiceOp{client: c}\n\t// c.Snapshots = &SnapshotsServiceOp{client: c}\n\t// c.Sizes = &SizesServiceOp{client: c}\n\t// c.Storage = &StorageServiceOp{client: c}\n\t// c.StorageActions = &StorageActionsServiceOp{client: c}\n\t// c.Tags = &TagsServiceOp{client: c}\n\t// c.LoadBalancers = &LoadBalancersServiceOp{client: c}\n\t// c.Certificates = &CertificatesServiceOp{client: c}\n\t// c.Firewalls = &FirewallsServiceOp{client: c}\n\n\treturn c\n}", "title": "" }, { "docid": "6e337b80d373370b8dbb94dd0fc1b616", "score": "0.5766284", "text": "func New(baseURL string, limitTimeout time.Duration, clientTimeout time.Duration) *Client {\n\texp := retry.Exponential{\n\t\tInitial: 10 * time.Millisecond,\n\t\tFactor: 1.5,\n\t\tJitter: true,\n\t}\n\tstrategy := retry.LimitTime(limitTimeout, exp)\n\n\treturn &Client{\n\t\tBaseURL: baseURL,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: clientTimeout,\n\t\t},\n\t\tRetryStrategy: strategy,\n\t}\n}", "title": "" }, { "docid": "db353f16cc24fa7439e918cfe737ff47", "score": "0.57598716", "text": "func NewClient() *Client {\n\treturn &Client{\n\t\tBaseURL: BaseURLV1,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "aedcce8f12a2c95cee58d05efd2ee4ea", "score": "0.57477367", "text": "func newServiceAccounts(c *Client, ns string) ServiceAccountsInterface {\n\treturn &serviceAccounts{\n\t\tclient: c,\n\t\tnamespace: ns,\n\t}\n}", "title": "" }, { "docid": "ebae9f614b81eb106c9d3932a10646dc", "score": "0.57431334", "text": "func NewClient(domain, user, password string, config *tls.Config) Client {\n\tvar client = Client{\n\t\tdomain: domain,\n\t\tClient: http.Client{\n\t\t\tTransport: &AuthTransport{\n\t\t\t\tUsername: user,\n\t\t\t\tPassword: password,\n\t\t\t\tconfig: config,\n\t\t\t},\n\t\t},\n\t}\n\tprint(\"retunring client\")\n\treturn client\n}", "title": "" }, { "docid": "8993ede4efdd29c2fc062e34579b7d8c", "score": "0.5714936", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\tbaseURL, _ := url.Parse(realmDefaultBaseURL)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t\tUserAgent: userAgent,\n\t\tauth: &RealmAuth{},\n\t}\n\n\tc.RealmApps = &RealmAppsServiceOp{Client: c}\n\tc.RealmValues = &RealmValuesServiceOp{Client: c}\n\n\treturn c\n}", "title": "" }, { "docid": "40439654eb7ce1b18af1f7dc95aa1005", "score": "0.5706326", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tbaseURL: baseURLV1,\n\t\tapiKey: apiKey,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Second * 30,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5815127fe1d105aeb4e8f8a0b865a0f7", "score": "0.56899357", "text": "func NewClient(options *Options) *API {\n\tapi := &API{\n\t\tregion: options.Region,\n\t\tclientID: options.ClientID,\n\t\tclientSecret: options.ClientSecret,\n\t\tredirectURI: options.RedirectURI,\n\t\tlocale: options.Locale,\n\t\tclient: &http.Client{Timeout: time.Second * 10},\n\t\tauthURI: fmt.Sprintf(\"https://%s.battle.net\", options.Region),\n\t\tbaseURI: fmt.Sprintf(\"https://%s.api.blizzard.com\", options.Region),\n\t}\n\n\tapi.setClientToken()\n\n\treturn api\n}", "title": "" }, { "docid": "a0b6ad67d164f817e8bac19996d98d67", "score": "0.56777716", "text": "func NewClient(cfg Cfg) *Client {\n\tc := &Client{\n\t\tcfg: cfg,\n\t\tsize: uint64(len(cfg.Addrs)),\n\t\tregiterReq: &meta.RegisterRMRequest{},\n\t\tqueues: make(map[string]*task.Queue),\n\t\tseq: cfg.Seq,\n\t}\n\n\tfor _, addr := range cfg.Addrs {\n\t\tc.queues[addr] = task.New(128)\n\t\tgo c.sentTask(addr, c.queues[addr])\n\t}\n\n\tc.regiterReq.ApplicationID = cfg.ApplicationID\n\tc.regiterReq.Version = cfg.Version\n\tc.regiterReq.ExtraData = cfg.ApplicationData\n\tc.regiterReq.ResourceIDs = strings.Join(cfg.Resources, \",\")\n\treturn c\n}", "title": "" }, { "docid": "c79caceac30649058d591e1de57b7cf8", "score": "0.56727564", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.Accounts = NewAccountsService(s)\n\ts.Bidders = NewBiddersService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "90b4569c356876c834b5310af19f467f", "score": "0.56670284", "text": "func NewClient(httpClient *http.Client, config *Config) Client {\n\tconfig1 := oauth1.NewConfig(config.ConsumerKey, config.ConsumerSecret)\n\ttoken := oauth1.NewToken(config.AccessToken, config.AccessTokenSecret)\n\thttpClient = config1.Client(oauth1.NoContext, token)\n\n\treturn client{httpClient, config}\n}", "title": "" }, { "docid": "365e22efebd92ab8b11f7a9f202554eb", "score": "0.56619835", "text": "func NewAccountClient(c config) *AccountClient {\n\treturn &AccountClient{config: c}\n}", "title": "" }, { "docid": "4fa0f9a47f5f591b47f9d8183cd6386e", "score": "0.56585044", "text": "func NewClient(c ClientConfig) (Client, error) {\n\tconfig := &api.Config{\n\t\tAddress: c.URL,\n\t\tMaxRetries: 5,\n\t\tTimeout: time.Second * 30,\n\t\tError: nil,\n\t}\n\n\tclient, err := api.NewClient(config)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\terr = login(client, c.RoleID, c.SecretID)\n\tif err != nil {\n\t\treturn Client{}, err\n\t}\n\n\treturn Client{\n\t\tvaultClient: client,\n\t\troleID: c.RoleID,\n\t\tsecretID: c.SecretID,\n\t}, nil\n}", "title": "" }, { "docid": "cc3c4f29bd67c0199e08f67db93c9104", "score": "0.5645903", "text": "func (a Authenticator) NewClient(token *oauth2.Token) Client {\n\tclient := a.config.Client(a.context, token)\n\t// client の違いについて rakuten.go の client を呼び出している\n\treturn Client{\n\t\tclient: client,\n\t\t//baseURL: baseAddress,\n\t}\n}", "title": "" }, { "docid": "0fe9bbefbf3ebf06343a6e2634017c60", "score": "0.5640399", "text": "func NewClient(url string, apiKey string) Client {\n\tclient := Client{Url: url, APIKey: apiKey}\n\tclient.checkClient()\n\n\treturn client\n}", "title": "" }, { "docid": "922f550e5a8eca63c65cfb9ade4abe10", "score": "0.5625009", "text": "func createClient(options *ClientOptions, customHTTPClient *http.Client) (c *Client) {\r\n\r\n\t// Create a client\r\n\tc = new(Client)\r\n\r\n\t// Set options (either default or user modified)\r\n\tif options == nil {\r\n\t\toptions = DefaultClientOptions()\r\n\t}\r\n\r\n\t// Set the options\r\n\tc.Options = options\r\n\r\n\t// Is there a custom HTTP client to use?\r\n\tif customHTTPClient != nil {\r\n\t\tc.httpClient = customHTTPClient\r\n\t\treturn\r\n\t}\r\n\r\n\t// dial is the net dialer for clientDefaultTransport\r\n\tdial := &net.Dialer{KeepAlive: options.DialerKeepAlive, Timeout: options.DialerTimeout}\r\n\r\n\t// clientDefaultTransport is the default transport struct for the HTTP client\r\n\tclientDefaultTransport := &http.Transport{\r\n\t\tDialContext: dial.DialContext,\r\n\t\tExpectContinueTimeout: options.TransportExpectContinueTimeout,\r\n\t\tIdleConnTimeout: options.TransportIdleTimeout,\r\n\t\tMaxIdleConns: options.TransportMaxIdleConnections,\r\n\t\tProxy: http.ProxyFromEnvironment,\r\n\t\tTLSHandshakeTimeout: options.TransportTLSHandshakeTimeout,\r\n\t}\r\n\r\n\t// Determine the strategy for the http client\r\n\tif options.RequestRetryCount <= 0 {\r\n\r\n\t\t// no retry enabled\r\n\t\tc.httpClient = httpclient.NewClient(\r\n\t\t\thttpclient.WithHTTPTimeout(options.RequestTimeout),\r\n\t\t\thttpclient.WithHTTPClient(&http.Client{\r\n\t\t\t\tTransport: clientDefaultTransport,\r\n\t\t\t\tTimeout: options.RequestTimeout,\r\n\t\t\t}),\r\n\t\t)\r\n\t\treturn\r\n\t}\r\n\r\n\t// Retry enabled - create exponential back-off\r\n\tc.httpClient = httpclient.NewClient(\r\n\t\thttpclient.WithHTTPTimeout(options.RequestTimeout),\r\n\t\thttpclient.WithRetrier(heimdall.NewRetrier(\r\n\t\t\theimdall.NewExponentialBackoff(\r\n\t\t\t\toptions.BackOffInitialTimeout,\r\n\t\t\t\toptions.BackOffMaxTimeout,\r\n\t\t\t\toptions.BackOffExponentFactor,\r\n\t\t\t\toptions.BackOffMaximumJitterInterval,\r\n\t\t\t))),\r\n\t\thttpclient.WithRetryCount(options.RequestRetryCount),\r\n\t\thttpclient.WithHTTPClient(&http.Client{\r\n\t\t\tTransport: clientDefaultTransport,\r\n\t\t\tTimeout: options.RequestTimeout,\r\n\t\t}),\r\n\t)\r\n\r\n\treturn\r\n}", "title": "" }, { "docid": "2f24a3722c17e526c576dfe74b95ad42", "score": "0.56216854", "text": "func New(db database.Storer, cli *http.Client) *Clients {\n\tclients := &Clients{\n\t\tdb: db,\n\t\thttpClient: cli,\n\t\tclients: make(map[id.UserID]BotClient), // user_id => BotClient\n\t}\n\treturn clients\n}", "title": "" }, { "docid": "b8c8f0b57a6ca2e69569c9d2d643a621", "score": "0.5617629", "text": "func New() *Client {\n\treturn &Client{\n\t\tc: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tMaxIdleConns: 500,\n\t\t\t\tMaxIdleConnsPerHost: 500,\n\t\t\t\tIdleConnTimeout: 10 * time.Second,\n\t\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\t\tResponseHeaderTimeout: 10 * time.Second,\n\t\t\t\tExpectContinueTimeout: 10 * time.Second,\n\t\t\t},\n\t\t\tTimeout: 30 * time.Second,\n\t\t},\n\t\tlogger: logrus.NewEntry(logrus.New()),\n\t}\n}", "title": "" }, { "docid": "5f44f726b5b65d61719cc9bdc5313ab9", "score": "0.5617255", "text": "func New(token string, timeout time.Duration) (c *Client, err error) {\n\tc = &Client{\n\t\tclient: http.Client{Timeout: 10 * time.Second},\n\t\trateBucket: make(chan struct{}, 5),\n\t}\n\tif token == \"\" {\n\t\terr = errors.New(\"client requires token for authorization with the API\")\n\t\treturn\n\t}\n\tc.Token = token\n\tif timeout != 0 {\n\t\tc.client = http.Client{Timeout: timeout}\n\t}\n\n\t// Allow initial request\n\tc.rateBucket <- struct{}{}\n\treturn\n}", "title": "" }, { "docid": "4400dd12ad3b3e94f0613e6a55d0685e", "score": "0.56086034", "text": "func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error) {\n\tc := NewClient(httpClient)\n\n\tfor _, opt := range opts {\n\t\tif opt == nil {\n\t\t\tpanic(\"nil option passed, check your arguments\")\n\t\t}\n\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "56be07fbf87558d8b1941d68b6c37e76", "score": "0.56081563", "text": "func New(userName, token string) *Client {\n\tcli := &http.Client{\n\t\tTimeout: 3 * time.Second,\n\t}\n\treturn &Client{UserName: userName, Token: token, client: cli}\n}", "title": "" }, { "docid": "fc4d7490b8fe23ca442b7ecf3d9b2cbe", "score": "0.5603021", "text": "func NewClient(httpClient *http.Client) *Client {\n\tif httpClient == nil {\n\t\thttpClient = &http.Client{}\n\t}\n\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t\tUserAgent: userAgent,\n\t}\n\tc.common.client = c\n\n\tc.Organizations = (*OrganizationsService)(&c.common)\n\tc.Transactions = (*TransactionsService)(&c.common)\n\tc.Memberships = (*MembershipsService)(&c.common)\n\tc.Attachments = (*AttachmentsService)(&c.common)\n\tc.Labels = (*LabelsService)(&c.common)\n\n\treturn c\n}", "title": "" }, { "docid": "a0d2d4119eaf42b57cab7326f2d93fd7", "score": "0.56009954", "text": "func New(cr types.Credentials) *Client {\n\treturn &Client{Credentials: cr, baseURL: \"http://api.suffix.io/\"}\n}", "title": "" }, { "docid": "897e431eb7b646114f184012a127d0fb", "score": "0.55953735", "text": "func New() BaseClient {\n\treturn NewWithoutDefaults()\n}", "title": "" }, { "docid": "3d18395257065916cd5662860264883e", "score": "0.5593909", "text": "func newClient(authURL, token string, options ...configuration.HTTPClientOption) (*authclient.Client, error) {\n\tu, err := url.Parse(authURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thttpClient := http.DefaultClient\n\t// apply options\n\tfor _, opt := range options {\n\t\topt(httpClient)\n\t}\n\tclient := authclient.New(&doer{\n\t\ttarget: goaclient.HTTPClientDoer(httpClient),\n\t\ttoken: token,\n\t})\n\tclient.Host = u.Host\n\tclient.Scheme = u.Scheme\n\tlog.Debug(nil, map[string]interface{}{\"host\": client.Host, \"scheme\": client.Scheme}, \"initializing auth client\")\n\treturn client, nil\n}", "title": "" }, { "docid": "acc2f285fcb8a167439d3d99a15ec504", "score": "0.55922914", "text": "func NewClient(appID, appKey string) *Client {\n\treturn &Client{\n\t\tappID: appID,\n\t\tappKey: appKey,\n\t\tclient: &http.Client{\n\t\t\tTimeout: 60 * time.Second,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "faa17beb7a45f8b8b1c2e976f210a81e", "score": "0.5585804", "text": "func NewClient(oauthSecret []byte, retries int, sleep time.Duration) *Client {\n\ttoken := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{AccessToken: string(oauthSecret)},\n\t)\n\n\treturn &Client{\n\t\tClient: gogh.NewClient(oauth2.NewClient(context.Background(), token)),\n\t\tRetries: retries,\n\t\tSleep: sleep,\n\t}\n}", "title": "" }, { "docid": "f1f96f94d3cc2fed6e5d835c389460f7", "score": "0.55840033", "text": "func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error) {\n\tc := NewClient(httpClient)\n\tfor _, opt := range opts {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "f1f96f94d3cc2fed6e5d835c389460f7", "score": "0.55840033", "text": "func New(httpClient *http.Client, opts ...ClientOpt) (*Client, error) {\n\tc := NewClient(httpClient)\n\tfor _, opt := range opts {\n\t\tif err := opt(c); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "baf15c9eadfb418074ca97bd9c3402fa", "score": "0.55835336", "text": "func New(client *http.Client, config Config, logger LeveledLogger) (*Client, error) {\n\tif logger != nil {\n\t\tlog = logger\n\t}\n\n\tif config.Endpoint == \"\" {\n\t\treturn nil, errors.New(\"You must define at least an endpoint\")\n\t}\n\n\toncallClient := &Client{\n\t\tConfig: config,\n\t}\n\t// Strip off the trailing slash if it's there\n\toncallClient.Config.Endpoint = strings.TrimRight(oncallClient.Config.Endpoint, \"/\")\n\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\n\tproxiedTransport := client.Transport\n\tif proxiedTransport == nil {\n\t\tproxiedTransport = http.DefaultTransport\n\t}\n\n\tif config.AuthMethod == AuthMethodUser {\n\t\tlog.Debug(\"Using User AuthMethod\")\n\t\toncallClient.authRoundTripper = NewUserAuthorizationRoundTripper(UserAuthorizationRoundTripper{\n\t\t\tProxied: proxiedTransport,\n\t\t\tUsernameGetter: func() string { return oncallClient.Config.Username },\n\t\t\tPasswordGetter: func() string { return oncallClient.Config.Password },\n\t\t\tLoginEndpoint: strings.TrimRight(config.Endpoint, \"/\") + \"/login\",\n\t\t})\n\t} else {\n\t\tlog.Debug(\"Using API AuthMethod\")\n\t\toncallClient.authRoundTripper = APIAuthorizationRoundTripper{\n\t\t\tProxied: proxiedTransport,\n\t\t\tUsernameGetter: func() string { return oncallClient.Config.Username },\n\t\t\tPasswordGetter: func() string { return oncallClient.Config.Password },\n\t\t}\n\t}\n\tclient.Transport = oncallClient.authRoundTripper\n\n\toncallClient.Client = client\n\n\treturn oncallClient, nil\n}", "title": "" }, { "docid": "a85e2459d04af6ebe8ee71c6ff33e44e", "score": "0.5583355", "text": "func newClient(clientType ClientType, eventHubNamespace string, sharedAccessKeyName string, sharedAccessKeyValue string) *client {\n\tclient := &client{\n\t\tclientType: clientType,\n\t\teventHubNamespace: eventHubNamespace,\n\t\tsaKey: sharedAccessKeyName,\n\t\tsaValue: sharedAccessKeyValue,\n\t\turl: fmt.Sprintf(serviceBusURL, eventHubNamespace),\n\t\tclient: &http.Client{},\n\t\tRetryAttempts: defaultRetryAttempts,\n\t\tValidStatusCodes: defaultValidStatusCodes,\n\t\tRetryDuration: defaultRetryDuration,\n\t}\n\treturn client\n}", "title": "" }, { "docid": "db7f08f2d21724722518cbc1871fa825", "score": "0.55801725", "text": "func New(accessToken string) *Client {\n\treturn &Client{\n\t\thttpClient: &http.Client{},\n\t\taccessToken: accessToken,\n\t}\n}", "title": "" }, { "docid": "d92c9ecf862456987bb3596910df8ea3", "score": "0.55751514", "text": "func newDeploymentClient(apiClient *Client) *DeploymentClient {\n\treturn &DeploymentClient{\n\t\tapiClient: apiClient,\n\t}\n}", "title": "" }, { "docid": "913314d55795d242bbbb8c9db10b96d1", "score": "0.55734545", "text": "func NewClient(httpClient *http.Client) *Client {\n\tbaseURL, _ := url.Parse(defaultBaseURL)\n\n\tc := &Client{\n\t\tclient: httpClient,\n\t\tBaseURL: baseURL,\n\t\tUserAgent: userAgent,\n\t}\n\tc.AccessTokens = &AccessTokensService{c}\n\tc.Agents = &AgentsService{c}\n\tc.Annotations = &AnnotationsService{c}\n\tc.Artifacts = &ArtifactsService{c}\n\tc.Builds = &BuildsService{c}\n\tc.Jobs = &JobsService{c}\n\tc.Organizations = &OrganizationsService{c}\n\tc.Pipelines = &PipelinesService{c}\n\tc.User = &UserService{c}\n\tc.Teams = &TeamsService{c}\n\n\tif c.client != nil {\n\t\tif tokenAuth, ok := c.client.Transport.(*TokenAuthTransport); ok {\n\t\t\ttokenAuth.APIHost = baseURL.Host\n\t\t}\n\n\t\tif basicAuth, ok := c.client.Transport.(*BasicAuthTransport); ok {\n\t\t\tbasicAuth.APIHost = baseURL.Host\n\t\t}\n\t}\n\treturn c\n}", "title": "" }, { "docid": "3f1d120a18a3d37ca48cf479a65056c5", "score": "0.55732304", "text": "func New(cfgs ...ConfigFunc) *Client {\n\tc := &Client{\n\t\thttp.Client{Transport: http.DefaultTransport},\n\t\t*NewIdentity(),\n\t\t*NewCatalog(),\n\t\t*NewMarketplace(),\n\t}\n\n\tc.IdentityClient.common.backend.(*defaultBackend).client = &c.client\n\tc.CatalogClient.common.backend.(*defaultBackend).client = &c.client\n\tc.MarketplaceClient.common.backend.(*defaultBackend).client = &c.client\n\n\tForURLPattern(DefaultURLPattern)(c)\n\n\tfor _, cfg := range cfgs {\n\t\tcfg(c)\n\t}\n\n\t// We need to do this after we've set the configuration. In case someone\n\t// provided a UserAgent, it will get loaded and overwrite our defaults since\n\t// we re-assign the previous transport after this.\n\tWithUserAgent(\"\")(c)\n\tWithAPIToken(os.Getenv(\"MANIFOLD_API_TOKEN\"))(c)\n\n\treturn c\n}", "title": "" }, { "docid": "b84faf79dce496be2a2e4c38bf0770e2", "score": "0.5571893", "text": "func NewClient(tenant string, username string, password string, apikey string, region string, authurl string, private bool, overrideURLs []string) (Client, *http.Response) {\n\tc := &userClient{\n\t\tclient: &http.Client{\n\t\t\tTimeout: 30 * time.Minute,\n\t\t\tTransport: &http.Transport{\n\t\t\t\tMaxIdleConnsPerHost: 300,\n\t\t\t\tMaxIdleConns: 0,\n\t\t\t\tIdleConnTimeout: 5 * time.Second,\n\t\t\t\tDisableCompression: true,\n\t\t\t},\n\t\t},\n\t\ttenant: tenant,\n\t\tusername: username,\n\t\tpassword: password,\n\t\tapikey: apikey,\n\t\tregion: region,\n\t\tauthurl: authurl,\n\t\tprivate: private,\n\t\tuserAgent: \"Nectar\",\n\t}\n\tfor _, u := range overrideURLs {\n\t\tif u != \"\" {\n\t\t\tc.overrideURLs = append(c.overrideURLs, u)\n\t\t}\n\t}\n\tif aResp := c.authenticate(); aResp.StatusCode/100 != 2 {\n\t\treturn nil, aResp\n\t} else {\n\t\taResp.Body.Close()\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "179dffa79d05460307a468639f54c73d", "score": "0.5565742", "text": "func New(addr string, client *http.Client) *Client {\n\tif client == nil {\n\t\tclient = http.DefaultClient\n\t}\n\n\treturn &Client{\n\t\taddr: addr,\n\t\tclient: client,\n\t}\n}", "title": "" }, { "docid": "5475be22ff4ad904117605d90fd382f9", "score": "0.55647445", "text": "func NewClient(apiKey string) *Client {\n\treturn &Client{\n\t\tapiKey: apiKey,\n\t\tHTTPClient: &http.Client{\n\t\t\tTimeout: time.Minute,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a3cfd9a057a855336e0fd99e79a33064", "score": "0.5562352", "text": "func NewClient(options ...func(*Options)) *auth.Client {\n\topt := &Options{\n\t\tCredentialsFuncsCache: make(map[string]func(context.Context, string) (auth.Credential, error)),\n\t}\n\n\tfor _, o := range options {\n\t\to(opt)\n\t}\n\n\tauthClient := auth.Client{\n\t\tClient: &http.Client{\n\t\t\tTransport: &http.Transport{\n\t\t\t\tProxy: http.ProxyFromEnvironment,\n\t\t\t\tDialContext: (&net.Dialer{\n\t\t\t\t\tTimeout: 30 * time.Second,\n\t\t\t\t\tKeepAlive: 30 * time.Second,\n\t\t\t\t}).DialContext,\n\t\t\t\tForceAttemptHTTP2: true,\n\t\t\t\tMaxIdleConns: 100,\n\t\t\t\tIdleConnTimeout: 90 * time.Second,\n\t\t\t\tTLSHandshakeTimeout: 10 * time.Second,\n\t\t\t\tExpectContinueTimeout: 1 * time.Second,\n\t\t\t\t// TODO(loresuso, alacuku): tls config.\n\t\t\t},\n\t\t},\n\t\tCache: auth.NewCache(),\n\t\tCredential: func(ctx context.Context, reg string) (auth.Credential, error) {\n\t\t\t// try cred func from cache first\n\t\t\tcredFunc, exists := opt.CredentialsFuncsCache[reg]\n\t\t\tif exists {\n\t\t\t\treturn credFunc(ctx, reg)\n\t\t\t}\n\n\t\t\t// if auto login is on check if we tried logging in to registry\n\t\t\tif opt.AutoLoginHandler != nil {\n\t\t\t\tif err := opt.AutoLoginHandler.Login(ctx, reg); err != nil {\n\t\t\t\t\treturn auth.EmptyCredential, err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// if we did not cache the correct cred function yet search available ones\n\t\t\tfor _, credFunc := range opt.CredentialsFuncs {\n\t\t\t\tcred, err := credFunc(ctx, reg)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn auth.EmptyCredential, err\n\t\t\t\t}\n\n\t\t\t\tif cred != auth.EmptyCredential {\n\t\t\t\t\t// remember cred function for this reg for next time\n\t\t\t\t\topt.CredentialsFuncsCache[reg] = credFunc\n\t\t\t\t\treturn cred, nil\n\t\t\t\t}\n\t\t\t}\n\t\t\t// remember empty cred func for registries we dont have creds for\n\t\t\topt.CredentialsFuncsCache[reg] = EmptyCredentialFunc\n\t\t\treturn auth.EmptyCredential, nil\n\t\t},\n\t}\n\n\tauthClient.SetUserAgent(falcoctlUserAgent)\n\n\treturn &authClient\n}", "title": "" }, { "docid": "2928db4f43b90e1db014159238b257a0", "score": "0.5555918", "text": "func NewClient(config bca.Config) Client {\n\treturn Client{\n\t\tCompanyCode: config.CompanyCode,\n\t\tClient: bca.NewAPI(config),\n\t}\n}", "title": "" }, { "docid": "c8d598276032c658864f8d6585e1e139", "score": "0.555467", "text": "func newClient() (client *http.Client, err error) {\n\tclient = &http.Client{\n\t\tTransport: &http.Transport{\n\t\t\tTLSClientConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t},\n\t}\n\n\treturn client, err\n}", "title": "" }, { "docid": "323f4ea638603c94da371fe061dde71d", "score": "0.5526666", "text": "func NewWithClient(client *http.Client) *Client {\n\treturn &Client{client}\n}", "title": "" }, { "docid": "b52205715c278b84f1b6210345b424b4", "score": "0.5520621", "text": "func NewClient(tenant string, clientID string, clientSecret string, username string, password string) (*Client, error) {\n\n\thttpClient := cleanhttp.DefaultClient()\n\n\t// add default header for all future requests\n\thttpClient.Transport = roundTripperBearerToken{\n\t\tinnerRoundTripper: roundTripperErrorOnUnsuccessful{httpClient.Transport},\n\t\ttenant: tenant,\n\t\tclientID: clientID,\n\t\tclientSecret: clientSecret,\n\t\tusername: username,\n\t\tpassword: password,\n\t\ttokenCache: &roundTripperBearerTokenCache{},\n\t}\n\n\treturn &Client{\n\t\thttpClient,\n\t}, nil\n}", "title": "" }, { "docid": "161bc733ba4a0bd520fa826cc9164335", "score": "0.5516708", "text": "func NewClient(c *http.Client, n int) *Client {\n\treturn &Client{\n\t\tclient: c,\n\t\tconcurrency: n,\n\t}\n}", "title": "" }, { "docid": "7b2e50104aa73758d17b98704302a2b9", "score": "0.55146813", "text": "func NewClient(AppGUID, APIKey string, options ...func(*Client) error) (Client, error) {\n\tvar c Client\n\n\tc.AppGUID = AppGUID\n\tc.APIKey = APIKey\n\n\tfor _, option := range options {\n\t\terr := option(&c)\n\t\tif err != nil {\n\t\t\treturn c, err\n\t\t}\n\t}\n\n\treturn c, nil\n}", "title": "" }, { "docid": "8bdbebda5f20ae3096300d6bb3ed5d5e", "score": "0.5513351", "text": "func New(ver, team, token string) (*Client, error) {\n\tcli := &Client{token: token}\n\tcli.endpoint = fmt.Sprintf(endpointBase, team)\n\tcli.limiter = newRateLimitRoundTripper()\n\tcli.cli = &http.Client{Transport: cli.limiter}\n\tcli.userAgent = fmt.Sprintf(userAgentBase, ver)\n\treturn cli, nil\n}", "title": "" }, { "docid": "7fa29f000c3cd351d57d60fbee38e6cc", "score": "0.55105984", "text": "func New(iaas iaas.IClient, project string) *Client {\n\treturn &Client{\n\t\tiaas,\n\t\tproject,\n\t}\n}", "title": "" }, { "docid": "295a1a92b43dcba2e91541fb64f88c6c", "score": "0.5509138", "text": "func New(tugrikURL string) *Client {\n\treturn &Client{\n\t\trc: resty.New().\n\t\t\tSetHostURL(tugrikURL).\n\t\t\tSetLogger(ioutil.Discard).\n\t\t\tSetRetryCount(3).\n\t\t\tSetTimeout(10 * time.Second),\n\t}\n}", "title": "" }, { "docid": "57b2070efcca75c102c15f038ab52c44", "score": "0.55080503", "text": "func NewClient(ctx context.Context, cnf *Config) (*Client, error) {\n\n\thttpClient, err := getOauthClient(ctx, cnf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Client{\n\t\thttpClient: httpClient,\n\t\tctx: ctx,\n\t}, nil\n}", "title": "" }, { "docid": "fc40cc61e48ec336e0b1faffbfd2ccd3", "score": "0.5506626", "text": "func NewClient(customerID string) (*Client, error) {\n\tclientsMu.Lock()\n\tdefer clientsMu.Unlock()\n\n\tif client, ok := clients[customerID]; ok {\n\t\treturn client, nil\n\t}\n\n\tclient := &Client{\n\t\tCustomerID: customerID,\n\n\t\tConsumerKey: DefaultConsumerKey,\n\t\tConsumerSecret: DefaultConsumerSecret,\n\n\t\tSAMLProviderID: DefaultSAMLProviderID,\n\t\tPrivateKey: DefaultPrivateKey,\n\n\t\tHTTPClient: DefaultHTTPClient,\n\t}\n\n\terr := client.Init()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclients[customerID] = client\n\n\t// spawn a new goroutine which will sleep for 30 minutes and then delete the\n\t// cached client (this process will re-acquire the lock)\n\ttime.AfterFunc(time.Minute*30, func() {\n\t\tclientsMu.Lock()\n\t\tdefer clientsMu.Unlock()\n\n\t\tdelete(clients, customerID)\n\t})\n\n\treturn client, nil\n}", "title": "" }, { "docid": "889d6cff4baa1744a9ba0ee591ff2800", "score": "0.5504935", "text": "func New() *Client {\n\tsession := session.NewSession()\n\tcookieJar, _ := cookiejar.New(&cookiejar.Options{PublicSuffixList: publicsuffix.List})\n\thttp := resty.New().\n\t\tSetCookieJar(cookieJar).\n\t\tSetRetryCount(3).\n\t\tSetRetryWaitTime(3 * time.Second).\n\t\tSetRetryMaxWaitTime(20 * time.Second).\n\t\tSetHeaders(session.ClientSetting.DefaultHeaders)\n\tclient := Client{\n\t\thttp: http,\n\t\tsession: session,\n\t\tcookieJar: cookieJar,\n\t\tservices: make(map[string]service.Service),\n\t}\n\treturn &client\n}", "title": "" }, { "docid": "940a35cf3561660ad4af3e6c6f08f78e", "score": "0.5504242", "text": "func newClient(cfg *Config, httpClient *http.Client, logger log.Logger) (*clientImpl, error) {\n\toptions := []elastic.ClientOptionFunc{\n\t\telastic.SetURL(cfg.URL.String()),\n\t\telastic.SetBasicAuth(cfg.Username, cfg.Password),\n\t\t// Disable healthcheck to prevent blocking client creation (and thus Temporal server startup) if the Elasticsearch is down.\n\t\telastic.SetHealthcheck(false),\n\t\telastic.SetSniff(cfg.EnableSniff),\n\t\telastic.SetRetrier(elastic.NewBackoffRetrier(elastic.NewExponentialBackoff(128*time.Millisecond, 513*time.Millisecond))),\n\t\t// Critical to ensure decode of int64 won't lose precision.\n\t\telastic.SetDecoder(&elastic.NumberDecoder{}),\n\t\telastic.SetGzip(true),\n\t}\n\n\toptions = append(options, getLoggerOptions(cfg.LogLevel, logger)...)\n\n\tif httpClient == nil {\n\t\thttpClient = http.DefaultClient\n\t}\n\n\t// TODO (alex): Remove this when https://github.com/olivere/elastic/pull/1507 is merged.\n\tif cfg.CloseIdleConnectionsInterval != time.Duration(0) {\n\t\tif cfg.CloseIdleConnectionsInterval < minimumCloseIdleConnectionsInterval {\n\t\t\tcfg.CloseIdleConnectionsInterval = minimumCloseIdleConnectionsInterval\n\t\t}\n\t\tgo func(interval time.Duration, httpClient *http.Client) {\n\t\t\tcloseTimer := time.NewTimer(interval)\n\t\t\tdefer closeTimer.Stop()\n\t\t\tfor {\n\t\t\t\t<-closeTimer.C\n\t\t\t\tcloseTimer.Reset(interval)\n\t\t\t\thttpClient.CloseIdleConnections()\n\t\t\t}\n\t\t}(cfg.CloseIdleConnectionsInterval, httpClient)\n\t}\n\n\toptions = append(options, elastic.SetHttpClient(httpClient))\n\n\tclient, err := elastic.NewClient(options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Enable healthcheck (if configured) after client is successfully created.\n\tif cfg.EnableHealthcheck {\n\t\tclient.Stop()\n\t\terr = elastic.SetHealthcheck(true)(client)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tclient.Start()\n\t}\n\n\treturn &clientImpl{\n\t\tesClient: client,\n\t\turl: cfg.URL,\n\t}, nil\n}", "title": "" }, { "docid": "5081e9aa8d588479bb35f0fc6e1a3564", "score": "0.5498744", "text": "func NewClient(args ...interface{}) (client Client) {\n\tlimit := 3\n\tartist := false\n\n\tretryClient := retryablehttp.NewClient()\n\tretryClient.RetryMax = 10\n\tretryClient.Logger = nil\n\n\tfor _, arg := range args {\n\t\tswitch t := arg.(type) {\n\t\tcase int:\n\t\t\tlimit = t\n\t\tcase bool:\n\t\t\tartist = t\n\t\t}\n\t}\n\tclient = Client{\n\t\tArtist: artist,\n\t\tBaseURL: \"https://nhentai.net/api\",\n\t\tClient: retryClient.StandardClient(),\n\t\tLimit: make(chan struct{}, limit),\n\t}\n\treturn\n}", "title": "" } ]
828c9eebc371fee2a6e80609d7b80f27
Marshal returns a statement which represent the code needed to put the variable "id" into the io.Writer "writer" while returning an error.
[ { "docid": "e63b4881626b635230d24a51b0756cd2", "score": "0.5390598", "text": "func (e *EnumType) Marshal(id string, writer string) *Statement {\n\treturn NewIntType().Marshal(id, writer)\n}", "title": "" } ]
[ { "docid": "5c0f2fdb57b7c16d0ade42bcb8b94088", "score": "0.6498218", "text": "func (m *MapType) Marshal(mapID string, writer string) *Statement {\n\treturn jen.Func().Params().Params(jen.Error()).Block(\n\t\tjen.Err().Op(\":=\").Qual(\"github.com/lugu/qiloop/type/basic\", \"WriteUint32\").Call(jen.Id(\"uint32\").Call(\n\t\t\tjen.Id(\"len\").Call(jen.Id(mapID))),\n\t\t\tjen.Id(writer)),\n\t\tjen.Id(`if (err != nil) {\n return fmt.Errorf(\"write map size: %s\", err)\n }`),\n\t\tjen.For(\n\t\t\tjen.Id(\"k, v := range \"+mapID),\n\t\t).Block(\n\t\t\tjen.Err().Op(\"=\").Add(m.key.Marshal(\"k\", writer)),\n\t\t\tjen.Id(`if (err != nil) {\n return fmt.Errorf(\"write map key: %s\", err)\n }`),\n\t\t\tjen.Err().Op(\"=\").Add(m.value.Marshal(\"v\", writer)),\n\t\t\tjen.Id(`if (err != nil) {\n return fmt.Errorf(\"write map value: %s\", err)\n }`),\n\t\t),\n\t\tjen.Return(jen.Nil()),\n\t).Call()\n}", "title": "" }, { "docid": "43013a31600eba0de406d84331ab7893", "score": "0.6497689", "text": "func MarshalID(b string) graphql.Marshaler {\n\treturn graphql.WriterFunc(func(w io.Writer) {\n\t\t_, _ = w.Write(bat.UnsafeStrToByteArray(wrapStr(b)))\n\t})\n}", "title": "" }, { "docid": "01611b065750fe455a870062cb450c86", "score": "0.6259718", "text": "func (s *StructType) Marshal(structID string, writer string) *Statement {\n\treturn jen.Id(\"write\"+s.name()).Call(jen.Id(structID), jen.Id(writer))\n}", "title": "" }, { "docid": "2f5bbc5d43a6b6a66a3bd00dfb9a8245", "score": "0.6173975", "text": "func (t *TupleType) Marshal(tupleID string, writer string) *Statement {\n\tstatements := make([]jen.Code, 0)\n\tfor _, typ := range t.Members {\n\t\ts1 := jen.Err().Op(\"=\").Add(typ.Type.Marshal(tupleID+\".\"+strings.Title(typ.Name), writer))\n\t\ts2 := jen.Id(`if (err != nil) {\n\t\t\treturn fmt.Errorf(\"write tuple member: %s\", err)\n\t\t}`)\n\t\tstatements = append(statements, s1)\n\t\tstatements = append(statements, s2)\n\t}\n\tstatements = append(statements, jen.Return(jen.Nil()))\n\treturn jen.Func().Params().Params(jen.Error()).Block(\n\t\tstatements...,\n\t).Call()\n}", "title": "" }, { "docid": "3ac04f22c655318974a5015dc94d86cf", "score": "0.5817484", "text": "func (i Identifier) Marshal() (mi []byte) {\n\tmi = make([]byte, 1)\n\tmi[0] = byte(i)\n\treturn\n}", "title": "" }, { "docid": "046c47faee901f3870c462c947f38b9f", "score": "0.573499", "text": "func (id *ID) Marshal(b ...[]byte) ([]byte, error) {\n\tvar buf []byte\n\tif len(b) > 0 {\n\t\tbuf = b[0]\n\t}\n\n\treturn (*refs.OwnerID)(id).\n\t\tStableMarshal(buf)\n}", "title": "" }, { "docid": "bc76e3ca97114607f91f7e1c1f617504", "score": "0.562528", "text": "func (l *ListType) Marshal(listID string, writer string) *Statement {\n\treturn jen.Func().Params().Params(jen.Error()).Block(\n\t\tjen.Err().Op(\":=\").Qual(\"github.com/lugu/qiloop/type/basic\", \"WriteUint32\").Call(jen.Id(\"uint32\").Call(\n\t\t\tjen.Id(\"len\").Call(jen.Id(listID))),\n\t\t\tjen.Id(writer)),\n\t\tjen.Id(`if (err != nil) {\n return fmt.Errorf(\"write slice size: %s\", err)\n }`),\n\t\tjen.For(\n\t\t\tjen.Id(\"_, v := range \"+listID),\n\t\t).Block(\n\t\t\tjen.Err().Op(\"=\").Add(l.value.Marshal(\"v\", writer)),\n\t\t\tjen.Id(`if (err != nil) {\n return fmt.Errorf(\"write slice value: %s\", err)\n }`),\n\t\t),\n\t\tjen.Return(jen.Nil()),\n\t).Call()\n}", "title": "" }, { "docid": "03b7089cc2fdc947a7ceff857338fb79", "score": "0.54796463", "text": "func (id *ID) Marshal(compressed bool) []byte {\n\tlength := IDMarshalledSize(compressed)\n\tmarshalled := make([]byte, length)\n\tC.embedded_pairing_lqibe_id_marshal(unsafe.Pointer(&marshalled[0]), &id.Data, C._Bool(compressed))\n\treturn marshalled\n}", "title": "" }, { "docid": "13d91ec960407369df49f99b4c881da6", "score": "0.54479957", "text": "func Marshal(w io.Writer, val interface{}) error {\n\treturn EncodeTo(w, val)\n}", "title": "" }, { "docid": "b23fbaa7c36495bd42e448cfa4550ebb", "score": "0.53964573", "text": "func Marshal(typeID uint64, s capnp.Struct) (string, error) {\n\tbuf := new(bytes.Buffer)\n\tif err := NewEncoder(buf).Encode(typeID, s); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn buf.String(), nil\n}", "title": "" }, { "docid": "31d7f2ef2904566cf4d803e958c6e8f3", "score": "0.5373104", "text": "func idProvider(w http.ResponseWriter, r *http.Request) {\n\tid := idMaker.NewId()\n\tidMsg := msgdef.SIdMsg{Op: msgdef.SIdOp, Id: id}\n\tif buf, err := json.Marshal(idMsg); err != nil {\n\t\tprintln(err.Error())\n\t} else {\n\t\tw.Write(buf)\n\t}\n}", "title": "" }, { "docid": "396331de9552256649fcb9a16b2d443b", "score": "0.5303228", "text": "func MarshalOpenIDIdentityProvider(object *OpenIDIdentityProvider, writer io.Writer) error {\n\tstream := helpers.NewStream(writer)\n\twriteOpenIDIdentityProvider(object, stream)\n\tstream.Flush()\n\treturn stream.Error\n}", "title": "" }, { "docid": "2f5aab1c93a413361776bb3e463f94ef", "score": "0.5239959", "text": "func (m *Identity) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetTypeEscaped() != nil {\n cast := (*m.GetTypeEscaped()).String()\n err = writer.WriteStringValue(\"type\", &cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "4f326e0eb3a3c968271fc59799abaca1", "score": "0.5231458", "text": "func Marshal(codecID byte, v interface{}) ([]byte, error) {\n\tcodec, err := Get(codecID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn codec.Marshal(v)\n}", "title": "" }, { "docid": "4276a0dbb68afab40ffb341815105c64", "score": "0.5223431", "text": "func MarshalResponse(w io.Writer, val interface{}) (err error) {\n\tresp, err := Encode(val)\n\n\twrite4(w, uint32(len(resp)))\n\tw.Write(resp)\n\n\treturn\n}", "title": "" }, { "docid": "2e7cc04de874d8f5e74103e3d5447f3d", "score": "0.5217771", "text": "func (f Exists) Marshal(buf *Buffer) {\n\tbuf.EncodeVarint(tagExists)\n\tbuf.EncodeString(f.Var)\n\tf.Body.Marshal(buf)\n}", "title": "" }, { "docid": "3e0f39ee845828ecb9591569cfd3d897", "score": "0.51646155", "text": "func marshalIDString(pktType byte, id uint32, str string) ([]byte, error) {\n\tb := allocPkt(pktType, 4+(4+len(str)))\n\tb = appendU32(b, id)\n\treturn appendStr(b, str), nil\n}", "title": "" }, { "docid": "a90b62eaae2a1dd429a6daf1ea3a1bb7", "score": "0.51376927", "text": "func (m *OpResult) MarshalToWriter(writer jspb.Writer) {\n\tif m == nil {\n\t\treturn\n\t}\n\n\tif m.Code != 0 {\n\t\twriter.WriteInt32(1, m.Code)\n\t}\n\n\tif len(m.Status) > 0 {\n\t\twriter.WriteString(2, m.Status)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "42a14a8f665cde08ce944a4c4c155aad", "score": "0.51053506", "text": "func (id ID) MarshalBinary() (data []byte, err error) {\n\tdata = append([]byte{}, id[:]...)\n\treturn\n}", "title": "" }, { "docid": "cb869ad4b3261a2049953878f6466522", "score": "0.5043027", "text": "func (id ID) MarshalJSON() ([]byte, error) {\n\tif id == 0 {\n\t\treturn json.Marshal(nil)\n\t}\n\n\tres, err := hasher.Encode(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn json.Marshal(string(res))\n}", "title": "" }, { "docid": "edd84f69c52d4ea27eb9157ee1d090f2", "score": "0.5034437", "text": "func Marshal(v interface{}) ([]byte, error)", "title": "" }, { "docid": "2f4d21937de3e8b847907c3baecace58", "score": "0.5031693", "text": "func (r *resp) marshal() []byte {\n\tidBuf := make([]byte, 8)\n\toffset := binary.PutVarint(idBuf, r.reqID)\n\tbuf := make([]byte, 0, offset+1+4+len(r.result))\n\tb := bytes.NewBuffer(buf)\n\tb.Write(idBuf[0:offset])\n\t// write result type\n\tif r.err != nil {\n\t\tb.WriteByte(byte(respErr))\n\t\tbinary.Write(b, binary.LittleEndian, int32(len(r.err.Error())))\n\t\tb.Write([]byte(r.err.Error()))\n\t} else {\n\t\tb.WriteByte(byte(respSuccess))\n\t\tbinary.Write(b, binary.LittleEndian, int32(len(r.result)))\n\t\tb.Write(r.result)\n\t}\n\treturn b.Bytes()\n}", "title": "" }, { "docid": "3d3c667b7e7d7887652b56c66a94a61e", "score": "0.5022639", "text": "func (t *TSID) Marshal(dst []byte) []byte {\n\tdst = encoding.MarshalUint64(dst, t.MetricGroupID)\n\tdst = encoding.MarshalUint32(dst, t.JobID)\n\tdst = encoding.MarshalUint32(dst, t.InstanceID)\n\tdst = encoding.MarshalUint64(dst, t.MetricID)\n\treturn dst\n}", "title": "" }, { "docid": "36bd9261dc542802cc2884149604a16a", "score": "0.5004893", "text": "func (id ID) MarshalJSON() ([]byte, error) {\n\tif id == zero {\n\t\treturn []byte(\"null\"), nil\n\t}\n\n\tdst := []byte(\"\\\" \\\"\")\n\tenc := internal.Encode((*[10]byte)(&id))\n\tcopy(dst[1:], enc[:])\n\n\treturn dst, nil\n}", "title": "" }, { "docid": "b9c558793fc7ee2a1e7853102e28d894", "score": "0.4999919", "text": "func (p *PttID) Marshal() ([]byte, error) {\n\treturn p[:], nil\n}", "title": "" }, { "docid": "8cc2063c145ff0a027b9958f92e16e01", "score": "0.49997836", "text": "func EncodeUnrestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {\n\tif flags.HasFlags(EncBareIdentifiers) || isBareIdentifier(s) {\n\t\tbuf.WriteString(s)\n\t\treturn\n\t}\n\tencodeEscapedSQLIdent(buf, s)\n}", "title": "" }, { "docid": "865a6e67ae02e38fe7f03813a76901f7", "score": "0.49947548", "text": "func (id ID) MarshalText() (text []byte, err error) {\n\treturn []byte(id.String()), nil\n}", "title": "" }, { "docid": "865a6e67ae02e38fe7f03813a76901f7", "score": "0.49947548", "text": "func (id ID) MarshalText() (text []byte, err error) {\n\treturn []byte(id.String()), nil\n}", "title": "" }, { "docid": "f085a3257c974ae9cf1f7eed627ef69b", "score": "0.49858895", "text": "func (k *Key) marshal(w writer, escape bool) {\n\tif k.Parent != nil {\n\t\tk.Parent.marshal(w, escape)\n\t\tw.WriteByte('/')\n\t}\n\tw.WriteString(k.Kind)\n\tw.WriteByte(',')\n\tif k.NameID != \"\" {\n\t\tw.WriteByte('\\'')\n\t\tw.WriteString(url.PathEscape(k.NameID))\n\t\tw.WriteByte('\\'')\n\t} else {\n\t\tw.WriteString(strconv.FormatInt(k.IntID, 10))\n\t}\n}", "title": "" }, { "docid": "f43675611dd4391e549dd795b073ea89", "score": "0.49842173", "text": "func createOidWriter(objtype ObjectType, objsize uint, inner io.WriteCloser) *oidWriter {\n\thasher := sha1.New()\n\tfmt.Fprintf(hasher, \"%s %d\\x00\", objtype.HdrName(), objsize)\n\n\tw := &oidWriter{\n\t\thasher: hasher,\n\t\tinner: inner,\n\t\twriter: io.MultiWriter(hasher, inner),\n\t}\n\n\treturn w\n}", "title": "" }, { "docid": "a6fa8ecf1e9a9c02d0463ab586096b3e", "score": "0.49839815", "text": "func (i ID) MarshalBinary() ([]byte, error) {\n\treturn i.Bytes(), nil\n}", "title": "" }, { "docid": "824065518900dbe9d269a0d60b9b9b92", "score": "0.49728307", "text": "func (id ID) MarshalJSON() ([]byte, error) {\n\tstr := \"\\\"\" + id.String() + \"\\\"\"\n\treturn []byte(str), nil\n}", "title": "" }, { "docid": "ca48adde7eaef8226e08ee7b67988e87", "score": "0.49554068", "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": "fbaeee3087a098816a059d4824d0152a", "score": "0.49487814", "text": "func EncodeRestrictedSQLIdent(buf *bytes.Buffer, s string, flags EncodeFlags) {\n\tif flags.HasFlags(EncBareIdentifiers) || (!isReservedKeyword(s) && isBareIdentifier(s)) {\n\t\tbuf.WriteString(s)\n\t\treturn\n\t}\n\tencodeEscapedSQLIdent(buf, s)\n}", "title": "" }, { "docid": "ed7d4ae9da65f4f6dd2ef1345c3b0d90", "score": "0.49461767", "text": "func (id ID) MarshalBinary() ([]byte, error) {\n\treturn id[:], nil\n}", "title": "" }, { "docid": "05e6913191546b121b32a4a47a4e31fd", "score": "0.49435547", "text": "func WriteInt(w Writer, i int64) { writeInt(w, i) }", "title": "" }, { "docid": "219005178e46dc053a64e8621e221cb2", "score": "0.4942014", "text": "func (i *idsType) Marshal() ([]byte, error) {\n\t// idsAsString := i.Strings()\n\t// return json.Marshal(&idsAsString)\n\treturn json.Marshal(i.Strings())\n}", "title": "" }, { "docid": "ed7d9e2f07281d520f2743a7ab5423ae", "score": "0.49151835", "text": "func (w *Writer) Pack(ptr interface{}) {\n\tw.w.count = 0\n\tw.w.record = true\n\tw.err = binary.Write(w.w, w.order, ptr)\n\tw.position += w.w.count\n\tw.w.record = false\n}", "title": "" }, { "docid": "246e5a2a50ab659f8fa59b28b7d70ec0", "score": "0.49073723", "text": "func (id ID) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(id.String())\n}", "title": "" }, { "docid": "ba5a87ae2e31d61cf353d354b4e8231c", "score": "0.48880056", "text": "func (m *ResourceAccess) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"id\", m.GetId())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"type\", m.GetType())\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": "9ba5d3817eeb353f50b38707f58bae78", "score": "0.4882603", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn protocol.Marshal(-1, v)\n}", "title": "" }, { "docid": "14163dd05a57eff628203f067703f973", "score": "0.48802876", "text": "func (i ID) MarshalText() ([]byte, error) {\n\treturn []byte(i.String()), nil\n}", "title": "" }, { "docid": "ebe19987641a0d09d861af4d4532b191", "score": "0.48438996", "text": "func (s *Assertions) Marshal(w io.Writer) error {\n\treturn s.marshal(w)\n}", "title": "" }, { "docid": "f01725e0058e4c89cb118296d1e379af", "score": "0.48424673", "text": "func (m *WorkbookFunctionResult) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Entity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"error\", m.GetError())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteObjectValue(\"value\", m.GetValue())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "f7a9ac54a794e8e6e9fabc8ab4ac3745", "score": "0.48353994", "text": "func MarshalBid(r *bytes.Buffer, f *Bid) error {\n\tif err := encoding.WriteVarBytes(r, f.EncryptedData); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.Write256(r, f.HashedSecret); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.Write256(r, f.Nonce); err != nil {\n\t\treturn err\n\t}\n\n\tif err := keys.MarshalStealthAddress(r, f.StealthAddress); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.Write256(r, f.Commitment); err != nil {\n\t\treturn err\n\t}\n\n\tif err := encoding.Write256(r, f.Eligibility); err != nil {\n\t\treturn err\n\t}\n\n\treturn encoding.Write256(r, f.Expiration)\n}", "title": "" }, { "docid": "b5847cb6e24c3bed8b5fa1d102aa6ca6", "score": "0.48242497", "text": "func marshalIDStringAttr(pktType byte, id uint32, str string, attr *FileAttr) ([]byte, error) {\n\tb := allocPkt(pktType, 4+(4+len(str))+attr.encodedSize())\n\tb = appendU32(b, id)\n\tb = appendStr(b, str)\n\treturn appendAttr(b, attr), nil\n}", "title": "" }, { "docid": "b8acff28b9d27bde5c117624699eae54", "score": "0.4823745", "text": "func newMarshalerInstr(t reflect.Type) Instruction {\n\treturn func(p unsafe.Pointer, w Writer, es *encodeState) error {\n\t\tv := reflect.NewAt(t, p).Elem()\n\n\t\tm, ok := v.Interface().(Marshaler)\n\t\tif !ok {\n\t\t\t_, err := w.WriteString(\"null\")\n\t\t\treturn err\n\t\t}\n\t\tif err := m.WriteJSON(w); err != nil {\n\t\t\treturn &MarshalerError{err, t, jettisonMarshalerCtx}\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "914aae8b3202b47a180ba06d11765f07", "score": "0.48215774", "text": "func (i ID) MarshalJSON() ([]byte, error) {\n\treturn bson.ObjectId(i).MarshalJSON()\n}", "title": "" }, { "docid": "1c750fe30a19acab960c3e4baabba460", "score": "0.4818416", "text": "func SendErrorResponseMessage(writer io.Writer, msgId int, errMsg string) os.Error {\n _, err := writer.Write([]byte{ 0x94 })\n if err != nil { return err }\n _, err = msgpack.PackInt8(writer, RESPONSE)\n if err != nil { return err }\n _, err = msgpack.PackInt(writer, msgId)\n if err != nil { return err }\n _, err = msgpack.PackBytes(writer, []byte(errMsg))\n if err != nil { return err }\n _, err = msgpack.PackNil(writer)\n return err\n}", "title": "" }, { "docid": "71404be0265fb902ab80afb627d443b5", "score": "0.48178485", "text": "func Marshal(v interface{}) string {\n\treturn marshal(reflect.ValueOf(v), 0)\n}", "title": "" }, { "docid": "e89758e528694a964d1163a98b12c460", "score": "0.48132226", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn encode(v)\n\n}", "title": "" }, { "docid": "aea5fab02e175830c843881a1e19a7a8", "score": "0.48128244", "text": "func WriteEscapeID(buf *strings.Builder, in string) {\n\t// growing by 4 more than the length, gives us room\n\t// for guaranteed escaping with backticks on each end,\n\t// plus a small amount of room just in case there are\n\t// backticks within the symbol that needs to be double\n\t// escaped. This is an unlikely edge case.\n\tbuf.Grow(4 + len(in))\n\n\tbuf.WriteByte('`')\n\tfor i := 0; i < len(in); i++ {\n\t\tbuf.WriteByte(in[i])\n\t\tif in[i] == '`' {\n\t\t\tbuf.WriteByte('`')\n\t\t}\n\t}\n\tbuf.WriteByte('`')\n}", "title": "" }, { "docid": "e06eea76862d9cb5a0c4610b9f9f674b", "score": "0.48008788", "text": "func (t Int) Marshal(buf *Buffer) {\n\tbuf.EncodeVarint(tagInt)\n\tbuf.EncodeVarint(int64(t))\n}", "title": "" }, { "docid": "e11cccd0089ddb307b0696a9c8b8a0d1", "score": "0.47951263", "text": "func Pack(writer io.Writer, args... interface{}) (os.Error) {\n return PackOrder(writer, PackByteOrder, args);\n}", "title": "" }, { "docid": "d38dd340c42d4de62ced4be18d470444", "score": "0.4793828", "text": "func (x *MaterialReducerOutput) Marshal(r IO) {\n\tr.Varint32(&x.NetworkID)\n\tr.Varint32(&x.Count)\n}", "title": "" }, { "docid": "21d18061712c38e8067b7dbd4ea648d4", "score": "0.47747722", "text": "func (i *InstanceID) MarshalMetadata(data interface{}) error {\n\n\tif fmt.Sprintf(\"%v\", data) == \"<nil>\" {\n\t\treturn ErrIIDMetadataNilData\n\t}\n\n\tvar err error\n\tif i.metadata, err = json.Marshal(data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95e29f8b4bc28fec064bf06d72fa9f6a", "score": "0.476632", "text": "func (i ID) MarshalJSON() ([]byte, error) {\n\treturn json.Marshal(i.String())\n}", "title": "" }, { "docid": "d6ada30a7e3bd1c980b8c7816c53814a", "score": "0.47620296", "text": "func (s SPID) MarshalBinary() (data []byte, err error) {\n\tdata = append([]byte{}, s[:]...)\n\treturn\n}", "title": "" }, { "docid": "8be88ea64c52f213278ff08dfaa0acfe", "score": "0.47593948", "text": "func (i Ion) Marshal(value interface{}) ([]byte, error) {\n\treturn ion.MarshalBinary(value)\n}", "title": "" }, { "docid": "19e5cb0b235a42a1a11a9a69fa863ce5", "score": "0.47581875", "text": "func (u ID) MarshalJSON() ([]byte, error) {\n\tif len(u) == 0 {\n\t\treturn []byte(`\"\"`), nil\n\t}\n\treturn []byte(`\"` + u.String() + `\"`), nil\n}", "title": "" }, { "docid": "ddcc7d3cee85842aca2c16c2968922ca", "score": "0.47298285", "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": "f5dda6c5c6ae13fee118236446c55964", "score": "0.47289434", "text": "func (id DbID) MarshalJSON() ([]byte, error) {\n\treturn []byte(\"\\\"\" + id.String() + \"\\\"\"), nil\n}", "title": "" }, { "docid": "0437d2961798653557ab27d89d6662e6", "score": "0.47176626", "text": "func (id ID) MarshalText() ([]byte, error) {\n\tb := internal.Encode((*[10]byte)(&id))\n\n\treturn b[:], nil\n}", "title": "" }, { "docid": "df7d1e0d9ddaa806555b17dbc38d190c", "score": "0.47016162", "text": "func (b Encoder) PutID(typeID string) {\n\tb.Writer.FieldStart(TypeField)\n\tb.Writer.Str(typeID)\n}", "title": "" }, { "docid": "f0b405dff69fff0d71e49807fc693492", "score": "0.4686483", "text": "func (id *ID) MarshalJSON() ([]byte, error) {\n\treturn (*refs.OwnerID)(id).\n\t\tMarshalJSON()\n}", "title": "" }, { "docid": "b8eac671d88a631d598758fa8eacce26", "score": "0.4683299", "text": "func (i *InstanceID) MarshalText() ([]byte, error) {\n\n\tt := &bytes.Buffer{}\n\tfmt.Fprint(t, i.Driver)\n\tif len(i.Service) > 0 {\n\t\tfmt.Fprintf(t, \":%s\", i.Service)\n\t}\n\tfmt.Fprintf(t, \"=%s\", i.ID)\n\n\tif len(i.Fields) == 0 && len(i.metadata) == 0 {\n\t\treturn t.Bytes(), nil\n\t}\n\n\tt.WriteByte(',')\n\n\tif len(i.Fields) > 0 {\n\t\tvals := url.Values{}\n\t\tfor k, v := range i.Fields {\n\t\t\tvals.Add(k, v)\n\t\t}\n\t\tt.WriteString(vals.Encode())\n\t}\n\n\tif len(i.metadata) == 0 {\n\t\treturn t.Bytes(), nil\n\t}\n\n\tt.WriteByte(',')\n\n\tenc := b64.NewEncoder(b64.StdEncoding, t)\n\tif _, err := enc.Write(i.metadata); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := enc.Close(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn t.Bytes(), nil\n}", "title": "" }, { "docid": "4be6f46f9b406c03cf8eda73f3cb097f", "score": "0.4677972", "text": "func (x *ScoreboardIdentityEntry) Marshal(r IO) {\n\tr.Varint64(&x.EntryID)\n\tr.Varint64(&x.EntityUniqueID)\n}", "title": "" }, { "docid": "15319b3cf699fdd4c0584e21431b6b94", "score": "0.46673384", "text": "func (r RequestID) MarshalText() ([]byte, error) {\n\treturn []byte(uuid.UUID(r).String()), nil\n}", "title": "" }, { "docid": "900ea1997256cb5244e1f81207a592f7", "score": "0.4664638", "text": "func (id ObjectId) MarshalText() ([]byte, error) {\n\treturn []byte(fmt.Sprintf(\"%x\", string(id))), nil\n}", "title": "" }, { "docid": "ca7e2ab11a40da9075b582cb6d16c3ef", "score": "0.46618253", "text": "func Marshal(v interface{}) ([]byte, error) {\n\treturn GetAPI().Marshal(v)\n}", "title": "" }, { "docid": "fd91a023300d64872623fd7833425b5e", "score": "0.46607992", "text": "func Marshal(val interface{}) ([]byte, error) {\n\treturn MarshalWithParams(val, \"\")\n}", "title": "" }, { "docid": "d1b90af275732b11e427fb173bd910a6", "score": "0.4657375", "text": "func (c *create) genResp() {\n\tif c.hasErr() {\n\t\treturn\n\t}\n\n\tb, err := json.Marshal(c.id)\n\tif err != nil {\n\t\tc.err = errors.Wrap(err, \"jwork.conversation.create,genResp, could not marshal id object\")\n\t\treturn\n\t}\n\n\tc.resp = bytes.NewBuffer(b)\n}", "title": "" }, { "docid": "c3e0a22c9f412b46173c4034007dacf6", "score": "0.4653494", "text": "func writeTo(w io.Writer, n interface{}, v interface{}, b bool, b2 bool) (int64, error) {\n return 0, nil\n}", "title": "" }, { "docid": "6f4281bc047b2ba1958f575b4a12c46c", "score": "0.46517316", "text": "func (m *Int32Value) MarshalToWriter(writer jspb.Writer) {\n\tif m == nil {\n\t\treturn\n\t}\n\n\tif m.Value != 0 {\n\t\twriter.WriteInt32(1, m.Value)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2aad30dca1082c79817971bd76708b4b", "score": "0.46498418", "text": "func (r *QueuePushRequest) marshal(writer io.Writer) error {\n\tstream := helpers.NewStream(writer)\n\tr.stream(stream)\n\treturn stream.Error\n}", "title": "" }, { "docid": "04947150a630ca6830fda3bfdc5384f9", "score": "0.4647868", "text": "func (uid UUID) MarshalGQL(w io.Writer) {\n\t_, _ = w.Write([]byte(uuid.UUID(uid).String()))\n}", "title": "" }, { "docid": "8271187df1692226e11f639419b72adf", "score": "0.46451116", "text": "func marshalDiscussionID(discussionID int64) graphql.ID {\n\treturn graphql.ID(strconv.FormatInt(discussionID, 10))\n}", "title": "" }, { "docid": "9a9f56b4735bae206535467902bf8958", "score": "0.46385694", "text": "func marshalWithoutID(obj interface{}) ([]byte, error) {\n\tdata, err := json.Marshal(obj)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar raw map[string]*json.RawMessage\n\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdelete(raw, \"id\")\n\n\treturn json.Marshal(raw)\n}", "title": "" }, { "docid": "eaaa4ef58cf3cfe37244f79992a84ac9", "score": "0.4636586", "text": "func (b *baseBuilder) id(id int64) {}", "title": "" }, { "docid": "401a6680e83f106ca273c81e4f1ebf34", "score": "0.4635526", "text": "func (t Str) Marshal(buf *Buffer) {\n\tbuf.EncodeVarint(tagStr)\n\tbuf.EncodeString(string(t))\n}", "title": "" }, { "docid": "0342bf13feccc31d788e8cb1ca43886b", "score": "0.4632918", "text": "func (server *Server) Write(args *shared.Args, reply *string) error {\n\tobj, found := server.Objects[args.Key]\n\t*reply = \"SUCCESS\"\n\tfmt.Println(\"Write: TransactionID is: \", args.TransactionID)\n\tif !found {\n\t\tnewObj := NewObject(args.Value)\n\t\tserver.Objects[args.Key] = newObj\n\t\tnewObj.Writer = args.TransactionID\n\t\treturn nil\n\t}\n\n\tobj.m.Lock()\n\tif obj.Writer != args.TransactionID {\n\t\tfmt.Println(\"Commit error: the transaction does not have write lock\")\n\t}\n\tobj.Value = args.Value\n\tobj.m.Unlock()\n\n\treturn nil\n}", "title": "" }, { "docid": "1918b0e252bd6e1f15b151595e7ef91d", "score": "0.46049324", "text": "func (w *MultiTypedWriter) Write(typeID uint16, data []byte) (int, error) {\n\treturn writeRecord(w.w, typeID, data)\n}", "title": "" }, { "docid": "5dc4702c75733060ce63ed844bf560bc", "score": "0.45931304", "text": "func iocEncWrite(iocType, number, size uintptr) uintptr {\n\treturn iocEnc(iocOpWrite, iocType, number, size)\n}", "title": "" }, { "docid": "9ad3e203a0c11e017cd0bbef6b085129", "score": "0.45902893", "text": "func (o *codeObject) Marshal(buf []byte) ([]byte, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "2dbfc17e5e8e6efccd910cc43be7c53d", "score": "0.4588324", "text": "func (m *CommunicationsApplicationIdentity) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.Identity.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"applicationType\", m.GetApplicationType())\n if err != nil {\n return err\n }\n }\n {\n err = writer.WriteBoolValue(\"hidden\", m.GetHidden())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "317f0a043b4d5be7645e75fff94ed7dd", "score": "0.4583302", "text": "func (res *Result) Marshal() (string, error) {\n\treturn marshal(res)\n}", "title": "" }, { "docid": "013c58dc7a5fa06daa1b76fc3c32832b", "score": "0.45791507", "text": "func encodeEscapedSQLIdent(buf *bytes.Buffer, s string) {\n\tbuf.WriteByte('\"')\n\tstart := 0\n\tfor i, n := 0, len(s); i < n; i++ {\n\t\tch := s[i]\n\t\t// The only character that requires escaping is a double quote.\n\t\tif ch == '\"' {\n\t\t\tif start != i {\n\t\t\t\tbuf.WriteString(s[start:i])\n\t\t\t}\n\t\t\tstart = i + 1\n\t\t\tbuf.WriteByte(ch)\n\t\t\tbuf.WriteByte(ch) // add extra copy of ch\n\t\t}\n\t}\n\tif start < len(s) {\n\t\tbuf.WriteString(s[start:])\n\t}\n\tbuf.WriteByte('\"')\n}", "title": "" }, { "docid": "694cd9cc46c45afddec11e014e296c22", "score": "0.4578929", "text": "func (uuid UUID) Marshal() ([]byte, error) {\n\tif len(uuid) == 0 {\n\t\treturn nil, nil\n\t}\n\treturn []byte(uuid), nil\n}", "title": "" }, { "docid": "0a2b6bc56527cf8f9beaaebf119602a9", "score": "0.45598045", "text": "func ID(thing interface{}) string { return \"\" }", "title": "" }, { "docid": "a941f1f46e8b259383d47bf9c8337e7b", "score": "0.4557761", "text": "func (c *BinaryCodec) Write( i interface{ Write(*BinaryCodec) } ) *BinaryCodec {\n if c.err == nil {\n i.Write( c )\n }\n return c\n}", "title": "" }, { "docid": "9f18921340163c385545b36e8fec4f56", "score": "0.45564166", "text": "func (m *DeviceComplianceScriptRuleError) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.DeviceComplianceScriptError.Serialize(writer)\n if err != nil {\n return err\n }\n {\n err = writer.WriteStringValue(\"settingName\", m.GetSettingName())\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "f40137c618e1cbfde1cb784d44ee35f2", "score": "0.45542204", "text": "func (m *ResourceReference) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"id\", m.GetId())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"type\", m.GetTypeEscaped())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"webUrl\", m.GetWebUrl())\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": "26b77ed06e1ba2521b0b9fa2c18a85a3", "score": "0.45525137", "text": "func (id *MessageID) MarshalBinary() (result []byte, err error) {\n\treturn id.Bytes(), nil\n}", "title": "" }, { "docid": "701d5f5f90a36a440fc31f3cb9110bcc", "score": "0.4549837", "text": "func (id UULID) MarshalBinary() (data []byte, err error) {\n\tdata = make([]byte, BinarySize)\n\treturn data, id.MarshalBinaryTo(data)\n}", "title": "" }, { "docid": "1feea97f769d54c8525b2fe5c6d9d843", "score": "0.45465454", "text": "func (m Marshaller) Marshal(v interface{}) (string, error) {\n\tbytes, err := m(v)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes), nil\n}", "title": "" }, { "docid": "a4a142aa37be69bde24ef6164be39fb9", "score": "0.4537191", "text": "func (m *AzureADDeviceRegistrationError) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n err := m.UpdatableAssetError.Serialize(writer)\n if err != nil {\n return err\n }\n if m.GetReason() != nil {\n cast := (*m.GetReason()).String()\n err = writer.WriteStringValue(\"reason\", &cast)\n if err != nil {\n return err\n }\n }\n return nil\n}", "title": "" }, { "docid": "03a0bdab36c047db416b1a670945b7df", "score": "0.45306003", "text": "func (st *State) Marshal(w io.Writer) error {\n\tq := query.Query{\n\t\tPrefix: st.namespace.String(),\n\t}\n\n\tresults, err := st.dsRead.Query(context.Background(), q)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer results.Close()\n\n\tenc := codec.NewEncoder(w, st.codecHandle)\n\n\tfor r := range results.Next() {\n\t\tif r.Error != nil {\n\t\t\tlogger.Errorf(\"error in query result: %s\", r.Error)\n\t\t\treturn r.Error\n\t\t}\n\n\t\tk := ds.NewKey(r.Key)\n\t\t// reduce snapshot size by not storing the prefix\n\t\terr := enc.Encode(serialEntry{\n\t\t\tKey: k.BaseNamespace(),\n\t\t\tValue: r.Value,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Error(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c07b1c4d3b1d1c098a1177ffc2fe95cd", "score": "0.45126057", "text": "func (mw makeWriter) writeSomething(i interface{}) error {\n\tswitch v := i.(type) {\n\tcase *Rule:\n\t\treturn mw.writeRule(v)\n\tcase RawText:\n\t\treturn mw.writeRaw(v)\n\tcase makeVarAssign:\n\t\treturn mw.writeMakeVarAssign(v)\n\tcase *Comment:\n\t\treturn mw.writeComment(v)\n\tcase *Builder:\n\t\treturn mw.writeBuilder(v)\n\tdefault:\n\t\treturn errors.New(\"Unsupported type write\")\n\t}\n}", "title": "" }, { "docid": "d474c4fdf286477c7d7bf119c2105921", "score": "0.44847336", "text": "func (m *ValidationResult) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"message\", m.GetMessage())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"ruleName\", m.GetRuleName())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteBoolValue(\"validationPassed\", m.GetValidationPassed())\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": "1c75ba7061d4828f2e47e2ce3d41f16b", "score": "0.44760182", "text": "func (g *generator) encodeStatement(t reflect.Type, arg string) string {\n\tbn, native := builtinName(t)\n\tif bn != \"\" {\n\t\t// t can be handled by an Encoder method.\n\t\tif t != native {\n\t\t\t// t is not the Encoder method's argument type, so we must cast.\n\t\t\targ = fmt.Sprintf(\"%s(%s)\", native, arg)\n\t\t}\n\t\treturn fmt.Sprintf(\"e.Encode%s(%s)\", bn, arg)\n\t}\n\tif t.Kind() == reflect.Interface {\n\t\treturn fmt.Sprintf(\"e.EncodeAny(%s)\", arg)\n\t}\n\treturn fmt.Sprintf(\"encode_%s(e, %s)\", g.funcName(t), arg)\n}", "title": "" } ]
fdb8ad113b424597146f3969bc65d757
scanValues returns the types for scanning values from sql.Rows.
[ { "docid": "0205999bc0be1dce2dca3729eeacf3be", "score": "0.7528437", "text": "func (*Api) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase api.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Api\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" } ]
[ { "docid": "3f98e25e3f4762ed94a5c6e6317b8904", "score": "0.7795333", "text": "func (*Recruitment) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase recruitment.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase recruitment.FieldTitle, recruitment.FieldContent:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Recruitment\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "becd7649db8f9dc9033767330afa3e25", "score": "0.77679926", "text": "func (*ProcedureType) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase proceduretype.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase proceduretype.FieldProcedureName:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type ProcedureType\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "706c52e4b28ceecb937a19e16b67f26d", "score": "0.77555317", "text": "func (*Researchtype) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // TYPE_NAME\n\t}\n}", "title": "" }, { "docid": "43a2eedf2efdc26b9dd5a68d72efee2c", "score": "0.7622701", "text": "func (*Zoo) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase zoo.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Zoo\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ce963a0f0e48a823bb54c8c1ee35c39d", "score": "0.7592036", "text": "func (*Character) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase character.FieldPinYin, character.FieldTraditionalCharacter, character.FieldVariantCharacter:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase character.FieldIsKangxi, character.FieldIsNameScience, character.FieldIsRegular:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase character.FieldScienceStroke, character.FieldRadicalStroke, character.FieldStroke, character.FieldSimpleTotalStroke, character.FieldTraditionalRadicalStroke, character.FieldTraditionalTotalStroke:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase character.FieldID, character.FieldCh, character.FieldRadical, character.FieldKangxi, character.FieldKangxiStroke, character.FieldSimpleRadical, character.FieldSimpleRadicalStroke, character.FieldTraditionalRadical, character.FieldWuXing, character.FieldLucky, character.FieldComment:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Character\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a2d5fadcbb435c3abe9a7faf50bdf0a1", "score": "0.7590466", "text": "func (*ExValueScan) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase exvaluescan.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase exvaluescan.FieldBinary:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.Binary.ScanValue()\n\t\tcase exvaluescan.FieldBinaryOptional:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.BinaryOptional.ScanValue()\n\t\tcase exvaluescan.FieldText:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.Text.ScanValue()\n\t\tcase exvaluescan.FieldTextOptional:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.TextOptional.ScanValue()\n\t\tcase exvaluescan.FieldBase64:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.Base64.ScanValue()\n\t\tcase exvaluescan.FieldCustom:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.Custom.ScanValue()\n\t\tcase exvaluescan.FieldCustomOptional:\n\t\t\tvalues[i] = exvaluescan.ValueScanner.CustomOptional.ScanValue()\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b97a3e88740d173d03412ac74c1e4d1c", "score": "0.75290924", "text": "func (*ResultsDefinition) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase resultsdefinition.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase resultsdefinition.ForeignKeys[0]: // clinical_trial_results_definition\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type ResultsDefinition\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "d4ee22c9b14414db48881958b78c2da9", "score": "0.75243855", "text": "func (*Ranking) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase ranking.FieldID, ranking.FieldLastRank, ranking.FieldCurrentRank, ranking.FieldStateCal, ranking.FieldTransactionFactorRank:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase ranking.FieldWalletID, ranking.FieldName, ranking.FieldTaxID, ranking.FieldProvinceNameTH, ranking.FieldDistrictNameTH, ranking.FieldDistrictNameEN, ranking.FieldOccupationName, ranking.FieldStatusRanking, ranking.FieldLastDateCalRank, ranking.FieldNextDateCalRank, ranking.FieldZipCode, ranking.FieldSubDistrict, ranking.FieldPhoneno, ranking.FieldAddressDetail, ranking.FieldStreet:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase ranking.FieldRegisDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Ranking\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a5a00b7e98711fc8e998647fc3461902", "score": "0.7524332", "text": "func (*Admin) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase admin.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase admin.FieldIdentifiant, admin.FieldMotDePasse:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Admin\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4033e6ac80d2d1aa38d723ae0d8d0c17", "score": "0.75170386", "text": "func (*Entity) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase entity.FieldActive:\n\t\t\tvalues[i] = &sql.NullBool{}\n\t\tcase entity.FieldFirstname, entity.FieldLastname, entity.FieldFullname, entity.FieldType, entity.FieldUsername, entity.FieldToken, entity.FieldURL:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase entity.FieldDateCreated, entity.FieldDateOfBirth, entity.FieldLastLoginDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase entity.FieldID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Entity\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "56bd7a1555c0661c859e45aa51fd232b", "score": "0.7510254", "text": "func (*BookingMetadatum) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase bookingmetadatum.FieldID, bookingmetadatum.FieldBookingId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase bookingmetadatum.FieldKey, bookingmetadatum.FieldValue:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type BookingMetadatum\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4c78a50187e0cb4ba77e962d57e678d5", "score": "0.74799436", "text": "func (*Scholarshiptype) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Scholarshiptypename\n\t}\n}", "title": "" }, { "docid": "59a818b41d1161629dbd23fc02909e2a", "score": "0.7473284", "text": "func (*MetricName) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase metricname.FieldID, metricname.FieldTypeId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase metricname.FieldName, metricname.FieldHelp:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase metricname.FieldCreatedAt, metricname.FieldUpdatedAt, metricname.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase metricname.ForeignKeys[0]: // metric_type_metric_names\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type MetricName\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "6cd5ef50083577b9b464350956c65948", "score": "0.7463001", "text": "func (*Beer) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase beer.FieldID, beer.FieldIdmedia:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase beer.FieldTitlebeer, beer.FieldDescriptionbeer:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase beer.FieldCreationdatebeer:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Beer\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a66187e528a4f37e054ded331433bca1", "score": "0.745945", "text": "func (*ClinicalTrialMetadata) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase clinicaltrialmetadata.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase clinicaltrialmetadata.FieldTagName, clinicaltrialmetadata.FieldTagValue, clinicaltrialmetadata.FieldUseCaseCode:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase clinicaltrialmetadata.ForeignKeys[0]: // clinical_trial_metadata\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type ClinicalTrialMetadata\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b6f44894d10364e4a9643b1383aebf38", "score": "0.7457142", "text": "func (*Users) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase users.FieldUIsActive:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase users.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase users.FieldUPid, users.FieldUOrgid, users.FieldUFirstName, users.FieldULastName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase users.FieldUCreatedAt, users.FieldUPasswordUpdatedAt, users.FieldUExpiredAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase users.ForeignKeys[0]: // groups_users\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Users\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ecc0981c41d9c459d7662b2c071af0cb", "score": "0.74299806", "text": "func (*Question) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase question.FieldID, question.FieldUserID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase question.FieldBody:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase question.FieldPollExpiry, question.FieldCreatedAt, question.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Question\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "6a0b20808bb19acc27dad49354e92a8d", "score": "0.74289817", "text": "func (*Administrator) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase administrator.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase administrator.FieldUsername, administrator.FieldPassword:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Administrator\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "f495f34a2c657f160308eae16bcf25f2", "score": "0.7425591", "text": "func (*Role) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase role.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase role.FieldName, role.FieldRemark:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase role.FieldCreatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Role\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "3e7f4d9ab89b8b762379666d899b76c9", "score": "0.741727", "text": "func (*UserCard) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase usercard.FieldLimitDaily, usercard.FieldLimitMonthly:\n\t\t\tvalues[i] = new(sql.NullFloat64)\n\t\tcase usercard.FieldID, usercard.FieldUserID, usercard.FieldWalletID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase usercard.FieldCreatedAt, usercard.FieldUpdatedAt, usercard.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type UserCard\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "7275e7b66120cfecfb49ad86be3495e6", "score": "0.74156904", "text": "func (*Entry) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase entry.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase entry.FieldTitle, entry.FieldBody, entry.FieldTag:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "0e6219ce56943a901465a33bc1f185f6", "score": "0.7415585", "text": "func (*Pointtransaction) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase pointtransaction.FieldID, pointtransaction.FieldPoint:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase pointtransaction.FieldWalletID, pointtransaction.FieldTransactionName, pointtransaction.FieldReference:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase pointtransaction.FieldDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Pointtransaction\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2657893086a3ca0206a331dbef69178c", "score": "0.74129987", "text": "func (*Physicaltherapyrecord) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase physicaltherapyrecord.FieldID, physicaltherapyrecord.FieldPrice:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase physicaltherapyrecord.FieldPhone, physicaltherapyrecord.FieldNote:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase physicaltherapyrecord.FieldAppointtime:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase physicaltherapyrecord.ForeignKeys[0]: // _Patient_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase physicaltherapyrecord.ForeignKeys[1]: // _Personnel_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase physicaltherapyrecord.ForeignKeys[2]: // physicaltherapyroomname_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase physicaltherapyrecord.ForeignKeys[3]: // statusname_id\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Physicaltherapyrecord\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "89018ceda46f645c5343670f9305d6ed", "score": "0.74095726", "text": "func (*Answer) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase answer.FieldQuestionID, answer.FieldBody, answer.FieldOptionID:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase answer.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Answer\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "7a5372511c36836c36fef2f5f9e78ad9", "score": "0.7395604", "text": "func (*DeathManner) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase deathmanner.FieldID, deathmanner.FieldCreatedBy, deathmanner.FieldUpdatedBy:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase deathmanner.FieldCreatedWith, deathmanner.FieldUpdatedWith, deathmanner.FieldShort, deathmanner.FieldTitle, deathmanner.FieldDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase deathmanner.FieldCreatedAt, deathmanner.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase deathmanner.ForeignKeys[0]: // death_manner_metadata\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type DeathManner\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "8536af1211a6047fa8e16dc95229817b", "score": "0.7394866", "text": "func (*TCPDetectorResult) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase tcpdetectorresult.FieldMessages, tcpdetectorresult.FieldAddrs, tcpdetectorresult.FieldResults:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase tcpdetectorresult.FieldID, tcpdetectorresult.FieldTask, tcpdetectorresult.FieldResult, tcpdetectorresult.FieldMaxDuration:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase tcpdetectorresult.FieldCreatedAt, tcpdetectorresult.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "d676c610135785d4f7d524cc046256cd", "score": "0.7382633", "text": "func (*Session) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase session.FieldID, session.FieldData:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase session.FieldCreatedAt, session.FieldUpdatedAt, session.FieldExpiresAt:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Session\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "9a64d28e3acbf056225b7440bb16dc64", "score": "0.7381138", "text": "func (*Equipment) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase equipment.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase equipment.FieldName, equipment.FieldCondition:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase equipment.FieldCreateTime, equipment.FieldUpdateTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase equipment.ForeignKeys[0]: // category_equipment\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase equipment.ForeignKeys[1]: // location_equipment\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Equipment\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "cee384298f7aff68af4889ca9e7476f2", "score": "0.73749614", "text": "func (*Events) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase events.FieldEvents, events.FieldCorrelations, events.FieldSignature:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase events.FieldCount:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase events.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tcase events.ForeignKeys[0]: // instance_eventlisteners\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tcase events.ForeignKeys[1]: // workflow_wfevents\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Events\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "6368defab5a540e28c957f9b2c602368", "score": "0.7371884", "text": "func (*StatementEndingBalanc) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase statementendingbalanc.FieldStatementBalance:\n\t\t\tvalues[i] = &sql.NullFloat64{}\n\t\tcase statementendingbalanc.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase statementendingbalanc.FieldStatementDate:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase statementendingbalanc.ForeignKeys[0]: // _Bank_UID\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type StatementEndingBalanc\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "74babc844f5e1216280e3536f04bb1b0", "score": "0.7330103", "text": "func (*Namespace) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase namespace.FieldConfig, namespace.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase namespace.FieldCreatedAt, namespace.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase namespace.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Namespace\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2aa7397f983c4a3c52469cf7a6046241", "score": "0.7279015", "text": "func (*Reply) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase reply.FieldID, reply.FieldUserID, reply.FieldCommentID, reply.FieldParentID, reply.FieldStatus, reply.FieldFloor, reply.FieldCreateAt:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase reply.FieldContent:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "94e21a49fb25819ded664143d07e4672", "score": "0.72783947", "text": "func (*Hex) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase hex.FieldID, hex.FieldX, hex.FieldY:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase hex.FieldTerrain:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase hex.ForeignKeys[0]: // number_token_hex\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase hex.ForeignKeys[1]: // robber_hex\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Hex\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4b5b8f12676f6da14a82812cfaf21d4e", "score": "0.72783905", "text": "func (*Permission) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase permission.FieldData:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase permission.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase permission.FieldTenant, permission.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase permission.FieldCreatedAt, permission.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Permission\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "f9d90ec1fb6b8707d76309239681e975", "score": "0.7277117", "text": "func (*Item) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase item.FieldComplete:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase item.FieldID, item.FieldQuantity, item.FieldCategoryID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase item.FieldProductName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase item.ForeignKeys[0]: // shopping_item\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Item\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "cb96a36c483429e2a3e8f907312bb14c", "score": "0.7266008", "text": "func (*Event) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase event.FieldID, event.FieldAlertEvents:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase event.FieldSerialized:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase event.FieldCreatedAt, event.FieldUpdatedAt, event.FieldTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Event\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "48251de8bb05a0a5b5659809ab8dece8", "score": "0.72645634", "text": "func (*SysUser) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase sysuser.FieldIsDel:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase sysuser.FieldSort, sysuser.FieldStatus:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase sysuser.FieldID, sysuser.FieldUserName, sysuser.FieldRealName, sysuser.FieldFirstName, sysuser.FieldLastName, sysuser.FieldPassword, sysuser.FieldEmail, sysuser.FieldPhone, sysuser.FieldSalt:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase sysuser.FieldCreatedAt, sysuser.FieldUpdatedAt, sysuser.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type SysUser\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "c7a8d8b3cc4053276f0e87b35048e008", "score": "0.7261055", "text": "func (*IP) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase ip.FieldID, ip.FieldMask:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase ip.FieldIP, ip.FieldNet:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase ip.ForeignKeys[0]: // ip_machine\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type IP\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "56317e7cffc9d9beeff0d3863f6a10ad", "score": "0.7242456", "text": "func (*PingDetector) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase pingdetector.FieldOwners, pingdetector.FieldReceivers, pingdetector.FieldIps:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase pingdetector.FieldID, pingdetector.FieldStatus:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase pingdetector.FieldName, pingdetector.FieldTimeout, pingdetector.FieldInterval, pingdetector.FieldDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase pingdetector.FieldCreatedAt, pingdetector.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4b72637ebf2d1e75ef9f18f5c830c4fd", "score": "0.7230398", "text": "func (*CertainAgreement) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase certainagreement.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase certainagreement.FieldAgreementPiSponsorEmployee, certainagreement.FieldAgreementRestrictionType, certainagreement.FieldAgreementRestrictiveAgreement, certainagreement.FieldAgreementOtherDetails:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase certainagreement.ForeignKeys[0]: // certain_agreement_parent\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type CertainAgreement\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "8324929c42d5c024e5162f8671482876", "score": "0.71895796", "text": "func (*OutcomeAnalysis) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase outcomeanalysis.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase outcomeanalysis.FieldOutcomeAnalysisGroupDescription, outcomeanalysis.FieldOutcomeAnalysisTestedNonInferiority, outcomeanalysis.FieldOutcomeAnalysisNonInferiorityType, outcomeanalysis.FieldOutcomeAnalysisNonInferiorityComment, outcomeanalysis.FieldOutcomeAnalysisPValue, outcomeanalysis.FieldOutcomeAnalysisPValueComment, outcomeanalysis.FieldOutcomeAnalysisStatisticalMethod, outcomeanalysis.FieldOutcomeAnalysisStatisticalComment, outcomeanalysis.FieldOutcomeAnalysisParamType, outcomeanalysis.FieldOutcomeAnalysisParamValue, outcomeanalysis.FieldOutcomeAnalysisCiPctValue, outcomeanalysis.FieldOutcomeAnalysisCiNumSides, outcomeanalysis.FieldOutcomeAnalysisCiLowerLimit, outcomeanalysis.FieldOutcomeAnalysisCiUpperLimit, outcomeanalysis.FieldOutcomeAnalysisCiLowerLimitComment, outcomeanalysis.FieldOutcomeAnalysisCiUpperLimitComment, outcomeanalysis.FieldOutcomeAnalysisDispersionType, outcomeanalysis.FieldOutcomeAnalysisDispersionValue, outcomeanalysis.FieldOutcomeAnalysisEstimateComment, outcomeanalysis.FieldOutcomeAnalysisOtherAnalysisDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase outcomeanalysis.ForeignKeys[0]: // outcome_measure_outcome_analysis_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OutcomeAnalysis\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "f1e58ae5770d1826815a6610d4d971be", "score": "0.71873176", "text": "func (*Results) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullFloat64{}, // grade\n\t\t&sql.NullInt64{}, // group\n\t\t&sql.NullTime{}, // time\n\t}\n}", "title": "" }, { "docid": "5fb444e2ab1d59f963f6956863ae2fde", "score": "0.7170771", "text": "func (*StudyEligibility) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase studyeligibility.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase studyeligibility.FieldEligibilityCriteria, studyeligibility.FieldHealthyVolunteers, studyeligibility.FieldGender, studyeligibility.FieldMinimumAge, studyeligibility.FieldMaximumAge, studyeligibility.FieldStdAgeList, studyeligibility.FieldEthnicity:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase studyeligibility.ForeignKeys[0]: // clinical_trial_study_eligibility\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type StudyEligibility\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ef9e83ebadf12837862bd08d656518e8", "score": "0.715809", "text": "func (*ComprimiseEmail) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase comprimiseemail.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase comprimiseemail.FieldEmail:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type ComprimiseEmail\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ab0b5d41ccb8010f87f789f620f39518", "score": "0.71501446", "text": "func (*Watchlisthistory) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase watchlisthistory.FieldID, watchlisthistory.FieldRankWatchlist, watchlisthistory.FieldStatusDel:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase watchlisthistory.FieldName, watchlisthistory.FieldTaxID, watchlisthistory.FieldTypeName:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase watchlisthistory.FieldDateCalRank:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Watchlisthistory\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "947e9f47dc4feb95dd8c0376e96144fa", "score": "0.71327186", "text": "func (*Comment) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase comment.FieldID:\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tcase comment.FieldName, comment.FieldContent:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase comment.FieldCreatedAt, comment.FieldUpdatedAt, comment.FieldDeletedAt:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase comment.ForeignKeys[0]: // article_comments\n\t\t\tvalues[i] = &sql.NullInt64{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Comment\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "2c2649ed3f2496653081a8a8dd86ccce", "score": "0.7110497", "text": "func (*Prize) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // social_user_id\n\t\t&sql.NullString{}, // date\n\t}\n}", "title": "" }, { "docid": "097eb1318b3780114a4e9eb0596e9f8a", "score": "0.7102716", "text": "func (*Post) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase post.FieldTitle:\n\t\t\tvalues[i] = &sql.NullString{}\n\t\tcase post.FieldCreatedAt:\n\t\t\tvalues[i] = &sql.NullTime{}\n\t\tcase post.FieldID:\n\t\t\tvalues[i] = &uuid.UUID{}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Post\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "db84e39de7c133624f12296b1c7dedc2", "score": "0.7093168", "text": "func (*DeviceToken) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase devicetoken.FieldToken:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase devicetoken.FieldID, devicetoken.FieldPollInterval:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase devicetoken.FieldDeviceCode, devicetoken.FieldStatus, devicetoken.FieldCodeChallenge, devicetoken.FieldCodeChallengeMethod:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase devicetoken.FieldExpiry, devicetoken.FieldLastRequest:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "355a78a3750234177b9eda429f741640", "score": "0.7090997", "text": "func (*GoodsSpuImgs) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase goodsspuimgs.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase goodsspuimgs.FieldImgName, goodsspuimgs.FieldImgPath:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase goodsspuimgs.FieldCreatedAt, goodsspuimgs.FieldUpdatedAt, goodsspuimgs.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase goodsspuimgs.ForeignKeys[0]: // goods_spu_goods_spu_imgs\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type GoodsSpuImgs\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "717f58aefb42c537e35042a4ca21c435", "score": "0.70879847", "text": "func (*DrugAllergy) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // symptom\n\t\t&sql.NullString{}, // congenitalDisease\n\t\t&sql.NullString{}, // annotation\n\t\t&sql.NullTime{}, // dateTime\n\t}\n}", "title": "" }, { "docid": "dd6dc696caf9e1c839cbf664ada4ef79", "score": "0.708026", "text": "func (*SeriousEvent) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase seriousevent.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase seriousevent.FieldSeriousEventTerm, seriousevent.FieldSeriousEventOrganSystem, seriousevent.FieldSeriousEventSourceVocabulary, seriousevent.FieldSeriousEventAssessmentType, seriousevent.FieldSeriousEventNotes:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase seriousevent.ForeignKeys[0]: // adverse_events_module_serious_event_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type SeriousEvent\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "112dc8376fff259bb842d9e9fb7200f4", "score": "0.70757073", "text": "func ScanRowsToArray(rows *sql.Rows) ([]map[string]interface{}, error) {\n\tcolumns, _ := rows.ColumnTypes()\n\tlength := len(columns)\n\tresult := []map[string]interface{}{}\n\n\tfor rows.Next() {\n\t\treceiver := makeResultReceiver(length)\n\t\tif err := rows.Scan(receiver...); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\trow := make(map[string]interface{})\n\n\t\tfor i := 0; i < length; i++ {\n\t\t\tcol := columns[i]\n\t\t\tkey := col.Name()\n\t\t\tval := *(receiver[i]).(*interface{})\n\t\t\tif val == nil {\n\t\t\t\t// fmt.Println(key, \" value is null\")\n\t\t\t\t// row[key] = nil\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch col.DatabaseTypeName() {\n\t\t\tcase \"INT\":\n\t\t\t\tstr := string(val.([]uint8))\n\t\t\t\tparsedVal, err := strconv.ParseInt(str, 0, 32)\n\t\t\t\tif err == nil {\n\t\t\t\t\trow[key] = int(parsedVal)\n\t\t\t\t} else {\n\t\t\t\t\tfmt.Println(\"error parsing \", key, \" value\")\n\t\t\t\t\tfmt.Println(err.Error())\n\t\t\t\t}\n\t\t\tcase \"VARCHAR\":\n\t\t\t\tparsed := string(val.([]uint8))\n\t\t\t\tif !isEmpty(parsed) {\n\t\t\t\t\trow[key] = parsed\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tfmt.Printf(\"unsupport data type '%s' now\\n\", col.DatabaseTypeName())\n\t\t\t\t// TODO remember add other data type\n\t\t\t}\n\t\t}\n\t\tresult = append(result, row)\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "9d638fad1b669684ba53f0add6634fbb", "score": "0.70700717", "text": "func (*Datasource) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullInt64{}, // type\n\t\t&sub.DatasourceDetail{}, // detail\n\t\t&sql.NullTime{}, // createdAt\n\t\t&sql.NullTime{}, // updatedAt\n\t}\n}", "title": "" }, { "docid": "576a0aa608e76130e559ffd149c98963", "score": "0.7058365", "text": "func (*K8sDaemonSet) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase k8sdaemonset.FieldID, k8sdaemonset.FieldK8sClusterId, k8sdaemonset.FieldK8sNamespaceId, k8sdaemonset.FieldK8sObjectId:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase k8sdaemonset.FieldName:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase k8sdaemonset.FieldCreatedAt, k8sdaemonset.FieldUpdatedAt, k8sdaemonset.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type K8sDaemonSet\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "14e13c97be5b21b190378b03ae149125", "score": "0.7047355", "text": "func (*Story) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t}\n}", "title": "" }, { "docid": "da81afa74aed14de2aa74ff51245c1b9", "score": "0.70118076", "text": "func (*BankingData) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // bank_account\n\t}\n}", "title": "" }, { "docid": "e090014b43bc52b3afcbce3507d534de", "score": "0.6983091", "text": "func (*Kpi) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // description\n\t\t&sql.NullBool{}, // status\n\t}\n}", "title": "" }, { "docid": "9208b78ba8cac8034cdbe77575dd1c9f", "score": "0.69827616", "text": "func (*Message) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase message.FieldID, message.FieldSeen:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase message.FieldSenderUsername, message.FieldReceiverUsername, message.FieldMessage:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase message.FieldSendTime:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase message.ForeignKeys[0]: // user_message\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Message\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "c5a3ed939c596f7eb82a8f3cc5638a5f", "score": "0.69772965", "text": "func (*Split) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase split.FieldFrom, split.FieldTo:\n\t\t\tvalues[i] = new(sql.NullFloat64)\n\t\tcase split.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase split.FieldExecutionDate:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase split.ForeignKeys[0]: // entity_splits\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Split\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "874427d1773deaf61635d918cda726a3", "score": "0.6965781", "text": "func (*OutcomeDenomCount) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase outcomedenomcount.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase outcomedenomcount.FieldOutcomeDenomCountGroupID, outcomedenomcount.FieldOutcomeDenomCountValue:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase outcomedenomcount.ForeignKeys[0]: // outcome_denom_outcome_denom_count_list\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OutcomeDenomCount\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "a74911657f5085c914ed1ec3ec5d1ace", "score": "0.69456744", "text": "func (*Project) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t\t&sql.NullBool{},\n\t}\n}", "title": "" }, { "docid": "5059d2be8c7bfe78d84039e0db884b87", "score": "0.69429785", "text": "func (*RequestStatus) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase requeststatus.FieldStatus:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase requeststatus.FieldCreatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase requeststatus.FieldID:\n\t\t\tvalues[i] = new(uuid.UUID)\n\t\tcase requeststatus.ForeignKeys[0]: // request_status\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tcase requeststatus.ForeignKeys[1]: // request_status_user\n\t\t\tvalues[i] = &sql.NullScanner{S: new(uuid.UUID)}\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type RequestStatus\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "400f0a18f6809d3dab4d04b5da951651", "score": "0.6919118", "text": "func (*Lessonplan) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Room\n\t}\n}", "title": "" }, { "docid": "192de7f035d816b9bdf917f0a4725a70", "score": "0.69189614", "text": "func (*Comment) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullTime{},\n\t\t&sql.NullString{},\n\t\t&sql.NullString{},\n\t}\n}", "title": "" }, { "docid": "c3bbb9b86934c008e8d3c0604948d26d", "score": "0.691566", "text": "func (*Word) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // lang1\n\t\t&sql.NullString{}, // lang2\n\t\t&sql.NullString{}, // word1\n\t\t&sql.NullString{}, // word2\n\t}\n}", "title": "" }, { "docid": "b687550961112740f24a2343f88861be", "score": "0.6890427", "text": "func (*Hospital) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // hospital\n\t}\n}", "title": "" }, { "docid": "85c361469776329855f80fe113971a6f", "score": "0.68886656", "text": "func (*DispenseMedicine) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // datetime\n\t\t&sql.NullString{}, // note\n\t\t&sql.NullInt64{}, // amountchangemedicine\n\t\t&sql.NullString{}, // detailchangemedicine\n\t}\n}", "title": "" }, { "docid": "e2ca15c1bf3cd79d7cd4dd6fc6b53024", "score": "0.68755794", "text": "func (*Activity) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // activity_type\n\t\t&sql.NullBool{}, // is_create\n\t\t&sql.NullString{}, // old_value\n\t\t&sql.NullString{}, // new_value\n\t\t&[]byte{}, // clock_details\n\t}\n}", "title": "" }, { "docid": "70cf1e60aac9c4615782f9ed7fc5ab4d", "score": "0.6869857", "text": "func (*Customer) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // CustomerName\n\t\t&sql.NullString{}, // Address\n\t\t&sql.NullString{}, // PhoneNumber\n\t}\n}", "title": "" }, { "docid": "202915ef423f702ee7a6fe3582a7b08f", "score": "0.6861103", "text": "func (*Bookcourse) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // ACCESS\n\t\t&sql.NullString{}, // PHONE\n\t\t&sql.NullString{}, // DETAIL\n\t\t&sql.NullTime{}, // BOOKTIME\n\t}\n}", "title": "" }, { "docid": "6d52e519fd09673e9fe6bbf0dcc0d1e3", "score": "0.68574804", "text": "func (*Faculty) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // fname\n\t}\n}", "title": "" }, { "docid": "94728815cd0239a4a09e710ed44a50a7", "score": "0.6847852", "text": "func (*GithubGist) scanValues(columns []string) ([]any, error) {\n\tvalues := make([]any, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase githubgist.FieldOwner:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase githubgist.FieldPublic:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase githubgist.FieldID, githubgist.FieldSize:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase githubgist.FieldGistID, githubgist.FieldHTMLURL, githubgist.FieldDescription, githubgist.FieldName, githubgist.FieldType, githubgist.FieldLanguage, githubgist.FieldRawURL, githubgist.FieldContent:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase githubgist.FieldCreatedAt, githubgist.FieldUpdatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\tvalues[i] = new(sql.UnknownType)\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "ff255c26de6f32ea14412c0824469740", "score": "0.68274057", "text": "func (*Emp) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // user\n\t\t&sql.NullString{}, // pass\n\t\t&sql.NullString{}, // role\n\t}\n}", "title": "" }, { "docid": "30de07859674ddaf8689327dfc81b61e", "score": "0.68268746", "text": "func (*Url) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase url.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase url.FieldURL, url.FieldPath:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase url.FieldExpireAt, url.FieldCreatedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Url\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "4b85655d8958a57be1d4f22f509643a1", "score": "0.6826057", "text": "func (*OrderGoodsSku) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase ordergoodssku.FieldSpecsOption:\n\t\t\tvalues[i] = new([]byte)\n\t\tcase ordergoodssku.FieldIsCustomSku:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase ordergoodssku.FieldID, ordergoodssku.FieldSkuID, ordergoodssku.FieldPrice, ordergoodssku.FieldAmount:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase ordergoodssku.FieldSpuName, ordergoodssku.FieldSpuCode, ordergoodssku.FieldSpuHeadImg, ordergoodssku.FieldSpuDesc, ordergoodssku.FieldSpuDetails, ordergoodssku.FieldSkuName, ordergoodssku.FieldSkuCode:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase ordergoodssku.FieldCreatedAt, ordergoodssku.FieldUpdatedAt, ordergoodssku.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tcase ordergoodssku.ForeignKeys[0]: // goods_spu_order_goods_sku\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase ordergoodssku.ForeignKeys[1]: // order_info_order_goods_sku\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type OrderGoodsSku\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "733c719fe99f2749f891b6eb66631c5a", "score": "0.6806738", "text": "func (*MoreInfoModule) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase moreinfomodule.FieldID:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase moreinfomodule.FieldLimitationsAndCaveatsDescription:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase moreinfomodule.ForeignKeys[0]: // more_info_module_certain_agreement\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase moreinfomodule.ForeignKeys[1]: // more_info_module_point_of_contact\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase moreinfomodule.ForeignKeys[2]: // results_definition_more_info_module\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type MoreInfoModule\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "3254ed4207fe263dabc7ab89f294c65d", "score": "0.67957383", "text": "func (*Song) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullInt64{}, // name\n\t\t&sql.NullString{}, // phone\n\t\t&sql.NullInt64{}, // plays\n\t\t&sql.NullString{}, // gender\n\t}\n}", "title": "" }, { "docid": "4fbb3eb54402871d2692a233d29db28f", "score": "0.6790071", "text": "func (*BookBorrow) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // ADDED_TIME\n\t}\n}", "title": "" }, { "docid": "b0b11b843720b5c32362e53b4bc49c7c", "score": "0.6785203", "text": "func (*User) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullInt64{}, // age\n\t\t&sql.NullString{}, // email\n\t\t&sql.NullString{}, // password\n\t}\n}", "title": "" }, { "docid": "e185a98eca728421036d0e07a0e3769f", "score": "0.67715114", "text": "func (*Employee) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // User_id\n\t\t&sql.NullString{}, // Name\n\t\t&sql.NullString{}, // Tel\n\t\t&sql.NullString{}, // Email\n\t\t&sql.NullTime{}, // BirthdayDate\n\t\t&sql.NullTime{}, // AttendTime\n\t\t&sql.NullTime{}, // FinishTime\n\t}\n}", "title": "" }, { "docid": "8af0435314fe4661a20cfb353d8dbc37", "score": "0.6744794", "text": "func (*Product) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // description\n\t\t&sql.NullInt64{}, // cost\n\t\t&sql.NullBool{}, // is_active\n\t}\n}", "title": "" }, { "docid": "ac05085eba47e9d5754f841c5fa3537f", "score": "0.67426217", "text": "func (*CarCheckInOut) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // note\n\t\t&sql.NullString{}, // place\n\t\t&sql.NullInt64{}, // person\n\t\t&sql.NullFloat64{}, // distance\n\t\t&sql.NullTime{}, // checkIn\n\t\t&sql.NullTime{}, // checkOut\n\t}\n}", "title": "" }, { "docid": "17a0eae2fe32f50141d70498c55ee4e3", "score": "0.6741806", "text": "func (*Menu) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase menu.FieldHide:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase menu.FieldSort:\n\t\t\tvalues[i] = new(sql.NullInt64)\n\t\tcase menu.FieldID, menu.FieldCreatedBy, menu.FieldUpdatedBy, menu.FieldName, menu.FieldPath, menu.FieldIcon, menu.FieldParent:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase menu.FieldCreatedAt, menu.FieldUpdatedAt, menu.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type Menu\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "b110257d6bc0d7af8846e75bcb6b2717", "score": "0.6713752", "text": "func (*StepRun) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullString{}, // id\n\t\t&sql.NullTime{}, // created_at\n\t\t&sql.NullTime{}, // updated_at\n\t\t&sql.NullString{}, // status\n\t\t&sql.NullTime{}, // startedAt\n\t\t&sql.NullTime{}, // endedAt\n\t\t&sql.NullInt64{}, // index\n\t\t&sql.NullInt64{}, // participantsCount\n\t\t&sql.NullString{}, // hitID\n\t\t&sql.NullString{}, // urlToken\n\t}\n}", "title": "" }, { "docid": "44da4ec53a7cd8227b20062fbe3e536b", "score": "0.67095333", "text": "func (*DataRoom) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullFloat64{}, // price\n\t\t&sql.NullString{}, // roomnumber\n\t\t&sql.NullString{}, // roomdetail\n\t}\n}", "title": "" }, { "docid": "e1fe928ae6563e52dc2c3d97851f8341", "score": "0.6653719", "text": "func (*Contact) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullString{}, // name\n\t\t&sql.NullString{}, // value\n\t\t&sql.NullString{}, // kind\n\t\t&sql.NullBool{}, // principal\n\t\t&sql.NullBool{}, // validated\n\t\t&sql.NullBool{}, // fromAccount\n\t}\n}", "title": "" }, { "docid": "1e9744d92c5796837009ee5179848d56", "score": "0.6648158", "text": "func (*SysRoleMenu) scanValues(columns []string) ([]interface{}, error) {\n\tvalues := make([]interface{}, len(columns))\n\tfor i := range columns {\n\t\tswitch columns[i] {\n\t\tcase sysrolemenu.FieldIsDel:\n\t\t\tvalues[i] = new(sql.NullBool)\n\t\tcase sysrolemenu.FieldID, sysrolemenu.FieldRoleID, sysrolemenu.FieldMenuID, sysrolemenu.FieldActionID:\n\t\t\tvalues[i] = new(sql.NullString)\n\t\tcase sysrolemenu.FieldCreatedAt, sysrolemenu.FieldUpdatedAt, sysrolemenu.FieldDeletedAt:\n\t\t\tvalues[i] = new(sql.NullTime)\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unexpected column %q for type SysRoleMenu\", columns[i])\n\t\t}\n\t}\n\treturn values, nil\n}", "title": "" }, { "docid": "e9a5244610f3c82919cd5c5f0bd2b214", "score": "0.6646618", "text": "func (*Author) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // Name\n\t}\n}", "title": "" }, { "docid": "2d1bdf5c6ef917ee775619ae64d2fe10", "score": "0.66392493", "text": "func (*AlarmStatus) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // name\n\t}\n}", "title": "" }, { "docid": "24fca85b0e29fc5d7bc3bbe0c021f41a", "score": "0.66259456", "text": "func (*ExitPoint) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullString{}, // role\n\t\t&sql.NullString{}, // cid\n\t\t&[]byte{}, // condition\n\t}\n}", "title": "" }, { "docid": "6c71e323e916f68d11b737ce31bea3ac", "score": "0.66098416", "text": "func (*UserSettings) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullTime{}, // create_time\n\t\t&sql.NullTime{}, // update_time\n\t\t&sql.NullInt64{}, // newCardsPerDay\n\t}\n}", "title": "" }, { "docid": "9c805ddd87a2b6ccb66158bf7f1cbc7e", "score": "0.6595684", "text": "func (*ClubappStatus) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // clubstatus\n\t}\n}", "title": "" }, { "docid": "ac93b284c7343bee83faaed5a80bc08c", "score": "0.6591768", "text": "func (*Answer) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullTime{}, // at\n\t\t&[]byte{}, // responses\n\t\t&sql.NullBool{}, // valid\n\t}\n}", "title": "" }, { "docid": "68e6cfe0b5e818306dabb61834cecb6e", "score": "0.6564126", "text": "func (*Group) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // name\n\t}\n}", "title": "" }, { "docid": "8f2040342a1694dd9c312b3a58d7bdca", "score": "0.65554714", "text": "func (h *Handler) scan(q *sql.Rows, clen int, tfmt string) ([]string, error) {\n\tvar err error\n\n\t// scan to []interface{}\n\tr := make([]interface{}, clen)\n\tfor i := range r {\n\t\tr[i] = new(interface{})\n\t}\n\tif err = q.Scan(r...); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// get conversion funcs\n\tcb, cm, cs, cd := drivers.ConvertBytes(h.u), drivers.ConvertMap(h.u),\n\t\tdrivers.ConvertSlice(h.u), drivers.ConvertDefault(h.u)\n\n\trow := make([]string, clen)\n\tfor n, z := range r {\n\t\tj := z.(*interface{})\n\t\tswitch x := (*j).(type) {\n\t\tcase []byte:\n\t\t\tif x != nil {\n\t\t\t\trow[n], err = cb(x, tfmt)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase string:\n\t\t\trow[n] = x\n\n\t\tcase time.Time:\n\t\t\trow[n] = x.Format(tfmt)\n\n\t\tcase fmt.Stringer:\n\t\t\trow[n] = x.String()\n\n\t\tcase map[string]interface{}:\n\t\t\tif x != nil {\n\t\t\t\trow[n], err = cm(x)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase []interface{}:\n\t\t\tif x != nil {\n\t\t\t\trow[n], err = cs(x)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t\tif x != nil {\n\t\t\t\trow[n], err = cd(x)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn row, err\n}", "title": "" }, { "docid": "33128d1c2b556eeea77358c338d88ec3", "score": "0.6533843", "text": "func (*LineItem) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullInt64{}, // quantity\n\t}\n}", "title": "" }, { "docid": "5547ce81bd569bc3488cf33701855b6f", "score": "0.65099746", "text": "func (*Customer) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullTime{}, // created_at\n\t\t&sql.NullTime{}, // updated_at\n\t\t&sql.NullTime{}, // removed_at\n\t\t&sql.NullString{}, // address\n\t\t&sql.NullString{}, // phone\n\t}\n}", "title": "" }, { "docid": "db045144e244e1ec23072357596756dc", "score": "0.6503637", "text": "func (*File) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&uuid.UUID{}, // id\n\t\t&sql.NullString{}, // hash\n\t\t&sql.NullInt64{}, // size\n\t\t&sql.NullTime{}, // pinned_at\n\t\t&sql.NullTime{}, // unpinned_at\n\t\t&[]byte{}, // metadata\n\t}\n}", "title": "" }, { "docid": "3e8fdc35b54fa3ad5850ad6d254af600", "score": "0.64933336", "text": "func (*OutboundTransaction) scanValues() []interface{} {\n\treturn []interface{}{\n\t\t&sql.NullInt64{}, // id\n\t\t&sql.NullString{}, // channel\n\t\t&[]byte{}, // invoice\n\t\t&[]byte{}, // benefit\n\t\t&[]byte{}, // cost\n\t\t&sql.NullInt64{}, // amount\n\t}\n}", "title": "" } ]
56d054ce021287c96180e003f9916e6d
NewAccumulatorStore returns an initialized AccumulatorStore.
[ { "docid": "381ff0244eeff89a130782cb64a6c5b4", "score": "0.82720476", "text": "func NewAccumulatorStore() *AccumulatorStore {\n\treturn &AccumulatorStore{\n\t\tevMap: make(map[string][]wire.Event),\n\t}\n}", "title": "" } ]
[ { "docid": "e76a10d53d91c71ae9ba9273c72c8f0e", "score": "0.6606282", "text": "func NewAccumulator() (*Accumulator, error) {\n\taccum := &Accumulator{\n\t\thits: make(map[string]int),\n\t\ttransforms: make(map[string]string),\n\t\thashes: make(map[string]string),\n\t\tspdx: make(map[string]int),\n\t\tlomap: make(map[string]string),\n\t\tmatchTable: make(map[string]string),\n\t}\n\tif err := accum.loadAssets(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn accum, nil\n}", "title": "" }, { "docid": "f48b62a864a45b7a0947f48ecb993aba", "score": "0.6603155", "text": "func New(inmem bool) *Store {\n\treturn &Store{\n\t\tm: 0,\n\t\tinmem: inmem,\n\t\tlogger: log.New(os.Stderr, \"[store] \", log.LstdFlags),\n\t}\n}", "title": "" }, { "docid": "4b4110d414666dde54e8e0800a342752", "score": "0.65914714", "text": "func New() store.Store {\n\ts := &Store{\n\t\tconnected: true,\n\t}\n\treturn s\n}", "title": "" }, { "docid": "9a3f6ff499e7349c89fc523d3fb2ead3", "score": "0.65858424", "text": "func NewStore() *Store {\n\treturn &Store{}\n}", "title": "" }, { "docid": "9a3f6ff499e7349c89fc523d3fb2ead3", "score": "0.65858424", "text": "func NewStore() *Store {\n\treturn &Store{}\n}", "title": "" }, { "docid": "25493f8559f1268c5454e27c76ab3563", "score": "0.65790004", "text": "func NewStore(log *log.Logger, gql *graphql.GraphQL) *Store {\n\treturn &Store{\n\t\tlog: log,\n\t\tgql: gql,\n\t}\n}", "title": "" }, { "docid": "42eefb6a1badc0428c1a6ede7f2a130c", "score": "0.6563301", "text": "func New() *Store {\n\treturn &Store{\n\t\tm: map[string]*storeItem{},\n\t}\n}", "title": "" }, { "docid": "377910df7aeda224236e4e080268f961", "score": "0.6532629", "text": "func New() *Store {\n\treturn &Store{\n\t\tm: make(map[string]string),\n\t\tlogger: log.New(os.Stderr, \"[store] \", log.LstdFlags),\n\t}\n}", "title": "" }, { "docid": "ba6a11162039622d7d93788330f8efaf", "score": "0.6523482", "text": "func NewStore(db *cockroach.DB, logger *zap.Logger) *Store {\n\treturn &Store{\n\t\tdb: db,\n\t\tlogger: logger,\n\t\tclock: DefaultClock,\n\t}\n}", "title": "" }, { "docid": "b945b50c001f261c742643c3389ae44a", "score": "0.650318", "text": "func NewStore() *Store {\n\treturn &Store{snapshots: make(map[string]Snapshot)}\n}", "title": "" }, { "docid": "f16de4a8ffd95935be89ed9a674bd61a", "score": "0.6483334", "text": "func newStore() *store {\n\ts := store{\n\t\tserviceToConfigs: make(map[listeners.ID][]integration.Config),\n\t}\n\n\treturn &s\n}", "title": "" }, { "docid": "bf5c581baff72534835f70b60168ded4", "score": "0.64711815", "text": "func NewAccumulator(cfg *AccumulatorConfig) (*Accumulator, error) {\n\tc, err := chunk.NewForEncoding(chunk.Varbit)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ta := &Accumulator{\n\t\tchunks: []*chunkend{\n\t\t\t&chunkend{\n\t\t\t\tChunk: c,\n\t\t\t\tEnd: 0,\n\t\t\t},\n\t\t},\n\t\tmaxAge: cfg.MaxAge.Nanoseconds() / int64(time.Millisecond),\n\t}\n\treturn a, nil\n}", "title": "" }, { "docid": "906f801cb4b35d8d40f4f4c32659c2db", "score": "0.64596397", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tRootDir: \"testdata\",\n\t\tIndexFile: filepath.Join(\"testdata\", \"golden.files\"),\n\t\tskip: 3,\n\t}\n}", "title": "" }, { "docid": "88150fd5179490192ce7326c36301008", "score": "0.6420405", "text": "func New(root string) (*Store, error) {\n\treturn NewWithContext(context.Background(), root)\n}", "title": "" }, { "docid": "a1aa2d2de92b6f1f21a9f0ea0f69572a", "score": "0.63961047", "text": "func (Counter) NewStore(shard consumer.Shard, rec *recoverylog.Recorder) (consumer.Store, error) {\n\tvar rdb = store_rocksdb.NewStore(rec)\n\trdb.Cache = make(map[NGram]uint64)\n\treturn rdb, rdb.Open()\n}", "title": "" }, { "docid": "763a56992c14f10c97937d65b45f29a5", "score": "0.6393522", "text": "func NewStore(db *db.DB, log logger.Logger) *store {\n\treturn &store{db, log}\n}", "title": "" }, { "docid": "a547b64874aa588f17016f6aa1b9f9d8", "score": "0.6344296", "text": "func NewStore(cfg cfg.StoreCfg) (Store, error) {\n\tif cfg.Memory {\n\t\treturn newMemoryStore()\n\t}\n\n\t// TODO: need to implement\n\treturn nil, nil\n}", "title": "" }, { "docid": "f5468be67c286f58da5dbf7292ba70b3", "score": "0.63400626", "text": "func NewStore(sf StoreObjectFunc, actions ActionIndex) Store {\n\treturn Store{\n\t\to: sf(),\n\t\tactions: actions,\n\t}\n}", "title": "" }, { "docid": "8da521bfae890e04f2d0ccc4737cc767", "score": "0.6319255", "text": "func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *Store {\n\tstore := &Store{\n\t\tUntypedStore: configmap.NewUntypedStore(\n\t\t\t\"kourier\",\n\t\t\tlogger,\n\t\t\tconfigmap.Constructors{\n\t\t\t\tconfig.ConfigName: config.NewConfigFromConfigMap,\n\t\t\t\tnetwork.ConfigName: network.NewConfigFromConfigMap,\n\t\t\t},\n\t\t\tonAfterStore...,\n\t\t),\n\t}\n\treturn store\n}", "title": "" }, { "docid": "db87feb139b9d3ccbd6e18891d3a8746", "score": "0.6297949", "text": "func NewStore(ctx context.Context, db *sql.DB, apiKeyring keyring.Keyring, oc *oncall.Store) (*Store, error) {\n\treturn &Store{\n\t\tdb: db,\n\t\tkeys: apiKeyring,\n\t\toc: oc,\n\t}, nil\n}", "title": "" }, { "docid": "3e55124f3daed0592be50d4fd2662837", "score": "0.6293029", "text": "func NewStore(log *logger.Logger, db *sqlx.DB) *Store {\n\treturn &Store{\n\t\tlog: log,\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "b8891caf8511f07212336d5dd9f52fd6", "score": "0.62927896", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tdata: make(map[storeapi.Key]*storeapi.ExpiringValue),\n\t}\n}", "title": "" }, { "docid": "d61b5b6d6198427ac8576e030e9cb769", "score": "0.62793773", "text": "func New() *Store {\n\treturn &Store{refs: make(map[string]*ref)}\n}", "title": "" }, { "docid": "15d96d79fd0a737067942b675c57435c", "score": "0.6266349", "text": "func NewStore(writer, reader *sqlx.DB) Store {\n\treturn &storeImpl{writer, reader}\n}", "title": "" }, { "docid": "c8a0db37e0776645a5eb0536beba7568", "score": "0.6263236", "text": "func New() Store {\n\treturn Store{\n\t\ts: make(map[interface{}]interface{}),\n\t}\n}", "title": "" }, { "docid": "760bd71fd0536f22fcf04ccd48e38240", "score": "0.62514", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tOrigins: make(map[string]*Origin),\n\t}\n}", "title": "" }, { "docid": "c76f87467e886efbe7b71e2300820bbb", "score": "0.6251081", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tData: new(sync.Map),\n\t}\n}", "title": "" }, { "docid": "31a7e6a08f0dd80155ab969439ebc1b4", "score": "0.62495834", "text": "func New() *Store {\n\treturn &Store{data: make(map[string]interface{})}\n}", "title": "" }, { "docid": "6a19881b20251dbb0bb06044be707eab", "score": "0.6249136", "text": "func NewStore(bufferSize int) *Store {\n\t//nolint:gomnd // We want to have a guard here. And it's number 10. It's higher than 1 or 2 to allow for chained mode\n\tif bufferSize < 10 {\n\t\terr := fmt.Errorf(\"in-memory buffer size cannot be smaller than 10, currently %d, recommended at least 2000\", bufferSize)\n\t\tpanic(err)\n\t}\n\treturn &Store{\n\t\tstoreMtx: &sync.RWMutex{},\n\t\tstore: make([]*chain.Beacon, 0, bufferSize),\n\t\tbufferSize: bufferSize,\n\t}\n}", "title": "" }, { "docid": "725275e21aaafa0e7fb47f0f85850fe6", "score": "0.62431175", "text": "func NewStore(log *log.Logger, db *database.DB) Store {\n\treturn Store{\n\t\tlog: log,\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "a48338f24049dff084754d2838aca3c0", "score": "0.62357944", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tObserverList: []IObserver{},\n\t\tcount: 0,\n\t}\n}", "title": "" }, { "docid": "e16bb02beacf7f30500d86ea2c7d8820", "score": "0.6233175", "text": "func NewStore(query *skydba.Q) *Store {\n\tstore := Store{}\n\tstore.q = query\n\treturn &store\n}", "title": "" }, { "docid": "3f2861f4de3fed991a9cc6d6178ccf4a", "score": "0.621834", "text": "func NewStore() (store.Store, error) {\n\tstoreName := os.Getenv(\"AUDITOR_STORE\")\n\tswitch storeName {\n\tcase \"mongodb\":\n\t\treturn mongodb.New()\n\tcase \"dynamodb\":\n\t\treturn dynamodb.New()\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"Unknown store: %v\", storeName)\n\t}\n}", "title": "" }, { "docid": "6ca3b2645e24ce100c3e1903aac17b57", "score": "0.62029976", "text": "func NewStore(db dbutil.DB, clock func() time.Time) *Store {\n\treturn &Store{\n\t\tdb: db,\n\t\tclock: clock,\n\t}\n}", "title": "" }, { "docid": "23312b278fdebe976674a5dfef7f0043", "score": "0.62007594", "text": "func NewAccumulator(g int) Accumulator {\n\ta := Accumulator{groupSize: g, groupIndex: 0, groupings: map[string]int{}, tokenGroups: []TokenGroup{}}\n\n\tfor i := 0; i < g; i++ {\n\t\ta.tokenGroups = append(a.tokenGroups, TokenGroup{})\n\t}\n\n\treturn a\n}", "title": "" }, { "docid": "512dd4095c91b5810b51669ddbe3f30f", "score": "0.62000275", "text": "func NewStore(encryptor Encryptor, logger gologger.Logger) session.Store {\n\treturn &store{\n\t\tencryptor: encryptor,\n\t\tlogging: logger,\n\t}\n}", "title": "" }, { "docid": "5cf69a8852bb0acff5c7767176a4b215", "score": "0.61832106", "text": "func New(dbtx DBTX) *Store {\n\treturn &Store{dbtx: dbtx}\n}", "title": "" }, { "docid": "2291c5b9a03d2d8ea517ca24bd0d5ec3", "score": "0.6178717", "text": "func NewStore(db *sqlx.DB, logger hclog.Logger) *Store {\n\treturn &Store{\n\t\tdb: db,\n\t\tlogger: logger,\n\t}\n}", "title": "" }, { "docid": "bbdc56277470a40dd4a26e2a09522569", "score": "0.6171581", "text": "func New() *Store {\n\treturn &Store{\n\t\tuserAnimeLists: make(map[string]*data.UserAnimeList),\n\t\tanimeSearchResults: make([]*data.AnimeSearchResult, 0),\n\t\tanime: make(map[int]*data.Anime),\n\t}\n}", "title": "" }, { "docid": "492cef5d22db2e170f2fac37af3b5e84", "score": "0.61631304", "text": "func NewStore(driver StoreDriver) *Store {\n\treturn &Store{\n\t\tAuthorizedTokens: []string{},\n\t\tDriver: driver,\n\t}\n}", "title": "" }, { "docid": "49aa156ce7f3a7eb4d6b21f6a8802198", "score": "0.6162107", "text": "func New(db *sqlx.DB) *Store {\n\ts := Store{\n\t\tdb: db,\n\t}\n\n\treturn &s\n}", "title": "" }, { "docid": "1bce02d2c2f3a9a31cac88f86499cc41", "score": "0.61606026", "text": "func NewStore(engine *Engine) *Store {\n\t// Allocate an index for this store and allocate some internal data to go with\n\t// the store.\n\tgStoreLock.Lock()\n\tidx := gStoreSlab.allocate()\n\tgStoreMap[idx] = &storeData{engine: engine}\n\tgStoreLock.Unlock()\n\n\tptr := C.go_store_new(engine.ptr(), C.size_t(idx))\n\tstore := &Store{\n\t\t_ptr: ptr,\n\t\tEngine: engine,\n\t}\n\truntime.SetFinalizer(store, func(store *Store) {\n\t\tC.wasmtime_store_delete(store._ptr)\n\t})\n\treturn store\n}", "title": "" }, { "docid": "a12d6d35bb3c8251ceafe29b2ddfe3d6", "score": "0.61527824", "text": "func NewStore(db *sql.DB) *Store {\n\treturn &Store{\n\t\tQueries: New(db),\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "9af30f446b7b8061aa833f0b532572b5", "score": "0.61522454", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tgroups: map[string]*chat.Group{\n\t\t\t// TODO: Insert fixture data?\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8f201a158bb2ec8d85fa573d4d657de8", "score": "0.6136943", "text": "func New(logLevel int) *Store {\n\treturn &Store{\n\t\tlogger: logging.New(logLevel),\n\t\tdata: treemap.New(store.KeyCmp),\n\t\tsize: 0,\n\t}\n}", "title": "" }, { "docid": "bce64ea5f5902c51982cbdbcbe3c39ec", "score": "0.6132007", "text": "func NewStore(db *db.DB, logger logger.Logger, hash func(string) (string, error)) *store {\n\treturn &store{\n\t\tdb, logger, hash,\n\t}\n}", "title": "" }, { "docid": "4f40da8f20a0c928845007ba2f2ea387", "score": "0.61261517", "text": "func NewStore(logger configmap.Logger, onAfterStore ...func(name string, value interface{})) *CCStore {\n\tstore := &CCStore{\n\t\tUntypedStore: configmap.NewUntypedStore(\n\t\t\t\"defaults\",\n\t\t\tlogger,\n\t\t\tconfigmap.Constructors{\n\t\t\t\tGetDefaultsConfigName(): NewDefaultsFromConfigMap,\n\t\t\t},\n\t\t\tonAfterStore...,\n\t\t),\n\t}\n\n\treturn store\n}", "title": "" }, { "docid": "41466fedc2d72056c432f132b457bd78", "score": "0.61239547", "text": "func NewStore(st db.Store) {\n\tstore = st\n}", "title": "" }, { "docid": "aff8670b611f4e75d9e5ba8a19934554", "score": "0.6122163", "text": "func NewStore(opts StoreOpts) *Store {\n\treturn &Store{opts: opts}\n}", "title": "" }, { "docid": "0366cbe0555d2cc5b50dde4a808fa013", "score": "0.61182296", "text": "func (c *compiledSyncBase[N, Storage, Methods]) NewAccumulator(kvs attribute.Set) Accumulator {\n\tsc := &syncAccumulator[N, Storage, Methods]{}\n\tc.initStorage(&sc.current)\n\tc.initStorage(&sc.snapshot)\n\n\tsc.holder = c.findStorage(kvs)\n\treturn sc\n}", "title": "" }, { "docid": "12525def7387e9aa7c5d7fd6538d22eb", "score": "0.61127764", "text": "func NewStore(ctx context.Context) *Store {\n\treturn &Store{\n\t\tctx: ctx,\n\t\tservices: make(map[string]Service),\n\t\tmessages: make(map[string]Property),\n\t}\n}", "title": "" }, { "docid": "0f1810c04344f5bb5b3e776b5b74e201", "score": "0.60867244", "text": "func NewStore(user, goal, task *mgo.Collection) *Store {\n\treturn &Store{\n\t\tuserCollection: user,\n\t\tgoalCollection: goal,\n\t\tachievableCollection: task,\n\t}\n}", "title": "" }, { "docid": "706e4e23059447e514b289d91ae3fc7b", "score": "0.6077425", "text": "func NewStore(api plugin.API) (Store, error) {\n\tstore := Store{\n\t\tapi: api,\n\t}\n\treturn store, nil\n}", "title": "" }, { "docid": "22bd16eb4de2ea8e6d14aaa7a640e2a8", "score": "0.6074156", "text": "func New(root string, upstream string) Store {\n\treturn newLocalStore(root, upstream)\n}", "title": "" }, { "docid": "55aa72f4d4832844bd56f055b817a757", "score": "0.6064863", "text": "func NewStore(db *sqlx.DB) *Store {\n\treturn &Store{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "c5e50fb24485ef68b2fe1c2e3d7683a4", "score": "0.60606456", "text": "func NewStore(db *sqlx.DB) *Store {\n\treturn &Store{db}\n}", "title": "" }, { "docid": "2d32c991eab91029d325cc7b0e0ca72c", "score": "0.60605335", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tsessions: make(map[string]*Session),\n\t\tprofiles: make(map[string]*Profile),\n\t\tfriends: []*Friends{},\n\t\taskFriends: make(map[string]*AskFriends),\n\t}\n}", "title": "" }, { "docid": "2247257247b7fd5a029f17e610fce7bc", "score": "0.6057436", "text": "func NewStore() *Store {\n\tdir, err := os.Getwd()\n\tif err != nil {\n\t\tlogger.Sugar.Fatalf(\"Can get workdir %v\", err)\n\t\tos.Exit(1)\n\t}\n\n\tdb, err := leveldb.OpenFile(dir+\"/database\", nil)\n\tif err != nil {\n\t\tlogger.Sugar.Fatalf(\"Unable to create database directory %v\", err)\n\t\tos.Exit(1)\n\t}\n\n\treturn &Store{\n\t\tdb: db,\n\t}\n}", "title": "" }, { "docid": "bb65002126dce52a8cabcf2db38beee8", "score": "0.60262173", "text": "func New(sess *session.Session) *Store {\n\ts := &Store{\n\t\tsess: sess,\n\t\tbuckets: make(map[string]*Bucket),\n\t}\n\ts.cond = ctxsync.NewCond(&s.mu)\n\treturn s\n}", "title": "" }, { "docid": "620da3384b0f5216dfcbd10aad598ef6", "score": "0.6023574", "text": "func New() *Store {\n\treturn &Store{\n\t\ttblobs: make(map[bs.Ref]tblob),\n\t\tanchors: make(map[string][]timeref),\n\t}\n}", "title": "" }, { "docid": "3efd00896304b8342c86bd6c7cf8dc80", "score": "0.6018192", "text": "func NewStore() *Store {\n\treturn &Store{Store: dbadapter.Store{DB: dbm.NewMemDB()}}\n}", "title": "" }, { "docid": "b78ef67aa7501b177bdd56c0ada90b20", "score": "0.60106003", "text": "func NewStore(reader, writer *gorm.DB) Store {\n\treturn &storeImpl{reader, writer}\n}", "title": "" }, { "docid": "6271d6bb24499cb5df8fbf1687aefcf3", "score": "0.6006985", "text": "func New(logger logger.Logger) state.Store {\n\tdba := newCockroachDBAccess(logger)\n\n\treturn internalNew(logger, dba)\n}", "title": "" }, { "docid": "5dd83f0fb67700d76663f2f42da8ab89", "score": "0.60052085", "text": "func New(p storage.Provider) (*Store, error) {\n\tstore, err := p.OpenStore(storeName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open store : %w\", err)\n\t}\n\n\treturn &Store{Store: store}, nil\n}", "title": "" }, { "docid": "673169badf30588a2e5b58f32d385d29", "score": "0.6004925", "text": "func NewStore(ds *datastore.Client, ignoredAttr []string) *Store {\n\tignored := []string{}\n\tignored = append(ignored, ignoredAttr...)\n\tignored = append(ignored, alerts.STATE, ID, ASSIGNED_TO)\n\treturn &Store{\n\t\tignoredAttr: ignored,\n\t\tds: ds,\n\t\talertArrivalLatency: metrics2.GetFloat64SummaryMetric(\"alert_manager_store_alert_arrival_latency\"),\n\t}\n}", "title": "" }, { "docid": "607588de583ffe4824047dd00aae4ede", "score": "0.6003632", "text": "func New(id int64) *Store {\n\treturn &Store{\n\t\tid:\t\tid,\n\t\tm: make(map[string]string),\n leaderCh: make(chan bool, 1),\n reconcileCh: make(chan *member.ClusterMember, 32),\n reconcileInterval: time.Second * 5,\n\t\tlogger: log.New(os.Stderr, \"[hraftd-store] \", log.LstdFlags),\n\t}\n}", "title": "" }, { "docid": "1b473e2091fbbaf559ce8f423c6596d5", "score": "0.59880775", "text": "func newStore () (*store, error) {\n\tracks, racksManager := cart.New ()\n\tstre := &store {\n\t\tracks: racks,\n\t\tracksManager: racksManager,\n\t\tnewMssg: false,\n\t}\n\treturn stre, nil\n}", "title": "" }, { "docid": "7e27ef99be4b145953f49fc1fb84a1e7", "score": "0.5985111", "text": "func newStore(c *Config, httpAddr, raftAddr string) *store {\n\ts := store{\n\t\tdata: &Data{\n\t\t\tData: &meta.Data{\n\t\t\t\tIndex: 1,\n\t\t\t},\n\t\t},\n\t\tclosing: make(chan struct{}),\n\t\tdataChanged: make(chan struct{}),\n\t\tpath: c.Dir,\n\t\tconfig: c,\n\t\thttpAddr: httpAddr,\n\t\traftAddr: raftAddr,\n\t}\n\tif c.LoggingEnabled {\n\t\ts.logger = log.New(os.Stderr, \"[metastore] \", log.LstdFlags)\n\t} else {\n\t\ts.logger = log.New(ioutil.Discard, \"\", 0)\n\t}\n\n\tfunc() ([]byte, error) {\n\t\treturn bcrypt.GenerateFromPassword(nil, 1)\n\t}()\n\n\treturn &s\n}", "title": "" }, { "docid": "8c59351853be50bd0136d79e0c98ea89", "score": "0.59700537", "text": "func NewStore(src, dst value.Value) *InstStore {\n\treturn &InstStore{\n\t\tSrc: src,\n\t\tDst: dst,\n\t\tMetadata: make(map[string]*metadata.Metadata),\n\t}\n}", "title": "" }, { "docid": "b82eca82f30135f2ba3e1382bb75d49a", "score": "0.59645855", "text": "func New(rootDir string) (Store, error) {\n\ts := &store{\n\t\troot: rootDir,\n\t}\n\n\tm := filepath.Join(s.root, contextsDir, metadataDir)\n\tif err := createDirIfNotExist(m); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn s, nil\n}", "title": "" }, { "docid": "0b2120c38bf21e89233d28df73eed9eb", "score": "0.5957037", "text": "func New(engine *xorm.Engine) (*store, error) {\n\treturn &store{Engine: engine}, nil\n}", "title": "" }, { "docid": "d5b64d3957a7ae5ca5e7afc0c0098557", "score": "0.5947694", "text": "func NewStore(db *dbstore.DB) core.ExperimentStore {\n\tdb.AutoMigrate(&core.ArchiveExperiment{})\n\n\treturn &experimentStore{db}\n}", "title": "" }, { "docid": "a96016778c40bf5aa69f02977defb782", "score": "0.5934899", "text": "func NewStore(name string) Storage {\n\tregistry.RLock()\n\tf, ok := registry.factories[name]\n\tregistry.RUnlock()\n\n\tif !ok {\n\t\treturn nil\n\t}\n\treturn f.New()\n}", "title": "" }, { "docid": "9d9774dfff475d01556962bfa689a7d5", "score": "0.5918838", "text": "func New() storage.Store {\n\treturn &store{\n\t\tdata: map[string]interface{}{},\n\t\ttriggers: map[*handle]storage.TriggerConfig{},\n\t\tpolicies: map[string][]byte{},\n\t}\n}", "title": "" }, { "docid": "c184df4c9e0bb83c62f244d7e3620f43", "score": "0.59098214", "text": "func NewStore(key string) *Store {\n\treturn &Store{\n\t\tkey: key,\n\t\tm: make(map[string][]byte),\n\t}\n}", "title": "" }, { "docid": "e09f96f935be4a9c17d4496672909c46", "score": "0.5905448", "text": "func New(capacity int64, store chainstore.Store) chainstore.Store {\n\treturn newLruManager(capacity, store)\n}", "title": "" }, { "docid": "7c00549eb4584acd4b7bb04e26052bb6", "score": "0.58959", "text": "func NewStore(ctx context.Context, db *sql.DB) (*Store, error) {\n\tp := &util.Prepare{DB: db, Ctx: ctx}\n\treturn &Store{\n\t\tdb: db,\n\t\tfindServicesByPolicyID: p.P(`\n\t\t\tSELECT COUNT(*)\n\t\t\tFROM services\n\t\t\tWHERE escalation_policy_id = $1\n\t\t`),\n\t\tfindPolicyDurationMinutes: p.P(`\n\t\t\tSELECT coalesce(SUM(s.delay*(e.repeat+1)), 0)\n\t\t \tFROM escalation_policy_steps s join escalation_policies e\n\t\t \t\tON s.escalation_policy_id= e.id \n\t\t\tWHERE s.escalation_policy_id=$1\n\t\t`),\n\t}, p.Err\n}", "title": "" }, { "docid": "e7926b9d8f4327d4fad1635794299aec", "score": "0.5890332", "text": "func New(dir string) (*Store, error) {\n\tstore := Store{Dir: dir}\n\terr := os.MkdirAll(store.Dir, 0755)\n\tif err != nil {\n\t\treturn &store, err\n\t}\n\treturn &store, nil\n}", "title": "" }, { "docid": "58dbf94af2ebb838dbe38c0fa5918a4d", "score": "0.588255", "text": "func New(opts ...Option) (*Store, error) {\n\tvar s Store\n\n\tif err := WithDefaults().Apply(&s); err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, opt := range opts {\n\t\tif err := opt.Apply(&s); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn &s, nil\n}", "title": "" }, { "docid": "daaf6db659ee0c1e96f91cb38b469397", "score": "0.5878497", "text": "func New(s storage.Storer, r retrieval.Interface, logger logging.Logger) storage.Storer {\n\treturn &store{Storer: s, retrieval: r, logger: logger}\n}", "title": "" }, { "docid": "ce241ab499d6136b83aa5c020ddf514b", "score": "0.58726245", "text": "func New(opts ...Option) wtypes.Store {\n\toptions := options{\n\t\tlocation: defaultLocation(),\n\t}\n\tfor _, o := range opts {\n\t\to.apply(&options)\n\t}\n\n\treturn &Store{\n\t\tlocation: options.location,\n\t\tpassphrase: options.passphrase,\n\t}\n}", "title": "" }, { "docid": "a84797131070681e76557b2bb78950b7", "score": "0.5871479", "text": "func New(fs embed.FS) *Store {\n\treturn &Store{\n\t\tfs: fs,\n\t}\n}", "title": "" }, { "docid": "79bf9de446b465d0402e83e5ed5f1c44", "score": "0.585972", "text": "func (p *App) NewStore(_ consumer.Shard, rec *recoverylog.Recorder) (consumer.Store, error) {\n\treturn consumer.NewJSONFileStore(rec, new(struct{}))\n}", "title": "" }, { "docid": "252dd154261f60e8a9dbf59baae515cb", "score": "0.58536536", "text": "func NewStore() *Store {\n\treturn &Store{\n\t\tplugins: make(map[string]*v2.Plugin),\n\t\tspecOpts: make(map[string][]SpecOpt),\n\t\thandlers: make(map[string][]func(string, *plugins.Client)),\n\t}\n}", "title": "" }, { "docid": "f310446d3a052dd2e94c764b73aa6469", "score": "0.5847989", "text": "func NewStore(root string) Store {\n\treturn &fsStore{root: root}\n}", "title": "" }, { "docid": "1949bc8838d62871e351d7ad596f9713", "score": "0.5847494", "text": "func NewStore(conn *db.Connection, authManager authManager, opts ...func(s *Store)) *Store {\n\ts := &Store{db: conn, auth: authManager}\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\treturn s\n}", "title": "" }, { "docid": "bfcd9be5017f370f43966a80d53f95bf", "score": "0.5846412", "text": "func NewWithStore(store store.KVStore) AppStore {\n\treturn &DefaultAppStore{store: store}\n}", "title": "" }, { "docid": "65a926b6973c256aa95808e6120e34e2", "score": "0.5844319", "text": "func NewStore(db *sql.DB) Store {\r\n\treturn &SQLStore{\r\n\t\tdb: db,\r\n\t\tQueries: New(db),\r\n\t}\r\n}", "title": "" }, { "docid": "8a8d0b74db7dc43d8674ff8a2c33ebe0", "score": "0.58434016", "text": "func NewStore(cfg Cfg, opts ...Option) Store {\n\ts := &store{\n\t\tmeta: &containerAdapter{},\n\t}\n\n\ts.cfg = cfg\n\ts.meta.meta.ShardAddr = s.cfg.RaftAddr\n\ts.meta.meta.RPCAddr = s.cfg.RPCAddr\n\n\ts.opts = &options{}\n\tfor _, opt := range opts {\n\t\topt(s.opts)\n\t}\n\ts.opts.adjust()\n\n\ts.snapshotManager = s.opts.snapshotManager\n\tif s.snapshotManager == nil {\n\t\ts.snapshotManager = newDefaultSnapshotManager(s)\n\t}\n\n\ts.trans = s.opts.trans\n\tif s.trans == nil {\n\t\ts.trans = newTransport(s)\n\t}\n\n\ts.rpc = s.opts.rpc\n\tif s.rpc == nil {\n\t\ts.rpc = newRPC(s)\n\t}\n\n\tif s.opts.shardStateAware == nil {\n\t\ts.opts.shardStateAware = s\n\t}\n\n\ts.readHandlers = make(map[uint64]ReadCommandFunc)\n\ts.writeHandlers = make(map[uint64]WriteCommandFunc)\n\ts.localHandlers = make(map[uint64]LocalCommandFunc)\n\ts.runner = task.NewRunner()\n\ts.initWorkers()\n\treturn s\n}", "title": "" }, { "docid": "c82210a4896d454f1ed38b6cf6558926", "score": "0.5840757", "text": "func New(raftDir string, raftBind string, inmem bool) *Store {\n\treturn &Store{\n\t\tRaftDir: \traftDir,\n\t\tRaftBind: \traftBind,\n\t\tm:\t\t\tmake(map[string]string),\n\t\tinmem:\t\tinmem,\n\t\tlogger: \tlog.New(os.Stderr, \"[store] \", log.LstdFlags),\n\t}\n}", "title": "" }, { "docid": "102c0d7d62046b7a93ce76dbbe26fe56", "score": "0.58385223", "text": "func New() *ObjectStore {\n\treturn &ObjectStore{\n\t\tobjectToID: make(map[uintptr]string),\n\t\tidToObject: make(map[string]reflect.Value),\n\t}\n}", "title": "" }, { "docid": "bb6c3d182ebd3116feac2e4cccc2db96", "score": "0.5830603", "text": "func NewStore(tableName string) Store {\n\treturn Store{TableName: tableName}\n}", "title": "" }, { "docid": "ab28d9b660f0f8e30c38340a75ca9ded", "score": "0.58273196", "text": "func NewStore(db *sql.DB) Store {\n\treturn &SQLStore{\n\t\tdb: db,\n\t\tQueries: New(db),\n\t}\n}", "title": "" }, { "docid": "53abb760ac85746c4fe80875df4c59eb", "score": "0.5816191", "text": "func NewStore(db *sql.DB) Store {\n\treturn &SQLStore {\n\t\tdb: db,\n\t\tQueries: New(db),\n\t}\n}", "title": "" }, { "docid": "d36c82bf7832cc215cefe577178d05b6", "score": "0.58152765", "text": "func New(config *exeggutor.Config) (AppStore, error) {\n\tstore, err := store.NewMdbStore(config.DataDirectory + \"/apps\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DefaultAppStore{store: store}, nil\n}", "title": "" }, { "docid": "d5f78e8bd02b4ff1416ab8a9d6236719", "score": "0.58098215", "text": "func NewStore(parent types.KVStore, parentStoreKey types.StoreKey, listener *types.MemoryListener) *Store {\n\treturn &Store{parent: parent, listener: listener, parentStoreKey: parentStoreKey}\n}", "title": "" }, { "docid": "9cc7b04e0dc2ff4612dbecd3ad5ebd02", "score": "0.5804344", "text": "func New(provider storage.Provider) (*Store, error) {\n\tstore, err := provider.OpenStore(storeName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open anchor link store: %w\", err)\n\t}\n\n\terr = provider.SetStoreConfig(storeName, storage.StoreConfiguration{TagNames: []string{hashTag}})\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\tmarshal: json.Marshal,\n\t\tunmarshal: json.Unmarshal,\n\t}, nil\n}", "title": "" }, { "docid": "54a0ad3c5d9b7c41945e57e218abdf35", "score": "0.580249", "text": "func New(raftDir, raftBind string) Store {\n\treturn &store{\n\t\tq: ds.NewQuadTree(quadTreeHeight),\n\t\tlogger: log.New(os.Stderr, \"[store] \", log.LstdFlags),\n\t\traftDir: raftDir,\n\t\traftBind: raftBind,\n\t}\n}", "title": "" }, { "docid": "8406790c626d771b15c16d42fefb98a7", "score": "0.5797972", "text": "func NewStore(db *pgxpool.Pool) Store {\n\treturn Store{db: db}\n}", "title": "" }, { "docid": "290052b519109f7f419f1a58b6cec118", "score": "0.5781351", "text": "func NewStore(cmClient corev1client.ConfigMapsGetter, sClient corev1client.SecretsGetter) *Store {\n\treturn &Store{\n\t\tcmClient: cmClient,\n\t\tsClient: sClient,\n\t\tTLSAssets: make(map[TLSAssetKey]TLSAsset),\n\t\tTokenAssets: make(map[string]Token),\n\t\tBasicAuthAssets: make(map[string]BasicAuthCredentials),\n\t\tOAuth2Assets: make(map[string]OAuth2Credentials),\n\t\tSigV4Assets: make(map[string]SigV4Credentials),\n\t\tobjStore: cache.NewStore(assetKeyFunc),\n\t}\n}", "title": "" } ]
2b4f11d3b79267c3b5a4f5be9cf2610d
maybeAddTLSForDestinationRule fills the DestinationRule template if the mTLS is turned on globally.
[ { "docid": "feedcc2dbf236692123488e1e553ea85", "score": "0.8228108", "text": "func maybeAddTLSForDestinationRule(tc *testConfig, templateFile string) string {\n\toutYaml, _ := util.CreateAndFill(tc.Info.TempDir, templateFile, map[string]string{\n\t\t\"globalMTlsEnable\": strconv.FormatBool(tc.Kube.AuthEnabled),\n\t})\n\treturn outYaml\n}", "title": "" } ]
[ { "docid": "6736dbfbc4d656e2cf6eb1300d1b6dbb", "score": "0.5887679", "text": "func TestDestinationRuleTls(t *testing.T) {\n\tframework.\n\t\tNewTest(t).\n\t\tFeatures(\"security.egress.tls.filebased\").\n\t\tRun(func(t framework.TestContext) {\n\t\t\tns := appNS\n\n\t\t\t// Setup our destination rule, enforcing TLS to \"server\". These certs will be created/mounted below.\n\t\t\tt.ConfigIstio().YAML(ns.Name(), `\napiVersion: networking.istio.io/v1alpha3\nkind: DestinationRule\nmetadata:\n name: db-mtls\nspec:\n exportTo: [\".\"]\n host: server\n trafficPolicy:\n tls:\n mode: MUTUAL\n clientCertificate: /etc/certs/custom/cert-chain.pem\n privateKey: /etc/certs/custom/key.pem\n caCertificates: /etc/certs/custom/root-cert.pem\n`).ApplyOrFail(t)\n\n\t\t\tfor _, portName := range []string{\"grpc\", \"http\", \"tcp\"} {\n\t\t\t\tportName := portName\n\t\t\t\tt.NewSubTest(portName).Run(func(t framework.TestContext) {\n\t\t\t\t\topts := echo.CallOptions{\n\t\t\t\t\t\tTo: server,\n\t\t\t\t\t\tCount: 1,\n\t\t\t\t\t\tPort: echo.Port{\n\t\t\t\t\t\t\tName: portName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tCheck: check.OK(),\n\t\t\t\t\t}\n\t\t\t\t\tif portName == \"tcp\" {\n\t\t\t\t\t\topts.Scheme = scheme.TCP\n\t\t\t\t\t}\n\t\t\t\t\tclient[0].CallOrFail(t, opts)\n\t\t\t\t})\n\t\t\t}\n\t\t})\n}", "title": "" }, { "docid": "a55daea0088e8b24d108fb59c9fcb872", "score": "0.57329124", "text": "func TestDestinationRuleTLS(t *testing.T) {\n\tframework.\n\t\tNewTest(t).\n\t\tRun(func(ctx framework.TestContext) {\n\t\t\tns := namespace.NewOrFail(t, ctx, namespace.Config{\n\t\t\t\tPrefix: \"tls\",\n\t\t\t\tInject: true,\n\t\t\t})\n\n\t\t\t// Setup our destination rule, enforcing TLS to \"server\". These certs will be created/mounted below.\n\t\t\tctx.ApplyConfigOrFail(t, ns.Name(), `\napiVersion: networking.istio.io/v1alpha3\nkind: DestinationRule\nmetadata:\n name: db-mtls\nspec:\n exportTo: [\".\"]\n host: server\n trafficPolicy:\n tls:\n mode: MUTUAL\n clientCertificate: /etc/certs/custom/cert-chain.pem\n privateKey: /etc/certs/custom/key.pem\n caCertificates: /etc/certs/custom/root-cert.pem\n`)\n\n\t\t\tvar client, server echo.Instance\n\t\t\techoboot.NewBuilderOrFail(t, ctx).\n\t\t\t\tWith(&client, echo.Config{\n\t\t\t\t\tService: \"client\",\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tPorts: []echo.Port{},\n\t\t\t\t\tPilot: p,\n\t\t\t\t\tSubsets: []echo.SubsetConfig{{\n\t\t\t\t\t\tVersion: \"v1\",\n\t\t\t\t\t\t// Set up custom annotations to mount the certs. We will re-use the configmap created by \"server\"\n\t\t\t\t\t\t// so that we don't need to manage it ourselves.\n\t\t\t\t\t\t// The paths here match the destination rule above\n\t\t\t\t\t\tAnnotations: echo.NewAnnotations().\n\t\t\t\t\t\t\tSet(echo.SidecarVolume, `{\"custom-certs\":{\"configMap\":{\"name\":\"server-certs\"}}}`).\n\t\t\t\t\t\t\tSet(echo.SidecarVolumeMount, `{\"custom-certs\":{\"mountPath\":\"/etc/certs/custom\"}}`),\n\t\t\t\t\t}},\n\t\t\t\t}).\n\t\t\t\tWith(&server, echo.Config{\n\t\t\t\t\tService: \"server\",\n\t\t\t\t\tNamespace: ns,\n\t\t\t\t\tPorts: []echo.Port{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"grpc\",\n\t\t\t\t\t\t\tProtocol: protocol.GRPC,\n\t\t\t\t\t\t\tInstancePort: 8090,\n\t\t\t\t\t\t\tTLS: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"http\",\n\t\t\t\t\t\t\tProtocol: protocol.HTTP,\n\t\t\t\t\t\t\tInstancePort: 8091,\n\t\t\t\t\t\t\tTLS: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"tcp\",\n\t\t\t\t\t\t\tProtocol: protocol.TCP,\n\t\t\t\t\t\t\tInstancePort: 8092,\n\t\t\t\t\t\t\tTLS: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tPilot: p,\n\t\t\t\t\t// Set up TLS certs on the server. This will make the server listen with these credentials.\n\t\t\t\t\tTLSSettings: &common.TLSSettings{\n\t\t\t\t\t\tRootCert: mustReadFile(t, \"root-cert.pem\"),\n\t\t\t\t\t\tClientCert: mustReadFile(t, \"cert-chain.pem\"),\n\t\t\t\t\t\tKey: mustReadFile(t, \"key.pem\"),\n\t\t\t\t\t\t// Override hostname to match the SAN in the cert we are using\n\t\t\t\t\t\tHostname: \"server.default.svc\",\n\t\t\t\t\t},\n\t\t\t\t\t// Do not inject, as we are testing non-Istio TLS here\n\t\t\t\t\tSubsets: []echo.SubsetConfig{{\n\t\t\t\t\t\tVersion: \"v1\",\n\t\t\t\t\t\tAnnotations: echo.NewAnnotations().SetBool(echo.SidecarInject, false),\n\t\t\t\t\t}},\n\t\t\t\t}).\n\t\t\t\tBuildOrFail(t)\n\n\t\t\tfor _, tt := range []string{\"grpc\", \"http\", \"tcp\"} {\n\t\t\t\tctx.NewSubTest(tt).Run(func(ctx framework.TestContext) {\n\t\t\t\t\tretry.UntilSuccessOrFail(ctx, func() error {\n\t\t\t\t\t\topts := echo.CallOptions{\n\t\t\t\t\t\t\tTarget: server,\n\t\t\t\t\t\t\tPortName: tt,\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif tt == \"tcp\" {\n\t\t\t\t\t\t\topts.Scheme = scheme.TCP\n\t\t\t\t\t\t}\n\t\t\t\t\t\tresp, err := client.Call(opts)\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\t\t\t\t\t\treturn resp.CheckOK()\n\t\t\t\t\t}, retry.Delay(time.Millisecond*100))\n\t\t\t\t})\n\t\t\t}\n\t\t})\n}", "title": "" }, { "docid": "fba0f8cd459b1102cd67200995ab897c", "score": "0.51942277", "text": "func newTLSConfigIfEmpty(tlsConfig *tls.Config) *tls.Config {\n\tif tlsConfig != nil {\n\t\treturn tlsConfig\n\t}\n\treturn &tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\t// Prioritize cipher suites sped up by AES-NI (AES-GCM)\n\t\tCipherSuites: []uint16{\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,\n\t\t\ttls.TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,\n\t\t},\n\t\tPreferServerCipherSuites: true,\n\t\t// Use curves which have assembly implementations\n\t\tCurvePreferences: []tls.CurveID{\n\t\t\ttls.X25519,\n\t\t\ttls.CurveP256,\n\t\t},\n\t\t// HTTP/2 must be enabled manually when using http.Serve\n\t\tNextProtos: []string{\"h2\", \"http/1.1\"},\n\t}\n}", "title": "" }, { "docid": "5cfacc07657a8305690fed18111fd9ec", "score": "0.5169133", "text": "func (h *Handler) NeedsTLS() bool {\n\treturn true\n}", "title": "" }, { "docid": "18f57671623d7e58a76f4b1462107213", "score": "0.51596", "text": "func (h *Handler) NeedsTLS() bool {\n\treturn false\n}", "title": "" }, { "docid": "f6184cbdd31459e06e38cc8d9a586bff", "score": "0.51571816", "text": "func NATSOptTLS(tlsConfig *tls.Config) NATSOption {\n\treturn func(n *natsPubSub) {\n\t\tn.tlsConfig = tlsConfig\n\t}\n}", "title": "" }, { "docid": "072b716e5887272a10a61df4029534b1", "score": "0.5135387", "text": "func validateTLS(route *routeapi.Route, fldPath *field.Path) field.ErrorList {\n\tresult := field.ErrorList{}\n\ttls := route.Spec.TLS\n\n\t// no tls config present, no need for validation\n\tif tls == nil {\n\t\treturn nil\n\t}\n\n\tswitch tls.Termination {\n\t// reencrypt must specify destination ca cert\n\t// cert, key, cacert may not be specified because the route may be a wildcard\n\tcase routeapi.TLSTerminationReencrypt:\n\t\tif len(tls.DestinationCACertificate) == 0 {\n\t\t\tresult = append(result, field.Required(fldPath.Child(\"destinationCACertificate\"), \"\"))\n\t\t}\n\t//passthrough term should not specify any cert\n\tcase routeapi.TLSTerminationPassthrough:\n\t\tif len(tls.Certificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"certificate\"), tls.Certificate, \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.Key) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"key\"), tls.Key, \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.CACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"caCertificate\"), tls.CACertificate, \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.DestinationCACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"destinationCACertificate\"), tls.DestinationCACertificate, \"passthrough termination does not support certificates\"))\n\t\t}\n\t// edge cert should only specify cert, key, and cacert but those certs\n\t// may not be specified if the route is a wildcard route\n\tcase routeapi.TLSTerminationEdge:\n\t\tif len(tls.DestinationCACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"destinationCACertificate\"), tls.DestinationCACertificate, \"edge termination does not support destination certificates\"))\n\t\t}\n\tdefault:\n\t\tvalidValues := []string{string(routeapi.TLSTerminationEdge), string(routeapi.TLSTerminationPassthrough), string(routeapi.TLSTerminationReencrypt)}\n\t\tresult = append(result, field.NotSupported(fldPath.Child(\"termination\"), tls.Termination, validValues))\n\t}\n\n\tif err := validateInsecureEdgeTerminationPolicy(tls, fldPath.Child(\"insecureEdgeTerminationPolicy\")); err != nil {\n\t\tresult = append(result, err)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "bc1ec9a126cb31103f71dfc6c852070a", "score": "0.50900704", "text": "func configureTLS(certLabel string, cmsKeystore tls.KeyStoreData, devmode bool) error {\n\tlog.Debug(\"Configuring TLS\")\n\n\tconst mqsc string = \"/etc/mqm/15-tls.mqsc\"\n\tconst mqscTemplate string = mqsc + \".tpl\"\n\n\terr := mqtemplate.ProcessTemplateFile(mqscTemplate, mqsc, map[string]string{\n\t\t\"SSLKeyR\": strings.TrimSuffix(cmsKeystore.Keystore.Filename, \".kdb\"),\n\t\t\"CertificateLabel\": certLabel,\n\t}, log)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif devmode && certLabel != \"\" {\n\t\terr = configureTLSDev()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e97687e8ae2432c936eb56e8d04e2b9b", "score": "0.50235015", "text": "func TestAutoAuthzMeshDestRuleEnabled(t *testing.T) {\n\ttestNoMtlsChecker(\"mtls_enabled_checker_12.yaml\", t, true)\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_12.yaml\", t, false)\n}", "title": "" }, { "docid": "16f8a13ab58cb7b4029876f621f5fbd1", "score": "0.49844342", "text": "func generateTLSConfig(host string, tls TLSConfig) *tls.Config {\n\t// init tls config\n\tif tls.Key != \"\" && tls.Cert != \"\" && !strings.HasPrefix(host, \"unix://\") {\n\t\ttlsCfg, err := httputils.GenTLSConfig(tls.Key, tls.Cert, tls.CA)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"fail to parse tls config %v\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\ttlsCfg.InsecureSkipVerify = !tls.VerifyRemote\n\n\t\treturn tlsCfg\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8c380e5408163b4a5bbfec06003f4de5", "score": "0.49752545", "text": "func validateTLS(route *routev1.Route, fldPath *field.Path) field.ErrorList {\n\tresult := field.ErrorList{}\n\ttls := route.Spec.TLS\n\n\t// no tls config present, no need for validation\n\tif tls == nil {\n\t\treturn nil\n\t}\n\n\tswitch tls.Termination {\n\t// reencrypt may specify destination ca cert\n\t// cert, key, cacert may not be specified because the route may be a wildcard\n\tcase routev1.TLSTerminationReencrypt:\n\t\t//passthrough term should not specify any cert\n\tcase routev1.TLSTerminationPassthrough:\n\t\tif len(tls.Certificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"certificate\"), \"redacted certificate data\", \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.Key) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"key\"), \"redacted key data\", \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.CACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"caCertificate\"), \"redacted ca certificate data\", \"passthrough termination does not support certificates\"))\n\t\t}\n\n\t\tif len(tls.DestinationCACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"destinationCACertificate\"), \"redacted destination ca certificate data\", \"passthrough termination does not support certificates\"))\n\t\t}\n\t\t// edge cert should only specify cert, key, and cacert but those certs\n\t\t// may not be specified if the route is a wildcard route\n\tcase routev1.TLSTerminationEdge:\n\t\tif len(tls.DestinationCACertificate) > 0 {\n\t\t\tresult = append(result, field.Invalid(fldPath.Child(\"destinationCACertificate\"), \"redacted destination ca certificate data\", \"edge termination does not support destination certificates\"))\n\t\t}\n\tdefault:\n\t\tvalidValues := []string{string(routev1.TLSTerminationEdge), string(routev1.TLSTerminationPassthrough), string(routev1.TLSTerminationReencrypt)}\n\t\tresult = append(result, field.NotSupported(fldPath.Child(\"termination\"), tls.Termination, validValues))\n\t}\n\n\tif err := validateInsecureEdgeTerminationPolicy(tls, fldPath.Child(\"insecureEdgeTerminationPolicy\")); err != nil {\n\t\tresult = append(result, err)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "e1e62d3939371aa598efa1b05f7569e7", "score": "0.4971214", "text": "func (c *Configuration) DoTLS() bool {\n\tif UseTLS {\n\t\treturn c.HasTLS()\n\t} else if c.TLS {\n\t\treturn c.HasTLS()\n\t}\n\treturn false\n}", "title": "" }, { "docid": "b4bf20883ff587e8bee9c45f6b825343", "score": "0.49211004", "text": "func (source *Source) HasTLS() bool {\n\treturn true\n}", "title": "" }, { "docid": "3104332533469081292640808f547e56", "score": "0.4870716", "text": "func TestConfigreExporterTLS(t *testing.T) {\n\t// Define an existing template with values that could be overwritten\n\tbaseTemplate := &corev1.PodTemplateSpec{\n\t\tSpec: corev1.PodSpec{\n\t\t\tContainers: []corev1.Container{{\n\t\t\t\tName: naming.ContainerPGMonitorExporter,\n\t\t\t\tVolumeMounts: []corev1.VolumeMount{{\n\t\t\t\t\tName: \"existing-volume\",\n\t\t\t\t\tMountPath: \"some-path\",\n\t\t\t\t}},\n\t\t\t\tEnv: []corev1.EnvVar{{\n\t\t\t\t\tName: \"existing-env\",\n\t\t\t\t\tValue: \"existing-value\",\n\t\t\t\t}},\n\t\t\t}},\n\t\t\tVolumes: []corev1.Volume{{\n\t\t\t\tName: \"existing-volume\",\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tEmptyDir: &corev1.EmptyDirVolumeSource{},\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t}\n\n\tt.Run(\"Exporter disabled\", func(t *testing.T) {\n\t\tcluster := &v1beta1.PostgresCluster{}\n\t\ttemplate := baseTemplate.DeepCopy()\n\t\tconfigureExporterTLS(cluster, template, nil)\n\t\t// Template shouldn't have changed\n\t\tassert.DeepEqual(t, template, baseTemplate)\n\t})\n\n\tt.Run(\"Exporter enabled no tls\", func(t *testing.T) {\n\t\tcluster := &v1beta1.PostgresCluster{\n\t\t\tSpec: v1beta1.PostgresClusterSpec{\n\t\t\t\tMonitoring: &v1beta1.MonitoringSpec{\n\t\t\t\t\tPGMonitor: &v1beta1.PGMonitorSpec{\n\t\t\t\t\t\tExporter: &v1beta1.ExporterSpec{},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\ttemplate := baseTemplate.DeepCopy()\n\t\tconfigureExporterTLS(cluster, template, nil)\n\t\t// Template shouldn't have changed\n\t\tassert.DeepEqual(t, template, baseTemplate)\n\t})\n\n\tt.Run(\"Custom TLS provided\", func(t *testing.T) {\n\t\tcluster := &v1beta1.PostgresCluster{\n\t\t\tObjectMeta: metav1.ObjectMeta{Name: \"test\"},\n\t\t\tSpec: v1beta1.PostgresClusterSpec{\n\t\t\t\tMonitoring: &v1beta1.MonitoringSpec{\n\t\t\t\t\tPGMonitor: &v1beta1.PGMonitorSpec{\n\t\t\t\t\t\tExporter: &v1beta1.ExporterSpec{\n\t\t\t\t\t\t\tCustomTLSSecret: &corev1.SecretProjection{\n\t\t\t\t\t\t\t\tLocalObjectReference: corev1.LocalObjectReference{\n\t\t\t\t\t\t\t\t\tName: \"custom-exporter-certs\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\ttemplate := baseTemplate.DeepCopy()\n\n\t\ttestConfigMap := &corev1.ConfigMap{\n\t\t\tObjectMeta: naming.ExporterWebConfigMap(cluster),\n\t\t}\n\n\t\t// What happens if the template already includes volumes/Mounts and envs?\n\t\tconfigureExporterTLS(cluster, template, testConfigMap)\n\n\t\t// Did we configure the cert volume and the web config volume while leaving\n\t\t// existing volumes in place?\n\t\tassert.Assert(t, marshalMatches(template.Spec.Volumes, `\n- emptyDir: {}\n name: existing-volume\n- name: exporter-certs\n projected:\n sources:\n - secret:\n name: custom-exporter-certs\n- configMap:\n name: test-exporter-web-config\n name: web-config\n\t\t`))\n\n\t\t// Is the exporter container in position 0?\n\t\tassert.Assert(t, template.Spec.Containers[0].Name == naming.ContainerPGMonitorExporter)\n\n\t\t// Did we configure the volume mounts on the container while leaving existing\n\t\t// mounts in place?\n\t\tassert.Assert(t, marshalMatches(template.Spec.Containers[0].VolumeMounts, `\n- mountPath: some-path\n name: existing-volume\n- mountPath: /certs\n name: exporter-certs\n- mountPath: /web-config\n name: web-config\n\t\t`))\n\n\t\t// Did we set the `WEB_CONFIG_DIR` env var on the container while leaving\n\t\t// existing vars in place?\n\t\tassert.Assert(t, marshalMatches(template.Spec.Containers[0].Env, `\n- name: existing-env\n value: existing-value\n- name: WEB_CONFIG_DIR\n value: web-config/\n\t\t`))\n\t})\n}", "title": "" }, { "docid": "e964ccc05ad732ae6cb567211536da17", "score": "0.48528823", "text": "func hasCompatibleTTL(caTTL time.Duration, svidTTL time.Duration) bool {\n\treturn svidTTL <= manager.MaxSVIDTTLForCATTL(caTTL)\n}", "title": "" }, { "docid": "63438749e20f9de7eb9e7c0ad2e70418", "score": "0.48426744", "text": "func TestAutoAuthzDestRuleDisable(t *testing.T) {\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_8.yaml\", t, true)\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_8.yaml\", t, false)\n}", "title": "" }, { "docid": "0a09a1401580608cad98fdbe70297516", "score": "0.4772132", "text": "func RequireTLS(policy *authn.Policy) (bool, *authn.MutualTls) {\n\tif policy == nil {\n\t\treturn false, nil\n\t}\n\tif len(policy.Peers) > 0 {\n\t\tfor _, method := range policy.Peers {\n\t\t\tswitch method.GetParams().(type) {\n\t\t\tcase *authn.PeerAuthenticationMethod_Mtls:\n\t\t\t\treturn true, method.GetMtls()\n\t\t\tdefault:\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "e8bfa5331139ae0ac27660382b7d3eec", "score": "0.47694358", "text": "func MaybeCreateTtlResourceIfSupported(resource types.ResourceWithTtl, name string, resourceTypeUrl string, heartbeat bool) (types.Resource, string, error) {\n\tif resource.Ttl != nil {\n\t\twrappedResource := &discovery.Resource{\n\t\t\tName: name,\n\t\t\tTtl: ptypes.DurationProto(*resource.Ttl),\n\t\t}\n\n\t\tif !heartbeat {\n\t\t\tany, err := ptypes.MarshalAny(resource.Resource)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, \"\", err\n\t\t\t}\n\t\t\tany.TypeUrl = resourceTypeUrl\n\t\t\twrappedResource.Resource = any\n\t\t}\n\n\t\treturn wrappedResource, deltaResourceTypeURL, nil\n\t}\n\n\treturn resource.Resource, resourceTypeUrl, nil\n}", "title": "" }, { "docid": "7ef382886c2d022240d462608f9bfb0d", "score": "0.47572562", "text": "func TestPeerAuthnNotFoundDestRuleIstioMutual(t *testing.T) {\n\ttestNoMtlsChecker(\"mtls_enabled_checker_6.yaml\", t, true)\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_6.yaml\", t, false)\n}", "title": "" }, { "docid": "4dfa1e7b69ab0e65a7cb6a62e8090140", "score": "0.47193483", "text": "func generateTLSConfig(sslConfig *config.ServerSSLConfig, logger log.Logger) (*tls.Config, error) {\n\tresult := tls.Config{\n\t\tMinVersion: tls.VersionTLS12,\n\t\tCipherSuites: defaultCipherSuites,\n\t}\n\n\tif sslConfig == nil || !sslConfig.Enabled {\n\t\treturn nil, nil //nolint:nilnil // We do not want a TLS config in these cases\n\t}\n\n\tif len(sslConfig.SelfSignedHostnames) == 0 && len(sslConfig.Certificates) == 0 {\n\t\treturn nil, errors.New(\"at least one certificate must be specified\")\n\t}\n\n\t// Generate self-signed certificates for each hostname requested\n\tif len(sslConfig.SelfSignedHostnames) > 0 {\n\t\tselfSignedCert, err := generateSelfSignedCertificate(sslConfig.SelfSignedHostnames)\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"failed to generate self-signed certificate: %v\", err)\n\n\t\t\treturn nil, err\n\t\t}\n\n\t\tresult.Certificates = append(result.Certificates, selfSignedCert)\n\t}\n\n\t// Set min and max TLS versions if they were specified in the config.\n\tif sslConfig.MinTLSVersion != nil {\n\t\tresult.MinVersion = utils.ParseTLSVersion(*sslConfig.MinTLSVersion)\n\t\tif result.MinVersion == 0 {\n\t\t\tlogger.Errorf(\"invalid TLS version: %v\", *sslConfig.MinTLSVersion)\n\n\t\t\treturn nil, errors.Errorf(\"invalid TLS version: %v\", *sslConfig.MinTLSVersion)\n\t\t}\n\t}\n\n\tif sslConfig.MaxTLSVersion != nil {\n\t\tresult.MaxVersion = utils.ParseTLSVersion(*sslConfig.MaxTLSVersion)\n\t\tif result.MaxVersion == 0 {\n\t\t\tlogger.Errorf(\"invalid TLS version: %v\", *sslConfig.MaxTLSVersion)\n\n\t\t\treturn nil, errors.Errorf(\"invalid TLS version: %v\", *sslConfig.MaxTLSVersion)\n\t\t}\n\t}\n\n\t// Set the cipher suites if they were specified in the config.\n\tif len(sslConfig.CipherSuites) > 0 {\n\t\tresult.CipherSuites = nil\n\n\t\tfor _, cipherSuiteName := range sslConfig.CipherSuites {\n\t\t\tsuiteID := utils.ParseCipherSuite(cipherSuiteName)\n\t\t\tif suiteID == 0 {\n\t\t\t\tlogger.Errorf(\"invalid cipher suite: %v\", cipherSuiteName)\n\n\t\t\t\treturn nil, errors.Errorf(\"invalid cipher suite: %v\", cipherSuiteName)\n\t\t\t}\n\n\t\t\tresult.CipherSuites = append(result.CipherSuites, suiteID)\n\t\t}\n\t}\n\n\t// Add each supplied certificate to the TLS config.\n\tfor _, certConfig := range sslConfig.Certificates {\n\t\tcert, err := getCertificateFromConfig(certConfig, logger)\n\n\t\tif err != nil {\n\t\t\tlogger.Errorf(\"unable to load certificate: %v\", err)\n\n\t\t\treturn nil, errors.Wrap(err, \"unable to load certificate\")\n\t\t}\n\n\t\tresult.Certificates = append(result.Certificates, *cert)\n\t}\n\n\treturn &result, nil\n}", "title": "" }, { "docid": "2611b7399b9db2fb498538c064e99400", "score": "0.46636617", "text": "func DestinationRule(c *canaryv1.CanaryApp) *istiogov1alpha3.DestinationRule {\n\tds := &istiogov1alpha3.DestinationRule{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"DestinationRule\",\n\t\t\tAPIVersion: \"networking.istio.io/v1alpha3\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: c.Name,\n\t\t\tNamespace: c.Namespace,\n\t\t},\n\t\tSpec: istiov1alpha3.DestinationRule{\n\t\t\tHost: c.Name,\n\t\t\tSubsets: []*istiov1alpha3.Subset{{\n\t\t\t\tName: \"primary\",\n\t\t\t\tLabels: map[string]string{\"app\": c.Name, \"service\": \"primary\"},\n\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tName: \"secondary\",\n\t\t\t\t\tLabels: map[string]string{\"app\": c.Name, \"service\": \"secondary\"},\n\t\t\t\t}},\n\t\t},\n\t}\n\treturn ds\n}", "title": "" }, { "docid": "1a14f5976dbfe008b0ca0b8c882e1499", "score": "0.4656244", "text": "func TestAutoAuthzPeerAuthnValidDestRuleValid(t *testing.T) {\n\ttestNoMtlsChecker(\"mtls_enabled_checker_4.yaml\", t, true)\n\ttestNoMtlsChecker(\"mtls_enabled_checker_5.yaml\", t, true)\n\ttestNoMtlsChecker(\"mtls_enabled_checker_4.yaml\", t, false)\n\ttestNoMtlsChecker(\"mtls_enabled_checker_5.yaml\", t, false)\n}", "title": "" }, { "docid": "943a2f26b51b8be3aaf18ad7bc2b33ec", "score": "0.45833632", "text": "func validateReceiverTLSConfig(cfg commoncfg.TLSConfig) error {\n\tif cfg.CAFile != \"\" || cfg.CertFile != \"\" || cfg.KeyFile != \"\" {\n\t\treturn errTLSFileNotAllowed\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a6efab179363092c757208de0fcbc036", "score": "0.4579604", "text": "func (o *TlsDeliveryProfile3) HasTlsBufferSize() bool {\n\tif o != nil && o.TlsBufferSize != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "a6319330912b6a1b53ba201db3b81947", "score": "0.45689154", "text": "func (o *Options) HasDestination() bool {\n\treturn *o.Out || len(o.Destinations) > 0\n}", "title": "" }, { "docid": "861c2c93a33b7debe9b820c12f4740fa", "score": "0.45584154", "text": "func calculateTTL(route *stack.Route, ipv4TTL uint8, ipv6HopLimit int16) uint8 {\n\tswitch netProto := route.NetProto(); netProto {\n\tcase header.IPv4ProtocolNumber:\n\t\tif ipv4TTL == tcpip.UseDefaultIPv4TTL {\n\t\t\treturn route.DefaultTTL()\n\t\t}\n\t\treturn ipv4TTL\n\tcase header.IPv6ProtocolNumber:\n\t\tif ipv6HopLimit == tcpip.UseDefaultIPv6HopLimit {\n\t\t\treturn route.DefaultTTL()\n\t\t}\n\t\treturn uint8(ipv6HopLimit)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"invalid protocol number = %d\", netProto))\n\t}\n}", "title": "" }, { "docid": "a50dfa60548d05214b303b11d7ecd754", "score": "0.4543344", "text": "func OptionTLS(certFile, keyFile string) func(*Handler) error {\n\treturn func(handler *Handler) error {\n\t\tif certFile == \"\" && keyFile == \"\" {\n\t\t\treturn nil\n\t\t}\n\t\thandler.tlsCertificateFile = certFile\n\t\thandler.tlsPrivateKeyFile = keyFile\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "840015da68a92c17364e2aea4ab8a94b", "score": "0.45295385", "text": "func (o ProfileFtpOutput) EnforceTlssessionReuse() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *ProfileFtp) pulumi.StringPtrOutput { return v.EnforceTlssessionReuse }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2c3784f236f7e464720f75e7a744b48a", "score": "0.45267808", "text": "func configureWebTLS(label string) error {\n\t// Return immediately if we have no certificate to use as identity\n\tif label == \"\" && os.Getenv(\"MQ_GENERATE_CERTIFICATE_HOSTNAME\") == \"\" {\n\t\treturn nil\n\t}\n\n\twebConfigDir := \"/etc/mqm/web/installations/Installation1/servers/mqweb\"\n\ttls := \"tls.xml\"\n\n\ttlsConfig := filepath.Join(webConfigDir, tls)\n\tnewTLSConfig := filepath.Join(webConfigDir, tls+\".tpl\")\n\terr := os.Remove(tlsConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not delete file %s: %v\", tlsConfig, err)\n\t}\n\t// we symlink here to prevent issues on restart\n\terr = os.Symlink(newTLSConfig, tlsConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not create symlink %s->%s: %v\", newTLSConfig, tlsConfig, err)\n\t}\n\tmqmUID, mqmGID, err := command.LookupMQM()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not find mqm user or group: %v\", err)\n\t}\n\terr = os.Chown(tlsConfig, mqmUID, mqmGID)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could change ownership of %s to mqm: %v\", tlsConfig, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d62d0c861261de043a56dbe0214e7687", "score": "0.4523691", "text": "func ExtendedValidateRoute(route *routeapi.Route) field.ErrorList {\n\ttlsConfig := route.Spec.TLS\n\tresult := field.ErrorList{}\n\n\tif tlsConfig == nil {\n\t\treturn result\n\t}\n\n\ttlsFieldPath := field.NewPath(\"spec\").Child(\"tls\")\n\tif errs := validateTLS(route, tlsFieldPath); len(errs) != 0 {\n\t\tresult = append(result, errs...)\n\t}\n\n\t// TODO: Check if we can be stricter with validating the certificate\n\t// is for the route hostname. Don't want existing routes to\n\t// break, so disable the hostname validation for now.\n\t// hostname := route.Spec.Host\n\thostname := \"\"\n\tvar certPool *x509.CertPool\n\n\tif len(tlsConfig.CACertificate) > 0 {\n\t\tcertPool = x509.NewCertPool()\n\t\tif ok := certPool.AppendCertsFromPEM([]byte(tlsConfig.CACertificate)); !ok {\n\t\t\tresult = append(result, field.Invalid(tlsFieldPath.Child(\"caCertificate\"), tlsConfig.CACertificate, \"failed to parse CA certificate\"))\n\t\t}\n\t}\n\n\tverifyOptions := &x509.VerifyOptions{\n\t\tDNSName: hostname,\n\t\tRoots: certPool,\n\t}\n\n\tif len(tlsConfig.Certificate) > 0 {\n\t\tif _, err := validateCertificatePEM(tlsConfig.Certificate, verifyOptions); err != nil {\n\t\t\tresult = append(result, field.Invalid(tlsFieldPath.Child(\"certificate\"), tlsConfig.Certificate, err.Error()))\n\t\t}\n\n\t\tcertKeyBytes := []byte{}\n\t\tcertKeyBytes = append(certKeyBytes, []byte(tlsConfig.Certificate)...)\n\t\tif len(tlsConfig.Key) > 0 {\n\t\t\tcertKeyBytes = append(certKeyBytes, byte('\\n'))\n\t\t\tcertKeyBytes = append(certKeyBytes, []byte(tlsConfig.Key)...)\n\t\t}\n\n\t\tif _, err := tls.X509KeyPair(certKeyBytes, certKeyBytes); err != nil {\n\t\t\tresult = append(result, field.Invalid(tlsFieldPath.Child(\"key\"), tlsConfig.Key, err.Error()))\n\t\t}\n\t}\n\n\tif len(tlsConfig.DestinationCACertificate) > 0 {\n\t\troots := x509.NewCertPool()\n\t\tif ok := roots.AppendCertsFromPEM([]byte(tlsConfig.DestinationCACertificate)); !ok {\n\t\t\tresult = append(result, field.Invalid(tlsFieldPath.Child(\"destinationCACertificate\"), tlsConfig.DestinationCACertificate, \"failed to parse destination CA certificate\"))\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "e572e34ac4bfbcb8bbf6e1dddd03e858", "score": "0.45154756", "text": "func (source *Source) UseTLS() bool {\n\treturn source.ForceSMTPS || source.Port == 465\n}", "title": "" }, { "docid": "da636c17ac74fe41dd8b7e3a913c1034", "score": "0.451376", "text": "func buildTLSConfig(tlsOption Options) (*tls.Config, error) {\n\tconf := &tls.Config{}\n\n\t// ensure http2 enabled\n\tconf.NextProtos = []string{\"h2\", \"http/1.1\", tlsalpn01.ACMETLS1Protocol}\n\n\tif len(tlsOption.ClientAuth.CAFiles) > 0 {\n\t\tpool := x509.NewCertPool()\n\t\tfor _, caFile := range tlsOption.ClientAuth.CAFiles {\n\t\t\tdata, err := caFile.Read()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tok := pool.AppendCertsFromPEM(data)\n\t\t\tif !ok {\n\t\t\t\tif caFile.IsPath() {\n\t\t\t\t\treturn nil, fmt.Errorf(\"invalid certificate(s) in %s\", caFile)\n\t\t\t\t}\n\t\t\t\treturn nil, errors.New(\"invalid certificate(s) content\")\n\t\t\t}\n\t\t}\n\t\tconf.ClientCAs = pool\n\t\tconf.ClientAuth = tls.RequireAndVerifyClientCert\n\t}\n\n\tclientAuthType := tlsOption.ClientAuth.ClientAuthType\n\tif len(clientAuthType) > 0 {\n\t\tif conf.ClientCAs == nil && (clientAuthType == \"VerifyClientCertIfGiven\" ||\n\t\t\tclientAuthType == \"RequireAndVerifyClientCert\") {\n\t\t\treturn nil, fmt.Errorf(\"invalid clientAuthType: %s, CAFiles is required\", clientAuthType)\n\t\t}\n\n\t\tswitch clientAuthType {\n\t\tcase \"NoClientCert\":\n\t\t\tconf.ClientAuth = tls.NoClientCert\n\t\tcase \"RequestClientCert\":\n\t\t\tconf.ClientAuth = tls.RequestClientCert\n\t\tcase \"RequireAnyClientCert\":\n\t\t\tconf.ClientAuth = tls.RequireAnyClientCert\n\t\tcase \"VerifyClientCertIfGiven\":\n\t\t\tconf.ClientAuth = tls.VerifyClientCertIfGiven\n\t\tcase \"RequireAndVerifyClientCert\":\n\t\t\tconf.ClientAuth = tls.RequireAndVerifyClientCert\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown client auth type %q\", clientAuthType)\n\t\t}\n\t}\n\n\t// Set PreferServerCipherSuites.\n\tconf.PreferServerCipherSuites = tlsOption.PreferServerCipherSuites\n\n\t// Set the minimum TLS version if set in the config\n\tif minConst, exists := MinVersion[tlsOption.MinVersion]; exists {\n\t\tconf.PreferServerCipherSuites = true\n\t\tconf.MinVersion = minConst\n\t}\n\n\t// Set the maximum TLS version if set in the config TOML\n\tif maxConst, exists := MaxVersion[tlsOption.MaxVersion]; exists {\n\t\tconf.PreferServerCipherSuites = true\n\t\tconf.MaxVersion = maxConst\n\t}\n\n\t// Set the list of CipherSuites if set in the config\n\tif tlsOption.CipherSuites != nil {\n\t\t// if our list of CipherSuites is defined in the entryPoint config, we can re-initialize the suites list as empty\n\t\tconf.CipherSuites = make([]uint16, 0)\n\t\tfor _, cipher := range tlsOption.CipherSuites {\n\t\t\tif cipherConst, exists := CipherSuites[cipher]; exists {\n\t\t\t\tconf.CipherSuites = append(conf.CipherSuites, cipherConst)\n\t\t\t} else {\n\t\t\t\t// CipherSuite listed in the toml does not exist in our listed\n\t\t\t\treturn nil, fmt.Errorf(\"invalid CipherSuite: %s\", cipher)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set the list of CurvePreferences/CurveIDs if set in the config\n\tif tlsOption.CurvePreferences != nil {\n\t\tconf.CurvePreferences = make([]tls.CurveID, 0)\n\t\t// if our list of CurvePreferences/CurveIDs is defined in the config, we can re-initialize the list as empty\n\t\tfor _, curve := range tlsOption.CurvePreferences {\n\t\t\tif curveID, exists := CurveIDs[curve]; exists {\n\t\t\t\tconf.CurvePreferences = append(conf.CurvePreferences, curveID)\n\t\t\t} else {\n\t\t\t\t// CurveID listed in the toml does not exist in our listed\n\t\t\t\treturn nil, fmt.Errorf(\"invalid CurveID in curvePreferences: %s\", curve)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn conf, nil\n}", "title": "" }, { "docid": "0a91fb68a662524797d743833a12ae64", "score": "0.4505531", "text": "func activeDst(src, dst *i18n.MessageTemplate, pluralRule *plural.Rule) (active *i18n.MessageTemplate, translateMessageTemplate *i18n.MessageTemplate) {\n\tpluralForms := pluralRule.PluralForms\n\tif len(src.PluralTemplates) == 1 {\n\t\tpluralForms = map[plural.Form]struct{}{\n\t\t\tplural.Other: {},\n\t\t}\n\t}\n\tfor pluralForm := range pluralForms {\n\t\tdt := dst.PluralTemplates[pluralForm]\n\t\tif dt == nil || dt.Src == \"\" {\n\t\t\tif translateMessageTemplate == nil {\n\t\t\t\ttranslateMessageTemplate = &i18n.MessageTemplate{\n\t\t\t\t\tMessage: &i18n.Message{\n\t\t\t\t\t\tID: src.ID,\n\t\t\t\t\t\tDescription: src.Description,\n\t\t\t\t\t\tHash: src.Hash,\n\t\t\t\t\t},\n\t\t\t\t\tPluralTemplates: make(map[plural.Form]*internal.Template),\n\t\t\t\t}\n\t\t\t}\n\t\t\ttranslateMessageTemplate.PluralTemplates[pluralForm] = src.PluralTemplates[plural.Other]\n\t\t\tcontinue\n\t\t}\n\t\tif active == nil {\n\t\t\tactive = &i18n.MessageTemplate{\n\t\t\t\tMessage: &i18n.Message{\n\t\t\t\t\tID: src.ID,\n\t\t\t\t\tDescription: src.Description,\n\t\t\t\t\tHash: src.Hash,\n\t\t\t\t},\n\t\t\t\tPluralTemplates: make(map[plural.Form]*internal.Template),\n\t\t\t}\n\t\t}\n\t\tactive.PluralTemplates[pluralForm] = dt\n\t}\n\treturn\n}", "title": "" }, { "docid": "2e3678b5147c797c6a55a7b31834bfbf", "score": "0.4505378", "text": "func (o *TlsDeliveryProfile3) HasTlsProtocols() bool {\n\tif o != nil && o.TlsProtocols != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "582542388b2ff771eb220dc8a289ef74", "score": "0.4503775", "text": "func (o *ClickstreamSinkUpdate) HasDestination() bool {\n\tif o != nil && o.Destination != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "85f2caf7c622232a97b0af57d4ba4cc6", "score": "0.44838533", "text": "func makeDestination(canary *flaggerv1.Canary, host string, weight int) istiov1alpha3.HTTPRouteDestination {\n\tdest := istiov1alpha3.HTTPRouteDestination{\n\t\tDestination: istiov1alpha3.Destination{\n\t\t\tHost: host,\n\t\t},\n\t\tWeight: weight,\n\t}\n\n\t// set destination port when an ingress gateway is specified\n\tif canary.Spec.Service.PortDiscovery &&\n\t\t(len(canary.Spec.Service.Gateways) > 0 &&\n\t\t\tcanary.Spec.Service.Gateways[0] != \"mesh\" || canary.Spec.Service.Delegation) {\n\t\tdest = istiov1alpha3.HTTPRouteDestination{\n\t\t\tDestination: istiov1alpha3.Destination{\n\t\t\t\tHost: host,\n\t\t\t\tPort: &istiov1alpha3.PortSelector{\n\t\t\t\t\tNumber: uint32(canary.Spec.Service.Port),\n\t\t\t\t},\n\t\t\t},\n\t\t\tWeight: weight,\n\t\t}\n\t}\n\n\treturn dest\n}", "title": "" }, { "docid": "00d3b1c53ce6f9f25a2d2c01c6dd68f2", "score": "0.448089", "text": "func configureTLS(tlsConfig *tls.Config) {\r\n\t// Make all necessary changes to the TLS configuration here.\r\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "1fc675c73de182e01105489b165298f5", "score": "0.44692817", "text": "func configureTLS(tlsConfig *tls.Config) {\n\t// Make all necessary changes to the TLS configuration here.\n}", "title": "" }, { "docid": "dd47a90874e335bbe6fbfa4500ab9f5e", "score": "0.4464713", "text": "func createTestTLSConfig(t *testing.T) *tls.Config {\n\ttestTLSConfig, err := configureTLS()\n\tif err != nil {\n\t\tt.Fatalf(\"we got an unexpected error while calling createTLSConfig: %s\", err)\n\t}\n\n\treturn &testTLSConfig\n}", "title": "" }, { "docid": "1296101c73e554ad896f263ece0132fd", "score": "0.44550213", "text": "func prepareTLS() (certFile string, keyFile string, useTLS bool) {\n\tcertFile = strings.Trim(os.Getenv(\"TLS_CERTFILE\"), \" \")\n\tif certFile == \"\" {\n\t\tlog.Debug(\"TLS Certfile was not set\")\n\t\treturn \"\", \"\", false\n\t}\n\tif _, err := os.OpenFile(certFile, os.O_RDONLY, 0600); os.IsNotExist(err) || os.IsPermission(err) {\n\t\tlog.Warnf(\"TLS Certfile was set to %s, but cannot be accessed: %s\", certFile, err)\n\t\treturn \"\", \"\", false\n\t}\n\tkeyFile = strings.Trim(os.Getenv(\"TLS_KEYFILE\"), \" \")\n\tif keyFile == \"\" {\n\t\tlog.Debug(\"TLS Keyfile was not set\")\n\t\treturn \"\", \"\", false\n\t}\n\tif _, err := os.OpenFile(keyFile, os.O_RDONLY, 0600); os.IsNotExist(err) || os.IsPermission(err) {\n\t\tlog.Warnf(\"TLS Keyfile was set to %s, but cannot be accessed: %s\", keyFile, err)\n\t\treturn \"\", \"\", false\n\t}\n\n\treturn certFile, keyFile, true\n}", "title": "" }, { "docid": "2db1aae56ab8fe73080f68c1bb5c4235", "score": "0.44499815", "text": "func FillTemplates(sourceIP, destinationIP string, rules []k8sfirewall.ChainRule) []k8sfirewall.ChainRule {\n\tif len(rules) == 0 {\n\t\treturn rules\n\t}\n\n\tif len(sourceIP) == 0 && len(destinationIP) == 0 {\n\t\treturn rules\n\t}\n\n\tnewRules := make([]k8sfirewall.ChainRule, len(rules))\n\tfor i, rule := range rules {\n\t\tnewRules[i] = rule\n\t\tnewRules[i].Src = sourceIP\n\t\tnewRules[i].Dst = destinationIP\n\t}\n\n\treturn newRules\n}", "title": "" }, { "docid": "676ffced4e02799f067aa200540f6313", "score": "0.4446099", "text": "func ForceTLS(forceTLS bool) Param {\n\treturn func(h *handler) {\n\t\th.forceTLS = forceTLS\n\t}\n}", "title": "" }, { "docid": "21fd899928db90e7120930c8cdabcc8b", "score": "0.44263533", "text": "func TestAutoAuthzMeshDestRuleDisable(t *testing.T) {\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_10.yaml\", t, true)\n\t// If the AP doesn't have principals\n\ttestNoMtlsChecker(\"mtls_enabled_checker_101.yaml\", t, true)\n\n\ttestMtlsCheckerPresent(\"mtls_enabled_checker_10.yaml\", t, false)\n\ttestNoMtlsChecker(\"mtls_enabled_checker_101.yaml\", t, false)\n}", "title": "" }, { "docid": "fd03e51709b9dc7a4c93be2451022949", "score": "0.44165283", "text": "func NewDestinationRuleManager(si cache.SharedIndexInformer) (*DestinationRuleManager, error) {\n\tevents := make(chan watch.Event, config.Config.Buffer.DestinationRuleEvent)\n\trh := NewCommonResourceEventHandler(events)\n\tsi.AddEventHandler(rh)\n\n\treturn &DestinationRuleManager{events: events}, nil\n}", "title": "" }, { "docid": "1b3d6a48ef8f542b702a21468a245711", "score": "0.44137228", "text": "func (c *Config) OutgoingTLSConfig() (*tls.Config, error) {\n\t// If VerifyServerHostname is true, that implies VerifyOutgoing\n\tif c.VerifyServerHostname {\n\t\tc.VerifyOutgoing = true\n\t}\n\tif !c.UseTLS && !c.VerifyOutgoing {\n\t\treturn nil, nil\n\t}\n\t// Create the tlsConfig\n\ttlsConfig := &tls.Config{\n\t\tRootCAs: x509.NewCertPool(),\n\t\tInsecureSkipVerify: true,\n\t}\n\tif c.ServerName != \"\" {\n\t\ttlsConfig.ServerName = c.ServerName\n\t\ttlsConfig.InsecureSkipVerify = false\n\t}\n\tif c.VerifyServerHostname {\n\t\t// ServerName is filled in dynamically based on the target DC\n\t\ttlsConfig.ServerName = \"VerifyServerHostname\"\n\t\ttlsConfig.InsecureSkipVerify = false\n\t}\n\tif len(c.CipherSuites) != 0 {\n\t\ttlsConfig.CipherSuites = c.CipherSuites\n\t}\n\tif c.PreferServerCipherSuites {\n\t\ttlsConfig.PreferServerCipherSuites = true\n\t}\n\n\t// Ensure we have a CA if VerifyOutgoing is set\n\tif c.VerifyOutgoing && c.CAFile == \"\" && c.CAPath == \"\" {\n\t\treturn nil, fmt.Errorf(\"VerifyOutgoing set, and no CA certificate provided!\")\n\t}\n\n\t// Parse the CA certs if any\n\trootConfig := &rootcerts.Config{\n\t\tCAFile: c.CAFile,\n\t\tCAPath: c.CAPath,\n\t}\n\tif err := rootcerts.ConfigureTLS(tlsConfig, rootConfig); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Add cert/key\n\tcert, err := c.KeyPair()\n\tif err != nil {\n\t\treturn nil, err\n\t} else if cert != nil {\n\t\ttlsConfig.Certificates = []tls.Certificate{*cert}\n\t}\n\n\t// Check if a minimum TLS version was set\n\tif c.TLSMinVersion != \"\" {\n\t\ttlsvers, ok := TLSLookup[c.TLSMinVersion]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"TLSMinVersion: value %s not supported, please specify one of [tls10,tls11,tls12]\", c.TLSMinVersion)\n\t\t}\n\t\ttlsConfig.MinVersion = tlsvers\n\t}\n\n\treturn tlsConfig, nil\n}", "title": "" }, { "docid": "e44d27452e92c0e33575767a75ef0151", "score": "0.44136226", "text": "func (plugin *Plugin) setupEgressRules(\n\tiptable *iptables.IPTables,\n\tproto iptables.Protocol,\n\tconf *config.NetConfig) error {\n\tswitch conf.EgressRedirectMode {\n\tcase config.NAT:\n\t\t// Redirect traffic in the CIDR block to the egress port.\n\t\tif conf.EgressPort != 0 {\n\t\t\treturn plugin.redirectCIDRTrafficByNAT(iptable, plugin.getCidr(proto, conf),\n\t\t\t\tstrconv.Itoa(conf.EgressPort))\n\t\t}\n\tcase config.TPROXY:\n\t\tif conf.EgressRedirectIPv4Addr != \"\" || conf.EgressRedirectIPv6Addr != \"\" {\n\t\t\treturn plugin.setupRedirectionIP(proto, conf)\n\t\t} else if conf.EgressPort != 0 {\n\t\t\treturn plugin.redirectCIDRTrafficByTProxy(proto, iptable,\n\t\t\t\tplugin.getCidr(proto, conf), strconv.Itoa(conf.EgressPort))\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2692393decdb231c7eb859e0faceb1df", "score": "0.43989173", "text": "func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "bb9819a74332fdb6306d81a210959754", "score": "0.43838754", "text": "func (c *Configurator) OutgoingTLSConfigForCheck(skipVerify bool) *tls.Config {\n\tc.log(\"OutgoingTLSConfigForCheck\")\n\tif !c.enableAgentTLSForChecks() {\n\t\treturn &tls.Config{\n\t\t\tInsecureSkipVerify: skipVerify,\n\t\t}\n\t}\n\n\tconfig := c.commonTLSConfig(false)\n\tconfig.InsecureSkipVerify = skipVerify\n\tconfig.ServerName = c.serverNameOrNodeName()\n\n\treturn config\n}", "title": "" }, { "docid": "abb0723b2504db4a21e82b842e999503", "score": "0.43821567", "text": "func (plugin *Plugin) addTproxyRouterRule(proto iptables.Protocol) error {\n\thandle, err := netlink.NewHandle()\n\tif err != nil {\n\t\tlog.Errorf(\"Creating a new handle failed: %v\", err)\n\t\treturn err\n\t}\n\n\trule := netlink.NewRule()\n\trule.Family = plugin.getRuleFamily(proto)\n\trule.Mark = tproxyRouteMarker\n\trule.Table = tproxyRouteTable\n\n\tif err := handle.RuleAdd(rule); err != nil {\n\t\tlog.Errorf(\"Add IP rule %v failed : %v\", rule, err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "87cce929715f9d4d10aea1e473a22b7a", "score": "0.4380902", "text": "func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "df9514bf0a763a29dde64ecf1cd0b141", "score": "0.43784493", "text": "func (i *TiSparkWorkerInstance) setTLSConfig(ctx context.Context, enableTLS bool, configs map[string]any, paths meta.DirPaths) (map[string]any, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "04421ec720f9c15d48fe8f7c983e1e5a", "score": "0.43699664", "text": "func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "d339e65753d064f6431fe326cb29c66d", "score": "0.43598464", "text": "func configureTLS(envConf Config, saramaConf *sarama.Config) error {\n\t// configure TLS\n\tif envConf.TLSEnabled {\n\t\tcert, err := tls.LoadX509KeyPair(envConf.TLSCert, envConf.TLSKey)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to load TLS cert(%s) and key(%s)\", envConf.TLSCert, envConf.TLSKey)\n\t\t}\n\n\t\tca, err := ioutil.ReadFile(envConf.CACerts)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"failed to load CA cert bundle at: %s\", envConf.CACerts)\n\t\t}\n\n\t\tpool := x509.NewCertPool()\n\t\tpool.AppendCertsFromPEM(ca)\n\n\t\ttlsCfg := &tls.Config{\n\t\t\tCertificates: []tls.Certificate{cert},\n\t\t\tRootCAs: pool,\n\t\t}\n\n\t\tsaramaConf.Net.TLS.Enable = true\n\t\tsaramaConf.Net.TLS.Config = tlsCfg\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f8b5371ddec0607c439e6b67073b71b9", "score": "0.43583795", "text": "func newConnectionSocketTLS(tcpSocket *net.TCPConn, tlsConfig *tls.Config, server bool, poolDesc string) *connectionSocketTLS {\n\treturn &connectionSocketTLS{\n\t\ttcpSocket: tcpSocket,\n\t\ttlsConfig: tlsConfig,\n\t\tserver: server,\n\t\tpoolDesc: poolDesc,\n\t}\n}", "title": "" }, { "docid": "ab20e5b575d01e234e8821f10f7c5f49", "score": "0.4351369", "text": "func setupTLS(ws *webserver.Server, config *serverinit.Config, hostname string) {\n\tcert, key := config.OptionalString(\"httpsCert\", \"\"), config.OptionalString(\"httpsKey\", \"\")\n\tif !config.OptionalBool(\"https\", true) {\n\t\treturn\n\t}\n\tif (cert != \"\") != (key != \"\") {\n\t\texitf(\"httpsCert and httpsKey must both be either present or absent\")\n\t}\n\n\tdefCert := osutil.DefaultTLSCert()\n\tdefKey := osutil.DefaultTLSKey()\n\tconst hint = \"You must add this certificate's fingerprint to your client's trusted certs list to use it. Like so:\\n\\\"trustedCerts\\\": [\\\"%s\\\"],\"\n\tif cert == defCert && key == defKey {\n\t\t_, err1 := wkfs.Stat(cert)\n\t\t_, err2 := wkfs.Stat(key)\n\t\tif err1 != nil || err2 != nil {\n\t\t\tif os.IsNotExist(err1) || os.IsNotExist(err2) {\n\t\t\t\tsig, err := httputil.GenSelfTLSFiles(hostname, defCert, defKey)\n\t\t\t\tif err != nil {\n\t\t\t\t\texitf(\"Could not generate self-signed TLS cert: %q\", err)\n\t\t\t\t}\n\t\t\t\tlog.Printf(hint, sig)\n\t\t\t} else {\n\t\t\t\texitf(\"Could not stat cert or key: %q, %q\", err1, err2)\n\t\t\t}\n\t\t}\n\t}\n\t// Always generate new certificates if the config's httpsCert and httpsKey are empty.\n\tif cert == \"\" && key == \"\" {\n\t\tsig, err := httputil.GenSelfTLSFiles(hostname, defCert, defKey)\n\t\tif err != nil {\n\t\t\texitf(\"Could not generate self signed creds: %q\", err)\n\t\t}\n\t\tlog.Printf(hint, sig)\n\t\tcert = defCert\n\t\tkey = defKey\n\t}\n\tdata, err := wkfs.ReadFile(cert)\n\tif err != nil {\n\t\texitf(\"Failed to read pem certificate: %s\", err)\n\t}\n\tsig, err := httputil.CertFingerprint(data)\n\tif err != nil {\n\t\texitf(\"certificate error: %v\", err)\n\t}\n\tlog.Printf(\"TLS enabled, with SHA-256 certificate fingerprint: %v\", sig)\n\tws.SetTLS(cert, key)\n}", "title": "" }, { "docid": "edd42f02dc05ea1891dd3bfafff09de5", "score": "0.4350996", "text": "func GenerateTLSConfig(host ...string) *tls.Config {\n\ttlsCert, _ := Certificate(host...)\n\n\treturn &tls.Config{\n\t\tCertificates: []tls.Certificate{tlsCert},\n\t\tNextProtos: []string{\"http/1.1\"},\n\t\t//ServerName: \"echo.cella.fun\",\n\t}\n}", "title": "" }, { "docid": "b3b3cddbd4d2fbe00e7fc0ac0a3f751b", "score": "0.43509606", "text": "func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLSQLDbSyncTaskProperties() (*ConnectToTargetSQLSQLDbSyncTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "093c760da134c6da12729406b812721e", "score": "0.43464884", "text": "func NewDestinationruleObject(app *v3.Application) istiov1alpha3.DestinationRule {\n\tservice := app.Name + \"-\" + \"service\" + \".\" + app.Namespace + \".svc.cluster.local\"\n\ttrafficPolicy := new(istiov1alpha3.TrafficPolicy)\n\tdestinationrule := istiov1alpha3.DestinationRule{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: \"DestinationRule\",\n\t\t\tAPIVersion: \"networking.istio.io/v1alpha3\",\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tOwnerReferences: []metav1.OwnerReference{*metav1.NewControllerRef(app, v3.SchemeGroupVersion.WithKind(\"Application\"))},\n\t\t\tNamespace: app.Namespace,\n\t\t\tName: app.Name + \"-\" + \"destinationrule\",\n\t\t\tAnnotations: map[string]string{},\n\t\t},\n\t\tSpec: istiov1alpha3.DestinationRuleSpec{\n\t\t\tHost: service,\n\t\t\tTrafficPolicy: trafficPolicy,\n\t\t},\n\t}\n\n\tif len(app.Spec.OptTraits.GrayRelease) >= 2 {\n\t\tfor k := range app.Spec.OptTraits.GrayRelease {\n\t\t\tvar labels map[string]string = make(map[string]string)\n\t\t\tlabels[\"version\"] = k\n\t\t\tlabels[\"app\"] = app.Name + \"-\" + \"workload\"\n\t\t\tlabels[\"inpool\"] = \"yes\"\n\t\t\tdestinationrule.Spec.Subsets = append(destinationrule.Spec.Subsets, istiov1alpha3.Subset{\n\t\t\t\tName: k,\n\t\t\t\tLabels: labels,\n\t\t\t})\n\t\t}\n\t}\n\tif app.Spec.OptTraits.LoadBalancer != nil {\n\t\tif app.Spec.OptTraits.LoadBalancer.ConsistentHash != nil {\n\t\t\tif app.Spec.OptTraits.LoadBalancer.ConsistentHash.UseSourceIP {\n\t\t\t\tlbsetting := new(istiov1alpha3.LoadBalancerSettings)\n\t\t\t\thashlb := new(istiov1alpha3.ConsistentHashLB)\n\t\t\t\thashlb = &istiov1alpha3.ConsistentHashLB{\n\t\t\t\t\tUseSourceIp: true,\n\t\t\t\t}\n\t\t\t\tlbsetting.ConsistentHash = hashlb\n\t\t\t\ttrafficPolicy.LoadBalancer = lbsetting\n\t\t\t}\n\t\t} else if lbType := app.Spec.OptTraits.LoadBalancer.Simple; lbType != \"\" {\n\t\t\tlbsetting := new(istiov1alpha3.LoadBalancerSettings)\n\t\t\tswitch lbType {\n\t\t\tcase \"ROUND_ROBIN\":\n\t\t\t\tlbsetting.Simple = istiov1alpha3.SimpleLBRoundRobin\n\t\t\tcase \"LEAST_CONN\":\n\t\t\t\tlbsetting.Simple = istiov1alpha3.SimpleLBLeastConn\n\t\t\tcase \"RANDOM\":\n\t\t\t\tlbsetting.Simple = istiov1alpha3.SimpleLBRandom\n\t\t\t}\n\t\t\ttrafficPolicy.LoadBalancer = lbsetting\n\t\t}\n\t} else {\n\t\ttrafficPolicy.LoadBalancer = &istiov1alpha3.LoadBalancerSettings{Simple: istiov1alpha3.SimpleLBRoundRobin}\n\t}\n\tif app.Spec.OptTraits.CircuitBreaking != nil {\n\t\tif app.Spec.OptTraits.CircuitBreaking.ConnectionPool != nil {\n\t\t\ttrafficPolicy.ConnectionPool = new(istiov1alpha3.ConnectionPoolSettings)\n\t\t\tif app.Spec.OptTraits.CircuitBreaking.ConnectionPool.TCP != nil {\n\t\t\t\ttrafficPolicy.ConnectionPool.Tcp = &istiov1alpha3.TCPSettings{\n\t\t\t\t\tMaxConnections: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.TCP.MaxConnections,\n\t\t\t\t\tConnectTimeout: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.TCP.ConnectTimeout,\n\t\t\t\t}\n\t\t\t}\n\t\t\tif app.Spec.OptTraits.CircuitBreaking.ConnectionPool.HTTP != nil {\n\t\t\t\ttrafficPolicy.ConnectionPool.Http = &istiov1alpha3.HTTPSettings{\n\t\t\t\t\tHttp1MaxPendingRequests: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.HTTP.HTTP1MaxPendingRequests,\n\t\t\t\t\tHttp2MaxRequests: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.HTTP.HTTP2MaxRequests,\n\t\t\t\t\tMaxRequestsPerConnection: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.HTTP.MaxRequestsPerConnection,\n\t\t\t\t\tMaxRetries: app.Spec.OptTraits.CircuitBreaking.ConnectionPool.HTTP.MaxRetries,\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif app.Spec.OptTraits.CircuitBreaking.OutlierDetection != nil {\n\t\t\ttrafficPolicy.OutlierDetection = &istiov1alpha3.OutlierDetection{\n\t\t\t\tConsecutiveErrors: app.Spec.OptTraits.CircuitBreaking.OutlierDetection.ConsecutiveErrors,\n\t\t\t\tInterval: app.Spec.OptTraits.CircuitBreaking.OutlierDetection.Interval,\n\t\t\t\tBaseEjectionTime: app.Spec.OptTraits.CircuitBreaking.OutlierDetection.BaseEjectionTime,\n\t\t\t\tMaxEjectionPercent: app.Spec.OptTraits.CircuitBreaking.OutlierDetection.MaxEjectionPercent,\n\t\t\t}\n\t\t}\n\t}\n\treturn destinationrule\n}", "title": "" }, { "docid": "dd359067f95fa7a15ca431d01b0ba1e6", "score": "0.43430436", "text": "func OptionDialTLS(dial func(network, addr string) (net.Conn, error)) Option {\n\treturn func(t *http.Transport) *http.Transport {\n\t\tt.DialTLS = dial // nolint:go-lint,staticcheck\n\t\treturn t\n\t}\n}", "title": "" }, { "docid": "605bdedf26c9e9f7bdecef2e0f70b631", "score": "0.4341228", "text": "func (ctsssstp ConnectToSourceSQLServerSyncTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "0b84b7b62f0e060310dda7bb1775a881", "score": "0.43406457", "text": "func (c *ConsulConnect) IsCustomizedTLS() bool {\n\treturn c.IsIngress() && c.Gateway.Ingress.TLS != nil &&\n\t\t(c.Gateway.Ingress.TLS.TLSMinVersion != \"\" ||\n\t\t\tc.Gateway.Ingress.TLS.TLSMaxVersion != \"\" ||\n\t\t\tlen(c.Gateway.Ingress.TLS.CipherSuites) != 0)\n}", "title": "" }, { "docid": "2fd2a886a1c6f487dc5db5d85ff483f9", "score": "0.43382084", "text": "func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8f05f587bdaac2b98c05d44e65e13fdd", "score": "0.4336647", "text": "func (o *TlsDeliveryProfile3) HasTlsCertificateDetails() bool {\n\tif o != nil && o.TlsCertificateDetails != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "85de35220eabf068712b4e18f27b5b0b", "score": "0.4327896", "text": "func (cttsdtp ConnectToTargetSQLDbTaskProperties) AsConnectToSourceSQLServerSyncTaskProperties() (*ConnectToSourceSQLServerSyncTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "8919ac24ed9a1b2f0b7e82e7ea1ecce9", "score": "0.43277904", "text": "func (p *Pack) makeTLSConfigNoSession(t *testing.T, publicAddr, clusterName string) *tls.Config {\n\tprivateKey, publicKey, err := native.GenerateKeyPair()\n\trequire.NoError(t, err)\n\n\tcertificate, err := p.rootCluster.Process.GetAuthServer().GenerateUserAppTestCert(\n\t\tauth.AppTestCertRequest{\n\t\t\tPublicKey: publicKey,\n\t\t\tUsername: p.user.GetName(),\n\t\t\tTTL: time.Hour,\n\t\t\tPublicAddr: publicAddr,\n\t\t\tClusterName: clusterName,\n\t\t\t// Use arbitrary session ID\n\t\t\tSessionID: uuid.New().String(),\n\t\t})\n\trequire.NoError(t, err)\n\n\ttlsCert, err := tls.X509KeyPair(certificate, privateKey)\n\trequire.NoError(t, err)\n\n\treturn &tls.Config{\n\t\tRootCAs: p.rootCertPool,\n\t\tCertificates: []tls.Certificate{tlsCert},\n\t\tInsecureSkipVerify: true,\n\t}\n}", "title": "" }, { "docid": "c7ddf75901c5b4941a5ac00692458c72", "score": "0.43249407", "text": "func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLDbTaskProperties() (*ConnectToTargetSQLDbTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "f5dd67b4b5bd82d4e2ef32da945c91f2", "score": "0.43243355", "text": "func (ctssstp ConnectToSourceSQLServerTaskProperties) AsConnectToTargetSQLMISyncTaskProperties() (*ConnectToTargetSQLMISyncTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "cddbabb1b7b72d9fca0028047d64e0ae", "score": "0.4322605", "text": "func (cttsmtp ConnectToTargetSQLMITaskProperties) AsConnectToSourceSQLServerTaskProperties() (*ConnectToSourceSQLServerTaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "6c4751193e13a9a2f72f15d2bf88daad", "score": "0.43208688", "text": "func TlsConfigWithHttp2Enabled(config *tls.Config) (*tls.Config, error) {\n\t// mostly based on http2 code in the standards library.\n\tif config.CipherSuites != nil {\n\t\t// If they already provided a CipherSuite list, return\n\t\t// an error if it has a bad order or is missing\n\t\t// ECDHE_RSA_WITH_AES_128_GCM_SHA256.\n\t\tconst requiredCipher = tls.TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\n\t\thaveRequired := false\n\t\tfor _, cs := range config.CipherSuites {\n\t\t\tif cs == requiredCipher {\n\t\t\t\thaveRequired = true\n\t\t\t}\n\t\t}\n\t\tif !haveRequired {\n\t\t\treturn nil, fmt.Errorf(\"http2: TLSConfig.CipherSuites is missing HTTP/2-required TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256\")\n\t\t}\n\t}\n\n\tconfig.PreferServerCipherSuites = true\n\n\thaveNPN := false\n\tfor _, p := range config.NextProtos {\n\t\tif p == \"h2\" {\n\t\t\thaveNPN = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !haveNPN {\n\t\tconfig.NextProtos = append(config.NextProtos, \"h2\")\n\t}\n\tconfig.NextProtos = append(config.NextProtos, \"h2-14\")\n\t// make sure http 1.1 is *after* all of the other ones.\n\tconfig.NextProtos = append(config.NextProtos, \"http/1.1\")\n\treturn config, nil\n}", "title": "" }, { "docid": "72509e28dc818ab2e081175f835279de", "score": "0.4312437", "text": "func (o *RecurrenceTransactionUpdate) HasDestinationId() bool {\n\tif o != nil && o.DestinationId != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e282d5ea9979fd1b199785dfa4f5cda3", "score": "0.4309698", "text": "func (ctsmstp ConnectToSourceMySQLTaskProperties) AsConnectToTargetSQLMITaskProperties() (*ConnectToTargetSQLMITaskProperties, bool) {\n\treturn nil, false\n}", "title": "" }, { "docid": "c0cb01ec7c0307e8e126558e7d0d017c", "score": "0.43096417", "text": "func SetOrGetTransport(isSubscribe bool) (http.RoundTripper){\n transport := &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, \n Dial: func(netw, addr string) (net.Conn, error) {\n c, err := net.DialTimeout(netw, addr, _connectTimeout * time.Second)\n \n if(c != nil){\n if(isSubscribe){\n deadline := time.Now().Add(time.Duration(_subscribeTimeout) * time.Second)\n c.SetDeadline(deadline) \n _subscribeConn = c\n } else {\n deadline := time.Now().Add(_nonSubscribeTimeout * time.Second)\n c.SetDeadline(deadline)\n _conn = c\n }\n } else {\n err = fmt.Errorf(_errorInInitializing ,err.Error())\n }\n \n if err != nil {\n return nil, err\n }\n \n return c, nil\n }}\n\n if(_proxyServerEnabled){\n proxyUrl, err := url.Parse(fmt.Sprintf(\"http://%s:%s@%s:%d\", _proxyUser, _proxyPassword, _proxyServer, _proxyPort))\n if(err == nil){ \n transport.Proxy = http.ProxyURL(proxyUrl)\n } else {\n fmt.Println(\"Error in connecting to proxy: \", err)\n }\n }\n return transport\n}", "title": "" } ]
cc091cc528e647ee98b10f6096fdb3d0
GetAttributeGroupWithContext is the same as GetAttributeGroup with the addition of the ability to pass a context and additional request options. See GetAttributeGroup for details on how to use this API operation. The context must be nonnil and will be used for request cancellation. If the context is nil a panic will occur. In the future the SDK may create subcontexts for http.Requests. See for more information on using Contexts.
[ { "docid": "16550d713be240fb5718366266c999cb", "score": "0.8567583", "text": "func (c *AppRegistry) GetAttributeGroupWithContext(ctx aws.Context, input *GetAttributeGroupInput, opts ...request.Option) (*GetAttributeGroupOutput, error) {\n\treq, out := c.GetAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" } ]
[ { "docid": "01c30f6ec6a1406cc32bd37111f04dcf", "score": "0.66016334", "text": "func (c *IoTWireless) GetMulticastGroupWithContext(ctx aws.Context, input *GetMulticastGroupInput, opts ...request.Option) (*GetMulticastGroupOutput, error) {\n\treq, out := c.GetMulticastGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "3520245bc1e3255be23237ed0d7c46aa", "score": "0.62765306", "text": "func GetAttributeGroup(context echo.Context) error {\n\tgroupID := context.Param(\"groupID\")\n\n\tgroup, err := helpers.GetAttributeGroup(groupID)\n\tif err != nil {\n\t\tlog.L.Errorf(\"failed to get an attribute set: %s\", err.String())\n\t\treturn context.JSON(http.StatusInternalServerError, err)\n\t}\n\n\treturn context.JSON(http.StatusOK, group)\n}", "title": "" }, { "docid": "399a6d35bacb0a6282cb96a097d5511f", "score": "0.62076956", "text": "func (c *AppRegistry) DisassociateAttributeGroupWithContext(ctx aws.Context, input *DisassociateAttributeGroupInput, opts ...request.Option) (*DisassociateAttributeGroupOutput, error) {\n\treq, out := c.DisassociateAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "12637dd119f310da1f6f56fe90f48f1f", "score": "0.6006679", "text": "func (c *Shield) DescribeProtectionGroupWithContext(ctx aws.Context, input *DescribeProtectionGroupInput, opts ...request.Option) (*DescribeProtectionGroupOutput, error) {\n\treq, out := c.DescribeProtectionGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "a6a9fbd83a72cb6bf0b9c676770d8f04", "score": "0.59935737", "text": "func (c *Monitorv4) GetUserGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.GetUserGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "dbdfd92fbc6b94e26555903253b80b69", "score": "0.5846749", "text": "func (c *AppRegistry) AssociateAttributeGroupWithContext(ctx aws.Context, input *AssociateAttributeGroupInput, opts ...request.Option) (*AssociateAttributeGroupOutput, error) {\n\treq, out := c.AssociateAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "1bf1dfe4764fdd21b4bad5d8b2761e37", "score": "0.58287364", "text": "func (c *AppRegistry) UpdateAttributeGroupWithContext(ctx aws.Context, input *UpdateAttributeGroupInput, opts ...request.Option) (*UpdateAttributeGroupOutput, error) {\n\treq, out := c.UpdateAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "a08d1ca6ae1629a4e2e8e641b8d2eced", "score": "0.5770751", "text": "func (a *UserGroupsApiService) GetGroup(ctx _context.Context, groupId string) ApiGetGroupRequest {\n\treturn ApiGetGroupRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tgroupId: groupId,\n\t}\n}", "title": "" }, { "docid": "5c143e41404410a5a4ed19da5ea8ff2f", "score": "0.5752257", "text": "func (c *Kec) DescribeScalingGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DescribeScalingGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d24f2c962d4f91ae7de72cc0972c80e6", "score": "0.5731566", "text": "func NewGetAuthNetgroupParamsWithContext(ctx context.Context) *GetAuthNetgroupParams {\n\tvar ()\n\treturn &GetAuthNetgroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "0f34f3be1fdc06202ebc7c4bd42239e6", "score": "0.5707191", "text": "func (s *GetAttributeGroupInput) SetAttributeGroup(v string) *GetAttributeGroupInput {\n\ts.AttributeGroup = &v\n\treturn s\n}", "title": "" }, { "docid": "16d91d69459f652bc65d5ebdd82f7983", "score": "0.557641", "text": "func (c *Client) ModifyServiceTemplateGroupAttributeWithContext(ctx context.Context, request *ModifyServiceTemplateGroupAttributeRequest) (response *ModifyServiceTemplateGroupAttributeResponse, err error) {\n if request == nil {\n request = NewModifyServiceTemplateGroupAttributeRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifyServiceTemplateGroupAttribute require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifyServiceTemplateGroupAttributeResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "4c2791b0b41e0c376d404ed91a7d539e", "score": "0.5551892", "text": "func (c *IoTWireless) GetMulticastGroupSessionWithContext(ctx aws.Context, input *GetMulticastGroupSessionInput, opts ...request.Option) (*GetMulticastGroupSessionOutput, error) {\n\treq, out := c.GetMulticastGroupSessionRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "0135b763cead999aa04592388faa73e8", "score": "0.5521323", "text": "func (c *Kec) DescribeDataGuardGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DescribeDataGuardGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "01181966042900b4985472107db22cec", "score": "0.5507525", "text": "func (c *EKS) DescribeNodegroupWithContext(ctx aws.Context, input *DescribeNodegroupInput, opts ...request.Option) (*DescribeNodegroupOutput, error) {\n\treq, out := c.DescribeNodegroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e99ef3002e03861e6fa7b497b2cb7cfa", "score": "0.5481402", "text": "func (c *Client) DescribeOriginGroupWithContext(ctx context.Context, request *DescribeOriginGroupRequest) (response *DescribeOriginGroupResponse, err error) {\n if request == nil {\n request = NewDescribeOriginGroupRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"DescribeOriginGroup require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewDescribeOriginGroupResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "6fdc1decd9e058e261786d344c6c4398", "score": "0.54798514", "text": "func (c *AppRegistry) ListAttributeGroupsWithContext(ctx aws.Context, input *ListAttributeGroupsInput, opts ...request.Option) (*ListAttributeGroupsOutput, error) {\n\treq, out := c.ListAttributeGroupsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "3779d1e941a1a91aa04289e57e4c9016", "score": "0.53916264", "text": "func (c *AppRegistry) DeleteAttributeGroupWithContext(ctx aws.Context, input *DeleteAttributeGroupInput, opts ...request.Option) (*DeleteAttributeGroupOutput, error) {\n\treq, out := c.DeleteAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d727ca0be3af34c66e8a1e09b08f3078", "score": "0.53667897", "text": "func (s *AssociateAttributeGroupInput) SetAttributeGroup(v string) *AssociateAttributeGroupInput {\n\ts.AttributeGroup = &v\n\treturn s\n}", "title": "" }, { "docid": "6a004e649ebe0044e41a16eca40be35d", "score": "0.5320362", "text": "func (s *DisassociateAttributeGroupInput) SetAttributeGroup(v string) *DisassociateAttributeGroupInput {\n\ts.AttributeGroup = &v\n\treturn s\n}", "title": "" }, { "docid": "8376320ca0cbd7d13e7c031bfeaea015", "score": "0.5309177", "text": "func (c *SES) GetIdentityDkimAttributesWithContext(ctx aws.Context, input *GetIdentityDkimAttributesInput, opts ...request.Option) (*GetIdentityDkimAttributesOutput, error) {\n\treq, out := c.GetIdentityDkimAttributesRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d8cf9f04e463b909e1fba70175c577eb", "score": "0.53024113", "text": "func NewPatchGroupParamsWithContext(ctx context.Context) *PatchGroupParams {\n\tvar ()\n\treturn &PatchGroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "771268f937c3029da23b2cd7e78add39", "score": "0.52969223", "text": "func (c *Client) ModifyAddressTemplateGroupAttributeWithContext(ctx context.Context, request *ModifyAddressTemplateGroupAttributeRequest) (response *ModifyAddressTemplateGroupAttributeResponse, err error) {\n if request == nil {\n request = NewModifyAddressTemplateGroupAttributeRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifyAddressTemplateGroupAttribute require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifyAddressTemplateGroupAttributeResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "18daf8aa9cae4dadba91bdae8c2b5ba3", "score": "0.528803", "text": "func (mgt aciResourceGroupHelperImpl) GetGroup(ctx context.Context, subscriptionID string, groupName string) (resources.Group, error) {\n\tgc, err := login.NewGroupsClient(subscriptionID)\n\tif err != nil {\n\t\treturn resources.Group{}, err\n\t}\n\treturn gc.Get(ctx, groupName)\n}", "title": "" }, { "docid": "a72dea10bfd7c878cbb4a7705950f359", "score": "0.52641094", "text": "func (s *DeleteAttributeGroupOutput) SetAttributeGroup(v *AttributeGroupSummary) *DeleteAttributeGroupOutput {\n\ts.AttributeGroup = v\n\treturn s\n}", "title": "" }, { "docid": "fe9f8b955a27d89811a35f4e7d595b65", "score": "0.5250441", "text": "func (s *AutograderService) GetGroup(ctx context.Context, in *pb.GetGroupRequest) (*pb.Group, error) {\n\tusr, err := s.getCurrentUser(ctx)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetGroup failed: authentication error: %v\", err)\n\t\treturn nil, ErrInvalidUserInfo\n\t}\n\tgroup, err := s.getGroup(in)\n\tif err != nil {\n\t\ts.logger.Errorf(\"GetGroup failed: %v\", err)\n\t\treturn nil, status.Error(codes.NotFound, \"failed to get group\")\n\t}\n\tif !(group.Contains(usr) || s.isTeacher(usr.GetID(), group.GetCourseID())) {\n\t\ts.logger.Error(\"GetGroup failed: user is not group member or teacher\")\n\t\treturn nil, status.Error(codes.PermissionDenied, \"only group members and teachers can access a group\")\n\t}\n\treturn group, nil\n}", "title": "" }, { "docid": "2fe50b8bc69a9511942ef795c9689c9d", "score": "0.52504104", "text": "func (s *UpdateAttributeGroupInput) SetAttributeGroup(v string) *UpdateAttributeGroupInput {\n\ts.AttributeGroup = &v\n\treturn s\n}", "title": "" }, { "docid": "fbb26ec6e1dd2f4f84a7ebf401e8d58d", "score": "0.5187916", "text": "func (s *UpdateAttributeGroupOutput) SetAttributeGroup(v *AttributeGroup) *UpdateAttributeGroupOutput {\n\ts.AttributeGroup = v\n\treturn s\n}", "title": "" }, { "docid": "de41529ca01dae9e469f342c2cd1f93f", "score": "0.51834965", "text": "func (s *DeleteAttributeGroupInput) SetAttributeGroup(v string) *DeleteAttributeGroupInput {\n\ts.AttributeGroup = &v\n\treturn s\n}", "title": "" }, { "docid": "b14914db0836d03ac0aa4370ae6d6b36", "score": "0.51825774", "text": "func (o *GetAuthNetgroupParams) WithContext(ctx context.Context) *GetAuthNetgroupParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "5557650463fafe874ad1d1f98a6b3bab", "score": "0.5154933", "text": "func GetGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GroupState, opts ...pulumi.ResourceOption) (*Group, error) {\n\tvar resource Group\n\terr := ctx.ReadResource(\"vault:identity/group:Group\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "81670698960d41344564f341ca0515af", "score": "0.5148962", "text": "func (s *CreateAttributeGroupOutput) SetAttributeGroup(v *AttributeGroup) *CreateAttributeGroupOutput {\n\ts.AttributeGroup = v\n\treturn s\n}", "title": "" }, { "docid": "3b43b50dcffa6b19b428d96827e9e4af", "score": "0.5134324", "text": "func (c *Client) GetGroup(ctx context.Context, req *migrationcenterpb.GetGroupRequest, opts ...gax.CallOption) (*migrationcenterpb.Group, error) {\n\treturn c.internalClient.GetGroup(ctx, req, opts...)\n}", "title": "" }, { "docid": "f2ec0bb72087abb3c66e1d7f159be90f", "score": "0.5133589", "text": "func (c *Client) DescribeOriginGroupDetailWithContext(ctx context.Context, request *DescribeOriginGroupDetailRequest) (response *DescribeOriginGroupDetailResponse, err error) {\n if request == nil {\n request = NewDescribeOriginGroupDetailRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"DescribeOriginGroupDetail require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewDescribeOriginGroupDetailResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "09ebe31f6ef88b54fd2d01b31d318451", "score": "0.5107549", "text": "func (t *Template) GetServiceCatalogAppRegistryAttributeGroupWithName(name string) (*servicecatalogappregistry.AttributeGroup, error) {\n\tif untyped, ok := t.Resources[name]; ok {\n\t\tswitch resource := untyped.(type) {\n\t\tcase *servicecatalogappregistry.AttributeGroup:\n\t\t\treturn resource, nil\n\t\t}\n\t}\n\treturn nil, fmt.Errorf(\"resource %q of type servicecatalogappregistry.AttributeGroup not found\", name)\n}", "title": "" }, { "docid": "c863b29085ca1e212febbdfc1d02507e", "score": "0.5089821", "text": "func (c *GroundStation) GetDataflowEndpointGroupWithContext(ctx aws.Context, input *GetDataflowEndpointGroupInput, opts ...request.Option) (*GetDataflowEndpointGroupOutput, error) {\n\treq, out := c.GetDataflowEndpointGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "23b545dae0fac7615f9d345ac920043c", "score": "0.5087691", "text": "func (m *GroupResource) GetGroup(ctx context.Context, groupId string) (*Group, *Response, error) {\n\turl := fmt.Sprintf(\"/api/v1/groups/%v\", groupId)\n\n\trq := m.client.CloneRequestExecutor()\n\n\treq, err := rq.WithAccept(\"application/json\").WithContentType(\"application/json\").NewRequest(\"GET\", url, nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar group *Group\n\n\tresp, err := rq.Do(ctx, req, &group)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\treturn group, resp, nil\n}", "title": "" }, { "docid": "1be9dc419066db524368bef21021b7d3", "score": "0.50861883", "text": "func (c *GlobalAccelerator) DescribeEndpointGroupWithContext(ctx aws.Context, input *DescribeEndpointGroupInput, opts ...request.Option) (*DescribeEndpointGroupOutput, error) {\n\treq, out := c.DescribeEndpointGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "b7e5bf8fb5bbc2c500ae37bb9e1c0fcf", "score": "0.5065775", "text": "func (a *API) GetGroup(request GroupRequest) model.Group {\n\tendpoint := a.BaseURL + \"/groups/\" + a.GetOrDefaultAccountAlias(request.AccountAlias) + \"/\" + request.ID\n\n\tgroup := model.Group{}\n\ta.GetWithAuthentication(endpoint, &group)\n\n\treturn group\n}", "title": "" }, { "docid": "dc0d489b3a071f1a05dafe317aec9cc8", "score": "0.5029584", "text": "func GetGroup(ctx *pulumi.Context,\n\tname string, id pulumi.ID, state *GroupState, opts ...pulumi.ResourceOpt) (*Group, error) {\n\tinputs := make(map[string]interface{})\n\tif state != nil {\n\t\tinputs[\"arn\"] = state.Arn\n\t\tinputs[\"name\"] = state.Name\n\t\tinputs[\"path\"] = state.Path\n\t\tinputs[\"uniqueId\"] = state.UniqueId\n\t}\n\ts, err := ctx.ReadResource(\"aws:iam/group:Group\", name, id, inputs, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Group{s: s}, nil\n}", "title": "" }, { "docid": "9a4a27e51304ca054af62335b2ea29af", "score": "0.5006129", "text": "func GetGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GroupState, opts ...pulumi.ResourceOption) (*Group, error) {\n\tvar resource Group\n\terr := ctx.ReadResource(\"keycloak:index/group:Group\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f71e4fb60747ad9de2bc3fd41747fc3a", "score": "0.5005046", "text": "func (c *AppRegistry) ListAssociatedAttributeGroupsWithContext(ctx aws.Context, input *ListAssociatedAttributeGroupsInput, opts ...request.Option) (*ListAssociatedAttributeGroupsOutput, error) {\n\treq, out := c.ListAssociatedAttributeGroupsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "9ea456b5f0f52a61bb7b9ca80e7206a9", "score": "0.49927238", "text": "func GetGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GroupState, opts ...pulumi.ResourceOption) (*Group, error) {\n\tvar resource Group\n\terr := ctx.ReadResource(\"gcp:monitoring/group:Group\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "d51ad81497b75f7801372e617b85ff12", "score": "0.49845862", "text": "func (k Keeper) GetGroup(ctx sdk.Context, id uint64) types.Group {\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GroupKey))\n\tvar group types.Group\n\tk.cdc.MustUnmarshalBinaryBare(store.Get(GetGroupIDBytes(id)), &group)\n\treturn group\n}", "title": "" }, { "docid": "8841eb3e4ea6735e32271e11e2a85f92", "score": "0.4967395", "text": "func GetRuleGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *RuleGroupState, opts ...pulumi.ResourceOption) (*RuleGroup, error) {\n\tvar resource RuleGroup\n\terr := ctx.ReadResource(\"aws:wafregional/ruleGroup:RuleGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "cbddc8175ffab666db0c5be2b79a21f4", "score": "0.49567303", "text": "func (c *Client) GetGroup(ctx context.Context, groupID string) (*Group, error) {\n\tmsg, err := c.DoCustomRequest(ctx, \"GET\", \"/groups/\"+groupID+\".json\", \"v2\", nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar group Group\n\terr = json.Unmarshal(msg.Body, &group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &group, nil\n}", "title": "" }, { "docid": "54714541e7b253c21f6e2a749672914a", "score": "0.49216717", "text": "func (c *Client) ModifySecurityGroupAttributeWithContext(ctx context.Context, request *ModifySecurityGroupAttributeRequest) (response *ModifySecurityGroupAttributeResponse, err error) {\n if request == nil {\n request = NewModifySecurityGroupAttributeRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifySecurityGroupAttribute require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifySecurityGroupAttributeResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "305d2b9782c220cee0e822b777f70c84", "score": "0.48814055", "text": "func NewGroupV2GetMembersOfGroupParamsWithContext(ctx context.Context) *GroupV2GetMembersOfGroupParams {\n\tvar ()\n\treturn &GroupV2GetMembersOfGroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "d3178ee3cf8df3a02a0d96dc38c418d3", "score": "0.48662382", "text": "func (m *MockSESAPI) GetIdentityDkimAttributesWithContext(arg0 context.Context, arg1 *ses.GetIdentityDkimAttributesInput, arg2 ...request.Option) (*ses.GetIdentityDkimAttributesOutput, 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, \"GetIdentityDkimAttributesWithContext\", varargs...)\n\tret0, _ := ret[0].(*ses.GetIdentityDkimAttributesOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "ac12d053cf56439daed01dc3c871307d", "score": "0.4860556", "text": "func GetRuleGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *RuleGroupState, opts ...pulumi.ResourceOption) (*RuleGroup, error) {\n\tvar resource RuleGroup\n\terr := ctx.ReadResource(\"aws-native:networkfirewall:RuleGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "51f5e1050338959847ae149867ca366f", "score": "0.48306915", "text": "func (rs *rpcServer) GetGroup(ctx context.Context, req *charon.GetGroupRequest) (*charon.GetGroupResponse, error) {\n\th := &getGroupHandler{\n\t\thandler: newHandler(rs, ctx, \"get_group\"),\n\t}\n\th.addRequest(1)\n\n\tresp, err := h.handle(ctx, req)\n\th.handler.handle(err, \"group has been retrieved\")\n\n\treturn resp, err\n}", "title": "" }, { "docid": "f7c22f3dfcf3abe98dad5e6e97a9ed9d", "score": "0.48190793", "text": "func (c *PrivateNetworks) GetNetworkWithContext(ctx aws.Context, input *GetNetworkInput, opts ...request.Option) (*GetNetworkOutput, error) {\n\treq, out := c.GetNetworkRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "e18da1bd4099f0a2a02537db54a9076c", "score": "0.47528303", "text": "func (o *GroupV2GetMembersOfGroupParams) WithGroupID(groupID int64) *GroupV2GetMembersOfGroupParams {\n\to.SetGroupID(groupID)\n\treturn o\n}", "title": "" }, { "docid": "2a9f3c3086c930606fb371affa91dfa4", "score": "0.474729", "text": "func (c *Slb) AssociateCertificateWithGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.AssociateCertificateWithGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "520c01df27486d2e1813f0b4d8ebccfa", "score": "0.47446772", "text": "func GetGroup(c echo.Context) error {\n\tresult := models.GetGroups()\n\treturn c.JSON(http.StatusOK, result)\n}", "title": "" }, { "docid": "87bb176a6fd90d783a290c6bcce507c5", "score": "0.47239918", "text": "func (User) GetGroup(vars map[string]string) string {\n\tfmt.Println(\"vars\", vars)\n\treturn vars[\"group_id\"]\n}", "title": "" }, { "docid": "2ffb33c00a94b76ae8b6818ed46b3396", "score": "0.47199604", "text": "func (m *MockDaxClient) DescribeSubnetGroupsWithContext(ctx aws.Context, i *dax.DescribeSubnetGroupsInput, opts ...request.Option) (*dax.DescribeSubnetGroupsOutput, error) {\n\tm.Called.DescribeSubnetGroupsWithContext = append(m.Called.DescribeSubnetGroupsWithContext, &CallDescribeSubnetGroupsWithContext{Ctx: ctx, I: i, Opts: opts})\n\n\treturn m.MockDescribeSubnetGroupsWithContext(ctx, i, opts)\n}", "title": "" }, { "docid": "b8dd17822b62204d63435d76c5b21d19", "score": "0.47166103", "text": "func (o *GroupV2GetMembersOfGroupParams) WithContext(ctx context.Context) *GroupV2GetMembersOfGroupParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "594eb608c17a4b9a068f8bc310244e3b", "score": "0.47111508", "text": "func (c *Client) GetGroup(groupID string) (*GroupDTO, error) {\n\tresp, err := c.doGet(c.buildURL(\"/api/group/%s\", groupID))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer closeBody(resp)\n\n\tswitch resp.StatusCode {\n\tcase http.StatusOK:\n\t\treturn DTOFromReader[GroupDTO](resp.Body)\n\n\tcase http.StatusNotFound:\n\t\treturn nil, nil\n\n\tdefault:\n\t\treturn nil, errors.Errorf(\"failed with status code %d\", resp.StatusCode)\n\t}\n}", "title": "" }, { "docid": "8143bf10b2f5e62f63bd91055eb09d80", "score": "0.46926776", "text": "func (c *Client) DescribeServiceTemplateGroupsWithContext(ctx context.Context, request *DescribeServiceTemplateGroupsRequest) (response *DescribeServiceTemplateGroupsResponse, err error) {\n if request == nil {\n request = NewDescribeServiceTemplateGroupsRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"DescribeServiceTemplateGroups require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewDescribeServiceTemplateGroupsResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "efda19e6425857fea3ab5807405a9204", "score": "0.46901852", "text": "func (o *GetCategoriesGroupsGroupIDParams) WithGroupID(GroupID int64) *GetCategoriesGroupsGroupIDParams {\n\to.GroupID = GroupID\n\treturn o\n}", "title": "" }, { "docid": "183ca803225ee84e8f5cef409c009879", "score": "0.46783575", "text": "func (c *EC2) DescribeNetworkInterfaceAttributeWithContext(ctx aws.Context, input *DescribeNetworkInterfaceAttributeInput, opts ...request.Option) (*DescribeNetworkInterfaceAttributeOutput, error) {\n\treq, out := c.DescribeNetworkInterfaceAttributeRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "69f9eb9a1ef9d19068bfc6cd58027541", "score": "0.46618876", "text": "func (m *MockDaxClient) UpdateSubnetGroupWithContext(ctx aws.Context, i *dax.UpdateSubnetGroupInput, opts ...request.Option) (*dax.UpdateSubnetGroupOutput, error) {\n\tm.Called.UpdateSubnetGroupsWithContext = append(m.Called.UpdateSubnetGroupsWithContext, &CallUpdateSubnetGroupsWithContext{Ctx: ctx, I: i, Opts: opts})\n\n\treturn m.MockUpdateSubnetGroupWithContext(ctx, i, opts)\n}", "title": "" }, { "docid": "130a213f005f22c842b5004a699c3b3c", "score": "0.46598768", "text": "func (s *SubscribeInfo) GetGroup() string {\n\treturn s.group\n}", "title": "" }, { "docid": "58f9314df7122a3b90eaf1fcc8b71a46", "score": "0.46593797", "text": "func (c *Client) ModifyNetworkInterfaceAttributeWithContext(ctx context.Context, request *ModifyNetworkInterfaceAttributeRequest) (response *ModifyNetworkInterfaceAttributeResponse, err error) {\n if request == nil {\n request = NewModifyNetworkInterfaceAttributeRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifyNetworkInterfaceAttribute require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifyNetworkInterfaceAttributeResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "995a070b11e30cbeb6b71f4991ec492b", "score": "0.46354735", "text": "func (c *EC2) DescribeImageAttributeWithContext(ctx aws.Context, input *DescribeImageAttributeInput, opts ...request.Option) (*DescribeImageAttributeOutput, error) {\n\treq, out := c.DescribeImageAttributeRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "523fb4cf4e511e23e323385a689f82a3", "score": "0.4627987", "text": "func (c *bytemarkClient) GetGroup(name pathers.GroupName) (group brain.Group, err error) {\n\terr = c.EnsureGroupName(&name)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tr, err := c.BuildRequest(\"GET\", BrainEndpoint, \"/accounts/%s/groups/%s?view=overview&include_deleted=true\", string(name.Account), name.Group)\n\tif err != nil {\n\t\treturn\n\t}\n\n\t_, _, err = r.Run(nil, &group)\n\tif err != nil {\n\t\treturn\n\t}\n\treturn\n}", "title": "" }, { "docid": "f96dc0f53f378a4add75b11d3d9b313c", "score": "0.46276328", "text": "func NewUpdateAuthGroupParamsWithContext(ctx context.Context) *UpdateAuthGroupParams {\n\tvar ()\n\treturn &UpdateAuthGroupParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "8f74888ec0c0a58ead7fd61aa5772cc8", "score": "0.46185994", "text": "func NewGetLdapGroupsSearchParamsWithContext(ctx context.Context) *GetLdapGroupsSearchParams {\n\tvar ()\n\treturn &GetLdapGroupsSearchParams{\n\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "1635c2d400b377df39221db0e4136020", "score": "0.4611414", "text": "func (Thallium) GetGroup() string {\n\tvar g groupType = a3\n\treturn g.get()\n}", "title": "" }, { "docid": "fcaf75eccb56824bf0de214da3f7fa1f", "score": "0.46058357", "text": "func (c *Slb) ModifyAlbRuleGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.ModifyAlbRuleGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "5822ddfe69af227b93277224314204cf", "score": "0.46005908", "text": "func (c *Credentials) GetWithContext(ctx context.Context) (Value, error) {\n\t// Check if credentials are cached, and not expired.\n\tselect {\n\tcase curCreds, ok := <-c.asyncIsExpired():\n\t\t// ok will only be true, of the credentials were not expired. ok will\n\t\t// be false and have no value if the credentials are expired.\n\t\tif ok {\n\t\t\treturn curCreds, nil\n\t\t}\n\tcase <-ctx.Done():\n\t\treturn Value{}, awserr.New(\"RequestCanceled\",\n\t\t\t\"request context canceled\", ctx.Err())\n\t}\n\n\t// Cannot pass context down to the actual retrieve, because the first\n\t// context would cancel the whole group when there is not direct\n\t// association of items in the group.\n\tresCh := c.sf.DoChan(\"\", func() (interface{}, error) {\n\t\treturn c.singleRetrieve(&suppressedContext{ctx})\n\t})\n\tselect {\n\tcase res := <-resCh:\n\t\treturn res.Val.(Value), res.Err\n\tcase <-ctx.Done():\n\t\treturn Value{}, awserr.New(\"RequestCanceled\",\n\t\t\t\"request context canceled\", ctx.Err())\n\t}\n}", "title": "" }, { "docid": "6145dce5e4e780888bb75ac9b33900f6", "score": "0.45959413", "text": "func (gc *GroupsClient) GetGroup(GroupGUID string) (*groupResponse, error) {\n\tpath := versioned(groupPath(GroupGUID))\n\tgroupResp := &groupResponse{}\n\n\t_, err := gc.client.get(path, groupResp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn groupResp, nil\n}", "title": "" }, { "docid": "feb54247c01da6cfcd06a4e7518231e1", "score": "0.45952418", "text": "func GetAccessGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *AccessGroupState, opts ...pulumi.ResourceOption) (*AccessGroup, error) {\n\tvar resource AccessGroup\n\terr := ctx.ReadResource(\"cloudflare:index/accessGroup:AccessGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "9b7dc9d5e7d4faa285d5e57d868ef756", "score": "0.45897982", "text": "func NewMetroclusterDrGroupCollectionGetParamsWithContext(ctx context.Context) *MetroclusterDrGroupCollectionGetParams {\n\treturn &MetroclusterDrGroupCollectionGetParams{\n\t\tContext: ctx,\n\t}\n}", "title": "" }, { "docid": "ee6b2c2cd98fc2f2261eb1c41f920b6e", "score": "0.45895675", "text": "func (c *Client) GetGroupQuery(ctx context.Context, params *GetGroupQueryInput, optFns ...func(*Options)) (*GetGroupQueryOutput, error) {\n\tif params == nil {\n\t\tparams = &GetGroupQueryInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"GetGroupQuery\", params, optFns, addOperationGetGroupQueryMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*GetGroupQueryOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "3653cae522efe4ac07a8e472437d9627", "score": "0.4576953", "text": "func (t *ConfigSnapshot) GetGroup(name string) (Group, bool) {\n\tgroup, ok := t.groupsByName[name]\n\treturn group, ok\n}", "title": "" }, { "docid": "3653cae522efe4ac07a8e472437d9627", "score": "0.4576953", "text": "func (t *ConfigSnapshot) GetGroup(name string) (Group, bool) {\n\tgroup, ok := t.groupsByName[name]\n\treturn group, ok\n}", "title": "" }, { "docid": "c472c6f7bd11c1afa76a4d6b2d1d78aa", "score": "0.45746455", "text": "func (c *Shield) ListResourcesInProtectionGroupWithContext(ctx aws.Context, input *ListResourcesInProtectionGroupInput, opts ...request.Option) (*ListResourcesInProtectionGroupOutput, error) {\n\treq, out := c.ListResourcesInProtectionGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "fc27d3e76695d23be2bae38144483ac3", "score": "0.4574378", "text": "func (c *MemoryDB) ResetParameterGroupWithContext(ctx aws.Context, input *ResetParameterGroupInput, opts ...request.Option) (*ResetParameterGroupOutput, error) {\n\treq, out := c.ResetParameterGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "0a0ff1d930f0e86afa3e3e28fc327915", "score": "0.45725185", "text": "func (c *EC2) GetVerifiedAccessGroupPolicyWithContext(ctx aws.Context, input *GetVerifiedAccessGroupPolicyInput, opts ...request.Option) (*GetVerifiedAccessGroupPolicyOutput, error) {\n\treq, out := c.GetVerifiedAccessGroupPolicyRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "0bf7abb20980a73f4c4ce23263ac3e7c", "score": "0.45622042", "text": "func (c *Kec) ModifyScalingGroupWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.ModifyScalingGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "8665334af8d53cfba2ff63f82aca4872", "score": "0.45576423", "text": "func (Osmium) GetGroup() string {\n\tvar g groupType = b8\n\treturn g.get()\n}", "title": "" }, { "docid": "a16bd0b2f7611f77fb7f9f3d6f1c1803", "score": "0.45457846", "text": "func (s *DisassociateAttributeGroupOutput) SetAttributeGroupArn(v string) *DisassociateAttributeGroupOutput {\n\ts.AttributeGroupArn = &v\n\treturn s\n}", "title": "" }, { "docid": "f564a8cb5d6e35b52688be07fe4cca7f", "score": "0.45442814", "text": "func (s *AssociateAttributeGroupOutput) SetAttributeGroupArn(v string) *AssociateAttributeGroupOutput {\n\ts.AttributeGroupArn = &v\n\treturn s\n}", "title": "" }, { "docid": "81c4b710a3a869ed28b182372f21c8a3", "score": "0.45442688", "text": "func (o *GroupV2GetMembersOfGroupParams) WithHTTPClient(client *http.Client) *GroupV2GetMembersOfGroupParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "fcf0d5c5f9ad6f325cfbbaea326b0ded", "score": "0.45427114", "text": "func GetModelPackageGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ModelPackageGroupState, opts ...pulumi.ResourceOption) (*ModelPackageGroup, error) {\n\tvar resource ModelPackageGroup\n\terr := ctx.ReadResource(\"aws:sagemaker/modelPackageGroup:ModelPackageGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "f744b0fb19baaf4ed7753e4d04090509", "score": "0.45374954", "text": "func (o *MetroclusterDrGroupCollectionGetParams) WithContext(ctx context.Context) *MetroclusterDrGroupCollectionGetParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "856e46e7596b7e380b4952923a961ab8", "score": "0.45368546", "text": "func (c *AppRegistry) ListAttributeGroupsForApplicationWithContext(ctx aws.Context, input *ListAttributeGroupsForApplicationInput, opts ...request.Option) (*ListAttributeGroupsForApplicationOutput, error) {\n\treq, out := c.ListAttributeGroupsForApplicationRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "d305a630a04bb66f9275d55be46daa36", "score": "0.45361558", "text": "func GetGroupMembership(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *GroupMembershipState, opts ...pulumi.ResourceOption) (*GroupMembership, error) {\n\tvar resource GroupMembership\n\terr := ctx.ReadResource(\"alicloud:ram/groupMembership:GroupMembership\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "2fce76bc2f292c068a0b373747964e9c", "score": "0.4522001", "text": "func (c *Eleum) GetWithContext(parentCtx context.Context, key string, value interface{}) error {\n\tctx, cancel := context.WithTimeout(parentCtx, c.readTimeout)\n\tdefer cancel()\n\tdone := make(chan execControl)\n\n\tgo func(done chan<- execControl) {\n\t\terr := c.Get(key, value)\n\t\tdone <- execControl{err: err}\n\t\treturn\n\t}(done)\n\n\tselect {\n\tcase resp := <-done:\n\t\treturn resp.err\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\t}\n}", "title": "" }, { "docid": "60ce5587b97bd4d4a42d8b41607dc608", "score": "0.4518618", "text": "func (c *Client) ModifyOriginGroupWithContext(ctx context.Context, request *ModifyOriginGroupRequest) (response *ModifyOriginGroupResponse, err error) {\n if request == nil {\n request = NewModifyOriginGroupRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"ModifyOriginGroup require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewModifyOriginGroupResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "fe39f3df89225bbfe798b4041d1a130e", "score": "0.45166793", "text": "func (c *AppRegistry) CreateAttributeGroupWithContext(ctx aws.Context, input *CreateAttributeGroupInput, opts ...request.Option) (*CreateAttributeGroupOutput, error) {\n\treq, out := c.CreateAttributeGroupRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "2c292b29ad92f27481e02c878bbbc4bd", "score": "0.45149142", "text": "func (c *Slb) DescribeAlbRuleGroupsWithContext(ctx aws.Context, input *map[string]interface{}, opts ...request.Option) (*map[string]interface{}, error) {\n\treq, out := c.DescribeAlbRuleGroupsRequest(input)\n\treq.SetContext(ctx)\n\treq.ApplyOptions(opts...)\n\treturn out, req.Send()\n}", "title": "" }, { "docid": "bb0012a888eb7a6467f3243ee440e737", "score": "0.45014396", "text": "func GetActionGroup(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *ActionGroupState, opts ...pulumi.ResourceOption) (*ActionGroup, error) {\n\tvar resource ActionGroup\n\terr := ctx.ReadResource(\"azure:monitoring/actionGroup:ActionGroup\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "75b9ed1ab9d895f8f5eac1d19107cc51", "score": "0.4500544", "text": "func ExtractGroupKey(ctx context.Context) (Key, error) {\n\tkey, ok := GroupKey(ctx)\n\tif !ok {\n\t\treturn \"\", errors.Errorf(\"group key missing\")\n\t}\n\treturn Key(key), nil\n}", "title": "" }, { "docid": "fe4ab478c87a4011d420994c9b65fada", "score": "0.44997332", "text": "func (c *SharedLinksClient) GetWithContext(ctx context.Context, in *SharedLinksRequestsGet) (*SharedLinkDetails, error) {\n\tout, err := c.pb.Get(ctx, convertFromSharedLinksRequestsGetPtr(in))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn convertToSharedLinkDetailsPtr(out), nil\n}", "title": "" }, { "docid": "70924735db7e74e74cd4a334559a328f", "score": "0.44969255", "text": "func (c *Client) DescribeAddressTemplateGroupsWithContext(ctx context.Context, request *DescribeAddressTemplateGroupsRequest) (response *DescribeAddressTemplateGroupsResponse, err error) {\n if request == nil {\n request = NewDescribeAddressTemplateGroupsRequest()\n }\n \n if c.GetCredential() == nil {\n return nil, errors.New(\"DescribeAddressTemplateGroups require credential\")\n }\n\n request.SetContext(ctx)\n \n response = NewDescribeAddressTemplateGroupsResponse()\n err = c.Send(request, response)\n return\n}", "title": "" }, { "docid": "05c1da179e44fca764fc2d802b1db740", "score": "0.4489035", "text": "func (vi VoiceIt2) GetGroup(groupId string) ([]byte, error) {\n\treq, err := http.NewRequest(\"GET\", vi.BaseUrl+\"/groups/\"+groupId+vi.NotificationUrl, nil)\n\tif err != nil {\n\t\treturn []byte{}, errors.New(\"GetGroup Exception: \" + err.Error())\n\t}\n\treq.SetBasicAuth(vi.APIKey, vi.APIToken)\n\treq.Header.Add(\"platformId\", PlatformId)\n\treq.Header.Add(\"platformVersion\", PlatformVersion)\n\n\tclient := &http.Client{}\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn []byte{}, errors.New(\"GetGroup Exception: \" + err.Error())\n\t}\n\tdefer resp.Body.Close()\n\treply, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn []byte{}, errors.New(\"GetGroup Exception: \" + err.Error())\n\t}\n\treturn reply, nil\n}", "title": "" }, { "docid": "ef8765b76c8eb3014594f5f7685c1223", "score": "0.44883397", "text": "func (ms *ClusterKvStateMachine) BlockGroupGet(key uint64) (*vp.BlockGroup, error) {\n\t// if !ms.raft.IsLeader(1) {\n\t// \treturn nil, errors.New(\"not leader\")\n\t// }\n\n\tvar item btreeinstance.BlockGroupKV\n\titem.K = key\n\tnewItem := ms.blockGroupData.Get(item)\n\n\tif newItem == nil {\n\t\treturn nil, errNotExists\n\t}\n\tblockGroup := &vp.BlockGroup{}\n\terr := pbproto.Unmarshal(newItem.(btreeinstance.BlockGroupKV).V, blockGroup)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn blockGroup, nil\n}", "title": "" } ]
74b82ce50111382cd72c2877515b7a2a
SetCertainAgreementID sets the "certain_agreement" edge to the CertainAgreement entity by ID.
[ { "docid": "bafe29d6f60f321bf7a4002a28ef10a4", "score": "0.819112", "text": "func (mimc *MoreInfoModuleCreate) SetCertainAgreementID(id int) *MoreInfoModuleCreate {\n\tmimc.mutation.SetCertainAgreementID(id)\n\treturn mimc\n}", "title": "" } ]
[ { "docid": "d361fe647a4400b1d04926ed0b7cd8ad", "score": "0.8318309", "text": "func (mimu *MoreInfoModuleUpdate) SetCertainAgreementID(id int) *MoreInfoModuleUpdate {\n\tmimu.mutation.SetCertainAgreementID(id)\n\treturn mimu\n}", "title": "" }, { "docid": "4dc63310df6d8cc9db0d8c28db8c8d2d", "score": "0.82969296", "text": "func (mimuo *MoreInfoModuleUpdateOne) SetCertainAgreementID(id int) *MoreInfoModuleUpdateOne {\n\tmimuo.mutation.SetCertainAgreementID(id)\n\treturn mimuo\n}", "title": "" }, { "docid": "02d44b4b8a9f075c340017e6740de384", "score": "0.7053438", "text": "func (mimc *MoreInfoModuleCreate) SetCertainAgreement(c *CertainAgreement) *MoreInfoModuleCreate {\n\treturn mimc.SetCertainAgreementID(c.ID)\n}", "title": "" }, { "docid": "8e7e526e550abd71a22820963f107ffe", "score": "0.70362294", "text": "func (mimuo *MoreInfoModuleUpdateOne) SetCertainAgreement(c *CertainAgreement) *MoreInfoModuleUpdateOne {\n\treturn mimuo.SetCertainAgreementID(c.ID)\n}", "title": "" }, { "docid": "9f1fff909515d229ddc0160e2c9b54e1", "score": "0.70249915", "text": "func (mimu *MoreInfoModuleUpdate) SetCertainAgreement(c *CertainAgreement) *MoreInfoModuleUpdate {\n\treturn mimu.SetCertainAgreementID(c.ID)\n}", "title": "" }, { "docid": "0f465020c84199e82d81ad841f86952a", "score": "0.5920203", "text": "func (s *Service) SetAgreement(clickwrapID string, agreement *UserAgreement) *SetAgreementOp {\n\treturn &SetAgreementOp{\n\t\tCredential: s.credential,\n\t\tMethod: \"POST\",\n\t\tPath: strings.Join([]string{\"clickwraps\", clickwrapID, \"versions\"}, \"/\"),\n\t\tPayload: agreement,\n\t\tQueryOpts: make(url.Values),\n\t\tVersion: clickV1,\n\t}\n}", "title": "" }, { "docid": "08052ff3d4cf6898d581dcb05e31683e", "score": "0.5282247", "text": "func (mimc *MoreInfoModuleCreate) SetNillableCertainAgreementID(id *int) *MoreInfoModuleCreate {\n\tif id != nil {\n\t\tmimc = mimc.SetCertainAgreementID(*id)\n\t}\n\treturn mimc\n}", "title": "" }, { "docid": "9ab9dcc55cde27208a97cbca887b1f94", "score": "0.5207846", "text": "func (mimu *MoreInfoModuleUpdate) SetNillableCertainAgreementID(id *int) *MoreInfoModuleUpdate {\n\tif id != nil {\n\t\tmimu = mimu.SetCertainAgreementID(*id)\n\t}\n\treturn mimu\n}", "title": "" }, { "docid": "11b31a9df9b76320088098a3845ce050", "score": "0.50987196", "text": "func SetSubjectKeyID(id []byte) Option {\n\treturn func(c *mycert) error {\n\t\tc.cert.SubjectKeyId = id\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3729d9d576ffbb69dbed1f82a019bdb1", "score": "0.5058086", "text": "func (mimuo *MoreInfoModuleUpdateOne) SetNillableCertainAgreementID(id *int) *MoreInfoModuleUpdateOne {\n\tif id != nil {\n\t\tmimuo = mimuo.SetCertainAgreementID(*id)\n\t}\n\treturn mimuo\n}", "title": "" }, { "docid": "24141a55f8633e406ec829e1ed9d92e2", "score": "0.4955301", "text": "func (m *PersonCertification) SetCertificationId(value *string)() {\n err := m.GetBackingStore().Set(\"certificationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a5c232244bef1f5dfe4ccdc699a3ea6c", "score": "0.48978722", "text": "func (au *ActivitiesUpdate) SetAcademicyearID(id int) *ActivitiesUpdate {\n\tau.mutation.SetAcademicyearID(id)\n\treturn au\n}", "title": "" }, { "docid": "1f9976024ad2eb18911d059cfa3df476", "score": "0.48873317", "text": "func (o *PostLhvAssociationIDMasterAccountsParams) SetAssociationID(associationID strfmt.UUID) {\n\to.AssociationID = associationID\n}", "title": "" }, { "docid": "d420e3ee1681bd0c506270f1eed72a61", "score": "0.4884149", "text": "func (keeper Keeper) setProposalID(ctx sdk.Context, proposalID uint64) {\n\tstore := ctx.KVStore(keeper.storeKey)\n\tbz := keeper.cdc.MustMarshalBinaryLengthPrefixed(proposalID)\n\tstore.Set(ProposalIDKey, bz)\n}", "title": "" }, { "docid": "505658efbc99581e769db61669ea2af7", "score": "0.48731154", "text": "func (auo *ActivitiesUpdateOne) SetAcademicyearID(id int) *ActivitiesUpdateOne {\n\tauo.mutation.SetAcademicyearID(id)\n\treturn auo\n}", "title": "" }, { "docid": "c8c0cd386cf68df388ced733d51795ba", "score": "0.48016843", "text": "func (t *Txn) SetCuratorID(id core.CuratorID) {\n\tvar b [4]byte\n\tbinary.BigEndian.PutUint32(b[:], uint32(id))\n\tt.put(metaBucket, curatorIDKey, b[:], defaultFillPct)\n}", "title": "" }, { "docid": "73495e81fdee8b3ebe99097effb3323f", "score": "0.47875276", "text": "func (c *CertainAgreementClient) UpdateOneID(id int) *CertainAgreementUpdateOne {\n\tmutation := newCertainAgreementMutation(c.config, OpUpdateOne, withCertainAgreementID(id))\n\treturn &CertainAgreementUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation}\n}", "title": "" }, { "docid": "23c534936d1f7a3ee788ab0c035ff3f8", "score": "0.4787188", "text": "func (cc *CourseCreate) SetDegreeIDID(id int) *CourseCreate {\n\tcc.mutation.SetDegreeIDID(id)\n\treturn cc\n}", "title": "" }, { "docid": "00389936ef1b54d33f1275f51d8173d0", "score": "0.4756114", "text": "func (m *ActivitiesMutation) SetAcademicyearID(id int) {\n\tm.academicyear = &id\n}", "title": "" }, { "docid": "fb7bdb4402e24d276a1892ae42d48ddb", "score": "0.47507638", "text": "func NewAgreementID(val string) AgreementIDField {\n\treturn AgreementIDField{quickfix.FIXString(val)}\n}", "title": "" }, { "docid": "02e2e948c170cf46907127daf6d95eb9", "score": "0.47423434", "text": "func (t *Term) SetCoeffID(cID int) {\n\t_coeffID := uint64(cID)\n\tif (_coeffID & (maskCoeffID >> shiftCoeffID)) != uint64(cID) {\n\t\tpanic(\"coeffID is too large, unsupported\")\n\t}\n\t_coeffID <<= shiftCoeffID\n\t*t = Term((uint64(*t) & (^maskCoeffID)) | _coeffID)\n}", "title": "" }, { "docid": "02e2e948c170cf46907127daf6d95eb9", "score": "0.47423434", "text": "func (t *Term) SetCoeffID(cID int) {\n\t_coeffID := uint64(cID)\n\tif (_coeffID & (maskCoeffID >> shiftCoeffID)) != uint64(cID) {\n\t\tpanic(\"coeffID is too large, unsupported\")\n\t}\n\t_coeffID <<= shiftCoeffID\n\t*t = Term((uint64(*t) & (^maskCoeffID)) | _coeffID)\n}", "title": "" }, { "docid": "02e2e948c170cf46907127daf6d95eb9", "score": "0.47423434", "text": "func (t *Term) SetCoeffID(cID int) {\n\t_coeffID := uint64(cID)\n\tif (_coeffID & (maskCoeffID >> shiftCoeffID)) != uint64(cID) {\n\t\tpanic(\"coeffID is too large, unsupported\")\n\t}\n\t_coeffID <<= shiftCoeffID\n\t*t = Term((uint64(*t) & (^maskCoeffID)) | _coeffID)\n}", "title": "" }, { "docid": "408bc18a2ba06ad9c78cc25b4b3f77fc", "score": "0.47207892", "text": "func (c *MoreInfoModuleClient) QueryCertainAgreement(mim *MoreInfoModule) *CertainAgreementQuery {\n\tquery := &CertainAgreementQuery{config: c.config}\n\tquery.path = func(ctx context.Context) (fromV *sql.Selector, _ error) {\n\t\tid := mim.ID\n\t\tstep := sqlgraph.NewStep(\n\t\t\tsqlgraph.From(moreinfomodule.Table, moreinfomodule.FieldID, id),\n\t\t\tsqlgraph.To(certainagreement.Table, certainagreement.FieldID),\n\t\t\tsqlgraph.Edge(sqlgraph.M2O, false, moreinfomodule.CertainAgreementTable, moreinfomodule.CertainAgreementColumn),\n\t\t)\n\t\tfromV = sqlgraph.Neighbors(mim.driver.Dialect(), step)\n\t\treturn fromV, nil\n\t}\n\treturn query\n}", "title": "" }, { "docid": "5068230b4f122071899a6e6261db3df1", "score": "0.4691014", "text": "func NewCertainAgreementClient(c config) *CertainAgreementClient {\n\treturn &CertainAgreementClient{config: c}\n}", "title": "" }, { "docid": "c07a9b6f29af09cffd1f07793370ff24", "score": "0.46275616", "text": "func (s *DescribeDirectConnectGatewayAssociationsInput) SetAssociationId(v string) *DescribeDirectConnectGatewayAssociationsInput {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "ca27d7b35036f8ba790049179213fc29", "score": "0.46196038", "text": "func (tx *Transaction) SetID() {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencoder := gob.NewEncoder(&encoded)\n\tencoder.Encode(tx)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.TXid = hash[:]\n}", "title": "" }, { "docid": "55d51139f4a578d9d96bc2c14afeb512", "score": "0.4604739", "text": "func (o *ModifyCryptokeyParams) SetCryptokeyID(cryptokeyID string) {\n\to.CryptokeyID = cryptokeyID\n}", "title": "" }, { "docid": "0633d7dd9860495d0230df96ccbf7a8b", "score": "0.4603873", "text": "func (s *GatewayAssociation) SetAssociationId(v string) *GatewayAssociation {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "cc0293c5f6dd7176d51772a00b532718", "score": "0.4601853", "text": "func (m *DetailMutation) SetCourseID(id int) {\n\tm.course = &id\n}", "title": "" }, { "docid": "36bd6bd3a24a2c604742354f667e6000", "score": "0.4600963", "text": "func (ksc *KeyStoreCreate) SetCoinID(id int32) *KeyStoreCreate {\n\tksc.mutation.SetCoinID(id)\n\treturn ksc\n}", "title": "" }, { "docid": "543ccc1ce99e075967a5cc181951d2c7", "score": "0.4590113", "text": "func (tx *Transaction) SetID() {\n\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\tencode := gob.NewEncoder(&encoded)\n\terr := encode.Encode(tx)\n\tHandleErr(err)\n\thash = sha256.Sum256(encoded.Bytes())\n\ttx.ID = hash[:]\n\n}", "title": "" }, { "docid": "256f40c9cee3a5d379429dddbad36069", "score": "0.45846003", "text": "func (e *Edge) SetID(i string) {\n\te.ID = graph.Identifier(i)\n}", "title": "" }, { "docid": "ef5da2271d9a594af3ff6251139f6a58", "score": "0.45802855", "text": "func (s *RepositoryAssociation) SetAssociationId(v string) *RepositoryAssociation {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "0406c248be746362ea8d34d13c91c03d", "score": "0.455575", "text": "func (m *TrainingMutation) SetCourseID(id int) {\n\tm.course = &id\n}", "title": "" }, { "docid": "31692b8337dbf95fa6807846619e987b", "score": "0.45505285", "text": "func (s *UpdateDirectConnectGatewayAssociationInput) SetAssociationId(v string) *UpdateDirectConnectGatewayAssociationInput {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "9293e50d4bc2717a621650b6b96d66de", "score": "0.45241687", "text": "func (m *GovernanceRoleAssignmentRequest) SetSubjectId(value *string)() {\n err := m.GetBackingStore().Set(\"subjectId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "e08bfb61d28c6296213f73f4760da993", "score": "0.4504679", "text": "func (tx *Transaction) SetID() {\r\n\tvar encoded bytes.Buffer\r\n\tvar hash [32]byte\r\n\r\n\tenc := gob.NewEncoder(&encoded)\r\n\terr := enc.Encode(tx)\r\n\tif err != nil {\r\n\t\tlog.Panic(err)\r\n\t}\r\n\thash = sha256.Sum256(encoded.Bytes())\r\n\ttx.ID = hash[:]\r\n}", "title": "" }, { "docid": "b1dee604bde89aae648afb32fe7439ea", "score": "0.4503929", "text": "func (c *CertainAgreementClient) Get(ctx context.Context, id int) (*CertainAgreement, error) {\n\treturn c.Query().Where(certainagreement.ID(id)).Only(ctx)\n}", "title": "" }, { "docid": "8b4cf84a53b7970b4b299f83cb6a1e38", "score": "0.44851518", "text": "func (s *RepositoryAssociationSummary) SetAssociationId(v string) *RepositoryAssociationSummary {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "2780456ece03cf7c6ed23b3ab43eeb18", "score": "0.44826505", "text": "func (s *DeleteDirectConnectGatewayAssociationInput) SetAssociationId(v string) *DeleteDirectConnectGatewayAssociationInput {\n\ts.AssociationId = &v\n\treturn s\n}", "title": "" }, { "docid": "a922ccc3b9955edaa37537c33b7a2d9d", "score": "0.44819278", "text": "func (tc *TrainingCreate) SetCourseID(id int) *TrainingCreate {\n\ttc.mutation.SetCourseID(id)\n\treturn tc\n}", "title": "" }, { "docid": "8c3c4930b4f464516ac8d5ef64462c0b", "score": "0.44816783", "text": "func (t *Transaction) SetID() error {\n\tvar encoded bytes.Buffer\n\tvar hash [32]byte\n\n\tenc := gob.NewEncoder(&encoded)\n\terr := enc.Encode(t)\n\tif err != nil {\n\t\treturn err\n\t}\n\thash = sha256.Sum256(encoded.Bytes())\n\tt.ID = hash[:]\n\treturn nil\n}", "title": "" }, { "docid": "42d65db7d4ece2d69f74e910c3902c2d", "score": "0.44721767", "text": "func (m Message) AgreementID() (*field.AgreementIDField, quickfix.MessageRejectError) {\n\tf := &field.AgreementIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "42d65db7d4ece2d69f74e910c3902c2d", "score": "0.44721767", "text": "func (m Message) AgreementID() (*field.AgreementIDField, quickfix.MessageRejectError) {\n\tf := &field.AgreementIDField{}\n\terr := m.Body.Get(f)\n\treturn f, err\n}", "title": "" }, { "docid": "7230207c0414ea0093d49d497b3ead48", "score": "0.44422573", "text": "func SetTransactionID(id string) CompleteSaleOption {\n\treturn func(r *CompleteSaleRequest) error {\n\t\tr.TransactionID = id\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "bc99b9a0a8823a99e87ecc69cf39f093", "score": "0.44409773", "text": "func (cu *ConnectivityUpdate) SetEventID(id uuid.UUID) *ConnectivityUpdate {\n\tcu.mutation.SetEventID(id)\n\treturn cu\n}", "title": "" }, { "docid": "24e566df6c7c00214d8a1edf2e83fa96", "score": "0.44313127", "text": "func NewAgreement(agreementid string, org string, deviceid string, deviceType string, policyName string, bcType string, bcName string, bcOrg string, agreementProto string, pattern string, serviceId []string, nhPolicy policy.NodeHealth, protocolTimeout uint64, agreementTimeout uint64) (*Agreement, error) {\n\tif agreementid == \"\" || agreementProto == \"\" {\n\t\treturn nil, errors.New(\"Illegal input: agreement id or agreement protocol is empty\")\n\t} else {\n\t\treturn &Agreement{\n\t\t\tCurrentAgreementId: agreementid,\n\t\t\tOrg: org,\n\t\t\tDeviceId: deviceid,\n\t\t\tDeviceType: deviceType,\n\t\t\tAgreementProtocol: agreementProto,\n\t\t\tAgreementProtocolVersion: 0,\n\t\t\tAgreementInceptionTime: uint64(time.Now().Unix()),\n\t\t\tAgreementCreationTime: 0,\n\t\t\tAgreementFinalizedTime: 0,\n\t\t\tAgreementTimedout: 0,\n\t\t\tProposalSig: \"\",\n\t\t\tProposal: \"\",\n\t\t\tProposalHash: \"\",\n\t\t\tConsumerProposalSig: \"\",\n\t\t\tPolicy: \"\",\n\t\t\tPolicyName: policyName,\n\t\t\tCounterPartyAddress: \"\",\n\t\t\tDataVerificationURL: \"\",\n\t\t\tDataVerificationUser: \"\",\n\t\t\tDataVerificationPW: \"\",\n\t\t\tDataVerificationCheckRate: 0,\n\t\t\tDataVerificationNoDataInterval: 0,\n\t\t\tDisableDataVerificationChecks: false,\n\t\t\tDataVerifiedTime: 0,\n\t\t\tDataNotificationSent: 0,\n\t\t\tMeteringTokens: 0,\n\t\t\tMeteringPerTimeUnit: \"\",\n\t\t\tMeteringNotificationInterval: 0,\n\t\t\tMeteringNotificationSent: 0,\n\t\t\tMeteringNotificationMsgs: []string{\"\", \"\"},\n\t\t\tArchived: false,\n\t\t\tTerminatedReason: 0,\n\t\t\tTerminatedDescription: \"\",\n\t\t\tBlockchainType: bcType,\n\t\t\tBlockchainName: bcName,\n\t\t\tBlockchainOrg: bcOrg,\n\t\t\tBCUpdateAckTime: 0,\n\t\t\tNHMissingHBInterval: nhPolicy.MissingHBInterval,\n\t\t\tNHCheckAgreementStatus: nhPolicy.CheckAgreementStatus,\n\t\t\tPattern: pattern,\n\t\t\tServiceId: serviceId,\n\t\t\tProtocolTimeoutS: protocolTimeout,\n\t\t\tAgreementTimeoutS: agreementTimeout,\n\t\t}, nil\n\t}\n}", "title": "" }, { "docid": "b8ee428f3c33fd2cdf6f52fff1e0e501", "score": "0.44086123", "text": "func (o *GetOryAccessControlPolicyParams) SetID(id string) {\n\to.ID = id\n}", "title": "" }, { "docid": "922c6deea166131a6ffe19ed1d60340b", "score": "0.44021735", "text": "func (o AgreementOutput) AgreementId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Agreement) pulumi.StringOutput { return v.AgreementId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "543656baa4512c59ee541528de4d6b21", "score": "0.43855295", "text": "func (k Keeper) setInvoiceID(ctx sdk.Context, invoiceID uint64) {\r\n\tstore := k.store(ctx)\r\n\tbz := k.codec.MustMarshalBinaryLengthPrefixed(invoiceID)\r\n\tstore.Set(InvoiceIDKey, bz)\r\n}", "title": "" }, { "docid": "e62d6fd403b9eac17b489f040cf6280f", "score": "0.43825185", "text": "func (m *RecommendationsMutation) SetUserApprobedID(id int) {\n\tm._UserApprobed = &id\n}", "title": "" }, { "docid": "4b3aaaaccd324e70add9f2bf57725db9", "score": "0.4365223", "text": "func (cuo *ConnectivityUpdateOne) SetEventID(id uuid.UUID) *ConnectivityUpdateOne {\n\tcuo.mutation.SetEventID(id)\n\treturn cuo\n}", "title": "" }, { "docid": "0d8808bcbc8f94f8c43ea0624efaab3e", "score": "0.43615893", "text": "func (o *DeleteCryptokeyParams) SetCryptokeyID(cryptokeyID string) {\n\to.CryptokeyID = cryptokeyID\n}", "title": "" }, { "docid": "88672df89ede2b1800e93a4e18a61726", "score": "0.43536744", "text": "func (m *UserMutation) SetUserExpertiseID(id int) {\n\tm._UserExpertise = &id\n}", "title": "" }, { "docid": "3dda7d017b12f2db9baadb2a460d5c6c", "score": "0.43424478", "text": "func SetCorrelationID(correlationID string) Option {\n\treturn publisheropts.SetCorrelationID(correlationID)\n}", "title": "" }, { "docid": "1f596c22eade09fa0f63ee2b73fe16ad", "score": "0.43423137", "text": "func (m *AudioConferencing) SetConferenceId(value *string)() {\n err := m.GetBackingStore().Set(\"conferenceId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "48c7d96e1100f41a6348d606a91d9944", "score": "0.43383062", "text": "func (m NoSettlPartyIDs) SetSettlPartyID(v string) {\n\tm.Set(field.NewSettlPartyID(v))\n}", "title": "" }, { "docid": "5e8b6619668ce5bd32d2857a2a67c40a", "score": "0.43267", "text": "func (n *Node) SetID(i string) {\n\tn.ID = graph.Identifier(i)\n}", "title": "" }, { "docid": "d1362422c0ce8444f4c8ff35d84d18f9", "score": "0.43224877", "text": "func (p *ProtocolHandler) InitiateAgreement(agreementId string,\n\tproducerPolicy *policy.Policy,\n\tconsumerPolicy *policy.Policy,\n\torg string,\n\tmyId string,\n\tmessageTarget interface{},\n\tworkload *policy.Workload,\n\tdefaultPW string,\n\tdefaultNoData uint64,\n\tsendMessage func(msgTarget interface{}, pay []byte) error) (abstractprotocol.Proposal, error) {\n\n\t// Determine which protocol version to use.\n\tprotocolVersion := producerPolicy.MinimumProtocolVersion(p.Name(), consumerPolicy, PROTOCOL_CURRENT_VERSION)\n\n\t// Create a proposal and augment it with the additional data we need in this protocol.\n\tvar newProposal *CSProposal\n\n\tif bp, err := abstractprotocol.CreateProposal(p, agreementId, producerPolicy, consumerPolicy, protocolVersion, myId, workload, defaultPW, defaultNoData); err != nil {\n\t\treturn nil, err\n\t} else if protocolVersion == 2 {\n\t\tnewProposal = NewCSProposal(bp, \"\")\n\t} else {\n\t\tnewProposal = NewCSProposal(bp, p.MyAddress)\n\t}\n\n\t// Send the proposal to the other party\n\tglog.V(5).Infof(\"Protocol %v sending proposal %s\", p.Name(), newProposal)\n\n\tif err := abstractprotocol.SendProposal(p, newProposal, consumerPolicy, org, messageTarget, sendMessage); err != nil {\n\t\treturn nil, err\n\t}\n\treturn newProposal, nil\n\n}", "title": "" }, { "docid": "0926fff2c588b5722d7cbd3817fdac46", "score": "0.43171346", "text": "func (o *GetCryptokeyParams) SetCryptokeyID(cryptokeyID string) {\n\to.CryptokeyID = cryptokeyID\n}", "title": "" }, { "docid": "65c036d567ef0c24330dd624f59b8f80", "score": "0.43006954", "text": "func (n *Node) SetID(id int) {\n\tn.id = id\n}", "title": "" }, { "docid": "28b0d594678af69df596d7c20431a44d", "score": "0.42925912", "text": "func (b *Base) SetOrgID(id influxdb.ID) {\n\tb.OrgID = id\n}", "title": "" }, { "docid": "28b0d594678af69df596d7c20431a44d", "score": "0.42925912", "text": "func (b *Base) SetOrgID(id influxdb.ID) {\n\tb.OrgID = id\n}", "title": "" }, { "docid": "6c2e2da63ab44bada481124bd4e61e31", "score": "0.42921036", "text": "func (e *ServerEvent) SetAccountID(id string) {\n\te.Spec.AccountID = id\n}", "title": "" }, { "docid": "fadf24b86da6867fba1425e2fae2b8ee", "score": "0.42903545", "text": "func (cc *CourseCreate) SetDegreeID(d *Degree) *CourseCreate {\n\treturn cc.SetDegreeIDID(d.ID)\n}", "title": "" }, { "docid": "e86b93f894a06190ca386a0b6f91c91b", "score": "0.42886865", "text": "func (n Now) SetTeamID(teamID string) {\n\tn.client.teamID = teamID\n}", "title": "" }, { "docid": "3ea781db89f8ba54b77b99506cbd04c3", "score": "0.4275532", "text": "func (m NoAllocs) SetIndividualAllocID(v string) {\n\tm.Set(field.NewIndividualAllocID(v))\n}", "title": "" }, { "docid": "6ee642c45aebdad9877f16e25918768b", "score": "0.42743346", "text": "func (s *ChainState) SetChainID(store KVStore, chainID string) {\n\ts.chainID = chainID\n\tstore.Set([]byte(\"base/chain_id\"), []byte(chainID))\n}", "title": "" }, { "docid": "1bbb8d51f338f782c31cbe03b4b33f09", "score": "0.42650366", "text": "func (b *GraphServiceAgreementsCollectionRequestBuilder) ID(id string) *AgreementRequestBuilder {\n\tbb := &AgreementRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "3cd9300174d26134aa62b7b2f8cf1c38", "score": "0.4263155", "text": "func (c *Caller) SetWalletID(id string) {\n\tc.walletID = id\n}", "title": "" }, { "docid": "572b34140aeb8a303f9b4e8f3aa53da1", "score": "0.4262504", "text": "func (f *Flags) SetProviderID(providerID string) {\n\tf.providerID = providerID\n}", "title": "" }, { "docid": "e0ff2e1fc3c45f905f032671daf83d81", "score": "0.42450383", "text": "func (m *UnifiedRoleAssignment) SetPrincipalOrganizationId(value *string)() {\n err := m.GetBackingStore().Set(\"principalOrganizationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "56f32d5d2cc7e821928bd10ce1e8b474", "score": "0.4239334", "text": "func (h Header) SetOnBehalfOfSubID(v string) {\n\th.Set(field.NewOnBehalfOfSubID(v))\n}", "title": "" }, { "docid": "678d54e0e9cd23fd65f6e5b7443caab3", "score": "0.4236061", "text": "func (iu *InviteeUpdate) SetPartyID(id int) *InviteeUpdate {\n\tiu.mutation.SetPartyID(id)\n\treturn iu\n}", "title": "" }, { "docid": "026e16c418aead3bb8a4e33e274f57fe", "score": "0.42329633", "text": "func (m *ScholarshipMutation) SetEducationlevelIDID(id int) {\n\tm._EducationlevelID = &id\n}", "title": "" }, { "docid": "ccc6bf0d47afcce1087a026bbe2230cb", "score": "0.4232642", "text": "func (h Header) SetOnBehalfOfCompID(v string) {\n\th.Set(field.NewOnBehalfOfCompID(v))\n}", "title": "" }, { "docid": "ba7076eb1799921430a220489274aa35", "score": "0.4228077", "text": "func (h Header) SetOnBehalfOfLocationID(v string) {\n\th.Set(field.NewOnBehalfOfLocationID(v))\n}", "title": "" }, { "docid": "909ab3e22e5789c4b56acf026a63860a", "score": "0.42171472", "text": "func (d *DHCPv4) SetTransactionID(transactionID uint32) {\n\td.transactionID = transactionID\n}", "title": "" }, { "docid": "201f075ffed787d62b2f4fd877e0a057", "score": "0.42155254", "text": "func (n *Node) SetID(id string) {\n\tn.id = id\n}", "title": "" }, { "docid": "a7fbb8145c339f6fd5d333bdf2475abc", "score": "0.42100877", "text": "func (o *GetServerForDeveloperParams) SetAid(aid string) {\n\to.Aid = aid\n}", "title": "" }, { "docid": "284a20b47b0c0da996a92c2f77698806", "score": "0.4199208", "text": "func (eClassifier *eClassifierImpl) SetClassifierID(newClassifierID int) {\n\toldClassifierID := eClassifier.classifierID\n\teClassifier.classifierID = newClassifierID\n\tif eClassifier.ENotificationRequired() {\n\t\teClassifier.ENotify(NewNotificationByFeatureID(eClassifier.AsEObject(), SET, ECLASSIFIER__CLASSIFIER_ID, oldClassifierID, newClassifierID, NO_INDEX))\n\t}\n}", "title": "" }, { "docid": "7af08a7039bf858b38906bbb4a47d3a1", "score": "0.4196198", "text": "func (iuo *InviteeUpdateOne) SetPartyID(id int) *InviteeUpdateOne {\n\tiuo.mutation.SetPartyID(id)\n\treturn iuo\n}", "title": "" }, { "docid": "1fd77ea7e4767a2d52e68a1a7b3e38c0", "score": "0.4194696", "text": "func SetEventID(eventID int64) {\n\tgetLocal().eventID = eventID\n}", "title": "" }, { "docid": "111433df451594b0be88f21b35fd6724", "score": "0.41939533", "text": "func (inst *Instance) setPeerID(peerID identity.OffChainID) {\n\tinst.peerID = peerID\n}", "title": "" }, { "docid": "9a3e9d53efe6cad5d9246db110deab54", "score": "0.41918582", "text": "func (m NoPartyIDs) SetPartyID(v string) {\n\tm.Set(field.NewPartyID(v))\n}", "title": "" }, { "docid": "9a3e9d53efe6cad5d9246db110deab54", "score": "0.41918582", "text": "func (m NoPartyIDs) SetPartyID(v string) {\n\tm.Set(field.NewPartyID(v))\n}", "title": "" }, { "docid": "9a3e9d53efe6cad5d9246db110deab54", "score": "0.41918582", "text": "func (m NoPartyIDs) SetPartyID(v string) {\n\tm.Set(field.NewPartyID(v))\n}", "title": "" }, { "docid": "9a3e9d53efe6cad5d9246db110deab54", "score": "0.41918582", "text": "func (m NoPartyIDs) SetPartyID(v string) {\n\tm.Set(field.NewPartyID(v))\n}", "title": "" }, { "docid": "9a3e9d53efe6cad5d9246db110deab54", "score": "0.41918582", "text": "func (m NoPartyIDs) SetPartyID(v string) {\n\tm.Set(field.NewPartyID(v))\n}", "title": "" }, { "docid": "4ccab3c192d1283d1e9126fd7899918b", "score": "0.41849673", "text": "func (m AllocationReportAck) SetAllocID(v string) {\n\tm.Set(field.NewAllocID(v))\n}", "title": "" }, { "docid": "586dd9aa307c6d60c4dab5cd56e2adae", "score": "0.4183148", "text": "func (builder ConsensusTopicUpdateTransaction) SetAutoRenewAccountID(id AccountID) ConsensusTopicUpdateTransaction {\n\tbuilder.pb.AutoRenewAccount = id.toProto()\n\treturn builder\n}", "title": "" }, { "docid": "d3de4c0893d58825c146379c769c1203", "score": "0.41820794", "text": "func (this *AllDistinct) SetID(propID core.PropId) {\n\tthis.id = propID\n}", "title": "" }, { "docid": "3d1bd33433a39b1b85a6f63bc5d3a10c", "score": "0.41806218", "text": "func (c *HTTPClient) SetClientID(id uuid.UUID, key bitcoin.Key) {\r\n\tc.ClientID = id\r\n\tc.ClientKey = key\r\n}", "title": "" }, { "docid": "3f1ecd49e9c3d72e3b5e76f2c1476b51", "score": "0.4179405", "text": "func (o *AuthorizationParams) SetClientID(clientID string) {\n\to.ClientID = clientID\n}", "title": "" }, { "docid": "ce347cbddc7d6517fae1053bd98d1cd2", "score": "0.41757923", "text": "func (o *GetServiceDetectionRuleFullRequestParams) SetID(id strfmt.UUID) {\n\to.ID = id\n}", "title": "" }, { "docid": "3218457b95af4cda455bfb200200c735", "score": "0.41518855", "text": "func (o *SparseLocalCA) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "cd6fa7934e22bec2ac3d0066ad785c58", "score": "0.4148087", "text": "func (t *Term) SetVariableID(cID int) {\n\t_constraintID := uint64(cID)\n\tif (_constraintID & maskVariableID) != uint64(cID) {\n\t\tpanic(\"constraintID is too large, unsupported\")\n\t}\n\t*t = Term((uint64(*t) & (^maskVariableID)) | _constraintID)\n}", "title": "" }, { "docid": "d866cd6a252a8200ee42969e1606b863", "score": "0.41455534", "text": "func (m Message) GetAgreementID(f *field.AgreementIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" }, { "docid": "d866cd6a252a8200ee42969e1606b863", "score": "0.41455534", "text": "func (m Message) GetAgreementID(f *field.AgreementIDField) quickfix.MessageRejectError {\n\treturn m.Body.Get(f)\n}", "title": "" } ]
a0c3290061b67369f80980a3c7cbdb6c
Sum256 returns the LSH256 checksum of the data.
[ { "docid": "fe179bb219e72e997673625024f4dfa0", "score": "0.87784845", "text": "func Sum256(data []byte) (sum [Size]byte) {\n\tb := lsh256{\n\t\toutlenbits: 256,\n\t}\n\tb.Reset()\n\tb.Write(data)\n\n\treturn b.checkSum()\n}", "title": "" } ]
[ { "docid": "cc400b0ab38dd831aaa2908f83f9df62", "score": "0.84390277", "text": "func Sum256(data []byte) []byte {\n\td := sha256.New()\n\td.Write(data)\n\treturn d.Sum(nil)\n}", "title": "" }, { "docid": "3fbea61123d312370f1dfd72ce6ca53e", "score": "0.8347515", "text": "func Sum256(data []byte) (digest [32]byte) {\n\th := New256()\n\th.Write(data)\n\th.Sum(digest[:0])\n\treturn\n}", "title": "" }, { "docid": "42ead07175fa8167961672db8ca1b54c", "score": "0.8244723", "text": "func Sum256(data []byte) [Size]byte {\n\tvar sum [Size]byte\n\tcheckSum(&sum, Size, data)\n\treturn sum\n}", "title": "" }, { "docid": "37743a600c796e7a58083da05e528086", "score": "0.7834288", "text": "func Sha256Sum(data []byte) string {\n\tbytes := sha256.Sum256(data)\n\treturn hex.EncodeToString(bytes[:])\n}", "title": "" }, { "docid": "338746e3d88577273d721a16bc67816f", "score": "0.7665679", "text": "func sum256Hex(data []byte) string {\n\thash := newSHA256Hasher()\n\tdefer hash.Close()\n\thash.Write(data)\n\treturn hex.EncodeToString(hash.Sum(nil))\n}", "title": "" }, { "docid": "8e6e51e5dbea659ea3d3ff9e3feb3779", "score": "0.7312607", "text": "func Sha256(data []byte) []byte {\n\tsum := sha256.Sum256(data)\n\treturn sum[:]\n}", "title": "" }, { "docid": "4d9dc54ef8d8887867ae70b084fdf6fa", "score": "0.7292856", "text": "func Sum256(text string) int16 {\n\tsum := sha256.Sum256([]byte(text));\n\treturn int16(binary.BigEndian.Uint16(sum[18:]))\n}", "title": "" }, { "docid": "10f4b94021766dab76005a5dee6c274f", "score": "0.72584", "text": "func SHA256Sum(b []byte) FileHash {\n\tsum := sha256.Sum256(b)\n\treturn FileHash(fmt.Sprintf(\"%x\", sum))\n}", "title": "" }, { "docid": "2efa7f4e57b64c50a0ce76e9f214bdcb", "score": "0.72365135", "text": "func Sha3Sum256(data []byte) []byte {\n\th := sha3.Sum256(data)\n\treturn h[:]\n}", "title": "" }, { "docid": "e25c10b598b313671e6d7e1d3c5fbf85", "score": "0.6899398", "text": "func hash256(data []byte) []byte {\n\thash := sha256.New()\n\thash.Write(data)\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "7acfdefea7ba87eb529bcf7c06090993", "score": "0.6817305", "text": "func GetSha256SumFromBytes(data []byte) string {\n\thash := sha256.Sum256(data)\n\treturn fmt.Sprintf(\"%x\", hash)\n}", "title": "" }, { "docid": "c8ed63701e91ae8d40eb9dbd0e24b7ae", "score": "0.6794231", "text": "func Sha256Hash(input []byte) []byte {\n\tres := sha256.Sum256(input)\n\treturn res[:]\n}", "title": "" }, { "docid": "087bef49949d6ca96d09ad2fad147fae", "score": "0.67407715", "text": "func Sum(data []byte) []byte {\n var cresstr [32]C.char\n C.xcoin_hash(C.CString(string(data)), C.int(len(data)), &cresstr[0])\n return []byte(C.GoStringN(&cresstr[0], 32))\n}", "title": "" }, { "docid": "4e640cd4be0f4712cd4db62343330e3c", "score": "0.66432214", "text": "func sum256(filePath string) (string, error) {\n\t// open the file for reading\n\tfile, err := os.Open(filePath)\n\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tdefer file.Close()\n\n\th := sha256.New()\n\tif _, err := io.Copy(h, file); err != nil {\n\t\treturn \"\", err\n\t}\n\treturn hex.EncodeToString(h.Sum(nil)), nil\n}", "title": "" }, { "docid": "66b99e3ba20680096b1605ffbf5ec03b", "score": "0.6631515", "text": "func SHA256(data ...[]byte) []byte {\n\thash := sha256.New()\n\tfor _, d := range data {\n\t\t_, _ = hash.Write(d)\n\t}\n\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "35dd581fd44b1465580776b9ba1a791d", "score": "0.6620232", "text": "func Sha256(X []byte) []byte {\n\t// TODO: implement\n\treturn nil\n}", "title": "" }, { "docid": "efbfe7196142b9068b70a8b402d7b429", "score": "0.65976804", "text": "func SHA256(input []byte) []byte {\n\thash := sha256.New()\n\thash.Write(input)\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "0a156cf62835ecaa47e5947c8964249a", "score": "0.6563222", "text": "func (h *hashChecksum) Sum() []byte { return h.hash.Sum(h.sumCache) }", "title": "" }, { "docid": "401b9f929e56d3bcd1be80d0b949dcc6", "score": "0.6514911", "text": "func (s *sha2_256Algo) SumHash() Hash {\n\tdigest := s.Sum(nil)\n\ts.Reset()\n\treturn digest\n}", "title": "" }, { "docid": "75c4e771988d98c375693500a32143cc", "score": "0.65146065", "text": "func (c *crc32Checksum) Sum() []byte { return c.crc32.Sum(nil) }", "title": "" }, { "docid": "c0a99f14d342ad040e9903fd8143dbb5", "score": "0.6484474", "text": "func (r *Reader) SHA256() []byte {\n\treturn r.sha256sum\n}", "title": "" }, { "docid": "8924e0a737cf0b2858816f01b66b8fa1", "score": "0.6448642", "text": "func (l License) Sha256Data() []byte {\n\tdata := sha256.Sum256([]byte(l.EncodedData))\n\treturn data[:]\n}", "title": "" }, { "docid": "5bdccb443bddf0137bb61ab0e5e5b75b", "score": "0.6439042", "text": "func Sha256Hash(L *lua.LState) int {\n\t// Get string to be hashed\n\tstr := L.Get(2)\n\n\t// Check for valid string type\n\tif str.Type() != lua.LTString {\n\n\t\tL.ArgError(1, \"Invalid string format. Expected string\")\n\t\treturn 0\n\t}\n\n\t// Hash string using sha1\n\tdata := sha256.Sum256([]byte(str.String()))\n\n\t// Convert byte array to string and push to stack\n\tL.Push(\n\t\tlua.LString(\n\t\t\tfmt.Sprintf(\"%x\", data),\n\t\t),\n\t)\n\n\treturn 1\n}", "title": "" }, { "docid": "a12847d9cc3ec1abde09ae2691f56aa8", "score": "0.64324814", "text": "func Sum(data []byte) []byte {\n\tvar res [32]C.char\n\tvar cstr = C.CString(string(data))\n\n\tdefer C.free(unsafe.Pointer(cstr))\n\tC.x16r_hash(cstr, &res[0])\n\n\treturn []byte(C.GoStringN(&res[0], 32))\n}", "title": "" }, { "docid": "6a06be1eb62751a6ca05dfa5e21e6dce", "score": "0.6426896", "text": "func KDFSHA256(in []byte) []byte {\n\tout := sha256.Sum256(in)\n\treturn out[:]\n}", "title": "" }, { "docid": "51797dc30e1771294e09e383fce2ee59", "score": "0.6359581", "text": "func checksum(input []byte) (cksum [4]byte) {\n\th := sha256.New()\n\t_, err := h.Write(input)\n\tif err != nil {\n\t\treturn\n\t}\n\tintermediateHash := h.Sum(nil)\n\th.Reset()\n\t_, err = h.Write(intermediateHash)\n\tif err != nil {\n\t\treturn\n\t}\n\tfinalHash := h.Sum(nil)\n\tcopy(cksum[:], finalHash[:])\n\treturn\n}", "title": "" }, { "docid": "6dbfcec8b61975ee106c84e929a91c03", "score": "0.6342988", "text": "func Checksum(data []byte) uint32 { return uint32(update(1, data)) }", "title": "" }, { "docid": "156c5e898b0e626588d769c92188928a", "score": "0.6301427", "text": "func CheckSum(payload []byte) []byte {\n\tfirstHash := sha256.Sum256(payload)\n\tsecondHash := sha256.Sum256(firstHash[:])\n\treturn secondHash[:checksumLength]\n}", "title": "" }, { "docid": "212fcfb3405686c41100862a9db3af72", "score": "0.62936664", "text": "func HashS256(data string) string {\n\th := sha256.New()\n\th.Write([]byte(data))\n\treturn EncodeBase64(h.Sum(nil))\n}", "title": "" }, { "docid": "fffbe3429d5b331f0db4d9a3c5a458f4", "score": "0.62910277", "text": "func CheckSum(payload []byte) []byte {\n\t// hashing it 2 times\n\tfistHash := sha256.Sum256(payload)\n\tsecondHash := sha256.Sum256(fistHash[:])\n\n\t// return the first 4byte of the hash\n\treturn secondHash[:checksumLength]\n}", "title": "" }, { "docid": "f325dcae8174d01d630d16ecc6271491", "score": "0.6242841", "text": "func Sum(data []byte) [Size]byte {\n\tvar d sha1\n\td.Reset()\n\td.Write(data)\n\treturn d.checkSum()\n}", "title": "" }, { "docid": "32b13ad776a0054ab24239cbebe8462a", "score": "0.62211126", "text": "func Sha256(b []byte) []byte {\n\tsha := sha256.New()\n\tsha.Write(b)\n\treturn sha.Sum(nil)\n}", "title": "" }, { "docid": "2cc23843bef136b5fa72a7a157a6363a", "score": "0.6199624", "text": "func (h *hash32) Sum(b []byte) (cs []byte) {\n\treturn append(b, h.sum[:]...)\n}", "title": "" }, { "docid": "d18c4679805ab00a1c27803f2a1dfb34", "score": "0.6193231", "text": "func Hash256(ba []byte) []byte {\n\tsha := sha256.New()\n\tsha.Write(ba)\n\tba = sha.Sum(nil)\n\tsha.Reset()\n\tsha.Write(ba)\n\treturn sha.Sum(nil)\n}", "title": "" }, { "docid": "1db41080a7c2b8373944c1b99dd8cd94", "score": "0.61897665", "text": "func Sha256(args ...[]byte) []byte {\n\thasher := sha256.New()\n\tfor _, bytes := range args {\n\t\thasher.Write(bytes)\n\t}\n\treturn hasher.Sum(nil)\n}", "title": "" }, { "docid": "c4d675551f7ad8eb7e21de913c7f684b", "score": "0.61456853", "text": "func Keccak256(data ...[]byte) []byte {\n\td := hash.GetHasher(hash.Keccak_256)\n\tfor _, b := range data {\n\t\td.Write(b)\n\t}\n\treturn d.Sum(nil)\n}", "title": "" }, { "docid": "53ee1c53c2ffce40d29f5f92ad47ea0d", "score": "0.61451334", "text": "func (f *File) Sha256() (string, error) {\n\tb, err := ioutil.ReadAll(f.Reader())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsum := sha256.Sum256(b)\n\treturn fmt.Sprintf(\"%x\", sum), nil\n}", "title": "" }, { "docid": "190eb332f7c1fc693642c44fd31cca6e", "score": "0.61443686", "text": "func SHA256(b []byte) []byte {\n\tvar h hash.Hash = sha256.New()\n\th.Write(b)\n\treturn h.Sum(nil)\n}", "title": "" }, { "docid": "4258403270ed377a6c965444cd366945", "score": "0.61409783", "text": "func Keccak256(data ...[]byte) []byte {\n\thash := sha3.NewLegacyKeccak256()\n\tfor _, d := range data {\n\t\t_, _ = hash.Write(d)\n\t}\n\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "b13a81d2cc56a2b92999949b337f22a8", "score": "0.6136425", "text": "func Keccak256(data ...[]byte) []byte {\n\t//d := sha3.NewKeccak256()\n\td := sha256.New()\n\tfor _, b := range data {\n\t\td.Write(b)\n\t}\n\treturn d.Sum(nil)\n}", "title": "" }, { "docid": "f946417629f557c46fc5788a8c732c64", "score": "0.61139524", "text": "func Keccak256(data ...[]byte) []byte {\n\td := sha3.NewLegacyKeccak256()\n\tfor _, b := range data {\n\t\td.Write(b)\n\t}\n\treturn d.Sum(nil)\n}", "title": "" }, { "docid": "f946417629f557c46fc5788a8c732c64", "score": "0.61139524", "text": "func Keccak256(data ...[]byte) []byte {\n\td := sha3.NewLegacyKeccak256()\n\tfor _, b := range data {\n\t\td.Write(b)\n\t}\n\treturn d.Sum(nil)\n}", "title": "" }, { "docid": "3b581d954bbafc6926e1606aa57c5ec7", "score": "0.60617673", "text": "func Sum(data []byte) [Size]byte {\n\tvar d digest\n\td.Reset()\n\td.write(data)\n\treturn d.checkSum()\n}", "title": "" }, { "docid": "bcb0db006cd6b8ff1f0466bedbbc1e38", "score": "0.6058761", "text": "func Checksum(data []byte, tab *crc64.Table,) uint64", "title": "" }, { "docid": "4a866b5d1b8f4f86768e0ec2c54b3a40", "score": "0.6051542", "text": "func SHA256(input string) string {\n\n\tx := sha256.New()\n\tx.Write([]byte(input))\n\treturn hex.EncodeToString(x.Sum(nil))\n\n}", "title": "" }, { "docid": "21add747e496358ed933c2927e00051b", "score": "0.6037479", "text": "func Sum(reader io.Reader) ([]byte, error) {\n\td := sha256.New()\n\tvar err error\n\tfor err == nil {\n\t\tlength := 0\n\t\tbyteBuffer := make([]byte, 1024*1024)\n\t\tlength, err = reader.Read(byteBuffer)\n\t\tbyteBuffer = byteBuffer[0:length]\n\t\td.Write(byteBuffer)\n\t}\n\tif err != io.EOF {\n\t\treturn nil, err\n\t}\n\treturn d.Sum(nil), nil\n}", "title": "" }, { "docid": "20af18f3ab36765e0ea77254f486ec72", "score": "0.6031349", "text": "func addChecksum(data []byte) []byte {\n\t// Get first byte of sha256\n\thasher := sha256.New()\n\t_, err := hasher.Write(data)\n\tif err != nil {\n\t\treturn nil\n\t}\n\thash := hasher.Sum(nil)\n\tfirstChecksumByte := hash[0]\n\n\t// len() is in bytes so we divide by 4\n\tchecksumBitLength := uint(len(data) / 4)\n\n\t// For each bit of check sum we want we shift the data one the left\n\t// and then set the (new) right most bit equal to checksum bit at that index\n\t// staring from the left\n\tdataBigInt := new(big.Int).SetBytes(data)\n\tfor i := uint(0); i < checksumBitLength; i++ {\n\t\t// Bitshift 1 left\n\t\tdataBigInt.Mul(dataBigInt, BigTwo)\n\n\t\t// Set rightmost bit if leftmost checksum bit is set\n\t\tif firstChecksumByte&(1<<(7-i)) > 0 {\n\t\t\tdataBigInt.Or(dataBigInt, BigOne)\n\t\t}\n\t}\n\n\treturn dataBigInt.Bytes()\n}", "title": "" }, { "docid": "6414f061371946a1eb5591af61189852", "score": "0.60187805", "text": "func Sum(h crypto.Hash, bitlen int, message []byte) []byte {\n\thash := New(h, bitlen)\n\thash.Write(message)\n\treturn hash.Sum(nil)\n}", "title": "" }, { "docid": "43068eab935bcd092df15079f754eb5e", "score": "0.59886026", "text": "func getSha256(input []byte) []byte {\n\tsha := sha256.New()\n\tsha.Write(input)\n\treturn sha.Sum(nil)\n}", "title": "" }, { "docid": "0ecc38f15cb06c836c158df42c1cbdaa", "score": "0.59866863", "text": "func GetDataSHA256(ctx context.Context, c client.Client, key client.ObjectKey) string {\n\thash := \"\"\n\n\tsec, err := Get(ctx, c, key)\n\tif err != nil {\n\t\treturn hash\n\t}\n\n\tdataHashes := make(map[string][32]byte)\n\n\tfor key, data := range sec.Data {\n\t\tdataHashes[key] = sha256.Sum256([]byte(data))\n\t}\n\n\tsortedKeys := []string{}\n\tfor key := range dataHashes {\n\t\tsortedKeys = append(sortedKeys, key)\n\t}\n\n\tsort.Strings(sortedKeys)\n\n\tfor _, key := range sortedKeys {\n\t\thash = fmt.Sprintf(\"%s%s\", hash, dataHashes[key])\n\t}\n\n\treturn hash\n}", "title": "" }, { "docid": "adbfd7ed886e8974536896d8ed415404", "score": "0.5985188", "text": "func AddSHA256(a SHA256, b SHA256) SHA256 {\n\tc := append(a[:], b[:]...)\n\treturn SumSHA256(c)\n}", "title": "" }, { "docid": "adbfd7ed886e8974536896d8ed415404", "score": "0.5985188", "text": "func AddSHA256(a SHA256, b SHA256) SHA256 {\n\tc := append(a[:], b[:]...)\n\treturn SumSHA256(c)\n}", "title": "" }, { "docid": "06d1bda8fa525c697de6f8e19342c8a4", "score": "0.59463376", "text": "func (p *Package) SHA256() (string, error) {\n\tdigest := sha256.New()\n\t_, err := digest.Write(p.b.Bytes())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tsum := digest.Sum(nil)\n\treturn fmt.Sprintf(\"%x\", sum), nil\n}", "title": "" }, { "docid": "c9feaeb8c3cf751481df10f800610189", "score": "0.59427905", "text": "func Sha256(in string) (string, error) {\n\thasher := sha3.New256()\n\t_, err := hasher.Write([]byte(in))\n\tif err != nil {\n\t\treturn \"\", errors.Wrap(err, \"sha256 write error\")\n\t}\n\treturn hex.EncodeToString(hasher.Sum(nil)), nil\n}", "title": "" }, { "docid": "e038fde2cc46806a974329d042e3eae9", "score": "0.594005", "text": "func makeSha256(data []byte) []byte {\r\n\thash := sha256.New()\r\n\thash.Write(data)\r\n\treturn hash.Sum(nil)\r\n}", "title": "" }, { "docid": "1d1fcd1ba921ec9d403ae5a9e136a075", "score": "0.5912863", "text": "func Sha256(plain []byte) string {\n\th := sha256.New()\n\n\treturn hexEncrypt(h, plain)\n}", "title": "" }, { "docid": "9dd550d17fed3fb5a2ac2c419a1cfb7d", "score": "0.59102505", "text": "func (xxh xxHash) Sum(b []byte) []byte {\n\th64 := xxh.Sum64()\n\treturn append(b, byte(h64), byte(h64>>8), byte(h64>>16), byte(h64>>24), byte(h64>>32), byte(h64>>40), byte(h64>>48), byte(h64>>56))\n}", "title": "" }, { "docid": "c6584c452ec4a0a61ad3c8b5cbcc7287", "score": "0.5897982", "text": "func Hash(data []byte) []byte {\n\th := sha256.Sum256(data)\n\treturn h[:]\n}", "title": "" }, { "docid": "66258af214e2b1f50a95a1fae6ec1593", "score": "0.5896519", "text": "func Sum224(data []byte) (sum224 [Size224]byte) {\n\tb := lsh256{\n\t\toutlenbits: 224,\n\t}\n\tb.Reset()\n\tb.Write(data)\n\n\tsum := b.checkSum()\n\tcopy(sum224[:], sum[:Size224])\n\n\treturn\n}", "title": "" }, { "docid": "f1a10c4bbf648d0ef2493b36f9359121", "score": "0.5893259", "text": "func (d *digest) Sum(in []byte) []byte {\n\thash := d.checkSum()\n\treturn append(in, hash[:]...)\n}", "title": "" }, { "docid": "e870aed23e5ffdeba4ee311ea75d7879", "score": "0.5877568", "text": "func Checksum(data []byte) uint32\t{ return finish(update(1, 0, data)) }", "title": "" }, { "docid": "9e03e9a4858e586b1db119a9eb13293c", "score": "0.58442205", "text": "func ComputeSecretCheckSum(data map[string][]byte) string {\n\tvar (\n\t\thash string\n\t\tkeys []string\n\t)\n\n\tfor k := range data {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\n\tfor _, k := range keys {\n\t\thash += ComputeSHA256Hex(data[k])\n\t}\n\n\treturn ComputeSHA256Hex([]byte(hash))\n}", "title": "" }, { "docid": "498d2ddbe16e21c6f84b6d2fb08ebba0", "score": "0.5839", "text": "func (d Digest32) Sum(b []byte) []byte {\n\th := d.Sum32()\n\treturn append(b, byte(h>>24), byte(h>>16), byte(h>>8), byte(h))\n}", "title": "" }, { "docid": "4f5a1a9a5526ba86940777fb2c1c09e2", "score": "0.5829243", "text": "func (h *Hash) Sum(b []byte) []byte {\n\tvar hHash C.HCRYPTHASH\n\tif C.CryptDuplicateHash(h.hHash, nil, 0, &hHash) == 0 {\n\t\tpanic(getErr(\"Error duplicating hash\"))\n\t}\n\tdefer func() {\n\t\tif C.CryptDestroyHash(hHash) == 0 {\n\t\t\tpanic(getErr(\"Error destroying hash\"))\n\t\t}\n\t}()\n\tif _, err := write(hHash, b); err != nil {\n\t\tpanic(err)\n\t}\n\tvar n C.DWORD\n\tslen := C.DWORD(C.sizeof_DWORD)\n\tif C.CryptGetHashParam(hHash, C.HP_HASHSIZE, (*C.uchar)(unsafe.Pointer(&n)), &slen, 0) == 0 {\n\t\tpanic(getErr(\"Error getting hash size\"))\n\t}\n\tres := make([]byte, int(n))\n\tif C.CryptGetHashParam(hHash, C.HP_HASHVAL, (*C.BYTE)(&res[0]), &n, 0) == 0 {\n\t\tpanic(getErr(\"Error getting hash value\"))\n\t}\n\treturn res\n}", "title": "" }, { "docid": "b6519b2b5a6c18f50979ff3dc3c442e1", "score": "0.58276135", "text": "func (ds DataSet) Sha256() string {\n\treturn bytesToSha256(ds.Data)\n}", "title": "" }, { "docid": "d48c87f04d240677fed77f5ba0613c60", "score": "0.58239186", "text": "func hash(data []byte) []byte {\n\th := sha256.New()\n\th.Write(data)\n\treturn h.Sum(nil)\n}", "title": "" }, { "docid": "dd0d91c2b088d179c431ec64ceef91b9", "score": "0.58238393", "text": "func sha256sum(filePath string) (result string, err error) {\n\tfile, err := os.Open(filePath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer file.Close()\n\n\thash := sha256.New()\n\t_, err = io.Copy(hash, file)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\treturn \"sha256.\" + hex.EncodeToString(hash.Sum(nil)), nil\n}", "title": "" }, { "docid": "601018e9ee770fd4e5fff1b85408e054", "score": "0.5822757", "text": "func Sum(data []byte) [Size]byte {\n\tvar d digest\n\td.Reset()\n\td.Write(data)\n\n\treturn d.finalize()\n}", "title": "" }, { "docid": "51bf1cee5bab3b5dc75f445716543490", "score": "0.5812529", "text": "func (c *ChunkLister) Sha256() []byte {\n\treturn nil\n}", "title": "" }, { "docid": "7977f3b143165fd9f0d2ed2b8ed1e127", "score": "0.5784535", "text": "func Sha256(text string) (string, error) {\n\thash, err := crypto.Hash([]byte(text))\n\tif err != nil {\n\t\treturn ``, logErrorValue(err, consts.CryptoError, \"hashing text\", text)\n\t}\n\thash = converter.BinToHex(hash)\n\treturn string(hash), nil\n}", "title": "" }, { "docid": "6b9b56c5fe1086a15b4a61f8cf0028da", "score": "0.5779168", "text": "func (d *digest) Sum(in []byte) []byte {\n\ts := d.Sum64()\n\treturn append(in, byte(s), byte(s>>8), byte(s>>16), byte(s>>24),\n\t\tbyte(s>>32), byte(s>>40), byte(s>>48), byte(s>>56))\n}", "title": "" }, { "docid": "ab886e91a65e4f98933c5fa648d13cd4", "score": "0.577302", "text": "func Sha256(str string) string {\n\tt := sha256.Sum256([]byte(str))\n\treturn hex.EncodeToString(t[:])\n}", "title": "" }, { "docid": "03668584d901bdc7dea41f3ed95be6ce", "score": "0.57403994", "text": "func HmacSha256(L *lua.LState) int {\n\t// Get secret string\n\tsecret := L.Get(2)\n\n\t// Check for valid string type\n\tif secret.Type() != lua.LTString {\n\n\t\tL.ArgError(1, \"Invalid secret format. Expected string\")\n\t\treturn 0\n\t}\n\n\t// Get message string to be hashed\n\tmessage := L.Get(3)\n\n\t// Check for valid string type\n\tif message.Type() != lua.LTString {\n\n\t\tL.ArgError(2, \"Invalid message format. Expected string\")\n\t\treturn 0\n\t}\n\n\thash := hmac.New(sha256.New, []byte(secret.String()))\n\thash.Write([]byte(message.String()))\n\n\t// Convert hash to hex string and push to stack\n\tL.Push(lua.LString(hex.EncodeToString(hash.Sum(nil))))\n\n\treturn 1\n}", "title": "" }, { "docid": "b1dd448571ae18b8cdfc3df9368dff0f", "score": "0.5739446", "text": "func (m *SHA256Module) SHA256(message string, saltKey string) (encrypted string) {\n\thash := sha256.New()\n\thash.Write([]byte(message + saltKey))\n\tencrypted = hex.EncodeToString(hash.Sum(nil))\n\treturn encrypted\n}", "title": "" }, { "docid": "41b1244f34efb76e1d7e1959e5551814", "score": "0.57360876", "text": "func Checksum(payload []byte) []byte {\n\tfirstHash := sha256.Sum256(payload)\n\tsecondHash := sha256.Sum256(firstHash[:])\n\n\treturn secondHash[:checksumLength]\n}", "title": "" }, { "docid": "5d611fafc0221e3b8af99771153dd566", "score": "0.57301545", "text": "func CheckSha256Sum(reader io.Reader, reqSha256Sum string) (status MatchStatus, err error) {\n\n\thasher := sha256.New()\n\tif _, err = io.Copy(hasher, reader); err != nil {\n\n\t\treturn Unknown, err\n\t}\n\n\treqSha256Sum = strings.ToLower(reqSha256Sum)\n\tgotSha256Sum := fmt.Sprintf(\"%x\", hasher.Sum(nil))\n\tif reqSha256Sum != gotSha256Sum {\n\t\treturn NoMatch, nil\n\t}\n\n\treturn Match, nil\n}", "title": "" }, { "docid": "5b269b039ff45ba020e4a28106890fc7", "score": "0.5724574", "text": "func Sum(data []byte, cvd CVD) [Size]byte {\n\tb := make([]byte, 0, Size)\n\th := Hash(cvd)\n\t/* #nosec */\n\th.Write(data)\n\tb = h.Sum(b)\n\treturn [Size]byte{b[0], b[1]}\n}", "title": "" }, { "docid": "2a26f04642f0727bb9028ab213fa6dc0", "score": "0.57182235", "text": "func Sha256Hash(fpath string) (string, error) {\n\tf, err := os.Open(fpath)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer f.Close()\n\n\th := sha256.New()\n\tif _, err := io.Copy(h, f); err != nil {\n\t\treturn \"\", err\n\t}\n\thash := fmt.Sprintf(\"%x\", h.Sum(nil))\n\treturn hash, nil\n}", "title": "" }, { "docid": "589cb5c9843a2c4bc9ef5af0dc9778c0", "score": "0.5715939", "text": "func Sha256(str cty.Value) (cty.Value, error) {\n\treturn Sha256Func.Call([]cty.Value{str})\n}", "title": "" }, { "docid": "0e6863a6340c4a53c4809d7dbc6cebce", "score": "0.57139355", "text": "func Checksum(data []byte, tab *Table) uint16 { return simpleUpdate(0xFFFF, tab, data) }", "title": "" }, { "docid": "a1085c2e1a9858e4da432ffeab64bae9", "score": "0.57072514", "text": "func (hash Hash) SHA256() string {\n\thashFunction := sha256.New()\n\trandomString := hash.Faker.Lorem().Word()\n\thashFunction.Write([]byte(randomString))\n\treturn fmt.Sprintf(\"%x\", string(hashFunction.Sum(nil)))\n}", "title": "" }, { "docid": "ae8e679ef4f194dea8f8ed620f770166", "score": "0.56941384", "text": "func U256(n *big.Int) []byte {\n\treturn math.PaddedBigBytes(math.U256(n), 32)\n}", "title": "" }, { "docid": "ae8e679ef4f194dea8f8ed620f770166", "score": "0.56941384", "text": "func U256(n *big.Int) []byte {\n\treturn math.PaddedBigBytes(math.U256(n), 32)\n}", "title": "" }, { "docid": "f01152a80e85dd1033647056e5eb228f", "score": "0.56912", "text": "func Sum32(seed uint64, data []byte) uint32", "title": "" }, { "docid": "8baf4269e7d1e51f238343caf2b99d3e", "score": "0.56898755", "text": "func (s *sha2_384Algo) SumHash() Hash {\n\tdigest := s.Sum(nil)\n\ts.Reset()\n\treturn digest\n}", "title": "" }, { "docid": "a065cc7628e53902cce7585e245ca461", "score": "0.5689872", "text": "func Keccak256Hash(data ...[]byte) (h hash.Hash) {\n\td := hash.GetHasher(hash.Keccak_256)\n\tfor _, b := range data {\n\t\td.Write(b)\n\t}\n\td.Sum(h[:0])\n\treturn h\n}", "title": "" }, { "docid": "697b946db10312fe7f0e80f45a0c5a01", "score": "0.56866187", "text": "func Hash(data []byte) [32]byte {\n\tvar hash [32]byte\n\n\th := sha256.New()\n\t// The hash interface never returns an error, for that reason\n\t// we are not handling the error below. For reference, it is\n\t// stated here https://golang.org/pkg/hash/#Hash\n\t// #nosec G104\n\th.Write(data)\n\th.Sum(hash[:0])\n\n\treturn hash\n}", "title": "" }, { "docid": "8beb1ec58fc59c10229edb850d03a7c8", "score": "0.5684368", "text": "func CheckSum(data string, size uint) (string, error) {\n\tswitch size {\n\tcase 256:\n\t\th := sha256.New()\n\t\th.Write([]byte(data))\n\t\tbs := h.Sum(nil)\n\t\tbytes := string(fmt.Sprintf(\"%x\\n\", bs))\n\t\treturn bytes, nil\n\tcase 512:\n\t\th := sha512.New()\n\t\th.Write([]byte(data))\n\t\tbs := h.Sum(nil)\n\t\tbytes := string(fmt.Sprintf(\"%x\\n\", bs))\n\t\treturn bytes[:], nil\n\tdefault:\n\t\treturn \"\", errors.New(\"unsupported sha size\")\n\t}\n\n}", "title": "" }, { "docid": "2d551d7dd7108015a6805cd78750c680", "score": "0.5680135", "text": "func (r *Reader) SHA256HexString() string {\n\treturn hex.EncodeToString(r.sha256sum)\n}", "title": "" }, { "docid": "9693fdf2688d4c9bb3e9ae59ed8b59ac", "score": "0.56734705", "text": "func ComputeHash256(buf []byte) []byte {\n\tarr := ComputeHash256Array(buf)\n\treturn arr[:]\n}", "title": "" }, { "docid": "3bb895271a6162a783fab057369ecdda", "score": "0.56680083", "text": "func ComputeHash256Array(buf []byte) Hash256 {\n\treturn sha256.Sum256(buf)\n}", "title": "" }, { "docid": "d38a4eedcc0e35d8c9a951a718cebca8", "score": "0.5664495", "text": "func (h *Hasher) Sum() int64 {\n\treturn int64(h.state & 0x7FFFFFFF)\n}", "title": "" }, { "docid": "d8e8cab49c65c7cefd9ba8d1a84138bb", "score": "0.5656715", "text": "func GetSHA256Hex(data []byte) string {\n\th := sha256.New()\n\th.Write(data)\n\treturn fmt.Sprintf(\"%x\", h.Sum(nil))\n}", "title": "" }, { "docid": "0fbb7dc43331ece7cc9c21130ba38187", "score": "0.5645093", "text": "func MustSumSHA256(b []byte, n int) SHA256 {\n\tif len(b) != n {\n\t\tlog.Panicf(\"Invalid sumsha256 byte length. Expected %d, have %d\",\n\t\t\tn, len(b))\n\t}\n\treturn SumSHA256(b)\n}", "title": "" }, { "docid": "1f424980459f426a2fdf8baf1205e135", "score": "0.5644956", "text": "func Sum32(key string, seed ...uint32) (hash uint32) {\n\thash = defaultSeed\n\tif len(seed) > 0 {\n\t\thash = seed[0]\n\t}\n\n\tiByte := 0\n\tfor ; iByte+4 <= len(key); iByte += 4 {\n\t\tk := uint32(key[iByte]) | uint32(key[iByte+1])<<8 |\n\t\t\tuint32(key[iByte+2])<<16 | uint32(key[iByte+3])<<24\n\n\t\tk *= c1\n\t\tk = (k << 15) | (k >> 17)\n\t\tk *= c2\n\t\thash ^= k\n\n\t\thash = (hash << 13) | (hash >> 19)\n\t\thash = hash*5 + nh\n\t}\n\n\tvar remainingBytes uint32\n\tswitch len(key) - iByte {\n\tcase 3:\n\t\tremainingBytes += uint32(key[iByte+2]) << 16\n\t\tfallthrough\n\tcase 2:\n\t\tremainingBytes += uint32(key[iByte+1]) << 8\n\t\tfallthrough\n\tcase 1:\n\t\tremainingBytes += uint32(key[iByte])\n\t\tremainingBytes *= c1\n\n\t\tremainingBytes = (remainingBytes << 15) | (remainingBytes >> 17)\n\t\tremainingBytes = remainingBytes * c2\n\t\thash ^= remainingBytes\n\t}\n\n\thash ^= uint32(len(key))\n\thash ^= hash >> 16\n\thash *= c3\n\thash ^= hash >> 13\n\thash *= c4\n\thash ^= hash >> 16\n\n\treturn\n}", "title": "" }, { "docid": "cf645d6ea14e6742347d96d5db323b67", "score": "0.5643286", "text": "func HashSum(h *maphash.Hash, b []byte) []byte", "title": "" }, { "docid": "165eb2a1449fbca9be16480125260b24", "score": "0.5640758", "text": "func Sum384(data []byte) (sum384 [Size384]byte) {\n\tvar d digest\n\td.is384 = true\n\td.Reset()\n\td.Write(data)\n\tsum := d.checkSum()\n\tcopy(sum384[:], sum[:Size384])\n\treturn\n}", "title": "" }, { "docid": "99dff2be20667cf3e9cfb122722532ed", "score": "0.56383425", "text": "func Checksum(bytes []byte, length int) []byte {\n\thash := ComputeHash256Array(bytes)\n\treturn hash[len(hash)-length:]\n}", "title": "" }, { "docid": "0bfd0a97127823f8c2c13ca26c2f7fce", "score": "0.56356245", "text": "func S256(x *big.Int) *big.Int {\n\tif x.Cmp(tt255) < 0 {\n\t\treturn x\n\t}\n\treturn new(big.Int).Sub(x, tt256)\n}", "title": "" }, { "docid": "c7296f7a8b638070d373361852710a1f", "score": "0.5611959", "text": "func Sha256(str string) string {\n\treturn sha(sha256.New(), str)\n}", "title": "" } ]
2b8ec1d05528eedbd5bf1ea1fc5970bd
Since TaxTableEntryTaxCode is just a simple String type, this merely returns the current string value.
[ { "docid": "8c7919a131c73c139c07831903873a1a", "score": "0.8102463", "text": "func (me TaxTableEntryTaxCode) String() string { return xsdt.String(me).String() }", "title": "" } ]
[ { "docid": "bddd7a86b9a6293a126624abca17a469", "score": "0.76015323", "text": "func (me TPaymentTaxCode) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "93460d0eb34084a60d03206d2afd61f5", "score": "0.7492318", "text": "func (me TSAFTPTMovementTaxCode) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "d65688421d2e117bc49e859afd789565", "score": "0.69584554", "text": "func (me TSAFPTPortugueseTaxExemptionCode) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "0e6c464a57e9c4254023b40423589068", "score": "0.6896639", "text": "func (me TxsdTaxType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "6fe158728e3804f1fcee4729e18ca83a", "score": "0.6797891", "text": "func (me TxsdWithholdingTaxType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "5868cd700c8f92478cf917d803cfbe2c", "score": "0.67873234", "text": "func (me TaxTableEntryTaxCode) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "ef66e19ab8e3f81016d5c50954a56e60", "score": "0.6530194", "text": "func (me TSAFTPTMovementTaxType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "b1ff55ea857889b0ab21d9dddaaabed7", "score": "0.6501552", "text": "func (me TxsdTaxAccountingBasis) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "6ad0e0c3540daed84cc27122ee32db14", "score": "0.6429972", "text": "func (me TPaymentTaxCode) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "d0f1071141772d5f7fae5569093714ff", "score": "0.63391167", "text": "func (me TSAFTaxonomyCode) String() string { return xsdt.Integer(me).String() }", "title": "" }, { "docid": "7fcab30fd1e8d505612d5fc12303ef46", "score": "0.63121986", "text": "func (me *TaxTableEntryTaxCode) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "1ab4bbae7fc552a3170817875fb2cc9a", "score": "0.6291862", "text": "func (me TSAFTPTMovementTaxCode) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "e706907bac85af8e9aa0fa16ac5e9548", "score": "0.62229323", "text": "func (me TSAFPTTransactionID) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "002bbcc7fbbb6c592b4843a4bee64112", "score": "0.6191238", "text": "func (me TSAFPTCNCode) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "39535c2489f2a260d8cfece8fcb5b668", "score": "0.6153956", "text": "func (me TPostalCodePT) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "09801e41d3db93a1aaf2b25bcfb01a91", "score": "0.6064324", "text": "func (t Tax) String() string {\n\tjt, _ := json.Marshal(t)\n\treturn string(jt)\n}", "title": "" }, { "docid": "24db3bab848e5a569d9f4fdbdf275c80", "score": "0.5982967", "text": "func (me TSAFPTPortugueseTaxExemptionCode) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "5fb97a1d824e81966ea04e2b31cf3d7e", "score": "0.5979487", "text": "func (me TxsdTaxonomyReference) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "e01dc4c7929a04147a2089d0bf9e7294", "score": "0.5956229", "text": "func (me *TPaymentTaxCode) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "297a5a6dbb136a70087e1400ff7d704d", "score": "0.5955669", "text": "func (me TxsdTaxType) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "b3770c3fa61af3e9f64644dc732a7753", "score": "0.5899279", "text": "func (me TxsdWithholdingTaxType) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "0bed6d272a639ea585ac44a01fe5cdbb", "score": "0.581336", "text": "func (me TSAFPTPortugueseTaxExemptionReason) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "ad23991ef2c7958ec071af132cec78c9", "score": "0.57957727", "text": "func (me TxsdTransactionType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "c223d33eb42892677a5bc1dcde30cf88", "score": "0.578413", "text": "func (me TKerningValue) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "6320e439ffbb9cce52b670cee8e542a1", "score": "0.5760699", "text": "func (me TxsdInvoiceType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "1d8316b7032b65007d4bdd0f96c07170", "score": "0.574059", "text": "func (me TxsdCompanyID) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "a5b25dfc1475e7bdecfbeeaffd62b8ab", "score": "0.5718567", "text": "func (me TSAFTPTSourceBilling) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "a96ec77868967078697fd2919632a339", "score": "0.57036936", "text": "func (o *TransferOriginatorDiligence) GetTaxId() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.TaxId\n}", "title": "" }, { "docid": "5bd2b5a1c6cb7e1d76cc35deb96211e4", "score": "0.5699934", "text": "func (me *TSAFTPTMovementTaxCode) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "84ffaee0e5f53fd226a4bacf6f4a34d8", "score": "0.5698476", "text": "func (me TSAFPTGLAccountID) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "98c9623339f7cc6e5fad232245f21725", "score": "0.5690155", "text": "func (me TxsdFiscalYear) String() string { return xsdt.Integer(me).String() }", "title": "" }, { "docid": "96abd98b57c2ce0a73faa8bbf4f0dc5c", "score": "0.5665152", "text": "func (me TxsdInvoiceStatus) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "02d5a5aa4d39e11131ae692c1f0d0413", "score": "0.56484205", "text": "func (me TSAFTPTMovementTaxType) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "e05f948406888844d1dff84d967e317c", "score": "0.5620464", "text": "func (me TSAFTPTPaymentType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "e26ec76b342ffdb3a4b61a1cd64d111d", "score": "0.5605208", "text": "func (me TSupplierCountry) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "e031a62093d80edc44ac5e5f48884625", "score": "0.56002074", "text": "func (me TSAFTPTSourcePayment) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "d04a239d1d96af97e4515be6984c3217", "score": "0.5571895", "text": "func (me TxsdTaxAccountingBasis) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "b0d2c0a76c82de63f1a3b1c67c279b03", "score": "0.55131507", "text": "func (me TBaselineShiftValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "b548c1bebeaae44a9ea3922e08b049e4", "score": "0.5509574", "text": "func (me TLanguageCodeType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "4e147c100a26cb5b6b046ff57c17a119", "score": "0.5507899", "text": "func (me TSpacingValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "f21e25228a1db532cbf4983322f917c9", "score": "0.5487948", "text": "func (me TxsdFeTurbulenceTypeType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "275e87dcab8f2031d9899b6a33d4bfc1", "score": "0.5483997", "text": "func (me TSAFPTUNNumber) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "69cc5a82dbbe6992efeb498f5ecc2f99", "score": "0.54835725", "text": "func (me TQualificationStatus) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "36ae705ce35773e21c1f4ef777c831a8", "score": "0.5451262", "text": "func (me TLanguageCodesType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "99c89a0bf9677b9b8fc0c30dff4f99cd", "score": "0.54390705", "text": "func (me TSAFTPTDocArchivalNumber) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "7dc30b34e946ff765982c1460556e789", "score": "0.54354554", "text": "func (me *TxsdTaxType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "274d9ff25988d36f1e934eeca1726c30", "score": "0.5428025", "text": "func (me TxsdPaymentStatus) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "048d830431c18a1c883d8fdee9256b89", "score": "0.5389682", "text": "func (me TgridOriginEnumType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "97abf9757584e38bb2976d19cb9bee56", "score": "0.53880054", "text": "func (me TxsdType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "97abf9757584e38bb2976d19cb9bee56", "score": "0.53880054", "text": "func (me TxsdType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "0d43c00e9be57de790392568ff2eae60", "score": "0.53807217", "text": "func (me *TxsdWithholdingTaxType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "6e587b3bafb7ea2359577e449b147ef8", "score": "0.5347666", "text": "func (me TSAFPTProductID) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "d854c5a1d9180d21ab8708b301835f14", "score": "0.5333231", "text": "func (t TransactionID) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "48687408fb0392fac7f776c0e439a157", "score": "0.5324103", "text": "func (me TxsdTaxonomyReference) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "cbbaaf720463a02a4647f30facafd6eb", "score": "0.531585", "text": "func (me TQualificationTypeStatus) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "a2d96b249b60dbcbd7cc425ec964af2c", "score": "0.5307487", "text": "func (me TSAFPTJournalID) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "fe8198a504db84713c8f074fa0101f76", "score": "0.53069204", "text": "func (o *W2) GetTaxYear() string {\n\tif o == nil || o.TaxYear.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.TaxYear.Get()\n}", "title": "" }, { "docid": "5f31e6ac59dc6356d2ca45e6c3653967", "score": "0.527352", "text": "func (me TPostalCodePT) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "1f5a630b0c613a63fb7a8262cab00dc4", "score": "0.5270451", "text": "func (me TMarkerValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "73035f53e7d73e03b6dbff78b2bb3346", "score": "0.5260313", "text": "func (me TisoLanguageCodes) String() string { return xsdt.Token(me).String() }", "title": "" }, { "docid": "91db2f45a4ba12959f55ac7fc225e85f", "score": "0.5256915", "text": "func (me TSAFPTPortugueseTaxExemptionReason) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "1d6b57814a9f18ce30097c9124978182", "score": "0.52476966", "text": "func (me TunitsEnumType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "84af83d7192e7578913b5fd4ec2b8c6a", "score": "0.52372414", "text": "func (t AXValueType) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "e0062535edd53bd5e4fed19e8c98bf9f", "score": "0.5212294", "text": "func (me TxsdProductType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "bab905d1da47ce1f9c8dbb0d98e4dee8", "score": "0.51963747", "text": "func (me TxsdTextPathTypeSpacing) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "f0584de5e3855c417e74847c25e04cad", "score": "0.51931685", "text": "func (m *PaymentTerm) GetCode()(*string) {\n val, err := m.GetBackingStore().Get(\"code\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "b427d0ba2e3d35ca545f83d021b31009", "score": "0.51766485", "text": "func (me THITStatus) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "adec411f2ae8c200e197268bd0d21f38", "score": "0.5171749", "text": "func (c *Cell) String() string {\n\treturn c.FormattedValue()\n}", "title": "" }, { "docid": "e3727a404aa6b365f88ef28d27f535eb", "score": "0.515317", "text": "func (me TSAFmonetaryType) String() string { return xsdt.Decimal(me).String() }", "title": "" }, { "docid": "9988edee88638dd83b0f9f12fab56d96", "score": "0.51487374", "text": "func (me TAttlistDataBankListCompleteYN) String() string { return xsdt.Token(me).String() }", "title": "" }, { "docid": "9ad49da6b3886d7766a1e1b88e611924", "score": "0.51401144", "text": "func (me TxsdThoroughfareDependentThoroughfares) String() string { return xsdt.Nmtoken(me).String() }", "title": "" }, { "docid": "b7aab3cd2b3785dc8b9af8210070be9c", "score": "0.51395226", "text": "func (me TSAFPTTransactionID) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "77c5e13e096d765f36076d9abb0bf5a5", "score": "0.51270986", "text": "func (me TPathDataType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "7479720cdb47c72bdcbf3e05ba5fdecf", "score": "0.51205146", "text": "func (b baseValue) String() string {\n\treturn b.value\n}", "title": "" }, { "docid": "bb7867e77511d8eee2210dbc48d26fe4", "score": "0.5117211", "text": "func (me *TSAFPTPortugueseTaxExemptionCode) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "57fce7e92a8f809d0c56aeb58a164910", "score": "0.51169026", "text": "func (c Code) String() string {\n\treturn codeString[c]\n}", "title": "" }, { "docid": "a7a549c0362c5fb34c50ed9a7289747c", "score": "0.5112654", "text": "func (tid TransactionID) String() string {\n\treturn fmt.Sprintf(\"%x\", tid[:])\n}", "title": "" }, { "docid": "146265f8087d18ac9f0d1a8232094534", "score": "0.51010317", "text": "func (c *TsCell) GetStringValue() string {\n\treturn string(c.cell.GetVarcharValue())\n}", "title": "" }, { "docid": "a107349d621a1b4a86cb50a3e0edc9e8", "score": "0.5098679", "text": "func (me TSAFPTAccountingPeriod) String() string { return xsdt.Integer(me).String() }", "title": "" }, { "docid": "1722893465ae25cb768acdea701c6c40", "score": "0.5093524", "text": "func (e Account) String() string { return ent.EntString(&e) }", "title": "" }, { "docid": "1722893465ae25cb768acdea701c6c40", "score": "0.5093524", "text": "func (e Account) String() string { return ent.EntString(&e) }", "title": "" }, { "docid": "569b646dbf31e4d169501a643c91ef3a", "score": "0.5079552", "text": "func (me TSAFPTCNCode) ToXsdtString() xsdt.String { return xsdt.String(me) }", "title": "" }, { "docid": "09a6526af737d1b02c9cee1682082e8d", "score": "0.5065129", "text": "func (me TFontFamilyValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "23b23f204362272b6cb0a3bd4adee6b5", "score": "0.50451213", "text": "func (me TxsdWorkType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "cf44e16c2cc1e1e7f3ce3747336b07bc", "score": "0.5042068", "text": "func (me *TSAFTPTMovementTaxType) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "b203dcb6b0539491a946f51896e1dcb5", "score": "0.5036684", "text": "func (me TFilterValueType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "a34536d7d1f8aff16c147d12a088f66a", "score": "0.5027845", "text": "func (me TitemIconStateEnumType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "f628c0c0b2bb3849a409c91e7a9d298e", "score": "0.50266135", "text": "func (classCode classCode) String() string {\n\treturn classCodes[classCode]\n}", "title": "" }, { "docid": "9e1f0e29c1ee885b19e2a2d7f2edd749", "score": "0.50248516", "text": "func (me TxsdActuate) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "9e1f0e29c1ee885b19e2a2d7f2edd749", "score": "0.50248516", "text": "func (me TxsdActuate) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "4c7369170934ca74dedc5f5c750f3824", "score": "0.5021245", "text": "func (code Code) String() string {\n\treturn string(code)\n}", "title": "" }, { "docid": "92e32d63daed8e8d8857f2d0cab2dffa", "score": "0.50204974", "text": "func (c CountryCode) String() string {\n\treturn countryCodeMapCC2String[int(c)]\n}", "title": "" }, { "docid": "18c1f4b1f6cfd12e358e277efc1041a3", "score": "0.50168943", "text": "func (me TitemIconStateType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "4ee687a33ac6b7631b39de64b343181b", "score": "0.5014682", "text": "func (me *TxsdTaxAccountingBasis) Set(s string) { (*xsdt.String)(me).Set(s) }", "title": "" }, { "docid": "ba0a62034c3c8a20c0ac7fb3fb2ffd24", "score": "0.50146544", "text": "func (me TGetQualificationRequestsSortProperty) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "424e3f166570749ce64e89d5aa94da19", "score": "0.5012869", "text": "func (txid TransactionID) String() string {\n\treturn hex.EncodeToString(txid)\n}", "title": "" }, { "docid": "83ca94ac4d0f5424f9b6facd8a94e1b9", "score": "0.5007057", "text": "func (t transactionDate) String() string {\n\treturn string(t)\n}", "title": "" }, { "docid": "05519158b786260335a264b3989848c3", "score": "0.49886736", "text": "func (me TartIdType) String() string { return xsdt.String(me).String() }", "title": "" }, { "docid": "bae3c4795afc164fef935bbe76eb6c3b", "score": "0.49862453", "text": "func (code Code) CodeStr() CodeStr {\n\tif code.Parent == nil {\n\t\treturn code.codeStr\n\t}\n\treturn (*code.Parent).CodeStr() + \".\" + code.codeStr\n}", "title": "" }, { "docid": "d2e99ab3ad0de1d133709109aedf61f6", "score": "0.4979344", "text": "func (me TextDecorationValueType) String() string { return xsdt.String(me).String() }", "title": "" } ]
9673755ab177afd04b74788e9a6fb1a2
Start create the ECS complain 'process.start' field. The time the process started.
[ { "docid": "de610d457d5bc2970ebffb94949e3d96", "score": "0.7103511", "text": "func (nsProcess) Start(value time.Time) fld.Field {\n\treturn ecsTime(\"process.start\", value)\n}", "title": "" } ]
[ { "docid": "919360015ced8852976bcdbef1b50381", "score": "0.64444405", "text": "func (p *Process) StartTime() time.Time {\n\treturn p.startTime\n}", "title": "" }, { "docid": "1fcb3e4b883f873c3bfcdd0aaff2ca2b", "score": "0.6196855", "text": "func Start() {\n\tself.startTime = time.Now()\n}", "title": "" }, { "docid": "9e910b0462cd9f956b6e7734b9a9b89e", "score": "0.6013067", "text": "func (w *Worklog) Start() {\n\tw.StartTime = time.Now()\n}", "title": "" }, { "docid": "6442bc53f5f018f29b92e0101309783e", "score": "0.6011492", "text": "func (p *greeterServer) StartTime(nothing interface{}, result *int64) error {\n\t*result = p.IGreeter.StartTime()\n\treturn nil\n}", "title": "" }, { "docid": "f7c1c6e827855e38ac5073feec6e1f9b", "score": "0.59769076", "text": "func (m *Master) start(p ProcessContainer) error {\n\tif p.IsAlive() {\n\t\treturn errors.New(\"Unable to start an running process.\")\n\t}\n\terr := p.Start()\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.SetUptime()\n\tm.Watcher.Add(p)\n\treturn nil\n}", "title": "" }, { "docid": "79d243c1749c0d203c5cdc7362e06a37", "score": "0.59429437", "text": "func (p *process) Start(ctx context.Context) error {\n\tdata, err := json.Marshal(p.spec)\n\tif err != nil {\n\t\treturn err\n\t}\n\trequest := &tasks.ExecProcessRequest{\n\t\tContainerID: p.task.containerID,\n\t\tTerminal: p.io.Terminal,\n\t\tStdin: p.io.Stdin,\n\t\tStdout: p.io.Stdout,\n\t\tStderr: p.io.Stderr,\n\t\tSpec: &protobuf.Any{\n\t\t\tTypeUrl: specs.Version,\n\t\t\tValue: data,\n\t\t},\n\t}\n\tresponse, err := p.task.client.TaskService().Exec(ctx, request)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.pid = response.Pid\n\tclose(p.pidSync)\n\treturn nil\n}", "title": "" }, { "docid": "e2e05f1e6a63f6f1b87498ba053f523d", "score": "0.59411013", "text": "func (p *Process) Start() (err error) {\n\tif p.command, err = p.startProcess(); err != nil {\n\t\treturn err\n\t}\n\tp.log.Debugf(\"New process %s was started (PID: %d)\", p.GetName(), p.GetPid())\n\n\treturn nil\n}", "title": "" }, { "docid": "f98213b86088ff675c271b2089c34174", "score": "0.59380114", "text": "func ProcessStart(msg string, v ...interface{}) string {\n\n\tmaxLen := 80\n\tprocess := fmt.Sprintf(msg, v...)\n\tsubLen := len(process) + len(\"+ >\")\n\n\t// print process, inserting a '-' (colon) 'n' times, where 'n' is the number\n\t// remaining after subtracting subLen (number of 'reserved' characters) from\n\t// maxLen (maximum number of allowed characters)\n\treturn fmt.Sprintf(\"+ %s %s >\\n\", process, strings.Repeat(\"-\", (maxLen-subLen)))\n}", "title": "" }, { "docid": "8d50383fd71a437550d6fd8f92c84484", "score": "0.58398175", "text": "func (p *Process) Started() time.Time {\n\treturn p.started\n}", "title": "" }, { "docid": "ebbc272d377ded65a37c6260e1b33cf3", "score": "0.5749561", "text": "func GetProcessStartTime(pid int) (string, error) {\n\tstat, err := Stat(pid)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"%d\", stat.StartTime), nil\n}", "title": "" }, { "docid": "1001e44f38ace03b1fcdb7069dd9678a", "score": "0.5743982", "text": "func (i *IEPG) Start() time.Time {\n\treturn i.getTime(\"Start\")\n}", "title": "" }, { "docid": "04000918d5a3ee0dfad28723823c42a0", "score": "0.5732359", "text": "func (s *System) RecordStart() {}", "title": "" }, { "docid": "2c47a07c72033c8e67317a8463e5fb48", "score": "0.5697662", "text": "func (p *Process) Start() error {\n\tp.Status.SetStatus(PROCESS_STATUS_STARTED)\n\toutFile, err := os.OpenFile(p.OutFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0777)\n\tif err != nil {\n\t\treturn err\n\t}\n\terrFile, err := os.OpenFile(p.ErrFile, os.O_CREATE|os.O_RDWR|os.O_APPEND, 0777)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Get current directory working path\n\twd, _ := os.Getwd()\n\tprocAtr := &os.ProcAttr{\n\t\tDir: wd,\n\t\tEnv: os.Environ(),\n\t\tFiles: []*os.File{\n\t\t\tos.Stdin,\n\t\t\toutFile,\n\t\t\terrFile,\n\t\t},\n\t}\n\targs := append([]string{p.Name}, p.Args...)\n\tprocess, err := os.StartProcess(p.Cmd, args, procAtr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.process = process\n\tp.Pid = p.process.Pid\n\terr = ioutil.WriteFile(p.PidFile, []byte(strconv.Itoa(proc.process.Pid)), 0660)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Status.InitUptime()\n\tp.Status.SetStatus(PROCESS_STATUS_RUNNING)\n\treturn nil\n}", "title": "" }, { "docid": "392c8bd756d5da92fdc229db3bce653f", "score": "0.56732994", "text": "func (proc *Process) Start() error {\n\tvar err error\n\tif err = proc.Cmd.Start(); err != nil {\n\t\treturn err\n\t}\n\n\t// set PID\n\tosProc := proc.Cmd.Process\n\tif osProc != nil {\n\t\tproc.PidUsage.SetPID(osProc.Pid)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be537ec32a1e31a30b21133fa4c98521", "score": "0.5655213", "text": "func (p *Process) Start() (err error) {\n\tp.TeleportProcess, err = service.NewTeleport(p.teleportConfig)\n\tif err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tp.RegisterFunc(\"gravity.service\", func() (err error) {\n\t\tdefer p.BroadcastEvent(service.Event{\n\t\t\tName: constants.ServiceStartedEvent,\n\t\t\tPayload: &ServiceStartedEvent{Error: err},\n\t\t})\n\t\tif err = p.Init(p.context); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\tif err = p.Serve(); err != nil {\n\t\t\treturn trace.Wrap(err)\n\t\t}\n\t\treturn nil\n\t})\n\treturn p.TeleportProcess.Start()\n}", "title": "" }, { "docid": "cb2ffa302e73951a5c2fc437f6b23050", "score": "0.5653304", "text": "func StartTime() time.Time {\n\treturn start\n}", "title": "" }, { "docid": "a8b2e6a6f84e868abf22e0344f20d056", "score": "0.5653014", "text": "func (p *Process) GetStartTime() time.Time {\n\treturn p.startTime\n}", "title": "" }, { "docid": "19faffc179ec837eda989a7680c8ed4e", "score": "0.5646406", "text": "func (db *DB) StartProcess(j *models.RegistryJournal) error {\n\treturn j.Insert(db.ctx, db.conn, boil.Infer())\n}", "title": "" }, { "docid": "83eb407687e577d0f74ee20220cb138e", "score": "0.56409776", "text": "func (t *Test) Start(msg string) {\n\tt.SetStatus(msg)\n\tt.count = 0\n\tt.msg = msg\n\tt.start = time.Now()\n}", "title": "" }, { "docid": "446e087e9b513ba3f76c433af7d330c9", "score": "0.5636855", "text": "func (this *Server) Ps_Start(conn net.Conn, applicationName string, processTypes []string) error {\n\treturn this.Ps_Manage(\"start\", conn, applicationName, processTypes)\n}", "title": "" }, { "docid": "2b138fdcf84f5f7a82d89b5e902cd343", "score": "0.5630343", "text": "func (m *stageExecution) StartTime() int64 {\n\treturn m.startTimeField\n}", "title": "" }, { "docid": "a893cf5088c80632ed2c1d6a488723c0", "score": "0.5609391", "text": "func (s *pqScheduler) start(ctx context.Context) { go s.process(ctx) }", "title": "" }, { "docid": "663699a33e051849a50ccb962e52beb9", "score": "0.5551648", "text": "func (b *BM) Start() {\n\tb.startTime = time.Now()\n}", "title": "" }, { "docid": "7cd647b4c1808a80a25ad91a28b7bf7b", "score": "0.5532372", "text": "func (t *Time) Start() {\n\tt.St = time.Now()\n}", "title": "" }, { "docid": "f9a0e84ab062941fb66e3a70d83d89f3", "score": "0.55267406", "text": "func (t *Task) Start() time.Time {\n\tt.started = time.Now().In(time.UTC)\n\tt.Started = t.started.Format(time.RFC3339)\n\n\treturn t.started\n}", "title": "" }, { "docid": "4744853a14f4f6b924d7fee55e8fa39a", "score": "0.55199623", "text": "func (s *StopWatch) Start() {\n\ts.startTime = time.Now()\n}", "title": "" }, { "docid": "71a3fa04826da5586863b613de7dce1f", "score": "0.54773045", "text": "func (proc *Proc) Start() error {\n\toutFile, err := utils.GetFile(proc.Outfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\terrFile, err := utils.GetFile(proc.Errfile)\n\tif err != nil {\n\t\treturn err\n\t}\n\twd, _ := os.Getwd()\n\tprocAtr := &os.ProcAttr{\n\t\tDir: wd,\n\t\tEnv: os.Environ(),\n\t\tFiles: []*os.File{\n\t\t\tos.Stdin,\n\t\t\toutFile,\n\t\t\terrFile,\n\t\t},\n\t}\n\targs := append([]string{proc.Name}, proc.Args...)\n\tprocess, err := os.StartProcess(proc.Cmd, args, procAtr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tproc.process = process\n\tproc.Pid = proc.process.Pid\n\terr = utils.WriteFile(proc.Pidfile, []byte(strconv.Itoa(proc.process.Pid)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tproc.Status.InitUptime()\n\tproc.Status.SetStatus(\"started\")\n\treturn nil\n}", "title": "" }, { "docid": "bf309368248f3767d4593ad921d49160", "score": "0.54690343", "text": "func (o AlertProcessingRuleSuppressionScheduleRecurrenceDailyOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionScheduleRecurrenceDaily) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c434e4b6e1d5b48c2275653b06f1d1d1", "score": "0.542487", "text": "func (_Token *TokenCaller) StartTime(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"startTime\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "1a8c89eea5c1c7ed4ac3c5e6526b3dfb", "score": "0.54183984", "text": "func (p *program) Start(s service.Service) error {\n\t\n\t/*-----------------------------------------------------------*/\n \n\tMetricsRun()\n\n\t/*-----------------------------------------------------------*/\n\n\treturn nil\n}", "title": "" }, { "docid": "7ba6a7d68c3ae5a8cf20edba17fbd72c", "score": "0.5398627", "text": "func (ex Exec) WaitForProcessToStart(process string) (started bool, pid string) {\n\tdefer logger.Sync()\n\n\tos.Setenv(\"USER\", \"root\")\n\tcount := 0\n\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\n\t\t\trepo, err := hsperfdata.New()\n\t\t\tif err == nil {\n\t\t\t\tfiles, err := repo.GetFiles()\n\t\t\t\tif err == nil {\n\t\t\t\t\tfor _, f := range files {\n\t\t\t\t\t\tresult, e := f.Read()\n\t\t\t\t\t\tif e == nil {\n\t\t\t\t\t\t\tname := result.GetProcName()\n\t\t\t\t\t\t\tlogger.Info(\"Running Process\",\n\t\t\t\t\t\t\t\t// Structured context as strongly typed Field values.\n\t\t\t\t\t\t\t\tlog.String(\"Name\", name),\n\t\t\t\t\t\t\t\tlog.String(\"Pid\", f.GetPid()),\n\t\t\t\t\t\t\t\tlog.Duration(\"backoff\", time.Second))\n\t\t\t\t\t\t\tif strings.Contains(strings.ToLower(name), strings.ToLower(process)) {\n\t\t\t\t\t\t\t\tstarted = true\n\t\t\t\t\t\t\t\tpid = f.GetPid()\n\t\t\t\t\t\t\t\treturn\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\tcancel()\n\t\t\tcount = count + 1\n\t\t\t//Waited too long for slave to start..something went wrong\n\t\t\tif count == 4 {\n\t\t\t\tstarted = false\n\t\t\t\treturn\n\t\t\t}\n\t\t\tctx, cancel = context.WithTimeout(context.Background(), 10*time.Second)\n\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e6ae279ca5d433585e504f1d635e36a7", "score": "0.538878", "text": "func SetStartTime(t manager) {\n\tt.startTime = time.Now().Unix()\n}", "title": "" }, { "docid": "156f604d199873cdb0fd271a786492f4", "score": "0.5387306", "text": "func (s *ExternalService) Start() error {\n\tlogfile, err := os.Create(fmt.Sprintf(\"/tmp/%s.log\", s.name))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmd := exec.Command(\"bash\", \"-c\", s.command)\n\tcmd.Dir = s.directory\n\tcmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}\n\tcmd.Stdout = logfile\n\tcmd.Stderr = logfile\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp, err := procs.FindByPid(cmd.Process.Pid)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.process = p\n\n\treturn nil\n}", "title": "" }, { "docid": "c849a8467db443f27efc04f6f8e3ed67", "score": "0.53834444", "text": "func (o BuildResponseOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v BuildResponse) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ae2d4007b65c35addf2871dacf81bec1", "score": "0.53820443", "text": "func (o ManagedIntegrationRuntimeOperationResultResponseOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ManagedIntegrationRuntimeOperationResultResponse) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "99414f221717e80c964556e0c002c212", "score": "0.53719825", "text": "func (s *workerServer) Start(ctx context.Context, r *proto.StartRequest) (*proto.StartResponse, error) {\n\n\tjobID, err := s.Service.Start(append([]string{r.ProcessName}, r.Args...))\n\tif err != nil {\n\t\treturn nil, status.Error(codes.Internal, err.Error())\n\t}\n\tout := proto.StartResponse{\n\t\tJobID: jobID,\n\t}\n\treturn &out, nil\n}", "title": "" }, { "docid": "86a63e3e12c01c1089dca0fb1722752a", "score": "0.53713596", "text": "func (o AlertProcessingRuleActionGroupScheduleRecurrenceDailyOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupScheduleRecurrenceDaily) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b678b3f6919b21cef02551916035c771", "score": "0.5367862", "text": "func (sp *SpanProcessor) Start() error {\n\tsp.Logger.Info(\"Starting\")\n\treturn nil\n}", "title": "" }, { "docid": "f35006d791dbd38f8ae34c457bd1cdcf", "score": "0.53471553", "text": "func (ctx *Context) StartTime() time.Time {\n\treturn ctx.startTime\n}", "title": "" }, { "docid": "dffbaaf479d34fd789f42eb0ac130e8b", "score": "0.53404814", "text": "func (c *Container) start(ctx context.Context) error {\n\tdefer trace.End(trace.Begin(\"Container.start\"))\n\n\tif c.vm == nil {\n\t\treturn fmt.Errorf(\"vm not set\")\n\t}\n\n\t// Power on\n\t_, err := tasks.WaitForResult(ctx, func(ctx context.Context) (tasks.ResultWaiter, error) {\n\t\treturn c.vm.PowerOn(ctx)\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// guestinfo key that we want to wait for\n\tkey := fmt.Sprintf(\"guestinfo..sessions|%s.started\", c.ID)\n\tvar detail string\n\n\t// Wait some before giving up...\n\tctx, cancel := context.WithTimeout(ctx, propertyCollectorTimeout)\n\tdefer cancel()\n\n\tdetail, err = c.vm.WaitForKeyInExtraConfig(ctx, key)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to wait for process launch status: %s\", err.Error())\n\t}\n\n\tif detail != \"true\" {\n\t\treturn errors.New(detail)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "84c9023818c72afce3e2930521de6067", "score": "0.53368956", "text": "func (app *App) Start(ctx context.Context, w io.Writer, process, versionStr string) error {\n\tw = app.withLogWriter(w)\n\tmsg := fmt.Sprintf(\"\\n ---> Starting the process %q\", process)\n\tif process == \"\" {\n\t\tmsg = fmt.Sprintf(\"\\n ---> Starting the app %q\", app.Name)\n\t}\n\tfmt.Fprintf(w, \"%s\\n\", msg)\n\tprov, err := app.getProvisioner()\n\tif err != nil {\n\t\treturn err\n\t}\n\tversion, err := app.getVersionAllowNil(versionStr)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = prov.Start(ctx, app, process, version, w)\n\tif err != nil {\n\t\tlog.Errorf(\"[start] error on start the app %s - %s\", app.Name, err)\n\t\treturn newErrorWithLog(err, app, \"start\")\n\t}\n\trebuild.RoutesRebuildOrEnqueueWithProgress(app.Name, w)\n\treturn err\n}", "title": "" }, { "docid": "951caa44472f95e63257eb826e238c56", "score": "0.5331497", "text": "func (m *BackgroundProcessManager) StartProcess(cmd *ManagedProcess) (*process.Process, error) {\n\tvar identifierLock *sync.Mutex\n\tif cmd.Identifier != nil {\n\t\tlock, _ := m.identifiers.LoadOrStore(*cmd.Identifier, &sync.Mutex{})\n\n\t\tidentifierLock = lock.(*sync.Mutex)\n\n\t\tidentifierLock.Lock()\n\t}\n\n\terr := cmd.Start()\n\tif err != nil {\n\t\tlog.Error(err, \"fail to start process\")\n\t\treturn nil, err\n\t}\n\n\tpid := cmd.Process.Pid\n\tprocState, err := process.NewProcess(int32(cmd.Process.Pid))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tct, err := procState.CreateTime()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpair := ProcessPair{\n\t\tPid: pid,\n\t\tCreateTime: ct,\n\t}\n\n\tchannel, _ := m.deathSig.LoadOrStore(pair, make(chan bool, 1))\n\tdeathChannel := channel.(chan bool)\n\n\tstdio := &Stdio{Locker: &sync.Mutex{}}\n\tif cmd.Stdin != nil {\n\t\tif stdin, ok := cmd.Stdin.(io.ReadWriteCloser); ok {\n\t\t\tstdio.Stdin = stdin\n\t\t}\n\t}\n\n\tif cmd.Stdout != nil {\n\t\tif stdout, ok := cmd.Stdout.(io.ReadWriteCloser); ok {\n\t\t\tstdio.Stdout = stdout\n\t\t}\n\t}\n\n\tif cmd.Stderr != nil {\n\t\tif stderr, ok := cmd.Stderr.(io.ReadWriteCloser); ok {\n\t\t\tstdio.Stderr = stderr\n\t\t}\n\t}\n\n\tm.stdio.Store(pair, stdio)\n\n\tlog := log.WithValues(\"pid\", pid)\n\n\tgo func() {\n\t\terr := cmd.Wait()\n\t\tif err != nil {\n\t\t\terr, ok := err.(*exec.ExitError)\n\t\t\tif ok {\n\t\t\t\tstatus := err.Sys().(syscall.WaitStatus)\n\t\t\t\tif status.Signaled() && status.Signal() == syscall.SIGTERM {\n\t\t\t\t\tlog.Info(\"process stopped with SIGTERM signal\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlog.Error(err, \"process exited accidentally\")\n\t\t\t}\n\t\t}\n\n\t\tlog.Info(\"process stopped\")\n\n\t\tdeathChannel <- true\n\t\tm.deathSig.Delete(pair)\n\t\tif io, loaded := m.stdio.LoadAndDelete(pair); loaded {\n\t\t\tif stdio, ok := io.(*Stdio); ok {\n\t\t\t\tstdio.Lock()\n\t\t\t\tif stdio.Stdin != nil {\n\t\t\t\t\tif err = stdio.Stdin.Close(); err != nil {\n\t\t\t\t\t\tlog.Error(err, \"stdin fails to be closed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif stdio.Stdout != nil {\n\t\t\t\t\tif err = stdio.Stdout.Close(); err != nil {\n\t\t\t\t\t\tlog.Error(err, \"stdout fails to be closed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif stdio.Stderr != nil {\n\t\t\t\t\tif err = stdio.Stderr.Close(); err != nil {\n\t\t\t\t\t\tlog.Error(err, \"stderr fails to be closed\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstdio.Unlock()\n\t\t\t}\n\t\t}\n\n\t\tif identifierLock != nil {\n\t\t\tidentifierLock.Unlock()\n\t\t\tm.identifiers.Delete(*cmd.Identifier)\n\t\t}\n\t}()\n\n\treturn procState, nil\n}", "title": "" }, { "docid": "95861ec167ebb42a208e1597bcd06df3", "score": "0.5300826", "text": "func (controller *Controller) Start() error {\n\tpidFileExists, processAlive, heartbeat := controller.Status()\n\tif pidFileExists || processAlive || heartbeat {\n\t\treturn errors.New(\"trakx is already running\")\n\t}\n\n\tlogFile, err := os.OpenFile(controller.logPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, logFilePermissions)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to open log file\")\n\t}\n\tdefer logFile.Close()\n\n\tcmd := exec.Command(os.Args[0], \"execute\")\n\tcmd.Stdout = logFile\n\tcmd.Stderr = logFile\n\tif err := cmd.Start(); err != nil {\n\t\treturn errors.Wrap(err, \"failed to start trakx process\")\n\t}\n\n\tif err := controller.processIDFile.Write(cmd.Process.Pid); err != nil {\n\t\treturn errors.Wrap(err, \"failed to write process id to file\")\n\t}\n\n\tfmt.Println(\"started trakx!\")\n\treturn nil\n}", "title": "" }, { "docid": "cc80a8fa045810e3bbf38f00b5154490", "score": "0.528486", "text": "func (o AlertProcessingRuleSuppressionScheduleRecurrenceWeeklyOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionScheduleRecurrenceWeekly) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c50b547d578c4222c7f5be44eb77ca3e", "score": "0.52802026", "text": "func SetStartTime(p *Pomodoro) {\n\tp.Start = GetCurrentTime()\n\tfmt.Println(\"Pomodoro started at: \", p.Start.Format(Layout))\n}", "title": "" }, { "docid": "bbd0c084007af0bf6b94f8fcc20713b4", "score": "0.5278689", "text": "func (self *Timer) Start() { self.start = time.Now() }", "title": "" }, { "docid": "9430ea748cfba9c601cca0fe40317a8a", "score": "0.52660817", "text": "func (p *Processus) Start() error {\n\tif !p.Status {\n\t\t// Starts the stuff\n\t\t/* q := fmt.Sprintf(\"systemctl start %s\", p.Name)\n\t\tcmd := exec.Command(\"sudo\", \"bash\", q) */\n\t\t// cmd := exec.Command(q)\n\t\terr := cmd.Run()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\treturn errors.New(\"Could not start the processus \" + p.Name)\n}", "title": "" }, { "docid": "48aa5dd8c0cd16c266243d9c56841641", "score": "0.52547014", "text": "func (c *Cmd) Start() error {\n\treturn c.StartTimeout(time.Time{})\n}", "title": "" }, { "docid": "8885bb6a5984a6d49140f16f645aac6a", "score": "0.52523685", "text": "func (s Server) start(m *tb.Message) {\n\tconst startMessage = `\nЯ бот напоминающий о твоем дне рождения!\nДоступные команды:\n\nСправка\n/start\n\nУстановить поздравление на день рождения в формате день.месяц\n/bday 01.12\n\nСвязаться с разработчиком\n/feedback текст сообщения`\n\n\t_, _ = s.bot.Send(m.Chat, startMessage)\n}", "title": "" }, { "docid": "1acdbd85aebbcacb5fa798545628c613", "score": "0.52423286", "text": "func (ej *ETJob) StartTime() *metav1.Time {\n\treturn &ej.trainingjob.CreationTimestamp\n}", "title": "" }, { "docid": "5dfeac7ac04863ea2f7f337a9a386533", "score": "0.5241705", "text": "func (o *orchestrator) StartProcess(procID string) ([]byte, error) {\n\tif o.processes[procID] == nil {\n\t\treturn nil, errors.New(\"Pipeline Not found\")\n\t}\n\tfmt.Println(\"Sending START Proc to node: \" + o.processes[procID].Ip)\n\treturn o.sendCommand(o.processes[procID].Ip, \"process/\"+o.processes[procID].Process.Id+\"/start\", \"GET\", nil)\n}", "title": "" }, { "docid": "ab0d472d581f199898222964b0e3eb2c", "score": "0.5238363", "text": "func (nsEvent) Start(value time.Time) fld.Field {\n\treturn ecsTime(\"event.start\", value)\n}", "title": "" }, { "docid": "9969ad28401c1253b402dfe2cb4b225e", "score": "0.52329755", "text": "func (js *JobStatus) StartTime() time.Time {\n return private_gestatus.GetStartTime(&js.js)\n}", "title": "" }, { "docid": "2a21649f6b5fb6bd1e1820e9b396e5ef", "score": "0.523031", "text": "func (m *Manager) Start() (error) {\n\tif m.getStatus() == Stopped {\n\t\tgo launch(m)\n\t\treturn nil\n\t} else {\n\t\treturn errors.New(\"already running. please wait until process has stopped\")\n\t}\n}", "title": "" }, { "docid": "8e1306fcd550c4cbbad91cdef3c8c7ac", "score": "0.5224534", "text": "func (_Token *TokenCallerSession) StartTime() (*big.Int, error) {\n\treturn _Token.Contract.StartTime(&_Token.CallOpts)\n}", "title": "" }, { "docid": "0c0d163bbd27925c7778ccaa121bed21", "score": "0.5219584", "text": "func (o AlertProcessingRuleSuppressionScheduleRecurrenceMonthlyOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionScheduleRecurrenceMonthly) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5a3c183a10d9f49edf03f273f3d1a8af", "score": "0.52188325", "text": "func (o AlertProcessingRuleActionGroupScheduleRecurrenceWeeklyOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupScheduleRecurrenceWeekly) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a7795bdc505e7f32856eb2d908d051dc", "score": "0.52111137", "text": "func (vtp *VtProcess) WaitStart() (err error) {\n\tvtp.proc = exec.Command(\n\t\tvtp.Binary,\n\t\t\"--port\", fmt.Sprintf(\"%d\", vtp.Port),\n\t\t\"--log_dir\", vtp.LogDirectory,\n\t\t\"--alsologtostderr\",\n\t)\n\n\tif vtp.PortGrpc != 0 {\n\t\tvtp.proc.Args = append(vtp.proc.Args, \"--grpc_port\")\n\t\tvtp.proc.Args = append(vtp.proc.Args, fmt.Sprintf(\"%d\", vtp.PortGrpc))\n\t}\n\n\tvtp.proc.Args = append(vtp.proc.Args, vtp.ExtraArgs...)\n\tvtp.proc.Env = append(vtp.proc.Env, os.Environ()...)\n\tvtp.proc.Env = append(vtp.proc.Env, vtp.Env...)\n\n\tvtp.proc.Stderr = os.Stderr\n\tvtp.proc.Stdout = os.Stdout\n\n\tlog.Infof(\"%v %v\", strings.Join(vtp.proc.Args, \" \"))\n\terr = vtp.proc.Start()\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvtp.exit = make(chan error)\n\tgo func() {\n\t\tvtp.exit <- vtp.proc.Wait()\n\t}()\n\n\ttimeout := time.Now().Add(60 * time.Second)\n\tfor time.Now().Before(timeout) {\n\t\tif vtp.IsHealthy() {\n\t\t\treturn nil\n\t\t}\n\n\t\tselect {\n\t\tcase err := <-vtp.exit:\n\t\t\treturn fmt.Errorf(\"process '%s' exited prematurely (err: %s)\", vtp.Name, err)\n\t\tdefault:\n\t\t\ttime.Sleep(300 * time.Millisecond)\n\t\t}\n\t}\n\n\tvtp.proc.Process.Kill()\n\treturn fmt.Errorf(\"process '%s' timed out after 60s (err: %s)\", vtp.Name, <-vtp.exit)\n}", "title": "" }, { "docid": "4f4e3f0dd1116acdce0c35a441163605", "score": "0.52091295", "text": "func (o LineageEventOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LineageEvent) pulumi.StringOutput { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fd9faba893115969a79ce0d0d916257e", "score": "0.52023906", "text": "func PgPostmasterStartTime(db XODB) (time.Time, error) {\n\tvar err error\n\n\t// sql query\n\tconst sqlstr = `SELECT pg_catalog.pg_postmaster_start_time()`\n\n\t// run query\n\tvar ret time.Time\n\tXOLog(sqlstr)\n\terr = db.QueryRow(sqlstr).Scan(&ret)\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\n\treturn ret, nil\n}", "title": "" }, { "docid": "19829011457a328aff57fe26149598ae", "score": "0.5198082", "text": "func (_Token *TokenSession) StartTime() (*big.Int, error) {\n\treturn _Token.Contract.StartTime(&_Token.CallOpts)\n}", "title": "" }, { "docid": "9146ffc684afcfdedf7c48a7aa9300c1", "score": "0.5197911", "text": "func (r *run) Start(props *StepProperties) {\n\tmsg := &Message{\n\t\tType: MsgType_StepStarted,\n\t\tStepId: props.Id,\n\t\tStep: props,\n\t}\n\tr.send(msg)\n}", "title": "" }, { "docid": "05e6614d1508bad60371e74f852c402a", "score": "0.51916474", "text": "func (t *Task) Start() {\n\tt.Started = time.Now()\n\tt.Finished = time.Time{}\n}", "title": "" }, { "docid": "98c8d71502a69df3f850508bf5375dfd", "score": "0.51595116", "text": "func (rb *RecoveryRecordBuilder) StartTime(starttime *DateTimeBuilder) *RecoveryRecordBuilder {\n\tv := starttime.Build()\n\trb.v.StartTime = &v\n\treturn rb\n}", "title": "" }, { "docid": "2ac64afcf3f8c5ea48e4e779443a743e", "score": "0.5157552", "text": "func (o ScanRunResponseOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ScanRunResponse) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "64b7bd9db1e9da9bd84013e6f8170f9d", "score": "0.51472175", "text": "func (client *RemoteClient) StartProcess(procName string) error {\n\tvar started bool\n\treturn client.conn.Call(\"RemoteMaster.StartProcess\", procName, &started)\n}", "title": "" }, { "docid": "2a1759ad88a76a7c08321fa5057f98a0", "score": "0.5145918", "text": "func (o SuppressionScheduleResponseOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SuppressionScheduleResponse) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ed58e4922e9a95fda2579ea16cd9d0ec", "score": "0.51390713", "text": "func (o AlertProcessingRuleActionGroupScheduleRecurrenceMonthlyOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupScheduleRecurrenceMonthly) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7de8c54651c3bf855ab9c70eb54407d0", "score": "0.51389307", "text": "func (dsj *DeepSpeedJob) StartTime() *metav1.Time {\n\treturn &dsj.trainingjob.CreationTimestamp\n}", "title": "" }, { "docid": "cd0547f6a3e1b87b48c45e8b570e3099", "score": "0.51362675", "text": "func (o *osExec) StartProcess(cmdConf *ProcessConf) (Process, error) {\r\n\treturn newOsProcess(cmdConf)\r\n}", "title": "" }, { "docid": "9190467f702b7527f7e2915f022a01ec", "score": "0.51260155", "text": "func (o SuppressionScheduleOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SuppressionSchedule) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9fec9aca88cd1b76edb89a49bde45fa2", "score": "0.51230174", "text": "func (h *Handler) Start(ctx context.Context, st, et time.Time) error {\n\tif err := h.start(ctx, st, et); err != nil {\n\t\treturn xerrors.Errorf(\"error in start method: %w\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7ae4bb27ea3e40c4ee4dd9600b3d7bd7", "score": "0.51141894", "text": "func (pier *Pier) Start() error {\n\tlogger.WithFields(logrus.Fields{\n\t\t\"id\": pier.meta.ID,\n\t\t\"interchain_counter\": pier.meta.InterchainCounter,\n\t\t\"receipt_counter\": pier.meta.ReceiptCounter,\n\t\t\"source_receipt_counter\": pier.meta.SourceReceiptCounter,\n\t}).Info(\"Pier information\")\n\n\tif err := pier.monitor.Start(); err != nil {\n\t\treturn fmt.Errorf(\"monitor start: %w\", err)\n\t}\n\n\tif err := pier.exec.Start(); err != nil {\n\t\treturn fmt.Errorf(\"executor start: %w\", err)\n\t}\n\n\tif err := pier.sync.Start(); err != nil {\n\t\treturn fmt.Errorf(\"sync start: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1f9bf14c8dc7b9b2d2a21f6a91f50224", "score": "0.5111377", "text": "func (s *Server) ActionStart(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != \"POST\" {\n\t\thttp.NotFound(w, r)\n\t\treturn\n\t}\n\n\tnow := time.Now()\n\tswitch s.state {\n\tcase StateStopped:\n\t\tt := now.Add(s.mode.Duration())\n\t\ts.t = t\n\t\ts.state = StateRunning\n\n\tcase StatePaused:\n\t\tt := now.Add(s.d)\n\t\ts.t = t\n\t\ts.state = StateRunning\n\n\tcase StateRunning:\n\t\ts.RefreshStatus(true)\n\t\tif s.state == StateRunning {\n\t\t\ts.d = s.t.Sub(now)\n\t\t\ts.state = StatePaused\n\t\t}\n\t}\n\n\tstr := s.formatTimer()\n\tfmt.Fprint(w, str)\n}", "title": "" }, { "docid": "947e1279b53571b1b56a28be73e11526", "score": "0.510696", "text": "func (remote_master *RemoteMaster) StartProcess(procName string, ack *bool) error {\n\t*ack = true\n\treturn remote_master.master.StartProcess(procName)\n}", "title": "" }, { "docid": "738a7974be99af95410226c1084e5480", "score": "0.509568", "text": "func (o LookupJobResultOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupJobResult) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "d0f5ac492a2a9768008b8e6facf84810", "score": "0.50794524", "text": "func StartJOB(item, params string) {\n\tnow := time.Now().Format(time.RFC3339)\n\n\tres, err := db.Model(\"mq_table\").Data(g.Map{\"item\": item, \"status\": \"0\", \"params\": params, \"starttime\": now}).Save()\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\tlog.Println(\"mq start finish:\", item, res)\n}", "title": "" }, { "docid": "ec65e6bfd15dddaf05eb2815946961e1", "score": "0.5074514", "text": "func (rb *TrainedModelDeploymentNodesStatsBuilder) StartTime(starttime *EpochTimeUnitMillisBuilder) *TrainedModelDeploymentNodesStatsBuilder {\n\tv := starttime.Build()\n\trb.v.StartTime = v\n\treturn rb\n}", "title": "" }, { "docid": "c7b00805e24d09b5053f28105f7f0375", "score": "0.50738555", "text": "func (o LookupConversationResultOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupConversationResult) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5bfee2dfac0be65da36ae1e1fb530cb7", "score": "0.507212", "text": "func (sn *Node) StartTime() time.Time {\n\treturn sn.startTime\n}", "title": "" }, { "docid": "a2b1c667b73c3899d33ac5a0846a5e3d", "score": "0.50713235", "text": "func (suite *PouchStartSuite) TestStartCommand(c *check.C) {\n\tname := \"start-normal\"\n\tres := command.PouchRun(\"create\", \"--name\", name, busyboxImage, \"top\")\n\tdefer DelContainerForceMultyTime(c, name)\n\tres.Assert(c, icmd.Success)\n\n\tcommand.PouchRun(\"start\", name).Assert(c, icmd.Success)\n\n\tcommand.PouchRun(\"stop\", name).Assert(c, icmd.Success)\n}", "title": "" }, { "docid": "7c7176a8070fcd94c572f15256bc5b9e", "score": "0.50696224", "text": "func (o TriggerBuildArtifactsObjectsTimingOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v TriggerBuildArtifactsObjectsTiming) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e02e19698264a189268bf311c0f55b28", "score": "0.5066349", "text": "func (_Token *TokenCaller) STARTTIME(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Token.contract.Call(opts, out, \"START_TIME\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "6c2b3df16c0c983fbd2f15a5722b65e6", "score": "0.50632656", "text": "func (r *Reporter) Start(_ context.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "209dea6540fd85f17d91416dd62d8b8e", "score": "0.50632626", "text": "func (o BuildResponsePtrOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *BuildResponse) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.StartTime\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "1d0d3e3a1b76c124797ee4c2531bf510", "score": "0.50616515", "text": "func (o BackupRunOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *BackupRun) pulumi.StringOutput { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1066219ec82e83060d5eb4647defa979", "score": "0.5057334", "text": "func (p *profiler) Start() time.Time {\n\tatomic.AddUint64(&p.cntStart, 1)\n\treturn time.Now()\n}", "title": "" }, { "docid": "65d66991c0807fde5f1946d41e4d0ec3", "score": "0.50415695", "text": "func (pm *Manager) ProcessCreate(ctx context.Context, req *rpc.ProcessCreateRequest) (ret *rpc.ProcessResponse, err error) {\n\tif req.Spec.Name == \"\" || req.Spec.Binary == \"\" {\n\t\treturn nil, status.Errorf(codes.InvalidArgument, \"missing required argument\")\n\t}\n\n\tlogrus.Infof(\"Process Manager: prepare to create process %v\", req.Spec.Name)\n\tlogger, err := util.NewLonghornWriter(req.Spec.Name, pm.logsDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tprocessPath, err := ensureValidProcessPath(req.Spec.Binary)\n\tif err != nil {\n\t\treturn nil, status.Error(codes.InvalidArgument, err.Error())\n\t}\n\n\tp := &Process{\n\t\tName: req.Spec.Name,\n\t\tBinary: processPath,\n\t\tArgs: req.Spec.Args,\n\t\tPortCount: req.Spec.PortCount,\n\t\tPortArgs: req.Spec.PortArgs,\n\n\t\tUUID: util.UUID(),\n\n\t\tState: StateStarting,\n\n\t\tlock: &sync.RWMutex{},\n\n\t\tlogger: logger,\n\n\t\texecutor: pm.Executor,\n\t\thealthChecker: pm.HealthChecker,\n\t}\n\n\tif err := pm.registerProcess(p); err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.UpdateCh <- p\n\tif err := p.Start(); err != nil {\n\t\t// initializing failed so we sent event about the failed state, but still return the process rpc below\n\t\t// this is to be consistent with the prior implementation\n\t\tlogrus.WithError(err).Errorf(\"Process Manager: failed to init new process %v\", req.Spec.Name)\n\t\tp.UpdateCh <- p\n\t} else {\n\t\tlogrus.Infof(\"Process Manager: created process %v\", req.Spec.Name)\n\t}\n\n\treturn p.RPCResponse(), nil\n}", "title": "" }, { "docid": "ec70777d09f1ca2ecd36a76b36905b01", "score": "0.50411636", "text": "func (o SynchronizationDetailsResponseOutput) StartTime() pulumi.StringOutput {\n\treturn o.ApplyT(func(v SynchronizationDetailsResponse) string { return v.StartTime }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8b93f8933caab415e81850799227dbf5", "score": "0.5039644", "text": "func (p *Process) Runtime() time.Duration {\n\treturn p.time\n}", "title": "" }, { "docid": "af190a7795f169e016f361ec58858d98", "score": "0.50392973", "text": "func (m *Master) StartProcess(name string) error {\n\tm.Lock()\n\tdefer m.Unlock()\n\tif p, ok := m.Processes[name]; ok {\n\t\treturn m.start(p)\n\t}\n\treturn errors.New(\"Unable to start an unknown process.\")\n}", "title": "" }, { "docid": "20c2b3795288a96a0a71c8f22b2d1abe", "score": "0.50180596", "text": "func GetStartTime(p *Pomodoro) (st time.Time) {\n\tst = p.Start\n\treturn\n}", "title": "" }, { "docid": "27ad6cca08223c5111ee174786165f0f", "score": "0.501421", "text": "func (o ScanRunOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ScanRun) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "fe26312b6b6dfd4f8e7f587397b3e2bc", "score": "0.50080264", "text": "func (p *ParallelProcess) Start() error {\n\tlog.Infof(\"Starting %q with args %q.\", p.child.Path, p.child.Args[1:])\n\treturn p.child.Start()\n}", "title": "" }, { "docid": "8e0f11df55a60a41ef425b3862cafb5d", "score": "0.5007525", "text": "func (kc *KronosClient) setStart(options map[string]interface{}, startTime *KronosTime, requestDict map[string]interface{}) {\n\tstartId := options[\"startId\"]\n\tif startId == nil {\n\t\trequestDict[\"start_time\"] = startTime.Time\n\t} else {\n\t\trequestDict[\"start_id\"] = startId.(string)\n\t}\n}", "title": "" }, { "docid": "de6d0f6069a7570a5ec1627c9c9b6401", "score": "0.49998814", "text": "func (info *TrackInfo) StartTime() time.Time { return info.startTime }", "title": "" }, { "docid": "b2f15b5a237e13e7e4ef13811aee7561", "score": "0.49871436", "text": "func (b *Booking) StartTime() time.Time {\r\n\treturn b.target.startTime\r\n}", "title": "" }, { "docid": "cdbffc408709e17d0519eaa0850d8186", "score": "0.49861705", "text": "func Start() {\n\tdefaultScheduler.Start()\n}", "title": "" }, { "docid": "6cc81e3edba3a89fdac1f881ff2125fb", "score": "0.49842262", "text": "func (o ShareSynchronizationResponseOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v ShareSynchronizationResponse) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0092d0b6a8092893f4e9ab9bb253914e", "score": "0.4982619", "text": "func (o PatchDeploymentRecurringScheduleOutput) StartTime() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v PatchDeploymentRecurringSchedule) *string { return v.StartTime }).(pulumi.StringPtrOutput)\n}", "title": "" } ]
68f117bcc9dc984a3c74e3aea73ce189
update updates a single region/program pair.
[ { "docid": "1e263719fdb4db5723f9b2c9c67ab5da", "score": "0.6228854", "text": "func (d *datastore) update(ctx context.Context, region ngdp.Region, program ngdp.ProgramCode) error {\n\tglog.Infof(\"Updating %q/%q\", program, region)\n\n\tcdn, version, err := d.llc.Info(ctx, program, region)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"retrieving info\")\n\t}\n\n\td.l.RLock()\n\toldVersion, haveOldVersion := d.versionInfos[program][region]\n\tbuildConfig, haveBuildConfig := d.buildConfigs[version.BuildConfig]\n\tcdnConfig, haveCDNConfig := d.cdnConfigs[version.CDNConfig]\n\td.l.RUnlock()\n\n\tif haveOldVersion {\n\t\tif oldVersion.VersionsName != version.VersionsName {\n\t\t\tglog.Infof(\"%q/%q: version string changed from %v to %v\", program, region, oldVersion.VersionsName, version.VersionsName)\n\t\t}\n\t\tif oldVersion.BuildID != version.BuildID {\n\t\t\tglog.Infof(\"%q/%q: build ID changed from %v to %v\", program, region, oldVersion.BuildID, version.BuildID)\n\t\t}\n\t\tif !oldVersion.BuildConfig.Equal(version.BuildConfig) {\n\t\t\tglog.Infof(\"%q/%q: build config changed from %032x to %032x\", program, region, oldVersion.BuildConfig, version.BuildConfig)\n\t\t}\n\t}\n\n\tif !haveBuildConfig || !haveCDNConfig {\n\t\tglog.Infof(\"%q/%q: retrieving build config %032x\", program, region, version.BuildConfig)\n\t\tglog.Infof(\"%q/%q: retrieving CDN config %032x\", program, region, version.CDNConfig)\n\n\t\tcdnConfigS, buildConfigS, err := d.llc.Configs(ctx, cdn, version)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"retrieving configs\")\n\t\t}\n\n\t\tbuildConfig = &buildConfigS\n\t\tcdnConfig = &cdnConfigS\n\n\t\td.l.Lock()\n\t\td.buildConfigs[version.BuildConfig] = buildConfig\n\t\td.cdnConfigs[version.CDNConfig] = cdnConfig\n\t\td.l.Unlock()\n\t}\n\n\td.l.RLock()\n\tencodingMapper, haveEncodingMapper := d.encodingMappers[version.BuildConfig]\n\tarchiveMapper, haveArchiveMapper := d.archiveMappers[version.CDNConfig]\n\td.l.RUnlock()\n\n\tif !haveEncodingMapper || !haveArchiveMapper {\n\t\tencodingMapper, archiveMapper, err = d.llc.Mappers(ctx, cdn, *cdnConfig, *buildConfig)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"retrieving mappers\")\n\t\t}\n\n\t\td.l.Lock()\n\t\td.encodingMappers[version.BuildConfig] = encodingMapper\n\t\td.archiveMappers[version.CDNConfig] = archiveMapper\n\t\td.l.Unlock()\n\t}\n\n\td.l.RLock()\n\t_, haveFilenameMapper := d.filenameMappers[version.BuildConfig]\n\td.l.RUnlock()\n\n\tif !haveFilenameMapper {\n\t\tglog.Info(\"Building filename map\")\n\t\trootCDNHash, err := encodingMapper.ToCDNHash(buildConfig.Root)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"mapping root file hash to CDN hash\")\n\t\t}\n\n\t\troot, err := d.llc.Fetch(ctx, cdn, rootCDNHash)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"fetching root file\")\n\t\t}\n\t\tdefer root.Close()\n\n\t\tmapper, err := mndx.Parse(root)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"parsing filename map\")\n\t\t}\n\n\t\ttree, err := mndx.ToTree(mapper)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"treeifying filename map\")\n\t\t}\n\n\t\td.l.Lock()\n\t\td.filenameMappers[version.BuildConfig] = tree\n\t\td.l.Unlock()\n\t}\n\n\td.l.Lock()\n\td.cdnInfos[program][region] = &cdn\n\td.versionInfos[program][region] = &version\n\td.l.Unlock()\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "a6807cd241e732cac00c1c6dff7f3b4c", "score": "0.5484375", "text": "func (s *Sysregion) Update(ctx context.Context, key ...interface{}) error {\n\tvar err error\n\tvar dbConn *sql.DB\n\n\t// if deleted, bail\n\tif s._deleted {\n\t\treturn errors.New(\"update failed: marked for deletion\")\n\t}\n\n\ttx, err := components.M.GetConnFromCtx(ctx)\n\tif err != nil {\n\t\tdbConn, err = components.M.GetMasterConn()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\ttableName, err := GetSysregionTableName(key...)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// sql query\n\tsqlstr := `UPDATE ` + tableName + ` SET ` +\n\t\t`parent_id = ?, sort = ?, region_name = ?, region_type = ?, pinyin = ?, lft = ?, rgt = ?, mid_admin_name = ?, mid_admin_id = ?, is_delete = ?, created_at = ?, updated_at = ?` +\n\t\t` WHERE region_id = ?`\n\n\t// run query\n\tutils.GetTraceLog(ctx).Debug(\"DB\", zap.String(\"SQL\", fmt.Sprint(sqlstr, s.ParentID, s.Sort, s.RegionName, s.RegionType, s.Pinyin, s.Lft, s.Rgt, s.MidAdminName, s.MidAdminID, s.IsDelete, s.CreatedAt, s.UpdatedAt, s.RegionID)))\n\tif tx != nil {\n\t\t_, err = tx.Exec(sqlstr, s.ParentID, s.Sort, s.RegionName, s.RegionType, s.Pinyin, s.Lft, s.Rgt, s.MidAdminName, s.MidAdminID, s.IsDelete, s.CreatedAt, s.UpdatedAt, s.RegionID)\n\t} else {\n\t\t_, err = dbConn.Exec(sqlstr, s.ParentID, s.Sort, s.RegionName, s.RegionType, s.Pinyin, s.Lft, s.Rgt, s.MidAdminName, s.MidAdminID, s.IsDelete, s.CreatedAt, s.UpdatedAt, s.RegionID)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "7ddf52b54b3a967d4bd6c545cd58acc9", "score": "0.5469615", "text": "func (m *Manager) Update(addr *core.Address, oldPassphrase, newPassphrase []byte) error {\n\tkey, err := m.ks.GetKey(addr.String(), oldPassphrase)\n\tif err != nil {\n\t\terr = m.loadFile(addr, oldPassphrase)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t_, err = m.storeAddress(key.(keystore.PrivateKey), newPassphrase, true)\n\treturn err\n}", "title": "" }, { "docid": "7844515ce753f01ed7d15603303a43a2", "score": "0.53716284", "text": "func (p *Prog) Update() error {\n\t//ebitenutil.DebugPrint(screen, \"Hello World!\")\n\t// screen.Fill(color.Black)\n\treturn nil\n}", "title": "" }, { "docid": "055dfa408801cfcacafa116fc61659a4", "score": "0.5312092", "text": "func (a *ArmLicensedIp) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/arm.licensed_ip\", a.Value, options...)\n}", "title": "" }, { "docid": "75ff910c4ad84f954b3327d60ef1fdd9", "score": "0.529716", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdiffReporter *ackcompare.Reporter,\n) (*resource, error) {\n\n\tinput, err := rm.newUpdateRequestPayload(ctx, desired)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, respErr := rm.sdkapi.ModifyFleetWithContext(ctx, input)\n\trm.metrics.RecordAPICall(\"UPDATE\", \"ModifyFleet\", respErr)\n\tif respErr != nil {\n\t\treturn nil, respErr\n\t}\n\t// Merge in the information we read from the API call above to the copy of\n\t// the original Kubernetes object we passed to the function\n\tko := desired.ko.DeepCopy()\n\n\trm.setStatusDefaults(ko)\n\n\treturn &resource{ko}, nil\n}", "title": "" }, { "docid": "95c1b3a11f86e8d42b6bc6a3e9fefece", "score": "0.52732724", "text": "func (c *Client) Update(ctx context.Context, arg *ngrok.ReservedAddrUpdate) (*ngrok.ReservedAddr, error) {\n\tif arg == nil {\n\t\targ = new(ngrok.ReservedAddrUpdate)\n\t}\n\tvar res ngrok.ReservedAddr\n\tvar path bytes.Buffer\n\tif err := template.Must(template.New(\"update_path\").Parse(\"/reserved_addrs/{{ .ID }}\")).Execute(&path, arg); err != nil {\n\t\tpanic(err)\n\t}\n\targ.ID = \"\"\n\tvar (\n\t\tapiURL = &url.URL{Path: path.String()}\n\t\tbodyArg interface{}\n\t)\n\tapiURL.Path = path.String()\n\tbodyArg = arg\n\n\tif err := c.apiClient.Do(ctx, \"PATCH\", apiURL, bodyArg, &res); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &res, nil\n}", "title": "" }, { "docid": "5446d47adc2b86e7c54bba2fa51352af", "score": "0.5227934", "text": "func (e *App) Update(ctx context.Context, req *ucenter.UpdateReq, rsp *ucenter.UpdateResp) error {\n\tlog.Info(\"Received Ucenter.Update request\")\n\treturn nil\n}", "title": "" }, { "docid": "d1ffbf416727e45a16414e72cf6c347e", "score": "0.5201605", "text": "func (r *SharedInsightRequest) Update(ctx context.Context, reqObj *SharedInsight) error {\n\treturn r.JSONRequest(ctx, \"PATCH\", \"\", reqObj, nil)\n}", "title": "" }, { "docid": "f3083d0238f81c9559011da194a2ab63", "score": "0.519991", "text": "func (adb *AppNameDB) Update(app common.Application) error {\n\tvar (\n\t\tlogger = adb.sugar.With(\"func\", caller.GetCurrentFunctionName())\n\t\taddresses []string\n\t)\n\tlogger.Debugw(\"update app address\", \"id\", app.ID)\n\n\tfor _, address := range app.Addresses {\n\t\taddresses = append(addresses, address.String())\n\t}\n\n\t_, err := adb.db.Exec(`SELECT update_app($1, $2, $3)`,\n\t\tapp.ID,\n\t\tapp.Name,\n\t\tpq.StringArray(addresses))\n\n\tif err != nil {\n\t\tpErr, ok := err.(*pq.Error)\n\t\tif !ok {\n\t\t\treturn err\n\t\t}\n\t\tif pErr != nil && pErr.Code == \"P0002\" {\n\t\t\treturn ErrNotExists\n\t\t}\n\t\treturn pErr\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9e81084d2d1df60aaaf867f1e0fd60bc", "score": "0.5172644", "text": "func (conn *Connection) Update(space, index uint32, key, ops Body) (resp Response, err error) {\n\treturn conn.UpdateAsync(space, index, key, ops).Get()\n}", "title": "" }, { "docid": "c20a16d423b96000cfb9cfcaff2e62e5", "score": "0.5166165", "text": "func (api *api) AppUpdate(appBody *AppUpdate) error {\n\n\turi := \"/v1/objects/pool/update\"\n\t_, err := api.makeRequest(\"POST\", uri, \"app\", appBody)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79315560dd6326cbf15b1ea97f2a4e2a", "score": "0.51648927", "text": "func (us *UsState) Update(ctx context.Context, db DB) error {\n\tswitch {\n\tcase !us._exists: // doesn't exist\n\t\treturn logerror(&ErrUpdateFailed{ErrDoesNotExist})\n\tcase us._deleted: // deleted\n\t\treturn logerror(&ErrUpdateFailed{ErrMarkedForDeletion})\n\t}\n\t// update with composite primary key\n\tconst sqlstr = `UPDATE public.us_states SET ` +\n\t\t`state_name = $1, state_abbr = $2, state_region = $3 ` +\n\t\t`WHERE state_id = $4`\n\t// run\n\tlogf(sqlstr, us.StateName, us.StateAbbr, us.StateRegion, us.StateID)\n\tif _, err := db.ExecContext(ctx, sqlstr, us.StateName, us.StateAbbr, us.StateRegion, us.StateID); err != nil {\n\t\treturn logerror(err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "864d88e1eb9c888ef9b1ae76f04c15ef", "score": "0.5149401", "text": "func (p *Pop3Spamplus) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/pop3.spamplus\", p.Value, options...)\n}", "title": "" }, { "docid": "dba8898f61855ee61f824735a950c41b", "score": "0.5133093", "text": "func (c *Client) Update(exe *ExecutionStats) error {\n\tkey := c.db.IDKey(c.ctx, Kind, exe.ID)\n\tkey, err := c.db.Put(c.ctx, key, exe)\n\tif err != nil {\n\t\treturn errDatastore.WithError(err).Annotate(\"failed to put\")\n\t}\n\tif exe.ID == 0 {\n\t\texe.ID = key.IntID()\n\t\t_, err = c.db.Put(c.ctx, key, exe)\n\t\tif err != nil {\n\t\t\treturn errDatastore.WithError(err).Annotate(\"failed to put\")\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3883f8abbe1292f6ed739e42e9cb65e3", "score": "0.5121545", "text": "func runUpdate(regionEnvs []*RegionEnv, updateFunc UpdateFn) error {\n\n\t// See if all regions made it here.\n\tlog.Debugf(\"Number of regions: %d\", len(regionEnvs))\n\n\tupdater := func() <-chan *RegionEnv {\n\t\t// WaitGroup for all of the updates.\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(len(regionEnvs))\n\t\tobjectStream := make(chan *RegionEnv)\n\t\tfor _, regionEnv := range regionEnvs {\n\t\t\tgo updateFunc(&wg, regionEnv, objectStream)\n\t\t}\n\t\t// Close the channel once all regionEnvs have been passed.\n\t\t// This needs to be inside the update function, because channels should be closed by the sender.\n\t\tgo func() {\n\t\t\twg.Wait()\n\t\t\tclose(objectStream)\n\t\t}()\n\t\treturn objectStream\n\t}\n\n\tupdates := updater()\n\tfor update := range updates {\n\t\tif len(update.Errors) > 0 {\n\t\t\treturn fmt.Errorf(\"Update failed: %s\", update.Errors)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "476184b563247d0ae1140d3749c810ee", "score": "0.511895", "text": "func (eng *engine) update(app App, dt time.Duration, ut uint64) {\n\n\t// Fetch input from the device thread. Essentially a sequential call.\n\teng.machine <- eng.data // blocks until processed by the server.\n\t<-eng.data.reply // blocks until processing is finished.\n\tinput := eng.data.input // User input has been refreshed.\n\tstate := eng.data.state // Engine state has been refreshed.\n\tdts := dt.Seconds() // delta time as float.\n\n\t// update the location and orientation of any physics bodies.\n\teng.bodies.stepVelocities(eng, dts) // Marks povs as dirty.\n\n\t// Have the application adjust any or all state before rendering.\n\tinput.Dt = dts // how long to get back to here.\n\tinput.Ut = ut // update ticks.\n\tapp.Update(eng, input, state) // application to updates its own state.\n\n\t// update assets that the application changed or which need\n\t// per tick processing. Per-ticks include animated models,\n\t// particle effects, surfaces, phrases, ...\n\tif eng.alive {\n\t\teng.models.refresh(dts) // check for new load requests.\n\t\teng.sounds.refresh() // check for new load requests.\n\t\teng.povs.updateWorldTransforms()\n\t\teng.sounds.repositionSoundListener()\n\t}\n}", "title": "" }, { "docid": "5e98849418bba162c78fd25edeb50feb", "score": "0.51172066", "text": "func update(db gorp.SqlExecutor, a *sdk.Action) error {\n\treturn sdk.WrapError(gorpmapping.Update(db, a), \"unable to update action %s\", a.Name)\n}", "title": "" }, { "docid": "8e3bb9137ca6654395399f752e86ba32", "score": "0.5109614", "text": "func runUpdate(regionEnvs []*RegionEnv, updateFunc UpdateFn) error {\n\n\t// See if all regions made it here.\n\tlog.Debugf(\"Number of regions: %d\", len(regionEnvs))\n\n\t// Done channel boiler plate.\n\tdone := make(chan interface{})\n\tdefer close(done)\n\t// WaitGroup for all of the updates.\n\n\tupdater := func() <-chan *RegionEnv {\n\t\tvar wg sync.WaitGroup\n\t\twg.Add(len(regionEnvs))\n\t\tobjectStream := make(chan *RegionEnv)\n\t\tfor _, regionEnv := range regionEnvs {\n\t\t\tgo updateFunc(done, &wg, regionEnv, objectStream)\n\t\t}\n\t\t// Close the channel once all regionEnvs have been passed.\n\t\t// This needs to be inside the update function, because channels should be closed by the sender.\n\t\tgo func() {\n\t\t\twg.Wait()\n\t\t\tclose(objectStream)\n\t\t}()\n\t\treturn objectStream\n\t}\n\n\tupdates := updater()\n\tfor update := range updates {\n\t\tif len(update.Errors) > 0 {\n\t\t\treturn fmt.Errorf(\"Update of %s failed\\n%s\", update.Region, update.Errors)\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79c29ef2a4df47e0e5a62e31f80395e5", "score": "0.51090205", "text": "func UpdateSection(w http.ResponseWriter, r *http.Request) {\n\tresponse := services.UpdateSection(r)\n\n\trender.Status(r, response.Code)\n\trender.JSON(w, r, response)\n}", "title": "" }, { "docid": "106484ae773d7ab0f70ab031159b1ca6", "score": "0.50995874", "text": "func Update(ctx *cli.Context) error {\n\tflags := (&Flags{}).Scan(ctx)\n\n\tloadAWSConfig(flags.Region)\n\n\tif flags.IsUpdateFunctionCode() {\n\t\t_, err := updateFunctionCode(flags.Name, flags.Path, flags.IsNewVersion)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"deploy function failure %s\", err)\n\t\t}\n\n\t\treturn err\n\t}\n\n\treturn fmt.Errorf(\"command not found\")\n}", "title": "" }, { "docid": "216f4d8f6cf4ce6d5ac03703db4940bf", "score": "0.5096316", "text": "func (r *RoutingBgpSystems) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/routing.bgp.systems\", r.Value, options...)\n}", "title": "" }, { "docid": "26c56749f97d591e58142824c5468654", "score": "0.5095719", "text": "func Update(script, manifest []byte) {\n\tcontract.Update(script, manifest)\n}", "title": "" }, { "docid": "c872dbe34df69c3186fd4a5982fca2b3", "score": "0.50832313", "text": "func (r *operationContext) update(step operationStep) error {\n\tr.Infof(\"step: `%v`\", step)\n\treturn r.op.update(r.backend, step)\n}", "title": "" }, { "docid": "907d067258f2062cf304024a2342f1a0", "score": "0.50560373", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdiffReporter *ackcompare.Reporter,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "907d067258f2062cf304024a2342f1a0", "score": "0.50560373", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdiffReporter *ackcompare.Reporter,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "31e1df3909ba8f9918f00298279952c3", "score": "0.5055957", "text": "func (a *AwscliProfiles) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/awscli.profiles\", a.Value, options...)\n}", "title": "" }, { "docid": "8da30338aceca4f611486b259d879cf3", "score": "0.5055498", "text": "func (g *GNMI) GnUpdate(path *gnmipb.Path, val map[string]interface{}) error {\n\tif g.ProbeID == \"\" {\n\t\tif err := g.GnInit(); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*5)\n\tdefer cancel()\n\n\ttoUpdate, err := json.Marshal(val)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to assemble the update value: %v\", err)\n\t}\n\tsetRequest := &gnmipb.SetRequest{\n\t\tDelete: nil, //[]*pb.Path\n\t\tReplace: nil, //[]*pb.Update\n\t\tUpdate: []*gnmipb.Update{{\n\t\t\tPath: path,\n\t\t\tVal: &gnmipb.TypedValue{\n\t\t\t\t//Value: &pb.TypedValue_StringVal{StringVal: VALUE_UPDATE},\n\t\t\t\tValue: &gnmipb.TypedValue_JsonVal{JsonVal: toUpdate},\n\t\t\t},\n\t\t}},\n\t}\n\t_, err = g.Probe.Set(ctx, &pb.SetRequest{\n\t\tID: g.ProbeID,\n\t\tRequest: setRequest,\n\t}, grpc.PerRPCCredentials(g.Token))\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bfdc1f55093c412cf81067db8a69c70c", "score": "0.5054212", "text": "func (c *ReservationsController) Update(w http.ResponseWriter, r *http.Request) error {\n\tvars := mux.Vars(r)\n\n\tresource, err := helpers.AcceptResource(r, resources.ReservationResourceType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif reservation, ok := resource.(models.Reservation); ok {\n\t\treservation.ID = bson.ObjectIdHex(vars[\"id\"])\n\n\t\terr = c.ipam.UpdateReservation(reservation)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn helpers.RenderLocation(w, http.StatusNoContent, fmt.Sprintf(\"/reservations/%s\", reservation.ID.Hex()))\n\t}\n\n\treturn fmt.Errorf(\"Invalid Resource Type\")\n}", "title": "" }, { "docid": "b7cea82fff15401238872f9a2b78ff74", "score": "0.50492823", "text": "func (c *Client) Update(uri string, body map[string]interface{}) ([]byte, error) {\n\treturn c.post(uri, body)\n}", "title": "" }, { "docid": "c3cc73892855326a69abd4a634ab953a", "score": "0.5034888", "text": "func (m *Model) UpdateRegion(zones []types.Zone) error {\n\tregion, err := types.CreateRegionInfo(zones)\n\tif err != nil {\n\t\treturn err\n\t}\n\tslices, err := m.alg.CreateSliceGroups(region)\n\tif err != nil {\n\t\treturn err\n\t}\n\tm.region = region\n\tm.slices = slices\n\treturn nil\n}", "title": "" }, { "docid": "0001d22661d28343df45f5a2b6e7be5f", "score": "0.50276864", "text": "func (s State) UpdateState(currentState []string, bundle *v1.Bundle, namespace string, bundleParam string) error {\n\tlog.Info(\"Update State - Change the Bundle CRD to reflect the current state\")\n\tif paramFound {\n\t\t// Check if Bundle CRD matches\n\t\tlog.Debug(\"Checking if Bundle CRD parameters match.\")\n\t\tif !reflect.DeepEqual(bundle.Spec.Plans[planIndex].Parameters[paramIndex].Enum, currentState) {\n\t\t\t// Update the Bundle Enum with the currentState\n\t\t\tupdateBundle(currentState, bundle, namespace)\n\t\t}\n\t} else {\n\t\tlog.Debugf(\"Looking for Parameter '%v'\", bundleParam)\n\t\tfor p, plan := range bundle.Spec.Plans {\n\t\t\tlog.Debugf(\"Plan: %v\", plan.Name)\n\t\t\tfor a, param := range plan.Parameters {\n\t\t\t\tlog.Debugf(\" Parameter: %v\", param.Name)\n\t\t\t\tif param.Name == bundleParam {\n\t\t\t\t\t// Cache the location of the param we want to update\n\t\t\t\t\tplanIndex = p\n\t\t\t\t\tparamIndex = a\n\t\t\t\t\tparamFound = true\n\n\t\t\t\t\tlog.Debug(\"Checking if Bundle CRD parameters match.\")\n\t\t\t\t\tif !reflect.DeepEqual(bundle.Spec.Plans[planIndex].Parameters[paramIndex].Enum, currentState) {\n\t\t\t\t\t\tupdateBundle(currentState, bundle, namespace)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "eb55de6ec82b5664cd5e2f6dc919523f", "score": "0.5026144", "text": "func (a *AweGlobalApVlantag) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/awe.global.ap_vlantag\", a.Value, options...)\n}", "title": "" }, { "docid": "1e00cbc9e6cf1b3986b2f9982f058fc2", "score": "0.50244004", "text": "func Bpf_link__update_program(link *Struct_bpf_link, prog *Struct_bpf_program) int32 {\n\treturn C.bpf_link__update_program()\n}", "title": "" }, { "docid": "8b7250a254b36c9fdaf5fcb868a4f35b", "score": "0.50115347", "text": "func (l *LicensingActiveIps) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/licensing.active_ips\", l.Value, options...)\n}", "title": "" }, { "docid": "33ef870167665f2882f378513c06b84d", "score": "0.50104153", "text": "func (h *HaSyncIpsec) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ha.sync.ipsec\", h.Value, options...)\n}", "title": "" }, { "docid": "d1d768cf8204a89650afd7cf4dca5a9e", "score": "0.49997133", "text": "func (s *SandboxdDhparams2048) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/sandboxd.dhparams_2048\", s.Value, options...)\n}", "title": "" }, { "docid": "2e756d624c1f37af47fc9f0604984c1d", "score": "0.49938673", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdelta *ackcompare.Delta,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "2e756d624c1f37af47fc9f0604984c1d", "score": "0.49938673", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdelta *ackcompare.Delta,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "2e756d624c1f37af47fc9f0604984c1d", "score": "0.49938673", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdelta *ackcompare.Delta,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "2e756d624c1f37af47fc9f0604984c1d", "score": "0.49938673", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdelta *ackcompare.Delta,\n) (*resource, error) {\n\t// TODO(jaypipes): Figure this out...\n\treturn nil, ackerr.NotImplemented\n}", "title": "" }, { "docid": "cdeddd4e52918e855fd48c361062cd4a", "score": "0.49920815", "text": "func (i *IpsFailopen) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ips.failopen\", i.Value, options...)\n}", "title": "" }, { "docid": "027712857bab649bba14924a078209b4", "score": "0.49877402", "text": "func updateServiceInstanceRegion(\n\tdone chan interface{},\n\twg *sync.WaitGroup,\n\tregionEnv *RegionEnv,\n\tserviceInstanceStream chan *RegionEnv,\n) {\n\tdefer wg.Done()\n\n\t// Cluster configmap must have the \"cloud\" key for service instances to be created.\n\tcloud, ok := regionEnv.ClusterSettings[\"CLOUD\"]\n\tif !ok {\n\t\tlog.Errorf(\"Cannot create or update Service Instances in %s, as the porter2k8s config map does not have a \"+\n\t\t\t\"'cloud' key\", regionEnv.Region)\n\t\tserviceInstanceStream <- regionEnv\n\t\treturn\n\t}\n\n\t// Catalog Service Instances are not required.\n\tif len(regionEnv.ServiceInstances[cloud]) == 0 {\n\t\tserviceInstanceStream <- regionEnv\n\t\treturn\n\t}\n\n\tvar updateErr, getErr, watchErr error\n\tvar serviceInstanceSuccessful bool\n\tvar previousServiceInstance, serviceInstanceUpdate *catalogv1beta1.ServiceInstance\n\t// Clientset is region specific.\n\tserviceInstanceInterface := regionEnv.CatalogClientset.ServicecatalogV1beta1().ServiceInstances(\n\t\tregionEnv.Cfg.Namespace)\n\n\t// Update any tokens in the spec. For example VNET or ACCOUNT.\n\tregionEnv.replaceServiceInstanceParameters(cloud)\n\n\tfor _, serviceInstance := range regionEnv.ServiceInstances[cloud] {\n\t\tname := serviceInstance.ObjectMeta.Name\n\t\tif location, ok := regionEnv.ClusterSettings[\"CLOUD_LOCATION\"]; ok {\n\t\t\tlocationRegex := regexp.MustCompile(`\"location\":\"\\w+\"`)\n\t\t\tlocationUpdate := []byte(fmt.Sprintf(\"\\\"location\\\":\\\"%s\\\"\", location))\n\t\t\tserviceInstance.Spec.Parameters.Raw = locationRegex.ReplaceAllLiteral(\n\t\t\t\tserviceInstance.Spec.Parameters.Raw,\n\t\t\t\tlocationUpdate,\n\t\t\t)\n\t\t\t// Append location to resource group.\n\t\t\tif cloud == \"azure\" {\n\t\t\t\tresourceGroupRegex := regexp.MustCompile(`\"resourceGroup\":\"(\\w+)\"`)\n\t\t\t\tresourceGroupUpdate := []byte(fmt.Sprintf(\"\\\"resourceGroup\\\":\\\"$1-%s\\\"\", location))\n\t\t\t\tserviceInstance.Spec.Parameters.Raw = resourceGroupRegex.ReplaceAll(\n\t\t\t\t\tserviceInstance.Spec.Parameters.Raw, resourceGroupUpdate)\n\t\t\t}\n\t\t}\n\n\t\t// Check if serviceInstance already exists.\n\t\tpreviousServiceInstance, getErr = serviceInstanceInterface.Get(name, metav1.GetOptions{})\n\n\t\tif getErr == nil {\n\t\t\tif needsUpdate(previousServiceInstance, serviceInstance) {\n\t\t\t\t// Resource Version is required to be passed back unaltered.\n\t\t\t\tserviceInstance.ObjectMeta.ResourceVersion = previousServiceInstance.ObjectMeta.ResourceVersion\n\t\t\t\tserviceInstance.Spec.ExternalID = previousServiceInstance.Spec.ExternalID\n\t\t\t\tserviceInstanceUpdate, updateErr = serviceInstanceInterface.Update(serviceInstance)\n\t\t\t}\n\t\t} else if errors.IsNotFound(getErr) {\n\t\t\tserviceInstanceUpdate, updateErr = serviceInstanceInterface.Create(serviceInstance)\n\t\t} else {\n\t\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"unable to get service instance %s\", getErr))\n\t\t\tserviceInstanceStream <- regionEnv\n\t\t\treturn\n\t\t}\n\t\tif updateErr != nil {\n\t\t\tregionEnv.Errors = append(regionEnv.Errors,\n\t\t\t\tfmt.Errorf(\"unable to create/update service instance %s\\n%s\", name, updateErr),\n\t\t\t)\n\t\t\tserviceInstanceStream <- regionEnv\n\t\t\treturn\n\t\t}\n\n\t\tif serviceInstanceUpdate != nil {\n\t\t\tlog.Infof(\"Update: %+v\", serviceInstanceUpdate)\n\t\t\tserviceInstanceSuccessful, watchErr = regionEnv.watchServiceInstance(serviceInstanceUpdate)\n\t\t} else {\n\t\t\t// Ensure existing service instance is healthy.\n\t\t\tserviceInstanceSuccessful, watchErr = regionEnv.watchServiceInstance(serviceInstance)\n\t\t}\n\n\t\tif watchErr != nil {\n\t\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"service instance failure %s\", watchErr))\n\t\t} else if !serviceInstanceSuccessful {\n\t\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"unknown service instance error\"))\n\t\t}\n\t}\n\tselect {\n\tcase <-done:\n\t\tlog.Info(\"Received Done\")\n\t\treturn\n\tcase serviceInstanceStream <- regionEnv:\n\t}\n}", "title": "" }, { "docid": "627ad0b62e11d8cf930d858236ffd240", "score": "0.49876863", "text": "func (a *App) Update(payer string, points int, timestamp string) {\r\n\ta.RW.Lock()\r\n\ta.User[a.Name].Update(payer, points, timestamp)\r\n\ta.RW.Unlock()\r\n}", "title": "" }, { "docid": "1269750fe993dc36f173fe66b47a633c", "score": "0.49871865", "text": "func (s *DynamicSource) update(ctx context.Context, apiPrefix string) error {\n\twg := sync.WaitGroup{}\n\n\twg.Add(2)\n\n\tvar statusResponse StationStatusResponse\n\tvar statusErr error\n\n\tstatusURL := apiPrefix + \"/station_status.json\"\n\tinfoURL := apiPrefix + \"/station_information.json\"\n\n\tvar infoResponse StationInformationResponse\n\tvar infoErr error\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tstatusErr = getJSON(ctx, &statusResponse, statusURL)\n\t}()\n\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tinfoErr = getJSON(ctx, &infoResponse, infoURL)\n\t}()\n\n\twg.Wait()\n\n\tif statusErr != nil {\n\t\treturn fmt.Errorf(\"error fetching status: %w\", statusErr)\n\t}\n\tif infoErr != nil {\n\t\treturn fmt.Errorf(\"error fetching info: %w\", infoErr)\n\t}\n\n\tif err := s.integrateUpdates(&statusResponse, &infoResponse); err != nil {\n\t\treturn fmt.Errorf(\"error integrating updates: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "77b6aa67869ced8f3d46bbf642195bf3", "score": "0.49833775", "text": "func (k Keeper) UpdateParams(ctx sdk.Context, updater sdk.AccAddress, updates Params, updatedFields []string) sdk.Error {\r\n\tif !k.isAdmin(ctx, updater) {\r\n\t\terr := ErrAddressNotAuthorised()\r\n\t\treturn err\r\n\t}\r\n\r\n\tcurrent := k.GetParams(ctx)\r\n\tupdated := k.getUpdatedParams(current, updates, updatedFields)\r\n\tk.SetParams(ctx, updated)\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "17cd7c869a91456997f2a28f97c0b541", "score": "0.49807453", "text": "func UpdatePi(address string, updates map[string]string) error {\n\tsqlStatement := `\nUPDATE pis\nSET %s\nWHERE address = $1;`\n\n\tsetStatements := make([]string, 0)\n\tvals := make([]interface{}, 0)\n\tvals = append(vals, address)\n\tind := 2\n\tfor key, val := range updates {\n\t\tstatement := fmt.Sprintf(\"%s = $%d\", key, ind)\n\t\tsetStatements = append(setStatements, statement)\n\t\tvals = append(vals, val)\n\t\tind = ind + 1\n\t}\n\n\tsetStatement := strings.Join(setStatements, \", \")\n\tsqlStatement = fmt.Sprintf(sqlStatement, setStatement)\n\n\t_, err := db.Exec(sqlStatement, vals...)\n\treturn err\n}", "title": "" }, { "docid": "97735230fc6e4c9427c8d724c6a2c30a", "score": "0.4976427", "text": "func (c *OperatorSdkClient) Update(object sdk.Object) error {\n\treturn sdk.Update(object)\n}", "title": "" }, { "docid": "8a38c8122c65316f2e10521c799a8556", "score": "0.49679515", "text": "func (c Client) Update(input *UpdateApplicationInput) (*UpdateApplicationResponse, error) {\n\treturn c.UpdateWithContext(context.Background(), input)\n}", "title": "" }, { "docid": "00a09f5e49dbe99b7a2249443dea2c6f", "score": "0.4963067", "text": "func (i *IpsEngine) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ips.engine\", i.Value, options...)\n}", "title": "" }, { "docid": "5d325ac1fdfa0013cdbe75e12d80ed1c", "score": "0.49591243", "text": "func (c *SidecarClient) Update(ctx context.Context, guid string, r *resource.SidecarUpdate) (*resource.Sidecar, error) {\n\tvar sc resource.Sidecar\n\t_, err := c.client.patch(ctx, path.Format(\"/v3/sidecars/%s\", guid), r, &sc)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &sc, nil\n}", "title": "" }, { "docid": "03c04998bc83f7abd492e01b891a4913", "score": "0.49565953", "text": "func (env *Env) Update(fn TxnOp) error {\n\treturn env.run(true, 0, fn)\n}", "title": "" }, { "docid": "b7062864acc5681b4886abdebea43e24", "score": "0.49501297", "text": "func updateServiceRegion(\n\tdone chan interface{},\n\twg *sync.WaitGroup,\n\tregionEnv *RegionEnv,\n\tserviceStream chan *RegionEnv,\n) {\n\tdefer wg.Done()\n\t// Make this optional to support worker containers with no Service object\n\tif regionEnv.Service == nil {\n\t\tserviceStream <- regionEnv\n\t\treturn\n\t}\n\n\tvar updateErr, getErr error\n\tvar previousService, serviceUpdate *v1.Service\n\n\tname := regionEnv.Service.ObjectMeta.Name\n\t// Client set is region specific.\n\tserviceInterface := regionEnv.Clientset.CoreV1().Services(regionEnv.Cfg.Namespace)\n\n\t// Check if service already exists.\n\tpreviousService, getErr = serviceInterface.Get(name, metav1.GetOptions{})\n\n\t// Replace domain name with regional value.\n\t// This affects all objects with domain names in them, not just services.\n\t// Since the service is mandatory, we do it here rather than in istio or ingress.\n\tregionEnv.updateDomainName()\n\n\t// Update service if required.\n\tif getErr == nil {\n\t\tif needsUpdate(previousService, regionEnv.Service) {\n\t\t\t// Cluster IP and Resource Version are required to be passed back unaltered.\n\t\t\tregionEnv.Service.ObjectMeta.ResourceVersion = previousService.ObjectMeta.ResourceVersion\n\t\t\tregionEnv.Service.Spec.ClusterIP = previousService.Spec.ClusterIP\n\t\t\tserviceUpdate, updateErr = serviceInterface.Update(regionEnv.Service)\n\t\t}\n\t} else if errors.IsNotFound(getErr) {\n\t\tserviceUpdate, updateErr = serviceInterface.Create(regionEnv.Service)\n\t} else {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to get service\\n%s\", getErr))\n\t\tserviceStream <- regionEnv\n\t\treturn\n\t}\n\tif updateErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to create/update service\\n%s\", updateErr))\n\t\tserviceStream <- regionEnv\n\t\treturn\n\t}\n\n\tif serviceUpdate != nil {\n\t\tlog.Infof(\"Update: %+v\", serviceUpdate)\n\t}\n\n\tselect {\n\tcase <-done:\n\t\tlog.Info(\"Received Done\")\n\t\treturn\n\tcase serviceStream <- regionEnv:\n\t}\n}", "title": "" }, { "docid": "c20822cd2f2ce902c07856552fe24f14", "score": "0.494707", "text": "func (g *Geoip) updater() {\n\n\tvar waitTime = g.UpdatePeriod\n\n\tfor {\n\n\t\t// Wait appropriate sleep period.\n\t\ttime.Sleep(waitTime)\n\n\t\tlog.Print(\"Running GeoIP update...\")\n\n\t\t// Create geoipupdate command.\n\t\tcmd := exec.Command(\"geoipupdate\", \"-f\", \"GeoIP.conf\",\n\t\t\t\"-d\", \".\")\n\n\t\t// Execute, stdout/stderr to byte array.\n\t\tout, err := cmd.CombinedOutput()\n\t\tif err != nil {\n\t\t\tlog.Print(\"Update error: %s\", err.Error())\n\t\t\tlog.Print(\"geoipupdate: %s\", out)\n\n\t\t\t// Failed: Retry sooner than the long period.\n\t\t\twaitTime = 600 * time.Second\n\t\t\tcontinue\n\n\t\t}\n\n\t\tlog.Print(\"GeoIP updated, success.\")\n\n\t\t// On successful update, wait period is a long period.\n\t\twaitTime = g.UpdatePeriod\n\n\t\t// Ping the main goroutine, so it knows to reopen the\n\t\t// GeoIP database.\n\t\tg.notif <- true\n\n\t}\n\n}", "title": "" }, { "docid": "72da0890998d76dd0c979e2829cfbe43", "score": "0.49419844", "text": "func (cidr *CidrMap) Update(domainname string) (*ResponseStatus, error) {\n\n // common code\n \n stat, err := cidr.save(domainname)\n if err != nil {\n return nil, err\n } \n return stat.Status, err\n\n}", "title": "" }, { "docid": "06fd7aa0a54adba75da01ac131216f22", "score": "0.49413016", "text": "func (rm *resourceManager) sdkUpdate(\n\tctx context.Context,\n\tdesired *resource,\n\tlatest *resource,\n\tdiffReporter *ackcompare.Reporter,\n) (*resource, error) {\n\treturn rm.customUpdateRepository(ctx, desired, latest, diffReporter)\n}", "title": "" }, { "docid": "7cbb55209192e1bfb246d502ff0df383", "score": "0.49412856", "text": "func (t *SimpleChaincode) updateStudent(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tvar err error\n\n\tif len(args) != 6 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 6 \")\n\t}\n\n\t// ==== Input sanitation ====\n\tfor i := 0; i < 6; i++ {\n\t\tif len(args[i]) <= 0 {\n\t\t\treturn shim.Error(\"argument must be a non-empty string\")\n\t\t}\n\t}\n\n\trollno := strings.ToLower(args[0])\n\tname := args[1]\n\tcourse := args[2]\n\tdate1 := args[4]\n\tdetails := args[3]\n\tgrade := args[5]\n\tif err != nil {\n\t\treturn shim.Error(\"4rd argument must be a date string\" + err.Error())\n\t}\n\n\t// ==== Check if rollno already exists to update====\n\tstudentAsBytes, err := stub.GetState(rollno + \"_\" + course)\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to get student: \" + err.Error())\n\t} else if studentAsBytes == nil {\n\t\treturn shim.Error(\"Unable to find the rollno \" + rollno + \"for this course=\" + course)\n\t}\n\n\trecordToUpdate := student{}\n\terr = json.Unmarshal(studentAsBytes, &recordToUpdate) //unmarshal it aka JSON.parse()\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\trecordToUpdate.Name = name\n\trecordToUpdate.Course = course\n\trecordToUpdate.Date = date1\n\trecordToUpdate.Details = details\n\trecordToUpdate.Grade = grade\n\n\tstudentUpdateAsBytes, _ := json.Marshal(recordToUpdate)\n\terr = stub.PutState(rollno+\"_\"+course, studentUpdateAsBytes) //rewrite the student\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Notify listeners that an event \"eventInvoke\" have been executed (check line 19 in the file invoke.go)\n\terr = stub.SetEvent(\"eventupdatestudent\", []byte{})\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\tfmt.Println(\"- end updatestudent\")\n\treturn shim.Success(nil)\n\n}", "title": "" }, { "docid": "b6618b4f92b8f97cde8be906e428036a", "score": "0.49381098", "text": "func (k Keeper) UpdateParams(ctx sdk.Context, updater sdk.AccAddress, updates Params, updatedFields []string) sdk.Error {\n\tif !k.isAdmin(ctx, updater) {\n\t\terr := ErrAddressNotAuthorised()\n\t\treturn err\n\t}\n\n\tcurrent := k.GetParams(ctx)\n\tupdated := k.getUpdatedParams(current, updates, updatedFields)\n\tk.SetParams(ctx, updated)\n\n\treturn nil\n}", "title": "" }, { "docid": "b6618b4f92b8f97cde8be906e428036a", "score": "0.49381098", "text": "func (k Keeper) UpdateParams(ctx sdk.Context, updater sdk.AccAddress, updates Params, updatedFields []string) sdk.Error {\n\tif !k.isAdmin(ctx, updater) {\n\t\terr := ErrAddressNotAuthorised()\n\t\treturn err\n\t}\n\n\tcurrent := k.GetParams(ctx)\n\tupdated := k.getUpdatedParams(current, updates, updatedFields)\n\tk.SetParams(ctx, updated)\n\n\treturn nil\n}", "title": "" }, { "docid": "aa4f4f5c10c0c7b8954c22d7eccdf32e", "score": "0.4937585", "text": "func (ss *secretStore) Update(organizationID, secretID string, value *CreateSecretRequest) error {\n\tlog := logger.WithFields(logrus.Fields{\"tag\": \"UpdateSecret\"})\n\n\tpath := secretPath(organizationID, secretID)\n\n\tlog.Debugln(\"Update secret:\", path)\n\n\tsort.Strings(value.Tags)\n\n\tdata := map[string]interface{}{\"value\": *value}\n\n\tif _, err := ss.logical.Write(path, data); err != nil {\n\t\treturn errors.Wrap(err, \"Error during updating secret\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3d44446bf25722b05c8197724914480f", "score": "0.49371132", "text": "func (c *JobClient) Update(ctx context.Context, id tracker.Key, state tracker.State, detail string) error {\n\tu := c.api\n\tu.Path = \"/v2/job/update\"\n\tparams := make(url.Values, 3)\n\tparams.Add(\"id\", string(id))\n\tparams.Add(\"state\", string(state))\n\tparams.Add(\"detail\", detail)\n\tu.RawQuery = params.Encode()\n\treturn c.postClose(ctx, u)\n}", "title": "" }, { "docid": "a25359b62eadfedb93244dd9eeb82435", "score": "0.49370608", "text": "func (c Client) UpdateApplication(app *application) error {\n\tif len(app.ID.Value) == 0 {\n\t\treturn fmt.Errorf(\"id can not be empty\")\n\t}\n\n\tbody, err := json.Marshal(struct {\n\t\tApplication struct {\n\t\t\tName string `json:\"name\"`\n\t\t\tDescription string `json:\"description\"`\n\t\t\tRedirectURI string `json:\"redirect_uri,omitempty\"`\n\t\t\tURL string `json:\"url\"`\n\t\t\tGrantType *GrantType `json:\"grant_type,omitempty\"`\n\t\t\tTokenTypes *TokenTypes `json:\"token_types,omitempty\"`\n\t\t}`json:\"application\"`\n\n\t}{\n\t\tApplication: struct {\n\t\t\tName string `json:\"name\"`\n\t\t\tDescription string `json:\"description\"`\n\t\t\tRedirectURI string `json:\"redirect_uri,omitempty\"`\n\t\t\tURL string `json:\"url\"`\n\t\t\tGrantType *GrantType `json:\"grant_type,omitempty\"`\n\t\t\tTokenTypes *TokenTypes `json:\"token_types,omitempty\"`\n\t\t}{\n\t\t\tName: app.Name,\n\t\t\tDescription: app.Description,\n\t\t\tRedirectURI: app.RedirectURI,\n\t\t\tURL: app.URL,\n\t\t\tGrantType: app.GrantType,\n\t\t\tTokenTypes: app.TokenTypes,\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(\"PATCH\",c.getURL(fmt.Sprintf(\"/v1/applications/%s\", app.ID.Value)),\n\t\tbytes.NewBuffer(body))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Auth-Token\", c.credentials.Token)\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"could not update values\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cac9e8edeeab40a95eaec73d724a2993", "score": "0.4930598", "text": "func (s *Storage) Update(id uint64, address ethereum.Address, addressType *common.AddressType, description string) error {\n\tvar (\n\t\tlogger = s.sugar.With(\"func\", caller.GetCurrentFunctionName(),\n\t\t\t\"id\", id,\n\t\t\t\"address\", address.String(),\n\t\t\t\"description\", description,\n\t\t)\n\t\tqueryStmt = `UPDATE addresses\nSET address = COALESCE($1, address),\n type = COALESCE($2, type),\n description = COALESCE($3, description),\n timestamp = $4\nWHERE id = $5 RETURNING id;`\n\t\tparams []interface{}\n\t)\n\n\t// fill address value\n\tif !blockchain.IsZeroAddress(address) {\n\t\tparams = append(params, address.String())\n\t} else {\n\t\tparams = append(params, nil)\n\t}\n\n\t// fill type value\n\tif addressType != nil {\n\t\tlogger = logger.With(\"type\", addressType.String())\n\t\tparams = append(params, addressType.String())\n\t} else {\n\t\tparams = append(params, nil)\n\t}\n\n\t// fill description value\n\tif len(description) != 0 {\n\t\tparams = append(params, description)\n\t} else {\n\t\tparams = append(params, nil)\n\t}\n\n\t// fill timestamp value\n\tts, err := s.resolv.Resolve(address)\n\tswitch err {\n\tcase blockchain.ErrNotAvailable:\n\t\tlogger.Debugw(\"address contract creation time is not available\", \"err\", err)\n\t\tparams = append(params, nil)\n\tcase nil:\n\t\tparams = append(params, ts.UTC())\n\tdefault:\n\t\treturn err\n\t}\n\n\t// fill query condition param\n\tparams = append(params, id)\n\n\tlogger.Debug(\"updating reserve address record in database\")\n\tvar updatedID uint64\n\tif err = s.db.Get(&updatedID, queryStmt, params...); err == sql.ErrNoRows {\n\t\treturn storage.ErrNotExists\n\t} else if err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9be7b67570afa4286d1d7ee6db26f455", "score": "0.4927603", "text": "func (a *ApplicationAPI) Update(ctx context.Context, req *pb.UpdateApplicationRequest) (*pb.UpdateApplicationResponse, error) {\n\tif err := a.validator.Validate(ctx,\n\t\tauth.ValidateApplicationAccess(req.Id, auth.Update),\n\t); err != nil {\n\t\treturn nil, grpc.Errorf(codes.Unauthenticated, \"authentication failed: %s\", err)\n\t}\n\n\tapp, err := storage.GetApplication(config.C.PostgreSQL.DB, req.Id)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\t// update the fields\n\tapp.Name = req.Name\n\tapp.Description = req.Description\n\tapp.ServiceProfileID = req.ServiceProfileID\n\tapp.PayloadCodec = codec.Type(req.PayloadCodec)\n\tapp.PayloadEncoderScript = req.PayloadEncoderScript\n\tapp.PayloadDecoderScript = req.PayloadDecoderScript\n\n\terr = storage.UpdateApplication(config.C.PostgreSQL.DB, app)\n\tif err != nil {\n\t\treturn nil, errToRPCError(err)\n\t}\n\n\treturn &pb.UpdateApplicationResponse{}, nil\n}", "title": "" }, { "docid": "8c43d2f7adf04d9e183fc21a228f9c5e", "score": "0.49257684", "text": "func (h *HaAwsElasticIp) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ha.aws.elastic_ip\", h.Value, options...)\n}", "title": "" }, { "docid": "c9020fe3871851d51f513114edd69383", "score": "0.49206212", "text": "func (cc *HelloWorld) update(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\t// Validate and extract parameters\n\tif rc := Validate(\"update\", args /*args[0]=id*/, \"%s\", 1, 64 /*args[1]=DStatus*/, \"%s\", 1, 255 /*args[2]=Timestamp*/, \"%s\", 1, 255 /*args[3]=EdgeID*/, \"%s\", 1, 255); rc.Status > 0 {\n\t\treturn rc\n\t}\n\tid := strings.ToLower(args[0])\n\tdoc := &Doc{DStatus: args[1], Timestamp:args[2], EdgeID:args[3]}\n\n\t// Validate that this ID exist\n\tif value, err := stub.GetState(id); err != nil || value == nil {\n\t\treturn Error(http.StatusNotFound, \"Not Found\")\n\t}\n\n\t// Write the message\n\tif err := stub.PutState(id, doc.ToJson()); err != nil {\n\t\treturn Error(http.StatusInternalServerError, err.Error())\n\t}\n\n\treturn Success(http.StatusNoContent, \"Message Updated\", nil)\n}", "title": "" }, { "docid": "7b11c49b83ce643219dd5ccebd151a51", "score": "0.49201795", "text": "func (db *reindexerImpl) update(ctx context.Context, namespace string, item interface{}, precepts ...string) (int, error) {\n\tnamespace = strings.ToLower(namespace)\n\n\tif db.otelTracer != nil {\n\t\tdefer db.startTracingSpan(ctx, \"Reindexer.Update\", otelattr.String(\"rx.ns\", namespace)).End()\n\t}\n\n\tif db.promMetrics != nil {\n\t\tdefer prometheus.NewTimer(db.promMetrics.clientCallsLatency.WithLabelValues(\"Update\", namespace)).ObserveDuration()\n\t}\n\n\treturn db.modifyItem(ctx, namespace, nil, item, nil, modeUpdate, precepts...)\n}", "title": "" }, { "docid": "7ca7fe8b4586028dc4a33d707e9c6e30", "score": "0.49075845", "text": "func (d DB) Update(Profile) error { return errors.New(\"stub\") }", "title": "" }, { "docid": "a94cb67e147340d402c85a7e6c0a73f6", "score": "0.49028808", "text": "func resourceUpdate(d *schema.ResourceData, m interface{}) error{\t\n\td.Partial(true)\n\tif d.HasChange(\"address\"){\n\t\td.SetPartial(\"address\")\n\t}\n\td.Partial(false)\n\treturn resourceRead(d,m)\n}", "title": "" }, { "docid": "80a728afe463e50b92c5ef59a1bb3409", "score": "0.49020514", "text": "func (m *mixpanel) Update(distinctId string, u *Update) error {\n\tparams := map[string]interface{}{\n\t\t\"$token\": m.Token,\n\t\t\"$distinct_id\": distinctId,\n\t}\n\n\tif u.IP != \"\" {\n\t\tparams[\"$ip\"] = u.IP\n\t}\n\tif u.Timestamp == IgnoreTime {\n\t\tparams[\"$ignore_time\"] = true\n\t} else if u.Timestamp != nil {\n\t\tparams[\"$time\"] = u.Timestamp.Unix()\n\t}\n\n\tparams[u.Operation] = u.Properties\n\n\tautoGeolocate := u.IP == \"\"\n\n\treturn m.send(\"engage\", params, autoGeolocate)\n}", "title": "" }, { "docid": "d59ca4dec396754c4fcf2aa745cf9710", "score": "0.49012232", "text": "func Update(db *storm.DB, roles map[string]string, regions []string) error {\n\tvar wg sync.WaitGroup\n\twg.Add(len(roles))\n\n\tfor account, role := range roles {\n\t\t// update all accounts in parallel to speed this up\n\t\tgo func(account, role string) {\n\t\t\tupdateForRole(db, account, role, regions)\n\t\t\twg.Done()\n\t\t}(account, role)\n\t}\n\twg.Wait()\n\treturn nil\n}", "title": "" }, { "docid": "7e76b3be52422ef33ddba0ddce0a500f", "score": "0.49000466", "text": "func (client *SnapshotsClient) update(ctx context.Context, resourceGroupName string, snapshotName string, snapshot SnapshotUpdate, options *SnapshotsBeginUpdateOptions) (*http.Response, error) {\n\treq, err := client.updateCreateRequest(ctx, resourceGroupName, snapshotName, snapshot, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresp, err := client.pl.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) {\n\t\treturn nil, client.updateHandleError(resp)\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "bc8e4e563e3576179cdae5e490fb6944", "score": "0.48983", "text": "func (c PGPClient) PGPUpdate(ctx context.Context, __arg PGPUpdateArg) (err error) {\n\terr = c.Cli.Call(ctx, \"keybase.1.pgp.pgpUpdate\", []interface{}{__arg}, nil, 0*time.Millisecond)\n\treturn\n}", "title": "" }, { "docid": "a8c85b4dc597dbd91b06bf5b716db997", "score": "0.48982862", "text": "func (s *RPC) Update(c context.Context, id string, state rpc.State) error {\n\tprocID, err := strconv.ParseInt(id, 10, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpproc, err := s.store.ProcLoad(procID)\n\tif err != nil {\n\t\tlog.Printf(\"error: rpc.update: cannot find pproc with id %d: %s\", procID, err)\n\t\treturn err\n\t}\n\n\tbuild, err := s.store.GetBuild(pproc.BuildID)\n\tif err != nil {\n\t\tlog.Printf(\"error: cannot find build with id %d: %s\", pproc.BuildID, err)\n\t\treturn err\n\t}\n\n\tproc, err := s.store.ProcChild(build, pproc.PID, state.Proc)\n\tif err != nil {\n\t\tlog.Printf(\"error: cannot find proc with name %s: %s\", state.Proc, err)\n\t\treturn err\n\t}\n\n\trepo, err := s.store.GetRepo(build.RepoID)\n\tif err != nil {\n\t\tlog.Printf(\"error: cannot find repo with id %d: %s\", build.RepoID, err)\n\t\treturn err\n\t}\n\n\tif state.Exited {\n\t\tproc.Stopped = state.Finished\n\t\tproc.ExitCode = state.ExitCode\n\t\tproc.Error = state.Error\n\t\tproc.State = model.StatusSuccess\n\t\tif state.ExitCode != 0 || state.Error != \"\" {\n\t\t\tproc.State = model.StatusFailure\n\t\t}\n\t} else {\n\t\tproc.Started = state.Started\n\t\tproc.State = model.StatusRunning\n\t}\n\n\tif err := s.store.ProcUpdate(proc); err != nil {\n\t\tlog.Printf(\"error: rpc.update: cannot update proc: %s\", err)\n\t}\n\n\tbuild.Procs, _ = s.store.ProcList(build)\n\tbuild.Procs = model.Tree(build.Procs)\n\tmessage := pubsub.Message{\n\t\tLabels: map[string]string{\n\t\t\t\"repo\": repo.FullName,\n\t\t\t\"private\": strconv.FormatBool(repo.IsPrivate),\n\t\t},\n\t}\n\tmessage.Data, _ = json.Marshal(model.Event{\n\t\tRepo: *repo,\n\t\tBuild: *build,\n\t})\n\ts.pubsub.Publish(c, \"topic/events\", message)\n\n\treturn nil\n}", "title": "" }, { "docid": "1aa04640cfebbce4eb11c9978102bc75", "score": "0.48980537", "text": "func (m MapStore) UpdatePuppy(id uint32, p *Puppy) error {\n\tif _, ok := m.ms[id]; !ok {\n\t\treturn Errorf(ErrNotFound, \"Puppy ID can't be found, update operation failed\")\n\t}\n\ti, err := strconv.Atoi(p.Value)\n\tif err != nil {\n\t\treturn Errorf(ErrInvalidInput, \"Puppy value is not recognised\")\n\t} else if i < 0 {\n\t\treturn Errorf(ErrInvalidInput, \"Puppy value can't be negative\")\n\t}\n\tp.ID = id\n\tm.ms[id] = *p\n\treturn nil\n}", "title": "" }, { "docid": "ca517666f9aa591580bf5911000f2568", "score": "0.48928595", "text": "func (r *InstancesService) Update(project string, instance string, databaseinstance *DatabaseInstance) *InstancesUpdateCall {\n\tc := &InstancesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}\n\tc.project = project\n\tc.instance = instance\n\tc.databaseinstance = databaseinstance\n\treturn c\n}", "title": "" }, { "docid": "bc29b01d8ed939cf6cfc1a94d25601f5", "score": "0.48900765", "text": "func UpdatePair(ctx context.Context, ref *db.Ref, pairings map[int64]int64) {\n\tfor k, v := range pairings {\n\t\tif err := ref.Update(ctx, map[string]interface{}{\n\t\t\tfmt.Sprintf(\"%d/partner\", k): v,\n\t\t\tfmt.Sprintf(\"%d/partner\", v): k,\n\t\t}); err != nil {\n\t\t\tlog.Println(\"Error updating info:\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "400175cf7f01335dddcfc4cb667839b6", "score": "0.48894215", "text": "func (client VirtualNetworkClient) updateByoipRange(ctx context.Context, request common.OCIRequest) (common.OCIResponse, error) {\n\thttpRequest, err := request.HTTPRequest(http.MethodPut, \"/byoipRanges/{byoipRangeId}\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar response UpdateByoipRangeResponse\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": "30f7de7f2e28cced022cdbc9bdc9363a", "score": "0.48822603", "text": "func (k *Keyring) Update(id string, b []byte) error {\n\tif id == \"\" {\n\t\treturn errors.Errorf(\"no id\")\n\t}\n\tif strings.HasPrefix(id, reservedPrefix) {\n\t\treturn errors.Errorf(\"keyring id prefix reserved %s\", id)\n\t}\n\n\titem, err := getItem(k.st, k.service, id, k.key)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif item == nil {\n\t\treturn ErrItemNotFound\n\t}\n\titem.Data = b\n\n\treturn setItem(k.st, k.service, item, k.key)\n}", "title": "" }, { "docid": "dc43c42cc5350a4a4b0fae63d6b548e7", "score": "0.48734197", "text": "func (a *VSphereActuator) Update(ctx context.Context, cr *minterv1.CredentialsRequest) error {\n\treturn a.sync(ctx, cr)\n}", "title": "" }, { "docid": "dd2c396d9e23a98d4ef31bc6fe1d2cbf", "score": "0.48526555", "text": "func (p *Pop3ScanTls) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/pop3.scan_tls\", p.Value, options...)\n}", "title": "" }, { "docid": "e6e0bfea07d83b063081ccc770df1125", "score": "0.48521566", "text": "func (ds *DeviceState) Update(key *ari.Key, state string) error {\n\treq := map[string]string{\n\t\t\"deviceState\": state,\n\t}\n\n\treturn ds.client.put(\"/deviceStates/\"+key.ID, nil, &req)\n}", "title": "" }, { "docid": "64be7950f8dd21ce31cf4014a81aa553", "score": "0.48516884", "text": "func updateProfile(p *model.Profile, repo repository.ProfileRepository) error {\n\terr := repo.Update(p.ID, p)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfmt.Println(\"Update Success !\")\n\n\treturn nil\n}", "title": "" }, { "docid": "191300f9a76f0f8e2129e5976e0d9097", "score": "0.48422834", "text": "func (r *RoutingOspfRedistributeIpsecStatus) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/routing.ospf.redistribute.ipsec.status\", r.Value, options...)\n}", "title": "" }, { "docid": "0efd09bf348693a0bba999aa18350624", "score": "0.48385322", "text": "func RunUpdate(currentVersion common.Player, mac string, authParams AuthParams, updaterPort int) {\n\n\tpayloadBytes, err := json.Marshal(currentVersion)\n\tif err != nil {\n\t\tfmt.Print(err)\n\t\t// handle err\n\t}\n\tbody := bytes.NewReader(payloadBytes)\n\n\treq, err := http.NewRequest(\"PUT\", \"http://localhost:\"+strconv.Itoa(updaterPort)+\"/profiles/clientId:\"+mac, body)\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\treq.Header.Set(\"X-Client-Id\", authParams.ClientId)\n\tif !authParams.ClientToken.Expired {\n\t\treq.Header.Set(\"X-Authentication-Token\", authParams.ClientToken.Token)\n\t}\n\n\t// run assembled request\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\trespBody, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\n\tsb := string(respBody)\n\tlog.Printf(sb, resp.Status)\n\tdefer resp.Body.Close()\n}", "title": "" }, { "docid": "9ba4e791ca400916390aa3461283c31d", "score": "0.48333582", "text": "func (h *HttpUseSxlUrid) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/http.use_sxl_urid\", h.Value, options...)\n}", "title": "" }, { "docid": "0bbdecef8f42e6fae73a3addd37645e9", "score": "0.48328876", "text": "func update(stub shim.ChaincodeStubInterface, args []string) ([]byte, error) {\n\tvar err error\n\tret := make(map[string]interface{})\n\n\tif len(args) != 2 {\n\t\tlog.Error().Msg(\"FNUPDATE: Incorrect arguments. Expecting key and data\")\n\t\treturn nil, fmt.Errorf(\"Incorrect arguments. Expecting key and data\")\n\t}\n\n\tkey, err := stub.CreateCompositeKey(ObjectType, []string{args[0]})\n\tif err != nil {\n\t\tlog.Error().Stack().Err(err)\n\t\treturn nil, fmt.Errorf(\"Failed to create composite key, err: %v\", err.Error())\n\t}\n\n\terr = stub.PutState(key, []byte(args[1]))\n\tif err != nil {\n\t\tlog.Error().Stack().Err(err)\n\t\treturn nil, fmt.Errorf(\"Failed to update data: %v, err: %v\", args[1], err.Error())\n\t}\n\n\tret[\"update\"] = args[0]\n\n\treturn json.Marshal(ret)\n}", "title": "" }, { "docid": "40e313e233328609a5a57c42e73c2f49", "score": "0.48325983", "text": "func (e *EmailpkiGlobalCity) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/emailpki.global.city\", e.Value, options...)\n}", "title": "" }, { "docid": "593924aaa8fdb3d83f813477213eaed9", "score": "0.4831822", "text": "func (pms *PromMetricsService) update() error {\n\n\ttailsIncluded, legacyMsTargetIndex, err := pms.queryIncludedTails()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treceiptEntriesApplied, c2MsTargetIndex, err := pms.queryC2NodeReceipts()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpms.state.LastLegacyMilestoneIndexQueried = legacyMsTargetIndex\n\tpms.state.LastC2MilestoneIndexQueried = c2MsTargetIndex\n\tpms.state.ReceiptEntriesApplied += receiptEntriesApplied\n\tpms.state.LegacyTailsIncluded += tailsIncluded\n\tif err := pms.state.persist(pms.cfg.StateFilePath); err != nil {\n\t\treturn err\n\t}\n\n\tpms.legacyWfTailsIncluded.Add(float64(tailsIncluded))\n\tpms.receiptEntriesApplied.Add(float64(receiptEntriesApplied))\n\n\tif pms.cfg.Debug {\n\t\tjsonState, err := json.MarshalIndent(pms.state, \"\", \" \")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlog.Printf(\"updated prom metrics service state:\\n %v\", string(jsonState))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "70fd0cc82ed945df2e3fcee62a44c657", "score": "0.48311576", "text": "func (r *Room) Update(db *sqlx.DB) (sql.Result, error) {\n\tstmt := `\n UPDATE room\n SET size = :size,\n flatmates = :flatmates,\n rent = :rent,\n hospice = :hospice,\n landlord = :landlord,\n\n postcode = :postcode,\n street = :street,\n house_number = :house_number,\n floor = :floor,\n\n toilet = :toilet,\n bathroom = :bathroom,\n shared_living = :shared_living,\n personal_spaces = :personal_spaces\n WHERE id = :id\n `\n\treturn db.NamedExec(stmt, r)\n}", "title": "" }, { "docid": "ea821f5c8f3183c7325c033f38345298", "score": "0.4830227", "text": "func (ps *ProbeService) Update(name string, probe Probe) error {\n\terr := runValidators(probe, nameInvalid, urlInvalid, delayInvalid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, ok := ps.probes[name]; !ok {\n\t\treturn ErrProbeNotFound\n\t}\n\tif _, ok := ps.probes[probe.Name]; name != probe.Name && ok {\n\t\treturn ErrProbeAlreadyExist\n\t}\n\n\tps.probes[name].finish <- true\n\tdelete(ps.probes, name)\n\n\tprobe.finish = make(chan bool, 1)\n\tps.probes[probe.Name] = &probe\n\n\tgo ps.run(ps.probes[probe.Name])\n\n\tlog.Printf(\"Probe [%s] has been successfuly updated.\\n\", probe.Name)\n\treturn nil\n}", "title": "" }, { "docid": "810d2f91b55c61c99c059bb41fa9a60d", "score": "0.48301446", "text": "func (o *VaultSystem) Update() (*restapi.GenericMapResponse, error) {\n\tif o.ID == \"\" {\n\t\treturn nil, errors.New(\"error: ID is empty\")\n\t}\n\n\tvar queryArg = make(map[string]interface{})\n\tqueryArg, err := generateRequestMap(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Special handling of system login profile\n\t//if queryArg[\"LoginDefaultProfile\"] != \"\" {\n\tqueryArg[\"updateChallenges\"] = true\n\t//}\n\n\tLogD.Printf(\"Generated Map for Update(): %+v\", queryArg)\n\treply, err := o.client.CallGenericMapAPI(o.apiUpdate, queryArg)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !reply.Success {\n\t\treturn nil, errors.New(reply.Message)\n\t}\n\n\treturn reply, nil\n}", "title": "" }, { "docid": "545e4607cd917a48c59dcea050f35ef5", "score": "0.48193693", "text": "func (r *courseResource) update(c echo.Context) error {\n\tmodel, err := r.service.Get(c.Param(\"courseID\"))\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, helper.NewErrorResponse(err))\n\t}\n\n\tif err := c.Bind(model); err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, helper.NewErrorResponse(err))\n\t}\n\n\tresponse, err := r.service.Update(model)\n\tif err != nil {\n\t\treturn c.JSON(http.StatusBadRequest, helper.NewErrorResponse(err))\n\t}\n\n\treturn c.JSON(http.StatusOK, helper.NewSuccessResponse(*response))\n}", "title": "" }, { "docid": "56ea29a915438ff4c826a6cd5fe3f595", "score": "0.48181984", "text": "func (e *EppCity) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/epp.city\", e.Value, options...)\n}", "title": "" }, { "docid": "c2e622d23c2b861524684ec04c046ddf", "score": "0.4816988", "text": "func (client *FactorioClient) Update(resource_type string, resource_id string, update_opts interface{}, result_out interface{}) error {\n\treturn client.doCall(result_out, \"update\", resource_type, resource_id, update_opts)\n}", "title": "" }, { "docid": "fd0d6a4f6f3430c9f8de25f991e36948", "score": "0.4816517", "text": "func (cc *EnergyMarket) update(stub shim.ChaincodeStubInterface, args []string) peer.Response {\n\n\t// Validate and extract parameters\n\tif rc := Validate(\"create\", args \n\t/*args[0]=id*/, \"%s\", 1, 64 \n\t/*args[1]=ObjectType*/, \"%s\", 1, 64 \n\t/*args[1]=ProductName*/, \"%s\", 1, 255 \n\t/*args[1]=Description*/, \"%s\", 1, 64 \n\t/*args[1]=OfferorID*/, \"%s\", 1, 50 \n\t/*args[1]=Price*/, \"%f\", 0.1, 2.5); rc.Status > 0 {\n\t\treturn rc\n\t}\n\n\t////////////////////////////////////////////////////////\n\t// extract the individual parameters from the args array\n\t////////////////////////////////////////////////////////\n\t\n\t// productid\n\tid := strings.ToLower(args[0])\n\n\t// price\n\tprice, err := strconv.ParseFloat(args[5], 32)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// create the timestamp\n\tmytime := time.Now()\n\n\t// create new productOffering with extracted parameters\n\tproductOffering := &ProductOffering{ObjectType: \"productOfferings\", ProductName: args[2], Description: args[3], OfferorID: args[4], Price: float32(price), Status: available, Timestamp: mytime.Format(\"2006-01-02 15:04:05\")}\n\n\n\t// validate that productID does exist\n\tif value, err := stub.GetState(id); err != nil || value == nil {\n\t\treturn Error(http.StatusNotFound, \"Not Found\")\n\t}\n\n\t// save modified productOffering to blockchain\n\tif err := stub.PutState(id, productOffering.ToJson()); err != nil {\n\t\treturn Error(http.StatusInternalServerError, err.Error())\n\t}\n\n\t// return positive feedback if successful\n\treturn Success(http.StatusNoContent, \"Text Updated\", nil)\n\n}", "title": "" }, { "docid": "7671227a2a6be586bafec93dd831de11", "score": "0.48120078", "text": "func updateJobRegion(\n\tdone chan interface{},\n\twg *sync.WaitGroup,\n\tregionEnv *RegionEnv,\n\tjobStream chan *RegionEnv,\n) {\n\tdefer wg.Done()\n\t// Job is not required when deploying a Deployment\n\tif regionEnv.Job == nil {\n\t\tjobStream <- regionEnv\n\t\treturn\n\t}\n\n\tvar createErr, deleteErr, watchErr error\n\tvar newJob *batchv1.Job\n\tname := regionEnv.Job.Name\n\n\t// Client set is region specific.\n\tjobInterface := regionEnv.Clientset.BatchV1().Jobs(regionEnv.Cfg.Namespace)\n\n\t// Delete if job already exists.\n\tif previousJob, getErr := jobInterface.Get(name, metav1.GetOptions{}); getErr == nil {\n\t\tlog.Infof(\"Found existing job %s in %s - trying to delete\", name, regionEnv.Region)\n\t\tif deleteErr = regionEnv.deleteJob(previousJob, true); deleteErr != nil {\n\t\t\tregionEnv.Errors = append(regionEnv.Errors,\n\t\t\t\tfmt.Errorf(\"Unable to delete preexisting job %s in %s: %w\", name, regionEnv.Region, deleteErr))\n\t\t\tjobStream <- regionEnv\n\t\t\treturn\n\t\t}\n\t\tlog.Infof(\"Job %s deleted in %s\", name, regionEnv.Region)\n\t}\n\n\t// Replace docker registry with regional value.\n\tregionEnv.updateRegistry(regionEnv.Job)\n\n\t// Replace tokens in annotations.\n\tregionEnv.replaceDeploymentAnnotations(regionEnv.Job)\n\n\t// Inject service binding secrets.\n\tregionEnv.injectSecretKeyRefs(regionEnv.Job)\n\n\t// Fail deployment if any of the RegionEnv methods produced errors.\n\tif len(regionEnv.Errors) > 0 {\n\t\tjobStream <- regionEnv\n\t\treturn\n\t}\n\n\tlog.Debugf(\"Run: %+v\", regionEnv.Job)\n\t// Create the job\n\tnewJob, createErr = jobInterface.Create(regionEnv.Job)\n\tif createErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors,\n\t\t\tfmt.Errorf(\"Unable to create job %s in %s: %w\", name, regionEnv.Region, createErr))\n\t\tjobStream <- regionEnv\n\t\treturn\n\t}\n\n\t// Watch job execution.\n\tnewJob, watchErr = regionEnv.watchJob(newJob)\n\tif watchErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors,\n\t\t\tfmt.Errorf(\"failure while watching job %s in %s: %w\", name, regionEnv.Region, watchErr),\n\t\t)\n\t} else {\n\t\tjobCondition := &newJob.Status.Conditions[len(newJob.Status.Conditions)-1]\n\t\tswitch jobCondition.Type {\n\t\tcase batchv1.JobComplete:\n\t\t\tlog.Infof(\"job %s in %s completed at %v\", name, regionEnv.Region, newJob.Status.CompletionTime)\n\n\t\tcase batchv1.JobFailed:\n\t\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\n\t\t\t\t\"job %s failed in %s: %s - %s\", name, regionEnv.Region, jobCondition.Reason, jobCondition.Message),\n\t\t\t)\n\t\tdefault:\n\t\t\tlog.Warnf(\"job %s unknown status: %+v\\n\", regionEnv.Region, newJob.Status.Conditions)\n\t\t}\n\t}\n\n\t// Cleanup Job, configmaps, secrets\n\tprotectedShas := map[string]bool{}\n\tdeleteErr = regionEnv.deleteJob(newJob, false)\n\tif deleteErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors,\n\t\t\tfmt.Errorf(\"Unable to clean up job %s in %s: %w\", name, regionEnv.Region, deleteErr))\n\t}\n\tif !regionEnv.deleteOldConfigMaps(name, protectedShas) {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"configmap deletion error\"))\n\t}\n\tif !regionEnv.deleteOldSecrets(name, protectedShas) {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"secret deletion failure\"))\n\t}\n\n\tselect {\n\tcase <-done:\n\t\tlog.Info(\"Received Done\")\n\t\treturn\n\tcase jobStream <- regionEnv:\n\t}\n}", "title": "" }, { "docid": "4167878917656b0eeca622125369a925", "score": "0.48112425", "text": "func (c Client) Update(tx transaction.Transaction) (*result.Application, error) {\n\tclientId := tx.Instance.GetClientId()\n\tobjectId := tx.Instance.GetObjectId()\n\tservicePrincipalId := tx.Instance.GetServicePrincipalId()\n\n\tapp, err := c.Application().Update(tx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"updating application resource: %w\", err)\n\t}\n\n\tif err := c.Application().RedirectUri().Update(tx); err != nil {\n\t\treturn nil, fmt.Errorf(\"updating redirect URIs: %w\", err)\n\t}\n\n\tactualPermissions := permissions.ExtractPermissions(app)\n\tpreAuthApps, err := c.process(tx, actualPermissions)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := c.Application().RemoveDisabledPermissions(tx, *app); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &result.Application{\n\t\tClientId: clientId,\n\t\tObjectId: objectId,\n\t\tServicePrincipalId: servicePrincipalId,\n\t\tPermissions: actualPermissions,\n\t\tPreAuthorizedApps: *preAuthApps,\n\t\tTenant: c.config.Tenant.Id,\n\t\tResult: result.OperationUpdated,\n\t}, nil\n}", "title": "" }, { "docid": "ea6f37d32d3c13f350f5cb4acad39527", "score": "0.48094803", "text": "func updateIngressRegion(\n\tdone chan interface{},\n\twg *sync.WaitGroup,\n\tregionEnv *RegionEnv,\n\tingressStream chan *RegionEnv,\n) {\n\tdefer wg.Done()\n\t// Do not create ingress if the cluster is running istio.\n\tif regionEnv.Ingress == nil || regionEnv.ClusterSettings[\"ISTIO\"] == \"true\" {\n\t\tingressStream <- regionEnv\n\t\treturn\n\t}\n\n\tvar updateErr, getErr error\n\tvar ingressUpdate *extensionsv1beta1.Ingress\n\n\tname := regionEnv.Ingress.ObjectMeta.Name\n\t// Client set is region specific.\n\tingressInterface := regionEnv.Clientset.ExtensionsV1beta1().Ingresses(regionEnv.Cfg.Namespace)\n\n\t// Check if ingress already exists.\n\tpreviousIngress, getErr := ingressInterface.Get(name, metav1.GetOptions{})\n\n\t// Update ingress if required.\n\tif getErr == nil {\n\t\tif needsUpdate(previousIngress, regionEnv.Ingress) {\n\t\t\tingressUpdate, updateErr = ingressInterface.Update(regionEnv.Ingress)\n\t\t}\n\t} else if errors.IsNotFound(getErr) {\n\t\tingressUpdate, updateErr = ingressInterface.Create(regionEnv.Ingress)\n\t} else {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to get ingress\\n%s\", getErr))\n\t\tingressStream <- regionEnv\n\t\treturn\n\t}\n\tif updateErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to create/update ingress\\n%s\", updateErr))\n\t\tingressStream <- regionEnv\n\t\treturn\n\t}\n\n\tif ingressUpdate != nil {\n\t\tlog.Infof(\"Update: %+v\", ingressUpdate)\n\t}\n\n\tselect {\n\tcase <-done:\n\t\tlog.Info(\"Received Done\")\n\t\treturn\n\tcase ingressStream <- regionEnv:\n\t}\n}", "title": "" }, { "docid": "59116f8a79d49de81059eccade02eee2", "score": "0.48076472", "text": "func updateConfigMapRegion(\n\tdone chan interface{},\n\twg *sync.WaitGroup,\n\tregionEnv *RegionEnv,\n\tconfigMapStream chan *RegionEnv,\n) {\n\tdefer wg.Done()\n\t// ConfigMap is not required.\n\tif regionEnv.ConfigMap == nil {\n\t\tconfigMapStream <- regionEnv\n\t\treturn\n\t}\n\n\tvar updateErr, getErr error\n\tvar previousConfigMap, configMapUpdate *v1.ConfigMap\n\n\tdeploymentName := regionEnv.Deployment.ObjectMeta.Name\n\tconfigMapInterface := regionEnv.Clientset.CoreV1().ConfigMaps(regionEnv.Cfg.Namespace)\n\n\t// Override metadata objects with deployment-specific values\n\tregionEnv.ConfigMap.ObjectMeta.Labels[\"app\"] = deploymentName\n\tname := regionEnv.ConfigMap.ObjectMeta.Name\n\n\tpreviousConfigMap, getErr = configMapInterface.Get(name, metav1.GetOptions{})\n\n\tif getErr == nil {\n\t\tif needsUpdate(previousConfigMap, regionEnv.ConfigMap) {\n\t\t\tconfigMapUpdate, updateErr = configMapInterface.Update(regionEnv.ConfigMap)\n\t\t}\n\t} else if errors.IsNotFound(getErr) {\n\t\tconfigMapUpdate, updateErr = configMapInterface.Create(regionEnv.ConfigMap)\n\t} else {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to get ConfigMap\\n%s\", getErr))\n\t\tconfigMapStream <- regionEnv\n\t\treturn\n\t}\n\n\tif updateErr != nil {\n\t\tregionEnv.Errors = append(regionEnv.Errors, fmt.Errorf(\"Unable to create/update ConfigMap\\n%s\", updateErr))\n\t\tconfigMapStream <- regionEnv\n\t\treturn\n\t}\n\n\tif configMapUpdate != nil {\n\t\tlog.Infof(\"Update: %+v\", configMapUpdate)\n\t}\n\tselect {\n\tcase <-done:\n\t\tlog.Info(\"Received Done\")\n\t\treturn\n\tcase configMapStream <- regionEnv:\n\t}\n}", "title": "" }, { "docid": "62710110bd74c7ab581b65a474625bf7", "score": "0.48053393", "text": "func (i *IpsecAdvancedProbePsk) Update(client sophos.ClientInterface, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/ipsec.advanced.probe_psk\", i.Value, options...)\n}", "title": "" } ]
9954cba7778ff94c6b3557957bde62c5
WithCompleted adds the completed to the post purchases params
[ { "docid": "6bf38d2bc44ce611e599db20319ccbab", "score": "0.77247584", "text": "func (o *PostPurchasesParams) WithCompleted(completed *string) *PostPurchasesParams {\n\to.SetCompleted(completed)\n\treturn o\n}", "title": "" } ]
[ { "docid": "4ae9c5295fff6081c3a5f18fa87b87bb", "score": "0.64286083", "text": "func (o *PostPurchasesParams) SetCompleted(completed *string) {\n\to.Completed = completed\n}", "title": "" }, { "docid": "d949c8fff7fcb849896f8bcf56166ff4", "score": "0.6324609", "text": "func (o *PostPurchasesParams) WithLineCompleted(lineCompleted *string) *PostPurchasesParams {\n\to.SetLineCompleted(lineCompleted)\n\treturn o\n}", "title": "" }, { "docid": "b4ddaff537f76ab30ee44d416959e4d1", "score": "0.5381184", "text": "func (o *PostPurchasesParams) WithTimeout(timeout time.Duration) *PostPurchasesParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "aa85045e8915fa5b5f6827464df355e3", "score": "0.5361033", "text": "func (oc *OrderCreate) SetCompleted(b bool) *OrderCreate {\n\toc.mutation.SetCompleted(b)\n\treturn oc\n}", "title": "" }, { "docid": "849208d4579fea2758489e7b596813ee", "score": "0.5292049", "text": "func (o *PostPurchasesParams) 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.Completed != nil {\n\n\t\t// form param completed\n\t\tvar frCompleted string\n\t\tif o.Completed != nil {\n\t\t\tfrCompleted = *o.Completed\n\t\t}\n\t\tfCompleted := frCompleted\n\t\tif fCompleted != \"\" {\n\t\t\tif err := r.SetFormParam(\"completed\", fCompleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Cost != nil {\n\n\t\t// form param cost\n\t\tvar frCost string\n\t\tif o.Cost != nil {\n\t\t\tfrCost = *o.Cost\n\t\t}\n\t\tfCost := frCost\n\t\tif fCost != \"\" {\n\t\t\tif err := r.SetFormParam(\"cost\", fCost); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.CostCenter != nil {\n\n\t\t// form param cost_center\n\t\tvar frCostCenter string\n\t\tif o.CostCenter != nil {\n\t\t\tfrCostCenter = *o.CostCenter\n\t\t}\n\t\tfCostCenter := frCostCenter\n\t\tif fCostCenter != \"\" {\n\t\t\tif err := r.SetFormParam(\"cost_center\", fCostCenter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Groups != nil {\n\n\t\t// form param groups\n\t\tvar frGroups string\n\t\tif o.Groups != nil {\n\t\t\tfrGroups = *o.Groups\n\t\t}\n\t\tfGroups := frGroups\n\t\tif fGroups != \"\" {\n\t\t\tif err := r.SetFormParam(\"groups\", fGroups); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineAssetIds != nil {\n\n\t\t// form param line_asset_ids\n\t\tvar frLineAssetIds string\n\t\tif o.LineAssetIds != nil {\n\t\t\tfrLineAssetIds = *o.LineAssetIds\n\t\t}\n\t\tfLineAssetIds := frLineAssetIds\n\t\tif fLineAssetIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_asset_ids\", fLineAssetIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineBuildingIds != nil {\n\n\t\t// form param line_building_ids\n\t\tvar frLineBuildingIds string\n\t\tif o.LineBuildingIds != nil {\n\t\t\tfrLineBuildingIds = *o.LineBuildingIds\n\t\t}\n\t\tfLineBuildingIds := frLineBuildingIds\n\t\tif fLineBuildingIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_building_ids\", fLineBuildingIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCancelPolicy != nil {\n\n\t\t// form param line_cancel_policy\n\t\tvar frLineCancelPolicy string\n\t\tif o.LineCancelPolicy != nil {\n\t\t\tfrLineCancelPolicy = *o.LineCancelPolicy\n\t\t}\n\t\tfLineCancelPolicy := frLineCancelPolicy\n\t\tif fLineCancelPolicy != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_cancel_policy\", fLineCancelPolicy); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCertificateIds != nil {\n\n\t\t// form param line_certificate_ids\n\t\tvar frLineCertificateIds string\n\t\tif o.LineCertificateIds != nil {\n\t\t\tfrLineCertificateIds = *o.LineCertificateIds\n\t\t}\n\t\tfLineCertificateIds := frLineCertificateIds\n\t\tif fLineCertificateIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_certificate_ids\", fLineCertificateIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCircuitIds != nil {\n\n\t\t// form param line_circuit_ids\n\t\tvar frLineCircuitIds string\n\t\tif o.LineCircuitIds != nil {\n\t\t\tfrLineCircuitIds = *o.LineCircuitIds\n\t\t}\n\t\tfLineCircuitIds := frLineCircuitIds\n\t\tif fLineCircuitIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_circuit_ids\", fLineCircuitIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCircuits != nil {\n\n\t\t// form param line_circuits\n\t\tvar frLineCircuits string\n\t\tif o.LineCircuits != nil {\n\t\t\tfrLineCircuits = *o.LineCircuits\n\t\t}\n\t\tfLineCircuits := frLineCircuits\n\t\tif fLineCircuits != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_circuits\", fLineCircuits); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCompleted != nil {\n\n\t\t// form param line_completed\n\t\tvar frLineCompleted string\n\t\tif o.LineCompleted != nil {\n\t\t\tfrLineCompleted = *o.LineCompleted\n\t\t}\n\t\tfLineCompleted := frLineCompleted\n\t\tif fLineCompleted != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_completed\", fLineCompleted); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineContractID != nil {\n\n\t\t// form param line_contract_id\n\t\tvar frLineContractID string\n\t\tif o.LineContractID != nil {\n\t\t\tfrLineContractID = *o.LineContractID\n\t\t}\n\t\tfLineContractID := frLineContractID\n\t\tif fLineContractID != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_contract_id\", fLineContractID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineContractType != nil {\n\n\t\t// form param line_contract_type\n\t\tvar frLineContractType string\n\t\tif o.LineContractType != nil {\n\t\t\tfrLineContractType = *o.LineContractType\n\t\t}\n\t\tfLineContractType := frLineContractType\n\t\tif fLineContractType != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_contract_type\", fLineContractType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCost != nil {\n\n\t\t// form param line_cost\n\t\tvar frLineCost string\n\t\tif o.LineCost != nil {\n\t\t\tfrLineCost = *o.LineCost\n\t\t}\n\t\tfLineCost := frLineCost\n\t\tif fLineCost != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_cost\", fLineCost); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCostCenter != nil {\n\n\t\t// form param line_cost_center\n\t\tvar frLineCostCenter string\n\t\tif o.LineCostCenter != nil {\n\t\t\tfrLineCostCenter = *o.LineCostCenter\n\t\t}\n\t\tfLineCostCenter := frLineCostCenter\n\t\tif fLineCostCenter != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_cost_center\", fLineCostCenter); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineCustomer != nil {\n\n\t\t// form param line_customer\n\t\tvar frLineCustomer string\n\t\tif o.LineCustomer != nil {\n\t\t\tfrLineCustomer = *o.LineCustomer\n\t\t}\n\t\tfLineCustomer := frLineCustomer\n\t\tif fLineCustomer != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_customer\", fLineCustomer); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineDeviceAssetNos != nil {\n\n\t\t// form param line_device_asset_nos\n\t\tvar frLineDeviceAssetNos string\n\t\tif o.LineDeviceAssetNos != nil {\n\t\t\tfrLineDeviceAssetNos = *o.LineDeviceAssetNos\n\t\t}\n\t\tfLineDeviceAssetNos := frLineDeviceAssetNos\n\t\tif fLineDeviceAssetNos != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_device_asset_nos\", fLineDeviceAssetNos); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineDeviceOsIds != nil {\n\n\t\t// form param line_device_os_ids\n\t\tvar frLineDeviceOsIds string\n\t\tif o.LineDeviceOsIds != nil {\n\t\t\tfrLineDeviceOsIds = *o.LineDeviceOsIds\n\t\t}\n\t\tfLineDeviceOsIds := frLineDeviceOsIds\n\t\tif fLineDeviceOsIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_device_os_ids\", fLineDeviceOsIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineDeviceSerialNos != nil {\n\n\t\t// form param line_device_serial_nos\n\t\tvar frLineDeviceSerialNos string\n\t\tif o.LineDeviceSerialNos != nil {\n\t\t\tfrLineDeviceSerialNos = *o.LineDeviceSerialNos\n\t\t}\n\t\tfLineDeviceSerialNos := frLineDeviceSerialNos\n\t\tif fLineDeviceSerialNos != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_device_serial_nos\", fLineDeviceSerialNos); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineDevices != nil {\n\n\t\t// form param line_devices\n\t\tvar frLineDevices string\n\t\tif o.LineDevices != nil {\n\t\t\tfrLineDevices = *o.LineDevices\n\t\t}\n\t\tfLineDevices := frLineDevices\n\t\tif fLineDevices != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_devices\", fLineDevices); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineEndDate != nil {\n\n\t\t// form param line_end_date\n\t\tvar frLineEndDate string\n\t\tif o.LineEndDate != nil {\n\t\t\tfrLineEndDate = *o.LineEndDate\n\t\t}\n\t\tfLineEndDate := frLineEndDate\n\t\tif fLineEndDate != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_end_date\", fLineEndDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineFrequency != nil {\n\n\t\t// form param line_frequency\n\t\tvar frLineFrequency string\n\t\tif o.LineFrequency != nil {\n\t\t\tfrLineFrequency = *o.LineFrequency\n\t\t}\n\t\tfLineFrequency := frLineFrequency\n\t\tif fLineFrequency != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_frequency\", fLineFrequency); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineItemType != nil {\n\n\t\t// form param line_item_type\n\t\tvar frLineItemType string\n\t\tif o.LineItemType != nil {\n\t\t\tfrLineItemType = *o.LineItemType\n\t\t}\n\t\tfLineItemType := frLineItemType\n\t\tif fLineItemType != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_item_type\", fLineItemType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineName != nil {\n\n\t\t// form param line_name\n\t\tvar frLineName string\n\t\tif o.LineName != nil {\n\t\t\tfrLineName = *o.LineName\n\t\t}\n\t\tfLineName := frLineName\n\t\tif fLineName != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_name\", fLineName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineNo != nil {\n\n\t\t// form param line_no\n\t\tvar frLineNo string\n\t\tif o.LineNo != nil {\n\t\t\tfrLineNo = *o.LineNo\n\t\t}\n\t\tfLineNo := frLineNo\n\t\tif fLineNo != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_no\", fLineNo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineNotes != nil {\n\n\t\t// form param line_notes\n\t\tvar frLineNotes string\n\t\tif o.LineNotes != nil {\n\t\t\tfrLineNotes = *o.LineNotes\n\t\t}\n\t\tfLineNotes := frLineNotes\n\t\tif fLineNotes != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_notes\", fLineNotes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LinePartIds != nil {\n\n\t\t// form param line_part_ids\n\t\tvar frLinePartIds string\n\t\tif o.LinePartIds != nil {\n\t\t\tfrLinePartIds = *o.LinePartIds\n\t\t}\n\t\tfLinePartIds := frLinePartIds\n\t\tif fLinePartIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_part_ids\", fLinePartIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineQuantity != nil {\n\n\t\t// form param line_quantity\n\t\tvar frLineQuantity string\n\t\tif o.LineQuantity != nil {\n\t\t\tfrLineQuantity = *o.LineQuantity\n\t\t}\n\t\tfLineQuantity := frLineQuantity\n\t\tif fLineQuantity != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_quantity\", fLineQuantity); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineRackIds != nil {\n\n\t\t// form param line_rack_ids\n\t\tvar frLineRackIds string\n\t\tif o.LineRackIds != nil {\n\t\t\tfrLineRackIds = *o.LineRackIds\n\t\t}\n\t\tfLineRackIds := frLineRackIds\n\t\tif fLineRackIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_rack_ids\", fLineRackIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineRenewDate != nil {\n\n\t\t// form param line_renew_date\n\t\tvar frLineRenewDate string\n\t\tif o.LineRenewDate != nil {\n\t\t\tfrLineRenewDate = *o.LineRenewDate\n\t\t}\n\t\tfLineRenewDate := frLineRenewDate\n\t\tif fLineRenewDate != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_renew_date\", fLineRenewDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineRoomIds != nil {\n\n\t\t// form param line_room_ids\n\t\tvar frLineRoomIds string\n\t\tif o.LineRoomIds != nil {\n\t\t\tfrLineRoomIds = *o.LineRoomIds\n\t\t}\n\t\tfLineRoomIds := frLineRoomIds\n\t\tif fLineRoomIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_room_ids\", fLineRoomIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineServiceType != nil {\n\n\t\t// form param line_service_type\n\t\tvar frLineServiceType string\n\t\tif o.LineServiceType != nil {\n\t\t\tfrLineServiceType = *o.LineServiceType\n\t\t}\n\t\tfLineServiceType := frLineServiceType\n\t\tif fLineServiceType != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_service_type\", fLineServiceType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineSoftwareIds != nil {\n\n\t\t// form param line_software_ids\n\t\tvar frLineSoftwareIds string\n\t\tif o.LineSoftwareIds != nil {\n\t\t\tfrLineSoftwareIds = *o.LineSoftwareIds\n\t\t}\n\t\tfLineSoftwareIds := frLineSoftwareIds\n\t\tif fLineSoftwareIds != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_software_ids\", fLineSoftwareIds); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineStartDate != nil {\n\n\t\t// form param line_start_date\n\t\tvar frLineStartDate string\n\t\tif o.LineStartDate != nil {\n\t\t\tfrLineStartDate = *o.LineStartDate\n\t\t}\n\t\tfLineStartDate := frLineStartDate\n\t\tif fLineStartDate != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_start_date\", fLineStartDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.LineType != nil {\n\n\t\t// form param line_type\n\t\tvar frLineType string\n\t\tif o.LineType != nil {\n\t\t\tfrLineType = *o.LineType\n\t\t}\n\t\tfLineType := frLineType\n\t\tif fLineType != \"\" {\n\t\t\tif err := r.SetFormParam(\"line_type\", fLineType); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Notes != nil {\n\n\t\t// form param notes\n\t\tvar frNotes string\n\t\tif o.Notes != nil {\n\t\t\tfrNotes = *o.Notes\n\t\t}\n\t\tfNotes := frNotes\n\t\tif fNotes != \"\" {\n\t\t\tif err := r.SetFormParam(\"notes\", fNotes); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.OrderNo != nil {\n\n\t\t// form param order_no\n\t\tvar frOrderNo string\n\t\tif o.OrderNo != nil {\n\t\t\tfrOrderNo = *o.OrderNo\n\t\t}\n\t\tfOrderNo := frOrderNo\n\t\tif fOrderNo != \"\" {\n\t\t\tif err := r.SetFormParam(\"order_no\", fOrderNo); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PoDate != nil {\n\n\t\t// form param po_date\n\t\tvar frPoDate string\n\t\tif o.PoDate != nil {\n\t\t\tfrPoDate = *o.PoDate\n\t\t}\n\t\tfPoDate := frPoDate\n\t\tif fPoDate != \"\" {\n\t\t\tif err := r.SetFormParam(\"po_date\", fPoDate); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.PurchaseID != nil {\n\n\t\t// form param purchase_id\n\t\tvar frPurchaseID string\n\t\tif o.PurchaseID != nil {\n\t\t\tfrPurchaseID = *o.PurchaseID\n\t\t}\n\t\tfPurchaseID := frPurchaseID\n\t\tif fPurchaseID != \"\" {\n\t\t\tif err := r.SetFormParam(\"purchase_id\", fPurchaseID); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t}\n\n\tif o.Vendor != nil {\n\n\t\t// form param vendor\n\t\tvar frVendor string\n\t\tif o.Vendor != nil {\n\t\t\tfrVendor = *o.Vendor\n\t\t}\n\t\tfVendor := frVendor\n\t\tif fVendor != \"\" {\n\t\t\tif err := r.SetFormParam(\"vendor\", fVendor); 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": "308d983a53a9afe7a66a979a64d6b567", "score": "0.52714163", "text": "func (o *DepositCreate) SetCompleted(v time.Time) {\n\to.Completed = v\n}", "title": "" }, { "docid": "5bef845331d5d31d6dd6dbe8d7a24445", "score": "0.52607167", "text": "func (o *PostPurchasesParams) WithContext(ctx context.Context) *PostPurchasesParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "230bfc9309153a7530b6fa8fdcb27945", "score": "0.52362573", "text": "func NewPostPurchasesParams() *PostPurchasesParams {\n\tvar ()\n\treturn &PostPurchasesParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "dc968571c8899594503615c0c6eb35b8", "score": "0.51989347", "text": "func NewPostPurchasesParamsWithHTTPClient(client *http.Client) *PostPurchasesParams {\n\tvar ()\n\treturn &PostPurchasesParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "35799a8b94c3a48edee313659238a6dd", "score": "0.51358235", "text": "func NewPostPurchasesParamsWithTimeout(timeout time.Duration) *PostPurchasesParams {\n\tvar ()\n\treturn &PostPurchasesParams{\n\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "0ba7e1634433cd389c13ddef16b9a1e9", "score": "0.50708276", "text": "func (o *ApplianceClusterInstallBaseAllOf) SetCompletedPhases(v []ApplianceClusterInstallPhase) {\n\to.CompletedPhases = v\n}", "title": "" }, { "docid": "2b20adb742d78b1275f96b8fe300d8b4", "score": "0.49852663", "text": "func (o *PostPurchasesParams) WithHTTPClient(client *http.Client) *PostPurchasesParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "6281577381f7ba7d0c0dee0de135872d", "score": "0.4985258", "text": "func (o *DepositDetail) SetCompleted(v time.Time) {\n\to.Completed.Set(&v)\n}", "title": "" }, { "docid": "a8de40c02e1c0b61b073af8bd1ac571f", "score": "0.48313498", "text": "func (o *PostPurchasesParams) SetLineCompleted(lineCompleted *string) {\n\to.LineCompleted = lineCompleted\n}", "title": "" }, { "docid": "95ccfa5d93e3022081f588d4c1b4c0ea", "score": "0.4779645", "text": "func NewCompleteSetupPostRequestBody()(*CompleteSetupPostRequestBody) {\n m := &CompleteSetupPostRequestBody{\n }\n m.backingStore = ie8677ce2c7e1b4c22e9c3827ecd078d41185424dd9eeb92b7d971ed2d49a392e.BackingStoreFactoryInstance();\n m.SetAdditionalData(make(map[string]any))\n return m\n}", "title": "" }, { "docid": "cd7770df4354b3ddf5b9cfb071392337", "score": "0.47278845", "text": "func (fb *FBStruct) GenOrderCompleted(\n\torder *models.Order) (*url.Values, error) {\n\tv := url.Values{}\n\tv.Set(\"upload_tag\", tagName)\n\tv.Set(\"access_token\", fb.cfg.AccessToken)\n\n\tsatoshi, err := orderSatoshi(order)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get satoshi from order fail err %v\", err)\n\t}\n\n\ts, err := jsonBuilder.Array(\n\t\tjsonBuilder.Object(\n\t\t\tjsonBuilder.Attr(\"event_time\", time.Now().Unix()),\n\t\t\tjsonBuilder.Attr(\"event_name\", \"Other\"),\n\t\t\tjsonBuilder.Attr(\"match_keys\", jsonBuilder.Object(\n\t\t\t\tjsonBuilder.Attr(\"extern_id\", order.UserID.String()),\n\t\t\t)),\n\t\t\tjsonBuilder.Attr(\"custom_data\", jsonBuilder.Object(\n\t\t\t\tjsonBuilder.Attr(\"custom_event_name\", \"OrderCompleted\"),\n\t\t\t\tjsonBuilder.Attr(\"value\", decimalToFloat(satoshi)),\n\t\t\t)),\n\t\t),\n\t).Marshal()\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"marshal: %v\", err)\n\t}\n\tv.Set(\"data\", string(s))\n\treturn &v, nil\n}", "title": "" }, { "docid": "66e005b1641c23f77e3b813051bf5081", "score": "0.4726226", "text": "func (transaction *Transacion) Completed() error {\n\n\ttransaction.Status = transactionCompleted\n\ttransaction.UpdatedAt = time.Now()\n\n\terr := transaction.isValid()\n\treturn err\n\n}", "title": "" }, { "docid": "de7377ded89d4e9351c3d3e24c01816e", "score": "0.47252476", "text": "func (m *CompaniesItemPaymentTermsRequestBuilder) Post(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PaymentTermable, requestConfiguration *CompaniesItemPaymentTermsRequestBuilderPostRequestConfiguration)(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PaymentTermable, error) {\n requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.Send(ctx, requestInfo, ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.CreatePaymentTermFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PaymentTermable), nil\n}", "title": "" }, { "docid": "5b76d42e2558e4c7ba86e5092aadf3d2", "score": "0.46765438", "text": "func (o *DepositDetail) HasCompleted() bool {\n\tif o != nil && o.Completed.IsSet() {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "f5088dcd1b3016b824a4e9bcbfd31643", "score": "0.4668293", "text": "func route_Tasks_Update_Complete_POST(dso *DataSourceOrchestration) httprouter.Handle {\n\treturn func(w http.ResponseWriter, r *http.Request, rp httprouter.Params) {\n\t\tlog.Tracef(\"route_Tasks_Update_Complete_POST(): Started\")\n\n\t\t// Parse request body JSON\n\t\tvar task service.Task\n\t\tdecoder := json.NewDecoder(r.Body)\n\t\terr := decoder.Decode(&task)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"route_Tasks_New_POST() --> json.Decode(&task): %v\", err)\n\t\t\tdso.Renderer.JSON(w, http.StatusBadRequest, map[string]string{\"error\": fmt.Sprintf(\"JSON decode of request body failed: %v\", err)})\n\t\t\treturn\n\t\t}\n\t\tlog.Tracef(\"route_Tasks_Update_Complete_POST(): Decoded JSON to task: %v\", task)\n\n\t\terr = dso.Store.MarkAsCompleted(task.ID)\n\t\tif err != nil {\n\t\t\tlog.Warnf(\"route_Tasks_New_POST() --> Store.MarkAsCompleted(task.ID): %v\", err)\n\t\t\tdso.Renderer.JSON(w, http.StatusBadRequest, map[string]string{\"error\": fmt.Sprintf(\"Error occurred marking task as completed: %v\", err)})\n\t\t\treturn\n\t\t}\n\n\t\tdso.Renderer.JSON(w, http.StatusOK, nil)\n\t}\n}", "title": "" }, { "docid": "bc7962605552918ff8e2a0acf4b9b2ed", "score": "0.46586162", "text": "func (c Webinar) MarkAsPurchased(tx *pop.Connection, u *User) error {\n\tif c.Webinar.Price == 0 {\n\t\tc.Webinar.Purchased = true\n\t\treturn nil\n\t}\n\tb, err := tx.Where(\"course_id = ? and user_id = ?\", c.Webinar.ID, u.ID).Exists(\"purchases\")\n\tfmt.Println(\"purchased for this user:\", b)\n\tc.Webinar.Purchased = b\n\treturn err\n}", "title": "" }, { "docid": "4802a6a743b30a418d4126f23e6c0ec7", "score": "0.46491095", "text": "func (m *ProjectMutation) SetCompleted(t time.Time) {\n\tm.completed = &t\n}", "title": "" }, { "docid": "a346db7e612b01ec89ef587fb3b378e0", "score": "0.464397", "text": "func (o *IncidentTodoAttributes) SetCompleted(v string) {\n\to.Completed.Set(&v)\n}", "title": "" }, { "docid": "99570991ca7a1b979f53dd819bc27930", "score": "0.46402147", "text": "func orderCompleted(orders OrderList, order Order, orderDoneTxChan chan<- network.UDPmessage) OrderList {\n\torders = removeDoneOrders(orders, order)\n\tif order.Type == OrderInternal {\n\t\tbackup.SaveToFile(orders, backup.BackupInternal)\n\t\tdriver.SetButtonLamp(driver.ButtonInternalOrder, order.Floor, 0)\n\t} else if order.Type == OrderExternal {\n\t\tbackup.SaveToFile(orders, backup.BackupExternal)\n\t\tdriver.SetButtonLamp(driver.ButtonType(order.Direction), order.Floor, 0)\n\t\tif order.AssignedTo == localId {\n\n\t\t\t// Send \"order completed\" message repeatedly for redundancy\n\t\t\tgo func() {\n\t\t\t\torderJson, _ := json.Marshal(order)\n\t\t\t\tfor i := 0; i < 15; i++ {\n\t\t\t\t\torderDoneTxChan <- network.UDPmessage{Type: network.MsgFinishedOrder, Data: orderJson}\n\t\t\t\t\ttime.Sleep(200 * time.Millisecond)\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\treturn orders\n}", "title": "" }, { "docid": "f4925d706e63f2810d41dacdd7e5ea11", "score": "0.458439", "text": "func (o *TasklistsIdTasksJsonTodoItem) SetCompleted(v bool) {\n\to.Completed = &v\n}", "title": "" }, { "docid": "6cfb2164cad45029937c9f675b4b60ef", "score": "0.45707005", "text": "func (o *ApplianceClusterInstallBaseAllOf) HasCompletedPhases() bool {\n\tif o != nil && o.CompletedPhases != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "286e5f954e4fef798b34cdacc1254496", "score": "0.45704654", "text": "func (o *InlineResponse20089SearchResultTasks) SetCompleted(v bool) {\n\to.Completed = &v\n}", "title": "" }, { "docid": "3731cb41e65670096d628cfc10a7b839", "score": "0.45678487", "text": "func TestCreatePurchaseInvoiceStatusFinished(t *testing.T) {\n\n\to := orm.NewOrm()\n\to.Raw(\"DELETE FROM purchase_invoice\").Exec()\n\n\tuser := model.DummyUserPriviledgeWithUsergroup(1)\n\tsd, _ := auth.Login(user)\n\ttoken := \"Bearer \" + sd.Token\n\n\tpo := model.DummyPurchaseOrder()\n\tpo.InvoiceStatus = \"finished\"\n\tpo.TotalCharge = 5000\n\tpo.IsDeleted = 0\n\tpo.Save()\n\tpox := common.Encrypt(po.ID)\n\n\tpi := model.DummyPurchaseInvoice()\n\tpi.TotalAmount = 1000\n\tpi.PurchaseOrder = po\n\tpi.Save()\n\n\tpi2 := model.DummyPurchaseInvoice()\n\tpi2.TotalAmount = 1000\n\tpi2.PurchaseOrder = po\n\tpi2.Save()\n\n\tvar create = []struct {\n\t\treq tester.D\n\t\texpected int\n\t}{\n\t\t{tester.D{\"recognition_date\": time.Now(),\n\t\t\t\"purchase_order\": pox,\n\t\t\t\"due_date\": time.Now(),\n\t\t\t\"total_amount\": 3000,\n\t\t\t\"note\": \"AHAHAHA\",\n\t\t\t\"billing_address\": \"THE POK\"}, http.StatusUnprocessableEntity},\n\t}\n\tng := tester.New()\n\tfor _, tes := range create {\n\t\tng.SetHeader(tester.H{\"Authorization\": token})\n\t\tng.POST(\"/v1/purchase-invoice\").\n\t\t\tSetJSON(tes.req).\n\t\t\tRun(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\t\t\tassert.Equal(t, tes.expected, res.Code, fmt.Sprintf(\"\\nreason: Validation Not Matched,\\ndata: %v , \\nresponse: %v\", tes.req, res.Body.String()))\n\t\t\t})\n\t}\n}", "title": "" }, { "docid": "ff4e096d0c7c2000aa71a046fdf19dd6", "score": "0.45442086", "text": "func (o *SummaryColumnCardResponse) SetCompleted(v int32) {\n\to.Completed = &v\n}", "title": "" }, { "docid": "033446abf0fa4dbb9f7e8d661bb032c7", "score": "0.45284382", "text": "func (wc *Wepay) PostAfterPay(c echo.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "4a5d92de81cd4c4196605c47554c5114", "score": "0.45086795", "text": "func (auth *AuthManager) RecordCompletedOrder(user account.AccountID, oid order.OrderID, t time.Time) {\n\ttMS := encode.UnixMilli(t)\n\tauth.recordOrderDone(user, oid, nil, tMS)\n}", "title": "" }, { "docid": "9ee479a8751d3e0bd3429424318648a6", "score": "0.4497634", "text": "func (item TransactionSearchItem) IsCompleted() bool {\n\treturn item.Status == \"Completed\"\n}", "title": "" }, { "docid": "786d0717454f4cb902b1eac5eee88649", "score": "0.44477588", "text": "func (o *TasklistsIdTasksJsonTodoItem) HasCompleted() bool {\n\tif o != nil && o.Completed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "8d5ed74182805a6928e96e2a2d6d2720", "score": "0.44249955", "text": "func (m *ItemOutlookTaskGroupsItemTaskFoldersItemTasksOutlookTaskItemRequestBuilder) Complete()(*ItemOutlookTaskGroupsItemTaskFoldersItemTasksItemCompleteRequestBuilder) {\n return NewItemOutlookTaskGroupsItemTaskFoldersItemTasksItemCompleteRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "46adf046775dd16698abc6cc0be12bdc", "score": "0.44185972", "text": "func (o *IncidentTodoAttributes) HasCompleted() bool {\n\treturn o != nil && o.Completed.IsSet()\n}", "title": "" }, { "docid": "43b090fd6e2af5ade46734443f5f4854", "score": "0.441679", "text": "func PostPurchase(c *gin.Context) {\n\tvar in model.Purchase\n\terr := c.BindJSON(&in)\n\tcheckErr(err, BindJson)\n\t//Check if client parameters are valid\n\tif err != nil {\n\t\tresponse := gin.H{\n\t\t\t\"status\": \"error\",\n\t\t\t\"data\": nil,\n\t\t\t\"message\": ErrorParams,\n\t\t}\n\t\tc.JSON(http.StatusBadRequest, response)\n\t\treturn\n\t}\n\t//As the params are correct, we proceeded\n\t//to insert input purchase\n\tpurchase, flag := model.InsertPurchase(&in)\n\t//Flag is true if the model succeeds in inserting the client\n\tif flag {\n\t\tresponse := gin.H{\n\t\t\t\"status\": \"success\",\n\t\t\t\"data\": purchase,\n\t\t\t\"message\": nil,\n\t\t}\n\t\tc.JSON(http.StatusOK, response)\n\t} else {\n\t\tresponse := gin.H{\n\t\t\t\"status\": \"error\",\n\t\t\t\"data\": purchase,\n\t\t\t\"message\": PostMessageError + \" a client\",\n\t\t}\n\t\tc.JSON(http.StatusBadRequest, response)\n\t}\n}", "title": "" }, { "docid": "244289d343751197c9bf027b0a6c95f7", "score": "0.44099998", "text": "func (m *TargetUser) CompleteSubscription(status string) error {\n\n\tTargetUser, _ := app.Mapper.GetModel(&TargetUser{})\n\tm.SetStatus(status)\n\tif status == core.StatusCompleted {\n\t\tm.Completed = true\n\t}\n\n\tendDate, _ := time.Parse(core.MXTimeFormat, time.Now().Format(core.MXTimeFormat))\n\tm.EndDate = endDate\n\n\terr := TargetUser.Update(m)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c2e4f86ed04eaccf4c24f8dc23172e8e", "score": "0.43991145", "text": "func (s *CanaryRunTimeline) SetCompleted(v time.Time) *CanaryRunTimeline {\n\ts.Completed = &v\n\treturn s\n}", "title": "" }, { "docid": "0e2271a232990a81554e8c497c46d27b", "score": "0.43909666", "text": "func (o *PostPurchasesParams) WithCost(cost *string) *PostPurchasesParams {\n\to.SetCost(cost)\n\treturn o\n}", "title": "" }, { "docid": "fbf22fbebc0b8c12ac6608ee94fb6b2e", "score": "0.43867195", "text": "func (s *Store) AddPurchased(userID, itemID uint64, date int64) error {\n\tedge := purchased{\n\t\tFrom: fmt.Sprintf(\"%s/%d\", usersCollection, userID),\n\t\tTo: fmt.Sprintf(\"%s/%d\", itemsCollection, itemID),\n\t\tCreatedAt: date,\n\t}\n\treturn s.createEdge(edge, s.PurchasedEdge)\n}", "title": "" }, { "docid": "b595eacba700c2e9d6b8c447996ff99a", "score": "0.43780625", "text": "func (s *Stat) SetCompleted(success bool) {\n\ts.EndTime = time.Now()\n\ts.Duration = time.Since(s.StartTime)\n\ts.Success = success\n}", "title": "" }, { "docid": "538b03adea1a5ab15539e4d9c42b6eab", "score": "0.4368593", "text": "func (rb *ByProjectKeyMePaymentsKeyByKeyRequestBuilder) Post(body MyPaymentUpdate) *ByProjectKeyMePaymentsKeyByKeyRequestMethodPost {\n\treturn &ByProjectKeyMePaymentsKeyByKeyRequestMethodPost{\n\t\tbody: body,\n\t\turl: fmt.Sprintf(\"/%s/me/payments/key=%s\", rb.projectKey, rb.key),\n\t\tclient: rb.client,\n\t}\n}", "title": "" }, { "docid": "671c13012b82ac8056b2501e32175876", "score": "0.43618175", "text": "func (c billing) ExecutePostSale(sale *model.Sale) error {\n\tif sale.TotalAmount == 0 || sale.TotalAmount < 0 {\n\t\treturn errors.New(\"Invalid amounts\")\n\t}\n\tif sale.Status != model.FINISH {\n\t\treturn errors.New(\"Invalid status\")\n\t}\n\n\tfmt.Println(\"Billing....\")\n\tsale.ID = 123\n\tfmt.Println(\"Billed!\")\n\treturn nil\n}", "title": "" }, { "docid": "58c13baf95b1cee5da535457f3f9996d", "score": "0.43575567", "text": "func (d *Details) CompleteTask(){\n\td.IsComplete=true\n}", "title": "" }, { "docid": "b7df146756ffb001412a9cf2bfa848d1", "score": "0.4357002", "text": "func CreateCompletedContractData(db *db.DB) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Header.Get(\"Content-type\") == \"application/json\" {\n\t\t\tsession, err := db.Store.Get(r, \"session\")\n\t\t\tif err != nil {\n\t\t\t\trespondError(w, http.StatusInternalServerError, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif session.Values[\"auth\"] != true {\n\t\t\t\trespondError(w, http.StatusUnauthorized, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tnewCompletedData := &models.Completed{}\n\n\t\t\tif err = json.NewDecoder(r.Body).Decode(newCompletedData); err != nil {\n\t\t\t\trespondError(w, http.StatusBadRequest, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tif err := db.Grm.Debug().\n\t\t\t\tTable(\"completed\").\n\t\t\t\tCreate(&newCompletedData).\n\t\t\t\tError; err != nil {\n\t\t\t\trespondError(w, http.StatusInternalServerError, err.Error())\n\t\t\t\treturn\n\t\t\t}\n\t\t\trespondJSON(w, http.StatusOK, nil)\n\t\t} else {\n\t\t\trespondError(w, http.StatusBadRequest, \"Invalid content type\")\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d34ef64df474e9e849a0460f53d9c56f", "score": "0.43560374", "text": "func OrderFinishPOST(c *gin.Context) {\n\tc.Request.ParseForm()\n\torder := db.AuditLogOrder{\n\t\tID: web.GetTarget(c),\n\t\tTime: time.Now().Format(\"2006-01-02 15:04:05\"),\n\t\tUser: auth.GetLogin(c),\n\t\tItems: web.OrderItemsGet(c),\n\t\tProject: db.Project{Number: c.PostForm(\"Project.Number\"), Name: c.PostForm(\"Project.Name\"), ShippingAddress: c.PostForm(\"Project.ShippingAddress\"), DeliveryLocation: c.PostForm(\"Project.DeliveryLocation\"), Foreman: db.Foreman{Name: c.PostForm(\"Foreman.Name\"), Contact: db.Contact{Email: c.PostForm(\"Foreman.Contact.Email\"), Phone: c.PostForm(\"Foreman.Contact.Phone\"), Other: \"\"}}},\n\t\tPackagingMethod: c.PostForm(\"PackagingMethod\"),\n\t\tPurchasingAgent: db.PurchasingAgent{Name: c.PostForm(\"PurchasingAgent.Name\"), Contact: db.Contact{Email: c.PostForm(\"PurchasingAgent.Contact.Email\"), Phone: c.PostForm(\"PurchasingAgent.Contact.Phone\"), Other: \"\"}},\n\t\tPrefabDirector: db.PrefabDirector{Name: c.PostForm(\"PrefabDirector.Name\"), Contact: db.Contact{Email: c.PostForm(\"PrefabDirector.Contact.Email\"), Phone: c.PostForm(\"PrefabDirector.Contact.Phone\"), Other: \"\"}},\n\t\tDeliveryReceiver: db.DeliveryReceiver{\n\t\t\tName: c.PostForm(\"DeliveryReceiver.Name\"),\n\t\t\tContact: db.Contact{\n\t\t\t\tEmail: c.PostForm(\"DeliveryReceiver.Contact.Email\"),\n\t\t\t\tPhone: c.PostForm(\"DeliveryReceiver.Contact.Phone\"),\n\t\t\t\tOther: \"\",\n\t\t\t},\n\t\t},\n\t\tLaborTaskCode: c.PostForm(\"LaborTaskCode\"),\n\t\tNotes: c.PostForm(\"Notes\"),\n\t}\n\tif err := db.AuditLog(order); err != nil {\n\t\torder.Time = \"[Generated upon submission]\"\n\t\tc.HTML(http.StatusOK, \"order.tmpl\", &orderData{HeaderData: orderHeader, UserMode: db.UserGet(auth.GetLogin(c)).Mode, Order: order, Message: err.Error(), New: true})\n\t\treturn\n\t}\n\temails := []string{c.PostForm(\"Foreman.Contact.Email\"), c.PostForm(\"PurchasingAgent.Contact.Email\"), c.PostForm(\"PrefabDirector.Contact.Email\"), c.PostForm(\"DeliveryReceiver.Contact.Email\")}\n\tmail.Send(emails, web.GetTarget(c))\n\tc.Redirect(http.StatusSeeOther, \"/order/\"+order.ID)\n\treturn\n}", "title": "" }, { "docid": "b5f47886a4bcecc7d9b5df42be82134f", "score": "0.43520486", "text": "func WithCompleteParams(addr string, client *httpclient.HTTPClient) Option {\n\treturn func(d *Deployment) {\n\t\td.addr = addr\n\t\td.client = client\n\t}\n}", "title": "" }, { "docid": "baed8536cb9242a1c8ef28f5f9a7d113", "score": "0.4350659", "text": "func (d NotificationLogger) BtCompleted(GID []argo.GID) {\n\td.Logger.Printf(\"bt %s completed.\\n\", GID)\n}", "title": "" }, { "docid": "98c5077f4f3d19161f93e78bbafe2329", "score": "0.4328592", "text": "func (o *PostPurchasesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1c823ce3e2612c715d2dd6b398290d23", "score": "0.4328344", "text": "func Completed(v bool) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCompleted), v))\n\t})\n}", "title": "" }, { "docid": "855aec54e0a15573b628d7d38be265ba", "score": "0.4322131", "text": "func (h *Contract) PostPaymentAct(w http.ResponseWriter, r *http.Request) {\n\t// Initial response handler\n\tvar res response.OrderPaymentResponse\n\n\t// Binding request\n\treq := request.OrderPaymentReq{}\n\tif err := h.Bind(r, &req); err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\t// Validate request of struct request\n\tif err := h.Validator.Driver.Struct(req); err != nil {\n\t\th.SendRequestValidationError(w, err.(validator.ValidationErrors))\n\t\treturn\n\t}\n\n\t// Check db context\n\tctx := context.Background()\n\tdb, err := h.DB.Acquire(ctx)\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\treturn\n\t}\n\tdefer db.Release()\n\n\t// Model db transaction\n\tm := model.Contract{App: h.App}\n\ttx, err := db.Begin(ctx)\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\treturn\n\t}\n\n\t// Check paid by order\n\tmemberCode := h.GetUserCode(r.Context())\n\tmember, _ := m.GetMemberByCode(db, ctx, memberCode)\n\tif member.ID == 0 {\n\t\th.SendNotfound(w, fmt.Sprintf(\"Member %s not found.\", memberCode))\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\t// Check order data exist\n\torderExist, _ := m.GetOrderByOrderCode(db, ctx, req.OrderCode)\n\tif orderExist.ID == 0 {\n\t\th.SendNotfound(w, fmt.Sprintf(\"Order %s not found.\", req.OrderCode))\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\t// Check paid by order by request auth\n\tif member.ID != orderExist.PaidBy {\n\t\th.SendNotfound(w, fmt.Sprintf(\"Order paid by %s is invalid.\", memberCode))\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\t// Create order payment default set expired date\n\torderPaymentSetter := model.OrderPaymentEnt{\n\t\tOrderID: orderExist.ID,\n\t\tAmount: int64(req.Amount),\n\t\tPaymentStatus: model.PAYMENT_STATUS_PROCESS,\n\t}\n\n\t// Update url snap url midtrans\n\tpaymentService := payment.New(h.App)\n\torderCode := orderExist.OrderCode\n\torderAmount := int64(req.Amount)\n\tparamMidtrans := paymentService.SetMidtransParam(member.Email, member.Name, orderCode, orderAmount)\n\tmidtransResponse, err := paymentService.GetMidtransPaymentURL(paramMidtrans)\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\tif midtransResponse[\"redirect_url\"] == \"\" {\n\t\th.SendBadRequest(w, \"failed to get snap url midtrans.\")\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\torderPaymentSetter.PaymentURL = midtransResponse[\"redirect_url\"]\n\n\t// Check order payment exist then saved, if exist = renew payment\n\torderPaymentSaved := model.OrderPaymentEnt{}\n\torderPayment, _ := m.GetPaymentOrderByOrderID(db, ctx, orderExist.ID)\n\tif orderPayment.ID != 0 {\n\t\torderPaymentSetter.PaymentType = orderPayment.PaymentType\n\t\torderPaymentSetter.ExpiredDate = orderPayment.ExpiredDate\n\t\torderPaymentSetter.Payloads = orderPayment.Payloads\n\t\torderPaymentSaved, err = m.UpdateOrderPayment(tx, ctx, orderPaymentSetter, orderExist.ID)\n\t\tif err != nil {\n\t\t\th.SendBadRequest(w, err.Error())\n\t\t\ttx.Rollback(ctx)\n\t\t\treturn\n\t\t}\n\t\torderPaymentSaved.CreatedDate = orderPayment.CreatedDate\n\t\torderPaymentSaved.ExpiredDate = orderPayment.ExpiredDate\n\t} else {\n\t\torderPaymentSaved, err = m.AddOrderPayment(db, ctx, tx, orderPaymentSetter)\n\t\tif err != nil {\n\t\t\th.SendBadRequest(w, err.Error())\n\t\t\ttx.Rollback(ctx)\n\t\t\treturn\n\t\t}\n\t}\n\torderPaymentSaved.OrderCode = orderExist.OrderCode\n\n\t// Activity user logging in process\n\tlog := model.LogActivityUserEnt{\n\t\tUserID: int64(member.ID),\n\t\tRole: h.GetUserRole(r.Context()),\n\t\tTitle: \"Update Order\",\n\t\tActivity: fmt.Sprintf(\"Update Order Payment Trip Itin For %s\", member.Name),\n\t\tEventType: r.Method,\n\t}\n\t_, err = m.AddLogActivity(tx, ctx, log)\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\t// Send Notifications - To User (Admin, TC)\n\tuserPlayers, err := m.GetListPlayerByUserCodeAndRole(db, ctx, \"\", \"\")\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\tnotifContentUser := model.NotificationContent{\n\t\tSubject: model.NOTIF_SUBJ_ORDER_HISTORY,\n\t\tTripName: orderExist.MemberItin.Title,\n\t\tStatusPayment: model.PAYMENT_STATUS_PROCESS_METHOD_DESC,\n\t}\n\t_, err = m.SendNotifications(tx, db, ctx, userPlayers, notifContentUser)\n\tif err != nil {\n\t\th.SendBadRequest(w, psql.ParseErr(err))\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\t// Commit transaction\n\terr = tx.Commit(ctx)\n\tif err != nil {\n\t\th.SendBadRequest(w, err.Error())\n\t\ttx.Rollback(ctx)\n\t\treturn\n\t}\n\n\th.SendSuccess(w, res.Transform(orderPaymentSaved), nil)\n}", "title": "" }, { "docid": "05acb44d7830f7b221e02bfe99619138", "score": "0.43125322", "text": "func (o *InlineResponse20089SearchResultTasks) HasCompleted() bool {\n\tif o != nil && o.Completed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0dfbdb7508c98535b0ecc6c9f485193d", "score": "0.43077892", "text": "func (j *Job) SetCompleted(c bool) {\n\tj.completedLock.Lock()\n\tdefer j.completedLock.Unlock()\n\tj.completed = c\n}", "title": "" }, { "docid": "94e782bcadce5d8656172efdcd24dc4b", "score": "0.42635298", "text": "func (t *task) registerCompletedStageFinished(bq *InMemoryBuildQueue) {\n\tt.platformQueue.tasksCompletedDurationSeconds.Observe(bq.now.Sub(t.currentStageStartTime).Seconds())\n\tt.currentStageStartTime = bq.now\n}", "title": "" }, { "docid": "d74ecc87530c164917834199c3251b9b", "score": "0.42549208", "text": "func (service SubscriptionsService) Postpone(uuid string, dt time.Time, bulk bool) (*Response, Subscription, error) {\n\taction := fmt.Sprintf(\"subscriptions/%s/postpone\", uuid)\n\treq, err := service.client.newRequest(\"PUT\", action, Params{\n\t\t\"bulk\": bulk,\n\t\t\"next_renewal_date\": dt.Format(time.RFC3339),\n\t}, nil)\n\tif err != nil {\n\t\treturn nil, Subscription{}, err\n\t}\n\n\tvar dest Subscription\n\tres, err := service.client.do(req, &dest)\n\n\treturn res, dest, err\n}", "title": "" }, { "docid": "ab8dcaa2cbd492764856a32121ce8920", "score": "0.42497936", "text": "func (h *Hook) AfterDeliverTx(ctx sdk.Context, req abci.RequestDeliverTx, res abci.ResponseDeliverTx) {\n}", "title": "" }, { "docid": "92faff7375f476939d4dcaee7cb3df67", "score": "0.4249121", "text": "func (s *PolicyGeneration) SetCompletedOn(v time.Time) *PolicyGeneration {\n\ts.CompletedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "01b49ba680b6d82534c1a4974fd29f72", "score": "0.42387024", "text": "func (k Keeper) AppendTimedoutPurchaseOrder(\r\n\tctx sdk.Context,\r\n\ttimedoutPurchaseOrder types.TimedoutPurchaseOrder,\r\n) uint64 {\r\n\t// Create the timedoutPurchaseOrder\r\n\tcount := k.GetTimedoutPurchaseOrderCount(ctx)\r\n\r\n\t// Set the ID of the appended value\r\n\ttimedoutPurchaseOrder.Id = count\r\n\r\n\tstore := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.TimedoutPurchaseOrderKey))\r\n\tappendedValue := k.cdc.MustMarshalBinaryBare(&timedoutPurchaseOrder)\r\n\tstore.Set(GetTimedoutPurchaseOrderIDBytes(timedoutPurchaseOrder.Id), appendedValue)\r\n\r\n\t// Update timedoutPurchaseOrder count\r\n\tk.SetTimedoutPurchaseOrderCount(ctx, count+1)\r\n\r\n\treturn count\r\n}", "title": "" }, { "docid": "53c7525ba978cd9723ae44a4c623adcf", "score": "0.4225067", "text": "func TestTestUpdatePurchaseInvoiceStatusFinished(t *testing.T) {\n\n\tuser := model.DummyUserPriviledgeWithUsergroup(1)\n\tsd, _ := auth.Login(user)\n\ttoken := \"Bearer \" + sd.Token\n\n\tpo := model.DummyPurchaseOrder()\n\tpo.InvoiceStatus = \"finished\"\n\tpo.IsDeleted = 0\n\tpo.TotalCharge = 5000\n\tpo.Save()\n\n\tpi := model.DummyPurchaseInvoice()\n\tpi.TotalAmount = 1000\n\tpi.PurchaseOrder = po\n\tpi.IsDeleted = 0\n\tpi.Save()\n\n\tpi2 := model.DummyPurchaseInvoice()\n\tpi2.TotalAmount = 1000\n\tpi2.PurchaseOrder = po\n\tpi2.IsDeleted = 0\n\tpi2.Save()\n\n\tid := common.Encrypt(pi.ID)\n\n\tvar update = []struct {\n\t\treq tester.D\n\t\texpected int\n\t}{\n\t\t{tester.D{\"recognition_date\": time.Now(),\n\t\t\t\"total_amount\": 3000,\n\t\t\t\"note\": \"AHAHAHA\"}, http.StatusUnprocessableEntity},\n\t}\n\tng := tester.New()\n\tfor _, tes := range update {\n\t\tng.SetHeader(tester.H{\"Authorization\": token})\n\t\tng.PUT(\"/v1/purchase-invoice/\"+id).\n\t\t\tSetJSON(tes.req).\n\t\t\tRun(test.Router(), func(res tester.HTTPResponse, req tester.HTTPRequest) {\n\t\t\t\tassert.Equal(t, tes.expected, res.Code, fmt.Sprintf(\"\\nreason: Validation Not Matched,\\ndata: %v , \\nresponse: %v\", tes.req, res.Body.String()))\n\t\t\t})\n\t}\n}", "title": "" }, { "docid": "4cebb95a8c0f2602e9eb833398f1d69a", "score": "0.42152637", "text": "func DoPurchase(c nessie.Client, account nessie.Account, merchant nessie.Merchant){\n\tpurchaseData := []byte(` {\n\t \"merchant_id\": \"`+merchant.Id+`\",\n\t \"medium\": \"balance\",\n\t \"purchase_date\": \"2017-07-31\",\n\t \"amount\": 4.55,\n\t \"description\": \"`+merchant.Name+`\"\n\t}`)\n\tfmt.Println(\"Creating Purchase for \" + account.Nickname + \" with details...\")\n\tfmt.Println(string(purchaseData))\n\tstatus := c.CreatePurchase(account.Id, purchaseData)\n\tfmt.Println(\" Created Purchase? \", status)\n\tfmt.Println()\n}", "title": "" }, { "docid": "c3041a3a0a03d09d9b475162cdd27ee4", "score": "0.42059553", "text": "func (o *MicrosoftGraphFollowupFlag) SetCompletedDateTime(v AnyOfmicrosoftGraphDateTimeTimeZone) {\n\to.CompletedDateTime = &v\n}", "title": "" }, { "docid": "5f3e62991915f513378634b978962b75", "score": "0.41859454", "text": "func (policy *ParaPolicy) OnAddBlockFinish(block *types.BlockDetail) {\n}", "title": "" }, { "docid": "423ecb79ec622e8be44578826d521f6b", "score": "0.41575715", "text": "func taskCompleted(ctx context.Context, client *cloudtasks.Client, task *taskspb.Task, taskId string) error {\n\terr := ackTask(ctx, client, task)\n\tif err != nil {\n\t\tfmt.Printf(\"\\t[%v] Failed to acknowledge task.\\n\", taskId)\n\n\t\treturn err\n\t}\n\n\tfmt.Printf(\"\\t[%v] Task acknowledged.\\n\", taskId)\n\n\treturn nil\n}", "title": "" }, { "docid": "1d83a852b312cb115a5f097a2f4bf278", "score": "0.41555437", "text": "func (p Payment) finished() bool {\n\treturn p.SentAt != nil || now().Sub(p.CreatedAt) > config.AllowedDuration\n}", "title": "" }, { "docid": "90f91c3801a9c6edd1ddd62d3f47f000", "score": "0.41538882", "text": "func (m *OutlookTask) SetCompletedDateTime(value DateTimeTimeZoneable)() {\n err := m.GetBackingStore().Set(\"completedDateTime\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a1c67c130f6233cdaaa3e23d2a3c00f6", "score": "0.41531575", "text": "func (m *DataPolicyOperation) SetCompletedDateTime(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)() {\n m.completedDateTime = value\n}", "title": "" }, { "docid": "5d1d39619da8de2d6d96709d0234cc4e", "score": "0.41526926", "text": "func (s *Service) BeaconBlockProposalCompleted(started time.Time, result string) {}", "title": "" }, { "docid": "1bc2e64f7f294684913d2a23de82982a", "score": "0.41506937", "text": "func (m *ItemItemsItemWorkbookFunctionsBinom_InvPostRequestBody) SetTrials(value iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Jsonable)() {\n err := m.GetBackingStore().Set(\"trials\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "d21af379e939de5a5c1a4f0d6b337924", "score": "0.4149577", "text": "func (transaction *Transaction) Complete() error {\n\ttransaction.Status = TransactionCompleted\n\ttransaction.UpdatedAt = time.Now()\n\terr := transaction.isValid()\n\treturn err\n}", "title": "" }, { "docid": "6a2f3df2989b63a4eb71de562a27863c", "score": "0.41466147", "text": "func (n *OpenBazaarNode) CompleteOrder(orderID models.OrderID, ratings []models.Rating, includeIDInRating bool, done chan struct{}) error {\n\tvar (\n\t\torder models.Order\n\t\tprofile *models.Profile\n\t\terr error\n\t)\n\terr = n.repo.DB().View(func(tx database.Tx) error {\n\t\tprofile, err = tx.GetProfile()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn tx.Read().Where(\"id = ?\", orderID.String()).Find(&order).Error\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !order.CanComplete() {\n\t\treturn fmt.Errorf(\"%w: order is not in a state where it can be completed\", coreiface.ErrBadRequest)\n\t}\n\n\torderOpen, err := order.OrderOpenMessage()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfulfillments, err := order.OrderFulfillmentMessages()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbuyer, err := order.Buyer()\n\tif err != nil {\n\t\treturn err\n\t}\n\tvendor, err := order.Vendor()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tratingSignatures, err := order.RatingSignaturesMessage()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(ratings) != len(orderOpen.Items) {\n\t\treturn errors.New(\"number of ratings does not equal number of items in the order\")\n\t}\n\n\tif len(ratingSignatures.Sigs) != len(orderOpen.Items) {\n\t\treturn errors.New(\"missing rating signatures from vendor needed to build rating\")\n\t}\n\n\tchaincode, err := hex.DecodeString(orderOpen.Payment.Chaincode)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tratingKeys, err := utils.GenerateRatingPrivateKeys(n.ratingMasterKey, len(orderOpen.Items), chaincode)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcompleteMsg := &pb.OrderComplete{\n\t\tTimestamp: ptypes.TimestampNow(),\n\t}\n\n\tfor i, rating := range ratings {\n\t\tratingPB := &pb.Rating{\n\t\t\tTimestamp: ptypes.TimestampNow(),\n\n\t\t\tVendorSig: ratingSignatures.Sigs[i],\n\t\t\tVendorID: orderOpen.Listings[0].Listing.VendorID,\n\n\t\t\tOverall: uint32(rating.Overall),\n\t\t\tQuality: uint32(rating.Quality),\n\t\t\tCustomerService: uint32(rating.CustomerService),\n\t\t\tDescription: uint32(rating.Description),\n\t\t\tDeliverySpeed: uint32(rating.DeliverySpeed),\n\t\t\tReview: rating.Review,\n\t\t}\n\n\t\tif includeIDInRating {\n\t\t\tidentityPubkey, err := crypto.MarshalPublicKey(n.ipfsNode.PrivateKey.GetPublic())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tidHash := sha256.Sum256([]byte(n.Identity().Pretty()))\n\t\t\tsig, err := n.escrowMasterKey.Sign(idHash[:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tratingPB.BuyerName = profile.Name\n\t\t\tratingPB.BuyerID = &pb.ID{\n\t\t\t\tPeerID: n.Identity().Pretty(),\n\t\t\t\tPubkeys: &pb.ID_Pubkeys{\n\t\t\t\t\tIdentity: identityPubkey,\n\t\t\t\t\tEscrow: n.escrowMasterKey.PubKey().SerializeCompressed(),\n\t\t\t\t},\n\t\t\t\tHandle: profile.Handle,\n\t\t\t\tSig: sig.Serialize(),\n\t\t\t}\n\n\t\t\tratingSigHash := sha256.Sum256(ratingPB.VendorSig.RatingKey)\n\t\t\tbuyerSig, err := n.ipfsNode.PrivateKey.Sign(ratingSigHash[:])\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tratingPB.BuyerSig = buyerSig\n\t\t}\n\n\t\tser, err := proto.Marshal(ratingPB)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thashed := sha256.Sum256(ser)\n\n\t\tratingSig, err := ratingKeys[i].Sign(hashed[:])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tratingPB.RatingSignature = ratingSig.Serialize()\n\n\t\tcompleteMsg.Ratings = append(completeMsg.Ratings, ratingPB)\n\t}\n\n\tif orderOpen.Payment.Method == pb.OrderOpen_Payment_MODERATED {\n\t\twallet, err := n.multiwallet.WalletForCurrencyCode(orderOpen.Payment.Coin)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trelease, err := n.buildEscrowRelease(&order, wallet,\n\t\t\tiwallet.NewAddress(fulfillments[0].ReleaseInfo.ToAddress, iwallet.CoinType(orderOpen.Payment.Coin)),\n\t\t\tiwallet.NewAmount(fulfillments[0].ReleaseInfo.TransactionFee))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcompleteMsg.ReleaseInfo = release\n\t}\n\n\treturn n.repo.DB().Update(func(tx database.Tx) error {\n\t\tcompleteAny, err := ptypes.MarshalAny(completeMsg)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tm := &npb.OrderMessage{\n\t\t\tOrderID: order.ID.String(),\n\t\t\tMessageType: npb.OrderMessage_ORDER_COMPLETE,\n\t\t\tMessage: completeAny,\n\t\t}\n\n\t\tif err := utils.SignOrderMessage(m, n.ipfsNode.PrivateKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tpayload, err := ptypes.MarshalAny(m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tmessage := newMessageWithID()\n\t\tmessage.MessageType = npb.Message_ORDER\n\t\tmessage.Payload = payload\n\n\t\t_, err = n.orderProcessor.ProcessMessage(tx, buyer, m)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn n.messenger.ReliablySendMessage(tx, vendor, message, done)\n\t})\n}", "title": "" }, { "docid": "83fd4a1a0a208b6887a4fd87c3844cdf", "score": "0.4142526", "text": "func (_Augur *AugurTransactor) LogCompleteSetsPurchased(opts *bind.TransactOpts, _universe common.Address, _market common.Address, _account common.Address, _numCompleteSets *big.Int) (*types.Transaction, error) {\n\treturn _Augur.contract.Transact(opts, \"logCompleteSetsPurchased\", _universe, _market, _account, _numCompleteSets)\n}", "title": "" }, { "docid": "3f0ad00cfdf7e357d6b756a011940e62", "score": "0.41396815", "text": "func CompletedEQ(v bool) predicate.Order {\n\treturn predicate.Order(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCompleted), v))\n\t})\n}", "title": "" }, { "docid": "0cbf0bad0b954e85edabfd02c54fb98d", "score": "0.41274598", "text": "func (o *PostServiceDetailsParams) WithState(state *string) *PostServiceDetailsParams {\n\to.SetState(state)\n\treturn o\n}", "title": "" }, { "docid": "ba9c0d1b02db6cfde1aaacb0e5aa7195", "score": "0.4120226", "text": "func (t *Task) Complete() {\n\tcurrTime := time.Now()\n\tt.Completed = true\n\tt.CompletedAt = &currTime\n}", "title": "" }, { "docid": "645e57bcbe57e2789aa482e885aae9d7", "score": "0.4104914", "text": "func (m *SubscribedSkusRequestBuilder) Post(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.SubscribedSkuable, requestConfiguration *SubscribedSkusRequestBuilderPostRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.SubscribedSkuable, error) {\n requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateSubscribedSkuFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.SubscribedSkuable), nil\n}", "title": "" }, { "docid": "1ce8c23a27cbaee3d608eb7aafe2e377", "score": "0.41014466", "text": "func (o *DepositDetail) UnsetCompleted() {\n\to.Completed.Unset()\n}", "title": "" }, { "docid": "f82c6bd9e678172d8145713d946e2980", "score": "0.40883568", "text": "func (s *Service) BeaconCommitteeSubscriptionCompleted(started time.Time, result string) {}", "title": "" }, { "docid": "7b827915fe614f81189610a1c1034033", "score": "0.40790528", "text": "func registerTaskFinished(w http.ResponseWriter, r *http.Request) {\n if r.Method == http.MethodPost {\n values, err := url.ParseQuery(r.URL.RawQuery)\n if err != nil {\n fmt.Fprint(w, err)\n return\n }\n if len(values.Get(\"id\")) == 0 {\n w.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(w, \"Wrong input\")\n return\n }\n\n // Register task as finished in database here\n response, err := http.Post(\"http://\" + databaseLocation + \"/finishTask?id=\" + values.Get(\"id\"), \"test/plain\", nil)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(w, \"Error:\", err)\n return\n }\n\n _, err = io.Copy(w, response.Body)\n if err != nil {\n w.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(w, \"Error:\", err)\n return\n }\n } else {\n w.WriteHeader(http.StatusBadRequest)\n fmt.Fprint(w, \"Error 🚫: Only POST accepted.\")\n }\n}", "title": "" }, { "docid": "05918dae3a4f5cfb89836d7ad3d86dce", "score": "0.4069081", "text": "func (a *ActivityContext) Completed(result interface{}) {\n res, _ := a.marshaler.Marshal(result)\n a.heartbeatTimer.Stop()\n defer a.recycle()\n for i := 0; ; i++ {\n if err := a.markCompletedRequest(string(res)); err != nil {\n if i > 10 {\n log.Panicf(\"Failed to mark activity as completed!: %v\", err)\n }\n log.Printf(\"Failed to mark activity as completed! Retrying.: %v\", err)\n time.Sleep(time.Duration(i * i) * 200 * time.Millisecond)\n continue\n }\n return\n }\n}", "title": "" }, { "docid": "ea383006cde7a1de7276c6432c3a1574", "score": "0.40662795", "text": "func (s *Shipment) Complete() error {\n\tif s.Status != ShipmentStatusDELIVERED {\n\t\treturn errors.Wrap(ErrInvalidTransition, \"Completed\")\n\t}\n\ts.Status = ShipmentStatusCOMPLETED\n\treturn nil\n}", "title": "" }, { "docid": "cbcd318e588054bb09f0962f03f35a13", "score": "0.4066262", "text": "func (p *PurchaseManager) purchase(height int64) {\n\terr := p.w.Unlock(p.passphrase, nil)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to purchase tickets this round: %v\", err)\n\t\treturn\n\t}\n\tpurchaseInfo, err := p.purchaser.Purchase(height)\n\tif err != nil {\n\t\tlog.Errorf(\"Failed to purchase tickets this round: %v\", err)\n\t\treturn\n\t}\n\t// Since we don't know if the wallet had been unlocked before we unlocked\n\t// it, avoid locking it here, even though we don't need it to remain\n\t// unlocked.\n\tlog.Debugf(\"Purchased %v tickets this round\", purchaseInfo.Purchased)\n}", "title": "" }, { "docid": "def5ef3ac7e5e2009ec779cf91f67538", "score": "0.40654275", "text": "func (sg *MailClient) SendPurchaseConfirmation(p *Purchase) error {\n\tproducts := p.ProductSels\n\tif len(products) == 0 {\n\t\treturn errors.New(\"empty products slice in purchase confirmation\")\n\t}\n\tsubj := fmt.Sprintf(\"Order confirmation: #%s\", p.DisplayID())\n\ttext := \"<html><body>\"\n\ttext += fmt.Sprintf(\"<p>Hi %s:</p>\", p.User.Name)\n\ttext += \"<p>Here's a quick order summary for your records. You bought:</p>\"\n\ttext += \"<ul>\"\n\tfor _, product := range products {\n\t\tprice := float64(product.Price) / 100\n\t\tvar size string\n\t\tif len(product.Size) > 0 {\n\t\t\tsize = fmt.Sprintf(\" (%s)\", product.Size)\n\t\t}\n\t\ttext += fmt.Sprintf(\"<li>%d @ $%.2f - %s%s</li>\", product.Count,\n\t\t\tprice, product.Name, size)\n\t}\n\ttext += \"</ul><table>\"\n\ttext += fmt.Sprintf(\"<tr><td>Subtotal: </td><td>$%.2f</td></tr>\",\n\t\tfloat64(p.Subtotal())/100)\n\ttext += fmt.Sprintf(\"<tr><td>Shipping: </td><td>$%.2f</td></tr>\",\n\t\tfloat64(p.Shipping)/100)\n\ttext += fmt.Sprintf(\"<tr><td>Tax: </td><td>$%.2f</td></tr>\",\n\t\tfloat64(p.Tax)/100)\n\ttext += \"<tr><td>My fee: </td><td>$0.00</td></tr>\"\n\ttext += fmt.Sprintf(\"<tr><td><b>Total: </b></td><td><b>$%.2f</b></td></tr>\",\n\t\tfloat64(p.Total)/100)\n\ttext += \"</table>\"\n\tdelivery := time.Now().Add(7 * 24 * time.Hour)\n\tdelS := delivery.Format(\"Monday Jan 2, 2006\")\n\ttext += fmt.Sprintf(\"<p>Expected delivery before %s. \", delS)\n\ttext += fmt.Sprintf(\"Your order confirmation number is %s.</p>\",\n\t\tp.DisplayID())\n\ttext += \"<p>Glad I could help! :)</p><p>- Ava</p>\"\n\ttext += \"</body></html>\"\n\treturn sg.Send(subj, text, p.User)\n}", "title": "" }, { "docid": "59bc5d163ff3ea74fc9f201c5fa135b2", "score": "0.4065312", "text": "func (o *PostPurchasesParams) WithPurchaseID(purchaseID *string) *PostPurchasesParams {\n\to.SetPurchaseID(purchaseID)\n\treturn o\n}", "title": "" }, { "docid": "d79d38332cca563641ff6b9062d64795", "score": "0.40619868", "text": "func (o *PostPurchasesParams) WithGroups(groups *string) *PostPurchasesParams {\n\to.SetGroups(groups)\n\treturn o\n}", "title": "" }, { "docid": "f3afb036c2cd79d2c656f2782c518fb8", "score": "0.40589908", "text": "func (t *DurableTransaction) setOnCompleteCallback() {\n\tif t.txn != nil {\n\t\tt.txn.val.Set(\n\t\t\t\"oncomplete\",\n\t\t\tjs.FuncOf(func(th js.Value, dats []js.Value) interface{} {\n\t\t\t\t// set txn to nil to indicate transaction complete\n\t\t\t\tt.txn = nil\n\t\t\t\treturn nil\n\t\t\t}),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "b8b046b69468c479e723568823a52117", "score": "0.4057795", "text": "func (_m *MockProcessor) complete(task *taskInfo) {\n\t_m.Called(task)\n}", "title": "" }, { "docid": "bb0107b3e22471bed68ff401c4807d3d", "score": "0.40531683", "text": "func (m *CompaniesItemPaymentTermsRequestBuilder) ToPostRequestInformation(ctx context.Context, body ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.PaymentTermable, requestConfiguration *CompaniesItemPaymentTermsRequestBuilderPostRequestConfiguration)(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {\n requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformation()\n requestInfo.UrlTemplate = m.BaseRequestBuilder.UrlTemplate\n requestInfo.PathParameters = m.BaseRequestBuilder.PathParameters\n requestInfo.Method = i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST\n requestInfo.Headers.Add(\"Accept\", \"application/json\")\n err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, \"application/json\", body)\n if err != nil {\n return nil, err\n }\n if requestConfiguration != nil {\n requestInfo.Headers.AddAll(requestConfiguration.Headers)\n requestInfo.AddRequestOptions(requestConfiguration.Options)\n }\n return requestInfo, nil\n}", "title": "" }, { "docid": "36a1fcc288d4303f2fd77cf5a99807f3", "score": "0.40529782", "text": "func NewPutCustomFieldPurchasesOK() *PutCustomFieldPurchasesOK {\n\treturn &PutCustomFieldPurchasesOK{}\n}", "title": "" }, { "docid": "b9f74fd89808b9b68518f806f1de1aa2", "score": "0.40471098", "text": "func (wc *Wepay) PostPay(c echo.Context) error {\n\treturn nil\n}", "title": "" }, { "docid": "483f010a164a80671bece6f7ad8037aa", "score": "0.4045135", "text": "func (n *Notifier) NotifyPurgeCompleted(ctx context.Context, luciProject string, operationID string, eta time.Time) error {\n\terr := prjpb.Send(ctx, luciProject, &prjpb.Event{\n\t\tEvent: &prjpb.Event_PurgeCompleted{\n\t\t\tPurgeCompleted: &prjpb.PurgeCompleted{\n\t\t\t\tOperationId: operationID,\n\t\t\t},\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn n.TaskRefs.Dispatch(ctx, luciProject, eta)\n}", "title": "" }, { "docid": "c82d20f5e086055610ec33758918ec67", "score": "0.40376043", "text": "func (o *PostPurchasesParams) WithLineEndDate(lineEndDate *string) *PostPurchasesParams {\n\to.SetLineEndDate(lineEndDate)\n\treturn o\n}", "title": "" }, { "docid": "31cec3025c7e8b8e3d52cd833cb953b2", "score": "0.4030313", "text": "func (o *SummaryColumnCardResponse) HasCompleted() bool {\n\tif o != nil && o.Completed != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "aaedcefbeee6a8a20dab0b5ea87ac3a6", "score": "0.4025402", "text": "func ToMatchingServiceRespondQueryTaskCompletedArgs(t *matching.MatchingService_RespondQueryTaskCompleted_Args) *types.MatchingServiceRespondQueryTaskCompletedArgs {\n\tif t == nil {\n\t\treturn nil\n\t}\n\treturn &types.MatchingServiceRespondQueryTaskCompletedArgs{\n\t\tRequest: ToMatchingRespondQueryTaskCompletedRequest(t.Request),\n\t}\n}", "title": "" }, { "docid": "1b7839ba658e370de63290c8584a211f", "score": "0.4024594", "text": "func (o *IncidentTodoAttributes) UnsetCompleted() {\n\to.Completed.Unset()\n}", "title": "" }, { "docid": "f675a986fdbb4ae8e3b020d069fd8135", "score": "0.4019151", "text": "func (e *Email) SendCompleteSubmission(ptrSubmission interface{}) error {\n\tvar (\n\t\tname string\n\t\tuniqueCode string\n\t\ttypeSubmission string\n\t\tisPaid bool = true\n\t)\n\n\tswitch v := ptrSubmission.(type) {\n\tcase *models.AktaKelahiran:\n\t\ttypeSubmission = \"Akta Kelahiran\"\n\t\tname = v.Nama\n\t\tuniqueCode = v.UniqueCode\n\tcase *models.KartuKeluarga:\n\t\ttypeSubmission = \"Kartu Keluarga\"\n\t\tname = v.Nama\n\t\tuniqueCode = v.UniqueCode\n\tcase *models.SuratKeterangan:\n\t\ttypeSubmission = fmt.Sprintf(\"Surat Keterangan %s\", v.Tipe)\n\t\tname = v.Nama\n\t\tuniqueCode = v.UniqueCode\n\t\tisPaid = v.IsPaid\n\tdefault:\n\t\tlog.Printf(\"Invalid type in SendCompleteSubmission: %s\", reflect.TypeOf(ptrSubmission))\n\t}\n\n\te.Subject = \"Pengajuan Berkas Anda Telah Selesai\"\n\te.Body = fmt.Sprintf(\"Pemberitahuan kepada %s dengan kode %s, bahwa pengajuan %s anda kini telah SELESAI! Silahkan mengunjungi kantor Desa Telukjambe untuk pengambilannya. \", name, uniqueCode, typeSubmission)\n\n\tif isPaid {\n\t\te.Body = e.Body + fmt.Sprintf(\"Layanan pengajuan anda dikenakan biaya sebesar 20.000 rupiah.\")\n\t} else {\n\t\te.Body = e.Body + fmt.Sprintf(\"Layanan pengajuan anda dikenakan biaya sebesar 0 rupiah.\")\n\t}\n\n\treturn e.Send()\n}", "title": "" }, { "docid": "8d7df7e876f1733532c60f603e24ad6c", "score": "0.4016845", "text": "func (_ScryProtocol *ScryProtocolTransactor) AdvancePurchase(opts *bind.TransactOpts, seqNo string, publishId string, startVerify bool) (*types.Transaction, error) {\n\treturn _ScryProtocol.contract.Transact(opts, \"advancePurchase\", seqNo, publishId, startVerify)\n}", "title": "" }, { "docid": "951f60b6a15dfbe47e8f3d51bdda77a5", "score": "0.40061748", "text": "func (t *Transaction) Done() {\n\tt.bucket.Forget(t.TransactionID)\n}", "title": "" }, { "docid": "aeeba5b1f92045d6c1e6589d665b7942", "score": "0.39993712", "text": "func (s *JobDetails) SetCompletedOn(v time.Time) *JobDetails {\n\ts.CompletedOn = &v\n\treturn s\n}", "title": "" }, { "docid": "edd79da46ab522eaca526cd1fd1711c1", "score": "0.39962447", "text": "func (mr *MockUseCaseMockRecorder) AddCompletedOrder(arg0, arg1, arg2 interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"AddCompletedOrder\", reflect.TypeOf((*MockUseCase)(nil).AddCompletedOrder), arg0, arg1, arg2)\n}", "title": "" }, { "docid": "ac4cf4ed97228cc4cbb387e3e75ef61d", "score": "0.39944232", "text": "func (handler *Handler) CompleteItem(w http.ResponseWriter, r *http.Request) {\n\tvars := mux.Vars(r)\n\tidAsString := vars[\"id\"]\n\tif len(idAsString) == 0 {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tid, _ := strconv.Atoi(idAsString)\n\titem, err := handler.service.CompleteItem(id)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\tw.Header().Add(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusOK)\n\tjson.NewEncoder(w).Encode(item)\n}", "title": "" } ]
f2d57b5563eb84f4607f3e962c08d8ce
GrantToken mocks base method.
[ { "docid": "d6d2d188e81c8f192ad838f29396f2a2", "score": "0.7331571", "text": "func (m *MockAuthorization) GrantToken(ktx kontext.Context, accessTokenReq entity.AccessTokenRequestJSON) (entity.OauthAccessTokenJSON, jsonapi.Errors) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GrantToken\", ktx, accessTokenReq)\n\tret0, _ := ret[0].(entity.OauthAccessTokenJSON)\n\tret1, _ := ret[1].(jsonapi.Errors)\n\treturn ret0, ret1\n}", "title": "" } ]
[ { "docid": "de22df824b7245a025fdc108b019b075", "score": "0.6700953", "text": "func (m *MockLease) Grant(arg0 context.Context, arg1 int64) (*clientv3.LeaseGrantResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Grant\", arg0, arg1)\n\tret0, _ := ret[0].(*clientv3.LeaseGrantResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cf6895d79b5f6c235a9ff26a4f61d798", "score": "0.6607204", "text": "func (m *MockSCMAPI) VendBaseToken(arg0 context.Context, arg1 *identityclient.Client) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VendBaseToken\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e214b1e06999d344e350ec5cee875365", "score": "0.6394104", "text": "func (_m *MockblockServerLocal) RefreshAuthToken(_param0 context.Context) {\n\t_m.ctrl.Call(_m, \"RefreshAuthToken\", _param0)\n}", "title": "" }, { "docid": "dd3fbe1206a808d554ba467afc13b846", "score": "0.63195866", "text": "func (_m *MockBlockServer) RefreshAuthToken(_param0 context.Context) {\n\t_m.ctrl.Call(_m, \"RefreshAuthToken\", _param0)\n}", "title": "" }, { "docid": "bdba67faa2a22f4d14785277e8e94e90", "score": "0.63117296", "text": "func (m *MockUserAuthRepository) RegisterToken(arg0, arg1 string) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RegisterToken\", arg0, arg1)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "92c64c3e2f75eb0892aabb78f03be4cc", "score": "0.62704927", "text": "func TestRefreshToken(t *testing.T) {\n\n\tConvey(\"Test internal method 'acquireEnvironment'\", t, func() {\n\t\tvar token string = \"sfsdfdsfdsfsdf\"\n\t\tConvey(\"test with mock http request\", func() {\n\t\t\t// do mock here\n\t\t\tpatches := ApplyMethod(reflect.TypeOf((*httpRequester)(nil)), \"Post\", func(_ *httpRequester, url string, _ interface{}, respData interface{}) error {\n\t\t\t\tbodyBytes := []byte(fmt.Sprintf(`{\"token\":\"%s\"}`, token))\n\t\t\t\tjson.Unmarshal(bodyBytes, respData)\n\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\tdefer patches.Reset()\n\n\t\t\tconf, err := NewConf(TestConfFile)\n\t\t\tSo(err, ShouldBeNil)\n\n\t\t\tconf.refreshToken(context.Background())\n\t\t\tSo(conf.Token, ShouldEqual, token)\n\t\t})\n\n\t})\n}", "title": "" }, { "docid": "6fb4a113caaad47ce8989169f9b53a73", "score": "0.62682533", "text": "func RefreshTokenGrantTest(t *testing.T, spec *Spec) {\n\t// invalid client secret\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: \"invalid\",\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.ValidRefreshToken,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_client\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid refresh token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.InvalidRefreshToken,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_request\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// unknown refresh token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.UnknownRefreshToken,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// expired refresh token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.ExpiredRefreshToken,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// wrong client\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.PublicClientID,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.ValidRefreshToken,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// exceeding scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\"refresh_token\": spec.ValidRefreshToken,\n\t\t\t\"scope\": spec.ExceedingScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// test refresh token\n\tRefreshTokenTest(t, spec, spec.ValidRefreshToken)\n}", "title": "" }, { "docid": "00089c268ab83a8d3b162269cfaef469", "score": "0.6248561", "text": "func (m *MockExternalAPI) getToken() error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"getToken\")\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e95de4ed1a7e50a67f511af90859e96d", "score": "0.6223782", "text": "func (_m *MockmdServerLocal) RefreshAuthToken(_param0 context.Context) {\n\t_m.ctrl.Call(_m, \"RefreshAuthToken\", _param0)\n}", "title": "" }, { "docid": "9abbff996be9eebaea1ecf6b43eafd97", "score": "0.617431", "text": "func (m *MockSCMAPI) VendTenantToken(arg0 context.Context, arg1 string) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VendTenantToken\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1231579fd8fca416e1e54090851b193f", "score": "0.6165584", "text": "func (m *MockRepository) WithToken(arg0 http.Handler) http.Handler {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"WithToken\", arg0)\n\tret0, _ := ret[0].(http.Handler)\n\treturn ret0\n}", "title": "" }, { "docid": "fd6dd03f13d9ffa5fdbdbe9db31dfefb", "score": "0.6115366", "text": "func (m *MockPlatformRepository) GetToken() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetToken\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "5d42bfa62d41a1be864d9eb4dc272db9", "score": "0.61057884", "text": "func (_m *MockMDServer) RefreshAuthToken(_param0 context.Context) {\n\t_m.ctrl.Call(_m, \"RefreshAuthToken\", _param0)\n}", "title": "" }, { "docid": "fcd8af64ee45e804e958465108d007a3", "score": "0.6073979", "text": "func (m *MockUserAuthRepository) RevokeToken(arg0 string) (int, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RevokeToken\", arg0)\n\tret0, _ := ret[0].(int)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c1a6fc6e8a9521c61e7902be83a315c9", "score": "0.6046079", "text": "func (m *MockUserAuthRepository) IssueToken(arg0, arg1 string) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"IssueToken\", arg0, arg1)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "c8107113dbd50b4adb84f9cda77132aa", "score": "0.6012153", "text": "func TestDoOauthToken01(t *testing.T) {\n\n\t// Start the db connection.\n\tdb, _ := models.NewDB()\n\tdefer db.Close()\n\n\t// Create controller\n\tc := &Controller{DB: db}\n\n\t// Create a test user.\n\tdb.Create(&models.User{FirstName: \"Spicer\", LastName: \"Matthews\", Email: \"spicer@cloudmanic.com\", Password: \"$2a$10$jP2rLOmWtIsMeQcCD..bye6kPADPwLMrz0aOaAPb/4Y4w68VYfJ2m\"})\n\n\t// Post data\n\tvar postStr = []byte(`{ \"username\": \"spicer@cloudmanic.com\", \"password\": \"foobar\", \"client_id\": \"Vm4YwgHM2bweuzYeZ\", \"grant_type\": \"password\" }`)\n\n\t// Make a mock request.\n\treq, _ := http.NewRequest(\"POST\", \"/oauth/token\", bytes.NewBuffer(postStr))\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Setup writer.\n\tw := httptest.NewRecorder()\n\tgin.SetMode(\"release\")\n\tgin.DisableConsoleColor()\n\tr := gin.New()\n\tr.POST(\"/oauth/token\", c.DoOauthToken)\n\tr.ServeHTTP(w, req)\n\n\t// Parse json that returned.\n\tst.Expect(t, len(gjson.Get(w.Body.String(), \"access_token\").String()), 50)\n\tst.Expect(t, gjson.Get(w.Body.String(), \"token_type\").String(), \"bearer\")\n\n\t// ------------- Test the login fails for the wrong password. ----------- //\n\n\t// Post data\n\tpostStr = []byte(`{ \"username\": \"spicer@cloudmanic.com\", \"password\": \"abc123\", \"client_id\": \"Vm4YwgHM2bweuzYeZ\", \"grant_type\": \"password\" }`)\n\n\t// Make a mock request.\n\treq2, _ := http.NewRequest(\"POST\", \"/oauth/token\", bytes.NewBuffer(postStr))\n\treq2.Header.Set(\"Accept\", \"application/json\")\n\n\t// Setup writer.\n\tw = httptest.NewRecorder()\n\tgin.SetMode(\"release\")\n\tgin.DisableConsoleColor()\n\tr = gin.New()\n\tr.POST(\"/oauth/token\", c.DoOauthToken)\n\tr.ServeHTTP(w, req2)\n\n\t// Parse json that returned.\n\tst.Expect(t, gjson.Get(w.Body.String(), \"error\").String(), \"Sorry, we could not find your account.\")\n}", "title": "" }, { "docid": "2e7629000cd96e547ba911163c639925", "score": "0.59692276", "text": "func TestDoOauthToken02(t *testing.T) {\n\n\t// Start the db connection.\n\tdb, _ := models.NewDB()\n\tdefer db.Close()\n\n\t// Create controller\n\tc := &Controller{DB: db}\n\n\t// Create a test user.\n\tdb.Create(&models.User{FirstName: \"Spicer\", LastName: \"Matthews\", Email: \"spicer@cloudmanic.com\", Password: \"$2a$10$jP2rLOmWtIsMeQcCD..bye6kPADPwLMrz0aOaAPb/4Y4w68VYfJ2m\"})\n\n\t// Post data\n\tvar postStr = []byte(`{ \"username\": \"spicer@cloudmanic.com\", \"password\": \"foobar\", \"client_id\": \"wrong-client-id\", \"grant_type\": \"password\" }`)\n\n\t// Make a mock request.\n\treq, _ := http.NewRequest(\"POST\", \"/login\", bytes.NewBuffer(postStr))\n\treq.Header.Set(\"Accept\", \"application/json\")\n\n\t// Setup writer.\n\tw := httptest.NewRecorder()\n\tgin.SetMode(\"release\")\n\tgin.DisableConsoleColor()\n\tr := gin.New()\n\tr.POST(\"/login\", c.DoOauthToken)\n\tr.ServeHTTP(w, req)\n\n\t// Parse json that returned.\n\tst.Expect(t, gjson.Get(w.Body.String(), \"error\").String(), \"Invalid client_id or grant type.\")\n\n\t// ------------- Test the login fails for the wrong grant_type. ----------- //\n\n\t// Post data\n\tpostStr = []byte(`{ \"username\": \"spicer@cloudmanic.com\", \"password\": \"abc123\", \"client_id\": \"Vm4YwgHM2bweuzYeZ\", \"grant_type\": \"authorization_code\" }`)\n\n\t// Make a mock request.\n\treq2, _ := http.NewRequest(\"POST\", \"/login\", bytes.NewBuffer(postStr))\n\treq2.Header.Set(\"Accept\", \"application/json\")\n\n\t// Setup writer.\n\tw = httptest.NewRecorder()\n\tgin.SetMode(\"release\")\n\tgin.DisableConsoleColor()\n\tr = gin.New()\n\tr.POST(\"/login\", c.DoOauthToken)\n\tr.ServeHTTP(w, req2)\n\n\t// Parse json that returned.\n\tst.Expect(t, gjson.Get(w.Body.String(), \"error\").String(), \"Invalid client_id or grant type.\")\n}", "title": "" }, { "docid": "7968fb013c348fbdefe918054714bde0", "score": "0.5933161", "text": "func (m *MockKvdb) GrantUserAccess(arg0 string, arg1 kvdb.PermissionType, arg2 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GrantUserAccess\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "d281232d63b987287894f1666ea60ca5", "score": "0.5931004", "text": "func (m *MockGithubInterface) RefreshToken(gitSource *model.GitSource, refreshToken string) (*common.Token, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshToken\", gitSource, refreshToken)\n\tret0, _ := ret[0].(*common.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "12b5f74094554b9eb02c7d3c71a6e1a5", "score": "0.5927269", "text": "func TestPollForAccessToken(t *testing.T) {\n}", "title": "" }, { "docid": "8a7d414cbc20ef7e6216a45065d938b1", "score": "0.5921472", "text": "func (m *MockTokenRepository) SetRefreshToken(arg0 context.Context, arg1, arg2 string, arg3 time.Duration) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"SetRefreshToken\", arg0, arg1, arg2, arg3)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "67073f4a55cf872818e3a2847dc0ee6e", "score": "0.5916805", "text": "func (m *MockUsersService) CheckToken(arg0 string) (service.ResCheckToken, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CheckToken\", arg0)\n\tret0, _ := ret[0].(service.ResCheckToken)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "19c546428cd2c713796c0e6fc1037387", "score": "0.5868405", "text": "func (m *MockTokenSource) Token() (*oauth2.Token, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Token\")\n\tret0, _ := ret[0].(*oauth2.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "e6454996049de5c3b2b42de1c66c5951", "score": "0.58518153", "text": "func (m *MockRepository) VerifyFirebaseToken(ctx context.Context, token string) (domain.Auth, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VerifyFirebaseToken\", ctx, token)\n\tret0, _ := ret[0].(domain.Auth)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "1f327e945d305d6f3012204e3e713430", "score": "0.58415633", "text": "func (m *MockAdmin) ParseToken(token string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ParseToken\", token)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e10287dc67b9dbe1f0b93d161f4733ec", "score": "0.5840688", "text": "func TestVerifyToken(t *testing.T) {\n\t// Init\n\tatExpires := time.Now().Add(time.Minute * 15).Unix()\n\taccess := entity.Access{\n\t\tUserID: 1,\n\t}\n\n\taToken, _ := generateAccessTokenString(access, atExpires)\n\n\treq, _ := http.NewRequest(\"GET\", \"localhost:8080/negativacao\", nil)\n\treq.Header.Add(\"Authorization\", \"Bearer \"+aToken)\n\n\t// Execution\n\t_, isValid := verifyToken(aToken)\n\n\t// Validation\n\tif isValid != nil {\n\t\tt.Error(\"token signing invalido\")\n\t}\n}", "title": "" }, { "docid": "c3723739f84fe6aac971df86ab20bdb5", "score": "0.5839415", "text": "func (_m *MockauthTokenRefreshHandler) RefreshAuthToken(_param0 context.Context) {\n\t_m.ctrl.Call(_m, \"RefreshAuthToken\", _param0)\n}", "title": "" }, { "docid": "baae3e9795fd380d1cbae506fc94deb6", "score": "0.5834656", "text": "func PasswordGrantTest(t *testing.T, spec *Spec) {\n\t// invalid client secret\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: \"invalid\",\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": spec.ResourceOwnerUsername,\n\t\t\t\"password\": spec.ResourceOwnerPassword,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_client\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid username\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": \"invalid\",\n\t\t\t\"password\": spec.ResourceOwnerPassword,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusForbidden, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid password\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": spec.ResourceOwnerUsername,\n\t\t\t\"password\": \"invalid\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusForbidden, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": spec.ResourceOwnerUsername,\n\t\t\t\"password\": spec.ResourceOwnerPassword,\n\t\t\t\"scope\": spec.InvalidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// exceeding scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": spec.ResourceOwnerUsername,\n\t\t\t\"password\": spec.ResourceOwnerPassword,\n\t\t\t\"scope\": spec.ExceedingScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\tvar accessToken, refreshToken string\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"password\",\n\t\t\t\"username\": spec.ResourceOwnerUsername,\n\t\t\t\"password\": spec.ResourceOwnerPassword,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusOK, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"bearer\", jsonFieldString(r, \"token_type\"), debug(r))\n\t\t\tassert.Equal(t, spec.ValidScope, jsonFieldString(r, \"scope\"), debug(r))\n\t\t\tassert.Equal(t, float64(spec.ExpectedExpiresIn), jsonFieldFloat(r, \"expires_in\"), debug(r))\n\n\t\t\taccessToken = jsonFieldString(r, \"access_token\")\n\t\t\tassert.NotEmpty(t, accessToken, debug(r))\n\n\t\t\trefreshToken = jsonFieldString(r, \"refresh_token\")\n\t\t\tassert.NotEmpty(t, refreshToken, debug(r))\n\t\t},\n\t})\n\n\t// test access token\n\tAccessTokenTest(t, spec, accessToken)\n\n\t// test refresh token if present\n\tif refreshToken != \"\" {\n\t\tRefreshTokenTest(t, spec, refreshToken)\n\t}\n}", "title": "" }, { "docid": "7e204af22b7d5c70ed2e914d6c3ff8c1", "score": "0.5832443", "text": "func (_m *MockKMSAPI) RetireGrant(_param0 *kms.RetireGrantInput) (*kms.RetireGrantOutput, error) {\n\tret := _m.ctrl.Call(_m, \"RetireGrant\", _param0)\n\tret0, _ := ret[0].(*kms.RetireGrantOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "007af1b16a406961df19f147e4415f4c", "score": "0.5829433", "text": "func (m *MockAuthorization) GrantAuthorizationCode(ktx kontext.Context, authorizationReq entity.AuthorizationRequestJSON) (interface{}, jsonapi.Errors) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GrantAuthorizationCode\", ktx, authorizationReq)\n\tret0, _ := ret[0].(interface{})\n\tret1, _ := ret[1].(jsonapi.Errors)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5faeee77546e549a2eb76c9e55c4ed0b", "score": "0.5824791", "text": "func (m *MockTokenServiceServer) CreateToken(arg0 context.Context, arg1 *pb.CreateTokenRequest) (*pb.CreateTokenResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateToken\", arg0, arg1)\n\tret0, _ := ret[0].(*pb.CreateTokenResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "00ff7ec42494f0094b9043dde86aeda8", "score": "0.5711126", "text": "func (m *MockUserAuthRepository) ValidateToken(arg0 string) (bool, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ValidateToken\", arg0)\n\tret0, _ := ret[0].(bool)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "b643e8cdd1cfc5cf124466abbd8ffcc8", "score": "0.5698078", "text": "func (m *MockGenerator) GenerateRefreshToken(arg0 *claims.Claims) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateRefreshToken\", arg0)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "81935e2e447f374053c5342cee60d0fc", "score": "0.5692236", "text": "func TestImportTokens(t *testing.T) {\n\tendpoint := \"/api/v2/import_token\"\n\n\tcases := TestCases{\n\t\t{\n\t\t\t\"ImportToken Create\",\n\t\t\tfunc(t *testing.T, api *API, ctx context.Context) error {\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusOK, &ImportTokenCreateRequest{600, 600})\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusServiceUnavailable, \"\")\n\n\t\t\t\t_, err := api.CreateImportToken(ctx, 600, 600)\n\t\t\t\tassert.NoError(t, err)\n\n\t\t\t\t_, err = api.CreateImportToken(ctx, 600, 600)\n\t\t\t\tassert.Error(t, err)\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"ImportToken Get\",\n\t\t\tfunc(t *testing.T, api *API, ctx context.Context) error {\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusOK, &ImportTokenKeyResponse{})\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusOK, \"\")\n\n\t\t\t\t_, err := api.GetImportTokenTransportKey(ctx)\n\t\t\t\tassert.NoError(t, err)\n\n\t\t\t\t_, err = api.GetImportTokenTransportKey(ctx)\n\t\t\t\tassert.Error(t, err)\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"Assert context authorization override\",\n\t\t\tfunc(t *testing.T, api *API, ctx context.Context) error {\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusNoContent, \"\")\n\t\t\t\tMockAuthURL(NewTestURL()+endpoint, http.StatusServiceUnavailable, \"{'resources':[{'errorMsg':'none'}]}\")\n\n\t\t\t\t// auth token injection via context\n\t\t\t\torig := \"Basic 12345\"\n\t\t\t\ttok, err := api.getAccessToken(context.WithValue(ctx, authContextKey, orig))\n\t\t\t\tassert.NoError(t, err)\n\t\t\t\tassert.Exactly(t, tok, orig)\n\n\t\t\t\t// TokenURL overriding\n\t\t\t\tts := api.tokenSource.(*iam.IAMTokenSource)\n\t\t\t\tts.TokenURL = \":\"\n\t\t\t\t_, err = api.getAccessToken(ctx)\n\t\t\t\tassert.Error(t, err)\n\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\t\"Dump Implementations\",\n\t\t\tfunc(t *testing.T, api *API, ctx context.Context) error {\n\t\t\t\tcodes := []int{\n\t\t\t\t\thttp.StatusOK,\n\t\t\t\t\thttp.StatusCreated,\n\t\t\t\t\thttp.StatusNoContent,\n\t\t\t\t\thttp.StatusTeapot,\n\t\t\t\t}\n\t\t\t\trs := []string{}\n\t\t\t\trb := []byte(\"access_token\")\n\t\t\t\tlog := NewLogger(func(args ...interface{}) {})\n\t\t\t\treq := func() *http.Request {\n\t\t\t\t\treq, err := http.NewRequest(http.MethodGet, NewTestURL(), nil)\n\t\t\t\t\tassert.NoError(t, err)\n\t\t\t\t\treturn req\n\t\t\t\t}\n\t\t\t\tfor _, dump := range dumpers {\n\t\t\t\t\tfor _, code := range codes {\n\t\t\t\t\t\tres := http.Response{StatusCode: code}\n\t\t\t\t\t\tdump(req(), &res, []byte{}, rb, log, rs)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t}\n\tcases.Run(t)\n}", "title": "" }, { "docid": "f57facbbe1ccb58033bb535ff44d43b3", "score": "0.56791985", "text": "func (m *MockUsersService) RefreshToken(arg0 service.ReqRefreshToken) (service.ResRefreshToken, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshToken\", arg0)\n\tret0, _ := ret[0].(service.ResRefreshToken)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "31f619b70f6cadeec86f7009a493ec5e", "score": "0.5663981", "text": "func (m *MockTokenStore) Put(arg0 string, arg1 *ClientToken) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Put\", arg0, arg1)\n}", "title": "" }, { "docid": "e132fc27e1a43b56592372590b7ea0d9", "score": "0.5658788", "text": "func (m *MockTokenServer) Push(arg0 context.Context, arg1 *rpc.Token) (*rpc.Token, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Push\", arg0, arg1)\n\tret0, _ := ret[0].(*rpc.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "04b2616f90a37a47d0fcdb6295d76c49", "score": "0.56512886", "text": "func (m *MockAuthorization) RevokeToken(ktx kontext.Context, revokeAccessTokenReq entity.RevokeAccessTokenRequestJSON) jsonapi.Errors {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RevokeToken\", ktx, revokeAccessTokenReq)\n\tret0, _ := ret[0].(jsonapi.Errors)\n\treturn ret0\n}", "title": "" }, { "docid": "3914c8d2582635f5260ee896a858b179", "score": "0.56507796", "text": "func (m *MockIdentityService) VerifyToken(arg0 string) (schema.Authorization, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VerifyToken\", arg0)\n\tret0, _ := ret[0].(schema.Authorization)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f9b56c4281c0219bac88354b1cd4bdc1", "score": "0.56400245", "text": "func (m *MockRepo) AddAccessToken(arg0 Ctx, arg1 AccessToken, arg2 dom.UserName) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"AddAccessToken\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "6236d0ae5be224bef804ec7ea977d6da", "score": "0.5633795", "text": "func (m *MockAuthService) GenerateRefreshToken(user *models.User) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateRefreshToken\", user)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "cb7124d631b73c98124433469dd9bd22", "score": "0.5629128", "text": "func (_m *MockKMSAPI) CreateGrant(_param0 *kms.CreateGrantInput) (*kms.CreateGrantOutput, error) {\n\tret := _m.ctrl.Call(_m, \"CreateGrant\", _param0)\n\tret0, _ := ret[0].(*kms.CreateGrantOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "f889faf1307084877ddacd5fb65b7a18", "score": "0.5613331", "text": "func (m *MockTokenServiceServer) UpdateToken(arg0 context.Context, arg1 *pb.UpdateTokenRequest) (*pb.UpdateTokenResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"UpdateToken\", arg0, arg1)\n\tret0, _ := ret[0].(*pb.UpdateTokenResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "218794d50e78df060776f2db05607ba3", "score": "0.56015366", "text": "func GetMockTokenServer(tokenDataMap *sync.Map) *httptest.Server {\n\tserver := httptest.NewServer(http.HandlerFunc(func(rw http.ResponseWriter, req *http.Request) {\n\t\turlPath := req.URL.String()\n\t\tif req.Method == http.MethodGet && urlPath == \"/v1/auth/token/lookup-self\" {\n\t\t\ttoken := req.Header.Get(AuthTypeHeader)\n\t\t\tsampleTokenLookup, exists := tokenDataMap.Load(token)\n\t\t\tif !exists {\n\t\t\t\trw.WriteHeader(403)\n\t\t\t\t_, _ = rw.Write([]byte(\"permission denied\"))\n\t\t\t} else {\n\t\t\t\tresp := sampleTokenLookup.(TokenLookupResponse)\n\t\t\t\tif ret, err := json.Marshal(resp); err != nil {\n\t\t\t\t\trw.WriteHeader(500)\n\t\t\t\t\t_, _ = rw.Write([]byte(err.Error()))\n\t\t\t\t} else {\n\t\t\t\t\trw.WriteHeader(200)\n\t\t\t\t\t_, _ = rw.Write(ret)\n\t\t\t\t}\n\t\t\t}\n\t\t} else if req.Method == http.MethodPost && urlPath == \"/v1/auth/token/renew-self\" {\n\t\t\ttoken := req.Header.Get(AuthTypeHeader)\n\t\t\tsampleTokenLookup, exists := tokenDataMap.Load(token)\n\t\t\tif !exists {\n\t\t\t\trw.WriteHeader(403)\n\t\t\t\t_, _ = rw.Write([]byte(\"permission denied\"))\n\t\t\t} else {\n\t\t\t\tcurrentTTL := sampleTokenLookup.(TokenLookupResponse).Data.Ttl\n\t\t\t\tif currentTTL <= 0 {\n\t\t\t\t\t// already expired\n\t\t\t\t\trw.WriteHeader(403)\n\t\t\t\t\t_, _ = rw.Write([]byte(\"permission denied\"))\n\t\t\t\t} else {\n\t\t\t\t\ttokenPeriod := sampleTokenLookup.(TokenLookupResponse).Data.Period\n\n\t\t\t\t\ttokenDataMap.Store(token, TokenLookupResponse{\n\t\t\t\t\t\tData: types.TokenMetadata{\n\t\t\t\t\t\t\tRenewable: true,\n\t\t\t\t\t\t\tTtl: tokenPeriod,\n\t\t\t\t\t\t\tPeriod: tokenPeriod,\n\t\t\t\t\t\t},\n\t\t\t\t\t})\n\t\t\t\t\trw.WriteHeader(200)\n\t\t\t\t\t_, _ = rw.Write([]byte(\"token renewed\"))\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\trw.WriteHeader(404)\n\t\t\t_, _ = rw.Write([]byte(fmt.Sprintf(\"Unknown urlPath: %s\", urlPath)))\n\t\t}\n\t}))\n\treturn server\n}", "title": "" }, { "docid": "3f9d6848ee72c3e920ead6d799ffd866", "score": "0.55971503", "text": "func ImplicitGrantTest(t *testing.T, spec *Spec) {\n\t// invalid scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"token\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.InvalidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", fragment(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", fragment(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// exceeding scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"token\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ExceedingScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", fragment(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", fragment(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// access denied\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: map[string]string{\n\t\t\t\"response_type\": \"token\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", fragment(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", fragment(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid password\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.InvalidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"token\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.InvalidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", fragment(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", fragment(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\tvar accessToken string\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"token\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"bearer\", fragment(r, \"token_type\"), debug(r))\n\t\t\tassert.Equal(t, spec.ValidScope, fragment(r, \"scope\"), debug(r))\n\t\t\tassert.Equal(t, strconv.Itoa(spec.ExpectedExpiresIn), fragment(r, \"expires_in\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", fragment(r, \"state\"), debug(r))\n\t\t\tassert.Empty(t, fragment(r, \"refresh_token\"), debug(r))\n\n\t\t\taccessToken = fragment(r, \"access_token\")\n\t\t\tassert.NotEmpty(t, accessToken, debug(r))\n\t\t},\n\t})\n\n\t// test access token\n\tAccessTokenTest(t, spec, accessToken)\n}", "title": "" }, { "docid": "e6764483dc90faad4613e67b7b8b5d30", "score": "0.5594809", "text": "func ClientCredentialsGrantTest(t *testing.T, spec *Spec) {\n\t// invalid client secret\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: \"invalid\",\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"client_credentials\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_client\", jsonFieldString(r, \"error\"), debug(r))\n\t\t\tassert.NotEmpty(t, auth(r, \"realm\"), debug(r))\n\t\t},\n\t})\n\n\t// public client\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.PublicClientID,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"client_credentials\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_client\", jsonFieldString(r, \"error\"), debug(r))\n\t\t\tassert.NotEmpty(t, auth(r, \"realm\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"client_credentials\",\n\t\t\t\"scope\": spec.InvalidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// exceeding scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"client_credentials\",\n\t\t\t\"scope\": spec.ExceedingScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\tvar accessToken, refreshToken string\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"client_credentials\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusOK, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"bearer\", jsonFieldString(r, \"token_type\"), debug(r))\n\t\t\tassert.Equal(t, spec.ValidScope, jsonFieldString(r, \"scope\"), debug(r))\n\t\t\tassert.Equal(t, float64(spec.ExpectedExpiresIn), jsonFieldFloat(r, \"expires_in\"), debug(r))\n\n\t\t\taccessToken = jsonFieldString(r, \"access_token\")\n\t\t\tassert.NotEmpty(t, accessToken, debug(r))\n\n\t\t\trefreshToken = jsonFieldString(r, \"refresh_token\")\n\t\t\tassert.NotEmpty(t, refreshToken, debug(r))\n\t\t},\n\t})\n\n\t// test access token\n\tAccessTokenTest(t, spec, accessToken)\n\n\t// test refresh token if present\n\tif refreshToken != \"\" {\n\t\tRefreshTokenTest(t, spec, refreshToken)\n\t}\n}", "title": "" }, { "docid": "fb7a73aa44d798154689a8838185861b", "score": "0.5594303", "text": "func AuthorizationCodeGrantTest(t *testing.T, spec *Spec) {\n\t// invalid scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.InvalidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", query(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// exceeding scope\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ExceedingScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_scope\", query(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// access denied\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", query(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid password\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.InvalidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.InvalidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"access_denied\", query(r, \"error\"), debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\t\t},\n\t})\n\n\tvar authorizationCode string\n\n\t// get authorization code\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\n\t\t\tauthorizationCode = query(r, \"code\")\n\t\t\tassert.NotEmpty(t, authorizationCode, debug(r))\n\t\t},\n\t})\n\n\t// invalid client secret\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: \"invalid\",\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": spec.InvalidAuthorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_client\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// invalid authorization code\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": spec.InvalidAuthorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_request\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// unknown authorization code\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": spec.UnknownAuthorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// expired authorization code\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": spec.ExpiredAuthorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// wrong client\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.PublicClientID,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": authorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// wrong redirect uri\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": authorizationCode,\n\t\t\t\"redirect_uri\": spec.SecondaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\tvar accessToken, refreshToken string\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": authorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusOK, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"bearer\", jsonFieldString(r, \"token_type\"), debug(r))\n\t\t\tassert.Equal(t, spec.ValidScope, jsonFieldString(r, \"scope\"), debug(r))\n\t\t\tassert.Equal(t, float64(spec.ExpectedExpiresIn), jsonFieldFloat(r, \"expires_in\"), debug(r))\n\n\t\t\taccessToken = jsonFieldString(r, \"access_token\")\n\t\t\tassert.NotEmpty(t, accessToken, debug(r))\n\n\t\t\trefreshToken = jsonFieldString(r, \"refresh_token\")\n\t\t\tassert.NotEmpty(t, refreshToken, debug(r))\n\t\t},\n\t})\n\n\t// test access token\n\tAccessTokenTest(t, spec, accessToken)\n\n\t// test refresh token if present\n\tif refreshToken != \"\" {\n\t\tRefreshTokenTest(t, spec, refreshToken)\n\t}\n\n\t/* code replay attack */\n\n\t// get authorization code\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.AuthorizeEndpoint,\n\t\tForm: extend(spec.ValidAuthorizationParams, map[string]string{\n\t\t\t\"response_type\": \"code\",\n\t\t\t\"client_id\": spec.ConfidentialClientID,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"state\": \"xyz\",\n\t\t}),\n\t\tHeader: extend(spec.ValidAuthorizationHeaders, nil),\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusSeeOther, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"xyz\", query(r, \"state\"), debug(r))\n\n\t\t\tauthorizationCode = query(r, \"code\")\n\t\t\tassert.NotEmpty(t, authorizationCode, debug(r))\n\t\t},\n\t})\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": authorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusOK, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"bearer\", jsonFieldString(r, \"token_type\"), debug(r))\n\t\t\tassert.Equal(t, spec.ValidScope, jsonFieldString(r, \"scope\"), debug(r))\n\t\t\tassert.Equal(t, float64(spec.ExpectedExpiresIn), jsonFieldFloat(r, \"expires_in\"), debug(r))\n\n\t\t\taccessToken = jsonFieldString(r, \"access_token\")\n\t\t\tassert.NotEmpty(t, accessToken, debug(r))\n\n\t\t\trefreshToken = jsonFieldString(r, \"refresh_token\")\n\t\t\tassert.NotEmpty(t, refreshToken, debug(r))\n\t\t},\n\t})\n\n\t// get access token\n\tDo(spec.Handler, &Request{\n\t\tMethod: \"POST\",\n\t\tPath: spec.TokenEndpoint,\n\t\tUsername: spec.ConfidentialClientID,\n\t\tPassword: spec.ConfidentialClientSecret,\n\t\tForm: map[string]string{\n\t\t\t\"grant_type\": \"authorization_code\",\n\t\t\t\"scope\": spec.ValidScope,\n\t\t\t\"code\": authorizationCode,\n\t\t\t\"redirect_uri\": spec.PrimaryRedirectURI,\n\t\t},\n\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t},\n\t})\n\n\t// check if code replay mitigation is supported\n\tif spec.CodeReplayMitigation {\n\t\t// check access token\n\t\tDo(spec.Handler, &Request{\n\t\t\tMethod: \"GET\",\n\t\t\tPath: spec.ProtectedResource,\n\t\t\tHeader: map[string]string{\n\t\t\t\t\"Authorization\": \"Bearer \" + accessToken,\n\t\t\t},\n\t\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\t\tassert.Equal(t, http.StatusUnauthorized, r.Code, debug(r))\n\t\t\t},\n\t\t})\n\n\t\t// check refresh token\n\t\tDo(spec.Handler, &Request{\n\t\t\tMethod: \"POST\",\n\t\t\tPath: spec.TokenEndpoint,\n\t\t\tUsername: spec.ConfidentialClientID,\n\t\t\tPassword: spec.ConfidentialClientSecret,\n\t\t\tForm: map[string]string{\n\t\t\t\t\"grant_type\": \"refresh_token\",\n\t\t\t\t\"refresh_token\": refreshToken,\n\t\t\t},\n\t\t\tCallback: func(r *httptest.ResponseRecorder, rq *http.Request) {\n\t\t\t\tassert.Equal(t, http.StatusBadRequest, r.Code, debug(r))\n\t\t\t\tassert.Equal(t, \"invalid_grant\", jsonFieldString(r, \"error\"), debug(r))\n\t\t\t},\n\t\t})\n\t}\n}", "title": "" }, { "docid": "ddb46db154b88c4b51ce1564b86954fc", "score": "0.5576736", "text": "func (_m *Lease) Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error) {\n\tret := _m.Called(ctx, ttl)\n\n\tvar r0 *clientv3.LeaseGrantResponse\n\tif rf, ok := ret.Get(0).(func(context.Context, int64) *clientv3.LeaseGrantResponse); ok {\n\t\tr0 = rf(ctx, ttl)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*clientv3.LeaseGrantResponse)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(context.Context, int64) error); ok {\n\t\tr1 = rf(ctx, ttl)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "e0e962baec820ea85941343321329e33", "score": "0.55697024", "text": "func TestRefreshToken(t *testing.T) {\n\taurl := fmt.Sprintf(\"/token?grant_type=refresh_token&refresh_token=%s\", url.QueryEscape(refreshToken))\n\tr, err := newRequest(\"GET\", aurl, \"\", nil, &basicAuth{clientID, clientSecret})\n\tif err != nil {\n\t\tt.Fatalf(\"Failed to create request, reason: %v\", err)\n\t}\n\n\tw := httptest.NewRecorder()\n\tserver.HandleToken(w, r)\n\tif w.Code != http.StatusOK {\n\t\tt.Fail()\n\t}\n\n\tres, err := parseResponseBody(w.Body.Bytes())\n\tif err != nil {\n\t\tt.Fail()\n\t}\n\n\tassert.NotNil(t, res, \"No valid JSON response was detected\")\n\n\tif res[\"error_description\"] != nil {\n\t\tt.Fatalf(\"JSON response indicated an error: %s\", res[\"error_description\"])\n\t}\n\n\tassert.NotNil(t, res[\"access_token\"], \"Access token was not provided\")\n\tassert.NotNil(t, res[\"refresh_token\"], \"Refresh token was not provided\")\n\tassert.NotNil(t, res[\"expires_in\"], \"Expiry info was not provided\")\n}", "title": "" }, { "docid": "4f6b7140499760b548cc3c3b57cc85bd", "score": "0.55619425", "text": "func (m *MockAuthService) GenerateAccessToken(user *models.User) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateAccessToken\", user)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "d2585ae13e1063c3a099470e0df5b03f", "score": "0.55588853", "text": "func TestProvisionTokenCreation_GitHubBot(t *testing.T) {\n\t// Test setup\n\tctx := context.Background()\n\tsetup := setupTestEnv(t)\n\trequire.NoError(t, teleportCreateDummyRole(ctx, \"a\", setup.TeleportClient))\n\n\ttokenSpecYAML := `\nroles: \n - Bot\njoin_method: github\nbot_name: my-bot\ngithub:\n allow:\n - repository: org/repo\n`\n\texpectedSpec := &types.ProvisionTokenSpecV2{\n\t\tRoles: types.SystemRoles{types.RoleBot},\n\t\tJoinMethod: types.JoinMethodGitHub,\n\t\tBotName: \"my-bot\",\n\t\tGitHub: &types.ProvisionTokenSpecV2GitHub{Allow: []*types.ProvisionTokenSpecV2GitHub_Rule{{Repository: \"org/repo\"}}},\n\t}\n\n\t// Creating the Kubernetes resource. We are using an untyped client to be able to create invalid resources.\n\ttokenManifest := map[string]interface{}{}\n\terr := yaml.Unmarshal([]byte(tokenSpecYAML), &tokenManifest)\n\trequire.NoError(t, err)\n\n\ttokenName := validRandomResourceName(\"token-\")\n\n\tobj := resources.GetUnstructuredObjectFromGVK(teleportTokenGVK)\n\tobj.Object[\"spec\"] = tokenManifest\n\tobj.SetName(tokenName)\n\tobj.SetNamespace(setup.Namespace.Name)\n\n\t// Doing the test: we create the TeleportProvisionToken in Kubernetes\n\terr = setup.K8sClient.Create(ctx, obj)\n\trequire.NoError(t, err)\n\n\t// Then we wait for the token to be created in Teleport\n\tfastEventually(t, func() bool {\n\t\ttToken, err := setup.TeleportClient.GetToken(ctx, tokenName)\n\t\t// If the resource creation should succeed we check the resource was found and validate ownership labels\n\t\tif trace.IsNotFound(err) {\n\t\t\treturn false\n\t\t}\n\t\trequire.NoError(t, err)\n\n\t\trequire.Equal(t, tToken.GetName(), tokenName)\n\t\trequire.Contains(t, tToken.GetMetadata().Labels, types.OriginLabel)\n\t\trequire.Equal(t, tToken.GetMetadata().Labels[types.OriginLabel], types.OriginKubernetes)\n\t\texpectedToken := &types.ProvisionTokenV2{\n\t\t\tMetadata: types.Metadata{},\n\t\t\tSpec: *expectedSpec,\n\t\t}\n\t\t_ = expectedToken.CheckAndSetDefaults()\n\t\tcompareTokenSpecs(t, expectedToken, tToken)\n\n\t\treturn true\n\t})\n\t// Test Teardown\n\n\trequire.NoError(t, setup.K8sClient.Delete(ctx, obj))\n\t// We wait for the role deletion in Teleport\n\tfastEventually(t, func() bool {\n\t\t_, err := setup.TeleportClient.GetToken(ctx, tokenName)\n\t\treturn trace.IsNotFound(err)\n\t})\n}", "title": "" }, { "docid": "8efd67bff405a6d6b92f9430258d74bb", "score": "0.5555941", "text": "func (m *MockClient) GrantTypes() []oidc.GrantType {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GrantTypes\")\n\tret0, _ := ret[0].([]oidc.GrantType)\n\treturn ret0\n}", "title": "" }, { "docid": "1a53498ebb269a62dae9ef0bce5ea0b5", "score": "0.5553817", "text": "func (m *MockAuthProvider) Authorize(token, psi string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Authorize\", token, psi)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "4c74e085e616d3a42e84a9d227cb5f18", "score": "0.5547541", "text": "func TestCreateJoinTokenWithoutToken(t *testing.T) {\n\tsuite := setupRegistrationTest(t)\n\tdefer suite.ctrl.Finish()\n\n\trequest := &registration.JoinToken{Ttl: 200}\n\n\t//expectations\n\tsuite.mockDataStore.EXPECT().\n\t\tRegisterToken(gomock.Any(), gomock.Any()).\n\t\tReturn(&common.Empty{}, nil)\n\n\t//exercise\n\tresponse, err := suite.handler.CreateJoinToken(nil, request)\n\n\t//verification\n\tif response.Token == \"\" {\n\t\tt.Errorf(\"Response was incorrect\\n Got: empty token\\n Want: a token value\\n\")\n\n\t}\n\n\tif response.Ttl != 200 {\n\t\tt.Errorf(\"Response was incorrect\\n Got: %v\\n Want: %v\\n\",\n\t\t\tresponse.Ttl, 200)\n\n\t}\n\n\tif err != nil {\n\t\tt.Errorf(\"Error was not expected\\n Got: %v\\n Want: %v\\n\", err, nil)\n\t}\n}", "title": "" }, { "docid": "d69083832a7169d3b291fb18b4d379b6", "score": "0.55458635", "text": "func (_m *MockConfig) SetKeyManager(_param0 KeyManager) {\n\t_m.ctrl.Call(_m, \"SetKeyManager\", _param0)\n}", "title": "" }, { "docid": "a8075fd49840b11a44335dda21698672", "score": "0.5534469", "text": "func (_m *MockKMSAPI) CreateGrantRequest(_param0 *kms.CreateGrantInput) (*request.Request, *kms.CreateGrantOutput) {\n\tret := _m.ctrl.Call(_m, \"CreateGrantRequest\", _param0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*kms.CreateGrantOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "26be96bb3f42f35936c69b58edef81bc", "score": "0.55312085", "text": "func TestPasswordAuthnWithAuthrTokenExpired(t *testing.T) {\n\tsrv, teardown := ServiceForTest()\n\tdefer teardown()\n\n\tviper.Set(\"authorization_token_expires_in\", \"1s\")\n\n\t// 1. Get Password Parameters\n\temail := \"carol@example.com\"\n\n\treq := &authapi.StartPasswordAuthnRequest{\n\t\tClientId: \"authcore-io\",\n\t\tUserHandle: email,\n\t}\n\tres, err := srv.StartPasswordAuthn(context.Background(), req)\n\tassert.NoError(t, err)\n\n\t// 2. Do key exchange\n\tpassword := []byte(\"password\")\n\tspake2, err := authentication.NewSPAKE2Plus()\n\tassert.NoError(t, err)\n\n\tclientIdentity, serverIdentity := authentication.GetIdentity()\n\n\tstate, message, err := spake2.StartClient(clientIdentity, serverIdentity, password, res.PasswordSalt, nil)\n\tassert.NoError(t, err)\n\n\treq2 := &authapi.PasswordAuthnKeyExchangeRequest{\n\t\tMessage: message,\n\t\tTemporaryToken: res.TemporaryToken,\n\t}\n\tres2, err := srv.PasswordAuthnKeyExchange(context.Background(), req2)\n\tassert.NoError(t, err)\n\n\tchallengeToken := res2.PasswordChallenge.Token\n\tmessage = res2.PasswordChallenge.Message\n\n\t// 3. Finish confirmation\n\tsecret, err := state.Finish(res2.PasswordChallenge.Message)\n\tassert.Nil(t, err)\n\n\tconfirmation := secret.GetConfirmation()\n\n\treq3 := &authapi.FinishPasswordAuthnRequest{\n\t\tTemporaryToken: res2.TemporaryToken,\n\t\tResponse: &authapi.FinishPasswordAuthnRequest_PasswordResponse{\n\t\t\tPasswordResponse: &authapi.PasswordResponse{\n\t\t\t\tToken: challengeToken,\n\t\t\t\tConfirmation: confirmation,\n\t\t\t},\n\t\t},\n\t}\n\tres3, err := srv.FinishPasswordAuthn(context.Background(), req3)\n\tassert.NoError(t, err)\n\n\t// Sleep until the authorization token is expired\n\ttime.Sleep(2 * time.Second)\n\n\t// 4. Create an access token from refresh token (#204)\n\treq4 := &authapi.CreateAccessTokenRequest{\n\t\tGrantType: authapi.CreateAccessTokenRequest_REFRESH_TOKEN,\n\t\tToken: res3.AuthorizationToken,\n\t}\n\t_, err = srv.CreateAccessToken(context.Background(), req4)\n\tassert.Error(t, err)\n}", "title": "" }, { "docid": "a98504c03a869c9d7f368d0c9ed67d58", "score": "0.55277604", "text": "func (m *MockRepository) GetTokenSupply(network, address string, tokenID int64) (transfer.TokenSupply, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetTokenSupply\", network, address, tokenID)\n\tret0, _ := ret[0].(transfer.TokenSupply)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "054473fbb2bec4706d7fb782048c896e", "score": "0.55250543", "text": "func (m *MockAuthService) RefreshToken(refreshToken string, userID uint) (*params.UserTokens, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RefreshToken\", refreshToken, userID)\n\tret0, _ := ret[0].(*params.UserTokens)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "22e2d2e6ea345d8b4d4fc8b44f8074ff", "score": "0.5497895", "text": "func (g *TokenGrantor) GrantToken(method string, userClaims *jwtclaims.UserClaims) (string, error) {\n\tif _, exists := jwtconfig.SigningMethods[method]; !exists {\n\t\treturn \"\", jwterrors.ErrUnsupportedSigningMethod.WithArgs(method)\n\t}\n\tif userClaims == nil {\n\t\treturn \"\", jwterrors.ErrNoClaims\n\t}\n\tif g.TokenSecret == \"\" {\n\t\treturn \"\", jwterrors.ErrEmptySecret\n\t}\n\treturn userClaims.GetToken(method, []byte(g.TokenSecret))\n}", "title": "" }, { "docid": "f995c6e5f5d8997435484adc037ed234", "score": "0.5494896", "text": "func newMockTokenAccessor(tokens []string) *mockTokenAccessor {\n\treturn &mockTokenAccessor{\n\t\ttokens: tokens,\n\t}\n}", "title": "" }, { "docid": "b9293fca63521fdd727120a59e1dd0ce", "score": "0.54809415", "text": "func (m *MockTokenClient) Push(ctx context.Context, in *rpc.Token, opts ...grpc.CallOption) (*rpc.Token, error) {\n\tm.ctrl.T.Helper()\n\tvarargs := []interface{}{ctx, in}\n\tfor _, a := range opts {\n\t\tvarargs = append(varargs, a)\n\t}\n\tret := m.ctrl.Call(m, \"Push\", varargs...)\n\tret0, _ := ret[0].(*rpc.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "a8e0a323ca9b1678a9502c5072d4d9aa", "score": "0.5468444", "text": "func (m *MockGenerator) GenerateAccessToken(arg0 *claims.Claims) (string, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GenerateAccessToken\", arg0)\n\tret0, _ := ret[0].(string)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "15a24639e85bd06dafe070fd8f4a858e", "score": "0.5456899", "text": "func TestAccessTokenProviderRefreshToken(t *testing.T) {\n\tsubscriptionKey := \"private\"\n\n\texpectedToken := \"some-token\"\n\n\tserver := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n\t\tif r.Method != \"POST\" {\n\t\t\tt.Fatalf(\"Unexpected request method: %s\", r.Method)\n\t\t}\n\n\t\tif have, want := r.Header.Get(\"Ocp-Apim-Subscription-Key\"), subscriptionKey; have != want {\n\t\t\tt.Fatalf(\"Unexpected 'Ocp-Apim-Subscription-Key' header: want %q, have %q.\", want, have)\n\t\t}\n\n\t\tw.Header().Set(\"Content-Type\", \"application/jwt; charset=us-ascii\")\n\n\t\tfmt.Fprint(w, expectedToken)\n\t\treturn\n\t}))\n\tdefer server.Close()\n\n\taccessTokenProvider := newAccessTokenProvider(subscriptionKey, server.URL)\n\n\tactualToken := new(accessToken)\n\tif err := accessTokenProvider.RefreshToken(actualToken); err != nil {\n\t\tt.Fatalf(\"Unexpected error returned by RefreshToken: %v\", err.Error())\n\t}\n\n\tif have, want := actualToken.Token, expectedToken; have != want {\n\t\tt.Fatalf(\"Unexpected Token: want %q, have %q.\", actualToken.Token)\n\t}\n\n\tif s := actualToken.ExpiresAt.Sub(time.Now()).Seconds(); s < 598 || s > 600 {\n\t\tt.Fatalf(\"Unexpected ExpiresAt %q for access token generated from http response.\", actualToken.ExpiresAt)\n\t}\n}", "title": "" }, { "docid": "b4186c937582d5f2eed96d9bce1a0780", "score": "0.54566437", "text": "func (m *MockIdentityService) GetServiceTokenID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetServiceTokenID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "d1463dd70661ac55f756637145864d13", "score": "0.5440032", "text": "func TestRefreshToken(t *testing.T) {\n\t// Init\n\tjwt := NewJWTAuth(nil)\n\trtExpires := time.Now().Add(time.Minute * 15).Unix()\n\taccess := entity.Access{\n\t\tUserID: 1,\n\t}\n\n\tresult := true\n\trToken, _ := generateRefreshTokenString(access, rtExpires)\n\n\t// Execution\n\tisValid := jwt.refreshToken(rToken)\n\n\tif isValid != result {\n\t\tt.Error(\"refresh token invalido\")\n\t}\n}", "title": "" }, { "docid": "af8c270eec545c4d4d2884f0ffbf8060", "score": "0.5435233", "text": "func _mockTokenBytes() []byte {\n tokenInfo := map[string]interface{} {\n \"access_token\": \"accessTokenValue\",\n \"token_type\": \"someTokenType\",\n \"expires_in\": int32 (3600),\n \"refresh_token\": \"\",\n \"scope\": \"read\",\n \"user_id\": \"someUserId\",\n }\n\n tokenBytes, _ := json.Marshal (tokenInfo)\n\n return tokenBytes\n}", "title": "" }, { "docid": "d7bb352334bfedd89246e4a1b6662287", "score": "0.5420909", "text": "func (m *MockClient) Authorize(c *gin.Context) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"Authorize\", c)\n}", "title": "" }, { "docid": "bf6121f8f964e51c70829777bf4d046a", "score": "0.54113024", "text": "func DeployPausableTokenMock(auth *bind.TransactOpts, backend bind.ContractBackend, initialAccount common.Address, initialBalance *big.Int) (common.Address, *types.Transaction, *PausableTokenMock, error) {\n\tparsed, err := abi.JSON(strings.NewReader(PausableTokenMockABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PausableTokenMockBin), backend, initialAccount, initialBalance)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &PausableTokenMock{PausableTokenMockCaller: PausableTokenMockCaller{contract: contract}, PausableTokenMockTransactor: PausableTokenMockTransactor{contract: contract}, PausableTokenMockFilterer: PausableTokenMockFilterer{contract: contract}}, nil\n}", "title": "" }, { "docid": "bdc461070d4571342d21e795981bf93b", "score": "0.5406011", "text": "func (access *AuthAccessMock) CreateToken(username string, password string) (token string, err error) {\n\treturn \"\", nil\n}", "title": "" }, { "docid": "4904b02032f4479118250f4379d0b995", "score": "0.5400861", "text": "func authTokenPost(t *testing.T, options tokens.AuthOptions, scope *tokens.Scope, requestJSON string) {\n\ttesthelper.SetupHTTP()\n\tdefer testhelper.TeardownHTTP()\n\n\tclient := gophercloud.ServiceClient{\n\t\tProviderClient: &gophercloud.ProviderClient{},\n\t\tEndpoint: testhelper.Endpoint(),\n\t}\n\n\ttesthelper.Mux.HandleFunc(\"/auth/tokens\", func(w http.ResponseWriter, r *http.Request) {\n\t\ttesthelper.TestMethod(t, r, \"POST\")\n\t\ttesthelper.TestHeader(t, r, \"Content-Type\", \"application/json\")\n\t\ttesthelper.TestHeader(t, r, \"Accept\", \"application/json\")\n\t\ttesthelper.TestJSONRequest(t, r, requestJSON)\n\n\t\tw.WriteHeader(http.StatusCreated)\n\t\tfmt.Fprintf(w, `{\n\t\t\t\"token\": {\n\t\t\t\t\"expires_at\": \"2014-10-02T13:45:00.000000Z\"\n\t\t\t}\n\t\t}`)\n\t})\n\n\tif scope != nil {\n\t\toptions.Scope = *scope\n\t}\n\n\texpected := &tokens.Token{\n\t\tExpiresAt: time.Date(2014, 10, 2, 13, 45, 0, 0, time.UTC),\n\t}\n\tactual, err := tokens.Create(&client, &options).Extract()\n\ttesthelper.AssertNoErr(t, err)\n\ttesthelper.CheckDeepEquals(t, expected, actual)\n}", "title": "" }, { "docid": "61ce7a723874c7156fdb71f426ee0be3", "score": "0.5400234", "text": "func (m *MockRepo) DelAccessToken(arg0 Ctx, arg1 AccessToken) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DelAccessToken\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "e9480ca1256a65009a8c3570fee3a531", "score": "0.5381682", "text": "func (m *MockTokenServiceServer) GetToken(arg0 context.Context, arg1 *pb.GetTokenRequest) (*pb.GetTokenResponse, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetToken\", arg0, arg1)\n\tret0, _ := ret[0].(*pb.GetTokenResponse)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2037b6c2ce980b021466bda6a51f1cd4", "score": "0.5380755", "text": "func TestTokenGeneration(t *testing.T) {\n\tt.Run(\"Generate one time token for Runtime\", func(t *testing.T) {\n\t\t//GIVEN\n\t\tctx := context.TODO()\n\t\truntime := registerRuntime(t, ctx, \"test\")\n\t\tdefer unregisterRuntime(t, runtime.ID)\n\t\ttokenRequestNumber := 3\n\n\t\t//WHEN\n\t\tfor i := 0; i < tokenRequestNumber; i++ {\n\t\t\ttoken := requestOneTimeTokenForRuntime(t, ctx, runtime.ID)\n\t\t\tassert.NotEmpty(t, token.Token)\n\t\t\tassert.NotEmpty(t, token.ConnectorURL)\n\t\t}\n\t\t//THEN\n\t\truntimeExt := getRuntime(t, ctx, runtime.ID)\n\t\tassert.Len(t, runtimeExt.Auths, tokenRequestNumber)\n\t})\n\n\tt.Run(\"Generate one time token for Application\", func(t *testing.T) {\n\t\t//GIVEN\n\t\tctx := context.TODO()\n\t\tapp := registerApplication(t, ctx, \"test\")\n\t\tdefer unregisterApplication(t, app.ID)\n\t\ttokenRequestNumber := 3\n\n\t\t//WHEN\n\t\tfor i := 0; i < tokenRequestNumber; i++ {\n\t\t\ttoken := requestOneTimeTokenForApplication(t, ctx, app.ID)\n\t\t\tassert.NotEmpty(t, token.Token)\n\t\t\tassert.NotEmpty(t, token.ConnectorURL)\n\t\t\tassert.NotEmpty(t, token.LegacyConnectorURL)\n\t\t}\n\n\t\t//THEN\n\t\tappExt := getApplication(t, ctx, app.ID)\n\t\tassert.Len(t, appExt.Auths, tokenRequestNumber)\n\t})\n}", "title": "" }, { "docid": "176ca10dc4371ea247a2efda51b41ea2", "score": "0.5377242", "text": "func TestClientToken(t *testing.T) {\n\tg := testGateway.ClientToken()\n\ttoken, err := g.Generate()\n\tif err != nil {\n\t\tt.Fatalf(\"failed to generate client token: %s\", err)\n\t}\n\tif len(token) == 0 {\n\t\tt.Fatalf(\"empty client token!\")\n\t}\n}", "title": "" }, { "docid": "f32743dd8970ed1c68529c1e262d9e27", "score": "0.53696316", "text": "func TestGenerateRefreshToken(t *testing.T) {\n\t// Init\n\trtExpires := time.Now().Add(time.Hour * 24 * 7).Unix()\n\taccess := entity.Access{\n\t\tUserID: 1,\n\t\tAccessToken: \"\",\n\t\tRefreshToken: \"\",\n\t}\n\n\t// Execution\n\trToken, _ := generateAccessTokenString(access, rtExpires)\n\n\t// Validation\n\tif rToken == \"\" {\n\t\tt.Error(\"token de refresh nao foi gerado\")\n\t}\n}", "title": "" }, { "docid": "33d993f4448b62793bff661a145bab84", "score": "0.53693676", "text": "func TestGetAccessToken(t *testing.T) {\n\t// Test cases of errors responded by Github:\n\t// authorization_pending\n\t// slow_down\n\t// expired_token\n\t// unsuppored_grant_type\n\t// incorrect_client_credentials\n\t// incorrect_device_code\n\t// access_denied\n}", "title": "" }, { "docid": "3bbf0f18786805495bcd10e76ea1c4b8", "score": "0.5368395", "text": "func (_m *DirectorClient) InvalidateSystemAuthOneTimeToken(ctx context.Context, authID string) error {\n\tret := _m.Called(ctx, authID)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(context.Context, string) error); ok {\n\t\tr0 = rf(ctx, authID)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "cce75d32360e7e1b4d77789b86c302ec", "score": "0.5365746", "text": "func (m *MockTokenRevocationStorage) CreateRefreshTokenSession(arg0 context.Context, arg1 string, arg2 fosite.Requester) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"CreateRefreshTokenSession\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "31a2aa8c123784bbf568b119ded23917", "score": "0.5350254", "text": "func (m *MockToken) EXPECT() *MockTokenMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "059127c3e266a76e8e07dc14c0e003ff", "score": "0.53393", "text": "func TestMockSet(t *testing.T) {\n\tmp := mockProvider{}\n\terr := mp.Set(service, user, password)\n\tif err != nil {\n\t\tt.Errorf(\"Should not fail, got: %s\", err)\n\t}\n}", "title": "" }, { "docid": "6dfb3f5479681c3ec8e0cfea1cea40fd", "score": "0.533418", "text": "func TestAuthenticatorAuthToken(t *testing.T) {\n\tauthenticator := newMockAuthenticator(newMockAccessToken(100))\n\n\tauthToken, err := authenticator.authToken()\n\tif err != nil {\n\t\tt.Fatalf(\"Unexpected error: %s\", err.Error())\n\t}\n\n\texpectedToken := <-authenticator.accessTokenChan\n\tif authToken != fmt.Sprintf(\"Bearer %s\", expectedToken.Token) {\n\t\tt.Fatalf(\"Invalid authToken '%s'.\", authToken)\n\t}\n}", "title": "" }, { "docid": "3a50b86a6ac98d5ebc1176bb2649c4f4", "score": "0.5331632", "text": "func TestStsService(t *testing.T) {\n\ttokenManager, hTTPClient, sTSAddr, sTSServer := setUpServerAndClient(t)\n\temptyStsParam := stsservice.StsResponseParameters{}\n\tmockToken := &stsservice.TokenInfo{\n\t\tTokenType: \"type\",\n\t\tIssueTime: time.Now(),\n\t\tExpireTime: time.Now().Add(1 * time.Hour)}\n\ttestCases := map[string]struct {\n\t\tgenTokenError error\n\t\tdumpTokenError error\n\t\tstsRequest *http.Request\n\t\tstsRespParam stsservice.StsResponseParameters\n\t\texpectedStsResponse *http.Response\n\t\texpectedResponseType stsRespType\n\t\texpectedToken *stsservice.TokenInfo\n\t}{\n\t\t\"Send a valid STS request and get STS success response\": {\n\t\t\tstsRequest: genStsRequest(validStsReq, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\tstsRespParam: genSuccessStsRespParam(),\n\t\t\texpectedStsResponse: genStsResponse(successStsResp, genSuccessStsRespParam(), nil, nil),\n\t\t\texpectedResponseType: successStsResp,\n\t\t},\n\t\t\"Send an invalid STS request (empty grant type) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(emptyGrantType, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"request query grant_type is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (incorrect grant type) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(incorrectGrantType, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"request query grant_type is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (empty subject token) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(emptySubjectToken, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"subject_token is empty\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (empty subject token type) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(emptySubjectTokenType, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"subject_token_type is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (incorrect subject token type) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(incorrectSubjectTokenType, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"subject_token_type is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (incorrect request method) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(incorrectRequestMethod, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"request method is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send an invalid STS request (incorrect content type) and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(incorrectContentType, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\texpectedStsResponse: genStsResponse(validationFailure, genSuccessStsRespParam(), errors.New(\"request content type is invalid\"), nil),\n\t\t\texpectedResponseType: validationFailure,\n\t\t},\n\t\t\"Send a valid STS request and get STS error response\": {\n\t\t\tstsRequest: genStsRequest(validStsReq, \"http://\"+sTSAddr.String()+TokenPath),\n\t\t\tgenTokenError: errors.New(\"failed to generate token\"),\n\t\t\texpectedStsResponse: genStsResponse(tokenGenerationFailure, emptyStsParam, errors.New(\"failed to generate token\"), nil),\n\t\t\texpectedResponseType: tokenGenerationFailure,\n\t\t},\n\t\t\"Send a dump request and get dump information in response\": {\n\t\t\tstsRequest: genStsRequest(tokenStatusDump, \"http://\"+sTSAddr.String()+StsStatusPath),\n\t\t\texpectedStsResponse: genStsResponse(StatusDumpSuccess, emptyStsParam, nil, mockToken),\n\t\t\texpectedResponseType: StatusDumpSuccess,\n\t\t\texpectedToken: mockToken,\n\t\t},\n\t\t\"Send a dump request and get error response\": {\n\t\t\tstsRequest: genStsRequest(tokenStatusDump, \"http://\"+sTSAddr.String()+StsStatusPath),\n\t\t\tdumpTokenError: errors.New(\"failed to dump token\"),\n\t\t\texpectedStsResponse: genStsResponse(StatusDumpFailure, emptyStsParam, errors.New(\"failed to dump token\"), nil),\n\t\t\texpectedResponseType: StatusDumpFailure,\n\t\t},\n\t}\n\tfor k, tc := range testCases {\n\t\tif tc.genTokenError != nil {\n\t\t\ttokenManager.SetGenerateTokenError(tc.genTokenError)\n\t\t}\n\t\tif tc.dumpTokenError != nil {\n\t\t\ttokenManager.SetDumpTokenError(tc.dumpTokenError)\n\t\t}\n\t\tif tc.expectedToken != nil {\n\t\t\ttokenManager.SetToken(*tc.expectedToken)\n\t\t}\n\t\ttokenManager.SetRespStsParam(tc.stsRespParam)\n\t\tresp, err := sendStsRequestWithRetry(hTTPClient, tc.stsRequest)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"(Test case %s), failure in sending STS request: %v\", k, err)\n\t\t}\n\t\tverifyResponse(t, k, tc.expectedResponseType, resp, tc.expectedStsResponse)\n\t\ttokenManager.SetGenerateTokenError(nil)\n\t\ttokenManager.SetDumpTokenError(nil)\n\t}\n\tsTSServer.Stop()\n}", "title": "" }, { "docid": "6ce2bfbc418e616131f1ed84871f7556", "score": "0.53282344", "text": "func expectAuthSysErrorForToken(t *testing.T, badToken *pb.AuthToken, expectedErrorMessage string) {\n\tauthSys, err := security.AuthSysFromAuthToken(badToken)\n\n\tif authSys != nil {\n\t\tt.Error(\"Expected a nil AuthSys\")\n\t}\n\n\tExpectError(t, err, expectedErrorMessage, \"\")\n}", "title": "" }, { "docid": "0952f359824faef5b75140fff4bb249d", "score": "0.53279746", "text": "func GrantAuthToken(conn *store.Connection, p provider.Name, exp time.Duration) (*token.AuthToken, error) {\n\tvar t token.Token\n\terr := conn.Transaction(func(tx *store.Connection) error {\n\t\tt = token.NewAuthToken(p, exp)\n\t\treturn conn.Create(t).Error\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn t.(*token.AuthToken), nil\n}", "title": "" }, { "docid": "410010874b0a722dd99a703980ec5659", "score": "0.5324593", "text": "func (m *MockSessionRepo) GetByToken(token string) (entity.Session, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetByToken\", token)\n\tret0, _ := ret[0].(entity.Session)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "11927cb11fad6543cc2fad9d53e7f2a6", "score": "0.53224343", "text": "func (m *MockAuthenticationAPI) SetAuthToken(arg0 string) {\n\tm.ctrl.T.Helper()\n\tm.ctrl.Call(m, \"SetAuthToken\", arg0)\n}", "title": "" }, { "docid": "dd71c581cf4d7fbfccd6f7ef59a0b7b3", "score": "0.5316023", "text": "func (_m *MockKMSAPI) RevokeGrant(_param0 *kms.RevokeGrantInput) (*kms.RevokeGrantOutput, error) {\n\tret := _m.ctrl.Call(_m, \"RevokeGrant\", _param0)\n\tret0, _ := ret[0].(*kms.RevokeGrantOutput)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "5d4911f4f0a127193e538aeeba97b708", "score": "0.53110915", "text": "func (m *MockClient) RestrictAdditionalIdTokenScopes() func([]string) []string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RestrictAdditionalIdTokenScopes\")\n\tret0, _ := ret[0].(func([]string) []string)\n\treturn ret0\n}", "title": "" }, { "docid": "f159b281a9c360d2cca0988f7da2312e", "score": "0.530563", "text": "func (m *MockGithubInterface) GetOauth2AccessToken(gitSource *model.GitSource, code string) (*common.Token, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetOauth2AccessToken\", gitSource, code)\n\tret0, _ := ret[0].(*common.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "61eac54c7d64901bad4939c7ad98cb75", "score": "0.5302044", "text": "func (m *MockClient) VerifyToken(tokenStr string) (*jwt.Token, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VerifyToken\", tokenStr)\n\tret0, _ := ret[0].(*jwt.Token)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "58c6e2953ce1e10e9477648a2ed21fe8", "score": "0.5274338", "text": "func (m *MockTokenRepository) DeleteRefreshToken(arg0 context.Context, arg1, arg2 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"DeleteRefreshToken\", arg0, arg1, arg2)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "5fdf6168d9d107def58f26716b92e3ff", "score": "0.5273317", "text": "func TestMockDelete(t *testing.T) {\n\tmp := mockProvider{}\n\n\terr := mp.Set(service, user, password)\n\tif err != nil {\n\t\tt.Errorf(\"Should not fail, got: %s\", err)\n\t}\n\n\terr = mp.Delete(service, user)\n\tif err != nil {\n\t\tt.Errorf(\"Should not fail, got: %s\", err)\n\t}\n}", "title": "" }, { "docid": "d1a5cc562dbde00baf8f8611bd1fc999", "score": "0.5271479", "text": "func (_m *MockKMSAPI) RetireGrantRequest(_param0 *kms.RetireGrantInput) (*request.Request, *kms.RetireGrantOutput) {\n\tret := _m.ctrl.Call(_m, \"RetireGrantRequest\", _param0)\n\tret0, _ := ret[0].(*request.Request)\n\tret1, _ := ret[1].(*kms.RetireGrantOutput)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "8452ed3fe922e0b81c2f1d7e61e28be7", "score": "0.5258882", "text": "func (m *MockTokenCredential) GetToken(ctx context.Context, options policy.TokenRequestOptions) (azcore.AccessToken, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"GetToken\", ctx, options)\n\tret0, _ := ret[0].(azcore.AccessToken)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "2ad9ecc4ab9c4ef59fadc773f37657b1", "score": "0.5256411", "text": "func (m *MockTokenRevocationStorage) RevokeRefreshToken(arg0 context.Context, arg1 string) error {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"RevokeRefreshToken\", arg0, arg1)\n\tret0, _ := ret[0].(error)\n\treturn ret0\n}", "title": "" }, { "docid": "376a5b268897cef67400613b35b5dcfb", "score": "0.52493435", "text": "func (m *MockTokenRepository) EXPECT() *MockTokenRepositoryMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "d10dceb1245efacd8e7617f8a697ff58", "score": "0.5246837", "text": "func (m *MockAuthenticator) Authenthicate(token string) (auth.Principal, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"Authenthicate\", token)\n\tret0, _ := ret[0].(auth.Principal)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "6bad589de6422237f9fb17305c98fb0e", "score": "0.523063", "text": "func (_SwapExchange *SwapExchangeTransactor) SetTokenBase(opts *bind.TransactOpts, tokenA string, tokenB string, _baseToken string, _rate *big.Int) (*types.Transaction, error) {\n\treturn _SwapExchange.contract.Transact(opts, \"setTokenBase\", tokenA, tokenB, _baseToken, _rate)\n}", "title": "" }, { "docid": "29a65827f815d5201de036c0be01f734", "score": "0.5228235", "text": "func (m *MockUserUsecase) VerifyToken(ctx context.Context, idToken entity.IDToken) (*entity.User, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"VerifyToken\", ctx, idToken)\n\tret0, _ := ret[0].(*entity.User)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" } ]
cb987000f5e761563720b5da191c450c
GetRouteTypeSpec returns the instance of the Inclusive Multicast Ethernet Tag Route type object
[ { "docid": "78cd222cf132b4ba90d63c852c3ef6b5", "score": "0.8381182", "text": "func (t *InclusiveMulticastEthTag) GetRouteTypeSpec() interface{} {\n\treturn t\n}", "title": "" } ]
[ { "docid": "084b7d23de429c098f5a5dab19338b81", "score": "0.64796746", "text": "func (route *RouteTables_Route_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/routeTables/routes\"\n}", "title": "" }, { "docid": "b50fd4f8fabe49b8179f12ffccdc5ba8", "score": "0.5782275", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix) GetRouteType() E_OpenconfigOspfv2_ExtendedPrefix_RouteType {\n\tif t == nil || t.RouteType == 0 {\n\t\treturn 0\n\t}\n\treturn t.RouteType\n}", "title": "" }, { "docid": "6521de480c7528776c248c372a7bef85", "score": "0.57685214", "text": "func (r Route) Type() string {\n\tswitch r.Family {\n\tcase netlink.FAMILY_V4:\n\t\treturn genericitems.IPv4RouteTypename\n\tcase netlink.FAMILY_V6:\n\t\treturn genericitems.IPv6RouteTypename\n\tdefault:\n\t\treturn genericitems.UnsupportedRouteTypename\n\t}\n}", "title": "" }, { "docid": "d9fd6cdcfaeedbfc7d4b531de63a6dca", "score": "0.57232064", "text": "func (o EgressIPAMTypeOutput) Spec() EgressIPAMSpecPtrOutput {\n\treturn o.ApplyT(func(v EgressIPAMType) *EgressIPAMSpec { return v.Spec }).(EgressIPAMSpecPtrOutput)\n}", "title": "" }, { "docid": "6270c05e77cbde693c0e74b74859ccb4", "score": "0.55202085", "text": "func (r NRoute) RouteType() NRouteType {\n\tswitch {\n\tcase r.AdpID == \"\" && r.AreaID == \"\" && r.ProviderID == 0:\n\t\treturn NRtTypEmpty\n\tcase r.AdpID > \"\" && r.AreaID > \"\" && r.ProviderID > 0:\n\t\treturn NRtTypFull\n\tcase r.AdpID > \"\" && r.AreaID == \"all\" && r.ProviderID == 0:\n\t\treturn NRtTypAllAreas\n\tcase r.AdpID == \"\" && r.AreaID > \"\" && r.ProviderID == 0:\n\t\treturn NRtTypArea\n\tcase r.AdpID == \"all\" && r.AreaID == \"\" && r.ProviderID == 0:\n\t\treturn NRtTypAllAdapters\n\tdefault:\n\t\treturn NRtTypInvalid\n\t}\n}", "title": "" }, { "docid": "2f838461257cff515ef4ec8e282655c9", "score": "0.54720247", "text": "func (t *NetworkInstance_Mpls_SignalingProtocols_RsvpTe_Session_ExplicitRouteObject) GetType() E_OpenconfigMplsRsvp_ExplicitRouteObject_Type {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "ccdbb945de1aec5175a4b3f6c69a8835", "score": "0.54354626", "text": "func ( r * Router ) Type ( ) string {\n return r.router_type\n}", "title": "" }, { "docid": "e29eb128a4066a4d524e1608485ce1ec", "score": "0.5404496", "text": "func (r *Reserve) RouteType() string {\n\treturn \"reserve\"\n}", "title": "" }, { "docid": "726e03a01a32e8c92c585079d6104a01", "score": "0.5348613", "text": "func GetMappingDrgRouteRuleRouteTypeEnum(val string) (DrgRouteRuleRouteTypeEnum, bool) {\n\tenum, ok := mappingDrgRouteRuleRouteTypeEnumLowerCase[strings.ToLower(val)]\n\treturn enum, ok\n}", "title": "" }, { "docid": "8e58169458c7990bad76dac074c20429", "score": "0.53153175", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv) GetType() NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_Type_Union {\n\tif t == nil || t.Type == nil {\n\t\treturn nil\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "859a9cd86660f58b8db24fc171c6d285", "score": "0.52831084", "text": "func (o IngressTypeOutput) Spec() IngressSpecPtrOutput {\n\treturn o.ApplyT(func(v IngressType) *IngressSpec { return v.Spec }).(IngressSpecPtrOutput)\n}", "title": "" }, { "docid": "01909562f7b9f60cb274f595d53ea74a", "score": "0.5191952", "text": "func (t *NetworkInstance_Mpls_Lsps_ConstrainedPath_Tunnel_Bandwidth) GetSpecificationType() E_OpenconfigMpls_TeBandwidthType {\n\tif t == nil || t.SpecificationType == 0 {\n\t\treturn OpenconfigMpls_TeBandwidthType_SPECIFIED\n\t}\n\treturn t.SpecificationType\n}", "title": "" }, { "docid": "f38110fc97b92201e870df01745c7007", "score": "0.5143355", "text": "func (msg MsgAddP8EContractSpecRequest) Type() string {\n\treturn TypeMsgAddP8EContractSpecRequest\n}", "title": "" }, { "docid": "879fb31dfd1bfa14eed4edf2f9ae8190", "score": "0.51138806", "text": "func (network *VirtualNetwork_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/virtualNetworks\"\n}", "title": "" }, { "docid": "e65092c9f91572bf8f0646f60049f690", "score": "0.509688", "text": "func (l *Limit) RouteType() string {\n\treturn l.Input.RouteType()\n}", "title": "" }, { "docid": "202013fdd7fd9aa69246bdad6414ffa7", "score": "0.50343764", "text": "func (SCMPTracerouteRequest) Type() slayers.SCMPType { return slayers.SCMPTypeTracerouteRequest }", "title": "" }, { "docid": "e59eda5e5368f01b129a17348c87738b", "score": "0.503413", "text": "func (o InstanceOutput) SpecType() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Instance) pulumi.StringPtrOutput { return v.SpecType }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dbb8eab7f83da441ead48f1cc7fe8148", "score": "0.49679184", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv) GetType() NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_Type_Union {\n\tif t == nil || t.Type == nil {\n\t\treturn nil\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "e2edc8ad8a8cdb5e620037fd87763437", "score": "0.49553823", "text": "func (oa *OrderedAggregate) RouteType() string {\n\treturn oa.Input.RouteType()\n}", "title": "" }, { "docid": "29817d98862352cb5d7ec9fa4e0c11f8", "score": "0.49548566", "text": "func (t TrafficEngineeringRouterIDTLV) Type() uint8 {\n\treturn t.TLVType\n}", "title": "" }, { "docid": "4f298ed8e80d9e386900ca593c343ab7", "score": "0.49445498", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_UnknownTlv) GetType() uint16 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "49c9bb6d77ffe5c74db3caabec5abf07", "score": "0.49385476", "text": "func (group *NetworkSecurityGroup_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/networkSecurityGroups\"\n}", "title": "" }, { "docid": "8d4bf46bd3040fc6e494e2269535dccd", "score": "0.49290624", "text": "func (o IngressPatchTypeOutput) Spec() IngressSpecPatchPtrOutput {\n\treturn o.ApplyT(func(v IngressPatchType) *IngressSpecPatch { return v.Spec }).(IngressSpecPatchPtrOutput)\n}", "title": "" }, { "docid": "7afaec10ee4505ca8959f69caeea43f8", "score": "0.4927207", "text": "func GetMappingPathMatchTypeMatchTypeEnum(val string) (PathMatchTypeMatchTypeEnum, bool) {\n\tenum, ok := mappingPathMatchTypeMatchTypeEnumLowerCase[strings.ToLower(val)]\n\treturn enum, ok\n}", "title": "" }, { "docid": "c3ccda537c8e8dcb58c59a952e1f4e7b", "score": "0.48847958", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv4Reachability_Prefix_Subtlv_Ipv6SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "08359160c9efe78a7058263dfb37dce7", "score": "0.48758507", "text": "func (o *EthernetInterfaceType) GetType() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Type\n}", "title": "" }, { "docid": "9ffcdb97515f6fd026618768d12192b7", "score": "0.4864274", "text": "func (msg MsgAddContractSpecificationRequest) Type() string {\n\treturn TypeMsgAddContractSpecificationRequest\n}", "title": "" }, { "docid": "53ad05d942069b1a7a80221d05697517", "score": "0.48621258", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv6Reachability_Prefix_Subtlv_Ipv6SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "d379c804bd314a51d72e22787c76b2ba", "score": "0.48602226", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "2e80a57175c7ae0481f9b001e1e5b01a", "score": "0.48559135", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv6Reachability_Prefix_Subtlv_Ipv4SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "83a81fc43076cb20688af9abfb47f909", "score": "0.48418933", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_AsExternalLsa_TypeOfService) GetExternalRouteTag() uint32 {\n\tif t == nil || t.ExternalRouteTag == nil {\n\t\treturn 0\n\t}\n\treturn *t.ExternalRouteTag\n}", "title": "" }, { "docid": "61007720866b891ca6fbedd46686346b", "score": "0.48377067", "text": "func (msg MsgAddP8EContractSpecRequest) Route() string {\n\treturn ModuleName\n}", "title": "" }, { "docid": "42a3148ff58cd275ba14f47cf9bb21cb", "score": "0.48303193", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_NssaExternalLsa_TypeOfService) GetExternalRouteTag() uint32 {\n\tif t == nil || t.ExternalRouteTag == nil {\n\t\treturn 0\n\t}\n\treturn *t.ExternalRouteTag\n}", "title": "" }, { "docid": "8d166a790795f4a820281119a58bd9e6", "score": "0.48286557", "text": "func (t *Lldp_Interface_Neighbor_Tlv) GetType() int32 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "e6fde14ff04b38679592ddf15c14851c", "score": "0.48256657", "text": "func (b *Block) specType() cty.Type {\n\tif b == nil {\n\t\treturn cty.EmptyObject\n\t}\n\n\treturn hcldec.ImpliedType(b.DecoderSpec())\n}", "title": "" }, { "docid": "75ea6823e278b9dbe99b16fa8e5fce03", "score": "0.48147762", "text": "func (PeeringRoute_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_vmwareengine_v1_vmwareengine_resources_proto_rawDescGZIP(), []int{11, 0}\n}", "title": "" }, { "docid": "443976d3ce3089f1d4b12cb89f7e2fe4", "score": "0.48073745", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix_Subtlv_Ipv6SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "e2d434be64e249d532a340cdc5aa02a0", "score": "0.48056042", "text": "func (o DatadogAgentTypeOutput) Spec() DatadogAgentSpecPtrOutput {\n\treturn o.ApplyT(func(v DatadogAgentType) *DatadogAgentSpec { return v.Spec }).(DatadogAgentSpecPtrOutput)\n}", "title": "" }, { "docid": "884178eebb6bac7c1061b4f8b0d9346e", "score": "0.4800097", "text": "func (MeshGatewayRoute_HttpRoute_Match_Header_MatchType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_gateway_route_proto_rawDescGZIP(), []int{0, 2, 0, 1, 0}\n}", "title": "" }, { "docid": "bd1a674a3e9150763d2bb0baeb95caa2", "score": "0.478992", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_RouterLsa) GetType() E_OpenconfigOspfTypes_ROUTER_LSA_TYPES {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "fbfb63ad2722b98895b3e115ff08f7e9", "score": "0.478852", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv6Reachability_Prefix_Subtlv_Ipv6SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "f3797b73fa02e79d95e0f8ce7cbc9988", "score": "0.4787554", "text": "func (in *NetworkRouteSpec) DeepCopy() *NetworkRouteSpec {\n\tif in == nil {\n\t\treturn nil\n\t}\n\tout := new(NetworkRouteSpec)\n\tin.DeepCopyInto(out)\n\treturn out\n}", "title": "" }, { "docid": "2434da7bee52adb3b2f4d468ae5bf29d", "score": "0.47788218", "text": "func (MeshGatewayRoute_HttpRoute_Match_Path_MatchType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_gateway_route_proto_rawDescGZIP(), []int{0, 2, 0, 0, 0}\n}", "title": "" }, { "docid": "f6fe46159179998037dcb5baa40f7830", "score": "0.47734407", "text": "func GetRouterType() string {\n\tif OldRouterDefinition.Router.Infra != \"\" {\n\t\treturn OldRouterDefinition.Router.Infra\n\t}\n\treturn DefaultRouterType\n}", "title": "" }, { "docid": "d8932eec2e8e4ff6d31df8bc772465d2", "score": "0.4767169", "text": "func (o GrpcRouteRuleMatchHeaderOutput) Type() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GrpcRouteRuleMatchHeader) *string { return v.Type }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f5f4439684c25aa1774cd12eb8d8b26f", "score": "0.47666356", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UnconstrainedLsp) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "7b29a7f6990e5333ab15fd57fdc91e41", "score": "0.4765771", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_Ipv6Reachability_Prefix_Subtlv_Ipv4SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "d678178af0484f3c8b14abc8f411aea6", "score": "0.4764159", "text": "func (address *PublicIPAddress_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/publicIPAddresses\"\n}", "title": "" }, { "docid": "fb086c26c29248a4cb24ec348ad18848", "score": "0.4762448", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv4Reachability_Prefix_Subtlv_Ipv4SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "a4681ef59c03d2817f7c9c125b4ae2ef", "score": "0.47588682", "text": "func (router *routerSocket) Type() SocketType {\n\treturn router.sck.Type()\n}", "title": "" }, { "docid": "ac569f92d7d95ea60c5a70e46afda750", "score": "0.4756794", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "ee92002805a19e3879deecc83eca4e59", "score": "0.47309", "text": "func (f *FkVerify) RouteType() string {\n\treturn \"FKVerify\"\n}", "title": "" }, { "docid": "03bfdb9dac1afd65d86f8b5a348df152", "score": "0.47300556", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_UndefinedSubtlv) GetType() uint8 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "c1818fcca2f5e89dab2dbc4de06872d7", "score": "0.47276047", "text": "func (SCMPTracerouteReply) Type() slayers.SCMPType { return slayers.SCMPTypeTracerouteReply }", "title": "" }, { "docid": "f6273981040f942874667fb9bc0da841", "score": "0.47244462", "text": "func (endpoint *DnsResolversInboundEndpoint) GetSpec() genruntime.ConvertibleSpec {\n\treturn &endpoint.Spec\n}", "title": "" }, { "docid": "bbc89eed204b1b277a7ed0618f3eb539", "score": "0.47213122", "text": "func SubscriberSpecForRoute(name string) *v1alpha1.SubscriberSpec {\n\treturn &v1alpha1.SubscriberSpec{\n\t\tRef: &corev1.ObjectReference{\n\t\t\tKind: \"Route\",\n\t\t\tAPIVersion: \"serving.knative.dev/v1alpha1\",\n\t\t\tName: name,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a892687a8280e305232ba40d768029f2", "score": "0.4720743", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_ExtendedPrefix_Tlv_SidLabelBinding_Tlv_EroPath_Segment) GetType() E_OpenconfigOspfTypes_OSPFV2_EXTPREFIX_BINDING_ERO_PATH_SEGMENT_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "07d94cd310c2d8e35de3a8721a4adb1f", "score": "0.47207218", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_UndefinedSubtlv) GetType() uint8 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "b77bef424f87b6ae0c200cbbb7fb083b", "score": "0.47090223", "text": "func (Qos_ClassifierTemplate_TrafficClassifiers_TrafficClassifier_RuleMacAddresss_RuleMacAddress_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_proto_rawDescGZIP(), []int{0, 2, 1, 0, 10, 0, 0}\n}", "title": "" }, { "docid": "5e162ba70620289ade7cab43abf4a129", "score": "0.47026902", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIpv4Reachability_Prefix_Subtlv_Ipv4SourceRouterId) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "ed025919485414d094af3ae92d4ed019", "score": "0.46935686", "text": "func (e *ExtendedIPReachabilityTLV) Type() uint8 {\n\treturn e.TLVType\n}", "title": "" }, { "docid": "0bc9fe677665a0e6fd9937e6ed1a7d33", "score": "0.4692722", "text": "func newRouteSpec(spec string) *routeSpecNode {\n\treturn &routeSpecNode{\n\t\tnodeType: nodeRouteSpec,\n\t\tvalue: spec,\n\t}\n}", "title": "" }, { "docid": "84032bce881e2405f535074e778f3c7e", "score": "0.4690374", "text": "func (w Way) GetType() OSMType {\n\treturn WayType\n}", "title": "" }, { "docid": "7e37b7826a0f51fecacf98f4c5a84763", "score": "0.46805757", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_UtilizedBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "fb26fcb9445fa414b65cdc8e59555008", "score": "0.46755213", "text": "func (msg MsgAddContractSpecificationRequest) Route() string {\n\treturn ModuleName\n}", "title": "" }, { "docid": "b8a477f283b92e1d5ae105e293828408", "score": "0.46592578", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UnconstrainedLsp) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "54b3c3b77364d37091c725f674c7b40f", "score": "0.46502063", "text": "func (Route_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_public_proto_rawDescGZIP(), []int{38, 1}\n}", "title": "" }, { "docid": "6659965f3ffabd061e16855f2234c8dd", "score": "0.4649892", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_UnknownTlv) GetType() uint16 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "fc1cb020c1397d6f8b8c818cbf5d70fe", "score": "0.46482712", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsisNeighborAttribute_Neighbor_Instance_Subtlv_AvailableBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "0ccc492a9beb4ebcd584d2e6578f0928", "score": "0.46473166", "text": "func (MeshGatewayRoute_HttpRoute_Match_Query_MatchType) EnumDescriptor() ([]byte, []int) {\n\treturn file_api_mesh_v1alpha1_gateway_route_proto_rawDescGZIP(), []int{0, 2, 0, 2, 0}\n}", "title": "" }, { "docid": "a8b7ee5f92011c5dcba14978877930eb", "score": "0.46402338", "text": "func (msg MsgAddScopeSpecificationRequest) Type() string {\n\treturn TypeMsgAddScopeSpecificationRequest\n}", "title": "" }, { "docid": "adda19505c2cd5248324c71345e13ed5", "score": "0.4636564", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "b5a1934af65fc865570f7fe379447203", "score": "0.46211997", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_UtilizedBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "b331c5b22a6e0930bc67bb7b4c38bc5c", "score": "0.46067765", "text": "func (o AddressSpecOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AddressSpec) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4a3759a75650fb21bd9d1dcfc187c7d1", "score": "0.45967507", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_IsisNeighborAttribute_Neighbor_Instance_Subtlv_AvailableBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "209880ac12787120f64ef65d5f90d073", "score": "0.45925033", "text": "func (msg MsgAddScopeSpecificationRequest) Route() string {\n\treturn ModuleName\n}", "title": "" }, { "docid": "4de6ad42e8386d93c0c91749dcd9f2b6", "score": "0.45911917", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_UnconstrainedLsp) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "54943afe0d7a1e3abf90856e25024651", "score": "0.45904732", "text": "func (Qos_ClassifierTemplate_TrafficClassifiers_TrafficClassifier_RuleMacAndMasks_RuleMacAndMask_MacType) EnumDescriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_proto_rawDescGZIP(), []int{0, 2, 1, 0, 9, 0, 0}\n}", "title": "" }, { "docid": "3bb86b7d30a615ebacb3f9e9b0b59743", "score": "0.458912", "text": "func (t *NetworkInstance_Mpls_Lsps_ConstrainedPath_Tunnel) GetType() E_OpenconfigMplsTypes_TUNNEL_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "132551316176e87de3d3d46a72f8c49d", "score": "0.45891047", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_UndefinedSubtlv) GetType() uint8 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "405c245bb7361e3764ac5ed5f206effa", "score": "0.4583032", "text": "func (rule *ServersOutboundFirewallRule) GetSpec() genruntime.ConvertibleSpec {\n\treturn &rule.Spec\n}", "title": "" }, { "docid": "297d40a6e745ffedd2a7435985d63ea7", "score": "0.45730168", "text": "func (o AddressSpaceSpecOutput) Type() pulumi.StringOutput {\n\treturn o.ApplyT(func(v AddressSpaceSpec) string { return v.Type }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e44ff12f4405ae25ab76789b9f6e1868", "score": "0.45479625", "text": "func (RouteTravelMode) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_maps_routes_v1_compute_routes_request_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2ba83d56fe571cd28c2aad62f7bf7285", "score": "0.45423484", "text": "func (zone *PrivateDnsZone_Spec_ARM) GetType() string {\n\treturn \"Microsoft.Network/privateDnsZones\"\n}", "title": "" }, { "docid": "c8725333a00f6a32e02823bacc6ab8ad", "score": "0.45387274", "text": "func (t *NetworkInstance_Protocol_Ospfv2_Area_Interface) GetNetworkType() E_OpenconfigOspfTypes_OSPF_NETWORK_TYPE {\n\tif t == nil || t.NetworkType == 0 {\n\t\treturn 0\n\t}\n\treturn t.NetworkType\n}", "title": "" }, { "docid": "edac7f5f92882e8a3c9de76ab293e522", "score": "0.45370218", "text": "func (o *RFCOntology) SpecURI() string {\n\treturn rfcSpec\n}", "title": "" }, { "docid": "74f05a7d7c5aae48ca43b71da780f62f", "score": "0.45349595", "text": "func (r *WebSphereLibertyApplicationRoute) GetPathType() networkingv1.PathType {\n\treturn r.PathType\n}", "title": "" }, { "docid": "c86f2c89e88e7d2d8da8f7208de4c192", "score": "0.45262876", "text": "func (m *_AlarmMessageAckObjectPushType) GetLengthSpec() uint8 {\n\treturn m.LengthSpec\n}", "title": "" }, { "docid": "f0cce29bbb57546f4215c89d942ef60b", "score": "0.45249495", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv6Reachability_Prefix_Subtlv_Flags) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "5742e29d22764d7262268aee8791a0a4", "score": "0.45219082", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIpv4Reachability_Prefix_Subtlv_Flags) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "d455bef2ddf811404f1e9a2a71a31447", "score": "0.4521681", "text": "func AsTypeSpec(node ast.Node) *ast.TypeSpec {\n\tdecl, ok := node.(*ast.TypeSpec)\n\tif !ok {\n\t\tpanic(\"expected *ast.TypeSpec\")\n\t}\n\treturn decl\n}", "title": "" }, { "docid": "dfca8d781bdc68ac474a93e96ac9a3de", "score": "0.45128345", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv) GetType() E_OpenconfigIsisLsdbTypes_ISIS_TLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "688e7e5107dfa7d33d8f202a3d3cd008", "score": "0.4505509", "text": "func (msg MsgDeleteContractSpecificationRequest) Type() string {\n\treturn TypeMsgDeleteContractSpecificationRequest\n}", "title": "" }, { "docid": "8aaed8dd30404c473291c4309bb02242", "score": "0.45023066", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "2de0fb4fe3456d49cf2526bb3b73659c", "score": "0.4495917", "text": "func (*NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_Type_Union_E_OpenconfigOspfv2_Tlv_Type_) Is_NetworkInstance_Protocol_Ospfv2_Area_Lsdb_LsaType_Lsa_OpaqueLsa_RouterInformation_Tlv_SegmentRoutingSidLabelRange_Tlv_Type_Union() {\n}", "title": "" }, { "docid": "b6d2fd52f2248b59bf2f0315212a6aaa", "score": "0.44958156", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_UndefinedSubtlv) GetType() uint8 {\n\tif t == nil || t.Type == nil {\n\t\treturn 0\n\t}\n\treturn *t.Type\n}", "title": "" }, { "docid": "cf8cb13791526be1d08ce68162152cb9", "score": "0.44787836", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_AvailableBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "2734187953183e1e55ea6310b5a9848b", "score": "0.4478555", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_MtIsn_Neighbor_Instance_Subtlv_UtilizedBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "253d8310e8f16cb006c1cdae6fb4b015", "score": "0.44681352", "text": "func (t *NetworkInstance_Protocol_Isis_Level_Lsp_Tlv_ExtendedIsReachability_Neighbor_Instance_Subtlv_AvailableBandwidth) GetType() E_OpenconfigIsisLsdbTypes_ISIS_SUBTLV_TYPE {\n\tif t == nil || t.Type == 0 {\n\t\treturn 0\n\t}\n\treturn t.Type\n}", "title": "" }, { "docid": "13ae074bc70805c4e1a732fb1f781af6", "score": "0.44678444", "text": "func (Qos_ClassifierTemplate_TrafficBehaviors_TrafficBehavior_FlowCarActions_FlowCarAction_IpType) EnumDescriptor() ([]byte, []int) {\n\treturn file_huaweiV8R12_qos_proto_rawDescGZIP(), []int{0, 2, 2, 0, 5, 0, 0}\n}", "title": "" } ]
03473506563367f24b435600b34141bc
Ensure that API endpoints that explicitly select a proxy to operate on work.
[ { "docid": "331d185aa853162707a8e6e2c00a5c1a", "score": "0.57157636", "text": "func (s *ServiceHTTPSuite) TestExplicitProxyAPIEndpoints(c *C) {\n\ts.kh.ResetOffsets(\"foo\", \"test.1\")\n\tsvc, err := Spawn(s.cfg)\n\tc.Assert(err, IsNil)\n\tdefer svc.Stop()\n\n\t// When/Then\n\tr, err := s.unixClient.Post(\"http://_/clusters/pxyH/topics/test.1/messages?sync\", \"text/plain\", strings.NewReader(\"Bazinga!\"))\n\tc.Check(err, IsNil)\n\tc.Check(r.StatusCode, Equals, http.StatusOK)\n\tbody := ParseJSONBody(c, r).(map[string]interface{})\n\tc.Check(int(body[\"partition\"].(float64)), Equals, 0)\n\tprodOffset := int64(body[\"offset\"].(float64))\n\n\tr, err = s.unixClient.Get(\"http://_/clusters/pxyH/topics/test.1/messages?group=foo\")\n\tc.Check(err, IsNil)\n\tc.Check(r.StatusCode, Equals, http.StatusOK)\n\tbody = ParseJSONBody(c, r).(map[string]interface{})\n\tc.Check(ParseBase64(c, body[\"value\"].(string)), Equals, \"Bazinga!\")\n\tc.Check(int64(body[\"offset\"].(float64)), Equals, prodOffset)\n}", "title": "" } ]
[ { "docid": "958d1cce2304b112a1d54fbebe60e876", "score": "0.580695", "text": "func TestSkipBadProxies(t *testing.T) {\n\tjs := `function FindProxyForURL(url, host) { return \"PROXY primary:80; PROXY backup:80\" }`\n\tserver := httptest.NewServer(http.HandlerFunc(pacjsHandler(js)))\n\tdefer server.Close()\n\tpw := NewPACWrapper(PACData{Port: 1})\n\tpf := NewProxyFinder(server.URL, pw)\n\treq := httptest.NewRequest(http.MethodGet, \"https://www.test\", nil)\n\tctx := context.WithValue(req.Context(), contextKeyID, 0)\n\treq = req.WithContext(ctx)\n\tproxy, err := pf.findProxyForRequest(req)\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"primary:80\", proxy.Host)\n\tpf.blocked.add(\"primary:80\")\n\tproxy, err = pf.findProxyForRequest(req)\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"backup:80\", proxy.Host)\n\tpf.blocked.add(\"backup:80\")\n\tproxy, err = pf.findProxyForRequest(req)\n\trequire.NoError(t, err)\n\tassert.Equal(t, \"primary:80\", proxy.Host)\n}", "title": "" }, { "docid": "9fc13fd80fd0ea766162a41f8ae73ee1", "score": "0.5721029", "text": "func setProxyIfDefined(config *viper.Viper) error {\n\t// Add HTTP_PROXY if exists\n\tproxy := os.Getenv(HttpProxy)\n\tif proxy != \"\" {\n\t\turl, err := url.Parse(proxy)\n\t\tif err != nil {\n\t\t\treturn errorutils.CheckError(err)\n\t\t}\n\t\thost, port, err := net.SplitHostPort(url.Host)\n\t\tif err != nil {\n\t\t\treturn errorutils.CheckError(err)\n\t\t}\n\t\tconfig.Set(PROXY+HOST, host)\n\t\tconfig.Set(PROXY+PORT, port)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de5529bcfda28c479b76e84863d2467d", "score": "0.56080085", "text": "func UseProxy(w http.ResponseWriter, r *http.Request) {\n\tCallRegisterFuncOrAbortEmptyPlain(w, r, message.MessageStatusUseProxy, http.StatusUseProxy)\n}", "title": "" }, { "docid": "8daa06dbaa431326aa29e4fb05350166", "score": "0.5544302", "text": "func resourceVolterraForwardProxyPolicyUpdate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tupdateMeta := &ves_io_schema.ObjectReplaceMetaType{}\n\tupdateSpec := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType{}\n\tupdateReq := &ves_io_schema_views_forward_proxy_policy.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\tproxyChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"any_proxy\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_AnyProxy{}\n\t\t\tproxyChoiceInt.AnyProxy = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.ProxyChoice = proxyChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"drp_http_connect\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_DrpHttpConnect{}\n\t\t\tproxyChoiceInt.DrpHttpConnect = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.ProxyChoice = proxyChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"network_connector\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_NetworkConnector{}\n\t\tproxyChoiceInt.NetworkConnector = &ves_io_schema_views.ObjectRefType{}\n\t\tupdateSpec.ProxyChoice = proxyChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Name = v.(string)\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Namespace = v.(string)\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Tenant = v.(string)\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"proxy_label_selector\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_ProxyLabelSelector{}\n\t\tproxyChoiceInt.ProxyLabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\tupdateSpec.ProxyChoice = proxyChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tproxyChoiceInt.ProxyLabelSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\truleChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"allow_all\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_AllowAll{}\n\t\t\truleChoiceInt.AllowAll = &ves_io_schema.Empty{}\n\t\t\tupdateSpec.RuleChoice = ruleChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"allow_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_AllowList{}\n\t\truleChoiceInt.AllowList = &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType{}\n\t\tupdateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tdefaultActionChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"default_action_allow\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionAllow{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionAllow = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_deny\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionDeny{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionDeny = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_next_policy\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionNextPolicy{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionNextPolicy = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"dest_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\tdestList := make([]*ves_io_schema.L4DestType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.DestList = destList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\tdestList[i] = &ves_io_schema.L4DestType{}\n\t\t\t\t\tdestListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"port_ranges\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tdestList[i].PortRanges = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"prefixes\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdestList[i].Prefixes = ls\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.HttpList = httpList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.TlsList = tlsList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"deny_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_DenyList{}\n\t\truleChoiceInt.DenyList = &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType{}\n\t\tupdateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tdefaultActionChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"default_action_allow\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionAllow{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionAllow = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_deny\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionDeny{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionDeny = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_next_policy\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionNextPolicy{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionNextPolicy = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"dest_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\tdestList := make([]*ves_io_schema.L4DestType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.DestList = destList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\tdestList[i] = &ves_io_schema.L4DestType{}\n\t\t\t\t\tdestListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"port_ranges\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tdestList[i].PortRanges = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"prefixes\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdestList[i].Prefixes = ls\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.HttpList = httpList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.TlsList = tlsList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"rule_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.ReplaceSpecType_RuleList{}\n\t\truleChoiceInt.RuleList = &ves_io_schema_views_forward_proxy_policy.ForwardProxyRuleListType{}\n\t\tupdateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"rules\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trules := make([]*ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType, len(sl))\n\t\t\t\truleChoiceInt.RuleList.Rules = rules\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\trules[i] = &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType{}\n\t\t\t\t\trulesMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\trules[i].Action = ves_io_schema_policy.RuleAction(ves_io_schema_policy.RuleAction_value[v.(string)])\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdestinationChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"all_destinations\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_AllDestinations{}\n\t\t\t\t\t\t\tdestinationChoiceInt.AllDestinations = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_asn_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstAsnList{}\n\t\t\t\t\t\tdestinationChoiceInt.DstAsnList = &ves_io_schema_policy.AsnMatchList{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"as_numbers\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]uint32, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = uint32(v.(int))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnList.AsNumbers = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_asn_set\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstAsnSet{}\n\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_ip_prefix_set\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstIpPrefixSet{}\n\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_label_selector\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstLabelSelector{}\n\t\t\t\t\t\tdestinationChoiceInt.DstLabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstLabelSelector.Expressions = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_prefix_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstPrefixList{}\n\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList = &ves_io_schema_views.PrefixStringListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ipv6_prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList.Ipv6Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList.Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"http_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_HttpList{}\n\t\t\t\t\t\tdestinationChoiceInt.HttpList = &ves_io_schema_views_forward_proxy_policy.URLListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\t\t\t\t\tdestinationChoiceInt.HttpList.HttpList = httpList\n\t\t\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"tls_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_TlsList{}\n\t\t\t\t\t\tdestinationChoiceInt.TlsList = &ves_io_schema_views_forward_proxy_policy.DomainListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\t\t\t\t\tdestinationChoiceInt.TlsList.TlsList = tlsList\n\t\t\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"url_category_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_UrlCategoryList{}\n\t\t\t\t\t\tdestinationChoiceInt.UrlCategoryList = &ves_io_schema_views_forward_proxy_policy.URLCategoryListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"url_categories\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\turl_categoriesList := []ves_io_schema_policy.URLCategory{}\n\t\t\t\t\t\t\t\tfor _, j := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\turl_categoriesList = append(url_categoriesList, ves_io_schema_policy.URLCategory(ves_io_schema_policy.URLCategory_value[j.(string)]))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.UrlCategoryList.UrlCategories = url_categoriesList\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\thttpConnectChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"no_http_connect_port\"]; ok && !isIntfNil(v) && !httpConnectChoiceTypeFound {\n\n\t\t\t\t\t\thttpConnectChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\thttpConnectChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_NoHttpConnectPort{}\n\t\t\t\t\t\t\thttpConnectChoiceInt.NoHttpConnectPort = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].HttpConnectChoice = httpConnectChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"port_matcher\"]; ok && !isIntfNil(v) && !httpConnectChoiceTypeFound {\n\n\t\t\t\t\t\thttpConnectChoiceTypeFound = true\n\t\t\t\t\t\thttpConnectChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_PortMatcher{}\n\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher = &ves_io_schema_policy.PortMatcherType{}\n\t\t\t\t\t\trules[i].HttpConnectChoice = httpConnectChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"invert_matcher\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher.InvertMatcher = v.(bool)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ports\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher.Ports = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"metadata\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tmetadata := &ves_io_schema.MessageMetaType{}\n\t\t\t\t\t\trules[i].Metadata = metadata\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tmetadataMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"description\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Description = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"disable\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Disable = w.(bool)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"name\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Name = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := rulesMapStrToI[\"rule_description\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\trules[i].RuleDescription = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := rulesMapStrToI[\"rule_name\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\trules[i].RuleName = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tsourceChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"all_sources\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_AllSources{}\n\t\t\t\t\t\t\tsourceChoiceInt.AllSources = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"inside_sources\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_InsideSources{}\n\t\t\t\t\t\t\tsourceChoiceInt.InsideSources = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"interface\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_Interface{}\n\t\t\t\t\t\tsourceChoiceInt.Interface = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"ip_prefix_set\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_IpPrefixSet{}\n\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"label_selector\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_LabelSelector{}\n\t\t\t\t\t\tsourceChoiceInt.LabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.LabelSelector.Expressions = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"namespace\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_Namespace{}\n\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsourceChoiceInt.Namespace = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"prefix_list\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_PrefixList{}\n\t\t\t\t\t\tsourceChoiceInt.PrefixList = &ves_io_schema_views.PrefixStringListType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ipv6_prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.PrefixList.Ipv6Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.PrefixList.Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Updating Volterra ForwardProxyPolicy obj with struct: %+v\", updateReq)\n\n\terr := client.ReplaceObject(context.Background(), ves_io_schema_views_forward_proxy_policy.ObjectType, updateReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error updating ForwardProxyPolicy: %s\", err)\n\t}\n\n\treturn resourceVolterraForwardProxyPolicyRead(d, meta)\n}", "title": "" }, { "docid": "2f63fed360d64e07e12c41c9318038a7", "score": "0.5517498", "text": "func (proxier *Proxier) syncProxyRules() {\n\tif proxier.disableHyperInternalService {\n\t\treturn\n\t}\n\n\t// don't sync rules till we've received services and endpoints\n\tif !proxier.haveReceivedEndpointsUpdate || !proxier.haveReceivedServiceUpdate {\n\t\tglog.V(2).Info(\"Not syncing proxy rules until Services and Endpoints have been received from master\")\n\t\treturn\n\t}\n\tglog.V(3).Infof(\"Syncing proxy rules\")\n\n\t// Get existing pods\n\tpodList, err := proxier.hyperClient.ListPods()\n\tif err != nil {\n\t\tglog.Warningf(\"Can not get pod list: %v\", err)\n\t\treturn\n\t}\n\n\t// setup services with pod's same namespace for each pod\n\tfor _, podInfo := range podList {\n\t\t_, podNamespace, err := kubecontainer.ParsePodFullName(podInfo.PodName)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Pod %s is not managed by kubernetes\", podInfo.PodName)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Build services of same namespace (assume all services within same\n\t\t// namespace will be consumed)\n\t\tconsumedServices := make([]hyper.HyperService, 0, 1)\n\t\tfor _, svcInfo := range proxier.serviceMap {\n\t\t\tif svcInfo.namespace != podNamespace {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tsvc := hyper.HyperService{\n\t\t\t\tServicePort: svcInfo.port,\n\t\t\t\tServiceIP: svcInfo.clusterIP.String(),\n\t\t\t\tProtocol: strings.ToLower(string(svcInfo.protocol)),\n\t\t\t}\n\n\t\t\thosts := make([]hyper.HyperServiceBackend, 0, 1)\n\t\t\tfor _, ep := range svcInfo.endpoints {\n\t\t\t\thostport := strings.Split(ep, \":\")\n\t\t\t\tport, _ := strconv.ParseInt(hostport[1], 10, 0)\n\t\t\t\thosts = append(hosts, hyper.HyperServiceBackend{\n\t\t\t\t\tHostIP: hostport[0],\n\t\t\t\t\tHostPort: int(port),\n\t\t\t\t})\n\t\t\t}\n\t\t\tsvc.Hosts = hosts\n\n\t\t\tconsumedServices = append(consumedServices, svc)\n\t\t}\n\t\tglog.V(4).Infof(\"Services of pod %s should consumed: %v\", podInfo.PodName, consumedServices)\n\n\t\t// update existing services\n\t\tif len(consumedServices) == 0 {\n\t\t\t// services can't be null for kubernetes, so fake one if it is null\n\t\t\tconsumedServices = append(consumedServices, hyper.HyperService{\n\t\t\t\tServiceIP: \"127.0.0.2\",\n\t\t\t\tServicePort: 65534,\n\t\t\t})\n\t\t}\n\n\t\terr = proxier.hyperClient.UpdateServices(podInfo.PodID, consumedServices)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Updating service for hyper pod %s failed: %v\", podInfo.PodName, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8138b2ee20acd5c479491b9b1c07e66e", "score": "0.5485885", "text": "func IsExplicitProxyConfigured(proxyConfig types.ProxyConfig) bool {\n\tif len(proxyConfig.Proxies) > 0 ||\n\t\tproxyConfig.Pacfile != \"\" ||\n\t\tproxyConfig.NetworkProxyEnable {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "01253a94a6bb88b75d503eea8997bdbb", "score": "0.54814947", "text": "func Proxy(proxy string) option {\n\treturn func(b *Burrow) error {\n\t\tvar err error\n\n\t\tif proxy == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\tif b.Proxy, err = endpoint.NewEndpoint(proxy); err != nil {\n\t\t\treturn fmt.Errorf(\"Proxy Endpoint: %s\", err)\n\t\t}\n\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "48ecfc444b7008fa7f54272a4076921d", "score": "0.5457718", "text": "func (p *proxyrunner) becomeNonPrimaryProxy() {\n\tp.primary = false\n\tpsi := p.smap.getProxy(p.si.DaemonID)\n\tif psi == nil {\n\t\tif glog.V(4) {\n\t\t\tglog.Warningf(\"becomeNonPrimaryProxy: failed to find itself %s in smap\", p.si.DaemonID)\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "69ccbfc748840d9cc750695efa30394f", "score": "0.54373085", "text": "func makeDesiredProxy(upstreams v1.UpstreamList) *v1.Proxy {\n\n\t// each virtual host represents the table of routes for a given\n\t// domain or set of domains.\n\t// in this example, we'll create one virtual host\n\t// for each upstream.\n\tvar virtualHosts []*v1.VirtualHost\n\n\tfor _, upstream := range upstreams {\n\t\tupstreamRef := upstream.Metadata.Ref()\n\t\t// create a virtual host for each upstream\n\t\tvHostForUpstream := &v1.VirtualHost{\n\t\t\t// logical name of the virtual host, should be unique across vhosts\n\t\t\tName: upstream.Metadata.Name,\n\n\t\t\t// the domain will be our \"matcher\".\n\t\t\t// requests with the Host header equal to the upstream name\n\t\t\t// will be routed to this upstream\n\t\t\tDomains: []string{upstream.Metadata.Name},\n\n\t\t\t// we'll create just one route designed to match any request\n\t\t\t// and send it to the upstream for this domain\n\t\t\tRoutes: []*v1.Route{{\n\t\t\t\t// use a basic catch-all matcher\n\t\t\t\tMatchers: []*matchers.Matcher{\n\t\t\t\t\t{\n\t\t\t\t\t\tPathSpecifier: &matchers.Matcher_Prefix{\n\t\t\t\t\t\t\tPrefix: \"/\",\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\n\t\t\t\t// tell Gloo where to send the requests\n\t\t\t\tAction: &v1.Route_RouteAction{\n\t\t\t\t\tRouteAction: &v1.RouteAction{\n\t\t\t\t\t\tDestination: &v1.RouteAction_Single{\n\t\t\t\t\t\t\t// single destination\n\t\t\t\t\t\t\tSingle: &v1.Destination{\n\t\t\t\t\t\t\t\tDestinationType: &v1.Destination_Upstream{\n\t\t\t\t\t\t\t\t\t// a \"reference\" to the upstream, which is a Namespace/Name tuple\n\t\t\t\t\t\t\t\t\tUpstream: &upstreamRef,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}},\n\t\t}\n\n\t\tvirtualHosts = append(virtualHosts, vHostForUpstream)\n\t}\n\n\tdesiredProxy := &v1.Proxy{\n\t\t// metadata will be translated to Kubernetes ObjectMeta\n\t\tMetadata: core.Metadata{Namespace: \"gloo-system\", Name: \"my-cool-proxy\"},\n\n\t\t// we have the option of creating multiple listeners,\n\t\t// but for the purpose of this example we'll just use one\n\t\tListeners: []*v1.Listener{{\n\t\t\t// logical name for the listener\n\t\t\tName: \"my-amazing-listener\",\n\n\t\t\t// instruct envoy to bind to all interfaces on port 8080\n\t\t\tBindAddress: \"::\", BindPort: 8080,\n\n\t\t\t// at this point you determine what type of listener\n\t\t\t// to use. here we'll be using the HTTP Listener\n\t\t\t// other listener types are currently unsupported,\n\t\t\t// but future\n\t\t\tListenerType: &v1.Listener_HttpListener{\n\t\t\t\tHttpListener: &v1.HttpListener{\n\t\t\t\t\t// insert our list of virtual hosts here\n\t\t\t\t\tVirtualHosts: virtualHosts,\n\t\t\t\t},\n\t\t\t}},\n\t\t},\n\t}\n\n\treturn desiredProxy\n}", "title": "" }, { "docid": "5fb43f8173a7b2da1f0f7285bc35b2b1", "score": "0.5436233", "text": "func setupProxy() {\n\tdirector := func(req *http.Request) {\n\t\treq.URL.Scheme = \"https\"\n\t\treq.URL.Host = hostmapping.Map(req.Host)\n\t\tlog.Tracef(\"[H1 proxy] Proxying request to %s://%s\", req.URL.Scheme, req.URL.Host)\n\t}\n\n\ttimeoutDialer := func(network, address string) (net.Conn, error) {\n\t\treturn net.DialTimeout(network, address, dialTimeout)\n\t}\n\n\tv1Proxy = &httputil.ReverseProxy{\n\t\tDirector: director,\n\t\tTransport: &http.Transport{\n\t\t\tDial: timeoutDialer,\n\t\t\tResponseHeaderTimeout: responseTimeout,\n\t\t\tMaxIdleConnsPerHost: idleConnections,\n\t\t\tTLSClientConfig: proxyTransportTLSConfig,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "105fd560843e60d59a9386e10c6a091c", "score": "0.5430531", "text": "func (handler *Handler) selectProxy(endpoint *backend.Endpoint, isWebSocket bool) Proxy {\n\tif endpoint.TLSMode == backend.TLSDisabledH2C {\n\t\tif isWebSocket {\n\t\t\treturn handler.InsecureWebSocketProxy\n\t\t}\n\n\t\treturn handler.H2CProxy\n\t}\n\n\tif endpoint.TLSMode == backend.TLSInsecure {\n\t\tif isWebSocket {\n\t\t\treturn handler.InsecureWebSocketProxy\n\t\t}\n\n\t\treturn handler.InsecureHTTPProxy\n\t}\n\n\tif isWebSocket {\n\t\treturn handler.SecureWebSocketProxy\n\t}\n\n\treturn handler.SecureHTTPProxy\n}", "title": "" }, { "docid": "ab2fd548fb444fc647cdba2842b37cc8", "score": "0.542117", "text": "func proxyHandler(res http.ResponseWriter, req *http.Request) {\n\tservice := req.Context().Value(requestedService).(services.Service)\n\t// No security on backend right now :-(\n\tdestination := \"http://\" + service.BackendDomain + req.URL.RequestURI()\n\tlogger.Debugf(\"Proxying to %s\", destination)\n\tb, err := ioutil.ReadAll(req.Body)\n\tdefer req.Body.Close()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not read request body - %s\", err))\n\t}\n\n\tinternalReq, err := http.NewRequest(req.Method, destination, bytes.NewReader(b))\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Unable to create request - %s\", err))\n\t}\n\n\tauth.SetInternalHeaders(req, internalReq.Header)\n\n\tcurrentUserUUID, err := auth.GetCurrentUserUUIDFromHeader(internalReq.Header)\n\tif err == nil {\n\t\t// authenticated request\n\t\tif _, isBanned := bannedUsers[currentUserUUID]; isBanned {\n\t\t\tlogger.Warningf(\"Banned user accessing service - user %s\", currentUserUUID)\n\t\t\terrorpages.Forbidden(res)\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Right here - check response Authorization and see if it's ok\n\t// with the requested service\n\n\t// Check perimeter authorization\n\tswitch internalReq.Header.Get(auth.AuthorizationHeader) {\n\tcase auth.AuthorizationAnonymousWeb:\n\t\tif service.Security != services.Public {\n\t\t\t// send to login\n\t\t\tscheme := \"https\"\n\t\t\tif config.Name == \"development\" || config.Name == \"test\" {\n\t\t\t\tscheme = \"http\"\n\t\t\t}\n\t\t\tredirectDest := &url.URL{Host: \"www.\" + config.ExternalApex, Scheme: scheme, Path: \"/login/\"}\n\n\t\t\turl := req.Host + req.URL.EscapedPath()\n\n\t\t\thttp.Redirect(res, req, redirectDest.String()+\"?return_to=\"+url, http.StatusTemporaryRedirect)\n\t\t\treturn\n\t\t}\n\tcase auth.AuthorizationAuthenticatedUser:\n\t\tif service.Security == services.Admin {\n\t\t\terrorpages.Forbidden(res)\n\t\t\treturn\n\t\t}\n\tcase auth.AuthorizationSupportUser:\n\t\t// no restrictions\n\tdefault:\n\t\tlogger.Panicf(\"unknown authorization header\")\n\t}\n\n\tclient := http.Client{\n\t\t// RETURN a redirect, do not FOLLOW it (which ends up causing relative redirect issues)\n\t\tCheckRedirect: func(req *http.Request, via []*http.Request) error {\n\t\t\treturn http.ErrUseLastResponse\n\t\t},\n\t}\n\tinternalRes, err := client.Do(internalReq)\n\tif err != nil {\n\t\tlogger.Warningf(\"Unable to query backend - %s\", err)\n\t\terrorpages.GatewayTimeout(res)\n\t\treturn\n\t}\n\t// Copy headers from service to user\n\tauth.ProxyHeaders(internalRes.Header, res.Header())\n\n\tif service.NoCacheHTML {\n\t\tif strings.Contains(strings.Join(res.Header()[\"Content-Type\"], \"\"), \"text/html\") {\n\t\t\t// insert header to prevent caching\n\t\t\tres.Header().Set(\"Cache-Control\", \"no-cache\")\n\t\t}\n\t}\n\n\tres.WriteHeader(internalRes.StatusCode)\n\tio.Copy(res, internalRes.Body)\n\tinternalRes.Body.Close()\n\n}", "title": "" }, { "docid": "67871bbb975dada96a69af49b529e7a6", "score": "0.53885645", "text": "func addProxy(tenant *xdsconfig.Tenant, apiProxy *apimgmt.Proxy) *xdsconfig.Proxy {\n\tp := xdsconfig.MakeProxy(tenant.Name, apiProxy)\n\ttenant.Proxies = append(tenant.Proxies, p)\n\treturn p\n}", "title": "" }, { "docid": "de8a77fac80365772bbfc5b734a95959", "score": "0.53860515", "text": "func (e *executor) ensureProxyConfigMap(ctx context.Context, ownerRef metav1.OwnerReference) (string, error) {\n\tsvc := e.taskSpec.Service\n\tif svc == nil {\n\t\treturn \"\", nil\n\t}\n\n\t// Prepare config\n\tvar config []string\n\tfor _, sps := range svc.Ports {\n\t\tif sps.NeedsProxy() {\n\t\t\tconfig = append(config,\n\t\t\t\tfmt.Sprintf(\"[servers.%s]\", sps.Name),\n\t\t\t\tfmt.Sprintf(\"bind = \\\":%d\\\"\", sps.Port),\n\t\t\t\t\"protocol = \\\"tcp\\\"\",\n\t\t\t\tfmt.Sprintf(\"[servers.%s.discovery]\", sps.Name),\n\t\t\t\t\"kind = \\\"static\\\"\",\n\t\t\t\tfmt.Sprintf(\"static_list = [\\\"127.0.0.1:%d weight=1\\\"]\", sps.LocalPort),\n\t\t\t)\n\t\t}\n\t}\n\tif len(config) == 0 {\n\t\t// No ports need proxy\n\t\treturn \"\", nil\n\t}\n\n\t// Build ConfigMap\n\tcm := &corev1.ConfigMap{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: e.myPod.Name,\n\t\t\tNamespace: e.myPod.Namespace,\n\t\t\tOwnerReferences: []metav1.OwnerReference{ownerRef},\n\t\t},\n\t\tData: map[string]string{\n\t\t\tgobetweenConfFileName: strings.Join(config, \"\\n\"),\n\t\t},\n\t}\n\n\t// Ensure configmap exists & is up to date\n\tif err := util.EnsureConfigMap(ctx, e.log, e.Client, cm, \"proxy config\"); err != nil {\n\t\te.log.Debug().Err(err).Msg(\"Failed to ensure proxy configmap\")\n\t\treturn \"\", maskAny(err)\n\t}\n\n\treturn cm.Name, nil\n}", "title": "" }, { "docid": "639238c010820b1ed11052b5d0972f96", "score": "0.53798115", "text": "func loadProxy(c *gin.Context, mock *Mock) {\n\tfmt.Printf(\"Proxy enabled, URL: %s Method: %s\", mock.ProxyUrl, mock.Method)\n\tvar myBody io.Reader\n\tmyHeaders := c.Request.Header\n\tif mock.Method != \"GET\" {\n\t\tmyBody = c.Request.Body\n\t}\n\trequest, requestError := http.NewRequest(mock.Method, mock.ProxyUrl, myBody)\n\tif requestError != nil {\n\t\tpanic(requestError)\n\t}\n\n\trequest.Header = myHeaders\n\tclient := &http.Client{}\n\tproxyResponse, proxyError := client.Do(request)\n\tif proxyError != nil {\n\t\tmessage := \"Proxy error: \" + mock.ProxyUrl + proxyError.Error()\n\t\tc.JSON(http.StatusBadGateway, gin.H{\"message\": message})\n\t\treturn\n\t}\n\tfmt.Println(\"Proxy response status:\", proxyResponse.Status)\n\n\tfor key, header := range proxyResponse.Header {\n\t\tfor _, h := range header {\n\t\t\tc.Header(key, h)\n\t\t}\n\t}\n\tio.Copy(c.Writer, proxyResponse.Body)\n\treturn\n}", "title": "" }, { "docid": "b3ad313ff1e1da9a8b4e3751d9c717fe", "score": "0.53755534", "text": "func ProxyAuthRequired(w http.ResponseWriter, r *http.Request) {\n\tCallRegisterFuncOrAbortEmptyError(w, r, message.MessageStatusProxyAuthRequired, http.StatusProxyAuthRequired)\n}", "title": "" }, { "docid": "1fbfe4cfab51007283ee50aaf342acc4", "score": "0.5352835", "text": "func TestSyncProxyRulesRepeated(t *testing.T) {\n\tipt := iptablestest.NewFake()\n\tfp := NewFakeProxier(ipt)\n\tmetrics.RegisterMetrics()\n\n\t// Create initial state\n\tvar svc2 *v1.Service\n\n\tmakeServiceMap(fp,\n\t\tmakeTestService(\"ns1\", \"svc1\", func(svc *v1.Service) {\n\t\t\tsvc.Spec.Type = v1.ServiceTypeClusterIP\n\t\t\tsvc.Spec.ClusterIP = \"172.30.0.41\"\n\t\t\tsvc.Spec.Ports = []v1.ServicePort{{\n\t\t\t\tName: \"p80\",\n\t\t\t\tPort: 80,\n\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t}}\n\t\t}),\n\t\tmakeTestService(\"ns2\", \"svc2\", func(svc *v1.Service) {\n\t\t\tsvc2 = svc\n\t\t\tsvc.Spec.Type = v1.ServiceTypeClusterIP\n\t\t\tsvc.Spec.ClusterIP = \"172.30.0.42\"\n\t\t\tsvc.Spec.Ports = []v1.ServicePort{{\n\t\t\t\tName: \"p8080\",\n\t\t\t\tPort: 8080,\n\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t}}\n\t\t}),\n\t)\n\n\tpopulateEndpointSlices(fp,\n\t\tmakeTestEndpointSlice(\"ns1\", \"svc1\", 1, func(eps *discovery.EndpointSlice) {\n\t\t\teps.AddressType = discovery.AddressTypeIPv4\n\t\t\teps.Endpoints = []discovery.Endpoint{{\n\t\t\t\tAddresses: []string{\"10.0.1.1\"},\n\t\t\t}}\n\t\t\teps.Ports = []discovery.EndpointPort{{\n\t\t\t\tName: pointer.String(\"p80\"),\n\t\t\t\tPort: pointer.Int32(80),\n\t\t\t\tProtocol: &tcpProtocol,\n\t\t\t}}\n\t\t}),\n\t\tmakeTestEndpointSlice(\"ns2\", \"svc2\", 1, func(eps *discovery.EndpointSlice) {\n\t\t\teps.AddressType = discovery.AddressTypeIPv4\n\t\t\teps.Endpoints = []discovery.Endpoint{{\n\t\t\t\tAddresses: []string{\"10.0.2.1\"},\n\t\t\t}}\n\t\t\teps.Ports = []discovery.EndpointPort{{\n\t\t\t\tName: pointer.String(\"p8080\"),\n\t\t\t\tPort: pointer.Int32(8080),\n\t\t\t\tProtocol: &tcpProtocol,\n\t\t\t}}\n\t\t}),\n\t)\n\n\tfp.syncProxyRules()\n\n\texpected := dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-SNQ3ZNILQDEJNDQO - [0:0]\n\t\t:KUBE-SEP-UHEGFW77JX3KXTOV - [0:0]\n\t\t:KUBE-SVC-2VJB64SDSIJUP5T6 - [0:0]\n\t\t:KUBE-SVC-XPGD46QRK7WJZT7O - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns2/svc2:p8080 cluster IP\" -m tcp -p tcp -d 172.30.0.42 --dport 8080 -j KUBE-SVC-2VJB64SDSIJUP5T6\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-SNQ3ZNILQDEJNDQO -m comment --comment ns1/svc1:p80 -s 10.0.1.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-SNQ3ZNILQDEJNDQO -m comment --comment ns1/svc1:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.1.1:80\n\t\t-A KUBE-SEP-UHEGFW77JX3KXTOV -m comment --comment ns2/svc2:p8080 -s 10.0.2.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-UHEGFW77JX3KXTOV -m comment --comment ns2/svc2:p8080 -m tcp -p tcp -j DNAT --to-destination 10.0.2.1:8080\n\t\t-A KUBE-SVC-2VJB64SDSIJUP5T6 -m comment --comment \"ns2/svc2:p8080 cluster IP\" -m tcp -p tcp -d 172.30.0.42 --dport 8080 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-2VJB64SDSIJUP5T6 -m comment --comment \"ns2/svc2:p8080 -> 10.0.2.1:8080\" -j KUBE-SEP-UHEGFW77JX3KXTOV\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 -> 10.0.1.1:80\" -j KUBE-SEP-SNQ3ZNILQDEJNDQO\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), true, expected, fp.iptablesData.String())\n\n\trulesSynced := countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric := countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\trulesTotal := rulesSynced\n\trulesTotalMetric := countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Add a new service and its endpoints. (This will only sync the SVC and SEP rules\n\t// for the new service, not the existing ones.)\n\tmakeServiceMap(fp,\n\t\tmakeTestService(\"ns3\", \"svc3\", func(svc *v1.Service) {\n\t\t\tsvc.Spec.Type = v1.ServiceTypeClusterIP\n\t\t\tsvc.Spec.ClusterIP = \"172.30.0.43\"\n\t\t\tsvc.Spec.Ports = []v1.ServicePort{{\n\t\t\t\tName: \"p80\",\n\t\t\t\tPort: 80,\n\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t}}\n\t\t}),\n\t)\n\tvar eps3 *discovery.EndpointSlice\n\tpopulateEndpointSlices(fp,\n\t\tmakeTestEndpointSlice(\"ns3\", \"svc3\", 1, func(eps *discovery.EndpointSlice) {\n\t\t\teps3 = eps\n\t\t\teps.AddressType = discovery.AddressTypeIPv4\n\t\t\teps.Endpoints = []discovery.Endpoint{{\n\t\t\t\tAddresses: []string{\"10.0.3.1\"},\n\t\t\t}}\n\t\t\teps.Ports = []discovery.EndpointPort{{\n\t\t\t\tName: pointer.String(\"p80\"),\n\t\t\t\tPort: pointer.Int32(80),\n\t\t\t\tProtocol: &tcpProtocol,\n\t\t\t}}\n\t\t}),\n\t)\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-BSWRHOQ77KEXZLNL - [0:0]\n\t\t:KUBE-SVC-X27LE4BHSL4DOUIK - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns2/svc2:p8080 cluster IP\" -m tcp -p tcp -d 172.30.0.42 --dport 8080 -j KUBE-SVC-2VJB64SDSIJUP5T6\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-BSWRHOQ77KEXZLNL -m comment --comment ns3/svc3:p80 -s 10.0.3.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-BSWRHOQ77KEXZLNL -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.1:80\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.1:80\" -j KUBE-SEP-BSWRHOQ77KEXZLNL\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We added 1 KUBE-SERVICES rule, 2 KUBE-SVC-X27LE4BHSL4DOUIK rules, and 2\n\t// KUBE-SEP-BSWRHOQ77KEXZLNL rules.\n\trulesTotal += 5\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Delete a service. (Won't update the other services.)\n\tfp.OnServiceDelete(svc2)\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-UHEGFW77JX3KXTOV - [0:0]\n\t\t:KUBE-SVC-2VJB64SDSIJUP5T6 - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-X KUBE-SEP-UHEGFW77JX3KXTOV\n\t\t-X KUBE-SVC-2VJB64SDSIJUP5T6\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We deleted 1 KUBE-SERVICES rule, 2 KUBE-SVC-2VJB64SDSIJUP5T6 rules, and 2\n\t// KUBE-SEP-UHEGFW77JX3KXTOV rules\n\trulesTotal -= 5\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Add a service, sync, then add its endpoints. (The first sync will be a no-op other\n\t// than adding the REJECT rule. The second sync will create the new service.)\n\tvar svc4 *v1.Service\n\tmakeServiceMap(fp,\n\t\tmakeTestService(\"ns4\", \"svc4\", func(svc *v1.Service) {\n\t\t\tsvc4 = svc\n\t\t\tsvc.Spec.Type = v1.ServiceTypeClusterIP\n\t\t\tsvc.Spec.ClusterIP = \"172.30.0.44\"\n\t\t\tsvc.Spec.Ports = []v1.ServicePort{{\n\t\t\t\tName: \"p80\",\n\t\t\t\tPort: 80,\n\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t}}\n\t\t}),\n\t)\n\tfp.syncProxyRules()\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns4/svc4:p80 has no endpoints\" -m tcp -p tcp -d 172.30.0.44 --dport 80 -j REJECT\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// The REJECT rule is in \"filter\", not NAT, so the number of NAT rules hasn't\n\t// changed.\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\tpopulateEndpointSlices(fp,\n\t\tmakeTestEndpointSlice(\"ns4\", \"svc4\", 1, func(eps *discovery.EndpointSlice) {\n\t\t\teps.AddressType = discovery.AddressTypeIPv4\n\t\t\teps.Endpoints = []discovery.Endpoint{{\n\t\t\t\tAddresses: []string{\"10.0.4.1\"},\n\t\t\t}}\n\t\t\teps.Ports = []discovery.EndpointPort{{\n\t\t\t\tName: pointer.String(\"p80\"),\n\t\t\t\tPort: pointer.Int32(80),\n\t\t\t\tProtocol: &tcpProtocol,\n\t\t\t}}\n\t\t}),\n\t)\n\tfp.syncProxyRules()\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-AYCN5HPXMIRJNJXU - [0:0]\n\t\t:KUBE-SVC-4SW47YFZTEDKD3PK - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"ns4/svc4:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.44 --dport 80 -j KUBE-SVC-4SW47YFZTEDKD3PK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-AYCN5HPXMIRJNJXU -m comment --comment ns4/svc4:p80 -s 10.0.4.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-AYCN5HPXMIRJNJXU -m comment --comment ns4/svc4:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.4.1:80\n\t\t-A KUBE-SVC-4SW47YFZTEDKD3PK -m comment --comment \"ns4/svc4:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.44 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-4SW47YFZTEDKD3PK -m comment --comment \"ns4/svc4:p80 -> 10.0.4.1:80\" -j KUBE-SEP-AYCN5HPXMIRJNJXU\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We added 1 KUBE-SERVICES rule, 2 KUBE-SVC-4SW47YFZTEDKD3PK rules, and\n\t// 2 KUBE-SEP-AYCN5HPXMIRJNJXU rules\n\trulesTotal += 5\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Change an endpoint of an existing service. This will cause its SVC and SEP\n\t// chains to be rewritten.\n\teps3update := eps3.DeepCopy()\n\teps3update.Endpoints[0].Addresses[0] = \"10.0.3.2\"\n\tfp.OnEndpointSliceUpdate(eps3, eps3update)\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-BSWRHOQ77KEXZLNL - [0:0]\n\t\t:KUBE-SEP-DKCFIS26GWF2WLWC - [0:0]\n\t\t:KUBE-SVC-X27LE4BHSL4DOUIK - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"ns4/svc4:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.44 --dport 80 -j KUBE-SVC-4SW47YFZTEDKD3PK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -s 10.0.3.2 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.2:80\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.2:80\" -j KUBE-SEP-DKCFIS26GWF2WLWC\n\t\t-X KUBE-SEP-BSWRHOQ77KEXZLNL\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We rewrote existing rules but did not change the overall number of rules.\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Add an endpoint to a service. This will cause its SVC and SEP chains to be rewritten.\n\teps3update2 := eps3update.DeepCopy()\n\teps3update2.Endpoints = append(eps3update2.Endpoints, discovery.Endpoint{Addresses: []string{\"10.0.3.3\"}})\n\tfp.OnEndpointSliceUpdate(eps3update, eps3update2)\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-DKCFIS26GWF2WLWC - [0:0]\n\t\t:KUBE-SEP-JVVZVJ7BSEPPRNBS - [0:0]\n\t\t:KUBE-SVC-X27LE4BHSL4DOUIK - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"ns4/svc4:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.44 --dport 80 -j KUBE-SVC-4SW47YFZTEDKD3PK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -s 10.0.3.2 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.2:80\n\t\t-A KUBE-SEP-JVVZVJ7BSEPPRNBS -m comment --comment ns3/svc3:p80 -s 10.0.3.3 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-JVVZVJ7BSEPPRNBS -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.3:80\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.2:80\" -m statistic --mode random --probability 0.5000000000 -j KUBE-SEP-DKCFIS26GWF2WLWC\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.3:80\" -j KUBE-SEP-JVVZVJ7BSEPPRNBS\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We added 2 KUBE-SEP-JVVZVJ7BSEPPRNBS rules and 1 KUBE-SVC-X27LE4BHSL4DOUIK rule\n\t// jumping to the new SEP chain. The other rules related to svc3 got rewritten,\n\t// but that does not change the count of rules.\n\trulesTotal += 3\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Sync with no new changes... This will not rewrite any SVC or SEP chains\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"ns4/svc4:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.44 --dport 80 -j KUBE-SVC-4SW47YFZTEDKD3PK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// (No changes)\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n\n\t// Now force a partial resync error and ensure that it recovers correctly\n\tif fp.needFullSync {\n\t\tt.Fatalf(\"Proxier unexpectedly already needs a full sync?\")\n\t}\n\tprFailures, err := testutil.GetCounterMetricValue(metrics.IptablesPartialRestoreFailuresTotal)\n\tif err != nil {\n\t\tt.Fatalf(\"Could not get partial restore failures metric: %v\", err)\n\t}\n\tif prFailures != 0.0 {\n\t\tt.Errorf(\"Already did a partial resync? Something failed earlier!\")\n\t}\n\n\t// Add a rule jumping from svc3's service chain to svc4's endpoint, then try to\n\t// delete svc4. This will fail because the partial resync won't rewrite svc3's\n\t// rules and so the partial restore would leave a dangling jump from there to\n\t// svc4's endpoint. The proxier will then queue a full resync in response to the\n\t// partial resync failure, and the full resync will succeed (since it will rewrite\n\t// svc3's rules as well).\n\t//\n\t// This is an absurd scenario, but it has to be; partial resync failures are\n\t// supposed to be impossible; if we knew of any non-absurd scenario that would\n\t// cause such a failure, then that would be a bug and we would fix it.\n\tif _, err := fp.iptables.ChainExists(utiliptables.TableNAT, utiliptables.Chain(\"KUBE-SEP-AYCN5HPXMIRJNJXU\")); err != nil {\n\t\tt.Fatalf(\"svc4's endpoint chain unexpected already does not exist!\")\n\t}\n\tif _, err := fp.iptables.EnsureRule(utiliptables.Append, utiliptables.TableNAT, utiliptables.Chain(\"KUBE-SVC-X27LE4BHSL4DOUIK\"), \"-j\", \"KUBE-SEP-AYCN5HPXMIRJNJXU\"); err != nil {\n\t\tt.Fatalf(\"Could not add bad iptables rule: %v\", err)\n\t}\n\n\tfp.OnServiceDelete(svc4)\n\tfp.syncProxyRules()\n\n\tif _, err := fp.iptables.ChainExists(utiliptables.TableNAT, utiliptables.Chain(\"KUBE-SEP-AYCN5HPXMIRJNJXU\")); err != nil {\n\t\tt.Errorf(\"svc4's endpoint chain was successfully deleted despite dangling references!\")\n\t}\n\tif !fp.needFullSync {\n\t\tt.Errorf(\"Proxier did not fail on previous partial resync?\")\n\t}\n\tupdatedPRFailures, err := testutil.GetCounterMetricValue(metrics.IptablesPartialRestoreFailuresTotal)\n\tif err != nil {\n\t\tt.Errorf(\"Could not get partial restore failures metric: %v\", err)\n\t}\n\tif updatedPRFailures != prFailures+1.0 {\n\t\tt.Errorf(\"Partial restore failures metric was not incremented after failed partial resync (expected %.02f, got %.02f)\", prFailures+1.0, updatedPRFailures)\n\t}\n\n\t// On retry we should do a full resync, which should succeed (and delete svc4)\n\tfp.syncProxyRules()\n\n\texpected = dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-AYCN5HPXMIRJNJXU - [0:0]\n\t\t:KUBE-SEP-DKCFIS26GWF2WLWC - [0:0]\n\t\t:KUBE-SEP-JVVZVJ7BSEPPRNBS - [0:0]\n\t\t:KUBE-SEP-SNQ3ZNILQDEJNDQO - [0:0]\n\t\t:KUBE-SVC-4SW47YFZTEDKD3PK - [0:0]\n\t\t:KUBE-SVC-X27LE4BHSL4DOUIK - [0:0]\n\t\t:KUBE-SVC-XPGD46QRK7WJZT7O - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 -j KUBE-SVC-X27LE4BHSL4DOUIK\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -s 10.0.3.2 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-DKCFIS26GWF2WLWC -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.2:80\n\t\t-A KUBE-SEP-JVVZVJ7BSEPPRNBS -m comment --comment ns3/svc3:p80 -s 10.0.3.3 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-JVVZVJ7BSEPPRNBS -m comment --comment ns3/svc3:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.3.3:80\n\t\t-A KUBE-SEP-SNQ3ZNILQDEJNDQO -m comment --comment ns1/svc1:p80 -s 10.0.1.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-SNQ3ZNILQDEJNDQO -m comment --comment ns1/svc1:p80 -m tcp -p tcp -j DNAT --to-destination 10.0.1.1:80\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.43 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.2:80\" -m statistic --mode random --probability 0.5000000000 -j KUBE-SEP-DKCFIS26GWF2WLWC\n\t\t-A KUBE-SVC-X27LE4BHSL4DOUIK -m comment --comment \"ns3/svc3:p80 -> 10.0.3.3:80\" -j KUBE-SEP-JVVZVJ7BSEPPRNBS\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 -> 10.0.1.1:80\" -j KUBE-SEP-SNQ3ZNILQDEJNDQO\n\t\t-X KUBE-SEP-AYCN5HPXMIRJNJXU\n\t\t-X KUBE-SVC-4SW47YFZTEDKD3PK\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), false, expected, fp.iptablesData.String())\n\n\trulesSynced = countRules(utiliptables.TableNAT, expected)\n\trulesSyncedMetric = countRulesFromLastSyncMetric(utiliptables.TableNAT)\n\tif rulesSyncedMetric != rulesSynced {\n\t\tt.Errorf(\"metric shows %d rules synced but iptables data shows %d\", rulesSyncedMetric, rulesSynced)\n\t}\n\n\t// We deleted 1 KUBE-SERVICES rule, 2 KUBE-SVC-4SW47YFZTEDKD3PK rules, and 2\n\t// KUBE-SEP-AYCN5HPXMIRJNJXU rules\n\trulesTotal -= 5\n\trulesTotalMetric = countRulesFromMetric(utiliptables.TableNAT)\n\tif rulesTotalMetric != rulesTotal {\n\t\tt.Errorf(\"metric shows %d rules total but expected %d\", rulesTotalMetric, rulesTotal)\n\t}\n}", "title": "" }, { "docid": "439e8eeb2c75d8a89a6b02091a8a0ce9", "score": "0.5293338", "text": "func resetProxyConfig() {\n}", "title": "" }, { "docid": "7892553a49702f5bdf0f8b7745a86883", "score": "0.52812785", "text": "func update() (changed bool, err error) {\n\tlist, err := endpoints.Get(namespace, endpointName)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif differ(proxies, list) {\n\t\tchanged = true\n\t}\n\tproxies = list\n\n\treturn\n}", "title": "" }, { "docid": "4a0dec70e3cc9dbcb9334e56ebe15f85", "score": "0.52678305", "text": "func (s *DefaultService) setUpNormalEndpoints(hostname string) ([]APIEndpoint, error) {\n\tvar (\n\t\tana = allowNondistributableArtifacts(s.config, hostname)\n\t\tendpoints []APIEndpoint\n\t)\n\n\ttlsConfig, err := s.tlsConfig(hostname)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tendpoints = []APIEndpoint{\n\t\t{\n\t\t\tURL: &url.URL{\n\t\t\t\tScheme: \"https\",\n\t\t\t\tHost: hostname,\n\t\t\t},\n\t\t\tVersion: APIVersion2,\n\t\t\tAllowNondistributableArtifacts: ana,\n\t\t\tTrimHostname: true,\n\t\t\tTLSConfig: tlsConfig,\n\t\t},\n\t}\n\n\tif tlsConfig.InsecureSkipVerify {\n\t\tendpoints = append(endpoints, APIEndpoint{\n\t\t\tURL: &url.URL{\n\t\t\t\tScheme: \"http\",\n\t\t\t\tHost: hostname,\n\t\t\t},\n\t\t\tVersion: APIVersion2,\n\t\t\tAllowNondistributableArtifacts: ana,\n\t\t\tTrimHostname: true,\n\t\t\t// used to check if supposed to be secure via InsecureSkipVerify\n\t\t\tTLSConfig: tlsConfig,\n\t\t})\n\t}\n\n\treturn endpoints, nil\n}", "title": "" }, { "docid": "542c171411465b90c17dcc768e12d5e3", "score": "0.52474886", "text": "func fillProxy(c *installerContext) {\n\tc.proxy = model.Proxy{\n\t\tHttp: os.Getenv(envHTTPProxy),\n\t\tHttps: os.Getenv(envHTTPSProxy),\n\t\tNoProxy: os.Getenv(envNoProxy)}\n}", "title": "" }, { "docid": "930ed6e5da4bb0ce33803a74d5a29fd9", "score": "0.52391857", "text": "func ProxyRequestsWithMissingPermission(cluster framework.Cluster, gateway string, opts ...client.CollectResponsesOptsFn) {\n\tconst PermissionName = \"allow-all-default\"\n\n\tframework.Logf(\"deleting TrafficPermission %q\", PermissionName)\n\tif cluster.GetKubectlOptions() == nil {\n\t\tExpect(cluster.GetKumactlOptions().KumactlDelete(\n\t\t\t\"traffic-permission\", PermissionName, \"default\"),\n\t\t).To(Succeed())\n\t} else {\n\t\tExpect(k8s.RunKubectlE(cluster.GetTesting(), cluster.GetKubectlOptions(),\n\t\t\t\"delete\", \"trafficpermission\", PermissionName),\n\t\t).To(Succeed())\n\t}\n\n\tframework.Logf(\"expecting 503 response from %q\", gateway)\n\tEventually(func(g Gomega) {\n\t\ttarget := fmt.Sprintf(\"http://%s/%s\",\n\t\t\tgateway, path.Join(\"test\", url.PathEscape(GinkgoT().Name())),\n\t\t)\n\n\t\topts = append(opts, client.WithHeader(\"Host\", \"example.kuma.io\"))\n\t\tstatus, err := client.CollectFailure(cluster, \"gateway-client\", target, opts...)\n\n\t\tg.Expect(err).To(Succeed())\n\t\tg.Expect(status.ResponseCode).To(Equal(503))\n\t}, \"30s\", \"1s\").Should(Succeed())\n}", "title": "" }, { "docid": "cf13a3b041c8fbb0dbbcb4be89f42ddc", "score": "0.5229828", "text": "func HandleProxy(w http.ResponseWriter, r *http.Request) {\n\thandleProxy(w, r, \"*\", \"true\")\n}", "title": "" }, { "docid": "47057209e61dde37b6dd9da55059f758", "score": "0.5224102", "text": "func resourceVolterraForwardProxyPolicyCreate(d *schema.ResourceData, meta interface{}) error {\n\tclient := meta.(*APIClient)\n\n\tcreateMeta := &ves_io_schema.ObjectCreateMetaType{}\n\tcreateSpec := &ves_io_schema_views_forward_proxy_policy.CreateSpecType{}\n\tcreateReq := &ves_io_schema_views_forward_proxy_policy.CreateRequest{\n\t\tMetadata: createMeta,\n\t\tSpec: createSpec,\n\t}\n\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\tcreateMeta.Annotations = ms\n\t}\n\n\tif v, ok := d.GetOk(\"description\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Description =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"disable\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.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\tcreateMeta.Labels = ms\n\t}\n\n\tif v, ok := d.GetOk(\"name\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Name =\n\t\t\tv.(string)\n\t}\n\n\tif v, ok := d.GetOk(\"namespace\"); ok && !isIntfNil(v) {\n\t\tcreateMeta.Namespace =\n\t\t\tv.(string)\n\t}\n\n\t//proxy_choice\n\n\tproxyChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"any_proxy\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_AnyProxy{}\n\t\t\tproxyChoiceInt.AnyProxy = &ves_io_schema.Empty{}\n\t\t\tcreateSpec.ProxyChoice = proxyChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"drp_http_connect\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_DrpHttpConnect{}\n\t\t\tproxyChoiceInt.DrpHttpConnect = &ves_io_schema.Empty{}\n\t\t\tcreateSpec.ProxyChoice = proxyChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"network_connector\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_NetworkConnector{}\n\t\tproxyChoiceInt.NetworkConnector = &ves_io_schema_views.ObjectRefType{}\n\t\tcreateSpec.ProxyChoice = proxyChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Name = v.(string)\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Namespace = v.(string)\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tproxyChoiceInt.NetworkConnector.Tenant = v.(string)\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"proxy_label_selector\"); ok && !proxyChoiceTypeFound {\n\n\t\tproxyChoiceTypeFound = true\n\t\tproxyChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_ProxyLabelSelector{}\n\t\tproxyChoiceInt.ProxyLabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\tcreateSpec.ProxyChoice = proxyChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t}\n\t\t\t\tproxyChoiceInt.ProxyLabelSelector.Expressions = ls\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\t//rule_choice\n\n\truleChoiceTypeFound := false\n\n\tif v, ok := d.GetOk(\"allow_all\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\n\t\tif v.(bool) {\n\t\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_AllowAll{}\n\t\t\truleChoiceInt.AllowAll = &ves_io_schema.Empty{}\n\t\t\tcreateSpec.RuleChoice = ruleChoiceInt\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"allow_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_AllowList{}\n\t\truleChoiceInt.AllowList = &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType{}\n\t\tcreateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tdefaultActionChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"default_action_allow\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionAllow{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionAllow = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_deny\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionDeny{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionDeny = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_next_policy\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionNextPolicy{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionNextPolicy = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.AllowList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"dest_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\tdestList := make([]*ves_io_schema.L4DestType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.DestList = destList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\tdestList[i] = &ves_io_schema.L4DestType{}\n\t\t\t\t\tdestListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"port_ranges\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tdestList[i].PortRanges = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"prefixes\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdestList[i].Prefixes = ls\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.HttpList = httpList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\truleChoiceInt.AllowList.TlsList = tlsList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"deny_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_DenyList{}\n\t\truleChoiceInt.DenyList = &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType{}\n\t\tcreateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tdefaultActionChoiceTypeFound := false\n\n\t\t\tif v, ok := cs[\"default_action_allow\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionAllow{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionAllow = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_deny\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionDeny{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionDeny = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"default_action_next_policy\"]; ok && !isIntfNil(v) && !defaultActionChoiceTypeFound {\n\n\t\t\t\tdefaultActionChoiceTypeFound = true\n\n\t\t\t\tif v.(bool) {\n\t\t\t\t\tdefaultActionChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxySimpleRuleType_DefaultActionNextPolicy{}\n\t\t\t\t\tdefaultActionChoiceInt.DefaultActionNextPolicy = &ves_io_schema.Empty{}\n\t\t\t\t\truleChoiceInt.DenyList.DefaultActionChoice = defaultActionChoiceInt\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"dest_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\tdestList := make([]*ves_io_schema.L4DestType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.DestList = destList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\tdestList[i] = &ves_io_schema.L4DestType{}\n\t\t\t\t\tdestListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"port_ranges\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tdestList[i].PortRanges = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := destListMapStrToI[\"prefixes\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\tls := make([]string, len(w.([]interface{})))\n\t\t\t\t\t\tfor i, v := range w.([]interface{}) {\n\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdestList[i].Prefixes = ls\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.HttpList = httpList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\truleChoiceInt.DenyList.TlsList = tlsList\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tif v, ok := d.GetOk(\"rule_list\"); ok && !ruleChoiceTypeFound {\n\n\t\truleChoiceTypeFound = true\n\t\truleChoiceInt := &ves_io_schema_views_forward_proxy_policy.CreateSpecType_RuleList{}\n\t\truleChoiceInt.RuleList = &ves_io_schema_views_forward_proxy_policy.ForwardProxyRuleListType{}\n\t\tcreateSpec.RuleChoice = ruleChoiceInt\n\n\t\tsl := v.(*schema.Set).List()\n\t\tfor _, set := range sl {\n\t\t\tcs := set.(map[string]interface{})\n\n\t\t\tif v, ok := cs[\"rules\"]; ok && !isIntfNil(v) {\n\n\t\t\t\tsl := v.([]interface{})\n\t\t\t\trules := make([]*ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType, len(sl))\n\t\t\t\truleChoiceInt.RuleList.Rules = rules\n\t\t\t\tfor i, set := range sl {\n\t\t\t\t\trules[i] = &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType{}\n\t\t\t\t\trulesMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"action\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\trules[i].Action = ves_io_schema_policy.RuleAction(ves_io_schema_policy.RuleAction_value[v.(string)])\n\n\t\t\t\t\t}\n\n\t\t\t\t\tdestinationChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"all_destinations\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_AllDestinations{}\n\t\t\t\t\t\t\tdestinationChoiceInt.AllDestinations = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_asn_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstAsnList{}\n\t\t\t\t\t\tdestinationChoiceInt.DstAsnList = &ves_io_schema_policy.AsnMatchList{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"as_numbers\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]uint32, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = uint32(v.(int))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnList.AsNumbers = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_asn_set\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstAsnSet{}\n\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstAsnSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_ip_prefix_set\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstIpPrefixSet{}\n\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstIpPrefixSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_label_selector\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstLabelSelector{}\n\t\t\t\t\t\tdestinationChoiceInt.DstLabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstLabelSelector.Expressions = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"dst_prefix_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_DstPrefixList{}\n\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList = &ves_io_schema_views.PrefixStringListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ipv6_prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList.Ipv6Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.DstPrefixList.Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"http_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_HttpList{}\n\t\t\t\t\t\tdestinationChoiceInt.HttpList = &ves_io_schema_views_forward_proxy_policy.URLListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"http_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\t\t\thttpList := make([]*ves_io_schema_views_forward_proxy_policy.URLType, len(sl))\n\t\t\t\t\t\t\t\tdestinationChoiceInt.HttpList.HttpList = httpList\n\t\t\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\t\t\thttpList[i] = &ves_io_schema_views_forward_proxy_policy.URLType{}\n\t\t\t\t\t\t\t\t\thttpListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_ExactValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_RegexValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_SuffixValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tpathChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"any_path\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\n\t\t\t\t\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_AnyPath{}\n\t\t\t\t\t\t\t\t\t\t\tpathChoiceInt.AnyPath = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_exact_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathExactValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_prefix_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathPrefixValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathPrefixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := httpListMapStrToI[\"path_regex_value\"]; ok && !isIntfNil(v) && !pathChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt := &ves_io_schema_views_forward_proxy_policy.URLType_PathRegexValue{}\n\n\t\t\t\t\t\t\t\t\t\thttpList[i].PathChoice = pathChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tpathChoiceInt.PathRegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"tls_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_TlsList{}\n\t\t\t\t\t\tdestinationChoiceInt.TlsList = &ves_io_schema_views_forward_proxy_policy.DomainListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tls_list\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsl := v.([]interface{})\n\t\t\t\t\t\t\t\ttlsList := make([]*ves_io_schema.DomainType, len(sl))\n\t\t\t\t\t\t\t\tdestinationChoiceInt.TlsList.TlsList = tlsList\n\t\t\t\t\t\t\t\tfor i, set := range sl {\n\t\t\t\t\t\t\t\t\ttlsList[i] = &ves_io_schema.DomainType{}\n\t\t\t\t\t\t\t\t\ttlsListMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound := false\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"exact_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_ExactValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.ExactValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"regex_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_RegexValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.RegexValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tif v, ok := tlsListMapStrToI[\"suffix_value\"]; ok && !isIntfNil(v) && !domainChoiceTypeFound {\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceTypeFound = true\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt := &ves_io_schema.DomainType_SuffixValue{}\n\n\t\t\t\t\t\t\t\t\t\ttlsList[i].DomainChoice = domainChoiceInt\n\n\t\t\t\t\t\t\t\t\t\tdomainChoiceInt.SuffixValue = v.(string)\n\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"url_category_list\"]; ok && !isIntfNil(v) && !destinationChoiceTypeFound {\n\n\t\t\t\t\t\tdestinationChoiceTypeFound = true\n\t\t\t\t\t\tdestinationChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_UrlCategoryList{}\n\t\t\t\t\t\tdestinationChoiceInt.UrlCategoryList = &ves_io_schema_views_forward_proxy_policy.URLCategoryListType{}\n\t\t\t\t\t\trules[i].DestinationChoice = destinationChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"url_categories\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\turl_categoriesList := []ves_io_schema_policy.URLCategory{}\n\t\t\t\t\t\t\t\tfor _, j := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\turl_categoriesList = append(url_categoriesList, ves_io_schema_policy.URLCategory(ves_io_schema_policy.URLCategory_value[j.(string)]))\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tdestinationChoiceInt.UrlCategoryList.UrlCategories = url_categoriesList\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\thttpConnectChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"no_http_connect_port\"]; ok && !isIntfNil(v) && !httpConnectChoiceTypeFound {\n\n\t\t\t\t\t\thttpConnectChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\thttpConnectChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_NoHttpConnectPort{}\n\t\t\t\t\t\t\thttpConnectChoiceInt.NoHttpConnectPort = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].HttpConnectChoice = httpConnectChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"port_matcher\"]; ok && !isIntfNil(v) && !httpConnectChoiceTypeFound {\n\n\t\t\t\t\t\thttpConnectChoiceTypeFound = true\n\t\t\t\t\t\thttpConnectChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_PortMatcher{}\n\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher = &ves_io_schema_policy.PortMatcherType{}\n\t\t\t\t\t\trules[i].HttpConnectChoice = httpConnectChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"invert_matcher\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher.InvertMatcher = v.(bool)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ports\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\thttpConnectChoiceInt.PortMatcher.Ports = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"metadata\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tmetadata := &ves_io_schema.MessageMetaType{}\n\t\t\t\t\t\trules[i].Metadata = metadata\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tmetadataMapStrToI := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"description\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Description = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"disable\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Disable = w.(bool)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif w, ok := metadataMapStrToI[\"name\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\t\t\tmetadata.Name = w.(string)\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := rulesMapStrToI[\"rule_description\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\trules[i].RuleDescription = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tif w, ok := rulesMapStrToI[\"rule_name\"]; ok && !isIntfNil(w) {\n\t\t\t\t\t\trules[i].RuleName = w.(string)\n\t\t\t\t\t}\n\n\t\t\t\t\tsourceChoiceTypeFound := false\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"all_sources\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_AllSources{}\n\t\t\t\t\t\t\tsourceChoiceInt.AllSources = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"inside_sources\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\n\t\t\t\t\t\tif v.(bool) {\n\t\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_InsideSources{}\n\t\t\t\t\t\t\tsourceChoiceInt.InsideSources = &ves_io_schema.Empty{}\n\t\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"interface\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_Interface{}\n\t\t\t\t\t\tsourceChoiceInt.Interface = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.Interface.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"ip_prefix_set\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_IpPrefixSet{}\n\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet = &ves_io_schema_views.ObjectRefType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"name\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Name = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"namespace\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Namespace = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"tenant\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tsourceChoiceInt.IpPrefixSet.Tenant = v.(string)\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"label_selector\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_LabelSelector{}\n\t\t\t\t\t\tsourceChoiceInt.LabelSelector = &ves_io_schema.LabelSelectorType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"expressions\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.LabelSelector.Expressions = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"namespace\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_Namespace{}\n\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsourceChoiceInt.Namespace = v.(string)\n\n\t\t\t\t\t}\n\n\t\t\t\t\tif v, ok := rulesMapStrToI[\"prefix_list\"]; ok && !isIntfNil(v) && !sourceChoiceTypeFound {\n\n\t\t\t\t\t\tsourceChoiceTypeFound = true\n\t\t\t\t\t\tsourceChoiceInt := &ves_io_schema_views_forward_proxy_policy.ForwardProxyAdvancedRuleType_PrefixList{}\n\t\t\t\t\t\tsourceChoiceInt.PrefixList = &ves_io_schema_views.PrefixStringListType{}\n\t\t\t\t\t\trules[i].SourceChoice = sourceChoiceInt\n\n\t\t\t\t\t\tsl := v.(*schema.Set).List()\n\t\t\t\t\t\tfor _, set := range sl {\n\t\t\t\t\t\t\tcs := set.(map[string]interface{})\n\n\t\t\t\t\t\t\tif v, ok := cs[\"ipv6_prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.PrefixList.Ipv6Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif v, ok := cs[\"prefixes\"]; ok && !isIntfNil(v) {\n\n\t\t\t\t\t\t\t\tls := make([]string, len(v.([]interface{})))\n\t\t\t\t\t\t\t\tfor i, v := range v.([]interface{}) {\n\t\t\t\t\t\t\t\t\tls[i] = v.(string)\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsourceChoiceInt.PrefixList.Prefixes = ls\n\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tlog.Printf(\"[DEBUG] Creating Volterra ForwardProxyPolicy object with struct: %+v\", createReq)\n\n\tcreateForwardProxyPolicyResp, err := client.CreateObject(context.Background(), ves_io_schema_views_forward_proxy_policy.ObjectType, createReq)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating ForwardProxyPolicy: %s\", err)\n\t}\n\td.SetId(createForwardProxyPolicyResp.GetObjSystemMetadata().GetUid())\n\n\treturn resourceVolterraForwardProxyPolicyRead(d, meta)\n}", "title": "" }, { "docid": "db5f421ee3c81248eaf60ee888c31efc", "score": "0.52137756", "text": "func (b *LocalBackend) setServeProxyHandlersLocked() {\n\tif !b.serveConfig.Valid() {\n\t\treturn\n\t}\n\tvar backends map[string]bool\n\tb.serveConfig.Web().Range(func(_ ipn.HostPort, conf ipn.WebServerConfigView) (cont bool) {\n\t\tconf.Handlers().Range(func(_ string, h ipn.HTTPHandlerView) (cont bool) {\n\t\t\tbackend := h.Proxy()\n\t\t\tif backend == \"\" {\n\t\t\t\t// Only create proxy handlers for servers with a proxy backend.\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tmak.Set(&backends, backend, true)\n\t\t\tif _, ok := b.serveProxyHandlers.Load(backend); ok {\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tb.logf(\"serve: creating a new proxy handler for %s\", backend)\n\t\t\tp, err := b.proxyHandlerForBackend(backend)\n\t\t\tif err != nil {\n\t\t\t\t// The backend endpoint (h.Proxy) should have been validated by expandProxyTarget\n\t\t\t\t// in the CLI, so just log the error here.\n\t\t\t\tb.logf(\"[unexpected] could not create proxy for %v: %s\", backend, err)\n\t\t\t\treturn true\n\t\t\t}\n\t\t\tb.serveProxyHandlers.Store(backend, p)\n\t\t\treturn true\n\t\t})\n\t\treturn true\n\t})\n\n\t// Clean up handlers for proxy backends that are no longer present\n\t// in configuration.\n\tb.serveProxyHandlers.Range(func(key, value any) bool {\n\t\tbackend := key.(string)\n\t\tif !backends[backend] {\n\t\t\tb.logf(\"serve: closing idle connections to %s\", backend)\n\t\t\tvalue.(*httputil.ReverseProxy).Transport.(*http.Transport).CloseIdleConnections()\n\t\t\tb.serveProxyHandlers.Delete(backend)\n\t\t}\n\t\treturn true\n\t})\n}", "title": "" }, { "docid": "a49e0f9419f7e8640b03d47c243af971", "score": "0.5200444", "text": "func useProxy(noProxy, addr string) bool {\n\tif len(addr) == 0 {\n\t\treturn true\n\t}\n\n\tif noProxy == \"*\" {\n\t\treturn false\n\t}\n\n\taddr = strings.ToLower(strings.TrimSpace(addr))\n\tif hasPort(addr) {\n\t\taddr = addr[:strings.LastIndex(addr, \":\")]\n\t}\n\n\tfor _, p := range strings.Split(noProxy, \",\") {\n\t\tp = strings.ToLower(strings.TrimSpace(p))\n\t\tif len(p) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif hasPort(p) {\n\t\t\tp = p[:strings.LastIndex(p, \":\")]\n\t\t}\n\t\tif addr == p {\n\t\t\treturn false\n\t\t}\n\t\tif p[0] == '.' && (strings.HasSuffix(addr, p) || addr == p[1:]) {\n\t\t\t// noProxy \".foo.com\" matches \"bar.foo.com\" or \"foo.com\"\n\t\t\treturn false\n\t\t}\n\t\tif p[0] != '.' && strings.HasSuffix(addr, p) && addr[len(addr)-len(p)-1] == '.' {\n\t\t\t// noProxy \"foo.com\" matches \"bar.foo.com\"\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "14ce6c20360f2ec0c7948e3b81d7b268", "score": "0.51830137", "text": "func RegisterProxyRoutes() error {\n\n\tdefaultOrigin := \"\"\n\tvar ndo *config.OriginConfig // points to the origin config named \"default\"\n\tvar cdo *config.OriginConfig // points to the origin config with IsDefault set to true\n\n\t// This iteration will ensure default origins are handled properly\n\tfor k, o := range config.Origins {\n\n\t\tif !config.IsValidOriginType(o.OriginType) {\n\t\t\treturn fmt.Errorf(`unknown origin type in origin config. originName: %s, originType: %s`, k, o.OriginType)\n\t\t}\n\n\t\t// Ensure only one default origin exists\n\t\tif o.IsDefault {\n\t\t\tif cdo != nil {\n\t\t\t\treturn fmt.Errorf(\"only one origin can be marked as default. Found both %s and %s\", defaultOrigin, k)\n\t\t\t}\n\t\t\tlog.Debug(\"default origin identified\", log.Pairs{\"name\": k})\n\t\t\tdefaultOrigin = k\n\t\t\tcdo = o\n\t\t\tcontinue\n\t\t}\n\n\t\t// handle origin named \"default\" last as it needs special handling based on a full pass over the range\n\t\tif k == \"default\" {\n\t\t\tndo = o\n\t\t\tcontinue\n\t\t}\n\n\t\terr := registerOriginRoutes(k, o)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif ndo != nil {\n\t\tif cdo == nil {\n\t\t\tndo.IsDefault = true\n\t\t\tcdo = ndo\n\t\t\tdefaultOrigin = \"default\"\n\t\t} else {\n\t\t\terr := registerOriginRoutes(\"default\", ndo)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\n\tif cdo != nil {\n\t\treturn registerOriginRoutes(defaultOrigin, cdo)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f184811a45d903da42e608e2343d8ece", "score": "0.51705813", "text": "func (route *Route) handleEndpoints() {\n\troute.getEndpoints()\n\tif route.endpoints == nil {\n\t\tif client.BackendServerDeleteAll(route.BackendName) {\n\t\t\troute.reload = true\n\t\t}\n\t\treturn\n\t}\n\troute.endpoints.BackendName = route.BackendName\n\troute.alignHAProxySrvs()\n\tactiveAnnotations := route.getServerAnnotations()\n\tfor srvName, srv := range route.endpoints.HAProxySrvs {\n\t\tif srv.Modified || route.NewBackend || activeAnnotations {\n\t\t\troute.handleHAProxSrv(srvName, srv.Address)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f92880c69e52ed0fbb7fe23c22302e0a", "score": "0.51561743", "text": "func reverseProxy(c *gin.Context) {\n\tif !strings.HasSuffix(c.Request.Host, rootDomain) && !strings.HasSuffix(c.Request.Host, rootDomainWithPort) {\n\t\tc.AbortWithStatusJSON(403, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": \"Incorrect root domain\",\n\t\t})\n\t\treturn\n\t}\n\n\tname := strings.Split(c.Request.Host, \".\")[0]\n\tvar proxy *types.ProxyInfo\n\tvar success bool\n\n\tif utils.Contains(balancedInstances, name) {\n\t\tproxy, success = masterBalancer.Get()\n\t} else {\n\t\tproxy, success = storage.Get(name)\n\t}\n\n\tif !success {\n\t\tc.AbortWithStatusJSON(503, gin.H{\n\t\t\t\"success\": false,\n\t\t\t\"message\": \"No such application exists\",\n\t\t})\n\t\treturn\n\t}\n\tproxy.Serve(c)\n}", "title": "" }, { "docid": "7588381f63b29079245baae7942bc970", "score": "0.515319", "text": "func TestNonLocalExternalIPs(t *testing.T) {\n\tipt := iptablestest.NewFake()\n\tfp := NewFakeProxier(ipt)\n\tsvcIP := \"172.30.0.41\"\n\tsvcPort := 80\n\tsvcExternalIPs := \"192.168.99.11\"\n\tsvcPortName := proxy.ServicePortName{\n\t\tNamespacedName: makeNSN(\"ns1\", \"svc1\"),\n\t\tPort: \"p80\",\n\t}\n\n\tmakeServiceMap(fp,\n\t\tmakeTestService(svcPortName.Namespace, svcPortName.Name, func(svc *v1.Service) {\n\t\t\tsvc.Spec.ClusterIP = svcIP\n\t\t\tsvc.Spec.ExternalIPs = []string{svcExternalIPs}\n\t\t\tsvc.Spec.Ports = []v1.ServicePort{{\n\t\t\t\tName: svcPortName.Port,\n\t\t\t\tPort: int32(svcPort),\n\t\t\t\tProtocol: v1.ProtocolTCP,\n\t\t\t\tTargetPort: intstr.FromInt32(int32(svcPort)),\n\t\t\t}}\n\t\t}),\n\t)\n\tepIP1 := \"10.180.0.1\"\n\tepIP2 := \"10.180.2.1\"\n\tpopulateEndpointSlices(fp,\n\t\tmakeTestEndpointSlice(svcPortName.Namespace, svcPortName.Name, 1, func(eps *discovery.EndpointSlice) {\n\t\t\teps.AddressType = discovery.AddressTypeIPv4\n\t\t\teps.Endpoints = []discovery.Endpoint{{\n\t\t\t\tAddresses: []string{epIP1},\n\t\t\t\tNodeName: nil,\n\t\t\t}, {\n\t\t\t\tAddresses: []string{epIP2},\n\t\t\t\tNodeName: pointer.String(testHostname),\n\t\t\t}}\n\t\t\teps.Ports = []discovery.EndpointPort{{\n\t\t\t\tName: pointer.String(svcPortName.Port),\n\t\t\t\tPort: pointer.Int32(int32(svcPort)),\n\t\t\t\tProtocol: &tcpProtocol,\n\t\t\t}}\n\t\t}),\n\t)\n\n\tfp.syncProxyRules()\n\n\texpected := dedent.Dedent(`\n\t\t*filter\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXTERNAL-SERVICES - [0:0]\n\t\t:KUBE-FIREWALL - [0:0]\n\t\t:KUBE-FORWARD - [0:0]\n\t\t:KUBE-PROXY-FIREWALL - [0:0]\n\t\t-A KUBE-FIREWALL -m comment --comment \"block incoming localnet connections\" -d 127.0.0.0/8 ! -s 127.0.0.0/8 -m conntrack ! --ctstate RELATED,ESTABLISHED,DNAT -j DROP\n\t\t-A KUBE-FORWARD -m conntrack --ctstate INVALID -j DROP\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding rules\" -m mark --mark 0x4000/0x4000 -j ACCEPT\n\t\t-A KUBE-FORWARD -m comment --comment \"kubernetes forwarding conntrack rule\" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT\n\t\tCOMMIT\n\t\t*nat\n\t\t:KUBE-NODEPORTS - [0:0]\n\t\t:KUBE-SERVICES - [0:0]\n\t\t:KUBE-EXT-XPGD46QRK7WJZT7O - [0:0]\n\t\t:KUBE-MARK-MASQ - [0:0]\n\t\t:KUBE-POSTROUTING - [0:0]\n\t\t:KUBE-SEP-SXIVWICOYRO3J4NJ - [0:0]\n\t\t:KUBE-SEP-ZX7GRIZKSNUQ3LAJ - [0:0]\n\t\t:KUBE-SVC-XPGD46QRK7WJZT7O - [0:0]\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"ns1/svc1:p80 external IP\" -m tcp -p tcp -d 192.168.99.11 --dport 80 -j KUBE-EXT-XPGD46QRK7WJZT7O\n\t\t-A KUBE-SERVICES -m comment --comment \"kubernetes service nodeports; NOTE: this must be the last rule in this chain\" -m addrtype --dst-type LOCAL -j KUBE-NODEPORTS\n\t\t-A KUBE-EXT-XPGD46QRK7WJZT7O -m comment --comment \"masquerade traffic for ns1/svc1:p80 external destinations\" -j KUBE-MARK-MASQ\n\t\t-A KUBE-EXT-XPGD46QRK7WJZT7O -j KUBE-SVC-XPGD46QRK7WJZT7O\n\t\t-A KUBE-MARK-MASQ -j MARK --or-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m mark ! --mark 0x4000/0x4000 -j RETURN\n\t\t-A KUBE-POSTROUTING -j MARK --xor-mark 0x4000\n\t\t-A KUBE-POSTROUTING -m comment --comment \"kubernetes service traffic requiring SNAT\" -j MASQUERADE\n\t\t-A KUBE-SEP-SXIVWICOYRO3J4NJ -m comment --comment ns1/svc1:p80 -s 10.180.0.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-SXIVWICOYRO3J4NJ -m comment --comment ns1/svc1:p80 -m tcp -p tcp -j DNAT --to-destination 10.180.0.1:80\n\t\t-A KUBE-SEP-ZX7GRIZKSNUQ3LAJ -m comment --comment ns1/svc1:p80 -s 10.180.2.1 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SEP-ZX7GRIZKSNUQ3LAJ -m comment --comment ns1/svc1:p80 -m tcp -p tcp -j DNAT --to-destination 10.180.2.1:80\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 cluster IP\" -m tcp -p tcp -d 172.30.0.41 --dport 80 ! -s 10.0.0.0/8 -j KUBE-MARK-MASQ\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 -> 10.180.0.1:80\" -m statistic --mode random --probability 0.5000000000 -j KUBE-SEP-SXIVWICOYRO3J4NJ\n\t\t-A KUBE-SVC-XPGD46QRK7WJZT7O -m comment --comment \"ns1/svc1:p80 -> 10.180.2.1:80\" -j KUBE-SEP-ZX7GRIZKSNUQ3LAJ\n\t\tCOMMIT\n\t\t`)\n\tassertIPTablesRulesEqual(t, getLine(), true, expected, fp.iptablesData.String())\n\n\trunPacketFlowTests(t, getLine(), ipt, testNodeIP, []packetFlowTest{\n\t\t{\n\t\t\tname: \"pod to cluster IP\",\n\t\t\tsourceIP: \"10.0.0.2\",\n\t\t\tdestIP: svcIP,\n\t\t\tdestPort: svcPort,\n\t\t\toutput: fmt.Sprintf(\"%s:%d, %s:%d\", epIP1, svcPort, epIP2, svcPort),\n\t\t\tmasq: false,\n\t\t},\n\t\t{\n\t\t\tname: \"external to external IP\",\n\t\t\tsourceIP: testExternalClient,\n\t\t\tdestIP: svcExternalIPs,\n\t\t\tdestPort: svcPort,\n\t\t\toutput: fmt.Sprintf(\"%s:%d, %s:%d\", epIP1, svcPort, epIP2, svcPort),\n\t\t\tmasq: true,\n\t\t},\n\t})\n}", "title": "" }, { "docid": "0a210427e1c6d3f6c6ea441466a4e653", "score": "0.51501495", "text": "func (route *Route) handleEndpoints() {\n\troute.getEndpoints()\n\tif route.endpoints == nil {\n\t\treturn\n\t}\n\troute.endpoints.BackendName = route.BackendName\n\tif route.service.DNS == \"\" {\n\t\troute.scaleHAProxySrvs()\n\t}\n\tactiveAnnotations := route.getServerAnnotations()\n\tfor srvName, srv := range route.endpoints.HAProxySrvs {\n\t\tif srv.Modified || route.NewBackend || activeAnnotations {\n\t\t\troute.handleHAProxSrv(srvName, srv.Address)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1d9955c5ffd3186c2fac0acefaf252f4", "score": "0.5147466", "text": "func (t *Transport) Proxy() bool {\n\treturn false\n}", "title": "" }, { "docid": "7ff69429bf5f522ead23d1d08eea114a", "score": "0.5139803", "text": "func (e *endpointManager) SelectAdapterProxy(msg *Message) (*AdapterProxy, bool) {\n\te.epLock.Lock()\n\teps := e.activeEp[:]\n\te.epLock.Unlock()\n\n\tif e.directProxy && len(eps) == 0 {\n\t\treturn nil, false\n\t}\n\tif !e.directProxy && len(e.activeEpf) == 0 {\n\t\treturn nil, false\n\t}\n\tselect {\n\tcase adp := <-e.checkAdapter:\n\t\tTLOG.Errorf(\"SelectAdapterProxy|check adapter, ep: %+v\", adp.GetPoint())\n\t\te.checkAdapterList.Delete(endpoint.Tars2endpoint(*adp.GetPoint()).Key)\n\t\treturn adp, true\n\tdefault:\n\t}\n\tvar (\n\t\tadp *AdapterProxy\n\t\tep endpoint.Endpoint\n\t\terr error\n\t)\n\tif msg.isHash && msg.hashType == ConsistentHash {\n\t\tep, err = e.activeEpConHash.Select(msg) // ConsistentHash\n\t} else if msg.isHash && msg.hashType == ModHash {\n\t\tep, err = e.activeEpModHash.Select(msg) // ModHash\n\t} else {\n\t\tep, err = e.activeEpRoundRobin.Select(msg) // RoundRobin\n\t}\n\tif err != nil {\n\t\tTLOG.Errorf(\"SelectAdapterProxy|enableWeight: %v, isHash: %b, hashType: %s, hashCode: %d, err: %v\", e.enableWeight(), msg.isHash, msg.hashType, msg.hashCode, err)\n\t\tgoto random\n\t}\n\tif v, ok := e.epList.Load(ep.Key); ok {\n\t\tadp = v.(*AdapterProxy)\n\t} else {\n\t\tepf := endpoint.Endpoint2tars(ep)\n\t\tadp = NewAdapterProxy(e.objName, &epf, e.comm)\n\t\te.epList.Store(ep.Key, adp)\n\t}\nrandom:\n\tif adp == nil && !e.directProxy {\n\t\t// not any node is alive, just select a random one.\n\t\trandomEpf := e.activeEpf[e.rand.Intn(len(e.activeEpf))]\n\t\trandomEp := endpoint.Tars2endpoint(randomEpf)\n\t\tif v, ok := e.epList.Load(randomEp.Key); ok {\n\t\t\tadp = v.(*AdapterProxy)\n\t\t} else {\n\t\t\tadp = NewAdapterProxy(e.objName, &randomEpf, e.comm)\n\t\t\te.epList.Store(randomEp.Key, adp)\n\t\t}\n\t}\n\treturn adp, false\n}", "title": "" }, { "docid": "0676eb0f412208c9c218602ffc768805", "score": "0.5138672", "text": "func (o *SyntheticsTestRequest) HasProxy() bool {\n\tif o != nil && o.Proxy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ef0220142762cc631c0b933d09f9968e", "score": "0.51128376", "text": "func (m *Windows10GeneralConfiguration) SetNetworkProxyDisableAutoDetect(value *bool)() {\n m.networkProxyDisableAutoDetect = value\n}", "title": "" }, { "docid": "35c51bf576e83d8049ad5c005be64de6", "score": "0.511224", "text": "func SetProxy(p string, verifyssl bool){\n if p != \"\" && p != \"none\" {\n proxyUrl, _ := url.Parse(p)\n client = &http.Client{Transport: &http.Transport{Proxy: http.ProxyURL(proxyUrl), TLSClientConfig: &tls.Config{InsecureSkipVerify: verifyssl}}}\n } else {\n client = &http.Client{Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: verifyssl}}}\n }\n}", "title": "" }, { "docid": "ca450990804c7a06d215ad7ec4957a29", "score": "0.50898916", "text": "func (a *Account) EnsureTorProxy(torAddress string) {\n\tif !a.RequireTor {\n\t\treturn\n\t}\n\n\tif a.Proxies == nil {\n\t\ta.Proxies = make([]string, 0, 1)\n\t}\n\n\tfor _, proxy := range a.Proxies {\n\t\tp, err := url.Parse(proxy)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\t//Already configured\n\t\tif p.Host == torAddress {\n\t\t\treturn\n\t\t}\n\t}\n\n\t//Tor refuses to connect to any other proxy at localhost/127.0.0.1 in the\n\t//chain, so we remove them\n\tallowedProxies := make([]string, 0, len(a.Proxies))\n\tfor _, proxy := range a.Proxies {\n\t\tp, err := url.Parse(proxy)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\thost, _, err := net.SplitHostPort(p.Host)\n\t\tif err != nil {\n\t\t\thost = p.Host\n\t\t}\n\n\t\tif host == \"localhost\" || host == \"127.0.0.1\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tallowedProxies = append(allowedProxies, proxy)\n\t}\n\n\ttorProxy := newTorProxy(torAddress)\n\tallowedProxies = append(allowedProxies, torProxy)\n\ta.Proxies = allowedProxies\n}", "title": "" }, { "docid": "438311579e9b6de9db21c5e928582b27", "score": "0.50814956", "text": "func GenerateProxy(conf routing.Config) http.Handler {\n\tproxy := &httputil.ReverseProxy{\n\t\tDirector: func(req *http.Request) {\n\t\t\treq.Header.Add(\"X-Router-Upstream\", conf.Upstream.Name)\n\t\t\treq.Header.Add(\"X-Router-Upstream-OriginalHost\", conf.Upstream.Host)\n\t\t\treq.Header.Add(\"X-Router-Upstream-OriginalPath\", req.URL.Path)\n\t\t\treq.Header.Add(\"X-Forwarded-Host\", req.Host)\n\t\t\treq.Header.Add(\"X-Origin-Host\", conf.Upstream.Host)\n\n\t\t\t// This was done to unblock the ability to test the code, but it would be\n\t\t\t// better if there were no references to testing within the code itself,\n\t\t\t// so I think the only way to solve this would be to inject the\n\t\t\t// modifications as a func dependency so we could modify the request\n\t\t\t// object differently depending on the runtime environment context.\n\t\t\tif req.Header.Get(\"X-Testing\") != \"true\" {\n\t\t\t\treq.URL.Scheme = \"https\"\n\t\t\t}\n\n\t\t\t// some upstreams will reject a request if the given Host HTTP header\n\t\t\t// isn't recognised, and so we always make sure to tweak that header\n\t\t\t// so it isn't set to the proxy's host value, but set to the upsteam's.\n\t\t\treq.Host = conf.Upstream.Host\n\t\t\treq.URL.Host = conf.Upstream.Host\n\n\t\t\tif conf.ModifyPath != \"\" {\n\t\t\t\tmodifyPath(req, conf.ModifyPath)\n\t\t\t}\n\n\t\t\tif conf.Override.Header != \"\" && conf.Override.Match != \"\" {\n\t\t\t\toverrideHeader(req, conf.Override)\n\t\t\t}\n\n\t\t\tif conf.Override.Query != \"\" && conf.Override.Match != \"\" {\n\t\t\t\toverrideQuery(req, conf.Override)\n\t\t\t}\n\n\t\t\tcleanUpQueryString(req)\n\n\t\t\tlog.Printf(\"request: %s\\n\", req.URL)\n\t\t},\n\t\tTransport: &http.Transport{\n\t\t\tDial: (&net.Dialer{\n\t\t\t\tTimeout: 5 * time.Second,\n\t\t\t}).Dial,\n\t\t},\n\t\tModifyResponse: func(r *http.Response) error {\n\t\t\tfor _, header := range responseHeaders {\n\t\t\t\tvalue := r.Request.Header.Get(header)\n\n\t\t\t\tif value != \"\" {\n\t\t\t\t\tr.Header.Set(header, value)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\n\treturn proxy\n}", "title": "" }, { "docid": "03ecab7fb7ac5f349a3051c7cfcf911c", "score": "0.5074856", "text": "func proxy(w http.ResponseWriter, req *http.Request) {\n\tdefer printHello(w)\n\n\tif req.URL.Path == proxyPath {\n\t\treturn\n\t}\n\n\tresp, err := http.Get(proxyURL(req.URL))\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusBadGateway)\n\t\treturn\n\t}\n\tdefer resp.Body.Close()\n\n\tif _, err := io.Copy(w, resp.Body); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t}\n}", "title": "" }, { "docid": "3fa8701c4197fa7a98a074c48e630894", "score": "0.50698775", "text": "func setUpTestProxy() {\n\n\tvar err error\n\tvar testProxyPort int32 = 3128\n\tvar testProxyNodePort int32 = 30128\n\tvar testProxyDeploymentReplicas int32 = 1\n\ttestProxyLabels := map[string]string{\"app\": \"test-proxy\"}\n\n\ttestProxyDeployment := appsv1.Deployment{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test-proxy\",\n\t\t\tNamespace: defaultNamespace,\n\t\t},\n\t\tSpec: appsv1.DeploymentSpec{\n\t\t\tSelector: &metav1.LabelSelector{\n\t\t\t\tMatchLabels: testProxyLabels,\n\t\t\t},\n\t\t\tReplicas: &testProxyDeploymentReplicas,\n\t\t\tTemplate: corev1.PodTemplateSpec{\n\t\t\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\t\t\tLabels: testProxyLabels,\n\t\t\t\t},\n\t\t\t\tSpec: corev1.PodSpec{\n\t\t\t\t\tContainers: []corev1.Container{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"ningx\",\n\t\t\t\t\t\t\tImage: \"ubuntu/squid:edge\",\n\t\t\t\t\t\t\tPorts: []corev1.ContainerPort{\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tContainerPort: testProxyPort,\n\t\t\t\t\t\t\t\t\tProtocol: \"TCP\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\terr = k8sClient.Create(ctx, &testProxyDeployment)\n\tExpect(err != nil || errors.IsConflict(err))\n\n\ttestProxyService := corev1.Service{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: \"test-proxy\",\n\t\t\tNamespace: defaultNamespace,\n\t\t},\n\t\tSpec: corev1.ServiceSpec{\n\t\t\tType: corev1.ServiceTypeNodePort,\n\t\t\tSelector: testProxyLabels,\n\t\t\tPorts: []corev1.ServicePort{\n\t\t\t\t{\n\t\t\t\t\tPort: testProxyPort,\n\t\t\t\t\tTargetPort: intstr.IntOrString{IntVal: testProxyPort},\n\t\t\t\t\tNodePort: testProxyNodePort,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\terr = k8sClient.Create(ctx, &testProxyService)\n\tExpect(err != nil || errors.IsConflict(err))\n\n\tproxyUrl, err := url.Parse(fmt.Sprintf(\"http://%s:%d\", clusterUrl.Hostname(), testProxyNodePort))\n\tExpect(err).NotTo(HaveOccurred())\n\n\thttp.DefaultTransport = &http.Transport{Proxy: http.ProxyURL(proxyUrl)}\n}", "title": "" }, { "docid": "6c18ee3869bbeeee198b4ae60d39c1bb", "score": "0.50635564", "text": "func setNoProxyUntil(d time.Duration) {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\tnoProxyUntil = time.Now().Add(d)\n}", "title": "" }, { "docid": "51580f8a63cad06761bd5953a9bf3a94", "score": "0.5024476", "text": "func (r *EnvironmentV1) checkProxy(env string) error {\n\thttpProxy := r.getVariable(env)\n\tif httpProxy == \"\" {\n\t\treturn nil\n\t}\n\tif _, err := utils.ParseProxy(httpProxy); err != nil {\n\t\treturn trace.Wrap(err, \"failed to parse %v\", env)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4cba316c1783b29deac89ffdae9eb708", "score": "0.5014999", "text": "func resync(ctx context.Context, upstreams v1.UpstreamList, client v1.ProxyClient) {\n\tdesiredProxy := makeDesiredProxy(upstreams)\n\n\t// see if the proxy exists. if yes, update; if no, create\n\texistingProxy, err := client.Read(\n\t\tdesiredProxy.Metadata.Namespace,\n\t\tdesiredProxy.Metadata.Name,\n\t\tclients.ReadOpts{Ctx: ctx})\n\n\t// proxy exists! this is an update, not a create\n\tif err == nil {\n\n\t\t// sleep for 1s as Gloo may be re-validating our proxy, which can cause resource version to change\n\t\ttime.Sleep(time.Second)\n\n\t\t// ensure resource version is the latest\n\t\texistingProxy, err = client.Read(\n\t\t\tdesiredProxy.Metadata.Namespace,\n\t\t\tdesiredProxy.Metadata.Name,\n\t\t\tclients.ReadOpts{Ctx: ctx})\n\t\tmust(err)\n\n\t\t// update the resource version on our desired proxy\n\t\tdesiredProxy.Metadata.ResourceVersion = existingProxy.Metadata.ResourceVersion\n\t}\n\n\t// write!\n\twritten, err := client.Write(desiredProxy,\n\t\tclients.WriteOpts{Ctx: ctx, OverwriteExisting: true})\n\n\tmust(err)\n\n\tlog.Printf(\"wrote proxy object: %+v\\n\", written)\n}", "title": "" }, { "docid": "59ed99ef5cd0fbb5399f364d0f2d7f75", "score": "0.5014364", "text": "func (p *proxyrunner) proxyElection(vr *VoteRecord, currPrimaryURL string) {\n\tif p.primary {\n\t\tglog.Infoln(\"Already in Primary state.\")\n\t\treturn\n\t}\n\txele := p.xactinp.renewElection(p, vr)\n\tif xele == nil {\n\t\tglog.Infoln(\"An election is already in progress, returning.\")\n\t\treturn\n\t}\n\tp.doProxyElection(vr, currPrimaryURL, xele)\n\txele.etime = time.Now()\n\tglog.Infoln(xele.tostring())\n\tp.xactinp.del(xele.id) // FIXME - keep it; handle xele.finished() in the renew...\n}", "title": "" }, { "docid": "2f9a39b1ae0a90f5311921d18b71c2f8", "score": "0.50023884", "text": "func needToPoll(syncerKey negtypes.NegSyncerKey, endpointMap negtypes.EndpointPodMap, lookup NegLookup, podLister cache.Indexer) negtypes.EndpointPodMap {\n\tif !lookup.ReadinessGateEnabled(syncerKey) {\n\t\treturn negtypes.EndpointPodMap{}\n\t}\n\tremoveIrrelevantEndpoints(endpointMap, podLister)\n\treturn endpointMap\n}", "title": "" }, { "docid": "37d9a2e1eb3c145433a3495336a960ff", "score": "0.4995421", "text": "func Proxy(req *http.Request) (proxyUrl *url.URL, err error) {\n\tproxyUrl, err = ProxyFromAutoConfig(req)\n\n\tif proxyUrl == nil || err != nil {\n\t\tproxyUrl, err = ProxyFromRegistry(req)\n\t}\n\treturn\n}", "title": "" }, { "docid": "d17840882c8a1a31d4b2a5d4a546d733", "score": "0.4970635", "text": "func (w *Syncer) SyncProxy(object interface{}) error {\n\t_, ok := object.(*apiconfigv1.Proxy)\n\tif !ok {\n\t\tw.logger.Error(\"wrong type in proxy syncer\")\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "471ace05fa91707885109edeeb870051", "score": "0.49702597", "text": "func proxyFactory(protocol string, frontend ProxyAddress, backends ...ProxyAddress) (Proxy, error) {\n\n\tif len(backends) == 0 {\n\t\treturn nil, errors.New(\"default proxy only requies one backend\")\n\t}\n\tif len(backends) > 1 {\n\t\treturn nil, errors.New(\"default proxy only supports one backend\")\n\t}\n\n\tbackendIP := net.ParseIP(backends[0].IP)\n\tif backendIP == nil {\n\t\treturn nil, fmt.Errorf(\"not a valid IP format: %v\", backendIP)\n\t}\n\n\tfrontendIP := net.ParseIP(frontend.IP)\n\tif frontendIP == nil {\n\t\treturn nil, fmt.Errorf(\"not a valid IP format: %v\", frontendIP)\n\t}\n\n\tvar frontendAddr, backendAddr net.Addr\n\tswitch strings.Trim(strings.ToLower(protocol), \" \") {\n\tcase commons.TCP:\n\t\tfrontendAddr = &net.TCPAddr{IP: frontendIP, Port: int(frontend.Port)}\n\t\tbackendAddr = &net.TCPAddr{IP: backendIP, Port: int(backends[0].Port)}\n\n\tcase commons.UDP:\n\t\tfrontendAddr = &net.UDPAddr{IP: frontendIP, Port: int(frontend.Port)}\n\t\tbackendAddr = &net.UDPAddr{IP: backendIP, Port: int(backends[0].Port)}\n\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported protocol %v\", protocol)\n\n\t}\n\n\tproxy, err := proxy.NewProxy(frontendAddr, backendAddr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &proxyWrapper{proxy}, nil\n}", "title": "" }, { "docid": "5ca8bfe2d21ee33ec2f64c2e0c7aaf69", "score": "0.49672306", "text": "func RunWithFallback(goArg []string, url string) error {\n\tserviceManager, err := createGoCentralServiceManager(url)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tartDetails := serviceManager.GetConfig().GetServiceDetails()\n\terr = setGoProxyWithoutApi(artDetails)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = cmd.RunGo(goArg)\n\n\tif err != nil {\n\t\tlog.Info(\"Received\", err.Error(), \"from proxy. Trying to download dependencies from VCS...\")\n\t\terr := os.Unsetenv(utils.GOPROXY)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn cmd.RunGo(goArg)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5a76b725db742d5646f9f12e650644f7", "score": "0.49662414", "text": "func optionChangeRequiresPodRedeploy(prev, next map[string]string) bool {\n\t// See GH-16717, as of v1.10.x Cilium does not support migrating\n\t// between endpointRoutes modes without restarting pods.\n\t// Also, the default setting for endpointRoutes is disabled.\n\t// If either of these properties change, this logic needs updating!\n\ta := \"false\"\n\tif opt, ok := prev[\"endpointRoutes.enabled\"]; ok {\n\t\ta = opt\n\t}\n\tb := \"false\"\n\tif opt, ok := next[\"endpointRoutes.enabled\"]; ok {\n\t\tb = opt\n\t}\n\n\tif a != b {\n\t\treturn true\n\t}\n\n\t// Switching on and off KPR affects who is handling service traffic.\n\t// E.g., off => on some traffic might be handled by iptables. For existing\n\t// connections it might not have enough of state information which could\n\t// lead to connection interruptions. To avoid it, restart the pods to restart\n\t// such connections.\n\ta = \"disabled\"\n\tif opt, ok := prev[\"kubeProxyReplacement\"]; ok {\n\t\ta = opt\n\t}\n\tb = \"disabled\"\n\tif opt, ok := next[\"kubeProxyReplacement\"]; ok {\n\t\tb = opt\n\t}\n\n\tif a != b {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ccdd60ce372afe70765d0c4fe3060694", "score": "0.4962497", "text": "func setAPIEndpointsMiddlewares(allowedRules config.APIAccessRules, deniedRules config.APIAccessRules) (grpc.UnaryServerInterceptor, grpc.StreamServerInterceptor) {\n\tallowed := apiAccessRuleToMap(allowedRules)\n\tdenied := apiAccessRuleToMap(deniedRules)\n\n\t// Passthrough if no gRPC rules\n\tif len(allowed) == 0 && len(denied) == 0 {\n\t\treturn nil, nil\n\t}\n\n\t// Return the unary middleware function\n\treturn func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (any, error) {\n\t\t\t// Apply the allowlist only on methods that are part of the Dapr runtime, or it will interfere with gRPC proxying\n\t\t\tif strings.HasPrefix(info.FullMethod, daprRuntimePrefix) {\n\t\t\t\tif len(denied) > 0 {\n\t\t\t\t\t_, ok := denied[info.FullMethod]\n\t\t\t\t\tif ok {\n\t\t\t\t\t\treturn nil, invokev1.ErrorFromHTTPResponseCode(http.StatusNotImplemented, \"requested endpoint is not available\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(allowed) > 0 {\n\t\t\t\t\t_, ok := allowed[info.FullMethod]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn nil, invokev1.ErrorFromHTTPResponseCode(http.StatusNotImplemented, \"requested endpoint is not available\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn handler(ctx, req)\n\t\t},\n\t\tfunc(srv any, stream grpc.ServerStream, info *grpc.StreamServerInfo, handler grpc.StreamHandler) error {\n\t\t\t// Apply the allowlist only on methods that are part of the Dapr runtime, or it will interfere with gRPC proxying\n\t\t\tif strings.HasPrefix(info.FullMethod, daprRuntimePrefix) {\n\t\t\t\tif len(denied) > 0 {\n\t\t\t\t\t_, ok := denied[info.FullMethod]\n\t\t\t\t\tif ok {\n\t\t\t\t\t\treturn invokev1.ErrorFromHTTPResponseCode(http.StatusNotImplemented, \"requested endpoint is not available\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif len(allowed) > 0 {\n\t\t\t\t\t_, ok := allowed[info.FullMethod]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\treturn invokev1.ErrorFromHTTPResponseCode(http.StatusNotImplemented, \"requested endpoint is not available\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn handler(srv, stream)\n\t\t}\n}", "title": "" }, { "docid": "b9af296e677b76d79c9ff557587fa6d5", "score": "0.49599972", "text": "func Proxy(proxy func(*http.Request) (*url.URL, error)) func(*Attacker) {\n\treturn func(a *Attacker) {\n\t\ttr := a.client.Transport.(*http.Transport)\n\t\ttr.Proxy = proxy\n\t}\n}", "title": "" }, { "docid": "ca3283be7fdfaa70e91bb402673c74e0", "score": "0.4957882", "text": "func proxyResolution(_proxy string) (*http.Client, error) {\n\tvar (\n\t\tclient *http.Client\n\t\tdialer proxy.Dialer\n\t)\n\n\tif _proxy != \"\" {\n\t\tcheckProxy, err := regexp.MatchString(\"@\", _proxy)\n\t\tif checkProxy {\n\t\t\tauthAndAddress := strings.Split(_proxy, \"@\")\n\t\t\tauth := authAndAddress[0]\n\t\t\tandAddress := authAndAddress[1]\n\t\t\tuserPassProxy := strings.Split(auth, \":\")\n\t\t\tuserProxy := userPassProxy[0]\n\t\t\tpasswordProxy := userPassProxy[1]\n\t\t\tauthData := proxy.Auth{\n\t\t\t\tUser: userProxy,\n\t\t\t\tPassword: passwordProxy,\n\t\t\t}\n\t\t\tdialer, err = proxy.SOCKS5(\"tcp\", andAddress, &authData, proxy.Direct)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tclient = &http.Client{\n\t\t\t\tTransport: &http.Transport{\n\t\t\t\t\tDial: dialer.Dial,\n\t\t\t\t},\n\t\t\t}\n\t\t} else {\n\t\t\tdialer, err = proxy.SOCKS5(\"tcp\", _proxy, nil, proxy.Direct)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tclient = &http.Client{\n\t\t\t\tTransport: &http.Transport{\n\t\t\t\t\tDial: dialer.Dial,\n\t\t\t\t},\n\t\t\t}\n\t\t}\n\t} else {\n\t\tclient = new(http.Client)\n\t}\n\treturn client, nil\n}", "title": "" }, { "docid": "b055640e947f0a09c926e337929c46d1", "score": "0.49506515", "text": "func proxyUpdate(threeScaleAdminPortal, threeScaleAdminPortalServiceUrl string, token3scale string) error {\n\turl := threeScaleAdminPortalServiceUrl + \"/proxy.xml\"\n\tlog.Info(\"Proxy Update URL: \" + url)\n\thostsub := strings.TrimPrefix(threeScaleAdminPortal, \"3scale-admin\")\n\tproductionEndPoint := \"https://api-3scale-apicast-production\" + hostsub\n\tstagingEndPoint := \"https://\" + stagingUrlPrefix + hostsub\n\tdata, err := json.Marshal(map[string]string{\n\t\t\"access_token\": token3scale,\n\t\t\"endpoint\": productionEndPoint,\n\t\t\"sandbox_endpoint\": stagingEndPoint,\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\treq, err := http.NewRequest(http.MethodPatch, url, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn err\n\t}\n\tclient := &http.Client{}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tresp, err := client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"expected status %v or %v but got %v\", http.StatusCreated, http.StatusOK, resp.StatusCode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "08c74dc5847e3dffa1fa96e18998383d", "score": "0.49471804", "text": "func proxy(res http.ResponseWriter, req *http.Request) {\n\tlog.Println(\"Proxied:\", req.Method, req.RequestURI)\n\t// Set up a simple proxy for read requests\n\ttargetUrl, err := url.Parse(elasticsearchUrl)\n\tif err != nil {\n\t\tlog.Println(\"ERROR - Couldn't parse URL:\", elasticsearchUrl, \" - \", err)\n\t\tfmt.Fprintln(res, \"Couldn't parse BONSAI_URL: '\", elasticsearchUrl, \"'\")\n\t} else {\n\t\tproxy := httputil.NewSingleHostReverseProxy(targetUrl)\n\t\tproxy.ServeHTTP(res, req)\n\t}\n}", "title": "" }, { "docid": "d4c00e1c305dc047e0c6ec4d32c421ed", "score": "0.49374068", "text": "func (s *translatorSyncer) propagateProxyStatus(ctx context.Context, proxy *gloov1.Proxy, clusterIngresses v1alpha1.ClusterIngressList) error {\n\tif proxy == nil {\n\t\treturn nil\n\t}\n\ttimeout := time.After(time.Second * 30)\n\tticker := time.Tick(time.Second / 2)\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil\n\t\tcase <-timeout:\n\t\t\treturn eris.Errorf(\"timed out waiting for proxy status to be updated\")\n\t\tcase <-ticker:\n\t\t\t// poll the proxy for an accepted or rejected status\n\t\t\tupdatedProxy, err := s.proxyClient.Read(\n\t\t\t\tproxy.GetMetadata().GetNamespace(),\n\t\t\t\tproxy.GetMetadata().GetName(),\n\t\t\t\tclients.ReadOpts{Ctx: ctx},\n\t\t\t)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tproxyStatus := s.statusClient.GetStatus(updatedProxy)\n\n\t\t\tswitch proxyStatus.GetState() {\n\t\t\tcase core.Status_Pending:\n\t\t\t\tcontinue\n\t\t\tcase core.Status_Rejected:\n\t\t\t\tcontextutils.LoggerFrom(ctx).Errorf(\"proxy was rejected by gloo: %v\", proxyStatus.GetReason())\n\t\t\t\treturn nil\n\t\t\tcase core.Status_Accepted:\n\t\t\t\treturn s.markClusterIngressesReady(ctx, clusterIngresses)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "825c0ee7f7c83fb5e1afb8926cbc3a54", "score": "0.4936832", "text": "func applyOCPProxySpec(n ClusterPolicyController, podSpec *corev1.PodSpec) error {\n\t// Pass HTTPS_PROXY, HTTP_PROXY and NO_PROXY env if set in clusterwide proxy for OCP\n\tproxy, err := GetClusterWideProxy(n.ctx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"ERROR: failed to get clusterwide proxy object: %s\", err)\n\t}\n\n\tif proxy == nil {\n\t\t// no clusterwide proxy configured\n\t\treturn nil\n\t}\n\n\tfor i, container := range podSpec.Containers {\n\t\t// skip if not nvidia-driver container\n\t\tif !strings.Contains(container.Name, \"nvidia-driver\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tproxyEnv := getProxyEnv(proxy)\n\t\tif len(proxyEnv) != 0 {\n\t\t\tpodSpec.Containers[i].Env = append(podSpec.Containers[i].Env, proxyEnv...)\n\t\t}\n\n\t\t// if user-ca-bundle is setup in proxy, create a trusted-ca configmap and add volume mount\n\t\tif proxy.Spec.TrustedCA.Name == \"\" {\n\t\t\treturn nil\n\t\t}\n\n\t\t// create trusted-ca configmap to inject custom user ca bundle into it\n\t\t_, err = getOrCreateTrustedCAConfigMap(n, TrustedCAConfigMapName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// mount trusted-ca configmap\n\t\tpodSpec.Containers[i].VolumeMounts = append(podSpec.Containers[i].VolumeMounts,\n\t\t\tcorev1.VolumeMount{\n\t\t\t\tName: TrustedCAConfigMapName,\n\t\t\t\tReadOnly: true,\n\t\t\t\tMountPath: TrustedCABundleMountDir,\n\t\t\t})\n\t\tpodSpec.Volumes = append(podSpec.Volumes,\n\t\t\tv1.Volume{\n\t\t\t\tName: TrustedCAConfigMapName,\n\t\t\t\tVolumeSource: corev1.VolumeSource{\n\t\t\t\t\tConfigMap: &corev1.ConfigMapVolumeSource{\n\t\t\t\t\t\tLocalObjectReference: v1.LocalObjectReference{\n\t\t\t\t\t\t\tName: TrustedCAConfigMapName,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tItems: []v1.KeyToPath{\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tKey: TrustedCABundleFileName,\n\t\t\t\t\t\t\t\tPath: TrustedCACertificate,\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}\n\treturn nil\n}", "title": "" }, { "docid": "138d2478e4fd35d14afd57f37b780a08", "score": "0.49360543", "text": "func (c *ProxyConfig) CheckAndSetDefaults() error {\n\tif c.WebTLSConfig == nil {\n\t\treturn trace.BadParameter(\"tls config missing\")\n\t}\n\tif c.Listener == nil {\n\t\treturn trace.BadParameter(\"listener missing\")\n\t}\n\tif c.Log == nil {\n\t\tc.Log = logrus.WithField(trace.Component, \"alpn:proxy\")\n\t}\n\tif c.Clock == nil {\n\t\tc.Clock = clockwork.NewRealClock()\n\t}\n\tif c.ReadDeadline == 0 {\n\t\tc.ReadDeadline = defaults.HandshakeReadDeadline\n\t}\n\tif c.Router == nil {\n\t\treturn trace.BadParameter(\"missing parameter router\")\n\t}\n\tif err := c.Router.CheckAndSetDefaults(); err != nil {\n\t\treturn trace.Wrap(err)\n\t}\n\tif c.AccessPoint == nil {\n\t\treturn trace.BadParameter(\"missing access point\")\n\t}\n\tif c.ClusterName == \"\" {\n\t\treturn trace.BadParameter(\"missing cluster name\")\n\t}\n\tif c.PingInterval == 0 {\n\t\tc.PingInterval = defaults.ProxyPingInterval\n\t}\n\n\tif c.IdentityTLSConfig == nil {\n\t\treturn trace.BadParameter(\"missing identity tls config\")\n\t}\n\tc.IdentityTLSConfig = c.IdentityTLSConfig.Clone()\n\tc.IdentityTLSConfig.ClientAuth = tls.RequireAndVerifyClientCert\n\tfn := auth.WithClusterCAs(c.IdentityTLSConfig, c.AccessPoint, c.ClusterName, c.Log)\n\tc.IdentityTLSConfig.GetConfigForClient = fn\n\n\treturn nil\n}", "title": "" }, { "docid": "f55cdd2556288fd3a552aca88c334556", "score": "0.4935279", "text": "func (w *Syncer) HandleProxyDelete(object interface{}) {\n\t_, ok := object.(*apiconfigv1.Proxy)\n\tif !ok {\n\t\tw.logger.Error(\"wrong type in proxy delete syncer\")\n\t\treturn\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e865f4369fdead0ad107ee363a634bc8", "score": "0.49336767", "text": "func (o *Options) HasHTTPClientProxyConfigured() bool {\n\treturn o.httpClientProxy != \"\"\n}", "title": "" }, { "docid": "7c2d617988db4bd9d497547da163aba8", "score": "0.49274993", "text": "func newProxy(config *Config) (*oauthProxy, error) {\n\tvar err error\n\t// step: set the logging level\n\tif config.LogJSONFormat {\n\t\tlog.SetFormatter(&log.JSONFormatter{})\n\t}\n\tif config.Verbose {\n\t\tlog.SetLevel(log.DebugLevel)\n\t}\n\n\tlog.Infof(\"starting %s, author: %s, version: %s, \", prog, author, version)\n\n\tservice := &oauthProxy{config: config}\n\n\t// step: parse the upstream endpoint\n\tservice.endpoint, err = url.Parse(config.Upstream)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// step: initialize the store if any\n\tif config.StoreURL != \"\" {\n\t\tif service.store, err = createStorage(config.StoreURL); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// step: initialize the openid client\n\tif !config.SkipTokenVerification {\n\t\tservice.client, service.provider, err = createOpenIDClient(config)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else {\n\t\tlog.Warnf(\"TESTING ONLY CONFIG - the verification of the token have been disabled\")\n\t}\n\n\tif config.ClientID == \"\" && config.ClientSecret == \"\" {\n\t\tlog.Warnf(\"Note: client credentials are not set, depending on provider (confidential|public) you might be able to auth\")\n\t}\n\n\t// step:\n\tswitch config.EnableForwarding {\n\tcase true:\n\t\tif err := createForwardingProxy(config, service); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\tdefault:\n\t\tif err := createReverseProxy(config, service); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\treturn service, nil\n}", "title": "" }, { "docid": "95aa45a6b833c16d875195b6330dff4d", "score": "0.4924956", "text": "func (o *MicrosoftGraphProxiedDomain) HasProxy() bool {\n\tif o != nil && o.Proxy != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "7e3e4ae82d4b66f692b88c6df9113e0e", "score": "0.49163637", "text": "func DummyProvider(proxies *Set, timeout time.Duration) ([]Proxy, error) {\n\tvar ps []Proxy\n\n\tstaticProxies := []string{\n\t\t\"http://154.72.199.38:32954 UG\",\n\t\t\"http://117.191.11.103:8080 CN\",\n\t\t\"http://186.103.175.158:3128 CL\",\n\t\t\"http://170.254.150.165:80 BR\",\n\t\t\"http://190.149.165.150:50806 GT\",\n\t\t\"http://112.12.91.67:8888 CN\",\n\t\t\"http://112.12.91.213:8888 CN\",\n\t\t\"http://150.109.55.190:83 US\",\n\t\t\"http://112.12.91.211:8888 CN\",\n\t\t\"http://177.99.11.207:8080 BR\",\n\t\t\"http://110.164.58.180:8080 TH\",\n\t\t\"socks5://178.62.193.19:1080 NL\",\n\t\t\"socks5://82.196.11.105:1080 NL\",\n\t\t\"socks5://94.130.73.24:37188 DE\",\n\t\t\"socks5://94.130.73.24:36975 DE\",\n\t\t\"socks5://94.130.73.24:36966 DE\",\n\t\t\"socks5://94.130.73.24:37374 DE\",\n\t\t\"socks5://54.38.195.161:47404 FR\",\n\t\t\"socks5://94.130.73.30:64918 DE\",\n\t}\n\n\tfor _, p := range staticProxies {\n\t\tcolumns := strings.Split(p, \" \")\n\n\t\trawurl := columns[0]\n\t\tcountry := columns[1]\n\n\t\tu, err := url.Parse(rawurl)\n\t\tif err != nil {\n\t\t\tpanic(\"invalid proxy in dummy provider\")\n\t\t}\n\n\t\tproxy := Proxy{\n\t\t\tURL: u,\n\t\t\tProvider: \"DummyProvider\",\n\t\t\tCountry: country,\n\t\t}\n\n\t\tproxies.Add(proxy)\n\t\tps = append(ps, proxy)\n\t}\n\n\treturn ps, nil\n}", "title": "" }, { "docid": "17d8105bf4336343829d71441e15db3b", "score": "0.49159783", "text": "func createReverseProxy(config *Config, service *oauthProxy) error {\n\tlog.Infof(\"enabled reverse proxy mode, upstream url: %s\", config.Upstream)\n\n\t// step: display the protected resources\n\tfor _, resource := range config.Resources {\n\t\tlog.Infof(\"protecting resources under uri: %s\", resource)\n\t}\n\tfor name, value := range config.MatchClaims {\n\t\tlog.Infof(\"the token must container the claim: %s, required: %s\", name, value)\n\t}\n\n\t// step: initialize the reverse http proxy\n\tif err := service.createUpstreamProxy(service.endpoint); err != nil {\n\t\treturn err\n\t}\n\n\t// step: setup the gin router and add router\n\tif err := service.createEndpoints(); err != nil {\n\t\treturn err\n\t}\n\n\t// step: load the templates\n\tif err := service.createTemplates(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c833e792994ea99a27771950f0a51f66", "score": "0.49159166", "text": "func resourceVolterraForwardProxyPolicy() *schema.Resource {\n\treturn &schema.Resource{\n\t\tCreate: resourceVolterraForwardProxyPolicyCreate,\n\t\tRead: resourceVolterraForwardProxyPolicyRead,\n\t\tUpdate: resourceVolterraForwardProxyPolicyUpdate,\n\t\tDelete: resourceVolterraForwardProxyPolicyDelete,\n\n\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\"annotations\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"description\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"disable\": {\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"labels\": {\n\t\t\t\tType: schema.TypeMap,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"namespace\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tForceNew: true,\n\t\t\t},\n\n\t\t\t\"any_proxy\": {\n\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"drp_http_connect\": {\n\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"network_connector\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"namespace\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\t\"tenant\": {\n\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"proxy_label_selector\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"expressions\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"allow_all\": {\n\n\t\t\t\tType: schema.TypeBool,\n\t\t\t\tOptional: true,\n\t\t\t},\n\n\t\t\t\"allow_list\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"default_action_allow\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"default_action_deny\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"default_action_next_policy\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"dest_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"port_ranges\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\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\n\t\t\t\t\t\t\"http_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"any_path\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_prefix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\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\n\t\t\t\t\t\t\"tls_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"deny_list\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"default_action_allow\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"default_action_deny\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"default_action_next_policy\": {\n\n\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\"dest_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"port_ranges\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\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\n\t\t\t\t\t\t\"http_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"any_path\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_prefix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"path_regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\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\n\t\t\t\t\t\t\"tls_list\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\n\t\t\t\"rule_list\": {\n\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\"rules\": {\n\n\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\"action\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"all_destinations\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"dst_asn_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"as_numbers\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeInt,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"dst_asn_set\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"dst_ip_prefix_set\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"dst_label_selector\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"expressions\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"dst_prefix_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"ipv6_prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"http_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"http_list\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"any_path\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"path_exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"path_prefix_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"path_regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"tls_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"tls_list\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"exact_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"regex_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\"suffix_value\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"url_category_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"url_categories\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"no_http_connect_port\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"port_matcher\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"invert_matcher\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"ports\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"metadata\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"description\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"disable\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"rule_description\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"rule_name\": {\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"all_sources\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"inside_sources\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeBool,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"interface\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"ip_prefix_set\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"name\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"namespace\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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\t\"tenant\": {\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"label_selector\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"expressions\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tRequired: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"namespace\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\"prefix_list\": {\n\n\t\t\t\t\t\t\t\t\t\tType: schema.TypeSet,\n\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\tElem: &schema.Resource{\n\t\t\t\t\t\t\t\t\t\t\tSchema: map[string]*schema.Schema{\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"ipv6_prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t\t\t\t\"prefixes\": {\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeList,\n\n\t\t\t\t\t\t\t\t\t\t\t\t\tOptional: true,\n\t\t\t\t\t\t\t\t\t\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t\t\t\t\t\t\t\t\t\t},\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},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8996421004b8fd598f0808429df69436", "score": "0.49146616", "text": "func useProxy(addr string) bool {\n\tif len(addr) == 0 {\n\t\treturn true\n\t}\n\thost, _, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif host == \"localhost\" {\n\t\treturn false\n\t}\n\tif ip := net.ParseIP(host); ip != nil {\n\t\tif ip.IsLoopback() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tnoProxy := noProxyEnv.Get()\n\tif noProxy == \"*\" {\n\t\treturn false\n\t}\n\n\taddr = strings.ToLower(strings.TrimSpace(addr))\n\tif hasPort(addr) {\n\t\taddr = addr[:strings.LastIndex(addr, \":\")]\n\t}\n\n\tfor _, p := range strings.Split(noProxy, \",\") {\n\t\tp = strings.ToLower(strings.TrimSpace(p))\n\t\tif len(p) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif hasPort(p) {\n\t\t\tp = p[:strings.LastIndex(p, \":\")]\n\t\t}\n\t\tif addr == p {\n\t\t\treturn false\n\t\t}\n\t\tif len(p) == 0 {\n\t\t\t// There is no host part, likely the entry is malformed; ignore.\n\t\t\tcontinue\n\t\t}\n\t\tif p[0] == '.' && (strings.HasSuffix(addr, p) || addr == p[1:]) {\n\t\t\t// noProxy \".foo.com\" matches \"bar.foo.com\" or \"foo.com\"\n\t\t\treturn false\n\t\t}\n\t\tif p[0] != '.' && strings.HasSuffix(addr, p) && addr[len(addr)-len(p)-1] == '.' {\n\t\t\t// noProxy \"foo.com\" matches \"bar.foo.com\"\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "6cf1061ca0aa67ada00608d47bca3a3d", "score": "0.49121612", "text": "func passThrough(w http.ResponseWriter, r *http.Request, defaultEndpoint string) {\n\t// remove www.\n\tif strings.HasPrefix(r.Host, \"www.\") {\n\t\tr.Host = strings.Replace(r.Host, \"www.\", \"\", 1)\n\t}\n\n\tendpoint := siteKey(r.Host, defaultEndpoint)\n\n\t// One quick sanity check before sending it on it's way\n\tif _, exists := endpoints[endpoint]; exists {\n\t\tlog.WithFields(\n\t\t\tlog.Fields{\n\t\t\t\t\"Host\": r.Host,\n\t\t\t\t\"From\": r.RemoteAddr,\n\t\t\t\t\"To\": endpoints[endpoint].Address,\n\t\t\t\t\"RequestURI\": r.RequestURI,\n\t\t\t\t\"Forwarded\": endpoint,\n\t\t\t}).Info(\"New Request\")\n\n\t\tendpoints[endpoint].Proxy.ServeHTTP(w, r)\n\t} else {\n\t\tlog.WithFields(\n\t\t\tlog.Fields{\n\t\t\t\t\"Request\": r.Host,\n\t\t\t\t\"From\": r.RemoteAddr,\n\t\t\t\t\"Forwarded\": endpoint,\n\t\t\t}).Info(\"Bad Request\")\n\n\t\tw.WriteHeader(http.StatusBadGateway)\n\t\tw.Write([]byte(\"Error 502 - Bad Gateway\"))\n\t}\n}", "title": "" }, { "docid": "ba0a2139d2f5974b42f10167962b84b5", "score": "0.4910458", "text": "func (h *Handler) proxyLoopIteration(r *http.Request, origReq *http.Request, w http.ResponseWriter, proxyErr error, start time.Time, retries int,\n\trepl *caddy.Replacer, reqHeader http.Header, reqHost string, next caddyhttp.Handler,\n) (bool, error) {\n\t// get the updated list of upstreams\n\tupstreams := h.Upstreams\n\tif h.DynamicUpstreams != nil {\n\t\tdUpstreams, err := h.DynamicUpstreams.GetUpstreams(r)\n\t\tif err != nil {\n\t\t\th.logger.Error(\"failed getting dynamic upstreams; falling back to static upstreams\", zap.Error(err))\n\t\t} else {\n\t\t\tupstreams = dUpstreams\n\t\t\tfor _, dUp := range dUpstreams {\n\t\t\t\th.provisionUpstream(dUp)\n\t\t\t}\n\t\t\th.logger.Debug(\"provisioned dynamic upstreams\", zap.Int(\"count\", len(dUpstreams)))\n\t\t\tdefer func() {\n\t\t\t\t// these upstreams are dynamic, so they are only used for this iteration\n\t\t\t\t// of the proxy loop; be sure to let them go away when we're done with them\n\t\t\t\tfor _, upstream := range dUpstreams {\n\t\t\t\t\t_, _ = hosts.Delete(upstream.String())\n\t\t\t\t}\n\t\t\t}()\n\t\t}\n\t}\n\n\t// choose an available upstream\n\tupstream := h.LoadBalancing.SelectionPolicy.Select(upstreams, r, w)\n\tif upstream == nil {\n\t\tif proxyErr == nil {\n\t\t\tproxyErr = caddyhttp.Error(http.StatusServiceUnavailable, fmt.Errorf(\"no upstreams available\"))\n\t\t}\n\t\tif !h.LoadBalancing.tryAgain(h.ctx, start, retries, proxyErr, r) {\n\t\t\treturn true, proxyErr\n\t\t}\n\t\treturn false, proxyErr\n\t}\n\n\t// the dial address may vary per-request if placeholders are\n\t// used, so perform those replacements here; the resulting\n\t// DialInfo struct should have valid network address syntax\n\tdialInfo, err := upstream.fillDialInfo(r)\n\tif err != nil {\n\t\treturn true, fmt.Errorf(\"making dial info: %v\", err)\n\t}\n\n\th.logger.Debug(\"selected upstream\",\n\t\tzap.String(\"dial\", dialInfo.Address),\n\t\tzap.Int(\"total_upstreams\", len(upstreams)))\n\n\t// attach to the request information about how to dial the upstream;\n\t// this is necessary because the information cannot be sufficiently\n\t// or satisfactorily represented in a URL\n\tcaddyhttp.SetVar(r.Context(), dialInfoVarKey, dialInfo)\n\n\t// set placeholders with information about this upstream\n\trepl.Set(\"http.reverse_proxy.upstream.address\", dialInfo.String())\n\trepl.Set(\"http.reverse_proxy.upstream.hostport\", dialInfo.Address)\n\trepl.Set(\"http.reverse_proxy.upstream.host\", dialInfo.Host)\n\trepl.Set(\"http.reverse_proxy.upstream.port\", dialInfo.Port)\n\trepl.Set(\"http.reverse_proxy.upstream.requests\", upstream.Host.NumRequests())\n\trepl.Set(\"http.reverse_proxy.upstream.max_requests\", upstream.MaxRequests)\n\trepl.Set(\"http.reverse_proxy.upstream.fails\", upstream.Host.Fails())\n\n\t// mutate request headers according to this upstream;\n\t// because we're in a retry loop, we have to copy\n\t// headers (and the r.Host value) from the original\n\t// so that each retry is identical to the first\n\tif h.Headers != nil && h.Headers.Request != nil {\n\t\tr.Header = make(http.Header)\n\t\tcopyHeader(r.Header, reqHeader)\n\t\tr.Host = reqHost\n\t\th.Headers.Request.ApplyToRequest(r)\n\t}\n\n\t// proxy the request to that upstream\n\tproxyErr = h.reverseProxy(w, r, origReq, repl, dialInfo, next)\n\tif proxyErr == nil || errors.Is(proxyErr, context.Canceled) {\n\t\t// context.Canceled happens when the downstream client\n\t\t// cancels the request, which is not our failure\n\t\treturn true, nil\n\t}\n\n\t// if the roundtrip was successful, don't retry the request or\n\t// ding the health status of the upstream (an error can still\n\t// occur after the roundtrip if, for example, a response handler\n\t// after the roundtrip returns an error)\n\tif succ, ok := proxyErr.(roundtripSucceeded); ok {\n\t\treturn true, succ.error\n\t}\n\n\t// remember this failure (if enabled)\n\th.countFailure(upstream)\n\n\t// if we've tried long enough, break\n\tif !h.LoadBalancing.tryAgain(h.ctx, start, retries, proxyErr, r) {\n\t\treturn true, proxyErr\n\t}\n\n\treturn false, proxyErr\n}", "title": "" }, { "docid": "2c7c535f81054da21245fdd1a53193ba", "score": "0.49047124", "text": "func RequestReverseProxy(req *http.Request, url *url.URL, providers []p.AbstractProviderInterface) types.ReverseResponse {\n\treq.URL.Host = req.Host\n\treq.URL.Scheme = url.Scheme\n\treq.Header.Set(\"X-Forwarded-Host\", req.Header.Get(\"Host\"))\n\n\tproxy := httputil.NewSingleHostReverseProxy(url)\n\tproxy.ModifyResponse = func(response *http.Response) error {\n\t\treturn rewriteBody(response, providers)\n\t}\n\n\treturn types.ReverseResponse{\n\t\t\"bad\",\n\t\tproxy,\n\t\treq,\n\t}\n}", "title": "" }, { "docid": "3bac5f9ae8cc02c7cff1f9150b2cf967", "score": "0.49044648", "text": "func TestProxyHandlesCorsPreflightWithDefaultAllowOrigin(t *testing.T) {\n\tt.Parallel()\n\n\tserviceName := \"test-echo\"\n\tconfigId := \"test-config-id\"\n\tcorsRequestMethod := \"PATCH\"\n\tcorsRequestHeader := \"X-PINGOTHER\"\n\tcorsAllowOriginValue := \"http://cloud.google.com\"\n\tcorsAllowMethodsValue := \"GET, PATCH, DELETE, OPTIONS\"\n\tcorsAllowHeadersValue := \"DNT,User-Agent,Cache-Control,Content-Type,Authorization, X-PINGOTHER\"\n\tcorsExposeHeadersValue := \"Content-Length,Content-Range\"\n\tcorsAllowCredentialsValue := \"true\"\n\tcorsMaxAgeValue := \"7200\"\n\n\targs := []string{\"--service=\" + serviceName, \"--service_config_id=\" + configId,\n\t\t\"--rollout_strategy=fixed\", \"--cors_preset=basic\",\n\t\t\"--cors_allow_origin=*\", \"--cors_allow_methods=\" + corsAllowMethodsValue,\n\t\t\"--cors_allow_headers=\" + corsAllowHeadersValue,\n\t\t\"--cors_expose_headers=\" + corsExposeHeadersValue, \"--cors_allow_credentials\",\n\t\t\"--cors_max_age=2h\"}\n\n\ts := env.NewTestEnv(platform.TestProxyHandlesCorsPreflightWithDefaultAllowOrigin, platform.EchoSidecar)\n\tdefer s.TearDown(t)\n\tif err := s.Setup(args); err != nil {\n\t\tt.Fatalf(\"fail to setup test env, %v\", err)\n\t}\n\n\ttestData := []struct {\n\t\tdesc string\n\t\treqHeaders map[string]string\n\t\twantError string\n\t\twantRespHeaders map[string]string\n\t}{\n\t\t{\n\t\t\tdesc: \"CORS preflight request is valid.\",\n\t\t\treqHeaders: map[string]string{\n\t\t\t\t\"Origin\": corsAllowOriginValue,\n\t\t\t\t\"Access-Control-Request-Method\": corsRequestMethod,\n\t\t\t\t\"Access-Control-Request-Headers\": corsRequestHeader,\n\t\t\t},\n\t\t\twantRespHeaders: map[string]string{\n\t\t\t\t\"Access-Control-Allow-Origin\": corsAllowOriginValue,\n\t\t\t\t\"Access-Control-Allow-Methods\": corsAllowMethodsValue,\n\t\t\t\t\"Access-Control-Allow-Headers\": corsAllowHeadersValue,\n\t\t\t\t\"Access-Control-Expose-Headers\": corsExposeHeadersValue,\n\t\t\t\t\"Access-Control-Allow-Credentials\": corsAllowCredentialsValue,\n\t\t\t\t\"Access-Control-Max-Age\": corsMaxAgeValue,\n\t\t\t},\n\t\t},\n\t}\n\n\tfor _, tc := range testData {\n\t\tt.Run(tc.desc, func(t *testing.T) {\n\t\t\turl := fmt.Sprintf(\"http://%v:%v%v\", platform.GetLoopbackAddress(), s.Ports().ListenerPort, \"/echo\")\n\t\t\trespHeaders, _, err := utils.DoWithHeaders(url, \"OPTIONS\", \"\", tc.reqHeaders)\n\n\t\t\tif err != nil && tc.wantError == \"\" {\n\t\t\t\tt.Fatal(err)\n\t\t\t} else if err == nil && tc.wantError != \"\" {\n\t\t\t\tt.Fatalf(\"Want error, got no error\")\n\t\t\t} else if err != nil && !strings.Contains(err.Error(), tc.wantError) {\n\t\t\t\tt.Errorf(\"\\nwant error: %v, \\ngot error: %v\", tc.wantError, err)\n\t\t\t}\n\n\t\t\tif respHeaders == nil {\n\t\t\t\tt.Fatalf(\"could not read response headers\")\n\t\t\t}\n\n\t\t\tfor key, value := range tc.wantRespHeaders {\n\t\t\t\tif respHeaders.Get(key) != value {\n\t\t\t\t\tt.Errorf(\"%s expected: %s, got: %s\", key, value, respHeaders.Get(key))\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "55bed111efe6ea9ba265b7602e1d380b", "score": "0.48995966", "text": "func (e *Runtime) Proxy(server *http.Server) error {\n\te.cancelFunc = append(e.cancelFunc, func() {\n\t\tif err := server.Shutdown(context.TODO()); err != nil {\n\t\t\tgrpclog.Infoln(err.Error())\n\t\t}\n\t})\n\n\treturn errors.WithStack(server.Serve(e.lis.HTTPListener()))\n}", "title": "" }, { "docid": "b5f4dcdc6c7a6d2c9491d07183000972", "score": "0.48927838", "text": "func useProxy(addr string) bool {\n\tif len(addr) == 0 {\n\t\treturn true\n\t}\n\thost, _, err := net.SplitHostPort(addr)\n\tif err != nil {\n\t\treturn false\n\t}\n\tif host == \"localhost\" {\n\t\treturn false\n\t}\n\tif ip := net.ParseIP(host); ip != nil {\n\t\tif ip.IsLoopback() {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tnoProxy := NoProxyEnv.Get()\n\tif noProxy == \"*\" {\n\t\treturn false\n\t}\n\n\taddr = strings.ToLower(strings.TrimSpace(addr))\n\tif hasPort(addr) {\n\t\taddr = addr[:strings.LastIndexByte(addr, ':')]\n\t}\n\n\tfor _, p := range strings.Split(noProxy, \",\") {\n\t\tp = strings.ToLower(strings.TrimSpace(p))\n\t\tif len(p) == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif hasPort(p) {\n\t\t\tp = p[:strings.LastIndexByte(p, ':')]\n\t\t}\n\t\tif addr == p {\n\t\t\treturn false\n\t\t}\n\t\tif len(p) == 0 {\n\t\t\t// There is no host part, likely the entry is malformed; ignore.\n\t\t\tcontinue\n\t\t}\n\t\tif p[0] == '.' && ((len(addr) >= len(p) && addr[len(addr)-len(p):] == p) || addr == p[1:]) {\n\t\t\t// no_proxy \".foo.com\" matches \"bar.foo.com\" or \"foo.com\"\n\t\t\treturn false\n\t\t}\n\t\tif p[0] != '.' && (len(addr) >= len(p) && addr[len(addr)-len(p):] == p) && addr[len(addr)-len(p)-1] == '.' {\n\t\t\t// no_proxy \"foo.com\" matches \"bar.foo.com\"\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "926d13a77dc92c1b3083e3e383231d91", "score": "0.48899394", "text": "func TestDontConvertNonHttpsToHttp(t *testing.T) {\n\tconfig := &endpoints.ApiDescriptor{\n\t\tName: \"guestbook_api\",\n\t\tVersion: \"X\",\n\t\tRoot: \"ios://https.appspot.com/_ah/api\",\n\t\tMethods: make(map[string]*endpoints.ApiMethod),\n\t}\n\tconfig.Adapter.Bns = \"http://https.appspot.com/_ah/spi\"\n\tconfig.Adapter.Type = \"lily\"\n\n\tconvertHttpsToHttp(config)\n\n\tassert.Equal(t, \"http://https.appspot.com/_ah/spi\", config.Adapter.Bns)\n\tassert.Equal(t, \"ios://https.appspot.com/_ah/api\", config.Root)\n}", "title": "" }, { "docid": "680b3295e32f87211ba8d90a12d5cfd4", "score": "0.48862228", "text": "func proxyRequest(app Module, response http.ResponseWriter, request *http.Request) {\n var redirectUrl string\n // trim app name from URL if specified in app config\n if app.TrimAppName {\n log.Debug(fmt.Sprintf(\"trimming app name from redirect for application %s\",\n app.ModuleName))\n replace := fmt.Sprintf(\"/%s\", app.ModuleName)\n redirectUrl = strings.Replace(app.ModuleRedirect, replace, \"\", -1)\n } else {\n redirectUrl = app.ModuleRedirect\n }\n\n // remove /api segment from request path\n request.URL.Path = strings.Replace(request.URL.Path, \"/api\", \"\", -1)\n log.Info(fmt.Sprintf(\"proxying request to %s\", redirectUrl))\n // construct new URL, set proxy headers and proxy\n redirect, _ := url.Parse(redirectUrl)\n SetProxyHeaders(request, redirect)\n // create reverse proxy instance and serve request\n proxy := httputil.NewSingleHostReverseProxy(redirect)\n proxy.ServeHTTP(response, request)\n}", "title": "" }, { "docid": "ae114c5745aa05c08d13d26506facf63", "score": "0.48848903", "text": "func newServiceProxy(addrs []string) *httputil.ReverseProxy {\n\ti := 0\n\tmutex := sync.Mutex{}\n\treturn &httputil.ReverseProxy{\n\t\tDirector: func(r *http.Request) {\n\t\t\tmutex.Lock()\n\t\t\tr.URL.Host = addrs[i%len(addrs)]\n\t\t\ti++\n\t\t\tmutex.Unlock()\n\t\t\tr.URL.Scheme = \"http\"\n\t\t},\n\t}\n}", "title": "" }, { "docid": "f55295719de7d1b34deb5c8a536b152d", "score": "0.48835844", "text": "func SetProxy(proxy func(*http.Request) (*url.URL, error)) error {\n\treturn std.SetProxy(proxy)\n}", "title": "" }, { "docid": "9e5e6e509be5c69ab0ff329878f97831", "score": "0.4881843", "text": "func SmartProxy(req *http.Request) (proxyUrl *url.URL, err error) {\n\n\tinitOnce.Do(initCache)\n\n\tif !useLookup {\n\t\terr = ErrCacheDisabled\n\t\treturn\n\t}\n\n\tproxyUrl, err = lookup(req)\n\tif err != nil {\n\t\tproxyUrl, err = Proxy(req)\n\t\tif err == nil {\n\t\t\tsetCache(req, proxyUrl)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "a01b892bb08434dbcdc1d726b7b18fad", "score": "0.4873204", "text": "func SetProxy(proxy func(*http.Request) (*url.URL, error)) func(*apiOptions) {\n\treturn func(opts *apiOptions) {\n\t\topts.proxy = proxy\n\t}\n}", "title": "" }, { "docid": "c66fd4af125ae2fd56b3958c031d358b", "score": "0.48713487", "text": "func passProxy(ctx context.Context, cancel context.CancelFunc, count *int) {\n\t// one time only\n\t*count++\n\tif *count > 1 {\n\t\tlog.Printf(\"passProxy count %d, aborting\", *count)\n\t\treturn\n\t}\n\n\tproxyAddr := RuntimeConfig.C2TransportProxy\n\tsl := strings.Split(proxyAddr, \"//\")\n\tif len(sl) < 2 {\n\t\tlog.Printf(\"TCPFwd: invalid proxy addr: %s\", proxyAddr)\n\t\treturn\n\t}\n\tgo func() {\n\t\tif strings.HasPrefix(sl[1], \"127.0.0.1\") {\n\t\t\tlog.Printf(\"RuntimeConfig.AgentProxy is %s, we are already serving the proxy, let's start broadcasting right away\", proxyAddr)\n\t\t\treturn\n\t\t}\n\t\tlog.Printf(\"[+] BroadcastServer: %s will be served here too, let's hope it helps more agents\\n\", proxyAddr)\n\t\terr := tun.TCPFwd(sl[1], RuntimeConfig.AutoProxyPort, ctx, cancel)\n\t\tif err != nil {\n\t\t\tlog.Print(\"TCPFwd: \", err)\n\t\t}\n\t}()\n\tgo StartBroadcast(false, ctx, cancel)\n}", "title": "" }, { "docid": "5e30c4f7626ec08b61ce8dd2602a8d92", "score": "0.487099", "text": "func (e EndPoints) validate() error {\n\tvar atLeastOne int\n\tv := reflect.ValueOf(e)\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tif endpoint := v.Field(i).Interface(); len(endpoint.(string)) > 1 {\n\t\t\tu, err := url.Parse(endpoint.(string))\n\t\t\tif err != nil {\n\t\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"url parsing error on %v: %v\", v.Field(i), endpoint))\n\t\t\t}\n\n\t\t\tif len(u.Scheme) == 0 {\n\t\t\t\treturn errors.Wrap(ErrMissingProtocol, fmt.Sprintf(\"missing protocol, on %v: %v\", v.Field(i), endpoint))\n\t\t\t}\n\t\t\tatLeastOne++\n\t\t}\n\t}\n\n\tif atLeastOne == 0 {\n\t\treturn ErrAtLeastOne\n\t}\n\n\t// if there is only a single endpoint for an API and that endpoint is used no matter what part of the world you are in\n\t// that is then the fastest endpoint that can be used\n\tif atLeastOne == 1 && len(e.Universal) > 0 {\n\t\te.FastestURL = e.Universal\n\t\te.Fallback = e.Universal\n\t}\n\n\tif len(e.Fallback) == 0 {\n\t\t// this endpoint should always work\n\t\treturn ErrFallbackUnset\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2d54349bfb02668f9cad6c3cdf610c8a", "score": "0.48670137", "text": "func setupAPI(mainapi *api.ConnectomeAPI) error {\n\tif simpleEngine, ok := mainapi.Store.(storage.Store); ok {\n\t\tq := &storeAPI{simpleEngine}\n\n\t\t// version endpoint\n\t\tendpoint := \"version\"\n\t\tmainapi.SetRoute(api.GET, PREFIX+\"/\"+endpoint, q.getVersion)\n\t\tmainapi.SupportedEndpoints[endpoint] = true\n\n\t\t// database endpoint\n\t\tendpoint = \"database\"\n\t\tmainapi.SetRoute(api.GET, PREFIX+\"/\"+endpoint, q.getDatabase)\n\t\tmainapi.SupportedEndpoints[endpoint] = true\n\n\t\t// datasets endpoint\n\t\tendpoint = \"datasets\"\n\t\tmainapi.SetRoute(api.GET, PREFIX+\"/\"+endpoint, q.getDatasets)\n\t\tmainapi.SupportedEndpoints[endpoint] = true\n\n\t\t// instances endpoint\n\t\tendpoint = \"instances\"\n\t\tmainapi.SetRoute(api.GET, PREFIX+\"/\"+endpoint, q.getDataInstances)\n\t\tmainapi.SupportedEndpoints[endpoint] = true\n\t} else {\n\t\t// meta interface is required by default\n\t\treturn fmt.Errorf(\"metadata interface is not available\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "920ce59ac4878fe30ff7167b43d290d3", "score": "0.48620027", "text": "func doHandleProxying(conn *serverConnection) {\n\tlog.Debug(\"Proxying \", conn.conn.RemoteAddr(), \"to\", conn.targetConn.RemoteAddr())\n\tgo egress(conn)\n\tgo ingress(conn)\n\n\tfor conn.status == stsProxying {\n\t\ttime.Sleep(time.Duration(5) * time.Second)\n\t}\n}", "title": "" }, { "docid": "23d2061c8056c12363a1b75d69b919ba", "score": "0.48611373", "text": "func (r *ReplicaSet) add(p *Proxy) error {\n\tif _, ok := r.proxyToReal[p.ProxyAddr]; ok {\n\t\treturn fmt.Errorf(\"proxy %s already used in ReplicaSet\", p.ProxyAddr)\n\t}\n\tif _, ok := r.realToProxy[p.MongoAddr]; ok {\n\t\treturn fmt.Errorf(\"mongo %s already exists in ReplicaSet\", p.MongoAddr)\n\t}\n\tr.Log.Infof(\"added %s\", p)\n\tr.proxyToReal[p.ProxyAddr] = p.MongoAddr\n\tr.realToProxy[p.MongoAddr] = p.ProxyAddr\n\tr.proxies[p.ProxyAddr] = p\n\treturn nil\n}", "title": "" }, { "docid": "f3995946176a501c671560a2b5b4d2ce", "score": "0.4856964", "text": "func TestAPIHook(t *testing.T) {\n\tConvey(\"Requests can be intercepted by a custom handler\", t, func() {\n\t\tproxy := goproxy.NewProxyHttpServer()\n\t\tproxy.Verbose = true\n\n\t\tcalledConnectHandler := false\n\t\tcalledRequestHandler := false\n\t\tcalledResponseHandler := false\n\t\tproxy.HandleConnectFunc(func(ctx *goproxy.ProxyCtx) goproxy.Next {\n\t\t\t//fmt.Printf(\"[TEST] HandleConnectFunc() called\\n\")\n\t\t\tcalledConnectHandler = true\n\t\t\treturn goproxy.NEXT\n\t\t})\n\n\t\t// Hook the proxy request handler\n\t\tproxy.HandleRequestFunc(func(ctx *goproxy.ProxyCtx) goproxy.Next {\n\t\t\tcalledRequestHandler = true\n\t\t\t//fmt.Printf(\"[TEST] HandleRequestFunc() - Request function triggered: %s\\n\", ctx.Req.URL)\n\t\t\treturn goproxy.NEXT\n\t\t})\n\n\t\tproxy.HandleResponseFunc(func(ctx *goproxy.ProxyCtx) goproxy.Next {\n\t\t\t//fmt.Printf(\"[TEST] HandleResponseFunc() - Response received: %s\\n\", ctx.Req.URL)\n\t\t\tcalledResponseHandler = true\n\t\t\treturn goproxy.NEXT\n\t\t})\n\n\t\tclient, err := oneShotProxy(proxy, \"11301\")\n\t\tSo(err, ShouldEqual, nil)\n\n\t\tr := string(getOrFail(srv.URL+\"/bobo\", client, t))\n\t\tSo(r, ShouldEqual, \"bobo\")\n\t\tSo(calledRequestHandler, ShouldEqual, true)\n\t\tSo(calledResponseHandler, ShouldEqual, false)\n\t\tSo(calledConnectHandler, ShouldEqual, false)\n\n\t\tcalledRequestHandler = false\n\t\tr = string(getOrFail(srv.URL+\"/bobo\", client, t))\n\t\tSo(r, ShouldEqual, \"bobo\")\n\n\t\t// The request handler should not be called a second time because the TCP connection was re-used.\n\t\tSo(calledRequestHandler, ShouldEqual, false)\n\n\t})\n}", "title": "" }, { "docid": "4034f1d8c06377f844c183f5a562b3fc", "score": "0.485525", "text": "func IsProxiedTest(clients *[]grpcv1.Client) bool {\n\tfor _, c := range *clients {\n\t\tif ContainerForName(config.SidecarContainerName, c.Run) != nil {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "11db9f1e5d65e235b3439e6e89b239cd", "score": "0.48535421", "text": "func (r *APIRoute) Proxy(opts ProxyOptions) *APIRoute {\n\tif err := opts.Validate(); err != nil {\n\t\tgrip.Alert(message.WrapError(err, message.Fields{\n\t\t\t\"message\": \"invalid proxy options\",\n\t\t\t\"route\": r.route,\n\t\t\t\"version\": r.version,\n\t\t\t\"existing_handler\": r.handler != nil,\n\t\t}))\n\t\treturn r\n\t}\n\n\tr.handler = (&httputil.ReverseProxy{\n\t\tTransport: opts.Transport,\n\t\tErrorLog: grip.MakeStandardLogger(level.Warning),\n\t\tDirector: opts.director,\n\t\tErrorHandler: opts.ErrorHandler,\n\t}).ServeHTTP\n\n\treturn r\n}", "title": "" }, { "docid": "b4e089a3bb94dd206d0daa450a0ceb27", "score": "0.4852338", "text": "func initAPI(keyCollection *keys) {\n\tif !isCoordinator {\n\t\tlogrus.Debug(\"isCoordinator == false, skipping webserver deployment\")\n\t} else {\n\t\tgo restAPI(keyCollection)\n\t}\n}", "title": "" }, { "docid": "0545ad74630a2d80417baf2cecdaa55c", "score": "0.48514375", "text": "func (insta *Instagram) UnsetProxy() {\n\tinsta.c.Transport = nil\n}", "title": "" }, { "docid": "5b24683fc1f197b99df425b5f9efef9c", "score": "0.48497137", "text": "func DefaultEndpointProvider(service string) []*url.URL {\n\tswitch service {\n\tcase \"frontend\":\n\t\tu, err := url.Parse(internalapi.Client.URL)\n\t\tif err != nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn []*url.URL{u.ResolveReference(&url.URL{Path: \"/.internal/checks\"})}\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "3bf23aaf31c1f15b205b716ad90de4ef", "score": "0.48495066", "text": "func ValidateNoProxyFormat(noProxy string, ocpVersion string) error {\n\tif noProxy == \"*\" {\n\t\tif wildcardSupported, err := common.VersionGreaterOrEqual(ocpVersion, \"4.8.0-fc.4\"); err != nil {\n\t\t\treturn err\n\t\t} else if wildcardSupported {\n\t\t\treturn nil\n\t\t}\n\t\treturn errors.Errorf(\"Sorry, no-proxy value '*' is not supported in this release\")\n\t}\n\tdomains := strings.Split(noProxy, \",\")\n\tfor _, s := range domains {\n\t\ts = strings.TrimPrefix(s, \".\")\n\t\tif govalidator.IsIP(s) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif govalidator.IsCIDR(s) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif govalidator.IsDNSName(s) {\n\t\t\tcontinue\n\t\t}\n\t\treturn errors.Errorf(\"NO Proxy format is not valid: '%s'. \"+\n\t\t\t\"NO Proxy is a comma-separated list of destination domain names, domains, IP addresses or other network CIDRs. \"+\n\t\t\t\"A domain can be prefaced with '.' to include all subdomains of that domain. Use '*' to bypass proxy for all destinations with OpenShift 4.8 or later.\", noProxy)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8ef482a9a609f2b982bab336499723dc", "score": "0.48449385", "text": "func mustProxify(hostname string) bool {\r\n\tdomainProxiesCacheLock.RLock()\r\n\tb, ok := domainProxiesCache[hostname]\r\n\tdomainProxiesCacheLock.RUnlock()\r\n\tif ok {\r\n\t\treturn b\r\n\t}\r\n\tb = false\r\n\tfor _, re := range domainsRegex {\r\n\t\tb = re.MatchString(hostname)\r\n\t\tif b {\r\n\t\t\tbreak\r\n\t\t}\r\n\t}\r\n\tdomainProxiesCacheLock.Lock()\r\n\tdomainProxiesCache[hostname] = b\r\n\tdomainProxiesCacheLock.Unlock()\r\n\tlog.Println(\"Proxify:\", hostname, b)\r\n\treturn b\r\n}", "title": "" }, { "docid": "4ad4240731a15ba26889e2a25621a8c5", "score": "0.48436886", "text": "func (proxier *Proxier) OnEndpointsUpdate(allEndpoints []api.Endpoints) {\n\tproxier.mu.Lock()\n\tdefer proxier.mu.Unlock()\n\tproxier.haveReceivedEndpointsUpdate = true\n\n\tregisteredEndpoints := make(map[proxy.ServicePortName]bool) // use a map as a set\n\n\t// Update endpoints for services.\n\tfor i := range allEndpoints {\n\t\tsvcEndpoints := &allEndpoints[i]\n\n\t\t// Check is namespace is configured with network\n\t\tnamespace, err := proxier.kubeClient.Namespaces().Get(svcEndpoints.Namespace)\n\t\tif err != nil {\n\t\t\tglog.Warningf(\"Get namespace error: %v\", err)\n\t\t\tcontinue\n\t\t}\n\t\tif namespace.Spec.Network == \"\" {\n\t\t\t// Only process namespaces with network\n\t\t\t// Namespaces without network will be processed by userspace proxier\n\t\t\tcontinue\n\t\t}\n\n\t\t// We need to build a map of portname -> all ip:ports for that\n\t\t// portname. Explode Endpoints.Subsets[*] into this structure.\n\t\tportsToEndpoints := map[string][]hostPortPair{}\n\t\tfor i := range svcEndpoints.Subsets {\n\t\t\tss := &svcEndpoints.Subsets[i]\n\t\t\tfor i := range ss.Ports {\n\t\t\t\tport := &ss.Ports[i]\n\t\t\t\tfor i := range ss.Addresses {\n\t\t\t\t\taddr := &ss.Addresses[i]\n\t\t\t\t\tportsToEndpoints[port.Name] = append(portsToEndpoints[port.Name], hostPortPair{addr.IP, port.Port})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor portname := range portsToEndpoints {\n\t\t\tsvcPort := proxy.ServicePortName{NamespacedName: types.NamespacedName{Namespace: svcEndpoints.Namespace, Name: svcEndpoints.Name}, Port: portname}\n\t\t\tstate, exists := proxier.serviceMap[svcPort]\n\t\t\tif !exists || state == nil {\n\t\t\t\tstate = newServiceInfo(svcPort)\n\t\t\t\tproxier.serviceMap[svcPort] = state\n\t\t\t}\n\t\t\tcurEndpoints := []string{}\n\t\t\tif state != nil {\n\t\t\t\tcurEndpoints = state.endpoints\n\t\t\t}\n\t\t\tnewEndpoints := flattenValidEndpoints(portsToEndpoints[portname])\n\n\t\t\tif len(curEndpoints) != len(newEndpoints) || !slicesEquiv(slice.CopyStrings(curEndpoints), newEndpoints) {\n\t\t\t\tglog.V(1).Infof(\"Setting endpoints for %s to %+v\", svcPort, newEndpoints)\n\t\t\t\tstate.endpoints = newEndpoints\n\t\t\t}\n\t\t\tregisteredEndpoints[svcPort] = true\n\t\t}\n\t}\n\t// Remove endpoints missing from the update.\n\tfor service, info := range proxier.serviceMap {\n\t\t// if missing from update and not already set by previous endpoints event\n\t\tif _, exists := registeredEndpoints[service]; !exists && info.endpoints != nil {\n\t\t\tglog.V(2).Infof(\"Removing endpoints for %s\", service)\n\t\t\t// Set the endpoints to nil, we will check for this in OnServiceUpdate so that we\n\t\t\t// only remove ServicePorts that have no endpoints and were not in the service update,\n\t\t\t// that way we only remove ServicePorts that were not in both.\n\t\t\tproxier.serviceMap[service].endpoints = nil\n\t\t}\n\t}\n\n\tproxier.syncProxyRules()\n}", "title": "" }, { "docid": "94780ebcb1b65a4e0b1f7fe1054c3d16", "score": "0.4831279", "text": "func (sd *ServiceDiscovery) GetProxyServiceInstances(proxy model.Proxy) ([]*model.ServiceInstance, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "27a22522b10f58990d1dbcd7d4ceeea8", "score": "0.48175213", "text": "func isInternalConfig(cfg *rest.Config) bool {\n\thost, port := os.Getenv(\"KUBERNETES_SERVICE_HOST\"), os.Getenv(\"KUBERNETES_SERVICE_PORT\")\n\treturn cfg.Host == \"https://\"+net.JoinHostPort(host, port)\n}", "title": "" }, { "docid": "ce96064bcabc8adb577cc06d8a6b79ad", "score": "0.48159274", "text": "func requiresInternalLoadBalancer(service *v1.Service) bool {\n\tif l, ok := service.Annotations[ServiceAnnotationLoadBalancerInternal]; ok {\n\t\treturn l == \"true\"\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "270660fb106fe30e68d9ba3f21f5e7ef", "score": "0.48105222", "text": "func UpdateHttpUseConnectionInsteadofProxyconnection(client sophos.ClientInterface, val bool, options ...sophos.Option) (err error) {\n\treturn put(client, \"/api/nodes/http.use_connection_insteadof_proxyconnection\", val, options...)\n}", "title": "" }, { "docid": "b96b5a196a0c54fedaaeb1a343b3dfab", "score": "0.48090404", "text": "func New(k8s kubernetes.Interface, dp DPSyncer, hostname string, opts ...Option) (Proxy, error) {\n\n\tif k8s == nil {\n\t\treturn nil, errors.Errorf(\"no k8s client\")\n\t}\n\n\tif dp == nil {\n\t\treturn nil, errors.Errorf(\"no dataplane syncer\")\n\t}\n\n\tp := &proxy{\n\t\tk8s: k8s,\n\t\tdpSyncer: dp,\n\t\thostname: hostname,\n\t\tsvcMap: make(k8sp.ServicePortMap),\n\t\tepsMap: make(k8sp.EndpointsMap),\n\n\t\trecorder: new(loggerRecorder),\n\n\t\tminDPSyncPeriod: 30 * time.Second, // XXX revisit the default\n\n\t\tstopCh: make(chan struct{}),\n\t}\n\n\tfor _, o := range opts {\n\t\tif err := o(p); err != nil {\n\t\t\treturn nil, errors.WithMessage(err, \"applying option\")\n\t\t}\n\t}\n\n\t// We need to create the runner first as once we start getting updates, they\n\t// will kick it\n\tp.runner = async.NewBoundedFrequencyRunner(\"dp-sync-runner\",\n\t\tp.invokeDPSyncer, p.minDPSyncPeriod, time.Hour /* XXX might be infinite? */, 1)\n\tdp.SetTriggerFn(p.runner.Run)\n\n\tp.svcHealthServer = healthcheck.NewServiceHealthServer(p.hostname, p.recorder, []string{\"0.0.0.0/0\"})\n\n\tp.epsChanges = k8sp.NewEndpointChangeTracker(p.hostname,\n\t\tnil, // change if you want to provide more ctx\n\t\tv1.IPv4Protocol,\n\t\tp.recorder,\n\t\tnil,\n\t)\n\tp.svcChanges = k8sp.NewServiceChangeTracker(nil, v1.IPv4Protocol, p.recorder, nil)\n\n\tnoProxyName, err := labels.NewRequirement(apis.LabelServiceProxyName, selection.DoesNotExist, nil)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"noProxyName selector: %s\", err)\n\t}\n\n\tnoHeadlessEndpoints, err := labels.NewRequirement(v1.IsHeadlessService, selection.DoesNotExist, nil)\n\tif err != nil {\n\t\treturn nil, errors.Errorf(\"noHeadlessEndpoints selector: %s\", err)\n\t}\n\n\tlabelSelector := labels.NewSelector()\n\tlabelSelector = labelSelector.Add(*noProxyName, *noHeadlessEndpoints)\n\n\tinformerFactory := informers.NewSharedInformerFactoryWithOptions(k8s, p.syncPeriod,\n\t\tinformers.WithTweakListOptions(func(options *metav1.ListOptions) {\n\t\t\toptions.LabelSelector = labelSelector.String()\n\t\t}))\n\n\tsvcConfig := config.NewServiceConfig(\n\t\tinformerFactory.Core().V1().Services(),\n\t\tp.syncPeriod,\n\t)\n\tsvcConfig.RegisterEventHandler(p)\n\n\tvar epsRunner stoppableRunner\n\n\tepsConfig := config.NewEndpointSliceConfig(informerFactory.Discovery().V1().EndpointSlices(), p.syncPeriod)\n\tepsConfig.RegisterEventHandler(p)\n\tepsRunner = epsConfig\n\n\tp.startRoutine(func() { p.runner.Loop(p.stopCh) })\n\tp.startRoutine(func() { epsRunner.Run(p.stopCh) })\n\tp.startRoutine(func() { informerFactory.Start(p.stopCh) })\n\tp.startRoutine(func() { svcConfig.Run(p.stopCh) })\n\n\treturn p, nil\n}", "title": "" }, { "docid": "66c9b2a18b29e5e23e9636442002a127", "score": "0.48086146", "text": "func (p *Proxy) UpdateIfExists(ctx context.Context, req ResourceRequest, wrapper Wrapper) error {\n\tp.mu.RLock()\n\tdefer p.mu.RUnlock()\n\treturn p.impl.UpdateIfExists(ctx, req, wrapper)\n}", "title": "" }, { "docid": "8bc135755ee117c0d74355c99271ef9a", "score": "0.4802929", "text": "func delegateAndMergeHandleGroupVersion(w http.ResponseWriter, r *http.Request, eligibleURLs []string, eligibleURLsToAPIServiceInfos map[string]*openAPIV3APIServiceInfo) {\n\tif len(eligibleURLs) == 1 {\n\t\t// fully delegate to the handler\n\t\teligibleURLsToAPIServiceInfos[eligibleURLs[0]].handler.ServeHTTP(w, r)\n\t\treturn\n\t} else if len(eligibleURLs) > 1 {\n\t\tmergedURL, err := mergeURLETags(eligibleURLs)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to get mergedURL: %s\", err.Error())\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\n\t\tif !isHashCurrent(r.URL, mergedURL.Query().Get(\"hash\")) {\n\t\t\thttp.Redirect(w, r, mergedURL.String(), 301)\n\t\t\treturn\n\n\t\t}\n\t\tvar specs []*spec3.OpenAPI\n\t\tvar maxLastModified time.Time\n\n\t\tfor eligibleURL, apiServiceInfo := range eligibleURLsToAPIServiceInfos {\n\t\t\twriter := newInMemoryResponseWriter()\n\t\t\treq, err := createNewAPIServiceRequest(r, eligibleURL)\n\t\t\tif err != nil {\n\t\t\t\tklog.Errorf(\"failed to create request: %s\", err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// delegate to multiple apiService handlers\n\t\t\tapiServiceInfo.handler.ServeHTTP(writer, req)\n\t\t\tlastModified, err := time.Parse(time.RFC1123, writer.Header().Get(\"Last-Modified\"))\n\t\t\tif err != nil {\n\t\t\t\tklog.Warningf(\"not received Last-Modified in RFC1123 format: %s\", err.Error())\n\t\t\t} else if lastModified.After(maxLastModified) {\n\t\t\t\tmaxLastModified = lastModified\n\t\t\t}\n\n\t\t\tspec := spec3.OpenAPI{}\n\t\t\tif err := json.Unmarshal(writer.data, &spec); err != nil {\n\t\t\t\tklog.Errorf(\"failed to unmarshal OpenAPI for openapiService %v/%v: %s\", apiServiceInfo.apiService.Namespace, apiServiceInfo.apiService.Name, err.Error())\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tspecs = append(specs, &spec)\n\t\t}\n\n\t\t// prefer info and version from external apiServices (will result in openshift title and description)\n\t\tsort.Slice(specs, func(i, j int) bool {\n\t\t\tif info := specs[i].Info; info != nil && strings.HasPrefix(strings.ToLower(info.Title), \"kubernetes\") {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\treturn true\n\t\t})\n\t\tmergedSpec, err := mergeSpecsV3(specs...)\n\t\tif err != nil {\n\t\t\tklog.Errorf(\"failed to merge spec: %s\", err.Error())\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tmergedSpecJSON, _ := json.Marshal(mergedSpec)\n\n\t\tif maxLastModified.IsZero() {\n\t\t\tmaxLastModified = time.Now()\n\t\t}\n\n\t\topenAPIHandleGroupVersion(w, r, mergedSpecJSON, mergedURL.Query().Get(\"hash\"), maxLastModified)\n\t}\n}", "title": "" }, { "docid": "025529ee991cc436c3aca513cd6acb3d", "score": "0.48022005", "text": "func (p KopsProvisioner) needApiAccessViaBastion() bool {\n\n\t// if the API load balancer type is internal and there's a bastion, we need\n\t// to set up port forwarding\n\tapiLoadBalancerType, ok := p.kopsConfig.Params.CreateCluster[configKeyKopsApiLoadBalancerType]\n\tif !ok {\n\t\tlog.Logger.Infof(\"No `%s` key under the kops `%s` key. Assuming we \"+\n\t\t\t\"don't need to set up SSH port forwarding to access the API server\",\n\t\t\tconfigKeyKopsApiLoadBalancerType, configKeyKopsCreateCluster)\n\t\treturn false\n\t}\n\n\tapiLoadBalancerType = strings.ToLower(apiLoadBalancerType)\n\n\tbastionValue, ok := p.kopsConfig.Params.CreateCluster[configKeyKopsBastion]\n\tif !ok {\n\t\tlog.Logger.Infof(\"No `%s` key under the kops `%s` key. Won't set up \"+\n\t\t\t\"SSH port forwarding to access the API server\", configKeyKopsBastion,\n\t\t\tconfigKeyKopsCreateCluster)\n\t}\n\n\tbastionValue = strings.ToLower(bastionValue)\n\n\treturn apiLoadBalancerType == \"internal\" && bastionValue == \"\" || bastionValue == \"true\"\n}", "title": "" } ]
00410598bacaf9316b2c6b889aa96480
GoString returns the string representation. API parameter values that are decorated as "sensitive" in the API will not be included in the string output. The member name will be present, but the value will be replaced with "sensitive".
[ { "docid": "ffad89a9fd5a4a398e4b645c85a60dfc", "score": "0.0", "text": "func (s Notifications) GoString() string {\n\treturn s.String()\n}", "title": "" } ]
[ { "docid": "d5612f7ba09e736647ac5e632243a30b", "score": "0.5972343", "text": "func (s BotMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59660137", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59660137", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59660137", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59660137", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4630d33b70c5844b5e64ade660963a3", "score": "0.59660137", "text": "func (s Member) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "fe413ac07f0cc84c1812307664cca5c0", "score": "0.58277494", "text": "func deriveGoString(this *MyStruct) string {\n\tbuf := bytes.NewBuffer(nil)\n\tfmt.Fprintf(buf, \"func() *gostring.MyStruct {\\n\")\n\tif this == nil {\n\t\tfmt.Fprintf(buf, \"return nil\\n\")\n\t} else {\n\t\tfmt.Fprintf(buf, \"this := &gostring.MyStruct{}\\n\")\n\t\tfmt.Fprintf(buf, \"this.Int64 = %#v\\n\", this.Int64)\n\t\tif this.StringPtr != nil {\n\t\t\tfmt.Fprintf(buf, \"this.StringPtr = func (v string) *string { return &v }(%#v)\\n\", *this.StringPtr)\n\t\t}\n\t\tfmt.Fprintf(buf, \"return this\\n\")\n\t}\n\tfmt.Fprintf(buf, \"}()\\n\")\n\treturn buf.String()\n}", "title": "" }, { "docid": "1918ba7d7432948a4b58121035f828ce", "score": "0.5795115", "text": "func (p Params) String() string {\n\tvar sb strings.Builder\n\tsb.WriteString(\"Params: \\n\")\n\tsb.WriteString(fmt.Sprintf(\"ACLKey: %v\\n\", p.ACL))\n\tsb.WriteString(fmt.Sprintf(\"DAOOwnerKey: %s\\n\", p.DAOOwner))\n\tsb.WriteString(fmt.Sprintf(\"UpgradeKey: %v\\n\", p.Upgrade))\n\treturn sb.String()\n}", "title": "" }, { "docid": "86cff2e54daa28be218bf1caddc829f8", "score": "0.57886565", "text": "func (v Struct) String() string {\n\tdata, err := v.MarshalJSON()\n\tif err != nil {\n\t\treturn fmt.Sprintf(`{\"error\": %v}`, err)\n\t}\n\treturn string(data)\n}", "title": "" }, { "docid": "796d3da09122d3a6eda8d85cd2072b9e", "score": "0.57803094", "text": "func (s GetMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "de2779b21a0c4435f4cf673825eb1442", "score": "0.5764692", "text": "func (p *PluginAPI) String() string {\n\tvar lines []string\n\tlines = append(lines, \"Struct PluginAPI:\")\n\tlines = append(lines, \"\\t- Generated on: 2016-12-06 08:06:59.815134005 +0100 CET\")\n\tlines = append(lines, \"\\t- Command: go-bind-plugin -plugin-path plugin.so -plugin-package ./plugin -output-name PluginAPI -output-path plugin_api.go -output-package main -dereference-vars -rebuild\")\n\tlines = append(lines, \"\\nPlugin info:\")\n\tlines = append(lines, \"\\t- package: github.com/wendigo/go-bind-plugin-example/plugin\")\n\tlines = append(lines, \"\\t- sha256 sum: 303cd891bd37c209c0ad0798673bd871af8e6bae3673cc7c261abb54e76e6ae9\")\n\tlines = append(lines, \"\\t- size: 2578348 bytes\")\n\tlines = append(lines, \"\\nExported functions (2):\")\n\tlines = append(lines, \"\\t- CalculateSin func(float64) (float64)\")\n\tlines = append(lines, \"\\t- SayHello func(string)\")\n\n\tlines = append(lines, \"\\nExported variables (1):\")\n\tlines = append(lines, \"\\t- CurrentYear int\")\n\n\treturn strings.Join(lines, \"\\n\")\n}", "title": "" }, { "docid": "3901139e74a3c7073fb661bd90272907", "score": "0.5755617", "text": "func (s FeatureParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "acb5f15fa51a789751deffe7cde15980", "score": "0.57170886", "text": "func (bs *Bindings) String() string {\r\n\treturn \"PARAM=VALUE\"\r\n}", "title": "" }, { "docid": "1cdad9caaf72275da4ef3e46c448a1a3", "score": "0.5697086", "text": "func (p *Parms) String() string {\n\tout, _ := json.MarshalIndent(p, \"\", \"\\t\")\n\treturn string(out)\n}", "title": "" }, { "docid": "7fdd9d07690703691d426379ec8d9a7a", "score": "0.56940645", "text": "func (s MemberFrameworkAttributes) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.5667433", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "f0c8ec069ef4f371f74a77c1fff342eb", "score": "0.5667433", "text": "func (s Api) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.56571585", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "74841839d2e20d32eda2604b690f38eb", "score": "0.56571585", "text": "func (s CreateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "540636a34adb1a7967a6f8d5aa0c8445", "score": "0.5648506", "text": "func (s UpdateParam) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9a2a32846e9d15057aac9e2f35e87213", "score": "0.56295896", "text": "func String(name, val string) Field {\n\treturn Field(zap.String(name, val))\n}", "title": "" }, { "docid": "947af2e687894d6d29a03e631290b565", "score": "0.561751", "text": "func (s CognitoMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "be5fe10413aca4c98011d6d93dfe98a4", "score": "0.5608239", "text": "func (s GetMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c8c4ae4808f93da388e9d506cd9913ca", "score": "0.5605517", "text": "func (pc ParamChange) String() string {\n\treturn fmt.Sprintf(`Param Change:\n Subspace: %s\n Key: %s\n Subkey: %X\n Value: %X\n`, pc.Subspace, pc.Key, pc.Subkey, pc.Value)\n}", "title": "" }, { "docid": "d9ee2b223b7036b0844ac2370527fbfe", "score": "0.5600498", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(`Distribution Params:\n Community Tax: %s\n Withdraw Addr Enabled: %t`,\n\t\tp.CommunityTax, p.WithdrawAddrEnabled)\n}", "title": "" }, { "docid": "e26540770e51fd568fbc7de170aeb593", "score": "0.5596325", "text": "func (s SomeStruct) String() string {\n\treturn fmt.Sprintf(\"p1: %T %+v; p2: %T %+v\", s.p1, s.p1, s.p2, s.p2)\n}", "title": "" }, { "docid": "332c8c86d87b0654fa614312ec4429f0", "score": "0.55884933", "text": "func (p Provider) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "d276cf09182d09730c046fea89169f72", "score": "0.5585225", "text": "func (g *Generic) String() string {\n\tparamStr := make([]string, len(g.Params))\n\tfor i, pr := range g.Params {\n\t\tparamStr[i] = pr.String()\n\t}\n\n\treturn fmt.Sprintf(\"{Header: %s, Params: %s}\",\n\t\tg.Header.String(),\n\t\tparamStr,\n\t)\n}", "title": "" }, { "docid": "1f8cd632fedb20ae2db50fc88345f4ca", "score": "0.5579801", "text": "func (p Params) String() string {\n\treturn fmt.Sprintf(\n\t\t\"TokenCourse: %d\\n\"+\n\t\t\t\"SubscriptionPrice: %d\\n\"+\n\t\t\t\"VPNGBPrice: %d\\n\"+\n\t\t\t\"StorageGBPrice: %d\\n\"+\n\t\t\t\"BaseVPNGb: %d\\n\"+\n\t\t\t\"BaseStorageGb: %d\\n\"+\n\t\t\t\"CouseChangeSigners: %v\\n\",\n\t\tp.TokenCourse,\n\t\tp.SubscriptionPrice,\n\t\tp.VPNGBPrice,\n\t\tp.StorageGBPrice,\n\t\tp.BaseVPNGb,\n\t\tp.BaseStorageGb,\n\t\tp.CourseChangeSigners,\n\t)\n}", "title": "" }, { "docid": "5c518cab9a26cf655d1488d854d900db", "score": "0.5579521", "text": "func (s ApiCallDetails) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b4d16e7e1a6908eb2f72037bb06b0461", "score": "0.5571026", "text": "func String(param interface{}) string {\n\tvar v string\n\tif param != nil {\n\t\tv = param.(string)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "bbc0a707148f9155b8d783f7e43faf92", "score": "0.5546587", "text": "func (vl VerbLevel) String() string {\n\treturn fmt.Sprintf(\"%d=%s\", vl, vl.Name())\n}", "title": "" }, { "docid": "6fd9f1d4d485cf6d2559650a970dc32b", "score": "0.5535005", "text": "func (s UpdateMemberOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "dd68b301cb40d6e731300f1c215fe2a2", "score": "0.5529285", "text": "func (v *Service) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [6]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ThriftName: %v\", v.ThriftName)\n\ti++\n\tif v.ParentID != nil {\n\t\tfields[i] = fmt.Sprintf(\"ParentID: %v\", *(v.ParentID))\n\t\ti++\n\t}\n\tfields[i] = fmt.Sprintf(\"Functions: %v\", v.Functions)\n\ti++\n\tfields[i] = fmt.Sprintf(\"ModuleID: %v\", v.ModuleID)\n\ti++\n\tif v.Annotations != nil {\n\t\tfields[i] = fmt.Sprintf(\"Annotations: %v\", v.Annotations)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Service{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.55236137", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522052", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "3ffc25a4edc5ca7652c4750de89130eb", "score": "0.5522052", "text": "func (s Parameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "1fc7be125648c218f16c96443de5ac5a", "score": "0.550183", "text": "func (s VirtualServiceProvider) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cdfef40083c53bb9723ce783f15375e4", "score": "0.5500519", "text": "func (c CliParams) String() string {\n\tnameFmt := \"%20s: \"\n\tlines := []string{\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Debug\", c.Debug),\n\t\tfmt.Sprintf(nameFmt+\"%t\", \"Help Printed\", c.HelpPrinted),\n\t\tfmt.Sprintf(nameFmt+\"%q\", \"Errors\", c.Errors),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Input File\", c.InputFile),\n\t\tfmt.Sprintf(nameFmt+\"%d\", \"Count\", c.Count),\n\t\tfmt.Sprintf(nameFmt+\"%s\", \"Points\", c.Points),\n\t}\n\treturn strings.Join(lines, \"\\n\") + \"\\n\"\n}", "title": "" }, { "docid": "8d24224fe2d09199e308710466d5c714", "score": "0.5497302", "text": "func (p paramHeader) String() string {\n\treturn fmt.Sprintf(\"%s (%d): %s\", p.typ, p.len, p.raw)\n}", "title": "" }, { "docid": "90965527fa89e64e83e14cc67d92714c", "score": "0.5496386", "text": "func Struct2String(st interface{}) string {\n\tvt := reflect.TypeOf(st)\n\tvv := reflect.ValueOf(st)\n\tvar str = \"\"\n\tfor i := 0; i < vt.NumField(); i++ {\n\t\tf := vt.Field(i)\n\t\tfmt.Println(f)\n\t\tv := vv.Field(i)\n\t\tfmt.Println(v)\n\t\tchKey := f.Tag.Get(\"json\")\n\t\tswitch v.Kind() {\n\t\tcase reflect.String:\n\t\t\tif s, ok := v.Interface().(string); ok && s != \"\" {\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + \"\\\"\" + s + \"\\\"\" + \",\"\n\t\t\t}\n\t\tcase reflect.Int:\n\t\t\tif i, ok := v.Interface().(int); ok && i != 0 {\n\t\t\t\ts := strconv.Itoa(i)\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + \"\\\"\" + s + \"\\\"\" + \",\"\n\n\t\t\t}\n\t\tcase reflect.Uint64:\n\t\t\tif u64, ok := v.Interface().(uint64); ok && u64 != 0 {\n\t\t\t\ts := strconv.Itoa(int(u64))\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + \"\\\"\" + s + \"\\\"\" + \",\"\n\n\t\t\t}\n\t\tcase reflect.Int64:\n\t\t\tif i64, ok := v.Interface().(int64); ok && i64 != 0 {\n\t\t\t\ts := strconv.Itoa(int(i64))\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + \"\\\"\" + s + \"\\\"\" + \",\"\n\n\t\t\t}\n\n\t\tcase reflect.Uint:\n\t\t\tif u, ok := v.Interface().(uint); ok && u != 0 {\n\t\t\t\ts := strconv.Itoa(int(u))\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + \"\\\"\" + s + \"\\\"\" + \",\"\n\n\t\t\t}\n\n\t\tcase reflect.Slice:\n\t\t\tl := v.Len()\n\t\t\tstri := \"\"\n\n\t\t\tfor i := 0; i < l; i++ {\n\t\t\t\tvi := v.Index(i).Interface()\n\t\t\t\tvtype := reflect.TypeOf(vi)\n\n\t\t\t\tif vtype.Name() == \"string\" {\n\t\t\t\t\tstri += \"\\\"\" + vi.(string) + \"\\\"\" + \",\"\n\t\t\t\t} else if vtype.Name() == \"uint\" {\n\t\t\t\t\tss := strconv.Itoa(int(vi.(uint)))\n\t\t\t\t\tstri += \"\\\"\" + ss + \"\\\"\" + \",\"\n\t\t\t\t} else if vtype.Name() == \"int\" {\n\t\t\t\t\tss := strconv.Itoa(vi.(int))\n\t\t\t\t\tstri += \"\\\"\" + ss + \"\\\"\" + \",\"\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tif stri != \"\" {\n\t\t\t\tstri = stri[:len(stri)-1]\n\t\t\t\tstri = \"[\" + stri + \"]\"\n\t\t\t\tstr += \"\\\"\" + chKey + \"\\\"\" + \":\" + stri + \",\"\n\t\t\t}\n\t\tdefault:\n\t\t\tglog.Error(\"unsupport common query type: \" + string(chKey))\n\t\t\treturn \"\"\n\n\t\t}\n\t}\n\tstr = str[:len(str)-1]\n\tstr = \"{\" + str + \"}\"\n\tfmt.Println(str)\n\treturn str\n}", "title": "" }, { "docid": "1349808747e8de15d5370d22518fa43c", "score": "0.54963446", "text": "func (m Struct) String() string {\n\tif m.Type != nil {\n\t\treturn m.Type.String()\n\t}\n\tif m.AnonymousType != nil {\n\t\treturn m.AnonymousType.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "39d7f12638a8500530687c2993aec529", "score": "0.5492613", "text": "func (m *Fields) String() string {\n\treturn m.ProtoFields().String()\n}", "title": "" }, { "docid": "2fc1b2ea1d2dc3b92ae03f3c915fc03e", "score": "0.54882467", "text": "func (p *Param) String() string {\n\tswitch p.ParameterKind {\n\tcase variable, variableDecl:\n\t\treturn strconv.Quote(\"$\" + p.Name)\n\tcase declaration:\n\t\treturn p.Name\n\tcase stringConstant:\n\t\treturn strconv.Quote(p.Name)\n\tcase otherConstant:\n\t\treturn p.Name\n\tcase ignored:\n\t\treturn \"\"\n\tdefault:\n\t\treturn \"<not supported>\"\n\t}\n}", "title": "" }, { "docid": "844a81f1d0eca520ae47087c72a631f9", "score": "0.5482777", "text": "func (s OidcMemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "cfa8e2073c069b97f059aff0859d888a", "score": "0.5475792", "text": "func (_struct Struct) String() string {\n\treturn fmt.Sprintf(\"struct:%s\", _struct.Name())\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.54744244", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "c5ac32b50515a01e38f8086951fb488b", "score": "0.54744244", "text": "func (s CreateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54618174", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.54618174", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "70654039945d2320f4eee3aa3a793d94", "score": "0.546168", "text": "func (s KeyValuePair) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0763cdfe3b89f2f4d83053ed67f8ca3e", "score": "0.54559284", "text": "func (s UpdateMemberInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "498d5e67ce1e86ab266d1abca2d48628", "score": "0.5443622", "text": "func (v Value) String() string {\n\tif sp, ok := v.any.(stringptr); ok {\n\t\t// Inlining this code makes a huge difference.\n\t\tvar s string\n\t\thdr := (*reflect.StringHeader)(unsafe.Pointer(&s))\n\t\thdr.Data = uintptr(sp)\n\t\thdr.Len = int(v.num)\n\t\treturn s\n\t}\n\tvar buf []byte\n\treturn string(v.append(buf))\n}", "title": "" }, { "docid": "faed4e1bb0db60dcb2c6f36e3c1066ed", "score": "0.544317", "text": "func (k *key) String() string {\n\treturn \"api context value \" + k.name\n}", "title": "" }, { "docid": "3d29636fde22fff60ec1419e6a474619", "score": "0.5442269", "text": "func (s OutputParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "015df2e8b9c6d3d1971a27e371c5b417", "score": "0.5436579", "text": "func (b *binding) String() string {\n\tvar index string\n\tif len(b.Input.StructFieldIndex) > 0 {\n\t\tindex = strconv.Itoa(b.Input.StructFieldIndex[0])\n\t\tfor _, i := range b.Input.StructFieldIndex[1:] {\n\t\t\tindex += fmt.Sprintf(\".%d\", i)\n\t\t}\n\t} else {\n\t\tindex = strconv.Itoa(b.Input.Index)\n\t}\n\n\treturn fmt.Sprintf(\"[%s:%s] maps to [%s]\", index, b.Input.Type.String(), b.Dependency)\n}", "title": "" }, { "docid": "88d88e2a43e2ff091793f31f1de09861", "score": "0.5427817", "text": "func (p Providers) String() string {\n\tjp, _ := json.Marshal(p)\n\treturn string(jp)\n}", "title": "" }, { "docid": "1e89f691f0ca1e346e18ac407cb71020", "score": "0.54250544", "text": "func (v *Argument) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [3]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Name: %v\", v.Name)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Type: %v\", v.Type)\n\ti++\n\tif v.Annotations != nil {\n\t\tfields[i] = fmt.Sprintf(\"Annotations: %v\", v.Annotations)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"Argument{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "afa587d9da57d0e282ba78c7d2d2b6bd", "score": "0.5403453", "text": "func valueString(v reflect.Value, opts tagOptions, sf reflect.StructField) string {\n\tfor v.Kind() == reflect.Ptr {\n\t\tif v.IsNil() {\n\t\t\treturn \"\"\n\t\t}\n\t\tv = v.Elem()\n\t}\n\n\tif v.Kind() == reflect.Bool && opts.Contains(\"int\") {\n\t\tif v.Bool() {\n\t\t\treturn \"1\"\n\t\t}\n\t\treturn \"0\"\n\t}\n\n\tif v.Type() == timeType {\n\t\tt := v.Interface().(time.Time)\n\t\tif opts.Contains(\"unix\") {\n\t\t\treturn strconv.FormatInt(t.Unix(), 10)\n\t\t}\n\t\tif opts.Contains(\"unixmilli\") {\n\t\t\treturn strconv.FormatInt((t.UnixNano() / 1e6), 10)\n\t\t}\n\t\tif opts.Contains(\"unixnano\") {\n\t\t\treturn strconv.FormatInt(t.UnixNano(), 10)\n\t\t}\n\t\tif layout := sf.Tag.Get(\"layout\"); layout != \"\" {\n\t\t\treturn t.Format(layout)\n\t\t}\n\t\treturn t.Format(time.RFC3339)\n\t}\n\n\treturn fmt.Sprint(v.Interface())\n}", "title": "" }, { "docid": "2dfe657e573ecf06637fc2e4e700b49f", "score": "0.54031956", "text": "func String(v interface{}) string {\n\treturn StringWithOptions(v, nil)\n}", "title": "" }, { "docid": "fc5a5ad42da54884cfd84053b31bb46a", "score": "0.54010916", "text": "func (o *Webchatmemberinfo) String() string {\n\tj, _ := json.Marshal(o)\n\tstr, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\\\u`, `\\u`, -1))\n\n\treturn str\n}", "title": "" }, { "docid": "9670499c6928849359a95e69aff066d8", "score": "0.5391195", "text": "func (s UseCase) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7810f5262bc9faa785879a38fa9b775d", "score": "0.5387395", "text": "func (s MemberDefinition) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "9c66cccdde8c717e9a130db2918369c1", "score": "0.5386851", "text": "func (s ParameterStringFilter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7fa9ae680372df047f172b65f4ed06b4", "score": "0.53827846", "text": "func (s ApiKey) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "07756aecfbfa7ae7208809e98ffe14ee", "score": "0.53760403", "text": "func Format(arg interface{}) string {\n\n\tif arg == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tswitch v := arg.(type) {\n\tcase error:\n\t\treturn fmt.Sprintf(\"%v\", v)\n\tcase int:\n\t\treturn fmt.Sprintf(\"%d\", v)\n\tcase int64:\n\t\treturn fmt.Sprintf(\"%d\", v)\n\tcase bool:\n\t\tif v {\n\t\t\treturn \"true\"\n\t\t}\n\t\treturn \"false\"\n\tcase float64:\n\t\treturn fmt.Sprintf(\"%v\", v)\n\tcase map[string]interface{}:\n\t\tvar b strings.Builder\n\t\t// Make a list of the keys, ignoring hidden members whose name\n\t\t// starts with \"__\"\n\t\tkeys := make([]string, 0)\n\t\tfor k := range v {\n\t\t\tif len(k) < 2 || k[0:2] != \"__\" {\n\t\t\t\tkeys = append(keys, k)\n\t\t\t}\n\t\t}\n\t\tsort.Strings(keys)\n\n\t\tb.WriteString(\"{\")\n\t\tfor n, k := range keys {\n\t\t\ti := v[k]\n\t\t\tif n > 0 {\n\t\t\t\tb.WriteString(\",\")\n\t\t\t}\n\t\t\tb.WriteRune(' ')\n\t\t\tb.WriteString(k)\n\t\t\tb.WriteString(\": \")\n\t\t\tb.WriteString(Format(i))\n\t\t}\n\t\tb.WriteString(\" }\")\n\t\treturn b.String()\n\n\tcase []interface{}:\n\t\tvar b strings.Builder\n\t\tb.WriteRune('[')\n\n\t\tfor n, i := range v {\n\t\t\tif n > 0 {\n\t\t\t\tb.WriteString(\", \")\n\t\t\t}\n\t\t\tb.WriteString(Format(i))\n\t\t}\n\t\tb.WriteRune(']')\n\t\treturn b.String()\n\n\tcase string:\n\t\treturn \"\\\"\" + v + \"\\\"\"\n\n\tdefault:\n\t\tvv := reflect.ValueOf(v)\n\n\t\t// IF it's an internal function, show it's name. If it is a standard builtin from the\n\t\t// function library, show the short form of the name.\n\t\tif vv.Kind() == reflect.Func {\n\t\t\tif ui.IsActive(ui.DebugLogger) {\n\t\t\t\tname := runtime.FuncForPC(reflect.ValueOf(v).Pointer()).Name()\n\t\t\t\tname = strings.Replace(name, \"github.com/tucats/gopackages/\", \"\", 1)\n\t\t\t\tname = strings.Replace(name, \"github.com/tucats/gopackages/runtime.\", \"\", 1)\n\t\t\t\treturn \"builtin \" + name\n\t\t\t} else {\n\t\t\t\treturn \"builtin\"\n\t\t\t}\n\t\t}\n\n\t\t// If it's a bytecode.Bytecode pointer, use reflection to get the\n\t\t// Name field value and use that with the name. A function literal\n\t\t// will have no name.\n\t\tif vv.Kind() == reflect.Ptr {\n\t\t\tts := vv.String()\n\t\t\tif ts == \"<*bytecode.ByteCode Value>\" {\n\t\t\t\te := reflect.ValueOf(v).Elem()\n\t\t\t\tif ui.IsActive(ui.DebugLogger) {\n\t\t\t\t\tname := GetString(e.Field(0).Interface())\n\t\t\t\t\treturn \"func \" + name\n\t\t\t\t} else {\n\t\t\t\t\treturn \"func\"\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn fmt.Sprintf(\"ptr %s\", ts)\n\t\t}\n\n\t\tif strings.HasPrefix(vv.String(), \"<bytecode.StackMarker\") {\n\t\t\te := reflect.ValueOf(v).Field(0)\n\t\t\tname := GetString(e.Interface())\n\t\t\treturn fmt.Sprintf(\"<%s>\", name)\n\t\t}\n\n\t\tif strings.HasPrefix(vv.String(), \"<bytecode.CallFrame\") {\n\t\t\te := reflect.ValueOf(v).Field(0)\n\t\t\tmodule := GetString(e.Interface())\n\t\t\te = reflect.ValueOf(v).Field(1)\n\t\t\tline := GetInt(e.Interface())\n\t\t\treturn fmt.Sprintf(\"<frame %s:%d>\", module, line)\n\t\t}\n\n\t\tif ui.IsActive(ui.DebugLogger) {\n\t\t\treturn fmt.Sprintf(\"kind %v %#v\", vv.Kind(), v)\n\t\t}\n\t\treturn fmt.Sprintf(\"kind %v %v\", vv.Kind(), v)\n\t}\n}", "title": "" }, { "docid": "a1a197d01d3356cc58146d848344edad", "score": "0.53728163", "text": "func (s GetApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b97895ab172f3c3bfc19eea555032fed", "score": "0.53680325", "text": "func (s VirtualGateway) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "d7f44fd5d8a4877e8cb88d194df9992e", "score": "0.53636086", "text": "func (s DBParameterGroup) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "805f9eaf50d4ca9966df5d30317541b8", "score": "0.535848", "text": "func (v *ServiceGenerator_Generate_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.Request != nil {\n\t\tfields[i] = fmt.Sprintf(\"Request: %v\", v.Request)\n\t\ti++\n\t}\n\n\treturn fmt.Sprintf(\"ServiceGenerator_Generate_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.535813", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "73c0cab2005d31098ef74dae88190f1f", "score": "0.535813", "text": "func (s CreateMembersOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "95412ff336fbc5b06f35ed4ffea03a0d", "score": "0.5353382", "text": "func (this *Name) String() string {\n\tif this.DoubleValue != nil {\n\t\treturn this.Before.String() + strconv.FormatFloat(this.GetDoubleValue(), 'f', -1, 64)\n\t}\n\tif this.IntValue != nil {\n\t\treturn this.Before.String() + strconv.FormatInt(this.GetIntValue(), 10)\n\t}\n\tif this.UintValue != nil {\n\t\treturn this.Before.String() + \"uint(\" + strconv.FormatUint(this.GetUintValue(), 10) + \")\"\n\t}\n\tif this.BoolValue != nil {\n\t\treturn this.Before.String() + strconv.FormatBool(this.GetBoolValue())\n\t}\n\tif this.StringValue != nil {\n\t\tif isId(this.GetStringValue()) {\n\t\t\treturn this.Before.String() + this.GetStringValue()\n\t\t}\n\t\treturn this.Before.String() + strconv.Quote(this.GetStringValue())\n\t}\n\tif this.BytesValue != nil {\n\t\treturn this.Before.String() + fmt.Sprintf(\"%#v\", this.GetBytesValue())\n\t}\n\tpanic(\"unreachable\")\n}", "title": "" }, { "docid": "11c90d6ee574cda9903fc75bee8832a0", "score": "0.53370744", "text": "func (s DBClusterMember) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "90faaf1f49275808b1cf90892b5cabaf", "score": "0.5335552", "text": "func (b *BitSet) String() string {\n\tm := b.Members()\n\ts := make([]byte, 0, 4*len(m))\n\ts = append(s, '{')\n\tfor _, i := range m {\n\t\ts = append(s, fmt.Sprintf(\" %d\", i)...)\n\t}\n\treturn string(append(s, \" }\"...))\n}", "title": "" }, { "docid": "cf74941b482b7a2a8b7fc968d6b30327", "score": "0.5335339", "text": "func (s ServiceFlags) String() string {\n\tvar str []string\n\n\tstr = append(str, string(s.SVCType()))\n\tif s&serviceFlagExtLocalScope != 0 {\n\t\tstr = append(str, string(SVCTrafficPolicyLocal))\n\t}\n\tif s&serviceFlagIntLocalScope != 0 {\n\t\tstr = append(str, \"Internal\"+string(SVCTrafficPolicyLocal))\n\t}\n\tif s&serviceFlagTwoScopes != 0 {\n\t\tstr = append(str, \"two-scopes\")\n\t}\n\tif s&serviceFlagSessionAffinity != 0 {\n\t\tstr = append(str, \"sessionAffinity\")\n\t}\n\tif s&serviceFlagRoutable == 0 {\n\t\tstr = append(str, \"non-routable\")\n\t}\n\tif s&serviceFlagSourceRange != 0 {\n\t\tstr = append(str, \"check source-range\")\n\t}\n\tif s&serviceFlagNat46x64 != 0 {\n\t\tstr = append(str, \"46x64\")\n\t}\n\tif s&serviceFlagL7LoadBalancer != 0 {\n\t\tstr = append(str, \"l7-load-balancer\")\n\t}\n\tif s&serviceFlagLoopback != 0 {\n\t\tstr = append(str, \"loopback\")\n\t}\n\n\treturn strings.Join(str, \", \")\n}", "title": "" }, { "docid": "ecb2b8d2d35038266c47a6c30b80ab8d", "score": "0.53333896", "text": "func (g Groups) String() string {\n\tjg, _ := json.Marshal(g)\n\treturn string(jg)\n}", "title": "" }, { "docid": "773ad15412af46740aafdd1afa28c4c8", "score": "0.53247327", "text": "func (s SigningProfileParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0180a328e152f607e55b36879703cf07", "score": "0.53233093", "text": "func (mf *mapFlags) String() string {\n\tkvs := make([]string, 0, len(mf.kv))\n\tfor k, v := range mf.kv {\n\t\tkvs = append(kvs, fmt.Sprintf(\"-%s=%s\", k, v))\n\t}\n\treturn strings.Join(kvs, \" \")\n}", "title": "" }, { "docid": "86c6ff3636cf0c4b0e477cba21a3618f", "score": "0.5313489", "text": "func (m JModifier) String() string {\n\tstr := \"\"\n\tif m&PRIVATE != 0 {\n\t\tstr = cat(str, \"private\")\n\t}\n\tif m&PROTECTED != 0 {\n\t\tstr = cat(str, \"protected\")\n\t}\n\tif m&PUBLIC != 0 {\n\t\tstr = cat(str, \"public\")\n\t}\n\tif m&STATIC != 0 {\n\t\tstr = cat(str, \"static\")\n\t}\n\tif m&FINAL != 0 {\n\t\tstr = cat(str, \"final\")\n\t}\n\tif str != \"\" {\n\t\tstr += \" \"\n\t}\n\treturn str\n}", "title": "" }, { "docid": "0ad07a9b9869d52130b409848ad40f06", "score": "0.5311528", "text": "func (g GetObjectInput) String() string {\n\treturn helper.Prettify(g)\n}", "title": "" }, { "docid": "3c6ea52c31fecb017c6fe640de94e2bc", "score": "0.5309984", "text": "func (P ConnectionParams) String() string {\n\treturn P.string(true, false)\n}", "title": "" }, { "docid": "1d4e7d34766971f14676e1ed1bb0333d", "score": "0.5308925", "text": "func (s DocumentParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "703f1405e08be3ad196f01e0383dac4b", "score": "0.5308519", "text": "func (t *Struct) String() string { return t.Name }", "title": "" }, { "docid": "a47b4009eb0fdc75f9d01fcc9dbf38a2", "score": "0.53069043", "text": "func (c *Cmd) String(p StringParam) *string {\n\tinto := new(string)\n\tvalue := values.NewString(into, p.value())\n\n\tswitch x := p.(type) {\n\tcase StringOpt:\n\t\tc.mkOpt(container.Container{Name: x.Name, Desc: x.Desc, EnvVar: x.EnvVar, HideValue: x.HideValue, Value: value, ValueSetByUser: x.SetByUser})\n\tcase StringArg:\n\t\tc.mkArg(container.Container{Name: x.Name, Desc: x.Desc, EnvVar: x.EnvVar, HideValue: x.HideValue, Value: value, ValueSetByUser: x.SetByUser})\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"Unhandled param %v\", p))\n\t}\n\n\treturn into\n}", "title": "" }, { "docid": "decd8e9f3b4aa59eb22e199be9f77f20", "score": "0.5306069", "text": "func (o ExportPolicyCreateRequest) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "d00241105253d4428c22acb51ad5ae04", "score": "0.530535", "text": "func (obj KeyColumnUsage) String() string {\n\tif data, err := json.Marshal(obj); err != nil {\n\t\treturn fmt.Sprintf(\"<KeyColumnUsage>\")\n\t} else {\n\t\treturn string(data)\n\t}\n}", "title": "" }, { "docid": "2e5cf7aeadef29bfb22dee4204766b1b", "score": "0.5304928", "text": "func (s CreateApiOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "447719bdb220732b4bce8c4dc6d60e01", "score": "0.5303592", "text": "func (p *Parameters) String() string {\n\tif p == nil {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s%s%s\", p.URL.String(), p.Headers.String(), p.TLSClient.String())\n}", "title": "" }, { "docid": "621894444e85b1dadecdc7c588e9c52b", "score": "0.5298738", "text": "func (p *VCardProperty) String() string {\n\treturn fmt.Sprintf(\" %s (type=%s, parameters=%v): %v\", p.Name, p.Type, p.Parameters, p.Value)\n}", "title": "" }, { "docid": "1b2a8352876879325a645931b300d9b0", "score": "0.5296363", "text": "func (a APIType) String() string {\n\tswitch a {\n\tcase EGL:\n\t\treturn \"EGL\"\n\tcase GLES2:\n\t\treturn \"GLES2\"\n\tcase GLES3:\n\t\treturn \"GLES3\"\n\tcase GLES31:\n\t\treturn \"GLES31\"\n\tcase VK:\n\t\treturn \"VK\"\n\t}\n\treturn fmt.Sprintf(\"UNKNOWN (%d)\", a)\n}", "title": "" }, { "docid": "7657ce98c9091c9009ef40f193e1f111", "score": "0.528619", "text": "func (opt OptNameOnly) String() string {\n\treturn \"OptNameOnly: \" + strconv.FormatBool(bool(opt))\n}", "title": "" }, { "docid": "dcd98e1d24da09b3d784b9efa32d91e9", "score": "0.52859807", "text": "func (pv MockPV) String() string {\n\tmpv, _ := pv.GetPubKey() // mockPV will never return an error, ignored here\n\treturn fmt.Sprintf(\"MockPV{%v}\", mpv.Address())\n}", "title": "" }, { "docid": "b73fb1a90cfbf19d9f4af1907aebd320", "score": "0.52823204", "text": "func (s GetApiInput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "e3de9d748bc3a8216c3e1839feabaed8", "score": "0.5282303", "text": "func (s AdMarkerPassthrough) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "0186e0dbb461d117707ba8002c53825c", "score": "0.52794826", "text": "func String(group InstanceGroup) string {\n\tvar buffer bytes.Buffer\n\twriteString := func(s string) {\n\t\t_, _ = buffer.WriteString(s)\n\t}\n\twriteString(\"app=\")\n\twriteString(group.App())\n\twriteString(\" account=\")\n\twriteString(group.Account())\n\tregion, ok := group.Region()\n\tif ok {\n\t\twriteString(\" region=\")\n\t\twriteString(region)\n\t}\n\tstack, ok := group.Stack()\n\tif ok {\n\t\twriteString(\" stack=\")\n\t\twriteString(stack)\n\t}\n\tcluster, ok := group.Cluster()\n\tif ok {\n\t\twriteString(\" cluster=\")\n\t\twriteString(cluster)\n\t}\n\n\treturn buffer.String()\n}", "title": "" }, { "docid": "8b1fc195738be037bde65b478aa60e90", "score": "0.52783513", "text": "func (o VolumeInfinitevolAttributesType) String() string {\n\treturn ToString(reflect.ValueOf(o))\n}", "title": "" }, { "docid": "4873139562b1e1270fb504c8a70a35e5", "score": "0.5273046", "text": "func (v Vector) String() string {\n\treturn fmt.Sprintf(\"%v:%v\", v.Gate, v.Valve)\n}", "title": "" }, { "docid": "f03cd35a740e74ed99ab0128f55710f1", "score": "0.5271403", "text": "func (s WorkflowParameter) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6a27d4f86d8ca5217b4512f4ac5316b1", "score": "0.52666306", "text": "func (s ModifyVpcAttributeOutput) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "a09fa60eb76413dee9fd910b59301e2c", "score": "0.5261972", "text": "func (sv SV) String() string {\n\tif !sv.hasBeenSet {\n\t\treturn \"\"\n\t}\n\n\tb := \"\"\n\tpr := \"\"\n\tif len(sv.buildIDs) > 0 {\n\t\tb = \"+\" + strings.Join(sv.buildIDs, \".\")\n\t}\n\tif len(sv.preRelIDs) > 0 {\n\t\tpr = \"-\" + strings.Join(sv.preRelIDs, \".\")\n\t}\n\treturn fmt.Sprintf(\"v%d.%d.%d%s%s\", sv.major, sv.minor, sv.patch, pr, b)\n}", "title": "" } ]
c5c4d8e2bbe374761ce4fd43a8c139b9
Handle handles the event by calling the function.
[ { "docid": "efd509df51ebafe88e5d4b80639a27c2", "score": "0.63378716", "text": "func (f FuncBindings) Handle(w Widget, event term.Event) bool {\n\treturn f(w, event)\n}", "title": "" } ]
[ { "docid": "8cf8deba1bce72cd78836f730d600671", "score": "0.75251245", "text": "func (f HandlerFunc) Handle(e boilerplater.SystemEvent) {\n\tf(e)\n}", "title": "" }, { "docid": "46148505f121a6de29d5ecf15fb06e2d", "score": "0.71466684", "text": "func (f eventHandlerFunc) handleEvent(event model.Event) error {\n\treturn f(event)\n}", "title": "" }, { "docid": "65ad6ece5144693ecb79d37964119ff8", "score": "0.7088789", "text": "func (f HandlerFunc) HandleEvent(w ResponseWriter, e interface{}) {\n\tf(w, e)\n}", "title": "" }, { "docid": "1937dc6c1ca678fe58151def089d3b1e", "score": "0.6942237", "text": "func (c *Client) HandleEvent(handleEvent func(event *Event)) {\n\tc.handleEvent = handleEvent\n}", "title": "" }, { "docid": "4e764580aea59a7fa7f3f0f129280d9a", "score": "0.69259316", "text": "func (wh WorkHandler) HandleEvent(in interface{}) (interface{}, error) {\n\treturn wh(in)\n}", "title": "" }, { "docid": "4f1fa980bf11b0d63c0709ab2df3e659", "score": "0.67878467", "text": "func (_m *EventListener) HandleEvent(event events.Event) {\n\t_m.Called(event)\n}", "title": "" }, { "docid": "bd3c503497dc5b5dc7ed920886867bcf", "score": "0.6693804", "text": "func (f EventHandlerFunc) HandleEvent(ctx context.Context, e Event) error {\n\treturn f(ctx, e)\n}", "title": "" }, { "docid": "fa0d435919cfb9fd458192206a400e26", "score": "0.66002613", "text": "func (h *Handler) Handle(e handler.Event) error {\n\tbytes, err := e.Serialize()\n\tif err == nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"event\": e,\n\t\t\t\"function_name\": h.FunctionName,\n\t\t}).Info(\"invoking lambda function\")\n\n\t\tsvc := lambda.New(session.New())\n\t\tparams := &lambda.InvokeInput{\n\t\t\tFunctionName: aws.String(h.FunctionName),\n\t\t\tInvocationType: aws.String(lambda.InvocationTypeEvent),\n\t\t\tPayload: bytes,\n\t\t\tQualifier: aws.String(h.Qualifier),\n\t\t}\n\t\t_, err = svc.Invoke(params)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "a384d683af1d9610e6d6d28810c36b46", "score": "0.65205884", "text": "func (w *World) HandleEvent(e sdl.Event) {\n\t//fmt.Printf(\"Event: %T\", e)\n}", "title": "" }, { "docid": "97f2dd51babbfd0e8bdb376d77d2a786", "score": "0.6489299", "text": "func (r Resource) HandleEvent(response http.ResponseWriter, request *http.Request) {\n\tel, err := r.TriggersClient.TektonV1alpha1().EventListeners(r.EventListenerNamespace).Get(r.EventListenerName, metav1.GetOptions{})\n\tif err != nil {\n\t\tlog.Printf(\"Error getting EventListener %s in Namespace %s: %s\", r.EventListenerName, r.EventListenerNamespace, err)\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tevent, err := ioutil.ReadAll(request.Body)\n\tif err != nil {\n\t\tlog.Printf(\"Error reading event body: %s\", err)\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\teventID := template.UID()\n\tlog.Printf(\"EventListener: %s in Namespace: %s handling event (EventID: %s) with payload: %s and header: %v\",\n\t\tr.EventListenerName, r.EventListenerNamespace, eventID, string(event), request.Header)\n\n\t// Execute each Trigger\n\tfor _, trigger := range el.Spec.Triggers {\n\t\tgo r.executeTrigger(event, request, trigger, eventID)\n\t}\n\n\t// TODO: Do we really need to return the entire body back???\n\tfmt.Fprintf(response, \"EventListener: %s in Namespace: %s handling event (EventID: %s) with payload: %s and header: %v\",\n\t\tr.EventListenerName, r.EventListenerNamespace, string(eventID), string(event), request.Header)\n}", "title": "" }, { "docid": "e25d18225deaee8d9dd9abc4377e849e", "score": "0.6415449", "text": "func (s *Summarizer) handleEvent(event *sEventOp) {\n\n\tswitch event.action {\n\tcase \"tick\":\n\t\ts.tick()\n\tcase \"stop\":\n\t\ts.stop()\n\tcase \"pause\":\n\t\ts.pause()\n\tcase \"error\":\n\t\ts.error()\n\t}\n\n\t// send the response so the caller can continue on\n\tevent.res <- true\n}", "title": "" }, { "docid": "c05ea0736d1cb5eefe80c816a78ca2dd", "score": "0.6359556", "text": "func (gl *gameLoop) handleEvent(event model.Event) error {\n\terr := gl.eventHandler.handleEvent(event)\n\treturn errors.Wrap(err, \"event handler error while handling event\")\n}", "title": "" }, { "docid": "829ff8d1e6c0a38c726ae035098f92c6", "score": "0.63399595", "text": "func (c *Client) handleEvent(payload []byte) {\n\tmessage := Event{}\n\n\tjson.Unmarshal(payload, &message)\n\n\tevent := message.Event\n\n\tif c.handlers[event] != nil {\n\t\tc.handlers[event] <- message.Data\n\t}\n}", "title": "" }, { "docid": "6d7e2201a35c6376f41dcadb7cc6d9c3", "score": "0.6308484", "text": "func (fm *Fesl) Handle(event network.SocketEvent) {\n\tev, ok := event.Data.(network.EventClientCommand)\n\tif !ok {\n\t\tlogrus.Error(\"Logic error: Cannot cast event to network.EventClientCommand\")\n\t\treturn\n\t}\n\n\tif !ev.Client.IsActive {\n\t\tlogrus.WithField(\"command\", ev.Command).Warn(\"Inactive client\")\n\t\treturn\n\t}\n\n\tfn, ok := fm.cmds.Find(event.Name)\n\tif !ok {\n\t\tlogrus.\n\t\t\tWithFields(logrus.Fields{\n\t\t\t\t\"event\": event.Name,\n\t\t\t\t\"payload\": ev.Command.Message,\n\t\t\t\t\"query\": ev.Command.Query,\n\t\t\t}).\n\t\t\tWarn(\"fesl.UnhandledRequest\")\n\t\treturn\n\t}\n\n\tfn(ev)\n}", "title": "" }, { "docid": "7fbe222c0ce084a853b49bd8b3783f3c", "score": "0.6297416", "text": "func (m *EventHandler) HandleEvent(event eh.Event) {\n\tm.Events = append(m.Events, event)\n\tm.Recv <- event\n}", "title": "" }, { "docid": "e7eee7711d4838c31b0e00eaaf130b88", "score": "0.62967306", "text": "func (m *Module) HandleEvent(event *sprobe.Event) {\n\tif ruleSet := m.GetRuleSet(); ruleSet != nil {\n\t\truleSet.Evaluate(event)\n\t}\n}", "title": "" }, { "docid": "f4be7aa0d4400cde660ff5a422bc2f8e", "score": "0.6293039", "text": "func (b Bot) HandleEvent(e fbot.Event) {\n\tif e.Type == fbot.EventError {\n\t\tb.err.Println(e.Text)\n\t\treturn\n\t}\n\n\tif e.Type == fbot.EventUnknown {\n\t\tb.err.Println(\"received unknown event\", e)\n\t\treturn\n\t}\n\n\tif e.Type == fbot.EventRead {\n\t\tif err := b.store.SetRead(e.ChatID, e.Time); err != nil {\n\t\t\tb.err.Println(err)\n\t\t}\n\t\treturn\n\t}\n\n\tb.scheduleNotify(e.ChatID)\n\n\tif e.Type == fbot.EventPayload {\n\t\tb.handlePayload(e.ChatID, e.Payload)\n\t\treturn\n\t}\n\n\tb.handleMessage(e.ChatID, e.Text)\n}", "title": "" }, { "docid": "54171e2ecb759d44d41f211b67c48f62", "score": "0.62927693", "text": "func Handle(action string, target string, timestamp string) {\n\tfmt.Printf(\"event [%s] detected at [%s] target: %s\\n\", action, timestamp, target)\n\treturn\n}", "title": "" }, { "docid": "3c149fa795535477160d4aa75c8701b9", "score": "0.62693995", "text": "func (a *actor) Handle(e Event) error {\n\treturn a.handler(e)\n}", "title": "" }, { "docid": "acbaa2b82ed6fd8da577f040790bfbaf", "score": "0.622202", "text": "func (f *Synchro) doEvent(evt SynchroEvent, msg string) {\n\tif f.evtCb != nil {\n\t\tf.evtCb(evt, msg)\n\t}\n}", "title": "" }, { "docid": "428d61331ec29cc8ffec36cfb8e758c1", "score": "0.62196094", "text": "func (h Handler) Handle(ctx context.Context, event Event) (events.APIGatewayProxyResponse, error) {\n\tif len(event.Records) > 0 {\n\n\t\tlog.Infof(\"Running %s...\", constants.CreateEvent)\n\t\trecord, err := cwevents.ParseRecord(event.Records[0].Change.NewImage)\n\t\tif err != nil {\n\t\t\treturn sendResponse(err)\n\t\t}\n\t\treturn sendResponse(cwevents.CreateEvents(record))\n\n\t} else {\n\n\t\tvar body Body\n\t\terr := json.Unmarshal([]byte(event.Body), &body)\n\t\tif err != nil {\n\t\t\treturn sendResponse(err)\n\t\t}\n\n\t\tswitch body.Function {\n\t\tcase constants.CreateExam:\n\t\t\tlog.Infof(\"Running %s...\", constants.CreateExam)\n\t\t\treturn sendResponse(exams.CreateExam(body.Exam))\n\t\tcase constants.StartScale:\n\t\t\tlog.Infof(\"Running %s...\", constants.StartScale)\n\t\t\tif err = scale.UpdateCapacity(body.Event.Students); err != nil {\n\t\t\t\treturn sendResponse(err)\n\t\t\t}\n\t\t\treturn sendResponse(cwevents.DeleteRule(body.Event.Name))\n\t\tcase constants.EndScale:\n\t\t\tlog.Infof(\"Running %s...\", constants.EndScale)\n\t\t\tif err = scale.UpdateCapacity(0); err != nil {\n\t\t\t\treturn sendResponse(err)\n\t\t\t}\n\t\t\treturn sendResponse(cwevents.DeleteRule(body.Event.Name))\n\n\t\t}\n\t\treturn sendResponse(errors.New(\"unknown or missing function\"))\n\n\t}\n}", "title": "" }, { "docid": "56ed949365bc7612fea9c37a6399f4e7", "score": "0.6206049", "text": "func HandleEvent(res http.ResponseWriter, req *http.Request) {\n\tdecoder := json.NewDecoder(req.Body)\n\tvar e Event\n\terr := decoder.Decode(&e)\n\tif err != nil {\n\t\tglog.Errorln(\"Failed to parse event:\", err)\n\t\tres.WriteHeader(http.StatusBadRequest)\n\t\tres.Write([]byte(\"Invalid event format\"))\n\t\treturn\n\t}\n\n\tswitch e.Event {\n\tcase \"start\":\n\t\tgo EventStart(e)\n\tcase \"image\":\n\t\tgo EventImage(e)\n\tcase \"video\":\n\t\tgo EventVideo(e)\n\tdefault:\n\t\tglog.Errorf(\"Unhandled event type: %+v\\n\", e)\n\t}\n\n\tres.WriteHeader(http.StatusOK)\n\treturn\n}", "title": "" }, { "docid": "3a2552da85dbc6d17ae12628d5769a07", "score": "0.6142791", "text": "func (h *EventHandler) Handle(w http.ResponseWriter, r *http.Request) {\n\tmetrics.Time(\"events.response\", func() {\n\t\tlimitedBody := http.MaxBytesReader(w, r.Body, h.maxEventSize)\n\t\tdefer limitedBody.Close()\n\t\tbody, err := ioutil.ReadAll(limitedBody)\n\t\tif err != nil {\n\t\t\tdrop(err, w)\n\t\t\treturn\n\t\t}\n\n\t\te, err := events.ParseEvent(body)\n\t\tif err != nil {\n\t\t\tdrop(err, w)\n\t\t\treturn\n\t\t}\n\n\t\tmetrics.Mark(\"events.requests.\" + e.Type)\n\t\tdelay := time.Now().Unix() - e.Timestamp.Unix()\n\t\tmetrics.UpdateGauge(\"events.requests.delay.current\", delay)\n\t\tlog.WithFields(log.Fields{\"EventType\": e.Type, \"OriginalTimestamp\": e.Timestamp.String()}).Debug(\"Received event\")\n\n\t\tif e.Type != statusUpdateEventType && e.Type != healthStatusChangedEventType {\n\t\t\tdrop(fmt.Errorf(\"%s is not supported\", e.Type), w)\n\t\t\treturn\n\t\t}\n\n\t\tselect {\n\t\tcase h.eventQueue <- event{eventType: e.Type, body: body, timestamp: time.Now()}:\n\t\t\taccept(w)\n\t\tdefault:\n\t\t\tmetrics.Mark(\"events.queue.drop\")\n\t\t\tdrop(errors.New(\"Event queue full\"), w)\n\t\t}\n\n\t})\n}", "title": "" }, { "docid": "016e1e2b5275d7121ffdeda4c1ceec91", "score": "0.60792005", "text": "func HandleEvent(ctx context.Context, data MyData) error {\n\tcex, ok := efgh.CloudEvent(ctx)\n\tif !ok {\n\t\tlog.Printf(\"Couldn't extract context for event: %+v\\n\", data)\n\t\treturn errors.New(\"Couldn't extract context, failing\")\n\t}\n\tlog.Printf(\"Read event %s at %s: %+v\\n\", cex.EventID, cex.EventTime.Format(time.RFC3339), data)\n\treturn nil\n}", "title": "" }, { "docid": "2167e51ccb5b69153ad8c25baa2c2aab", "score": "0.60678536", "text": "func (listener VisitListener) Handle() {\n\tfmt.Println(\"Say hello to my little friend \" + listener.Event.Visitor)\n}", "title": "" }, { "docid": "8c880676bebf7b082421fb87d5c9dbbb", "score": "0.60528487", "text": "func HandleEvent(c *gin.Context) {\n\tns := c.Param(\"ns\")\n\n\tvar data map[string]interface{}\n\terr := c.BindJSON(&data)\n\tif err != nil {\n\t\tc.JSON(400, gin.H{\"message\": \"Fail to parse event\"})\n\t\treturn\n\t}\n\n\tevent, err := types.ParseEvent(defaultCheckTTL, data)\n\tif err != nil {\n\t\tlogrus.WithError(err).WithField(\"body\", data).Error(\"Fail to parse event\")\n\t\tc.JSON(400, gin.H{\"message\": err.Error()})\n\t\treturn\n\t}\n\n\tmutex.Lock()\n\tdefer mutex.Unlock()\n\tif _, ok := events[ns]; !ok {\n\t\tevents[ns] = map[string]types.Event{}\n\t}\n\tevents[ns][event.ID] = event\n}", "title": "" }, { "docid": "038db57a576e5bd11fac515327a28b0d", "score": "0.6033591", "text": "func (h *apigeeSyncHandler) Handle(e apid.Event) {\n\n\tif changeSet, ok := e.(*common.ChangeList); ok {\n\t\th.processChangeList(changeSet)\n\t} else if snapData, ok := e.(*common.Snapshot); ok {\n\t\th.processSnapshot(snapData)\n\t} else {\n\t\tlog.Debugf(\"Received invalid event. Ignoring. %v\", e)\n\t}\n}", "title": "" }, { "docid": "0eba4648e470cd4d4ac1cf636e34cdf9", "score": "0.60242695", "text": "func (p *Transport) Handle(event EventType, handler FrameHandler) {\n\tp.mu.Lock()\n\tp.handlers[int(event)] = handler\n\tp.mu.Unlock()\n}", "title": "" }, { "docid": "d848a3c9a44284e602a3b0f5a8b4dfca", "score": "0.59963584", "text": "func (m *MockEventHandler) HandleEvent(e serf.Event) {\n\tm.Called(e)\n\treturn\n}", "title": "" }, { "docid": "19a025855fc64eaf60c11e8883ab2b16", "score": "0.5995624", "text": "func (h *handler) Handle(event alert.Event) {\n\t// Execute templates\n\ttd := event.TemplateData()\n\tvar buf bytes.Buffer\n\tfor i, d := range h.c.DataList {\n\t\terr := d.tmpl.Execute(&buf, td)\n\t\tif err != nil {\n\t\t\th.logger.Println(\"E! failed to handle event\", err)\n\t\t\treturn\n\t\t}\n\t\th.c.DataList[i].Value = buf.String()\n\t\tbuf.Reset()\n\t}\n\tif err := h.s.Trap(h.c.TrapOid, h.c.DataList); err != nil {\n\t\th.logger.Println(\"E! failed to handle event\", err)\n\t}\n}", "title": "" }, { "docid": "4fd867fe3ce2ce8935013f2bbb1d339d", "score": "0.5994579", "text": "func (b *Outbox) HandleEvent(ctx context.Context, event eh.Event) error {\n\treturn b.h.HandleEvent(ctx, event)\n}", "title": "" }, { "docid": "cb41785d81c47dcdaf03a7c477a1a5d0", "score": "0.5976408", "text": "func EventHandler(w http.ResponseWriter, r *http.Request) {\n\trawBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tFailResponse(w)\n\t\treturn\n\t}\n\tvar eventWrapper EventWrapper\n\tjson.Unmarshal(rawBody, &eventWrapper)\n\n\tswitch eventWrapper.Type {\n\tcase \"url_verification\":\n\t\thandleChallenge(eventWrapper, w)\n\tcase \"event_callback\":\n\t\thandleEvent(*eventWrapper.Event)\n\t}\n}", "title": "" }, { "docid": "8279bc538cdf2785fa39bb2968c3a1b7", "score": "0.5957906", "text": "func (p *Handler) Handle(event json.RawMessage, ctx *apex.Context) (interface{}, error) {\n\n\t// Parse the incoming proxy event from API Gateway\n\tproxyEvent := &Event{}\n\terr := json.Unmarshal(event, proxyEvent)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Parse proxy event: %s\", err)\n\t}\n\n\t// Build an http.Request from the evnt\n\trequest, err := buildRequest(proxyEvent, ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Build request: %s\", err)\n\t}\n\tresponseWriter := &ResponseWriter{}\n\n\t// Handle the request\n\tp.Handler.ServeHTTP(responseWriter, request)\n\n\t// Finish writing the response\n\tresponseWriter.finish()\n\n\treturn &responseWriter.response, nil\n}", "title": "" }, { "docid": "47f2f02ec3bd33d9f77089441b882b57", "score": "0.5955812", "text": "func (m *MentionMux) HandleEvent(r *Request) {\n\tif r.Message.Command != \"PRIVMSG\" {\n\t\t// TODO: Log this\n\t\treturn\n\t}\n\n\tlastArg := r.Message.Trailing()\n\tnick := r.CurrentNick()\n\n\t// We only handle this event if it starts with the\n\t// current bot's nick followed by punctuation\n\tif len(lastArg) < len(nick)+2 ||\n\t\t!strings.HasPrefix(lastArg, nick) ||\n\t\t!unicode.IsPunct(rune(lastArg[len(nick)])) ||\n\t\tlastArg[len(nick)+1] != ' ' {\n\t\treturn\n\t}\n\n\t// Copy it into a new Event\n\tnewRequest := r.Copy()\n\n\t// Strip the nick, punctuation, and spaces from the message\n\tnewRequest.Message.Params[len(newRequest.Message.Params)-1] = strings.TrimSpace(lastArg[len(nick)+1:])\n\n\tm.lock.RLock()\n\tdefer m.lock.RUnlock()\n\n\tfor _, h := range m.handlers {\n\t\th(newRequest)\n\t}\n}", "title": "" }, { "docid": "57ded566c37b37bb538f0f673e0bc3d4", "score": "0.5955525", "text": "func (mux *ServeMux) HandleEvent(resp ResponseWriter, event interface{}) {\n\t// Can do some pre-processing, logging, stats, etc here...\n\th, _ := mux.Handler(event)\n\tif h != nil {\n\t\th.HandleEvent(resp, event)\n\t}\n}", "title": "" }, { "docid": "9413d9b5fd654b5af01f5e7878ac0408", "score": "0.5949949", "text": "func (c *clientConn) HandleEvent(ctx context.Context, e IEvent, resp chan<- []byte) error {\n\tswitch ev := e.(type) {\n\tcase *killQueryEvent:\n\t\treturn c.handleKillQuery(ev, resp)\n\tcase *setVarEvent:\n\t\treturn c.handleSetVar(ev)\n\tcase *prepareEvent:\n\t\treturn c.handlePrepare(ev)\n\tdefault:\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3fa3c988e75fbaf1d3020451bcec494a", "score": "0.59323275", "text": "func (e *EventHandler) Handle(action string, h func(context.Context, *types.WorkloadEventMessage)) {\n\te.Lock()\n\tdefer e.Unlock()\n\te.handlers[action] = h\n}", "title": "" }, { "docid": "aad1d710ff867fad827b612b855a41e0", "score": "0.59125906", "text": "func (n Controller) Handle(ac appcontext.AppContext, input HandleInput) *Response {\n\tlog.InfoWithContext(ac, \"call inputport\", input)\n\n\tdata := notifyevent.InputData{\n\t\tUserID: input.UserID,\n\t\tMessage: input.Message,\n\t}\n\n\t// Receive error to send error state to SQS.\n\terr := n.inputPort.NotifyEvent(ac, data)\n\n\tlog.InfoWithContext(ac, \"return from inputport\", err)\n\n\tresp := &Response{\n\t\tError: err,\n\t}\n\n\tlog.InfoWithContext(ac, \"handler output\", *resp)\n\n\treturn resp\n}", "title": "" }, { "docid": "ad830a614d6635d1ba724564744c4f2a", "score": "0.59120053", "text": "func (l *Assigner) HandleEvent(eventName string, payload *[]byte) error {\n\tevent, err := gh.ParseWebHook(eventName, *payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\tswitch event := event.(type) {\n\tcase *gh.PullRequestEvent:\n\t\tif actions.ShouldRunOnPullRequest(event, l.IssuesAssignerConfig.Actions) {\n\t\t\terr = l.runOnPR(event.PullRequest)\n\t\t}\n\tcase *gh.IssuesEvent:\n\t\tif actions.ShouldRunOnIssue(event, l.IssuesAssignerConfig.Actions) {\n\t\t\terr = l.runOnIssue(event.Issue)\n\t\t}\n\t}\n\treturn err\n}", "title": "" }, { "docid": "2f92fceddecb3966ccf0d8b6b4ac23d2", "score": "0.5906684", "text": "func (p *eventWrapper) EventHandler(event eventstore.Event) error {\n\tswitch event.Type {\n\tcase \"PollCreated\":\n\t\treturn p.PollCreatedHandler(voting.PollCreated{\n\t\t\tID: event.ID,\n\t\t})\n\tcase \"PollOpened\":\n\t\treturn p.PollOpenedHandler(voting.PollOpened{\n\t\t\tID: event.ID,\n\t\t})\n\tcase \"PollClosed\":\n\t\treturn p.PollClosedHandler(voting.PollClosed{\n\t\t\tID: event.ID,\n\t\t})\n\tcase \"IssueAppended\":\n\t\tissueAppended := new(voting.IssueAppended)\n\t\tif err := json.Unmarshal(*event.Data, issueAppended); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn p.IssueAppendedHandler(*issueAppended)\n\tcase \"BallotCast\":\n\t\tballotCast := make(voting.BallotCast, 0)\n\t\tif err := json.Unmarshal(*event.Data, &ballotCast); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn p.BallotCastHandler(ballotCast)\n\t}\n\n\treturn eventmanager.ErrUnhandledEventType\n}", "title": "" }, { "docid": "5850bad07b1a3c1b09834ac03bd091de", "score": "0.5894589", "text": "func (d *EventDispatcher) HandleEvent(ctx context.Context, event event.Event) (int, error) {\n\td.mu.Lock()\n\tdefer d.mu.Unlock()\n\n\tactions := append(d.actions[:0:0], d.actions...)\n\tjobId := d.currentJobId\n\td.currentJobId++\n\n\treturn jobId, d.handleEventByActions(ctx, event, actions, jobId)\n}", "title": "" }, { "docid": "84b3e7df0049de88770d59c9574887e8", "score": "0.58892274", "text": "func handleEvent(ctx context.Context, ev interface{}, logger *log.Logger) {\n\tswitch ev := ev.(type) {\n\tcase *cdpruntime.EventConsoleAPICalled:\n\t\tfor _, arg := range ev.Args {\n\t\t\tline := string(arg.Value)\n\t\t\t// Any string content is quoted with double-quotes.\n\t\t\t// So need to treat it specially.\n\t\t\ts, err := strconv.Unquote(line)\n\t\t\tif err != nil {\n\t\t\t\t// Probably some numeric content, print it as is.\n\t\t\t\tfmt.Printf(\"%s\\n\", line)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfmt.Printf(\"%s\\n\", s)\n\t\t}\n\tcase *cdpruntime.EventExceptionThrown:\n\t\tif ev.ExceptionDetails != nil && ev.ExceptionDetails.Exception != nil {\n\t\t\tfmt.Printf(\"%s\\n\", ev.ExceptionDetails.Exception.Description)\n\t\t}\n\tcase *target.EventTargetCrashed:\n\t\tfmt.Printf(\"target crashed: status: %s, error code:%d\\n\", ev.Status, ev.ErrorCode)\n\t\terr := chromedp.Cancel(ctx)\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"error in cancelling context: %v\\n\", err)\n\t\t}\n\tcase *inspector.EventDetached:\n\t\tfmt.Println(\"inspector detached: \", ev.Reason)\n\t\terr := chromedp.Cancel(ctx)\n\t\tif err != nil {\n\t\t\tlogger.Printf(\"error in cancelling context: %v\\n\", err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6cd71baac274cb5a5336e0a56c0dbcd3", "score": "0.5878819", "text": "func (f HandlerFunc) Handle(i In, o Out) {\n\tf(i, o)\n}", "title": "" }, { "docid": "fdd78399f1caa4c9fef2720bb1612f69", "score": "0.5863271", "text": "func (q *QuotesGroup) handleEvent(msg []byte) (err error) {\n\tvar event event\n\tif err = json.Unmarshal(msg, &event); err != nil {\n\t\treturn\n\t}\n\tif event.Event == eventInfo {\n\t\tif event.Code == wsCodeStopping {\n\t\t\tq.restart()\n\t\t\treturn\n\t\t}\n\t}\n\tif event.Event == eventSubscribed {\n\t\tif event.Channel == channelCandles {\n\t\t\tevent.Symbol = strings.Replace(event.Key, \"trade:1m:t\", \"\", 1)\n\t\t\tevent.Pair = event.Symbol\n\t\t}\n\t\tq.add(event)\n\t\treturn\n\t}\n\tlog.Println(\"[BITFINEX] Unprocessed event: \", string(msg))\n\treturn\n}", "title": "" }, { "docid": "5b23be0a73ccd123075ba4e37f5cf042", "score": "0.58437616", "text": "func (e *EventListener) HandleRequest(ctx context.Context, event cloudevents.Event) error {\n\t// todo: contribute nil check upstream\n\tif event.Context == nil {\n\t\tlog.Print(\"Empty event context\")\n\t\treturn nil\n\t}\n\n\tif event.SpecVersion() != \"0.2\" {\n\t\tlog.Print(\"Only cloudevents version 0.2 supported\")\n\t\treturn nil\n\t}\n\tif event.Type() != e.eventType {\n\t\tlog.Printf(\"Mismatched event type submitted. Expected %s Got %s\", e.eventType, event.Type())\n\n\t\treturn nil\n\t}\n\n\tlog.Printf(\"Handling event Type: %q\", event.Type())\n\n\tswitch event.Type() {\n\tcase \"dev.knative.source.github.checksuite\":\n\t\tcs := &gh.CheckSuitePayload{}\n\t\tif err := event.DataAs(cs); err != nil {\n\t\t\tlog.Printf(\"Error decoding check suite payload: %q\", err)\n\t\t\treturn nil\n\t\t}\n\t\tif err := e.handleCheckSuite(event, cs); err != nil {\n\t\t\tlog.Printf(\"Error handling check suite payload: %q\", err)\n\t\t\treturn nil\n\t\t}\n\tcase \"dev.knative.source.github.push\":\n\t\tcs := &gh.PushPayload{}\n\t\tif err := event.DataAs(cs); err != nil {\n\t\t\tlog.Printf(\"Error decoding push payload: %q\", err)\n\t\t\treturn nil\n\t\t}\n\t\tif err := e.handlePush(event, cs); err != nil {\n\t\t\tlog.Printf(\"Error handling push payload: %q\", err)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2636ff79b8086a403665fd39ddf4f868", "score": "0.5839744", "text": "func (t *Text) HandleEvent(tcell.Event) bool {\n\treturn false\n}", "title": "" }, { "docid": "db95d73526bf6597cd239d2074097f9c", "score": "0.5837501", "text": "func (a *Adaptor) handle(\n\tctx context.Context,\n\tr dogma.ProcessRoot,\n\tsc *scope,\n\tp parcel.Parcel,\n) error {\n\tif p.ScheduledFor.IsZero() {\n\t\treturn a.Handler.HandleEvent(ctx, r, sc, p.Message)\n\t}\n\n\treturn a.Handler.HandleTimeout(ctx, r, sc, p.Message)\n}", "title": "" }, { "docid": "1a16504d5e140f11c6ada002f76f4de3", "score": "0.58296776", "text": "func (u *User) HandleEvent(eventRaw []byte) error {\n\tvar event *Event\n\terr := json.Unmarshal(eventRaw, &event)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// u.log(\"handle event:\", event.Type)\n\tevent.UserID = u.ID\n\tif event.Type == \"ping\" {\n\t\tpingTimestamp := FromUnixMilli(event.Value)\n\t\tpingToServer := time.Now().Sub(pingTimestamp)\n\t\tpingToServerMs := int64(math.Abs(float64(pingToServer.Milliseconds())))\n\t\t// fmt.Println(\"PING MS:\", pingToServerMs)\n\t\tu.SendPingEvent(pingToServerMs)\n\t\tu.BroadcastEventPing(pingToServerMs)\n\t\treturn nil\n\t} else if event.Type == \"midi\" {\n\t\tu.SendEvent(*event)\n\t\tu.BroadcastEvent(*event)\n\t\treturn nil\n\t} else if event.Type == \"mute\" {\n\t\tu.info.Mute = true\n\t\tu.BroadcastEventMute()\n\t\treturn nil\n\t} else if event.Type == \"unmute\" {\n\t\tu.info.Mute = false\n\t\tu.BroadcastEventUnmute()\n\t\treturn nil\n\t} else if event.Type == \"sync\" {\n\t\tu.BroadcastEvent(*event)\n\t\treturn nil\n\t}\n\treturn u.SendErr(errNotImplemented)\n}", "title": "" }, { "docid": "e6b009b4a424e1f62ca0e5a19f3a02b7", "score": "0.5808608", "text": "func (er *EventReporter) handleEvent(obj interface{}) {\n\tevent, ok := obj.(*corev1.Event)\n\tif !ok {\n\t\tklog.Errorf(\"Should be Event object but encounter others in handleEvent.\")\n\t\treturn\n\t}\n\n\t// Only need to report the event related to pod and node.\n\tif !er.isNeedToReport(event) {\n\t\treturn\n\t}\n\n\tklog.V(3).Infof(\"handle Event: %s\", event.Name)\n\n\taddLabelToResource(&event.ObjectMeta, er.ctx)\n\n\t// generates unique key for event.\n\tkey, err := cache.MetaNamespaceKeyFunc(event)\n\tif err != nil {\n\t\tklog.Errorf(\"Failed to get map key: %s\", err)\n\t\treturn\n\t}\n\n\teventMap := &EventResourceStatus{\n\t\tUpdateMap: map[string]*corev1.Event{\n\t\t\tkey: event,\n\t\t},\n\t}\n\n\tgo er.sendToSyncChan(eventMap)\n}", "title": "" }, { "docid": "c4f1e8f4ea90e9ef9810125454d2a247", "score": "0.5793811", "text": "func (m *Module) HandleCustomEvent(rule *rules.Rule, event *sprobe.CustomEvent) {\n\tm.SendEvent(rule, event, func() []string { return nil }, \"\")\n}", "title": "" }, { "docid": "53a9bfc0762eef3761df91a0deea0415", "score": "0.57925165", "text": "func (se OffEventHandlerFunctor) Handle(ac appcontext.AppContext, data EventCallbackData) *Response {\n\n\tlog.InfoWithContext(ac, \"timer on\", \"call inputport\", map[string]interface{}{\n\t\t\"user\": data.MessageEvent.User,\n\t\t\"text\": data.MessageEvent.Text,\n\t})\n\n\tinput := timeroffevent.InputData{\n\t\tUserID: data.MessageEvent.User,\n\t}\n\tse.inputPort.SetEventOff(ac, input, se.presenter)\n\n\tlog.InfoWithContext(ac, \"return from inputport\", se.presenter.Resp)\n\n\treturn &se.presenter.Resp\n}", "title": "" }, { "docid": "3d0c5e1a3f32488e0ab68927848d2d19", "score": "0.576913", "text": "func (em *Vi) HandleEvent(id novi.InputID, event novi.Event) bool {\n\tif id == ExInputID {\n\t\treturn em.HandleExInput(event)\n\t}\n\n\t// Must be MainInputID\n\tfor _, d := range em.dispatch {\n\t\tif d.Do(event, em.Mode) {\n\t\t\t// returns false if we need to exit\n\t\t\treturn em.CheckExecuteCommandBuffer()\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "c684a9780b28166c9f93ebbbcc95f094", "score": "0.57640696", "text": "func (m MapBindings) Handle(w Widget, event term.Event) bool {\n\tfn, ok := m[event]\n\tif ok {\n\t\tfn(w)\n\t}\n\treturn ok\n}", "title": "" }, { "docid": "185b822d59400a17e9ee76c64e14c821", "score": "0.57439053", "text": "func (handle CompleteFunc) Handle(item interface{}) {\n\thandle()\n}", "title": "" }, { "docid": "97212a8fe7a14ed36407b8a00c0eb628", "score": "0.5712005", "text": "func (h *EventHandler) HandleEvent(eventName string, processor EventProcessor) error {\n\tvalid := false\n\tfor _, n := range ValidEventNames {\n\t\tif n == eventName {\n\t\t\tvalid = true\n\t\t}\n\t}\n\tif !valid {\n\t\treturn fmt.Errorf(\"%s is not a valid event! Valid events are: %v\", eventName, ValidEventNames)\n\t}\n\n\tif h.processors == nil {\n\t\th.processors = make(map[string]EventProcessor)\n\t}\n\th.processors[eventName] = processor\n\treturn nil\n}", "title": "" }, { "docid": "679c0f4fe62ea3f540774c294f7964a1", "score": "0.56895924", "text": "func HandleReq(req []byte) []byte {\n\tres := process_event(req)\n\treturn res\n}", "title": "" }, { "docid": "5639e8ec758da26df99f8c3df0f6dff2", "score": "0.5688134", "text": "func (s *Service) HandleFunc(tp daemon.MsgType, h daemon.Handler) {\n\ts.mux.HandleFunc(tp, h)\n}", "title": "" }, { "docid": "f7083d1bee4fd4d51bfa97717750a700", "score": "0.56881136", "text": "func (fn OrangePressedHandlerFunc) Handle(params OrangePressedParams) middleware.Responder {\n\treturn fn(params)\n}", "title": "" }, { "docid": "aa15a6ee4aa8cdeac8c1e55205f92ec6", "score": "0.56688094", "text": "func (teh *CountEventHandler) HandleEvent() {\n\tb := teh.TimedPlugin.Bot\n\tb.FindUserEnsured(b.Nick).Reply(strconv.Itoa(teh.Count))\n\tteh.Count++\n}", "title": "" }, { "docid": "836f0144c7ae8663cf98df4908165506", "score": "0.5654856", "text": "func (s *SimpleFuncAgent) Process(event Event) error {\n\ts.err = s.f(event)\n\treturn s.err\n}", "title": "" }, { "docid": "7139d00a96fb68dca81f90ed1ebb94f9", "score": "0.5634163", "text": "func (s *githubHook) Handle(c *gin.Context) {\n\teventType := c.Request.Header.Get(\"X-GitHub-Event\")\n\tvar body []byte\n\tvar err error\n\tif c.Request.Body != nil {\n\t\tdefer c.Request.Body.Close()\n\t\tif body, err = ioutil.ReadAll(c.Request.Body); err != nil {\n\t\t\tlog.Printf(\"Failed to read body: %s\", err)\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"status\": \"Malformed body\"})\n\t\t\treturn\n\t\t}\n\t}\n\tvar event interface{}\n\tif len(body) > 1 {\n\t\tevent, err = github.ParseWebHook(eventType, body)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to parse body: %s\", err)\n\t\t\tc.JSON(http.StatusBadRequest, gin.H{\"status\": \"Malformed body\"})\n\t\t\treturn\n\t\t}\n\t}\n\tswitch eventType {\n\tcase \"ping\":\n\t\tlog.Print(\"Received ping from GitHub\")\n\t\tc.JSON(200, gin.H{\"message\": \"OK\"})\n\t\treturn\n\tcase \"commit_comment\",\n\t\t\"create\",\n\t\t\"deployment\", \"deployment_status\",\n\t\t\"pull_request\", \"pull_request_review\", \"pull_request_review_comment\",\n\t\t\"push\",\n\t\t\"release\",\n\t\t\"status\":\n\t\ts.handleEvent(c, eventType, event, body)\n\t\treturn\n\t// Added\n\tcase \"check_suite\", \"check_run\":\n\t\ts.handleCheck(c, eventType, event, body)\n\tcase \"issue_comment\":\n\t\ts.handleIssueComment(c, eventType, event, body)\n\tdefault:\n\t\t// Issue #127: Don't return an error for unimplemented events.\n\t\tlog.Printf(\"Unsupported event %q\", event)\n\t\tc.JSON(200, gin.H{\"message\": \"Ignored\"})\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "afc5285e128e115aededda553f35c435", "score": "0.56318456", "text": "func (s *watchableStore) handle(rev int64, ev storagepb.Event) {\n\ts.notify(rev, ev)\n\ts.stopWatchers(rev)\n}", "title": "" }, { "docid": "b700eeb4fd8d133043d3276e09f8b5a6", "score": "0.56272274", "text": "func (a *InstancedAction) HandleEvent(ctx context.Context, raw json.RawMessage) error {\n\tvar eventHeader struct {\n\t\tEvent EventName `json:\"event\"`\n\t\tAction ActionUUID `json:\"action\"`\n\t\tContext EventContext `json:\"context\"`\n\t}\n\tif err := json.Unmarshal(raw, &eventHeader); err != nil {\n\t\treturn fmt.Errorf(\"unmarshalling action and eventHeader: %w\", err)\n\t}\n\n\t// If the action doesn't match, it means this event was sent here improperly.\n\tif eventHeader.Action != \"\" && eventHeader.Action != a.actionUUID {\n\t\treturn fmt.Errorf(\"received mismatched action, %s != %s\", a.actionUUID, eventHeader.Action)\n\t}\n\n\t// If the context is empty, the event is intended for all instances of this action.\n\tif eventHeader.Context == \"\" {\n\t\tfor _, instance := range a.instances {\n\t\t\tif err := dispatchEvent(ctx, instance, eventHeader.Event, raw); err != nil {\n\t\t\t\treturn fmt.Errorf(\"dispatching event %q to action instance %q: %w\", eventHeader.Event, eventHeader.Context, err)\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// If the instance doesn't yet exist, create one and save it off.\n\tinstance, ok := a.instances[eventHeader.Context]\n\tif !ok {\n\t\tpublisher := newCoreActionInstancePublisher(eventHeader.Context, a.publisher)\n\t\tinstance = a.createInstance(eventHeader.Context, publisher)\n\t\ta.instances[eventHeader.Context] = instance\n\t}\n\n\tif err := dispatchEvent(ctx, instance, eventHeader.Event, raw); err != nil {\n\t\treturn fmt.Errorf(\"dispatching event %q to action instance %q: %w\", eventHeader.Event, eventHeader.Context, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7f89e9c60853c8b2edede5597b361dcd", "score": "0.5623752", "text": "func (srv *Server) handleEvent(event watch.Event) {\n\tv := &v1.Service{}\n\tif reflect.TypeOf(event.Object) == reflect.TypeOf(v) {\n\t\ti := reflect.ValueOf(event.Object).Interface()\n\t\tsrv.handleService(i.(*v1.Service), event.Type, 0)\n\t}\n}", "title": "" }, { "docid": "cca3ff47fa12cc7adf6d85a58f42f24e", "score": "0.5620593", "text": "func Handle(ep Endpoint, pkt *Packet, hs Handlers) error {\n\tif glog.V(3) {\n\t\tglog.Info(venuelib.FnName())\n\t}\n\tif glog.V(2) {\n\t\tglog.Infof(\"Handling %s packet.\", pkt.Action)\n\t}\n\n\th, ok := hs[pkt.Action]\n\tif !ok {\n\t\treturn venuelib.Errorf(codes.Unimplemented, \"%s action unimplemented for %s.\", pkt.Action, ep.EndpointName())\n\t}\n\treturn h.Handler(ep, pkt)\n}", "title": "" }, { "docid": "27bb5933dfc468a349f4fd78b107c858", "score": "0.56136364", "text": "func (h TestHandle) Handle(*slack.MessageEvent) string {\n\treturn \"A response\"\n}", "title": "" }, { "docid": "2b3b7e6f56b1ff63cf25186f71491d41", "score": "0.55984324", "text": "func (h *EventHandler) Handle(handler Handler, events ...string) error {\n\treturn h.HandleWait(handler, 0, events...)\n}", "title": "" }, { "docid": "ed688aa4f89ed96ec61e234df7176c7c", "score": "0.55946475", "text": "func (handler userUpdateEventHandler) Handle(library *Library, i interface{}) {\n\tif event, ok := i.(*UserUpdateEvent); ok {\n\t\thandler(library, event)\n\t}\n}", "title": "" }, { "docid": "9060c377a716f636cedf02d5bd4432de", "score": "0.55945396", "text": "func (h DeviceStateChangedEventHandler) HandleEvent(e *firehose.Event) firehose.Result {\n\tvar body DeviceStateChangedEvent\n\tif err := json.Unmarshal(e.Payload, &body); err != nil {\n\t\treturn firehose.Discard(oops.WithMessage(err, \"failed to unmarshal payload\"))\n\t}\n\treturn h(&body)\n}", "title": "" }, { "docid": "387b40104446d7b3c8600fdbe3483981", "score": "0.5586066", "text": "func (eb *messageBus) handle(hash []byte, msg Message) error {\n\t// TODO event checking and adding are not thread safe\n\n\t// fmt.Println(\"Handling message\", string(msg.Payload.Type), string(msg.Payload.Data))\n\n\t// check if we have already handled this event\n\t// shash := fmt.Sprintf(\"%x\", hash)\n\t// for _, msgHash := range eb.handledMessages {\n\t// \tif msgHash == shash {\n\t// \t\treturn nil\n\t// \t}\n\t// }\n\n\t// else add to handled messagebus\n\t// eb.handledMessages = append(eb.handledMessages, shash)\n\n\t// and trigger handlers\n\tfor _, h := range eb.handlers {\n\t\th(hash, msg)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aa3684633ae2c19676b7d46f2b61698d", "score": "0.55738056", "text": "func (gh *GitHubEventsHandler) HandleEvent(event interface{}, payload []byte) error {\n\n\tswitch event.(type) {\n\tcase *github.PushEvent:\n\t\t// this is a commit push, do something with it\n\t\tfmt.Println(\"Push event received.\")\n\t\t// 1. Fetch all Repositories of the Organization\n\t\t// repos := FetchOrganizationRepositories(ctx, client, *organization)\n\n\t\trepo := \"openshift-deployment-testing\"\n\t\t// 2. Fork the Repository\n\t\t//ForkRepository(ctx, client, *organization, repo)\n\n\t\t// 3. Get Repository Contents for Computation\n\t\t_, baseFileSHA := GetRepositoryContents(gh.Ctx, gh.Client, gh.Owner, repo, gh.Path)\n\n\t\t// 4. Edit pom.xml, commit and push for Version Bump\n\t\tEditAndCommitRepositoryContent(gh.Ctx, gh.Client, gh.Owner, repo, gh.Path, baseFileSHA, gh.Dependency)\n\n\t\t// 5. Open a PR to the repo.\n\t\tOpenPullRequest(gh.Ctx, gh.Client, gh.Organization, gh.Owner, repo)\n\n\tcase *github.PullRequestEvent:\n\t\t// this is a pull request, do something with it\n\tcase *github.WatchEvent:\n\t\t// https://developer.github.com/v3/activity/events/types/#watchevent\n\tdefault:\n\t\tlog.Printf(\"unknown event type\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9396986adf5fc5cce93505e19eebd875", "score": "0.5573478", "text": "func (el *EventLoop) processEvent(event interface{}) {\n\tt := reflect.TypeOf(event)\n\tdefer el.dispatchDelayedEvents(t)\n\n\tif f, ok := event.(func()); ok {\n\t\tf()\n\t\treturn\n\t}\n\n\t// run observers\n\tfor _, observer := range el.observers[t] {\n\t\tobserver(event)\n\t}\n\n\tif handler, ok := el.handlers[t]; ok {\n\t\thandler(event)\n\t}\n}", "title": "" }, { "docid": "60ca43a60bfe65e83290be9f9b540a2e", "score": "0.5557304", "text": "func (s *watchableStore) handle(rev int64, evs []storagepb.Event) {\n\ts.notify(rev, evs)\n}", "title": "" }, { "docid": "37e5309f7fad732a4be040f5d9d1772a", "score": "0.55534726", "text": "func OnEvent(h handler) func(ami *Amiga) {\n\treturn func(ami *Amiga) {\n\t\tami.onEvent = h\n\t}\n}", "title": "" }, { "docid": "d29494d7afbe7dc72038746c540fc8ed", "score": "0.5553124", "text": "func Handle(pr plexhooks.PlexResponse, user store.User) {\n\tif pr.Metadata.LibrarySectionType == \"show\" {\n\t\tHandleShow(pr, user.AccessToken)\n\t} else if pr.Metadata.LibrarySectionType == \"movie\" {\n\t\tHandleMovie(pr, user.AccessToken)\n\t}\n\tlog.Print(\"Event logged\")\n}", "title": "" }, { "docid": "f0c37490b1cbac4befdbb9ddb583ef53", "score": "0.55519587", "text": "func (p *Pipelined) handleEvent(event *types.Event) error {\n\tctx := context.WithValue(context.Background(), types.OrganizationKey, event.Entity.Organization)\n\tctx = context.WithValue(ctx, types.EnvironmentKey, event.Entity.Environment)\n\n\tvar handlerList []string\n\n\tif event.HasCheck() {\n\t\thandlerList = append(handlerList, event.Check.Handlers...)\n\t}\n\n\tif event.HasMetrics() {\n\t\thandlerList = append(handlerList, event.Metrics.Handlers...)\n\t}\n\n\thandlers, err := p.expandHandlers(ctx, handlerList, 1)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, handler := range handlers {\n\t\tfiltered := p.filterEvent(handler, event)\n\n\t\tif filtered {\n\t\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\t\"check\": event.Check.Name,\n\t\t\t\t\"entity\": event.Entity.ID,\n\t\t\t\t\"organization\": event.Entity.Organization,\n\t\t\t\t\"environment\": event.Entity.Environment,\n\t\t\t}).Debug(\"event filtered\")\n\t\t\tcontinue\n\t\t}\n\n\t\teventData, err := p.mutateEvent(handler, event)\n\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tlogger.WithFields(logrus.Fields{\n\t\t\t\"event\": string(eventData),\n\t\t\t\"handler\": handler.Name,\n\t\t}).Debug(\"sending event to handler\")\n\n\t\tswitch handler.Type {\n\t\tcase \"pipe\":\n\t\t\tif _, err := p.pipeHandler(handler, eventData); err != nil {\n\t\t\t\tlogger.Error(err)\n\t\t\t}\n\t\tcase \"tcp\", \"udp\":\n\t\t\tif _, err := p.socketHandler(handler, eventData); err != nil {\n\t\t\t\tlogger.Error(err)\n\t\t\t}\n\t\tdefault:\n\t\t\treturn errors.New(\"unknown handler type\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1c740fa945389d25753bdc12473bf718", "score": "0.55392903", "text": "func (lc *GnatsdHandler) Handle(event *types.Event, conf *types.HandlerConfig) (map[string]interface{}, error) {\n\t// Get topic from config\n\ttopic, ok := conf.Options.GetString(\"topic\")\n\tif !ok || topic == \"\" {\n\t\treturn nil, fmt.Errorf(\"topic not specified\")\n\t}\n\n\tfmt.Printf(\"[gnatsd] phase=%s topic=%s %+v\\n\", event.Type, topic, event.Data)\n\n\t// Publish the body as bytes\n\terr := lc.conn.Publish(topic, []byte(conf.Body))\n\n\t// if err == nil {\n\t// \tif err = lc.econn.Flush(); err != nil {\n\t// \t\terr = lc.econn.LastError()\n\t// \t}\n\t// }\n\n\treturn nil, err\n}", "title": "" }, { "docid": "026e8b212aae6000cb9ca668b0276019", "score": "0.5537225", "text": "func (m *fakeMode) HandleEvent(e term.Event, _ *clitypes.State) clitypes.HandlerAction {\n\tif keyEvent, ok := e.(term.KeyEvent); ok {\n\t\tm.keysHandled = append(m.keysHandled, ui.Key(keyEvent))\n\t\tif len(m.keysHandled) == m.maxKeys {\n\t\t\treturn clitypes.CommitCode\n\t\t}\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "a1af37913757f7555bd84d3b28755831", "score": "0.5528762", "text": "func (call *Call) OnceEventHandle(hl func(chan interface{}) HandlerEvent) chan interface{} {\n\tres := make(chan interface{})\n\tcall.AddActionHandle(hl(res))\n\treturn res\n}", "title": "" }, { "docid": "90d93de4b8548016f12c6e9b7490c652", "score": "0.55275553", "text": "func (b *EventBus) HandleEvent(ctx context.Context, event eh.Event) error {\n\tb.handlerMu.RLock()\n\tdefer b.handlerMu.RUnlock()\n\n\t// Handle the event, if there are no handlers this will be a no-op.\n\tfor _, h := range b.handlers[event.EventType()] {\n\t\tif err := h.HandleEvent(ctx, event); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// Publish the event.\n\treturn b.publisher.PublishEvent(ctx, event)\n}", "title": "" }, { "docid": "2df81ce2d023e2a27e072f3281f522eb", "score": "0.5522877", "text": "func (fn UpdateEventbyIDHandlerFunc) Handle(params UpdateEventbyIDParams) middleware.Responder {\n\treturn fn(params)\n}", "title": "" }, { "docid": "4b65928b96eaf5764b8c6922e6b1d720", "score": "0.5516821", "text": "func (c *BoxContainer) HandleEvent(event tcell.Event) bool {\n\tif c.Child != nil {\n\t\treturn c.Child.HandleEvent(event)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "eb5a5340957ef52a2598b5462b4b9eed", "score": "0.5516158", "text": "func EventHandle(w http.ResponseWriter, r *http.Request) {\n\tevents, err := lineClient.ParseRequest(r)\n\tif err != nil {\n\t\tfmt.Println(\"parse request fail\", err.Error())\n\t}\n\n\tfor _, event := range events {\n\t\tswitch event.Type {\n\t\tcase linebot.EventTypeMessage:\n\t\t\tswitch message := event.Message.(type) {\n\t\t\tcase *linebot.TextMessage:\n\t\t\t\tif i := tool.GetUserIndex(event.Source.UserID); i == -1 {\n\t\t\t\t\tconfig.User = append(config.User, common.User{\n\t\t\t\t\t\tLineID: event.Source.UserID,\n\t\t\t\t\t})\n\t\t\t\t}\n\t\t\t\tuserIndex := tool.GetUserIndex(event.Source.UserID)\n\t\t\t\tprefix := strings.Split(message.Text, \": \")[0]\n\t\t\t\tif prefix == \"McDaily\" {\n\t\t\t\t\tinfo := strings.Split(message.Text, \": \")[1]\n\t\t\t\t\tconfig.User[userIndex].McDailyAccount = strings.Split(info, \"/\")[0]\n\t\t\t\t\tconfig.User[userIndex].McDailyPassword = strings.Split(info, \"/\")[1]\n\t\t\t\t\tif _, err = lineClient.ReplyMessage(event.ReplyToken, linebot.NewTextMessage(\"新增麥當勞報報成功\")).Do(); err != nil {\n\t\t\t\t\t\tfmt.Printf(\"fail to add McDaily to user: %s\", event.Source.UserID)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase linebot.EventTypeFollow:\n\t\t\tif _, err = lineClient.ReplyMessage(event.ReplyToken, linebot.NewTextMessage(\"歡迎使用!!\")).Do(); err != nil {\n\t\t\t\tfmt.Printf(\"fail to reply follow event to user: %s\", event.Source.UserID)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86b90ed7b182fc2271ba0cddeab09ffa", "score": "0.5514388", "text": "func (d *Device) processEvent(ctx context.Context, buf []byte, requestType uint32) error {\n\tif f := d.EventHandlers[requestType]; f != nil {\n\t\treturn f(ctx, d, buf)\n\t}\n\treturn errors.Errorf(\"unknown event: %d\", requestType)\n}", "title": "" }, { "docid": "323f624cb508cad9d81e595a3ebd763b", "score": "0.55056524", "text": "func (f HandlerFunc) HandleElement(e Element) error {\n\treturn f(e)\n}", "title": "" }, { "docid": "2dbd39c0be456a746a73380dc8838466", "score": "0.54928994", "text": "func (e *EphemeralEditor) HandleEvent(ev tcell.Event) bool {\n\tswitch event := ev.(type) {\n\tcase EventEditRequest:\n\t\te.ShowEditor()\n\t\te.SetRequestor(event)\n\t\treturn true\n\tcase EventEditFinished:\n\t\t// pass the EventEditFinished to the widget that created the\n\t\t// EventEditRequest with the ID field populated\n\t\tevent.ID = e.RequestID\n\t\tdefer func() {\n\t\t\t// clean up after handling event\n\t\t\te.HideEditor()\n\t\t\te.ClearRequestor()\n\t\t}()\n\t\treturn e.Requestor.HandleEvent(event)\n\tcase views.EventWidget:\n\t\te.PostEvent(event)\n\tcase *tcell.EventMouse:\n\t\treturn e.passEventDown(ev)\n\tcase *tcell.EventKey:\n\t\treturn e.passEventDown(ev)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "41d4799cefe65d639630c959353e9bb8", "score": "0.5485313", "text": "func (s *RequestStats) HandleEvent(event ReqEvent) {\n\ts.mux.Lock()\n\tdefer s.mux.Unlock()\n\n\ts.compute(event.Time)\n\n\tswitch event.Type {\n\tcase ProxiedIn:\n\t\ts.proxiedConcurrency++\n\t\ts.proxiedCount++\n\t\tfallthrough\n\tcase ReqIn:\n\t\ts.requestCount++\n\t\ts.concurrency++\n\tcase ProxiedOut:\n\t\ts.proxiedConcurrency--\n\t\tfallthrough\n\tcase ReqOut:\n\t\ts.concurrency--\n\t}\n}", "title": "" }, { "docid": "6316ca675918438cd91f881fdaad54b9", "score": "0.5473157", "text": "func (sm *StateMachine) processEvent (fromId int,ev Event) []Action{\n\tactions := []Action{}\n\tswitch ev.(type) {\n\t\tcase AppendEntriesReqEv:\n\t\t\tevObj := ev.(AppendEntriesReqEv)\n\t\t\tactions = sm.handleAppendEntriesReq(fromId, evObj.term, evObj.leaderId, evObj.prevLogIndex, evObj.prevLogTerm, evObj.entries, evObj.leaderCommit)\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\tcase AppendEntriesRespEv:\n\t\t\tevObj := ev.(AppendEntriesRespEv)\n\t\t\tactions = sm.handleAppendEntriesResp(fromId, evObj.term, evObj.success)\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\tcase VoteReqEv:\n\t\t\tevObj := ev.(VoteReqEv)\n\t\t\tactions = sm.handleVoteReq(evObj.term, evObj.candidateId, evObj.lastLogIndex, evObj.lastLogTerm)\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\tcase VoteRespEv:\n\t\t\tevObj := ev.(VoteRespEv)\n\t\t\tactions = sm.handleVoteResp(fromId,evObj.term, evObj.voteGranted)\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\tcase TimeoutEv:\n\t\t\tevObj := ev.(TimeoutEv)\n\t\t\tactions = sm.handleTimeout()\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\tcase AppendEv:\n\t\t\tevObj := ev.(AppendEv)\n\t\t\tactions = sm.handleAppend(evObj.data)\n\t\t\tdebug(fmt.Sprintf(\"%v\\n\", evObj))\n\t\t// other cases\n\t\tdefault:\n\t\t\tprintln (\"Unrecognized\")\n\t}\n\treturn actions\n}", "title": "" }, { "docid": "21c266eaf3db305aa8c2b9db07410619", "score": "0.5467746", "text": "func (h *AuthenticateHandler) HandleEvent(e handlers.Event, s handlers.Session) {\n\tresp, send := handlers.Setup(e, s)\n\tdefer send()\n\n\tok, payload := h.validatePayload(e.Payload)\n\tif !ok {\n\t\tresp.Error = handlers.InvalidPayload\n\t\treturn\n\t}\n\n\tid, ok, err := h.auth.AuthenticateUser(payload.username, payload.password)\n\tif !ok || err != nil {\n\t\tresp.Error = handlers.AuthenticationError\n\t\treturn\n\t}\n\n\ts.SetAuthentication(id)\n\tresp.Error = nil\n}", "title": "" }, { "docid": "5aadb9a4c262ec8c4cb07a74843a9389", "score": "0.5465741", "text": "func HandleRequest(ctx context.Context, cwEvent events.CloudWatchEvent) (string, error) {\n\tfmt.Printf(\"Processing Item (logged to cloudwatch) %v \", string(cwEvent.Detail))\n\treturn fmt.Sprintf(\"Processing Item %v \", string(cwEvent.Detail)), nil\n}", "title": "" }, { "docid": "4d7c5db08acbf57a751b2477cf4754e5", "score": "0.54620904", "text": "func Handle(req handler.Request) (handler.Response, error) {\n\n\tvar (\n\t\terr error\n\t\tc, retEvent *CloudEvent\n\t\tcallbackURL []string\n\t)\n\n\tif len(wordList) == 0 {\n\t\twordList = getWordList()\n\t}\n\n\tstructuredRequest := isStructured(req.Header[\"Content-Type\"])\n\tcallbackURL = extractCallbackURL(&req)\n\n\tc, err = getCloudEvent(&req, structuredRequest)\n\n\twordType := extractWordType(c.Type)\n\tdataVal := getWordValue(wordList[wordType])\n\n\tif dataVal != nil {\n\t\tretEventType := strings.Replace(c.Type, reqEventTypePattern, resEventTypePattern, -1)\n\t\tretEvent = initCloudEvent(retEventType, dataVal, c.ID)\n\t}\n\n\treturn sendCloudEvent(retEvent, structuredRequest, callbackURL, err)\n\n}", "title": "" }, { "docid": "5897b63dc1d6caca650e35b374efc412", "score": "0.545751", "text": "func UserEvent() {}", "title": "" }, { "docid": "9a01a18632c801a4026581d7cbed8330", "score": "0.54532397", "text": "func (h *helper) handleHookPushEvent() handler {\n\treturn func(res http.ResponseWriter, req *http.Request) {\n\t\thook, err := githubhook.Parse([]byte(h.githubSecret), req)\n\t\tif err != nil {\n\t\t\th.logError(err, \"failed to parse the request, check your secret\")\n\t\t\treturn\n\t\t}\n\n\t\tdata, err := prettyPrint(hook.Payload)\n\t\tif err != nil {\n\t\t\th.logError(err, \"failed to prettify data\")\n\t\t\treturn\n\t\t}\n\t\tlog.Debugf(string(data))\n\n\t\te := new(event)\n\t\tif err := json.Unmarshal(data, e); err != nil {\n\t\t\th.logError(err, \"failed to trigger jenkins\")\n\t\t\treturn\n\t\t}\n\n\t\tif err := h.triggerJenkins(e, data); err != nil {\n\t\t\th.logError(err, fmt.Sprintf(\"`%v` `%v` failed to trigger jenkins\", e.Repo.Name, e.Ref))\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4f4e420e39be82809a3e5ab7f6482107", "score": "0.5446481", "text": "func ProcessEvent(function func(map[string]interface{}) (interface{}, error), event map[string]interface{}) (result interface{}, err error) {\n\t//panic handler\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tresult = nil\n\t\t\terr = fmt.Errorf(\"javascript panic: %v\", r)\n\t\t}\n\t}()\n\tresult, err = function(event)\n\tif err != nil {\n\t\terr = fmt.Errorf(\"javascript error: %v\", err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "af2ba606301dce1bb60fecd669df4886", "score": "0.54405123", "text": "func (m *MockSqsEventHandlerInitializer) Handle(v0 context.Context, v1 []events.SQSMessage, v2 v2.Logger) error {\n\tr0 := m.HandleFunc.nextHook()(v0, v1, v2)\n\tm.HandleFunc.appendCall(SqsEventHandlerInitializerHandleFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "3b94011aba5d871e34384772168f7f7c", "score": "0.5439526", "text": "func (c *Client) HandleKeyDownFunc(f KeyDownHandlerFunc) {\n\tc.HandleKeyDown(f)\n}", "title": "" }, { "docid": "c6931be170e46f429c0f1017e1861670", "score": "0.54389197", "text": "func (c *Controller) processEvent(fn cache.KeyFunc, obj interface{}) {\n\tkey, err := fn(obj)\n\tif err == nil {\n\t\tc.queue.Add(key)\n\t\treturn\n\t}\n\tlog.Errorf(\"Error calling key func: %s\", err.Error())\n}", "title": "" }, { "docid": "8ca52b32b59c48b9e03d5c0445b6309f", "score": "0.5435472", "text": "func (p *AgentPool) handleEvent(ctx context.Context, agent Agent) {\n\tstate := agent.GetState()\n\tswitch state {\n\tcase AgentConnecting:\n\t\treturn\n\tcase AgentConnected:\n\tcase AgentClosed:\n\t\tif ok := p.active.remove(agent); ok {\n\t\t\tp.wg.Done()\n\t\t}\n\t}\n\tp.updateConnectedProxies()\n\tp.log.Debugf(\"Active agent count: %d\", p.active.len())\n}", "title": "" }, { "docid": "b2e44bc1f5870a0c15796b225d7c955a", "score": "0.54272157", "text": "func handleEvent(ourName string, ne memberlist.NodeEvent) {\n\tswitch ne.Event {\n\tcase memberlist.NodeJoin:\n\t\t/* Don't bother telling people we've joined */\n\t\tif ourName == ne.Node.Name {\n\t\t\treturn\n\t\t}\n\t\tbroadcastAndLogf(\"[Join] %s\", FormatNode(ne.Node))\n\tcase memberlist.NodeUpdate:\n\t\tbroadcastAndLogf(\"[News] %s\", FormatNode(ne.Node))\n\tcase memberlist.NodeLeave:\n\t\tbroadcastAndLogf(\"[Part] %s\", FormatNode(ne.Node))\n\tdefault:\n\t\tbroadcastAndLogf(\n\t\t\t\"[Unknown event %v] %ss\",\n\t\t\tne.Event,\n\t\t\tFormatNode(ne.Node),\n\t\t)\n\t}\n}", "title": "" }, { "docid": "d0281e915252af92f8e2bf5df027b616", "score": "0.5425144", "text": "func (a *ActionTriggeredHandler) HandleEvent(ce cloudevents.Event, loggingDone chan bool) error {\n\n\tdefer func() { loggingDone <- true }()\n\tactionTriggeredEvent := keptn.ActionTriggeredEventData{}\n\n\terr := ce.DataAs(&actionTriggeredEvent)\n\tif err != nil {\n\t\terrMsg := \"action.triggered event not well-formed: \" + err.Error()\n\t\ta.keptnHandler.Logger.Error(errMsg)\n\t\treturn errors.New(errMsg)\n\t}\n\n\tif actionTriggeredEvent.Action.Action == ActionScaling {\n\t\t// Send action.started event\n\t\tif sendErr := a.sendEvent(ce, keptn.ActionStartedEventType, a.getActionStartedEvent(actionTriggeredEvent)); sendErr != nil {\n\t\t\ta.keptnHandler.Logger.Error(sendErr.Error())\n\t\t\treturn errors.New(sendErr.Error())\n\t\t}\n\n\t\tresp := a.handleScaling(actionTriggeredEvent)\n\t\tif resp.Action.Status == keptn.ActionStatusErrored {\n\t\t\ta.keptnHandler.Logger.Error(fmt.Sprintf(\"action %s failed with result %s\", actionTriggeredEvent.Action.Action, resp.Action.Result))\n\t\t} else {\n\t\t\ta.keptnHandler.Logger.Info(fmt.Sprintf(\"Finished action with status %s and result %s\", resp.Action.Status, resp.Action.Result))\n\t\t}\n\n\t\t// Send action.finished event\n\t\tif sendErr := a.sendEvent(ce, keptn.ActionFinishedEventType, resp); sendErr != nil {\n\t\t\ta.keptnHandler.Logger.Error(sendErr.Error())\n\t\t\treturn errors.New(sendErr.Error())\n\t\t}\n\t} else {\n\t\ta.keptnHandler.Logger.Info(\"Received unhandled action: \" + actionTriggeredEvent.Action.Action + \". Exiting\")\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" } ]
1d3a779056bb82484b5d59bfbce8a669
IDEQ applies the EQ predicate on the ID field.
[ { "docid": "5150f82f140fd814e732496c1e55f53a", "score": "0.692495", "text": "func IDEQ(id int) predicate.Configarea {\n\treturn predicate.Configarea(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" } ]
[ { "docid": "f0c99e30ea74ff73bbbb25e84fcaf79d", "score": "0.7830539", "text": "func IDEQ(id int) predicate.Post {\n\treturn predicate.Post(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "2feaf779d85de90c9dc4ec360445eed0", "score": "0.7796327", "text": "func IDEQ(id int) predicate.Card {\n\treturn predicate.Card(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "6a77f4aa7dfaa482628c07a9e0b02c9a", "score": "0.7697065", "text": "func IDEQ(id int) predicate.Node {\n\treturn predicate.Node(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "3c4bcb59e80c8b6c1bbbcdcf161e4d8a", "score": "0.76474875", "text": "func IDEQ(id string) predicate.Connector {\n\treturn predicate.Connector(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "c2984f0d8e5370f530cd1a0a5214d2f3", "score": "0.7638675", "text": "func IDEQ(id int) predicate.Car {\n\treturn predicate.Car(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "87b5f12eeb589e1d0662d9f1d5da825c", "score": "0.7601058", "text": "func IDEQ(id int) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "99abff417990f853900a642eda943945", "score": "0.7564329", "text": "func IDEQ(id int64) predicate.Deal {\n\treturn predicate.Deal(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5fcc7160f30875249846a2ecca610a8a", "score": "0.75599396", "text": "func IDEQ(id int) predicate.APIResponse {\n\treturn predicate.APIResponse(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "996c3f377c0cfa94579ecfcda4c861e1", "score": "0.7537515", "text": "func IDEQ(id uuid.UUID) predicate.MixinID {\n\treturn predicate.MixinID(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "89aa3e1ab20702c24ba9ac36ef3e4d23", "score": "0.74576163", "text": "func IDEQ(id uuid.UUID) predicate.Variant {\n\treturn predicate.Variant(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "7b4042e9019ff1e6318d4ab59f7dca3e", "score": "0.7456574", "text": "func IDEQ(id int) predicate.Recommendations {\n\treturn predicate.Recommendations(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "578287f93e216059aed00e235cf6326a", "score": "0.74502426", "text": "func IDEQ(id int) predicate.Model {\n\treturn predicate.Model(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "559365ea02246ff97eba9bad89b77059", "score": "0.7439996", "text": "func IDEQ(id int) predicate.Admin {\n\treturn predicate.Admin(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "47882bcbc734a3fc4019f9d68ec047e7", "score": "0.74374855", "text": "func IDEQ(id int) predicate.Product {\n\treturn predicate.Product(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bd3881eac24c2a45779114fc2214f881", "score": "0.74145085", "text": "func IDEQ(id int) predicate.BarRecord {\n\treturn predicate.BarRecord(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "4901388c9a1daad45a38b945793b91c9", "score": "0.74137694", "text": "func IDEQ(id int) predicate.Item {\n\treturn predicate.Item(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "8c8d44acb12ee9b7541a77edeb2aab68", "score": "0.7375792", "text": "func IDEQ(id int) predicate.Rating {\n\treturn predicate.Rating(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "654ab4885097b91da311c77bf9592ca0", "score": "0.73744893", "text": "func IDEQ(id int) predicate.Certificate {\n\treturn predicate.Certificate(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b48b81453429401ba9dba2880627304f", "score": "0.7362813", "text": "func IDEQ(id int) predicate.Giveaway {\n\treturn predicate.Giveaway(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "27b38e95c2695a1ff31139c399482e67", "score": "0.7353621", "text": "func IDEQ(id int) predicate.TriageResult {\n\treturn predicate.TriageResult(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "1fe5362657c457489e129bcc1b5e3987", "score": "0.7351353", "text": "func IDEQ(id int) predicate.Tag {\n\treturn predicate.Tag(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "77ed2ac3404bf7e839c2dd2064497d9b", "score": "0.7348366", "text": "func IDEQ(id int) predicate.Pointkycrv {\n\treturn predicate.Pointkycrv(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3cf21e24272e3d4c8e709e218153c489", "score": "0.734681", "text": "func IDEQ(id int) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3cf21e24272e3d4c8e709e218153c489", "score": "0.734681", "text": "func IDEQ(id int) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3cf21e24272e3d4c8e709e218153c489", "score": "0.734681", "text": "func IDEQ(id int) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e365d14cfe7092f1928f5469cdca3322", "score": "0.73351645", "text": "func IDEQ(id uuid.UUID) predicate.Screenshot {\n\treturn predicate.Screenshot(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "85821fcbf8572d65c9dccad50d0be163", "score": "0.7333923", "text": "func IDEQ(id int) predicate.AppointmentResults {\n\treturn predicate.AppointmentResults(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bee4befe639f4757c597fe9dd7f8c015", "score": "0.73325694", "text": "func IDEQ(id int) predicate.Task {\n\treturn predicate.Task(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "346b08a71d96b9bdaa5eefb5c63fe1bc", "score": "0.7313197", "text": "func IDEQ(id int) predicate.Mission {\n\treturn predicate.Mission(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "a7a2a3ddac81635e31b52d504a7f01ae", "score": "0.73077416", "text": "func IDEQ(id int) predicate.Roomuse {\n\treturn predicate.Roomuse(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "1fdadaba770422d42582ab6c3925a990", "score": "0.7307734", "text": "func IDEQ(id int) predicate.Problem {\n\treturn predicate.Problem(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0d5a662cf8eb84e8fd652a7d12503509", "score": "0.72903746", "text": "func IDEQ(id int) predicate.Experience {\n\treturn predicate.Experience(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "ded67b2c414d43aa4d16f975a301e56e", "score": "0.7285354", "text": "func IDEQ(id uuid.UUID) predicate.Transfer {\n\treturn predicate.Transfer(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9dc4c166c2e99f054e9cf7549f288e2f", "score": "0.727817", "text": "func IDEQ(id int) predicate.Books {\n\treturn predicate.Books(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "188ee38ca4070ce0d86dafdb0a82423b", "score": "0.7258367", "text": "func IDEQ(id int) predicate.Promotion {\n\treturn predicate.Promotion(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "bc353cdb9d81b2850db97af6b1cbdfe8", "score": "0.7228298", "text": "func IDEQ(id int) predicate.Course {\n\treturn predicate.Course(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cda638ed5b0dd22bce587960014b8af1", "score": "0.72216773", "text": "func IDEQ(id int) predicate.Orderonline {\n\treturn predicate.Orderonline(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e8f8167a0e0eb4ef133159da3a13b998", "score": "0.7217176", "text": "func IDEQ(id int) predicate.Source {\n\treturn predicate.Source(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b864a6b5442acc5103ce64b4c5e638bc", "score": "0.7216155", "text": "func IDEQ(id int) predicate.Person {\n\treturn predicate.Person(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "48a8dcd7df37f5f8e8d136174b2470e8", "score": "0.7195229", "text": "func IDEQ(id string) predicate.DUser {\n\treturn predicate.DUser(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b25edf2905ee03840f69122fb59edc11", "score": "0.7181805", "text": "func IDEQ(id int) predicate.License {\n\treturn predicate.License(func(t *dsl.Traversal) {\n\t\tt.HasID(p.EQ(id))\n\t})\n}", "title": "" }, { "docid": "a8880e6e3925f3dcd764de3a68c930e8", "score": "0.71643287", "text": "func IDEQ(id uint64) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "20066585d981d2bc55889b42e64caba1", "score": "0.7156845", "text": "func IDEQ(id int) predicate.DataRoom {\n\treturn predicate.DataRoom(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5c6f938d84f8ad3b9c33469f6df3d81b", "score": "0.7155148", "text": "func IDEQ(id int) predicate.File {\n\treturn predicate.File(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "0345e8553c88e03444f04115a79a8f2f", "score": "0.7150565", "text": "func IDEQ(id int) predicate.Profile {\n\treturn predicate.Profile(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "728ab46c2a63f7561e1e2f61364b6696", "score": "0.71439767", "text": "func IDEQ(id int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "eb73957d5e5e7296d8917ad3888e2809", "score": "0.713768", "text": "func IDEQ(id int) predicate.Logger {\n\treturn predicate.Logger(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "74aad5b9673471b1593f08b192eda33a", "score": "0.7122239", "text": "func IDEQ(id int) predicate.BlockInstance {\n\treturn predicate.BlockInstance(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "95a0d366bef5a31246d3936927f168e8", "score": "0.71203", "text": "func IDEQ(id int) predicate.ScholarshipRequest {\n\treturn predicate.ScholarshipRequest(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "e29dbfc776405069352bc40806a03429", "score": "0.70880777", "text": "func IDEQ(id int) predicate.Hospital {\n\treturn predicate.Hospital(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "75a52731e7e12a5973f7af015545626a", "score": "0.70836914", "text": "func IDEQ(id string) predicate.OAuth2Client {\n\treturn predicate.OAuth2Client(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "fb478bb35e72a13c5cd3dd0269e1d4bf", "score": "0.7082634", "text": "func IDEQ(id uuid.UUID) predicate.Task {\n\treturn predicate.Task(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5499b3e83e9ad6fbc31aaef7c1352077", "score": "0.7082204", "text": "func IDEQ(id string) predicate.Keys {\n\treturn predicate.Keys(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "5f963ec3399e04be782d703f1af5ef4e", "score": "0.707043", "text": "func IDEQ(id int) predicate.ResourcePool {\n\treturn predicate.ResourcePool(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "aaafbded70c8e83af3c3bd26fc974edb", "score": "0.7058121", "text": "func IDEQ(id int) predicate.Ticket {\n\treturn predicate.Ticket(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cb23fdab7127fdd5404e162df934c89c", "score": "0.6984685", "text": "func IDEQ(id int) predicate.History {\n\treturn predicate.History(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9b0b3b9a26adab9cbb0f69b16d96b8ad", "score": "0.69781363", "text": "func IDEQ(id int) predicate.Todo {\n\treturn predicate.Todo(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "302b19dc04e43e089ccfa92de4f363b0", "score": "0.69650775", "text": "func IDEQ(id int) predicate.RightToTreatment {\n\treturn predicate.RightToTreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "f69cf1886f504895aca74d2fdbe4c9f6", "score": "0.69640243", "text": "func IDEQ(id int) predicate.Campaign {\n\treturn predicate.Campaign(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "389e1e47fe8df9fbd7821910458abd23", "score": "0.696106", "text": "func IDEQ(id string) predicate.SysLogging {\n\treturn predicate.SysLogging(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "b5181a7ee38e85b4feb7dfa3a1b086c5", "score": "0.6918741", "text": "func IDEQ(id int) predicate.GithubAsset {\n\treturn predicate.GithubAsset(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "585e6720ac323c7f29cbb1762c55a2cd", "score": "0.6867186", "text": "func (f IDFilter) Eq(value int64) (exp Filter) {\n\treturn Filter{\n\t\texpression: \"id = ?\",\n\t\targs: []interface{}{value},\n\t}\n}", "title": "" }, { "docid": "b8df4816a7c2baf3c65ceea3316fdc8d", "score": "0.685642", "text": "func (qs CalendarQS) IDEq(v int32) CalendarQS {\n\treturn qs.filter(`\"id\" =`, v)\n}", "title": "" }, { "docid": "aa9fc535fbfd2ada854851160df29afc", "score": "0.6847401", "text": "func (qs RfprofileQS) IDEq(v int32) RfprofileQS {\n\treturn qs.filter(`\"id\" =`, v)\n}", "title": "" }, { "docid": "f480ed28bbc341c61b982f78ae5a3b4e", "score": "0.6838972", "text": "func (qs ArticleQuerySet) IDEq(ID uint) ArticleQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "ac3daf4d38bab62ee00cbe4e24366367", "score": "0.68342537", "text": "func IDEQ(id int) predicate.DeviceToken {\n\treturn predicate.DeviceToken(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "56a5bd0e49835b144df1ba5b18bf552d", "score": "0.6832487", "text": "func IdcardEQ(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIdcard), v))\n\t})\n}", "title": "" }, { "docid": "92bba8f46a10750d4f76ee64e260b08f", "score": "0.6801079", "text": "func IDEQ(id int) predicate.Playlist {\n\treturn predicate.Playlist(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "be8bf1a0f20d20f92b2ac4bbbb3519e7", "score": "0.6790906", "text": "func IDEQ(id int) predicate.GoodsSku {\n\treturn predicate.GoodsSku(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "d393449c83dda44b8ada17b34b8bb895", "score": "0.6784655", "text": "func (qs AccountQuerySet) IDEq(ID uint) AccountQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "16dbe87c83f39759b4f274aa3e218e49", "score": "0.67699516", "text": "func (qs CurrencyQuerySet) IDEq(ID uint) CurrencyQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "de8c1b37a6e25e7a574f7c711f6ffd25", "score": "0.6760218", "text": "func IDEQ(id int) predicate.Billingstatus {\n\treturn predicate.Billingstatus(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "9737465fa858c6b0c4713433f9db34c0", "score": "0.6740647", "text": "func IDEQ(id int) predicate.PortChannelInterface {\n\treturn predicate.PortChannelInterface(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "ebf1604addbb9714b424b5ee9b17dc2e", "score": "0.67059076", "text": "func IDEQ(id int) predicate.FieldType {\n\treturn predicate.FieldType(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "22550229763c424ddf4ebfe08aa5a77c", "score": "0.6693582", "text": "func IDEQ(id int) predicate.ExportTask {\n\treturn predicate.ExportTask(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "879917fea1fd7bf46bf9fec12fc660a2", "score": "0.6679505", "text": "func IdennumEQ(v string) predicate.RightToTreatment {\n\treturn predicate.RightToTreatment(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIdennum), v))\n\t})\n}", "title": "" }, { "docid": "072f611c122922746dacff7dcd3df9ab", "score": "0.6621787", "text": "func (qs PlanQuerySet) IDEq(ID uint) PlanQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "21610e294ac3d71d12b1d37646bc2672", "score": "0.6606135", "text": "func IDEQ(id int) predicate.Timer {\n\treturn predicate.Timer(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "cb1e61e7d3f2ddadea081f2b58684f77", "score": "0.6585596", "text": "func (qs UserQuerySet) IDEq(ID uint) UserQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "d08dda76abb39bde41a88f2354c83e85", "score": "0.65277195", "text": "func (qs TaskQuerySet) IDEq(ID uint64) TaskQuerySet {\n\treturn qs.w(qs.db.Where(\"id = ?\", ID))\n}", "title": "" }, { "docid": "fbc2f6da68257dfc7b735fc5c7b77661", "score": "0.64897877", "text": "func IDEQ(id int) predicate.BaselineMeasureDenomCount {\n\treturn predicate.BaselineMeasureDenomCount(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "eda4d5050dbf5e8c8a6bdb4913c6e7c1", "score": "0.62778556", "text": "func IDEQ(id int) predicate.FlowDropWithdraw {\n\treturn predicate.FlowDropWithdraw(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "3e1568f06bb64588c1571ab8b93341cd", "score": "0.61992115", "text": "func (eq *evalEq) ID() int64 {\n\treturn eq.id\n}", "title": "" }, { "docid": "b5b8a02cb38ca60f28516be733057f3e", "score": "0.6189149", "text": "func (qs CalendarQS) IDGe(v int32) CalendarQS {\n\treturn qs.filter(`\"id\" >=`, v)\n}", "title": "" }, { "docid": "270a28e90bc29fa06300e4ec548dccf8", "score": "0.6188236", "text": "func ExternalIdEQ(v string) predicate.Recommendations {\n\treturn predicate.Recommendations(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldExternalId), v))\n\t})\n}", "title": "" }, { "docid": "8290e8a6e3f4e7bf212b8d7eebdd4499", "score": "0.61372715", "text": "func (qs RfprofileQS) IDGe(v int32) RfprofileQS {\n\treturn qs.filter(`\"id\" >=`, v)\n}", "title": "" }, { "docid": "b282e2f58956112a72ad4f6d8ad05e19", "score": "0.6111064", "text": "func IDEqualFold(id string) predicate.Connector {\n\treturn predicate.Connector(sql.FieldEqualFold(FieldID, id))\n}", "title": "" }, { "docid": "70ea58ed121691091d1e65ad9ebdc1eb", "score": "0.6106574", "text": "func PatientIDEQ(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldPatientID), v))\n\t})\n}", "title": "" }, { "docid": "60573fd161d8276b00f3ed3923ced8f4", "score": "0.6097935", "text": "func IDNEQ(id int) predicate.License {\n\treturn predicate.License(func(t *dsl.Traversal) {\n\t\tt.HasID(p.NEQ(id))\n\t})\n}", "title": "" }, { "docid": "b3ed97d95d406769bf37d5e70f005534", "score": "0.60933113", "text": "func UIDEQ(v int64) predicate.Deal {\n\treturn predicate.Deal(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldUID), v))\n\t})\n}", "title": "" }, { "docid": "42a8c1bb4a5d13b623d8896c4418f6e4", "score": "0.60800815", "text": "func CardIDEQ(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCardID), v))\n\t})\n}", "title": "" }, { "docid": "42a8c1bb4a5d13b623d8896c4418f6e4", "score": "0.60800815", "text": "func CardIDEQ(v string) predicate.Patient {\n\treturn predicate.Patient(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldCardID), v))\n\t})\n}", "title": "" }, { "docid": "77ed6f28d67295282efd0841a6c78601", "score": "0.60778695", "text": "func IDNEQ(id int) predicate.Car {\n\treturn predicate.Car(sql.FieldNEQ(FieldID, id))\n}", "title": "" }, { "docid": "47ee39b8cc1171b6611b13aec5514eab", "score": "0.60143834", "text": "func IDNEQ(id int) predicate.Card {\n\treturn predicate.Card(sql.FieldNEQ(FieldID, id))\n}", "title": "" }, { "docid": "ed95d28011215bff2beb1696d637a7aa", "score": "0.6008218", "text": "func ID(id int) predicate.Demo {\n\treturn predicate.Demo(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "5338066d105172fe4cfcc4467f5158ac", "score": "0.6003793", "text": "func IdentifiantEQ(v string) predicate.Admin {\n\treturn predicate.Admin(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldIdentifiant), v))\n\t})\n}", "title": "" }, { "docid": "2e54dde4cfda345947e8f2d18656bde5", "score": "0.5921011", "text": "func ID(id int) predicate.Card {\n\treturn predicate.Card(sql.FieldEQ(FieldID, id))\n}", "title": "" }, { "docid": "ef2522e259b40cff716ad7938a9054c5", "score": "0.59079456", "text": "func (f IDFilter) Equal(value int64) (exp Filter) {\n\treturn f.Eq(value)\n}", "title": "" }, { "docid": "287b5a8204725a46c1dac0f3b484d312", "score": "0.58827186", "text": "func IDNEQ(id string) predicate.Keys {\n\treturn predicate.Keys(sql.FieldNEQ(FieldID, id))\n}", "title": "" }, { "docid": "b7f224d77211cce00c75e2c3b179e615", "score": "0.5876706", "text": "func ProductIdEQ(v int64) predicate.Deal {\n\treturn predicate.Deal(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldProductId), v))\n\t})\n}", "title": "" } ]
68f4f24985d048d58b7dbe3a6d46d372
GetMicrosecond is a wrapper around g_date_time_get_microsecond().
[ { "docid": "16df74e28924efc24e23a02012e03a7a", "score": "0.8217028", "text": "func (datetime DateTime) GetMicrosecond() int {\n\tret0 := C.g_date_time_get_microsecond(datetime.native())\n\treturn int(ret0)\n}", "title": "" } ]
[ { "docid": "710781466ca49fb17f4911b928999067", "score": "0.7313212", "text": "func GetTimestampMicroSec() int64 {\n\treturn time.Now().UnixNano() / int64(time.Microsecond)\n}", "title": "" }, { "docid": "014604d433dbe8018d9cc855583dbc68", "score": "0.71327525", "text": "func UnixMicrosecond(t time.Time) int64 {\n\treturn t.UnixNano() / 1e3\n}", "title": "" }, { "docid": "60b23c52aa2cf1b83fa5fe486df18de2", "score": "0.70842576", "text": "func (t MysqlTime) Microsecond() int {\n\treturn int(t.microsecond)\n}", "title": "" }, { "docid": "964aa6c3aacc366a41bd15c56499fab2", "score": "0.69623774", "text": "func (utdf UTDF) GetMicroseconds() int {\n\tmcS := (int(utdf[14]) << 24) + (int(utdf[15]) << 16) + (int(utdf[16]) << 8) + int(utdf[17])\n\treturn mcS\n}", "title": "" }, { "docid": "192223d01199efeb70ac2dcc858fc4b2", "score": "0.6544109", "text": "func (t Time) Microseconds() int64 {\n\treturn t.ns / 1000\n}", "title": "" }, { "docid": "bfd9739f29ff2dbcf15fa9a83c57508b", "score": "0.6484421", "text": "func microseconds() int64 {\r\n t := time.Now().UnixNano()\r\n us := t / int64(time.Microsecond)\r\n return us\r\n}", "title": "" }, { "docid": "06d43d53b38bbc1ecf410062090e19cd", "score": "0.6358949", "text": "func MicroTime() string {\n\treturn time.Now().Format(\"2006-01-02 15:04:05.000000\")\n}", "title": "" }, { "docid": "fc123a98da4cc43cab7d437d266f7fb1", "score": "0.6335664", "text": "func SetMicrosecond(t time.Time, microsecond int) time.Time {\n\treturn time.Date(t.Year(), t.Month(), t.Day(), t.Hour(), t.Minute(), t.Second(), microsecond*1e3, t.Location())\n}", "title": "" }, { "docid": "f0881c8a26fdb9a61dcba3781bc8f3f4", "score": "0.6326343", "text": "func Micro(t time.Time) int64 {\n\ts := t.Unix() * 1e6\n\tµs := int64(t.Nanosecond()) / 1e3\n\treturn s + µs\n}", "title": "" }, { "docid": "6bd79f075b8d2a0796e10c2a2d03e834", "score": "0.6273553", "text": "func fncMicrotime(ctx core.Context, args []*core.ZVal) (*core.ZVal, error) {\n\tvar asFloat *core.ZBool\n\t_, err := core.Expand(ctx, args, &asFloat)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tt := time.Now()\n\tif asFloat != nil && *asFloat {\n\t\t// return as float\n\t\tfv := float64(t.Unix()) + float64(t.Nanosecond())/1e9\n\t\treturn core.ZFloat(fv).ZVal(), nil\n\t}\n\n\t// return as string\n\tr := fmt.Sprintf(\"%0.8f %d\", float64(t.Nanosecond())/1e9, t.Unix())\n\treturn core.ZString(r).ZVal(), nil\n}", "title": "" }, { "docid": "97eb00b5b846223208397c57c0ed4a7d", "score": "0.6253062", "text": "func TimeToMicroseconds(t time.Time) int64 {\n\tif t.IsZero() {\n\t\treturn 0\n\t}\n\treturn t.UnixMicro()\n}", "title": "" }, { "docid": "9162f721a9dda835158dbb35e32a8d80", "score": "0.61665815", "text": "func MicrosecondsToTime(us int64) time.Time {\n\tif us == 0 {\n\t\treturn time.Time{}\n\t}\n\treturn time.UnixMicro(us)\n}", "title": "" }, { "docid": "a7ff8bbb6b601c89c067d6048364dce6", "score": "0.61549026", "text": "func (t *TimeCounter) GetUs() int64 {\n\treturn (time.Now().UnixNano() - t.int64) / int64(time.Microsecond)\n}", "title": "" }, { "docid": "a7ff8bbb6b601c89c067d6048364dce6", "score": "0.61549026", "text": "func (t *TimeCounter) GetUs() int64 {\n\treturn (time.Now().UnixNano() - t.int64) / int64(time.Microsecond)\n}", "title": "" }, { "docid": "ede7e14085db0068d5bc6381bd4ac11e", "score": "0.61395985", "text": "func sinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "77804bc4beec7872573d579d9aff8fce", "score": "0.60347885", "text": "func GetTimeMilliSecond(s int) time.Duration{\n\treturn time.Duration(s) * time.Millisecond\n}", "title": "" }, { "docid": "b931fe71b5e54bdae0e7b66da9978aec", "score": "0.5999524", "text": "func (ts TimestampMicrosecond) ToTime() time.Time {\n\treturn time.Time(ts)\n}", "title": "" }, { "docid": "d381eebb6c608ac2728e091c5208aab4", "score": "0.59889644", "text": "func SinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "d381eebb6c608ac2728e091c5208aab4", "score": "0.59889644", "text": "func SinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "d381eebb6c608ac2728e091c5208aab4", "score": "0.59889644", "text": "func SinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "d381eebb6c608ac2728e091c5208aab4", "score": "0.59889644", "text": "func SinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "d381eebb6c608ac2728e091c5208aab4", "score": "0.59889644", "text": "func SinceInMicroseconds(start time.Time) float64 {\n\treturn float64(time.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "e03311b4dc218a6614ed3b775d8cb7c9", "score": "0.58369493", "text": "func GetTimeMillisecond() string {\n\tnow := time.Now()\n\tnano := now.UnixNano()\n\tms := nano / 1000000\n\treturn strconv.FormatInt(ms, 10)\n}", "title": "" }, { "docid": "3cd6f2116150f09151bcc1692c7ad394", "score": "0.57631207", "text": "func GetTime(timestamp *timestamp.Timestamp) time.Time {\n\treturn time.Unix(timestamp.Seconds, int64(timestamp.Nanos))\n}", "title": "" }, { "docid": "f784de7df91b13ce3dcaaa69e0ddcd23", "score": "0.57606137", "text": "func microsecondInt64ToTime(i int64) time.Time {\n\tµsec := i % 1e6\n\tsec := (i - µsec) / 1e6\n\n\treturn time.Unix(sec, µsec*1e3)\n}", "title": "" }, { "docid": "de18c65b1a94352a0bada11dd507edfd", "score": "0.5752997", "text": "func time_us() int64 {\n t := time.Now()\n return t.UnixNano() / 1000\n}", "title": "" }, { "docid": "ba44ad327a34422c077c4f78ec143e0a", "score": "0.57211655", "text": "func FromMicro(µs int64) time.Time {\n\ts := µs / 1e6\n\tns := (µs - s*1e6) * 1e3\n\treturn time.Unix(s, ns)\n}", "title": "" }, { "docid": "490d678bc1f95502e2f32e63b236fd82", "score": "0.56926405", "text": "func GetNowUs() int64 {\n\treturn time.Now().UnixNano() / int64(time.Microsecond)\n}", "title": "" }, { "docid": "490d678bc1f95502e2f32e63b236fd82", "score": "0.56926405", "text": "func GetNowUs() int64 {\n\treturn time.Now().UnixNano() / int64(time.Microsecond)\n}", "title": "" }, { "docid": "866744a77905c2b798ed1ff17e7b321b", "score": "0.56698483", "text": "func (datetime DateTime) GetSecond() int {\n\tret0 := C.g_date_time_get_second(datetime.native())\n\treturn int(ret0)\n}", "title": "" }, { "docid": "944d8ac017e0222124b1cb1a13f1079e", "score": "0.56601954", "text": "func (t *TwampTimestamp) GetTime() time.Time {\n\t// convert epoch from 1900 back to 1970\n\treturn time.Unix(int64(t.Integer), int64(t.Fraction)).Add(-1 * epochOffset)\n}", "title": "" }, { "docid": "03ed915f39ce61463cee56c881134854", "score": "0.5656153", "text": "func (s *Scheduler) Millisecond() *Scheduler {\n\treturn s.Milliseconds()\n}", "title": "" }, { "docid": "e2760f1d46e54544969ce706c26f2de0", "score": "0.5652884", "text": "func BenchmarkCurrentMicrosecond(b *testing.B) {\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = CurrentMicrosecond()\n\t}\n}", "title": "" }, { "docid": "fcb24728ea0d881c7501ee27f3a1fea7", "score": "0.564068", "text": "func UnixMillisecond(t time.Time) int64 {\n\treturn t.UnixNano() / 1e6\n}", "title": "" }, { "docid": "4bcae8666491177f7b53525feb1ad055", "score": "0.5630591", "text": "func DurationMicrosecondComponent(d time.Duration) int {\n\tus := d / time.Microsecond\n\tms := d / time.Millisecond\n\treturn int(us - ms*1e3)\n}", "title": "" }, { "docid": "42e11074b9ae560e198d304365a37390", "score": "0.56276727", "text": "func DurationInMicroseconds(duration time.Duration) float64 {\n\treturn float64(duration.Nanoseconds()) / float64(time.Microsecond.Nanoseconds())\n}", "title": "" }, { "docid": "a788d7a73a38825b1546eacd5590d222", "score": "0.5601892", "text": "func GetMillionSecondTimestamp() int64 {\n\treturn time.Now().UnixNano() / 1e6\n}", "title": "" }, { "docid": "fe7de6fa63a4b113ec56c994aba44121", "score": "0.5560741", "text": "func (d ASEDuration) Microseconds() int { return int(d) }", "title": "" }, { "docid": "84d8023f8586d4f085ee639383f59c6f", "score": "0.5545777", "text": "func GetMillis() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "a7603a0aece3dd71da159b2d0e0edb54", "score": "0.55389315", "text": "func monotime() uint64 {\n\trtcCounter := uint32(nrf.RTC0.COUNTER)\n\toffset := (rtcCounter - rtcLastCounter) % 0xffffff // change since last measurement\n\trtcLastCounter = rtcCounter\n\ttimestamp += uint64(offset * 32) // TODO: not precise\n\treturn timestamp\n}", "title": "" }, { "docid": "fd3f84e235e93541eaa39cf34924e1df", "score": "0.55370885", "text": "func BenchmarkNowMicrosecond(b *testing.B) {\n\tb.ReportAllocs()\n\tb.ResetTimer()\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = time.Now().Unix() / 1e3\n\t}\n}", "title": "" }, { "docid": "8a236f712d3afde05677ce0c654c69a1", "score": "0.5517542", "text": "func EpochStamp2MicroTime(timestamp int64) time.Time {\n\treturn time.Unix(0, timestamp*int64(time.Microsecond))\n}", "title": "" }, { "docid": "3f63cde1225b48d6df454f3ba80461d8", "score": "0.55132484", "text": "func UnixMilliSecond() uint64 {\n\treturn TimeToTimestampMs(time.Now())\n}", "title": "" }, { "docid": "76837858dd277ecc06343399b420b2aa", "score": "0.5486182", "text": "func getTime(uucode uuid.UUID) time.Time {\n\tut, _ := uucode.Time()\n\ts, n := ut.UnixTime()\n\treturn time.Unix(s, n)\n}", "title": "" }, { "docid": "cda7e97710d8771d9ae002f112db8d17", "score": "0.5463568", "text": "func (t *Time) Second() int { return t.second }", "title": "" }, { "docid": "2fe1745f6be42ecc4eae679187526ccf", "score": "0.5436128", "text": "func TimeToUnixMillisecond(t time.Time) int64 {\n\tn := t.UnixNano()\n\treturn n / 1e6\n}", "title": "" }, { "docid": "13c87f037a6c2b092f012b66df19d06c", "score": "0.54278237", "text": "func (this *utilStruct) MillisecondsToTime(ms uint64) time.Time {\n\ts := int64(ms / MILLISECONDS_PER_SECOND)\n\tns := int64((ms % MILLISECONDS_PER_SECOND) * NANOSECONDS_PER_MILLISECOND)\n\tt := time.Unix(s, ns)\n\tutc := t.UTC()\n\treturn utc\n}", "title": "" }, { "docid": "261a8e4344927a96fbd7f721502b7c1d", "score": "0.54143614", "text": "func SecToMicroSec(sec int) int {\n\treturn (sec * int(time.Second) / int(time.Microsecond))\n}", "title": "" }, { "docid": "a6a9427b27a719c588241ce9c86b4c18", "score": "0.54033494", "text": "func GetTimeSecond(s int) time.Duration{\n\treturn time.Duration(s) * time.Second\n}", "title": "" }, { "docid": "ecf3e8407544f023a12b5abcbcce2c44", "score": "0.5379064", "text": "func (t TimeWrapper) getSecond() int8 {\n\treturn t.time.Sec\n}", "title": "" }, { "docid": "b41fee326addb28b1087347c8476ee0f", "score": "0.5377051", "text": "func TimeFromMicrosecondsSinceEpoch(micros int64) time.Time {\n\tnanos := micros * int64(nanosInOneMicro)\n\treturn time.Unix(0, nanos).UTC()\n}", "title": "" }, { "docid": "8efd8ad78c991beae8b65a4068f4ded6", "score": "0.53753155", "text": "func (t *TimeCounter) GetMs() int64 {\n\treturn (time.Now().UnixNano() - t.int64) / int64(time.Millisecond)\n}", "title": "" }, { "docid": "8efd8ad78c991beae8b65a4068f4ded6", "score": "0.53753155", "text": "func (t *TimeCounter) GetMs() int64 {\n\treturn (time.Now().UnixNano() - t.int64) / int64(time.Millisecond)\n}", "title": "" }, { "docid": "a20110225fb0d3da62676fb749976418", "score": "0.53687125", "text": "func timeMicrosToNative(fn toNativeFn) toNativeFn {\n\treturn func(bytes []byte) (interface{}, []byte, error) {\n\t\tl, b, err := fn(bytes)\n\t\tif err != nil {\n\t\t\treturn l, b, err\n\t\t}\n\t\ti, ok := l.(int64)\n\t\tif !ok {\n\t\t\treturn l, b, fmt.Errorf(\"cannot transform to native time.Duration, expected long, received %T\", l)\n\t\t}\n\t\tt := time.Duration(i) * time.Microsecond\n\t\treturn t, b, nil\n\t}\n}", "title": "" }, { "docid": "e89b50c16051e5e516cde15e9b0e9c87", "score": "0.5366632", "text": "func CalcDurationMicroUTC(duration time.Duration) string {\n\treturn CalcDurationUTC(duration, LayoutSecond)\n}", "title": "" }, { "docid": "d240159b4aa093dfc12218e33d9cd5b8", "score": "0.53623164", "text": "func GetBootTime() (time.Time, error) {\n\tcurrentTime := time.Now()\n\toutput, _, err := tickCount.Call()\n\tif errno, ok := err.(syscall.Errno); !ok || errno != 0 {\n\t\treturn time.Time{}, err\n\t}\n\treturn currentTime.Add(-time.Duration(output) * time.Millisecond).Truncate(time.Second), nil\n}", "title": "" }, { "docid": "d59cc2464184c626eb6d89c5e1193189", "score": "0.5357978", "text": "func GetMilliTimestamp() int64 {\n\treturn time.Now().UnixNano() / 1000000\n}", "title": "" }, { "docid": "c61a2cd3487361c4725f74d897822497", "score": "0.5339724", "text": "func (c *CommitEntry) GetMilliTime() int64 {\n\ta := make([]byte, 2, 8)\n\ta = append(a, c.MilliTime[:]...)\n\tmilli := int64(binary.BigEndian.Uint64(a))\n\treturn milli\n}", "title": "" }, { "docid": "ba6042f78f55a51e3fd1fbf77f19e3a7", "score": "0.5323726", "text": "func (t *StopWatchStep) Milliseconds() float64 {\n\treturn float64(t.du / time.Millisecond)\n}", "title": "" }, { "docid": "5de2ff7d753532437c2ee040111d05f9", "score": "0.53218913", "text": "func (s *Stopwatch) Milliseconds() int64 {\n\treturn int64(s.Duration() * time.Nanosecond / time.Millisecond)\n}", "title": "" }, { "docid": "41c2b80bd6367beacbaf9f4ee94ce3eb", "score": "0.53111047", "text": "func (m *MockClock) GetUTCTime() time.Time {\n\treturn time.Unix(m.Time, 0)\n}", "title": "" }, { "docid": "817af3c877309c7a482848eb6e0d4c02", "score": "0.53074145", "text": "func UnixMilliU(t time.Time) uint64 {\n\treturn uint64(t.Unix()*1e3) + uint64(t.Nanosecond())/1e6\n}", "title": "" }, { "docid": "c713b604d87ee17726a1f816bf2bff95", "score": "0.5274759", "text": "func milliTime() (r []byte) {\n\tbuf := new(bytes.Buffer)\n\tt := time.Now().UnixNano()\n\tm := t / 1e6\n\tbinary.Write(buf, binary.BigEndian, m)\n\treturn buf.Bytes()[2:]\n}", "title": "" }, { "docid": "0926767c9a95228ae378f4d35178815b", "score": "0.5273937", "text": "func (jbobject *DbColumnFamilyStoreMBean) GetRecentWriteLatencyMicros() float64 {\n\tjret, err := jbobject.CallDouble(\"getRecentWriteLatencyMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "1b6eb7acf0203be1bb724a6c5aa8e2c8", "score": "0.52384496", "text": "func GetTimestamp() float64 {\n\treturn float64(time.Now().UnixNano()) / float64(time.Millisecond) / float64(time.Nanosecond) / 1000.0\n}", "title": "" }, { "docid": "408b40aaad9637379974fb4d5440168e", "score": "0.52346164", "text": "func MicroSleep(tm float64) {\n\tC.microsleep(C.double(tm))\n}", "title": "" }, { "docid": "066e7c279b13c688792d33c7d6c2b029", "score": "0.5217957", "text": "func clockGettime(c ClockID) (ReferenceNS, error) {\n\tvar ts unix.Timespec\n\n\tvdsoClockGettime(c, &ts)\n\n\treturn ReferenceNS(ts.Nano()), nil\n}", "title": "" }, { "docid": "80bf46efa124c3abb110636c1920322e", "score": "0.520348", "text": "func TimeUnixMilli(t time.Time) int64 {\n\treturn t.UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "d244ad9a6f30a8b1a381723b2748dce5", "score": "0.5200758", "text": "func (t TimeInUs) Duration() time.Duration { return time.Duration(t) * time.Microsecond }", "title": "" }, { "docid": "ea5be386f1d25b59241f4b931ebdb066", "score": "0.51932985", "text": "func timeStampMicrosToNative(fn toNativeFn) toNativeFn {\n\treturn func(bytes []byte) (interface{}, []byte, error) {\n\t\tl, b, err := fn(bytes)\n\t\tif err != nil {\n\t\t\treturn l, b, err\n\t\t}\n\t\ti, ok := l.(int64)\n\t\tif !ok {\n\t\t\treturn l, b, fmt.Errorf(\"cannot transform native timestamp-micros, expected int64, received %T\", l)\n\t\t}\n\t\tsecs := i / int64(time.Millisecond)\n\t\tnanosecs := i - (secs * int64(time.Millisecond))\n\t\treturn time.Unix(secs, nanosecs).UTC(), b, nil\n\t}\n}", "title": "" }, { "docid": "6b75e139e5393554ff79f7108b743cb3", "score": "0.5189096", "text": "func (_Augur *AugurCaller) GetTimestamp(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Augur.contract.Call(opts, out, \"getTimestamp\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "3c9fdc72c08bba0038a28c7ede709f7c", "score": "0.5182099", "text": "func getUnixMilli() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "47b192b6e436ceacd30f73aa2bc255fe", "score": "0.5175907", "text": "func FormatTimeNoMicro(t time.Time) string {\n\treturn t.Format(iso8601NoMicro)\n}", "title": "" }, { "docid": "47b192b6e436ceacd30f73aa2bc255fe", "score": "0.5175907", "text": "func FormatTimeNoMicro(t time.Time) string {\n\treturn t.Format(iso8601NoMicro)\n}", "title": "" }, { "docid": "b4128f7acec53ef13eb183ef2d3d7b6f", "score": "0.5158679", "text": "func (c *Client) TimeInMilliseconds(name string, value float64, tags []string, rate float64) error {\n\treturn c.client.TimeInMilliseconds(name, value, Tags(tags).Pair(), rate)\n}", "title": "" }, { "docid": "00a2f6d245d95f824192c60d85d9bf2d", "score": "0.5128459", "text": "func TimeUnixMilli(t time.Time) int64 {\n\treturn t.UnixNano() / int64(time.Millisecond/time.Nanosecond)\n}", "title": "" }, { "docid": "00a2f6d245d95f824192c60d85d9bf2d", "score": "0.5128459", "text": "func TimeUnixMilli(t time.Time) int64 {\n\treturn t.UnixNano() / int64(time.Millisecond/time.Nanosecond)\n}", "title": "" }, { "docid": "3cc61f9d95165030c5a3c120fde7d133", "score": "0.51257116", "text": "func MilliNow() int64 {\n tim := time.Now()\n nanos := tim.UnixNano()\n millis := nanos/1000000\n return millis\n}", "title": "" }, { "docid": "3cc61f9d95165030c5a3c120fde7d133", "score": "0.51257116", "text": "func MilliNow() int64 {\n tim := time.Now()\n nanos := tim.UnixNano()\n millis := nanos/1000000\n return millis\n}", "title": "" }, { "docid": "ab7e16c5c5ed11c124cc518b49bca21d", "score": "0.5108473", "text": "func (l *Lbank) GetTimestamp(ctx context.Context) (time.Time, error) {\n\tvar resp TimestampResponse\n\tpath := fmt.Sprintf(\"/v%s/%s\", lbankAPIVersion2, lbankTimestamp)\n\terr := l.SendHTTPRequest(ctx, exchange.RestSpot, path, &resp)\n\tif err != nil {\n\t\treturn time.Time{}, err\n\t}\n\treturn time.UnixMilli(resp.Timestamp), nil\n}", "title": "" }, { "docid": "c3c0ccba964ab4f04b819007da1bdea7", "score": "0.51059747", "text": "func TimeInMilliseconds(name string, value float64, tags []string, rate float64) error {\n\tif client == nil {\n\t\treturn clientNotInitialized\n\t}\n\treturn client.TimeInMilliseconds(name, value, tags, rate)\n}", "title": "" }, { "docid": "c3c0ccba964ab4f04b819007da1bdea7", "score": "0.51059747", "text": "func TimeInMilliseconds(name string, value float64, tags []string, rate float64) error {\n\tif client == nil {\n\t\treturn clientNotInitialized\n\t}\n\treturn client.TimeInMilliseconds(name, value, tags, rate)\n}", "title": "" }, { "docid": "e90a27f5c4098fccf9db7793d6250468", "score": "0.510067", "text": "func GetTime() uint32 {\n\tnow := time.Since(time.Date(2000, time.January, 1, 0, 0, 0, 0, time.UTC))\n\treturn uint32((now.Nanoseconds() / 1000000000) % 0xffffffff)\n}", "title": "" }, { "docid": "40bde328b6bfe5df34454548b0147e80", "score": "0.51001865", "text": "func (c *mockClock) GetTimestamp() uint32 {\n\treturn uint32(int64(c.startTimeStamp) + time.Since(c.startTime).Microseconds())\n}", "title": "" }, { "docid": "20daf386d0d190a09a985ac48cea2618", "score": "0.5099261", "text": "func Milli(t time.Time) int64 {\n\ts := t.Unix() * 1e3\n\tms := int64(t.Nanosecond()) / 1e6\n\treturn s + ms\n}", "title": "" }, { "docid": "beeeeb715c60f6a167d46c063216a42b", "score": "0.509532", "text": "func getTimestamp() int64 {\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "7805147b432af4b72a82b8a55005cf4f", "score": "0.5093236", "text": "func (jbobject *DbColumnFamilyStoreMBean) GetRecentReadLatencyMicros() float64 {\n\tjret, err := jbobject.CallDouble(\"getRecentReadLatencyMicros\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn jret\n}", "title": "" }, { "docid": "10c0366b5fe2e9ca3eb6df2963ca5eaa", "score": "0.5086623", "text": "func CalcDateMicro(year, month, day int) string {\n\treturn CalcDate(year, month, day, LayoutMicro)\n}", "title": "" }, { "docid": "d321bdeaac0d8674054dfd253bb8cc2f", "score": "0.50863606", "text": "func UnixMilli(t time.Time) int64 {\n\treturn t.Unix()*1e3 + int64(t.Nanosecond())/1e6\n}", "title": "" }, { "docid": "86c8d327ea7d98b443e5f6ec69936ff1", "score": "0.50677836", "text": "func (u Unit) TimeScale() uint8 {\n\treturn uint8((u >> 12) & 0xF)\n}", "title": "" }, { "docid": "3b5b47a1623ab45a7e6e49c26cc74a06", "score": "0.5063097", "text": "func GetTime() int64 {\r\n\treturn time.Now().UnixNano() / int64(time.Millisecond)\r\n}", "title": "" }, { "docid": "b2c52799b49c11decadfc2358d2da7b5", "score": "0.5062196", "text": "func GetSeconds() float64 {\n\treturn perfOffset + float64(C.SDL_GetPerformanceCounter())*perfUnit\n}", "title": "" }, { "docid": "a5b1b2e7455da381d43b3a6c3ff18fa9", "score": "0.5052562", "text": "func (zd DurationMicrosecond) ToDuration() time.Duration {\n\treturn time.Duration(zd)\n}", "title": "" }, { "docid": "20f440c506cf4bdf3b9052d55d4fe1ca", "score": "0.5052532", "text": "func TimeFromUnixMillisecond(unixMs int64) time.Time {\n\tnano := unixMs * 1e6\n\treturn time.Unix(0, nano)\n}", "title": "" }, { "docid": "ee909f0744a7f1ba44f9c03446dec793", "score": "0.5052502", "text": "func UTCTimeMilliseconds() int64 {\n\treturn time.Now().UTC().UnixNano() / int64(time.Millisecond)\n}", "title": "" }, { "docid": "7a9de012b7ce452dd3ee0d97216886f0", "score": "0.5049106", "text": "func (m *pipeline) UpdateTimeInMicros() int64 {\n\treturn m.updateTimeInMicrosField\n}", "title": "" }, { "docid": "52c0ad11939450eeab4a15172ee5285f", "score": "0.5047427", "text": "func Test_byteToTime(t *testing.T) {\n\ttimeb := []byte{63, 155, 21, 96, 0, 0, 0, 0, 52, 156, 191, 42, 0, 0, 0, 0}\n\tres, err := byteToTime(timeb)\n\trequire.Nil(t, err)\n\n\trequire.Equal(t, int64(1612028735717200436), res.UnixNano())\n}", "title": "" }, { "docid": "22eb7d3bf93a8e40996f7760b6e281ea", "score": "0.50413424", "text": "func (t MysqlTime) Second() int {\n\treturn int(t.second)\n}", "title": "" }, { "docid": "ab8303c796f44ce8219adfbc935c068c", "score": "0.50207365", "text": "func (m *pipeline) CreateTimeInMicros() int64 {\n\treturn m.createTimeInMicrosField\n}", "title": "" }, { "docid": "39ac8fe18f35528d370a10f8d76ccfb4", "score": "0.50166464", "text": "func UnixMs(t time.Time) int64 {\n\treturn t.Unix() + int64(t.Nanosecond())/int64(time.Millisecond)\n}", "title": "" } ]
d655649686b13154bf02c7152828a0f9
CreateStrategyWithChan invokes the cloudcallcenter.CreateStrategy API asynchronously api document: asynchronous document:
[ { "docid": "8dde7f278908d0ce88399091436c3a19", "score": "0.7737658", "text": "func (client *Client) CreateStrategyWithChan(request *CreateStrategyRequest) (<-chan *CreateStrategyResponse, <-chan error) {\n\tresponseChan := make(chan *CreateStrategyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateStrategy(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" } ]
[ { "docid": "23b7f86560877ad0a5abccd97f32ed4b", "score": "0.7403349", "text": "func (client *Client) CreateStrategyWithCallback(request *CreateStrategyRequest, callback func(response *CreateStrategyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateStrategyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateStrategy(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "f1e6c30399524774f05bd7c803c8c9d6", "score": "0.6406623", "text": "func (client *Client) CreateStrategy(request *CreateStrategyRequest) (response *CreateStrategyResponse, err error) {\n\tresponse = CreateCreateStrategyResponse()\n\terr = client.DoAction(request, response)\n\treturn\n}", "title": "" }, { "docid": "7a4a18aef8fe34403c4d09d52e76fc70", "score": "0.59619623", "text": "func (i *Inviter) CreateStrategy(strategyName string) (Strategy, error) {\n\treturn newStrategy(strategyName, i.logger)\n}", "title": "" }, { "docid": "d96b3a9a2b8f373933ebba9766f03cb3", "score": "0.56782687", "text": "func CreateCreateStrategyRequest() (request *CreateStrategyRequest) {\n\trequest = &CreateStrategyRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"CloudCallCenter\", \"2017-07-05\", \"CreateStrategy\", \"\", \"\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "a24c9b751bf3371a26c11b052969e901", "score": "0.5396702", "text": "func (client *Client) CreateDataFlowWithChan(request *CreateDataFlowRequest) (<-chan *CreateDataFlowResponse, <-chan error) {\n\tresponseChan := make(chan *CreateDataFlowResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateDataFlow(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "734a3b6b8add0ca5fdbe5394ddc897a6", "score": "0.536349", "text": "func Create(options Options) apply.Strategy {\n\treturn createDelegatingStrategy(options)\n}", "title": "" }, { "docid": "0612012b12a4fce14ae99cb51197717c", "score": "0.53345174", "text": "func Create(orderOrgName, orderOrgUser, orderURL, orgName, orgUser, channelID, channelConfigPath string, configBytes []byte,\n\tsdkOpts ...fabsdk.Option) (txID string, err error) {\n\t// Resource management client is responsible for managing channels (create/update channel)\n\t// Supply user that has privileges to create channel (in this case orderer admin)\n\tresMgmtClient, sdk, err := resMgmtOrdererClient(orderOrgName, orderOrgUser, configBytes, sdkOpts...)\n\tif err != nil {\n\t\tgnomon.Log().Error(\"Create\", gnomon.Log().Err(err))\n\t\treturn \"\", err\n\t}\n\tdefer sdk.Close()\n\treturn createChannel(orderURL, orgName, orgUser, channelID, channelConfigPath, sdk, resMgmtClient)\n}", "title": "" }, { "docid": "e1ca46a27807fcfe61221e488e9860ac", "score": "0.53236103", "text": "func (client *Client) CreateElasticPlanWithChan(request *CreateElasticPlanRequest) (<-chan *CreateElasticPlanResponse, <-chan error) {\n\tresponseChan := make(chan *CreateElasticPlanResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateElasticPlan(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "88152174498e94c4492f7292df85ed25", "score": "0.53197324", "text": "func (client *Client) CreateProduceForPartnerWithChan(request *CreateProduceForPartnerRequest) (<-chan *CreateProduceForPartnerResponse, <-chan error) {\n\tresponseChan := make(chan *CreateProduceForPartnerResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateProduceForPartner(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "1663ef06f67416df6741ad3c1ba8253e", "score": "0.527349", "text": "func (client *Client) CreateForwardingRulesWithChan(request *CreateForwardingRulesRequest) (<-chan *CreateForwardingRulesResponse, <-chan error) {\n\tresponseChan := make(chan *CreateForwardingRulesResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateForwardingRules(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "d65dee2e624eb3122c6357fe405e601d", "score": "0.5269941", "text": "func (client *Client) CreateLoadBalancerWithChan(request *CreateLoadBalancerRequest) (<-chan *CreateLoadBalancerResponse, <-chan error) {\n\tresponseChan := make(chan *CreateLoadBalancerResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateLoadBalancer(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "43ece7535821ea26f1626bff8243ac07", "score": "0.52556455", "text": "func (client *Client) CreateElasticPlanWithCallback(request *CreateElasticPlanRequest, callback func(response *CreateElasticPlanResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateElasticPlanResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateElasticPlan(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cb6f4030c8418aa3a31b515f074cfcbf", "score": "0.52446485", "text": "func (client *Client) CreateDBClusterWithChan(request *CreateDBClusterRequest) (<-chan *CreateDBClusterResponse, <-chan error) {\n\tresponseChan := make(chan *CreateDBClusterResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateDBCluster(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "a111ee5222ec81066b5e7bfd89efea42", "score": "0.5206741", "text": "func (client *Client) CreateIndexFaceJobWithChan(request *CreateIndexFaceJobRequest) (<-chan *CreateIndexFaceJobResponse, <-chan error) {\n\tresponseChan := make(chan *CreateIndexFaceJobResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateIndexFaceJob(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "3ef10a09afc2350338cfd326c8405786", "score": "0.5206277", "text": "func (a *PublishSubscribeApiService) CreateChannelExecute(r ApiCreateChannelRequest) (SingleChannel, *_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 SingleChannel\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.Ctx, \"PublishSubscribeApiService.CreateChannel\")\n\tif localBasePath == \"/\" {\n\t localBasePath = \"\"\n\t}\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/v2/channels\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := _neturl.Values{}\n\tlocalVarFormParams := _neturl.Values{}\n\tif r.P_channelProposal == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"channelProposal 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.P_channelProposal\n\treq, err := a.client.prepareRequest(r.Ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "e341ef43b94529c14c0899655d66e06e", "score": "0.51873505", "text": "func (client *Client) CreateWirelessCloudConnectorWithChan(request *CreateWirelessCloudConnectorRequest) (<-chan *CreateWirelessCloudConnectorResponse, <-chan error) {\n\tresponseChan := make(chan *CreateWirelessCloudConnectorResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateWirelessCloudConnector(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "e20fda02337351741363c0e44e2e8e40", "score": "0.5178119", "text": "func (client *Client) CreateFileSystemWithChan(request *CreateFileSystemRequest) (<-chan *CreateFileSystemResponse, <-chan error) {\n\tresponseChan := make(chan *CreateFileSystemResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateFileSystem(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "be6b830a418cbcce3886706228ec684f", "score": "0.51722294", "text": "func (client *Client) DescribeStrategyWithChan(request *DescribeStrategyRequest) (<-chan *DescribeStrategyResponse, <-chan error) {\n\tresponseChan := make(chan *DescribeStrategyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.DescribeStrategy(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "3116c0cd54f17d1daaab7ef223f47925", "score": "0.51261073", "text": "func NewStrategy(ctrl Controller, options ...StrategyOptions) (*Strategy, error) {\n\tif ctrl == nil {\n\t\treturn nil, errors.Wrap(ErrInvalidParameter, \"controller is absent\")\n\t}\n\tstrategy := &Strategy{\n\t\tctrl: ctrl,\n\t\tratio: 0.8,\n\t\tcloser: run.NewCloser(1),\n\t}\n\tfor _, opt := range options {\n\t\topt(strategy)\n\t}\n\tif strategy.optionsErr != nil {\n\t\treturn nil, strategy.optionsErr\n\t}\n\tif strategy.logger == nil {\n\t\tstrategy.logger = logger.GetLogger(\"bucket-strategy\")\n\t}\n\tif err := strategy.resetCurrent(); err != nil {\n\t\treturn nil, err\n\t}\n\treturn strategy, nil\n}", "title": "" }, { "docid": "7b2b0ca841528e470a393725d1b49206", "score": "0.5117709", "text": "func (client *Client) CreateDataFlowWithCallback(request *CreateDataFlowRequest, callback func(response *CreateDataFlowResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateDataFlowResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateDataFlow(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "cf21d2909afe308d8d3ee44a99c4190a", "score": "0.51129085", "text": "func (client *Client) CreateProduceForPartnerWithCallback(request *CreateProduceForPartnerRequest, callback func(response *CreateProduceForPartnerResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateProduceForPartnerResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateProduceForPartner(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "baad9e2eb4c0f5ff98defea85baa15db", "score": "0.5090373", "text": "func (client *Client) CreateBizTypeWithChan(request *CreateBizTypeRequest) (<-chan *CreateBizTypeResponse, <-chan error) {\n\tresponseChan := make(chan *CreateBizTypeResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateBizType(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "b2bf7a77a6ffc6270b19c57345487151", "score": "0.50499636", "text": "func (src *Chain) CreateChannel(dst *Chain, ordered bool, to time.Duration, cmd *cobra.Command) error {\n\tvar order chanState.Order\n\tif ordered {\n\t\torder = chanState.ORDERED\n\t} else {\n\t\torder = chanState.UNORDERED\n\t}\n\n\tticker := time.NewTicker(to)\n\tfor ; true; <-ticker.C {\n\t\tchanSteps, err := src.CreateChannelStep(dst, order)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !chanSteps.Ready() {\n\t\t\tbreak\n\t\t}\n\n\t\tif err = chanSteps.Send(src, dst, cmd); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "79c2a83a94abafad2384d5f1d4272365", "score": "0.5036651", "text": "func NewStrategy(inputs, outputs uint, guide Guide, minLevel, maxLevel uint,\n\tabsoluteError, relativeError float64) *Strategy {\n\n\treturn &Strategy{\n\t\tni: inputs,\n\t\tno: outputs,\n\n\t\tguide: guide,\n\n\t\tlmin: minLevel,\n\t\tlmax: maxLevel,\n\n\t\tactive: internal.NewActive(inputs),\n\t\tthreshold: internal.NewThreshold(outputs, absoluteError, relativeError),\n\t}\n}", "title": "" }, { "docid": "2bb592d082cfdecad9c0a8168e40eba1", "score": "0.50209343", "text": "func (client *Client) CreateEvaluationWithChan(request *CreateEvaluationRequest) (<-chan *CreateEvaluationResponse, <-chan error) {\n\tresponseChan := make(chan *CreateEvaluationResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateEvaluation(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "eb69493727f7ad29ac382b2cbbbf5671", "score": "0.5020382", "text": "func (client *Client) CreateSceneDefensePolicyWithChan(request *CreateSceneDefensePolicyRequest) (<-chan *CreateSceneDefensePolicyResponse, <-chan error) {\n\tresponseChan := make(chan *CreateSceneDefensePolicyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateSceneDefensePolicy(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "cfd4c69dd0597ef6c36765904af1a2fc", "score": "0.50202227", "text": "func (setups OrgSetupArray) CreateChannel(w http.ResponseWriter, r *http.Request) {\n\tif err := r.ParseForm(); err != nil {\n\t\tfmt.Fprintf(w, \"ParseForm() err: %v\", err)\n\t\treturn\n\t}\n\torgName := r.FormValue(\"orgname\")\n\tchannelID := r.FormValue(\"channelid\")\n\tchannelConfigPath := r.FormValue(\"configpath\")\n\tcurrentSetup := sdkconnector.LoadSetup(orgName, setups)\n\tif currentSetup == nil {\n\t\thttp.Error(w, \"Organization '\"+orgName+\"' does not exist!\", 500)\n\t}\n\terr := sdkconnector.CreateChannel(currentSetup, channelID, channelConfigPath)\n\tif err != nil {\n\t\tfmt.Fprintf(w, err.Error())\n\t\treturn\n\t}\n\tfmt.Fprintf(w, \"Successfully created channel '%s'\", channelID)\n}", "title": "" }, { "docid": "7cac91c47e13bb6b5f31eab0708b0d51", "score": "0.50023496", "text": "func (routingTable *RoutingTable) createTask(idType int, responseChannel chan []Contact, contactRequested *Contact) *Task{\n\tvar task Task = Task{idType, responseChannel, contactRequested}\n\troutingTable.channelTasks <- task\n\treturn &task\n}", "title": "" }, { "docid": "e5ec04b77a93661193b1212fd8f2ff65", "score": "0.49921775", "text": "func (client *Client) CreateDBInstancePlanWithChan(request *CreateDBInstancePlanRequest) (<-chan *CreateDBInstancePlanResponse, <-chan error) {\n\tresponseChan := make(chan *CreateDBInstancePlanResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateDBInstancePlan(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "21fba3640a0faf368bb1a6e13ae27032", "score": "0.49617043", "text": "func (c *Resource) CreateChannel(request fab.CreateChannelRequest) (fab.TransactionID, error) {\n\thaveEnvelope := false\n\tif request.Envelope != nil {\n\t\tlogger.Debug(\"createChannel - have envelope\")\n\t\thaveEnvelope = true\n\t}\n\n\tif !haveEnvelope && request.TxnID.ID == \"\" {\n\t\ttxnID, err := txn.NewID(c.clientContext)\n\t\tif err != nil {\n\t\t\treturn txnID, err\n\t\t}\n\t\trequest.TxnID = txnID\n\t}\n\n\treturn request.TxnID, c.createOrUpdateChannel(request, haveEnvelope)\n}", "title": "" }, { "docid": "26126e920c7d59648c14d8bac2e75865", "score": "0.49339554", "text": "func createTokenChan(w http.ResponseWriter, r *http.Request, thisChan chan Token, chanDone chan bool, ChanID, recType string) {\n\tif SYS_STATELESS_SERVER == true {\n\t\treturn\n\t}\n\tisDesktopClient := false\n\tFL_DESKTOP := checkDesktop(w,r)\n\tif FL_DESKTOP == true {\n\t\tisDesktopClient = true\n\t}\n uid := \"\"\n tok := \"\"\n //c := appengine.NewContext(r)\n c, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n defer cancel()\n //u := user.Current(c)\n if r.Header.Get(\"X-Goog-Authenticated-User-Email\") != \"\" && ChanID == \"\" {\n\t//ChanID = uid\n\t_, uid := checkSession(w,r)\n\tChanID = uid\n }\n //if uid == \"\" {\n if r.Header.Get(\"X-Goog-Authenticated-User-Email\") == \"\" && ChanID == \"\" {\n\tipAdd := getIpAdd(w,r)\n\tgeoStr := getGeoString(w,r)\n\tif geoStr == \"\" {\n\t\tuid = fmt.Sprintf(\"guest-%v@%v\", randSeq(6), ipAdd)\n\t} else {\n\t\tuid = fmt.Sprintf(\"guest-%v@%v\", geoStr, ipAdd)\n\t}\n\tChanID = uid\n\t\n }\n //use existing channel id\n if uid == \"\" {\n \t uid = ChanID\n }\n var e Channelstore\n FL_CHAN_EXIST := true\n //D0086\n datastoreClient := createClientDS()\n //log.Printf(\"datastoreClient.Get() [5694]\")\n if err := datastoreClient.Get(c, getKeyChannel(c,ChanID), &e); err != nil {\n\t FL_CHAN_EXIST = false\n } else {\n\tif e.DateCreated == \"\" {\n\t\t//if no date found\n\t\te.DateCreated = \"20150101000000\"\n\t}\n \ttimeFormat := \"20060102150405\"\n\tthen, err := time.Parse(timeFormat, e.DateCreated)\n\tif err != nil {\n\t\t panic(err)\n\t\t//return\n\t}\n\tduration := time.Since(then)\n\tif duration.Hours() > CHAN_HOURS_EXPR {\n\t\tIS_ACTIVE := getActiveStatus(w,r,e.ChanID)\n\t\tif IS_ACTIVE == \"N\" {\n\t\t\t//delete old channel here\n\t\t\tFL_CHAN_EXIST = false\n\t\t\tdatastoreClient.Delete(c, getKeyChannel(c,e.ChanID))\n\t\t}\n\t}\n }\n if FL_CHAN_EXIST == false {\n \n\t\ttokNew := newChannelPut(w,r,ChanID,uid,isDesktopClient,recType)\n\t\ttok = tokNew\n } else {\n\t\ttok = e.TokenID\n }\n //return uid, tok\n t := Token{\n\t User: uid,\n\t Token: tok,\n }\n thisChan <- t\n chanDone <- true\n}", "title": "" }, { "docid": "40a10d7bdaedf85988fea64b1350aa9c", "score": "0.4923143", "text": "func (client *Client) CreateIndexFaceJobWithCallback(request *CreateIndexFaceJobRequest, callback func(response *CreateIndexFaceJobResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateIndexFaceJobResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateIndexFaceJob(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "530f06839529de79747317bc442eb576", "score": "0.4917338", "text": "func (client *Client) CreateAntChainAccountWithKeyPairAutoCreationWithChan(request *CreateAntChainAccountWithKeyPairAutoCreationRequest) (<-chan *CreateAntChainAccountWithKeyPairAutoCreationResponse, <-chan error) {\n\tresponseChan := make(chan *CreateAntChainAccountWithKeyPairAutoCreationResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateAntChainAccountWithKeyPairAutoCreation(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "1398bfd8352e1bd208cfdd72bac7a6b6", "score": "0.49084958", "text": "func (client *Client) CreateTrafficMirrorSessionWithChan(request *CreateTrafficMirrorSessionRequest) (<-chan *CreateTrafficMirrorSessionResponse, <-chan error) {\n\tresponseChan := make(chan *CreateTrafficMirrorSessionResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateTrafficMirrorSession(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "bc8e983817539f051014ca1c3fe51983", "score": "0.48892352", "text": "func CreateCreateStrategyResponse() (response *CreateStrategyResponse) {\n\tresponse = &CreateStrategyResponse{\n\t\tBaseResponse: &responses.BaseResponse{},\n\t}\n\treturn\n}", "title": "" }, { "docid": "a87b861e20e81d1dedce834d92501a47", "score": "0.4887918", "text": "func CreateChannel(sdk *fabsdk.FabricSDK, orderUser, ordererOrgName string, req resmgmt.SaveChannelRequest) (bool, error) {\n\n\t//prepare context\n\tclientContext := sdk.Context(fabsdk.WithUser(orderUser), fabsdk.WithOrg(ordererOrgName))\n\n\t// Channel management client is responsible for managing channels (create/update)\n\tresMgmtClient, err := resmgmt.New(clientContext)\n\tif err != nil {\n\t\treturn false, errors.WithMessage(err, \"Failed to create new channel management client\")\n\t}\n\n\t// Create channel (or update if it already exists)\n\tif _, err = resMgmtClient.SaveChannel(req, resmgmt.WithRetry(retry.DefaultResMgmtOpts)); err != nil {\n\t\treturn false, err\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "915167afc7b8414520178f9ee6516631", "score": "0.48801848", "text": "func (client *Client) DescribeStrategyWithCallback(request *DescribeStrategyRequest, callback func(response *DescribeStrategyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *DescribeStrategyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.DescribeStrategy(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3385897968afa4219651851f0c7e46d6", "score": "0.48757082", "text": "func (client *Client) CreateDBInstancePlanWithCallback(request *CreateDBInstancePlanRequest, callback func(response *CreateDBInstancePlanResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateDBInstancePlanResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateDBInstancePlan(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "17c6db73072c0aff1c77d8e969f2f8aa", "score": "0.4873448", "text": "func (a *PublishSubscribeApiService) CreateChannel(Ctx _context.Context) ApiCreateChannelRequest {\n\treturn ApiCreateChannelRequest{\n\t\tApiService: a,\n\t\tCtx: Ctx,\n\t}\n}", "title": "" }, { "docid": "c31c8b70ac8194ec4d004798fab51241", "score": "0.48710194", "text": "func (client *Client) CreateIpControlWithChan(request *CreateIpControlRequest) (<-chan *CreateIpControlResponse, <-chan error) {\n\tresponseChan := make(chan *CreateIpControlResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateIpControl(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "e50a7180e26521043d387d6f7df5d665", "score": "0.48634577", "text": "func (client *Client) CreateForwardingRulesWithCallback(request *CreateForwardingRulesRequest, callback func(response *CreateForwardingRulesResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateForwardingRulesResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateForwardingRules(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c504252bf16b41b31f7a50073b187600", "score": "0.48580828", "text": "func (k *KeyPairsClient) Create(ctx context.Context, orgID *identity.ID, output ProgressFunc) error {\n\treturn k.worker(ctx, \"generate\", orgID, output)\n}", "title": "" }, { "docid": "f574f2b8a4e2346724a76085996a8c2f", "score": "0.48576868", "text": "func (client *Client) CreateDedicatedUserClusterWithChan(request *CreateDedicatedUserClusterRequest) (<-chan *CreateDedicatedUserClusterResponse, <-chan error) {\n\tresponseChan := make(chan *CreateDedicatedUserClusterResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateDedicatedUserCluster(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "66b970a0741050beb045e75262bcca1a", "score": "0.4834649", "text": "func (client *Client) CreateDBClusterWithCallback(request *CreateDBClusterRequest, callback func(response *CreateDBClusterResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateDBClusterResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateDBCluster(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "db479edffd7b7ea3bd5706f8a9aabcbe", "score": "0.48219123", "text": "func (f *InfraProvider) CreateChannelTransactor(reqCtx reqContext.Context, cfg fab.ChannelCfg) (fab.Transactor, error) {\n\treturn channelImpl.NewTransactor(reqCtx, cfg)\n}", "title": "" }, { "docid": "0b185a15943dd01461bac89b9274e914", "score": "0.48106274", "text": "func (client *Client) CreateWirelessCloudConnectorWithCallback(request *CreateWirelessCloudConnectorRequest, callback func(response *CreateWirelessCloudConnectorResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateWirelessCloudConnectorResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateWirelessCloudConnector(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3fcc47832ca1418f3746df13338d9944", "score": "0.48046306", "text": "func CreateChannelArtefacts(spec NetworkSpec) error {\n\n\tif err := generateConfigTxExecScript(spec); err != nil {\n\t\treturn err\n\t}\n\tif err := generateConfigTxSpec(spec); err != nil {\n\t\treturn err\n\t}\n\tif err := execConfigTxExecScript(spec); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "932e7abf7e094b6063901688275951d0", "score": "0.47991696", "text": "func createChannel(w http.ResponseWriter, r *http.Request) {\n\t_, uid := checkSession(w,r)\n\tisDesktopClient := false\n\tFL_DESKTOP := checkDesktop(w,r)\n\tif FL_DESKTOP == true {\n\t\tisDesktopClient = true\n\t}\n\tif SYS_STATELESS_SERVER == true {\t\n\t\tChanID := fmt.Sprintf(\"%v\", r.FormValue(\"UID\"))\n\t\ttok := newChannelPut(w,r,ChanID,uid,isDesktopClient,\"\")\n\t\tdata,_ := json.Marshal(tok)\n\t\tw.Write(data)\n\t\treturn\t\t\n\t}\n\t//c := appengine.NewContext(r)\n c, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n defer cancel()\n\t\n\tif FL_PROC_OK := countryChecker(w,r); FL_PROC_OK != true {return}\n\t\n\tfunc_code := r.FormValue(\"func_code\")\n\tif func_code != \"NEW_INSTALL\" {\n\t\tcheckReferrer(w,r)\n\t}\n \n ChanID := fmt.Sprintf(\"%v\", r.FormValue(\"user\"))\n \n if r.Header.Get(\"X-Goog-Authenticated-User-Email\") == \"\" && uid == \"\" {\n\tuid = randSeq(6)\n }\n \n if ChanID == \"\" {\n\tChanID = uid\n }\n \n var e Channelstore\n FL_CHAN_EXIST := true\n tok := \"\"\n //D0086\n datastoreClient := createClientDS()\n //log.Printf(\"datastoreClient.Get() [5539]\")\n if err := datastoreClient.Get(c, getKeyChannel(c,ChanID), &e); err != nil {\n\t\tFL_CHAN_EXIST = false\n } else {\n\t\ttimeFormat := \"20060102150405\"\n\t\tthen, err := time.Parse(timeFormat, e.DateCreated)\n\t\tif err != nil {\n\t\t\t panic(err)\n\t\t\t//return\n\t\t}\n\t\tduration := time.Since(then)\n\t\tif duration.Hours() > CHAN_HOURS_EXPR {\n\t\t\tIS_ACTIVE := getActiveStatus(w,r,e.ChanID)\n\t\t\tif IS_ACTIVE == \"N\" {\n\t\t\t\t//delete old channel here\n\t\t\t\tFL_CHAN_EXIST = false\n\t\t\t\tdatastoreClient.Delete(c, getKeyChannel(c,e.ChanID))\n\t\t\t}\n\t\t}\n }\n \n if FL_CHAN_EXIST == false {\n\t\t\n\t\ttokNew := newChannelPut(w,r,ChanID,uid,isDesktopClient,\"\")\n\t\ttok = tokNew\n\t} else {\n\t\ttok = e.TokenID\n\t}\n \n\tdata,_ := json.Marshal(tok)\n\tw.Write(data)\n\treturn\n}", "title": "" }, { "docid": "82fb9ca15052388f158d33b9943f6c17", "score": "0.47944647", "text": "func CreateDescribeStrategyRequest() (request *DescribeStrategyRequest) {\n\trequest = &DescribeStrategyRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Sas\", \"2018-12-03\", \"DescribeStrategy\", \"sas\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "8a191fc13d0f477ad05a1b8d3cc5d011", "score": "0.47590902", "text": "func (s *Server) CreateChannel(ctx context.Context, req *pb.CreateChannelRequest) (*pb.ChannelInfo, error) {\n\ttx, err := req.GetTx().ToCore()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !tx.Verify() {\n\t\treturn nil, errors.New(\"The tx is not a valid tx\")\n\t}\n\tif tx.GetReceiver().String() != core.CreateChannelContractAddress.String() {\n\t\treturn nil, errors.New(\"The receiver of the tx is not the valid contract address\")\n\t}\n\t_, err = s.cc.CreateChannel(tx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &pb.ChannelInfo{}, nil\n}", "title": "" }, { "docid": "ae21910c5e7027aab2ad8e6686fa24af", "score": "0.47487727", "text": "func (client *Client) CreateUisConnectionWithChan(request *CreateUisConnectionRequest) (<-chan *CreateUisConnectionResponse, <-chan error) {\n\tresponseChan := make(chan *CreateUisConnectionResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateUisConnection(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "3e141e6b4c5253fca0bc7a6809d080f6", "score": "0.4748729", "text": "func (client *Client) CreateEvaluationWithCallback(request *CreateEvaluationRequest, callback func(response *CreateEvaluationResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateEvaluationResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateEvaluation(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "6e0f438dd662d0a93a9e47d34dca3bf3", "score": "0.4748711", "text": "func constructStrategy(params []string) (throttling.Strategy, error) {\n\tstrategyType := params[0]\n\timplArgs := params[1:]\n\tif strategyType == \"dynamic\" {\n\t\tif len(implArgs) != 7 {\n\t\t\treturn nil, fmt.Errorf(\"invalid number of args for strategy type %v. Expected %d, Got %d\", strategyType, 2, len(implArgs))\n\t\t}\n\t\tminDelay, err := time.ParseDuration(implArgs[0])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, could not parse minDelay=%q: %v\", strategyType, implArgs[0], err)\n\t\t}\n\t\tmaxDelay, err := time.ParseDuration(implArgs[1])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, could not parse maxDelay=%q: %v\", strategyType, implArgs[1], err)\n\t\t}\n\t\terrorsBeforeIncreasingDelay, err := strconv.Atoi(implArgs[2])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, expected errorsBeforeIncreasingDelay=%q to be an int: %v\", strategyType, implArgs[2], err)\n\t\t}\n\t\tsuccessesBeforeDecreasingDelay, err := strconv.Atoi(implArgs[3])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, expected successesBeforeDecreasingDelay=%q to be an int: %v\", strategyType, implArgs[3], err)\n\t\t}\n\t\tsuccessesBeforeResettingDelay, err := strconv.Atoi(implArgs[4])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, expected successesBeforeResettingDelay=%q to be an int: %v\", strategyType, implArgs[4], err)\n\t\t}\n\t\tnoRequestsTimeoutBeforeDecreasingDelay, err := time.ParseDuration(implArgs[5])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, could not parse noRequestsTimeoutBeforeDecreasingDelay=%q: %v\", strategyType, implArgs[5], err)\n\t\t}\n\t\tnoRequestsTimeoutBeforeResettingDelay, err := time.ParseDuration(implArgs[6])\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid argument for strategy type %v, could not parse noRequestsTimeoutBeforeResettingDelay=%q: %v\", strategyType, implArgs[6], err)\n\t\t}\n\t\treturn throttling.NewDynamicStrategy(minDelay, maxDelay, errorsBeforeIncreasingDelay, successesBeforeDecreasingDelay, successesBeforeResettingDelay, noRequestsTimeoutBeforeDecreasingDelay, noRequestsTimeoutBeforeResettingDelay, clock.RealClock{})\n\t}\n\treturn nil, fmt.Errorf(\"invalid strategy type provided: %v\", strategyType)\n}", "title": "" }, { "docid": "33cce5569d4687a3f84d440afb4b97bd", "score": "0.4744284", "text": "func NewChannel(name string, p *v1alpha1.Parallel) (*unstructured.Unstructured, error) {\n\t// Set the name of the resource we're creating as well as the namespace, etc.\n\ttemplate := eventingduck.ChannelTemplateSpecInternal{\n\t\tTypeMeta: metav1.TypeMeta{\n\t\t\tKind: p.Spec.ChannelTemplate.Kind,\n\t\t\tAPIVersion: p.Spec.ChannelTemplate.APIVersion,\n\t\t},\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tOwnerReferences: []metav1.OwnerReference{\n\t\t\t\t*kmeta.NewControllerRef(p),\n\t\t\t},\n\t\t\tName: name,\n\t\t\tNamespace: p.Namespace,\n\t\t},\n\t\tSpec: p.Spec.ChannelTemplate.Spec,\n\t}\n\traw, err := json.Marshal(template)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tu := &unstructured.Unstructured{}\n\terr = json.Unmarshal(raw, u)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn u, nil\n}", "title": "" }, { "docid": "6b016fbe966fd65476c2b019321d8234", "score": "0.47299436", "text": "func (client *Client) CreateADConnectorOfficeSiteWithChan(request *CreateADConnectorOfficeSiteRequest) (<-chan *CreateADConnectorOfficeSiteResponse, <-chan error) {\n\tresponseChan := make(chan *CreateADConnectorOfficeSiteResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateADConnectorOfficeSite(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "fbde6191e1bb33424b69cfcd46703dc1", "score": "0.47063753", "text": "func (client *Client) CreateCertAndKeyWithChan(request *CreateCertAndKeyRequest) (<-chan *CreateCertAndKeyResponse, <-chan error) {\n\tresponseChan := make(chan *CreateCertAndKeyResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateCertAndKey(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "61428b2122352c2dcf9e0944d2d6c938", "score": "0.46947178", "text": "func (client *Client) CreateLoadBalancerWithCallback(request *CreateLoadBalancerRequest, callback func(response *CreateLoadBalancerResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateLoadBalancerResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateLoadBalancer(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "53e025da077fe49b81c579caf9658bbb", "score": "0.46676686", "text": "func CreateKafkaWorker(statuschan chan string, filename string) KafkaWorker {\n // Create, and return the worker.\n worker := Worker{\n StatusChan: statuschan,\n NumRetries: 2,\n messages: []string{},\n Filename: filename,\n }\n kafka_worker := KafkaWorker{\n Worker: worker,\n Producer: Getkafkaproducer(),\n Count: 0,\n QuitChan: make(chan bool),\n }\n return kafka_worker\n}", "title": "" }, { "docid": "739ce6bd9514a94c4f6b75cb7ed4922f", "score": "0.4667319", "text": "func NewWithStrategy(strat Strategy) (*Crocker, error) {\n\thelper, err := strat.Helper()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Crocker{\n\t\tclient.NewShellProgramFunc(helper),\n\t}, nil\n}", "title": "" }, { "docid": "dbbacc85f14cc275ccda679ee3416c7f", "score": "0.4641535", "text": "func (client *Client) CreateTrafficMirrorSessionWithCallback(request *CreateTrafficMirrorSessionRequest, callback func(response *CreateTrafficMirrorSessionResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateTrafficMirrorSessionResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateTrafficMirrorSession(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "45d6fd269ed67a356bd6b0fcc3d5eb05", "score": "0.46292925", "text": "func (client *Client) CreateRepoWithChan(request *CreateRepoRequest) (<-chan *CreateRepoResponse, <-chan error) {\n\tresponseChan := make(chan *CreateRepoResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateRepo(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "b2febda6d2819de9aceaaf8b742e413b", "score": "0.46287435", "text": "func (s *Accounts) CreateFunc(rw http.ResponseWriter, r *http.Request) {\n\t// Decide whether to serve sync or async, default async\n\tsync := r.Header.Get(SyncHeader) != \"\"\n\tjob, acc, err := s.service.Create(r.Context(), sync)\n\tvar res interface{}\n\tif sync {\n\t\tres = acc\n\t} else {\n\t\tres = job\n\t}\n\n\tif err != nil {\n\t\thandleError(rw, s.log, err)\n\t\treturn\n\t}\n\n\thandleJsonResponse(rw, http.StatusCreated, res)\n}", "title": "" }, { "docid": "882755d4db4c8b0efa26563566a00f16", "score": "0.46261677", "text": "func (client *Client) CreateRepoWithCallback(request *CreateRepoRequest, callback func(response *CreateRepoResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateRepoResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateRepo(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "036725b19e502c17df6d67767b55f8d1", "score": "0.4624977", "text": "func (client *Client) CreateAntChainAccountWithKeyPairAutoCreationWithCallback(request *CreateAntChainAccountWithKeyPairAutoCreationRequest, callback func(response *CreateAntChainAccountWithKeyPairAutoCreationResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateAntChainAccountWithKeyPairAutoCreationResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateAntChainAccountWithKeyPairAutoCreation(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0d5f7dfa95d2bdc0d14e00692e6dbbbc", "score": "0.46242186", "text": "func generateChannel(channelType string, guildID primitive.ObjectID) interface{} {\n\tvar channelVals channel\n\n\tif channelType == \"post\" {\n\t\tchannelVals.Name = \"主频道\"\n\t\tchannelVals.Type = \"post\"\n\t\tchannelVals.GuildID = guildID\n\t}\n\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\n\tchannelCollection := ConnectDB(\"channel\")\n\n\tchannelRes, err := channelCollection.InsertOne(ctx, channelVals)\n\thandleError(err)\n\n\treturn channelRes.InsertedID\n}", "title": "" }, { "docid": "67130861b8c5e990a88ca9c9efc8d8c3", "score": "0.4621862", "text": "func (client *Client) ChannelCreate(ctx context.Context, draft *ChannelDraft, opts ...RequestOption) (result *Channel, err error) {\n\tparams := url.Values{}\n\tfor _, opt := range opts {\n\t\topt(&params)\n\t}\n\n\tendpoint := \"channels\"\n\terr = client.create(ctx, endpoint, params, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "605b5605e6eac7d33e5c065761c21bd6", "score": "0.46199974", "text": "func (client *Client) CreateCertificateForPackageRequestWithChan(request *CreateCertificateForPackageRequestRequest) (<-chan *CreateCertificateForPackageRequestResponse, <-chan error) {\n\tresponseChan := make(chan *CreateCertificateForPackageRequestResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateCertificateForPackageRequest(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "80f41a703be620d7056276dc8881877f", "score": "0.46135366", "text": "func (api *Api) createChannel(w http.ResponseWriter, r *http.Request) {\n\tvar ch model.Channel\n\t// Gets JSON object from request body.\n\tdecoder := json.NewDecoder(r.Body)\n\tif err := decoder.Decode(&ch); err != nil {\n\t\tutils.RespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\n\tdefer r.Body.Close()\n\n\tif err := ch.CreateChannel(d.Database); err != nil {\n\t\tutils.RespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\t// Respond with newly created channel.\n\tutils.RespondWithJSON(w, http.StatusCreated, ch)\n}", "title": "" }, { "docid": "8dd492648afc4044c9a1f097dd299d09", "score": "0.46111834", "text": "func (client *Client) CreateDedicatedUserClusterWithCallback(request *CreateDedicatedUserClusterRequest, callback func(response *CreateDedicatedUserClusterResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateDedicatedUserClusterResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateDedicatedUserCluster(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "bb15d346caf60ac998c8f657dc6004ea", "score": "0.4608859", "text": "func (client *Client) CreateAxtCommandWithChan(request *CreateAxtCommandRequest) (<-chan *CreateAxtCommandResponse, <-chan error) {\n\tresponseChan := make(chan *CreateAxtCommandResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateAxtCommand(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "70bcabc80a657237fd8840276768dc4b", "score": "0.46039832", "text": "func (client *Client) CreateFileSystemWithCallback(request *CreateFileSystemRequest, callback func(response *CreateFileSystemResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateFileSystemResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateFileSystem(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "8398c4ffd91b9f31706041933bfe7c6a", "score": "0.4603467", "text": "func (client *Client) CreateExpressCloudConnectionWithChan(request *CreateExpressCloudConnectionRequest) (<-chan *CreateExpressCloudConnectionResponse, <-chan error) {\n\tresponseChan := make(chan *CreateExpressCloudConnectionResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateExpressCloudConnection(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "43dc255d7a29b0fee0355ec0ac437df8", "score": "0.4595879", "text": "func (d *dispatcherChans) ChannelCreate() <-chan *ChannelCreate {\n\treturn d.channelCreateChan\n}", "title": "" }, { "docid": "03d4a82d3016a1ea63ba7f50cd40f9e4", "score": "0.45955008", "text": "func CreateNewUser(ctx context.Context, u *UserInfo) (uint, error) {\n result := make(chan uint)\n errorChan := make(chan error)\n defer close(result)\n defer close(errorChan)\n go func() {\n bkStorageManager.UserStorage.Create(&beStorage.UserEntity{\n ID: 0,\n UserName: u.UserName,\n Password: u.Password,\n }, result, errorChan)\n }()\n select {\n case ret := <-result:\n return ret, nil\n case err := <-errorChan:\n return 0, err\n case <-ctx.Done():\n return 0, ctx.Err()\n }\n}", "title": "" }, { "docid": "e2d3488b91488a4803451130c0f1e362", "score": "0.45910648", "text": "func (s *SmartContract) CreateChannel(ctx contractapi.TransactionContextInterface, channelID string, channelType string, mspIDs []string) error {\n\n\texists, err := s.ChannelExists(ctx, channelID)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the channel %s already exists\", channelID)\n\t}\n\n\tif channelType == \"\" {\n\t\tchannelType = ApplicationChannelType\n\t}\n\tif channelType != SystemChannelType && channelType != OpsChannelType && channelType != ApplicationChannelType {\n\t\treturn fmt.Errorf(\"invalid channel type - expecting %s, %s or %s\", SystemChannelType, OpsChannelType, ApplicationChannelType)\n\t}\n\n\tchannel := &Channel{\n\t\tObjectType: ChannelObjectType,\n\t\tID: channelID,\n\t\tChannelType: channelType,\n\t}\n\n\tif mspIDs != nil {\n\t\tchannel.Organizations = make(map[string]string)\n\n\t\tfor _, mspID := range mspIDs {\n\t\t\tchannel.Organizations[mspID] = \"\"\n\t\t}\n\t}\n\treturn s.putChannel(ctx, channel)\n}", "title": "" }, { "docid": "6df56bb7663112dc14f28f617ffc9632", "score": "0.45908305", "text": "func CreateOrUpdateChannel(client fab.FabricClient, ordererUser ca.User, orgUser ca.User, channel fab.Channel, channelConfig string) error {\n\tlogger.Debugf(\"***** Creating or updating channel: %s *****\\n\", channel.Name())\n\n\tcurrentUser := client.UserContext()\n\tdefer client.SetUserContext(currentUser)\n\n\tclient.SetUserContext(orgUser)\n\n\tconfigTx, err := ioutil.ReadFile(channelConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config file: %v\", err)\n\t}\n\n\tconfig, err := client.ExtractChannelConfig(configTx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error extracting channel config: %v\", err)\n\t}\n\n\tconfigSignature, err := client.SignChannelConfig(config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error signing configuration: %v\", err)\n\t}\n\n\tvar configSignatures []*common.ConfigSignature\n\tconfigSignatures = append(configSignatures, configSignature)\n\n\trequest := fab.CreateChannelRequest{\n\t\tName: channel.Name(),\n\t\tOrderer: channel.Orderers()[0],\n\t\tConfig: config,\n\t\tSignatures: configSignatures,\n\t}\n\n\tclient.SetUserContext(ordererUser)\n\t_, err = client.CreateChannel(request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CreateChannel returned error: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5c2366a5e3f6fd660ed12b0b4fd59bf6", "score": "0.45745134", "text": "func (client *Client) CreateBizTypeWithCallback(request *CreateBizTypeRequest, callback func(response *CreateBizTypeResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateBizTypeResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateBizType(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "e569747546a9eedbe349b7e1b130e55f", "score": "0.4572641", "text": "func (t *TelnetConn) CreateChannel(channelname string) {\n\tt.mutex.Lock()\n\tdefer t.mutex.Unlock()\n\n\tchannels := t.model.GetChannels()\n\n\t// Validate the user input\n\tif _, ok := channels[channelname]; ok {\n\t\tmsg := make([]string, 0)\n\t\tmsg = append(msg, \"error: <channel> already exists\")\n\t\tt.printLinesCallback(msg)\n\t\treturn\n\t}\n\n\t// Tell the model about the new channel\n\tt.model.CreateChannel(channelname)\n}", "title": "" }, { "docid": "f919caedf34104e44b94ab5c1cd236d6", "score": "0.45542005", "text": "func (client *Client) CreateAclRuleWithChan(request *CreateAclRuleRequest) (<-chan *CreateAclRuleResponse, <-chan error) {\n\tresponseChan := make(chan *CreateAclRuleResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateAclRule(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "997b566396dccdfa012ef9b8467c1c05", "score": "0.45491597", "text": "func (svc *ChannelService) CreateChannel(request *CreateChannelRequest) (*Channel, error) {\n\tnextid_request := &NextIDRequest{nil, \"channelids\"}\n\tid, err := svc.SG.IDService.NextID(nextid_request)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = InsertRow(svc.DB, CHANNELS_TABLE,\n\t\t\"Id\", id,\n\t\t\"TeamId\", request.Channel.Team.Id,\n\t\t\"UserId\", request.Channel.Creator.Id,\n\t\t\"Name\", request.Channel.Name,\n\t\t\"Public\", request.Channel.Public,\n\t\t\"Status\", request.Channel.Status)\n\tif err == nil {\n\t\trequest.Channel.Id = id\n\t}\n\treturn request.Channel, err\n}", "title": "" }, { "docid": "6771618395c692a4ef38fdad9ed4d2f4", "score": "0.4544068", "text": "func createFileChannelAndExecutePlugin(context context.T, channelName string) {\n\tlog := context.Log()\n\tlog.Infof(\"document: %v worker started\", channelName)\n\t//create channel from the given handle identifier by master\n\tipc, err, _ := filewatcherbasedipc.CreateFileWatcherChannel(log, context.Identity(), filewatcherbasedipc.ModeWorker, channelName, false)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to create channel: %v\", err)\n\t\treturn\n\t}\n\n\t//initialize SessionPluginRegistry\n\trunpluginutil.SSMPluginRegistry = plugin.RegisteredSessionWorkerPlugins()\n\n\t//TODO add command timeout\n\tstopTimer := make(chan bool)\n\tpipeline := messaging.NewWorkerBackend(context, sessionPluginRunner)\n\t//TODO wait for sigterm or send fail message to the channel?\n\tif err = messaging.Messaging(log, ipc, pipeline, stopTimer); err != nil {\n\t\tlog.Errorf(\"messaging worker encountered error: %v\", err)\n\t\t//If ipc messaging broke, there's nothing session worker process can do, exit immediately\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "e26049079a47dee4a1f223cb6eeaceb3", "score": "0.45431024", "text": "func (client *Client) CreateMixWithChan(request *CreateMixRequest) (<-chan *CreateMixResponse, <-chan error) {\n\tresponseChan := make(chan *CreateMixResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateMix(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "9fb2eb0632be16ce866304d89168da53", "score": "0.45354974", "text": "func (client *Client) CreateUisConnectionWithCallback(request *CreateUisConnectionRequest, callback func(response *CreateUisConnectionResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateUisConnectionResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateUisConnection(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "afed95b3efde2e9ef84359875a98f003", "score": "0.4534427", "text": "func CreateAndJoinChannel(client api.FabricClient, ordererUser api.User, orgUser api.User, channel api.Channel, channelConfig string) error {\n\t// Check if primary peer has joined this channel\n\tvar foundChannel bool\n\tprimaryPeer := channel.GetPrimaryPeer()\n\tclient.SetUserContext(orgUser)\n\tresponse, err := client.QueryChannels(primaryPeer)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying channels for primary peer: %s\", err)\n\t}\n\tfor _, responseChannel := range response.Channels {\n\t\tif responseChannel.ChannelId == channel.GetName() {\n\t\t\tfoundChannel = true\n\t\t}\n\t}\n\n\tif foundChannel {\n\t\t// There's no need to create a channel, initialize the channel from the orderer and return\n\t\tif err := channel.Initialize(nil); err != nil {\n\t\t\treturn fmt.Errorf(\"Error initializing channel: %v\", err)\n\t\t}\n\t\treturn nil\n\t}\n\n\tlogger.Infof(\"***** Creating and Joining channel: %s *****\\n\", channel.GetName())\n\n\tconfigTx, err := ioutil.ReadFile(channelConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error reading config file: %v\", err)\n\t}\n\n\tconfig, err := client.ExtractChannelConfig(configTx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error extracting channel config: %v\", err)\n\t}\n\n\tconfigSignature, err := client.SignChannelConfig(config)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error signing configuration: %v\", err)\n\t}\n\n\tvar configSignatures []*common.ConfigSignature\n\tconfigSignatures = append(configSignatures, configSignature)\n\n\tcreator, err := client.GetIdentity()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting creator: %v\", err)\n\t}\n\tnonce, err := generateRandomNonce()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute nonce: %s\", err)\n\t}\n\ttxID, err := computeTxID(nonce, creator)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute TxID: %s\", err)\n\t}\n\n\trequest := api.CreateChannelRequest{\n\t\tName: channel.GetName(),\n\t\tOrderer: channel.GetOrderers()[0],\n\t\tConfig: config,\n\t\tSignatures: configSignatures,\n\t\tTxID: txID,\n\t\tNonce: nonce,\n\t}\n\n\tclient.SetUserContext(ordererUser)\n\terr = client.CreateChannel(&request)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"CreateChannel returned error\")\n\t}\n\n\t// Wait for orderer to process channel metadata\n\ttime.Sleep(time.Second * 3)\n\n\tclient.SetUserContext(orgUser)\n\n\tnonce, err = generateRandomNonce()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute nonce: %s\", err)\n\t}\n\ttxID, err = computeTxID(nonce, creator)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute TxID: %s\", err)\n\t}\n\n\tgenesisBlockRequest := &api.GenesisBlockRequest{\n\t\tTxID: txID,\n\t\tNonce: nonce,\n\t}\n\tgenesisBlock, err := channel.GetGenesisBlock(genesisBlockRequest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error getting genesis block: %v\", err)\n\t}\n\n\tnonce, err = generateRandomNonce()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute nonce: %s\", err)\n\t}\n\ttxID, err = computeTxID(nonce, creator)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Could not compute TxID: %s\", err)\n\t}\n\tjoinChannelRequest := &api.JoinChannelRequest{\n\t\tTargets: channel.GetPeers(),\n\t\tGenesisBlock: genesisBlock,\n\t\tTxID: txID,\n\t\tNonce: nonce,\n\t}\n\terr = channel.JoinChannel(joinChannelRequest)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error joining channel: %s\", err)\n\t}\n\n\tlogger.Infof(\"***** Created and Joined channel: %s *****\\n\", channel.GetName())\n\n\treturn nil\n}", "title": "" }, { "docid": "163fe86319f446ff8ada24ba2754ed87", "score": "0.45232794", "text": "func (client *Client) CreateCertificateForPackageRequestWithCallback(request *CreateCertificateForPackageRequestRequest, callback func(response *CreateCertificateForPackageRequestResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateCertificateForPackageRequestResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateCertificateForPackageRequest(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "0cba7e79e46bdf731690e9d40eb23b54", "score": "0.4516177", "text": "func (client *Client) CreateLabelsetWithChan(request *CreateLabelsetRequest) (<-chan *CreateLabelsetResponse, <-chan error) {\n\tresponseChan := make(chan *CreateLabelsetResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateLabelset(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "f92ecc80ecfebeef5f76e2ee18bfa6db", "score": "0.44996285", "text": "func NewStrategy(registryWhitelister whitelist.RegistryWhitelister) Strategy {\n\treturn Strategy{\n\t\tObjectTyper: legacyscheme.Scheme,\n\t\tregistryWhitelister: registryWhitelister,\n\t}\n}", "title": "" }, { "docid": "efd2d9484ce0f17c098a3d9850e6889b", "score": "0.4492591", "text": "func (client *Client) CreateSceneDefensePolicyWithCallback(request *CreateSceneDefensePolicyRequest, callback func(response *CreateSceneDefensePolicyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateSceneDefensePolicyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateSceneDefensePolicy(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "4bddb009a56df514c35c5b7c0deefe3a", "score": "0.44830358", "text": "func (t *TournamentClient) CreateProvider(parameters *ProviderRegistrationParameters, useStub bool) (int, error) {\n\tlogger := t.logger().WithFields(log.Fields{\n\t\t\"method\": \"CreateProvider\",\n\t\t\"stub\": useStub,\n\t})\n\tendpoint := endpointCreateTournamentProvider\n\tif useStub {\n\t\tendpoint = endpointCreateStubTournamentProvider\n\t}\n\tvar id int\n\tif err := t.c.PostInto(endpoint, parameters, &id); err != nil {\n\t\tlogger.Debug(err)\n\t\treturn 0, err\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "368a0a1b07d2551733f3c15e4f7aa8c4", "score": "0.44743165", "text": "func (chatterHandler ChatterHandler) createChatter(w http.ResponseWriter, r *http.Request) {\n ws, err := upgrader.Upgrade(w, r, nil)\n if err != nil {\n log.Fatal(err)\n }\n chatter := &Chatter{Send: make(chan []byte, 256), Ws: ws, Room: chatterHandler.Room, Username: chatterHandler.Username, Id: chatterHandler.Id}\n chatter.Room.Register <- chatter\n\n fmt.Println(\"Created chatter \" + strconv.Itoa(chatter.Id) + \" in room \" + strconv.Itoa(chatter.Room.Id))\n\n defer func() { chatter.Room.Unregister <- chatter }()\n go chatter.writer() //perform writes asynchronously\n chatter.reader()\n}", "title": "" }, { "docid": "28f280d51718f6c5bb16cf193355880e", "score": "0.44730717", "text": "func NewStrategy(typer runtime.ObjectTyper, obj resource.Object) genericStrategy {\n\treturn genericStrategy{typer, names.SimpleNameGenerator, obj}\n}", "title": "" }, { "docid": "4d2d0d637d7ec10b1e6919777ae03b0e", "score": "0.4467348", "text": "func (client *Client) CreateCertAndKeyWithCallback(request *CreateCertAndKeyRequest, callback func(response *CreateCertAndKeyResponse, err error)) <-chan int {\n\tresult := make(chan int, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tvar response *CreateCertAndKeyResponse\n\t\tvar err error\n\t\tdefer close(result)\n\t\tresponse, err = client.CreateCertAndKey(request)\n\t\tcallback(response, err)\n\t\tresult <- 1\n\t})\n\tif err != nil {\n\t\tdefer close(result)\n\t\tcallback(nil, err)\n\t\tresult <- 0\n\t}\n\treturn result\n}", "title": "" }, { "docid": "92606b36608226ca364e81c0ca912889", "score": "0.44625047", "text": "func (f *MockInfraProvider) CreateChannelCfg(ctx fab.ClientContext, name string) (fab.ChannelCfg, error) {\n\treturn nil, nil\n}", "title": "" }, { "docid": "788edd86de3d353f6943b003a146c395", "score": "0.44566044", "text": "func NewChannel(input TL) *Channel {\n channel := new(Channel)\n switch ch := input.(type) {\n case TL_channelFull:\n channel._State = CHANNEL_DATA_FULL\n channel.ID = ch.Id\n channel.About = ch.About\n channel.PinnedMessageID = ch.Pinned_msg_id\n channel.Counters.Admins = ch.Admins_count\n channel.Counters.Banned = ch.Banned_count\n channel.Counters.Kicked = ch.Kicked_count\n channel.Counters.Unread = ch.Unread_count\n channel.Counters.Participants = ch.Participants_count\n channel.Flags.loadFlags(ch.Flags)\n case TL_channelForbidden:\n channel._State = CHANNEL_DATA_EMPTY\n case TL_channel:\n channel._State = CHANNEL_DATA_REGULAR\n channel.ID = ch.Id\n channel.Title = ch.Title\n channel.AccessHash = ch.Access_hash\n channel.Username = ch.Username\n channel.Date = ch.Date\n channel.RestrictionReason = ch.Restriction_reason\n channel.Flags.loadFlags(ch.Flags)\n if channel.Flags.AdminRightsSet && ch.Admin_rights != nil {\n channel.AdminRights.loadFlags(ch.Admin_rights.(TL_channelAdminRights).Flags)\n }\n if channel.Flags.BannedRightsSet && ch.Banned_rights != nil {\n channel.BannedRights.UntilDate = ch.Banned_rights.(TL_channelBannedRights).Until_date\n channel.BannedRights.loadFlags(ch.Banned_rights.(TL_channelBannedRights).Flags)\n }\n default:\n log.Println(\"NewChannel::ERROR::\", reflect.TypeOf(ch))\n return nil\n }\n return channel\n}", "title": "" }, { "docid": "1c4514ffc2a0791b246268835f1de581", "score": "0.4448988", "text": "func (a BrokerClient) Create(topic NewTopic) error {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "d4674ad75c713a541da3ea4375b19894", "score": "0.44289455", "text": "func (p *SelectionProvider) CreateSelectionService(channelID string) (fab.SelectionService, error) {\n\tif channelID == \"\" {\n\t\treturn nil, errors.New(\"Must provide channel ID\")\n\t}\n\n\tvar channelUser *ChannelUser\n\tfor _, p := range p.users {\n\t\tif p.ChannelID == channelID {\n\t\t\tchannelUser = &p\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif channelUser == nil {\n\t\treturn nil, errors.New(\"Must provide user for channel\")\n\t}\n\n\tccPolicyProvider, err := newCCPolicyProvider(p.providers, channelID, channelUser.Username, channelUser.OrgName)\n\tif err != nil {\n\t\treturn nil, errors.WithMessage(err, \"Failed to create cc policy provider\")\n\t}\n\tsvc, err := newSelectionService(channelID, p.lbp, ccPolicyProvider, p.cacheTimeout)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tp.refLock.Lock()\n\tp.refs = append(p.refs, svc)\n\tp.refLock.Unlock()\n\n\treturn svc, nil\n}", "title": "" }, { "docid": "f3364012fdd7216e8473167a62f358f0", "score": "0.44251466", "text": "func (client *Client) ChannelCreate(draft *ChannelDraft) (result *Channel, err error) {\n\terr = client.Create(ChannelURLPath, nil, draft, &result)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "e188c120bca4d6c26640f8853baf79a5", "score": "0.44063523", "text": "func (client *Client) CreateImagePipelineWithChan(request *CreateImagePipelineRequest) (<-chan *CreateImagePipelineResponse, <-chan error) {\n\tresponseChan := make(chan *CreateImagePipelineResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateImagePipeline(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" }, { "docid": "61f8f1589708fdc617777e03b6a88211", "score": "0.43992037", "text": "func (ca *channelAccessor) createPaych(ctx context.Context, amt, avail types.BigInt) (cid.Cid, error) {\n\tmb, err := ca.messageBuilder(ctx, ca.from)\n\tif err != nil {\n\t\treturn cid.Undef, err\n\t}\n\tmsg, err := mb.Create(ca.to, amt)\n\tif err != nil {\n\t\treturn cid.Undef, err\n\t}\n\n\tsmsg, err := ca.api.MpoolPushMessage(ctx, msg, nil)\n\tif err != nil {\n\t\treturn cid.Undef, xerrors.Errorf(\"initializing paych actor: %w\", err)\n\t}\n\tmcid := smsg.Cid()\n\n\t// Create a new channel in the store\n\tci, err := ca.store.CreateChannel(ctx, ca.from, ca.to, mcid, amt, avail)\n\tif err != nil {\n\t\tlog.Errorf(\"creating channel: %s\", err)\n\t\treturn cid.Undef, err\n\t}\n\n\t// Wait for the channel to be created on chain\n\tgo ca.waitForPaychCreateMsg(ctx, ci.ChannelID, mcid)\n\n\treturn mcid, nil\n}", "title": "" }, { "docid": "4cf26506be920bdc82753e3b60d8ecd3", "score": "0.43975088", "text": "func (client *Client) CreateDBInstanceWithChan(request *CreateDBInstanceRequest) (<-chan *CreateDBInstanceResponse, <-chan error) {\n\tresponseChan := make(chan *CreateDBInstanceResponse, 1)\n\terrChan := make(chan error, 1)\n\terr := client.AddAsyncTask(func() {\n\t\tdefer close(responseChan)\n\t\tdefer close(errChan)\n\t\tresponse, err := client.CreateDBInstance(request)\n\t\tif err != nil {\n\t\t\terrChan <- err\n\t\t} else {\n\t\t\tresponseChan <- response\n\t\t}\n\t})\n\tif err != nil {\n\t\terrChan <- err\n\t\tclose(responseChan)\n\t\tclose(errChan)\n\t}\n\treturn responseChan, errChan\n}", "title": "" } ]
a9761480f54de56994592fe2901ade16
AverageSyllablesPerWord returns the average number of syllables per word in the text
[ { "docid": "dbba02741015460f403f60701c74ac4b", "score": "0.84053355", "text": "func (r *Results) AverageSyllablesPerWord() float64 {\n\treturn float64(r.Syllables) / float64(r.Words)\n}", "title": "" } ]
[ { "docid": "f9ca910ab53320a4efea42a818e61891", "score": "0.5968186", "text": "func (r *Results) WordsWithAtLeastNSyllables(n int, incProperNouns bool) int {\n\tvar total int\n\tfor sCount, wCount := range r.syllableWords {\n\t\tif sCount >= n {\n\t\t\ttotal += wCount\n\t\t}\n\t}\n\n\tif !incProperNouns {\n\t\tfor sCount, wCount := range r.syllableProperNouns {\n\t\t\tif sCount >= n {\n\t\t\t\ttotal -= wCount\n\t\t\t}\n\t\t}\n\t}\n\n\tif total < 0 {\n\t\treturn 0\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "60d10524b103d89028a68d28ace13bfd", "score": "0.5846867", "text": "func (r *Results) AverageLettersPerWord() float64 {\n\treturn float64(r.Letters) / float64(r.Words)\n}", "title": "" }, { "docid": "fd4ae593946e3353e5fa87a8961c841c", "score": "0.57855594", "text": "func (r *Results) AverageWordsPerSentence() float64 {\n\tif r.Sentences == 0 {\n\t\treturn float64(r.Words)\n\t}\n\treturn float64(r.Words) / float64(r.Sentences)\n}", "title": "" }, { "docid": "81ef97b407333cb666923c9aac0b47ff", "score": "0.56565195", "text": "func (r *Results) PercentageWordsWithAtLeastNSyllables(n int, incProperNouns bool) float64 {\n\treturn (float64(r.WordsWithAtLeastNSyllables(n, incProperNouns)) / float64(r.Words)) * 100.0\n}", "title": "" }, { "docid": "05c214386a66652efc36d41627276b97", "score": "0.5647937", "text": "func WordScore(word string) int {\n pos := 3\n score := 0\n for i:= range []byte(strings.ToUpper(word)) {\n if pos < 0 {\n break\n }\n ns := i*(256*pos)\n score += ns\n pos -= 1\n }\n return score\n}", "title": "" }, { "docid": "441688ad1b4cc6838836f7f2ffdd9acc", "score": "0.55212873", "text": "func Analyse(r io.Reader) (res *Results, err error) {\n\tscanner := bufio.NewScanner(r)\n\tscanner.Split(bufio.ScanRunes)\n\tres = &Results{}\n\tres.syllableWords = make(map[int]int)\n\tres.syllableProperNouns = make(map[int]int)\n\n\tvar word string\n\tvar endWord bool\n\tfor scanner.Scan() {\n\t\tstr := scanner.Text()\n\t\tletter, _ := utf8.DecodeRuneInString(str)\n\t\tswitch {\n\t\tcase unicode.IsLetter(letter):\n\t\t\tres.Letters++\n\t\t\tword += str\n\t\t\tendWord = false\n\t\tcase unicode.IsSpace(letter):\n\t\t\tendWord = true\n\t\t\tres.Spaces++\n\t\tcase unicode.IsPunct(letter):\n\t\t\tendWord = true\n\t\t\tswitch str {\n\t\t\tcase \".\", \"!\", \"?\":\n\t\t\t\tres.Sentences++\n\t\t\t}\n\t\t\tres.Punctuation++\n\t\t}\n\n\t\tif endWord && len(word) > 0 {\n\t\t\tanalyseWord(word, res)\n\t\t\tendWord = false\n\t\t\tword = \"\"\n\t\t}\n\t}\n\n\tif len(word) > 0 {\n\t\tanalyseWord(word, res)\n\t}\n\n\t// Return scanner error if any\n\terr = scanner.Err()\n\n\treturn\n}", "title": "" }, { "docid": "fc7d1a3f980314cfbf39e268b570642d", "score": "0.5481064", "text": "func (w Word) ScoreWord() int {\n\tvar total int\n\twordMultiplier := 1\n\tfor _, s := range w.Squares {\n\t\tif s.Used {\n\t\t\ttotal += s.Value.Value\n\t\t} else if mult, ok := letterMult[s.Multiplier]; ok {\n\t\t\ttotal += mult * s.Value.Value\n\t\t} else {\n\t\t\ttotal += s.Value.Value\n\t\t\twordMultiplier *= wordMult[s.Multiplier]\n\t\t}\n\t}\n\ttotal = total * wordMultiplier\n\treturn total\n}", "title": "" }, { "docid": "81e8d99725f6870dc183d00ef2aef878", "score": "0.53058577", "text": "func score(word string) int {\n\tsum := 0\n\tfor x, c := range word {\n\t\tfmt.Println(x, c, cton[c])\n\t\tsum += cton[c]\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "2f447beab97e0f3769cc6c9a02f074ab", "score": "0.52315485", "text": "func score(word string) int {\n\tvar total int\n\tfor i := range word {\n\t\tswitch word[i] {\n\t\tcase 'e', 'a', 'i', 'o', 'n', 'r', 't', 'l', 's', 'u':\n\t\t\ttotal += 1\n\t\tcase 'd', 'g':\n\t\t\ttotal += 2\n\t\tcase 'b', 'c', 'm', 'p':\n\t\t\ttotal += 3\n\t\tcase 'f', 'h', 'v', 'w', 'y':\n\t\t\ttotal += 4\n\t\tcase 'k':\n\t\t\ttotal += 5\n\t\tcase 'j', 'x':\n\t\t\ttotal += 8\n\t\tcase 'q', 'z':\n\t\t\ttotal += 10\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "ac4378207522192fb497d92ee94186ed", "score": "0.52082974", "text": "func Syllables(w []rune) [][]rune {\n\tsyl_starts := []int{}\n\tif len(w) == 0 {\n\t\treturn [][]rune{}\n\t}\n\tif inf.Vowel[w[0]] {\n\t\tsyl_starts = append(syl_starts, 0)\n\t}\n\n\tfor i := 1; i < len(w)-1; i++ {\n\t\tif (inf.Vowel[w[i]] && inf.Vowel[w[i-1]]) || (!inf.Vowel[w[i]] && inf.Vowel[w[i+1]]) {\n\t\t\tsyl_starts = append(syl_starts, i)\n\t\t}\n\t}\n\n\tif len(w) >= 2 && inf.Vowel[w[len(w)-1]] && inf.Vowel[w[len(w)-2]] {\n\t\tsyl_starts = append(syl_starts, len(w)-1)\n\t}\n\n\tsyls := [][]rune{}\n\n\tfor i := 0; i < len(syl_starts)-1; i++ {\n\t\tsyls = append(syls, w[syl_starts[i]:syl_starts[i+1]])\n\t}\n\tsyls = append(syls, w[syl_starts[len(syl_starts)-1]:])\n\n\treturn syls\n}", "title": "" }, { "docid": "09f5ed4a3a57dbe20e7a9d437a1f7882", "score": "0.5095772", "text": "func Score(word string) int {\n\tvar score int\n\n\t// When looping through a string, the w becomes a rune\n\tfor _, w := range word {\n\t\t// unicode.toLower takes a rune and outputs a rune\n\t\tw := unicode.ToLower(w)\n\t\tscore += pointConverter[w]\n\t}\n\treturn score\n}", "title": "" }, { "docid": "7ee6ef12099613aef820d417b315a5bd", "score": "0.5086509", "text": "func StandardizeText(data string, toLower bool) map[string]datastructure.BoW {\n\tvar (\n\t\t// This will contains the text standardized\n\t\ttext string\n\t\t// Text splitted by whitespace\n\t\twords []string\n\t\t// Save the frequencies related to the word\n\t\tbow map[string]float64 = make(map[string]float64)\n\t\t// Struct for save the BoW\n\t\tbowList map[string]datastructure.BoW\n\t)\n\n\tif toLower {\n\t\tdata = strings.ToLower(data)\n\t}\n\t// Converting []byte in string\n\ttext = string(data)\n\ttext = replacer.Replace(text)\n\t// Tokenize text by whitespace\n\twords = strings.Fields(text)\n\ttotal := float64(len(words))\n\n\t// Saving the frequencies for each word\n\tfor _, word := range words {\n\t\t// Ignore unwanted character/string\n\t\tif _, ok := datastructure.StopWords[word]; !ok {\n\t\t\tbow[word]++\n\t\t\t// Saving the words in the global dictionary\n\t\t\tdictionary[word] = 0\n\t\t}\n\t}\n\n\t// Initialize the BoW struct for save the data\n\tbowList = make(map[string]datastructure.BoW, len(bow))\n\n\t// Save the RAW data into the struct and calculate the TF\n\tfor key, value := range bow {\n\t\t// if value > 0 {\n\t\t// Count -> Number of times that the terms appear\n\t\t// TF -> frequencies of the term\n\t\tbowList[key] = datastructure.BoW{Count: value, TF: value / total}\n\t\t// }\n\t}\n\treturn bowList\n}", "title": "" }, { "docid": "63f3ca6cfe122dc5ec8ec3b1e708cd62", "score": "0.508303", "text": "func Score(word string) int {\n\n\ts := strings.Split(word, \"\")\n\tsum := 0\n\n\tfor i := 0; i < len(s); i++ {\n\t\ts[i] = strings.ToLower(s[i])\n\n\t\tswitch s[i] {\n\t\tcase \"a\", \"e\", \"i\", \"o\", \"u\", \"l\", \"n\", \"r\", \"s\", \"t\":\n\t\t\tsum++\n\t\tcase \"d\", \"g\":\n\t\t\tsum += 2\n\t\tcase \"b\", \"c\", \"m\", \"p\":\n\t\t\tsum += 3\n\t\tcase \"f\", \"h\", \"v\", \"w\", \"y\":\n\t\t\tsum += 4\n\t\tcase \"k\":\n\t\t\tsum += 5\n\t\tcase \"j\", \"x\":\n\t\t\tsum += 8\n\t\tcase \"q\", \"z\":\n\t\t\tsum += 10\n\t\t}\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "4feb2591be313c0ba1aa0a78ba641cb4", "score": "0.5070262", "text": "func TotalScore(data string) int {\n\ttotal := 0\n\tfor _, r := range data {\n\t\ttotal += GetCharScore(strings.ToLower(string(r)))\n\t}\n\treturn total\n}", "title": "" }, { "docid": "35b3dfb785e1d4e41bba34e1b734b710", "score": "0.506342", "text": "func countWords(s *scene) int {\n\tsum := 0\n\tif s.isLeaf() {\n\t\tsum = len(strings.Split(s.Text, \" \"))\n\t} else {\n\t\tfor _, scene := range s.Children {\n\t\t\tsum += countWords(scene)\n\t\t}\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "600416a4d8174162f4692a56730edf37", "score": "0.5061948", "text": "func SMSCount(s string) int {\n\tvar processedCount int\n\n\tprocessedCount = 1\n\twordCount := len(s)\n\n\tif wordCount > 160 {\n\t\tprocessedCount = int(wordCount / 160)\n\t}\n\treturn processedCount\n}", "title": "" }, { "docid": "8d2016a87bb41445aa7dd32e34da48b7", "score": "0.50505704", "text": "func ScoreAlphabet(alphabet string) float64 {\n\tcounts := make(map[string]int)\n\n\tfor k := range LetterFrequencies {\n\t\tcounts[k] = 0\n\t}\n\n\tfor i := 0; i < len(alphabet); i++ {\n\t\tchar := strings.ToLower(alphabet[i : i+1])\n\t\tif strings.Contains(punctuation, char) {\n\t\t\tcounts[\"punc\"] += 1\n\t\t} else {\n\t\t\tprev, exists := counts[char]\n\t\t\tif exists {\n\t\t\t\tcounts[char] = prev + 1\n\t\t\t} else {\n\t\t\t\tcounts[\"other\"] = counts[\"other\"] + 1\n\t\t\t}\n\t\t}\n\t}\n\n\ttotalDiffence := 0.0\n\tfor k, v := range counts {\n\t\tdiff := (float64(v) / float64(len(alphabet))) - LetterFrequencies[k]\n\t\ttotalDiffence += diff * diff\n\t}\n\ttotalDiffence = math.Sqrt(totalDiffence)\n\treturn totalDiffence\n}", "title": "" }, { "docid": "1d7882ec2d797bd631fa116a2c614d49", "score": "0.5048817", "text": "func CalculateWordScores(phraseList []string) map[string]float64 {\n\twordFrequency := map[string]int{}\n\twordDegree := map[string]int{}\n\n\tfor _, phrase := range phraseList {\n\t\twordList := SeperateWords(phrase)\n\t\twordListLength := len(wordList)\n\t\twordListDegree := wordListLength - 1\n\n\t\tfor _, word := range wordList {\n\t\t\tSetDefaultStringInt(wordFrequency, word, 0)\n\t\t\twordFrequency[word]++\n\n\t\t\tSetDefaultStringInt(wordDegree, word, 0)\n\t\t\twordDegree[word] += wordListDegree\n\t\t}\n\t}\n\n\tfor key := range wordFrequency {\n\t\twordDegree[key] = wordDegree[key] + wordFrequency[key]\n\t}\n\n\twordScore := map[string]float64{}\n\tfor key := range wordFrequency {\n\t\tSetDefaultStringFloat64(wordScore, key, 0)\n\t\twordScore[key] = float64(wordDegree[key]) / float64(wordFrequency[key])\n\t}\n\n\treturn wordScore\n}", "title": "" }, { "docid": "d319b912377b9bd8accb713a6f623a74", "score": "0.5031564", "text": "func Score(word string) int {\n\tscore := 0\n\tfor _, letter := range word {\n\t\tscore += valueFor(letter)\n\t}\n\treturn score\n}", "title": "" }, { "docid": "6b92bb0079a4896637b6ed48fa3bcbe5", "score": "0.5027961", "text": "func reduceWords(tuples [][]string) map[string][]string {\n\tanagrams := make(map[string][]string)\n\tfor _, tuples := range tuples {\n\t\tanagrams[tuples[0]] = append(anagrams[tuples[0]], tuples[1])\n\t}\n\treturn anagrams\n}", "title": "" }, { "docid": "f9e24737c9cb3f81f1d2de229f1b5730", "score": "0.50245017", "text": "func Score(word string) int {\n\ttotal := 0\n\tfor i := 0; i < len(word); i++ {\n\t\tupperLetter := s.ToUpper(string(word[i]))\n\t\tfor group, score := range scoreLetter {\n\t\t\tif s.Contains(group, upperLetter) {\n\t\t\t\ttotal += score\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn total\n}", "title": "" }, { "docid": "48691eadd1b479e487e3818d7c98259c", "score": "0.50186974", "text": "func Score(word string) int {\n\tvar score int\n\n\tfor _, e := range word {\n\t\tscore += LetterScore(e)\n\t}\n\n\treturn score\n}", "title": "" }, { "docid": "2659ac124193da25f3ed774069aa3593", "score": "0.49966472", "text": "func Score(word string) int {\n\tif len(word) == 0 {\n\t\treturn 0\n\t}\n\n\tvar score int\n\tvar valueTable = [][]rune{\n\t\t[]rune{},\n\t\t[]rune{'a', 'e', 'i', 'o', 'u', 'l', 'n', 'r', 's', 't'},\n\t\t[]rune{'d', 'g'},\n\t\t[]rune{'b', 'c', 'm', 'p'},\n\t\t[]rune{'f', 'h', 'v', 'w', 'y'},\n\t\t[]rune{'k'},\n\t\t[]rune{},\n\t\t[]rune{},\n\t\t[]rune{'j', 'x'},\n\t\t[]rune{},\n\t\t[]rune{'q', 'z'},\n\t}\n\n\tfor _, char := range word {\n\t\tfor entryIndex, entry := range valueTable {\n\t\t\tfor _, letter := range entry {\n\t\t\t\tif unicode.ToLower(char) == letter {\n\t\t\t\t\tscore += entryIndex\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn score\n}", "title": "" }, { "docid": "a40a27515b82dfe9d08da8e3347610c4", "score": "0.4967365", "text": "func Calculate(word string, padding int) string {\n\t// Lets first split word to get unicode sequences in string\n\tunicodeWord := strings.Split(word, \"\")\n\n\t// We need Unicode length of the word not length of UTF-8\n\t// encoded Unicode word.\n\t// .\n\t// Additionally unlike expected word[0] is not a Unicode\n\t// letter instead first byte of UTF-8 encoded Unicode letter\n\t// (utf-8 encoded Unicode letter for Indian language is\n\t// normally 3 bytes in length). We need to reduce length by 1\n\t// to get last index of first Unicode character as strings are\n\t// 0 indexed.\n\n\twordLength, firstCharLastIndex := len(unicodeWord), len(unicodeWord[0])-1\n\tresult, lang := soundex(word, wordLength)\n\n\t// We don't need to padd English words soundex value\n\tif lang == \"en_US\" {\n\t\treturn result\n\t}\n\n\t// Convert sndx a rune slice into single string and padd it\n\t// with `padding' number of 0\n\tresult += strings.Repeat(`0`, padding)\n\n\t// Return the string slice 0 to padding+firstCharLastIndex\n\treturn result[0 : padding+firstCharLastIndex]\n}", "title": "" }, { "docid": "f6fd1d3f0d607d6fa0ad550c5001da8e", "score": "0.4953279", "text": "func Score(word string) int {\n\tword = strings.ToLower(word)\n\tscore := 0\n\tbuildMap()\n\tfor _, r := range word {\n\t\tscore += values[r]\n\t}\n\treturn score\n}", "title": "" }, { "docid": "00ff5eb67618a97ebc4af68ef09e8918", "score": "0.4951936", "text": "func wordFrequency(c *train.Classifier, category string, document string) (p float64) {\n\tp = 1.0\n\twnc := 0.0\n\twords := utilities.CountWords(document)\n\tfor word := range words {\n\t\twnc = (c.Words[category][word] + 1.0) / (c.WordCategoryTotal[category] + c.TotalWords)\n\t\tp = p * wnc\n\t}\n\treturn p\n}", "title": "" }, { "docid": "57946957b9a84d77ed1e3894777c78b0", "score": "0.49493614", "text": "func wordCount(content string) int {\n\tvar cnt = 0\n\tvar startIdx = 0\n\t//Find value (Todo: make sure [ will not appear at end of line)\n\tfor idx, c := range content {\n\t\tif c == '[' {\n\t\t\tstartIdx = idx + 1\n\t\t} else if c == ']' {\n\t\t\tval, _ := strconv.Atoi(content[startIdx:idx])\n\t\t\tcnt += val\n\t\t}\n\t}\n\treturn cnt\n}", "title": "" }, { "docid": "92f59f7ab3fc53747a0ecb3c25e7dc74", "score": "0.49001426", "text": "func Score(word string) int {\n\tletterScore := map[string]int{\n\t\t\"A\": 1, \"E\": 1, \"I\": 1, \"O\": 1, \"U\": 1,\n\t\t\"L\": 1, \"N\": 1, \"R\": 1, \"S\": 1, \"T\": 1,\n\t\t\"D\": 2, \"G\": 2, \"B\": 3, \"C\": 3, \"M\": 3,\n\t\t\"P\": 3, \"F\": 4, \"H\": 4, \"V\": 4, \"W\": 4,\n\t\t\"Y\": 4, \"K\": 5, \"J\": 8, \"X\": 8, \"Q\": 10,\n\t\t\"Z\": 10}\n\n\tfor _, char := range word {\n\t\tscore := letterScore[strings.ToUpper(string(char))]\n\t\tresult += score\n\t}\n\treturn result\n}", "title": "" }, { "docid": "c7552e15795dc6651b11005df8a1fd9c", "score": "0.48904327", "text": "func wordCount(src string) int {\n\tstr := strings.Fields(src)\n\treturn len(str)\n}", "title": "" }, { "docid": "076995ca1c21a6038ffb5637163edd12", "score": "0.48776072", "text": "func WordCount(input string) Frequency {\n\tfrequency := Frequency{}\n\tnoDashses := regexp.MustCompile(\"\\\\s'|'\\\\s\").ReplaceAllString(input, \" \")\n\tcleanInput := regexp.MustCompile(\"[^a-zA-Z0-9']\").ReplaceAllString(noDashses, \" \")\n\tnoDoubleSpaces := regexp.MustCompile(\"\\\\s+\").ReplaceAllString(cleanInput, \" \")\n\ttrimmed := strings.TrimSpace(noDoubleSpaces)\n\tlowerCase := strings.ToLower(trimmed)\n\twords := strings.Split(lowerCase, \" \")\n\tfor _, word := range words {\n\t\tfrequency[word]++\n\t}\n\treturn frequency\n}", "title": "" }, { "docid": "3831d22254303410c0b8c5c0187723d3", "score": "0.48732093", "text": "func (t *Text) Summarise(percentage float64) string {\n\tnumberOfWords := int(float64(t.numberOfWords) * percentage)\n\tif numberOfWords < 1 {\n\t\tnumberOfWords = 1\n\t}\n\n\ts := Sentences{\n\t\tsentences: t.Sentences,\n\t\tind: make([]int, len(t.Sentences)),\n\t}\n\tfor i := range s.ind {\n\t\ts.ind[i] = i\n\t}\n\n\tsort.Sort(sort.Reverse(s))\n\n\tvar topInd []int\n\n\ttotalWords := 0\n\tfor i := range s.sentences {\n\t\tif totalWords < numberOfWords {\n\t\t\ttotalWords += s.sentences[i].numberOfWords\n\t\t\ttopInd = append(topInd, i)\n\t\t} else {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tsort.Sort(sort.IntSlice(topInd))\n\n\tsummarisedText := \"\"\n\tfor i, ind := range topInd {\n\t\tif i == 0 {\n\t\t\tsummarisedText += t.Sentences[ind].Text\n\t\t} else {\n\t\t\tsummarisedText = summarisedText + \" \" + t.Sentences[ind].Text\n\t\t}\n\t}\n\n\treturn summarisedText\n}", "title": "" }, { "docid": "95c83db666d08a6280bc0d5b1d5694c4", "score": "0.48625743", "text": "func (poem Poem) NumWords() int {\n\tcount := 0\n\tfor _, stanza := range poem {\n\t\tfor _, line := range stanza {\n\t\t\t// each line stored as string\n\t\t\tsl := string(line)\n\t\t\t// stores all words in a slice\n\t\t\tparts := strings.Split(sl, \" \")\n\t\t\tcount += len(parts)\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "371a8f74b42cb6ed5cb1de7db3fe3ab4", "score": "0.48512268", "text": "func CountEncodedWords(messages []string, word string, decoder StringDecoder) int { // HL\n\tcount := 0\n\tfor _, m := range messages {\n\t\tif dm, err := decoder.DecodeString(m); err == nil { // HL\n\t\t\tcount += bytes.Count(dm, []byte(word))\n\t\t}\n\t}\n\treturn count\n}", "title": "" }, { "docid": "ae7d834b35090161b4d27d6ac7b41db6", "score": "0.48229098", "text": "func (w Word) Len() int { return len(w.Squares) }", "title": "" }, { "docid": "08712c6692f1b7f3c131de527b590ac4", "score": "0.48041126", "text": "func mrWordCount(input string) wordCounts {\n\tresults := make(wordCounts)\n\twords := strings.Fields(input)\n\tfor _, w := range words {\n\t\tresults[normalize(w)]++\n\t}\n\treturn results\n}", "title": "" }, { "docid": "5a08ad54d800d65c5186fc3538b28b73", "score": "0.47971871", "text": "func countWords(l string) {\n\tfor _, pc := range replaceChars {\n\t\tl = strings.Replace(l, string(pc), \"\", -1)\n\t}\n\tl = strings.ToLower(l)\n\twords := strings.Split(l, \" \")\n\tfor _, w := range words {\n\t\tresult[w] = result[w] + 1\n\t}\n}", "title": "" }, { "docid": "abd3e72d5f1dc23331a3c773fbb24ffc", "score": "0.47962886", "text": "func checkWords(tiles string, dictionary []string) string {\n\tlc := make(map[uint8]int)\n\tfor i := range tiles {\n\t\tlc[tiles[i]]++\n\t}\n\tbestScore := 0\n\tbestWord := \"\"\n\tfor _, candidate := range dictionary {\n\t\tletters := copyMap(lc)\n\t\tok := true\n\t\tfor j := range candidate {\n\t\t\tif val := letters[candidate[j]]; val > 0 {\n\t\t\t\tletters[candidate[j]] = val - 1\n\t\t\t} else {\n\t\t\t\tok = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif ok {\n\t\t\tcandidateScore := score(candidate)\n\t\t\tif candidateScore > bestScore {\n\t\t\t\tbestScore = candidateScore\n\t\t\t\tbestWord = candidate\n\t\t\t}\n\t\t}\n\t}\n\treturn bestWord\n}", "title": "" }, { "docid": "0a5fc4882c068de9b10e32c58c753883", "score": "0.47925192", "text": "func Score(w string) int {\n vals := map[rune]int{'A': 1, 'E': 1, 'I': 1, 'O': 1, 'U': 1, 'L': 1, 'N': 1, 'R': 1, 'S': 1, 'T':1,\n 'D': 2, 'G': 2,\n 'B': 3, 'C': 3, 'M': 3, 'P': 3,\n 'F': 4, 'H': 4, 'V': 4, 'W': 4, 'Y': 4,\n 'K': 5,\n 'J': 8, 'X': 8,\n 'Q': 10, 'Z': 10}\n\n var score int\n for _, x := range w {\n score += vals[unicode.ToUpper(x)]\n }\n\n return score\n}", "title": "" }, { "docid": "580d507862255a9acab98c6e97ab41dc", "score": "0.47748157", "text": "func Analyze(rdr io.Reader) float64 {\n\tvar (\n\t\tphraseSize int\n\t\tphraseCount int\n\t\thardWords int\n\t\twords int\n\t\ttotalSentenceLength int\n\t)\n\n\tscanner := bufio.NewScanner(rdr)\n\tscanner.Split(bufio.ScanWords)\n\tfor scanner.Scan() {\n\t\twords++\n\t\tphraseSize++\n\t\tw := scanner.Text()\n\n\t\tlastRune := w[len(w)-1]\n\t\tswitch lastRune {\n\t\tcase '.', ',', ';':\n\t\t\tw = w[:len(w)-1]\n\t\t\ttotalSentenceLength += phraseSize\n\t\t\tphraseCount++\n\t\t\tphraseSize = 0\n\t\t}\n\n\t\tif len(w) > 6 {\n\t\t\thardWords++\n\t\t}\n\t}\n\n\treturn 0.4 * (float64(totalSentenceLength/phraseCount + 100*hardWords/words))\n}", "title": "" }, { "docid": "8139496d389280482128521aeeed01b3", "score": "0.4760041", "text": "func WordCount(input string) Frequency {\n\tres := make(Frequency)\n\tfor _, word := range regexp.MustCompile(\"(\\\\'*[^0-9A-Za-z']+\\\\'*)+\").Split(strings.ToLower(input)+\" \", -1) {\n\t\tif word == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tif frequency, exist := res[word]; exist {\n\t\t\tres[word] = frequency + 1\n\t\t} else {\n\t\t\tres[word] = 1\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "5bd3d4486f1f12ed829eb1517aa2a99f", "score": "0.47507593", "text": "func ComputeSentence(s string) Sentence {\n\tres := Sentence{Text: s}\n\tres.Feats = make(map[string]map[string]int)\n\ttokens := s2Tokens(s)\n\n\tfor _, t := range tokens {\n\t\tif t.Type == \"space\" {\n\t\t\tcontinue\n\t\t}\n\t\tif t.Type == \"letter\" {\n\t\t\t//res.Words[strings.ToLower(t.Text)]++\n\t\t\tres.AddFeat(FeatWord, strings.ToLower(t.Text))\n\t\t} else {\n\t\t\tres.AddFeat(t.Type, strings.ToLower(t.Text))\n\t\t}\n\t}\n\n\tfor _, chBigramTr := range BigramTransitions(tokens) {\n\t\tres.AddFeat(FeatBigramTransition, chBigramTr)\n\t}\n\tfor _, chBigram := range NGrams(tokens, 2) {\n\t\tres.AddFeat(FeatBigram, chBigram)\n\t}\n\tif bg := InitialNGram(tokens, 2); bg != \"\" {\n\t\tres.AddFeat(FeatInitialBigram, bg)\n\t}\n\tif tg := FinalNGram(tokens, 3); tg != \"\" {\n\t\tres.AddFeat(FeatFinalTrigram, tg)\n\t}\n\t// for _, chTrigram := range NGrams(tokens, 3) {\n\t// \tres.AddFeat(FeatTrigram, chTrigram)\n\t// }\n\n\tvar nWords int\n\tfor _, freq := range res.Feats[FeatWord] {\n\t\tnWords += freq\n\t}\n\tres.AddFeatWithFreq(FeatCount, FeatValWordCount, nWords)\n\n\tvar nDigits int\n\tfor _, freq := range res.Feats[\"digit\"] {\n\t\tnDigits += freq\n\t}\n\tres.AddFeatWithFreq(FeatCount, FeatValDigitCount, nDigits)\n\n\treturn res\n}", "title": "" }, { "docid": "a83ee80a5b249e3a412fcfc4a2c5a082", "score": "0.47027212", "text": "func CalcWords(s intstack.IntStack, word string) {\n\tif s.IsEmpty() {\n\t\t/* Commented out timing is pure calculation*/\n\t\t//fmt.Println(word)\n\t} else {\n\t\t/*Check to see if the values are 1 or zero as they*/\n\t\t/*have no letters associated with them*/\n\t\tif s.Peek() == 1 || s.Peek() == 0 {\n\t\t\ts.Pop()\n\t\t\tCalcWords(s, word)\n\t\t} else {\n\t\t\tfor _, letter := range letterMap[s.Pop()] {\n\t\t\t\tCalcWords(s, word+letter)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "8fef84997db33a9d0c319532a18a905a", "score": "0.46732536", "text": "func WordCount(s string) map[string]int {\n\twords := strings.Split(s, \" \")\n\tcounts := make(map[string]int)\n\tfor _, element := range words {\n\t\tif _, ok := counts[element]; ok {\n\t\t\tcounts[element]++\n\t\t} else {\n\t\t\tcounts[element] = 1\n\t\t}\n\t}\n\treturn counts\n}", "title": "" }, { "docid": "64c02df8c19b3c4ce5c9a47e9eeec3bf", "score": "0.46685135", "text": "func computeFrequency(s string) map[string]int {\n\tvar fullWord string\n\n\t// Use a buffer to track partial words\n\twordBuffer := make([]string, 0)\n\tfreqMap := make(map[string]int)\n\n\tfor _, r := range s {\n\t\tif (r < 'a' || r > 'z') && (r < 'A' || r > 'Z') {\n\t\t\tif len(wordBuffer) > 0 {\n\t\t\t\t//\tIf it's not a letter\n\t\t\t\t//\t\tthen add word buffer into frequency map & increment its count\n\t\t\t\tfullWord = strings.Join(wordBuffer[:], \"\")\n\t\t\t\tif _, ok := freqMap[fullWord]; ok {\n\t\t\t\t\tfreqMap[fullWord]++\n\t\t\t\t} else {\n\t\t\t\t\tfreqMap[fullWord] = 1\n\t\t\t\t}\n\t\t\t\twordBuffer = nil\n\t\t\t}\n\t\t} else {\n\t\t\t// \tIf it's a letter\n\t\t\t//\t\tthen keep track of its lowercase letter into a word buffer\n\t\t\twordBuffer = append(wordBuffer, string(unicode.ToLower(r)))\n\t\t}\n\t}\n\n\t// Flush the buffer after iterating\n\tif len(wordBuffer) > 0 {\n\t\tfullWord = strings.Join(wordBuffer[:], \"\")\n\t\tif _, ok := freqMap[fullWord]; ok {\n\t\t\tfreqMap[fullWord]++\n\t\t} else {\n\t\t\tfreqMap[fullWord] = 1\n\t\t}\n\t}\n\n\treturn freqMap\n}", "title": "" }, { "docid": "0834641dafad6f977606d37e25766b8e", "score": "0.46635368", "text": "func main() {\n\tvar wordCount int\n\tscanner := bufio.NewScanner(os.Stdin)\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tfmt.Println(line)\n\n\t\t// wordCount += len(strings.Split(line, \" \"))\n\t\twordCount += len(strings.Fields(line))\n\t}\n\n\tfmt.Print(wordCount)\n}", "title": "" }, { "docid": "8a55a5bb32aa6301bf0593fc75ae4897", "score": "0.46543753", "text": "func Levenshtein(first, second, lang string) float32 {\n\tfirst = pkg.NormalizeWord(first)\n\tsecond = pkg.NormalizeWord(second)\n\tfirstWord := Word{Text: first, Language: lang}\n\tfirstWord.getCodes()\n\tsecondWord := Word{Text: second, Language: lang}\n\tsecondWord.getCodes()\n\tfirstLen := len([]rune(firstWord.Text))\n\tsecondLen := len([]rune(secondWord.Text))\n\n\tif pkg.XorIfEmpty(firstLen, secondLen) {\n\t\treturn 0\n\t}\n\tif first == second {\n\t\treturn 1\n\t}\n\tif len(firstWord.Codes) == 0 || len(secondWord.Codes) == 0 {\n\t\treturn 0\n\t}\n\n\tfirstLenEx := firstLen + 1\n\tsecondLenEx := secondLen + 1\n\tdistance := make([][]int, 3)\n\n\tfor i := 0; i < 3; i++ {\n\t\tdistance[i] = make([]int, secondLenEx+1)\n\t}\n\tfor j := 1; j < secondLenEx; j++ {\n\t\tdistance[0][j] = j * 2\n\t}\n\tcurrentRow := 0\n\tfor i := 1; i < firstLenEx; i++ {\n\t\tcurrentRow = i % 3\n\t\tdistance[currentRow][0] = i * 2\n\t\tpreviousRow := (i - 1) % 3\n\t\tfor j := 1; j < secondLenEx; j++ {\n\t\t\tdistance[currentRow][j] = pkg.MinInt(pkg.MinInt(distance[previousRow][j]+2, distance[currentRow][j-1]+2), distance[previousRow][j-1]+costDistanceSymbol(firstWord, secondWord, i-1, j-1))\n\t\t\tif i > 1 && j > 1 && firstWord.Text[i-1] == secondWord.Text[j-2] && firstWord.Text[i-2] == secondWord.Text[j-1] {\n\t\t\t\tdistance[currentRow][j] = pkg.MinInt(distance[currentRow][j], distance[(i-2)%3][j-2]+2)\n\t\t\t}\n\t\t}\n\n\t}\n\tlevCost := distance[currentRow][secondLenEx-1]\n\treturn 1 - pkg.MaxRatio(firstLen, secondLen, levCost)/2\n}", "title": "" }, { "docid": "19aad7086f73cabe41d2be8fc4bd43c3", "score": "0.4650228", "text": "func countWords(s string) int {\n\twords := 0\n\tinWord := false\n\tfor _, c := range s {\n\t\tif unicode.IsSpace(c) {\n\t\t\tinWord = false\n\t\t} else if !inWord {\n\t\t\twords++\n\t\t\tinWord = true\n\t\t}\n\t}\n\treturn words\n}", "title": "" }, { "docid": "d01332881c075107ac0d4b5465bf309c", "score": "0.46493638", "text": "func processForLength(fname string, requestLength int) {\n\t//fmt.Printf(\"reading file: %s\\n\", fname)\n\twordCount := 0\n\n\twordMap := make(map[uint32][]string)\n\n\tinFile, _ := os.Open(fname)\n\tdefer inFile.Close()\n\tscanner := bufio.NewScanner(inFile)\n\tscanner.Split(bufio.ScanLines)\n\n\t// For each line (one word)\n\tfor scanner.Scan() {\n\t\tword := scanner.Text()\n\t\tif len(word) != requestLength {\n\t\t\tcontinue\n\t\t}\n\t\twordCount++\n\t\tcode := getCode(word)\n\t\twordMap[code] = append(wordMap[code], word)\n\t}\n\t//fmt.Println(wordMap)\n\n\t//fmt.Println(\"wordLength, wordCount, bucketCount: \", requestLength, \",\", wordCount, \",\", len(wordMap))\n\n\t// Now that we have grouped words into \"buckets\" based on our algorithm, the rest is easy\n\t// for each bucket, make sure they are really anagrams (our bucket algo ignores letter repeats)\n\t// and if #words that are anagrams >= minimumWordsWeWant we print them\n\tfor k := range wordMap {\n\t\t// Don't bother unless we have enough words to care about\n\t\tif len(wordMap[k]) < minimumWordsWeWant {\n\t\t\tcontinue\n\t\t}\n\n\t\twordList := wordMap[k]\n\t\t//fmt.Println(k, wordList)\n\n\t\t// Make a map where the alphagram is the key so we can easily group\n\t\talphagramMap := make(map[string][]string)\n\t\tfor _, word := range wordList {\n\t\t\talphagram := getAlphagram(word)\n\t\t\talphagramMap[alphagram] = append(alphagramMap[alphagram], word)\n\t\t}\n\t\t//fmt.Println(alphagramMap)\n\n\t\t// For each alphagram, if wordCount >= MINIMUM_WORDS, print them\n\t\tfor alphagram := range alphagramMap {\n\t\t\tanagramCount := len(alphagramMap[alphagram])\n\t\t\tif anagramCount >= minimumWordsWeWant {\n\t\t\t\tfmt.Println(requestLength, anagramCount, alphagramMap[alphagram])\n\t\t\t}\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "f88ed8f84d29b61aa79338c3abbbd7c1", "score": "0.46486318", "text": "func WordCount(sentence string) Frequency {\n\tsentence = strings.ToLower(sentence)\n\tregexp, _ := regexp.Compile(\"[^ a-z0-9]+,-;\")\n\tsentence = regexp.ReplaceAllString(sentence, \"\")\n\twords := strings.FieldsFunc(sentence, Split)\n\n\tvar result Frequency\n\tresult = make(map[string]int)\n\tfor _, word := range words {\n\t\tresult[word]++\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "388be91142b706b800d3a337bc21768b", "score": "0.46479756", "text": "func WordCount(phrase string) Frequency {\n\tfreq := Frequency{}\n\twords := strings.Fields(normalize(phrase))\n\tfor _, w := range words {\n\t\tw = strings.Trim(w, \"'\")\n\t\tfreq[w]++\n\t}\n\treturn freq\n}", "title": "" }, { "docid": "c4344d92cdd0d8c2db6b1919e21a07ff", "score": "0.4643374", "text": "func WordCount(phrase string) (f Frequency) {\n\tf = make(Frequency)\n\tvar b strings.Builder\n\tvar ch byte\n\n\tfor i := 0; i < len(phrase); i++ {\n\t\tch = phrase[i] | 32\n\n\t\tif isAlphaNumeric(ch) {\n\t\t\tb.WriteByte(ch)\n\t\t} else if ch == '\\'' && b.Len() > 0 && i+1 < len(phrase) && isAlphaNumeric(phrase[i+1]) {\n\t\t\tb.WriteByte(ch)\n\t\t} else if b.Len() > 0 {\n\t\t\tf[b.String()]++\n\t\t\tb.Reset()\n\t\t}\n\t}\n\n\tif b.Len() > 0 {\n\t\tf[b.String()]++\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8396fb301064ce9ecc22ebc97d8841ab", "score": "0.46215728", "text": "func (d *AnalysedDocument) CalculateAverage() *AnalysedDocument {\n\tscore := float64((-1 * d.NegativeTweets) + d.PositiveTweets)\n\tcount := float64(d.NegativeTweets + d.PositiveTweets)\n\td.AverageScore = score / count\n\treturn d\n}", "title": "" }, { "docid": "34dca7568af135ed0110ed66174de109", "score": "0.46202672", "text": "func sherlockAndAnagrams(s string) int32 {\n\tvar total int32\n\twordTable := make(map[string]int)\n\tfor i := 0; i < len(s)/2; i++ {\n\t\tfor j := i; j < len(s); j++ {\n\t\t\tword := s[i:j]\n\t\t\t// Sort the substring to verify the letters line up\n\t\t\twordTable[sortString(word)] = wordTable[word] + 1\n\t\t}\n\t}\n\n\tfor _, count := range wordTable {\n\t\ttotal += int32(count - 1)\n\t}\n\n\treturn total\n}", "title": "" }, { "docid": "30bf365331e21381dff65ee85c070f5b", "score": "0.46108446", "text": "func WordCount(s string) Frequency {\n\ts = strings.ToLower(s)\n\tout := make(Frequency)\n\n\twords := findWord.FindAllString(s, -1)\n\n\tfor _, w := range words {\n\t\tif count, ok := out[w]; ok {\n\t\t\tout[w] = count + 1\n\t\t} else {\n\t\t\tout[w] = 1\n\t\t}\n\t}\n\treturn out\n}", "title": "" }, { "docid": "052e9fde6c9b0bab797194549747542d", "score": "0.45949355", "text": "func (g *Graph) AddWordLengthGraphData(smallWords int, medWords int, bigWords int) {\n\t// Ensure bitmap is not nil\n\tif g.bitmap == nil {\n\t\tg.bitmap = make(map[[2]int]byte)\n\t}\n\n\tg.graphCount++\n\ttotalWords := smallWords + medWords + bigWords\n\tsmallHeight := g.CalculateCatHeight(totalWords, smallWords)\n\tmedHeight := g.CalculateCatHeight(totalWords, medWords)\n\tmedCatLoc := smallHeight\n\tbigCatLoc := medCatLoc + medHeight\n\n\tfor x := 0; x < g.GraphWidth+1; x++ {\n\t\tfor y := 0; y < g.GraphHeight; y++ {\n\t\t\tcoord := [2]int{x, y}\n\t\t\tif x == 0 || x == g.GraphWidth {\n\t\t\t\tg.bitmap[coord] = '|'\n\t\t\t} else if y == 0 || y == medCatLoc || y == bigCatLoc ||\n\t\t\t\ty == g.GraphHeight {\n\t\t\t\tg.bitmap[coord] = '-'\n\t\t\t} else if y == 1 {\n\t\t\t\tg.AddCharData(\"Small words\", 0, 1)\n\t\t\t} else if y == medCatLoc+1 {\n\t\t\t\tg.AddCharData(\"Medium words\", 0, medCatLoc+1)\n\t\t\t} else if y == bigCatLoc+1 {\n\t\t\t\tg.AddCharData(\"Big words\", 0, bigCatLoc+1)\n\t\t\t} else {\n\t\t\t\tg.bitmap[coord] = ' '\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "667a73c2fdb6a66476dbf78e6ce235e5", "score": "0.4587918", "text": "func (t sylledTrans) syllables() [][]string {\n\tres := [][]string{}\n\tthisSyllable := []string{}\n\tfor gi, g2p := range t.trans.phonemes {\n\t\tfor pi, p := range g2p.p {\n\t\t\tindex := boundary{g: gi, p: pi}\n\t\t\tif t.isBoundary(index) {\n\t\t\t\tres = append(res, thisSyllable)\n\t\t\t\tthisSyllable = []string{}\n\t\t\t}\n\t\t\tif len(p) > 0 {\n\t\t\t\tthisSyllable = append(thisSyllable, p)\n\t\t\t}\n\t\t}\n\t}\n\tres = append(res, thisSyllable)\n\t//fmt.Println(\"???\", t, res)\n\treturn res\n}", "title": "" }, { "docid": "43b8d465d41bcbd19dd24afcf4ac81ed", "score": "0.4572019", "text": "func WordCount(s string) map[string]int {\n\tresult := make(map[string]int)\n\tfor _, value := range strings.Fields(s) {\n\t\tresult[value] = result[value] + 1\n\t}\n\treturn result\n}", "title": "" }, { "docid": "7aea1b3c3c862603b15256e2b3e990c1", "score": "0.45490655", "text": "func howMany(sentence string) int {\n\n\tw := strings.Fields(sentence)\n\tn := len(w)\n\n\tfor i := 0; i < n; i++ {\n\n\t\tr := []rune(w[i])\n\n\t\tword := true\n\n\t\t// loop over every character in word, except last\n\t\tfor j := 0; j < len(r)-1; j++ {\n\t\t\tif !isLetter(r[j]) && r[j] != '-' {\n\t\t\t\tword = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\t// if all characters are letters so far, last character isn't a letter but is punct then end sentence\n\t\tlastChar := r[len(r)-1]\n\t\tif word && !isLetter(lastChar) {\n\t\t\tif isPunct(lastChar) {\n\n\t\t\t\tw = w[:i+1]\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\tword = false\n\t\t\t}\n\t\t}\n\n\t\t// if not a word then remove from slice, unless final word\n\t\tif !word {\n\t\t\tif i == n-1 {\n\t\t\t\tw = w[:i]\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tw = append(w[:i], w[i+1:]...)\n\t\t\tn -= 1\n\t\t\tcontinue\n\t\t}\n\n\t}\n\n\treturn len(w)\n}", "title": "" }, { "docid": "07b7b104d5c55e35005e5fc4f19e541a", "score": "0.4541326", "text": "func calculateLetterFrequencies(sentence string) FrequencyTable {\n\tvar absoluteFrequencies = make(map[rune]int)\n\tvar relativeFrequencies = make(FrequencyTable)\n\tvar total = 0\n\n\tfor _, char := range \"abcdefghijklmnopqrstuvwxyz\" {\n\t\tabsoluteFrequencies[char] = 0\n\t}\n\n\tfor _, char := range onlyAlphabeticCharacters(strings.ToLower(sentence)) {\n\t\tabsoluteFrequencies[char] += 1\n\t\ttotal += 1\n\t}\n\n\tfor char, count := range absoluteFrequencies {\n\t\trelativeFrequencies[char] = float64(count*100) / float64(total)\n\t}\n\n\treturn relativeFrequencies\n}", "title": "" }, { "docid": "3b6b80bbac5a0daa49e777f71fbf0ef0", "score": "0.45331413", "text": "func GetFreqencyLikelihood(s string) float64 {\n\tif len(englishFrequencies) == 0 {\n\t\tsetLikelihoods()\n\t}\n\tlikelihood := 0.0\n\tcountMap := GetCounts(s)\n\tfor k, count := range countMap {\n\t\tfreq, ok := englishFrequencies[k]\n\t\tif !ok {\n\t\t\tfreq = minFrequency\n\t\t}\n\t\t// likelihood -= math.Sqrt(math.Pow((float64(count)/float64(len(s)) - freq), 2))\n\t\tlikelihood += float64(count) * math.Log(freq)\n\n\t}\n\treturn likelihood\n}", "title": "" }, { "docid": "549711baf2670072b98912188fa69043", "score": "0.45259166", "text": "func minimumLengthEncoding(words []string) int {\n\tusedMap, uniqueWord := make(map[string]bool), make([]string, 0)\n\tfor _, word := range words {\n\t\tif !usedMap[word] {\n\t\t\tusedMap[word] = true\n\t\t\tuniqueWord = append(uniqueWord, word)\n\t\t}\n\t}\n\tl := len(uniqueWord)\n\tfor i := 0; i < l; i++ {\n\t\tword1 := uniqueWord[i]\n\t\tfor j := 0; j < l; j++ {\n\t\t\tif i == j {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tword2 := uniqueWord[j]\n\t\t\tif strings.HasSuffix(word1, word2) {\n\t\t\t\tusedMap[word2] = false\n\t\t\t}\n\t\t}\n\t}\n\tresult := 0\n\tfor word, used := range usedMap {\n\t\tif used {\n\t\t\tresult = result + len(word) + 1\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "5f694817215f0c7aafe26ac304f5e63a", "score": "0.45097372", "text": "func Fk(text string) float64 {\n\tsyllableCount := float64(syllables.In(text))\n\twordCnt := float64(CntWords(text))\n\tsentCnt := float64(CntSents(text))\n\treturn 0.39*(wordCnt/sentCnt) + 11.8*(syllableCount/wordCnt) - 15.59\n}", "title": "" }, { "docid": "bf8dd1ae609f74de2e8c75dd484aa970", "score": "0.45078874", "text": "func main() {\n\tfmt.Println(word.Count(quote.SunAlso))\n\n\tfor k, v := range word.UseCount(quote.SunAlso) {\n\t\tfmt.Println(v, k)\n\t}\n}", "title": "" }, { "docid": "818367fd502df961b74ca2d7537b4bd1", "score": "0.4504093", "text": "func width(str string) int {\n\tsum := 0\n\tfor _, c := range str {\n\t\tif utf8.RuneLen(c) > 1 {\n\t\t\tsum += 2\n\t\t} else {\n\t\t\tsum++\n\t\t}\n\t}\n\treturn sum\n}", "title": "" }, { "docid": "7ba16380f4e917a11a4008fcd3039cc0", "score": "0.44800952", "text": "func WordCount(phrase string) Frequency {\n\tm := make(Frequency)\n\ta := regexp.MustCompile(\"[,:\\n ]+\")\n\twords := a.Split(phrase, -1)\n\tfor _, word := range words {\n\t\tm[strings.Trim(strings.ToLower(word), \"'.!@$%^&\")]++\n\t}\n\treturn m\n}", "title": "" }, { "docid": "a0714cb0e24b5cb9c2906b23bce1275a", "score": "0.4470206", "text": "func wordCount(pathToFile string) map[string]int {\r\n\tcontext := readFile(pathToFile)\r\n\tlistWords := strings.Split(context, \" \")\r\n\tcountTable := make(map[string]int)\r\n\tfor _, word := range listWords {\r\n\t\tcountTable[word]++\r\n\t}\r\n\treturn countTable\r\n}", "title": "" }, { "docid": "34ae3c8682fa0a1806c5d962cda6f643", "score": "0.44699964", "text": "func Summarize(title, content string, paras []string) string {\n var sentences_map map[string]int\n if paras == nil {\n paras = paragraphs(content)\n }\n\n sentences_map = sentencesRanks(strings.Join(paras, \"\\n\\n\"))\n summary := []string{title}\n\n // highest scoring sentence from each paragraph\n for _,p := range paras {\n sentence := strings.TrimSpace(bestSentence(p, sentences_map))\n if sentence != \"\" {\n summary = append(summary, sentence)\n }\n }\n\n return strings.Join(summary, \". \")\n}", "title": "" }, { "docid": "2710f2a2d14df4c383e4390fe1fa6996", "score": "0.4464962", "text": "func CountWordsOcurrences(s string) map[string]int {\n\t// dict will hold dictionary of ocurrences of each letter\n\tvar dict = make(map[string]int)\n\n\t// Make a Regex to say we only want letters and numbers\n\treg, err := regexp.Compile(\"[^a-zA-Z0-9]+\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// separate strings by spaces\n\tsliceOfSeparatedStrings := strings.Split(sentence, \" \")\n\t// sliceOfSeparatedStrings2 := strings.Fields(sentence)\n\n\t// iterate over slice of words, clean each one, and then add to dictionary\n\t// adding one to the default. Since in golang when creating a new var, it takes\n\t// it's zero value, the value of dict[cleanedStr] on any first ocurrence will be zero\n\tfor _, str := range sliceOfSeparatedStrings {\n\t\tcleanedStr := reg.ReplaceAllString(str, \"\")\n\t\tdict[cleanedStr]++\n\t\t// dict[cleanedStr] = dict[cleanedStr] + 1\n\t}\n\n\treturn dict\n}", "title": "" }, { "docid": "0d702b76c5d35eacfc04f4c6d349ed3a", "score": "0.44559598", "text": "func (d *Document) Initialize() {\n\td.WordFrequency = make(map[string]int)\n\tfor _, s := range d.SentenceTokenizer.Tokenize(d.Content) {\n\t\twordCount := d.NumWords\n\t\td.NumSentences++\n\t\twords := []Word{}\n\t\tfor _, word := range d.WordTokenizer.Tokenize(s) {\n\t\t\td.NumCharacters += countChars(word)\n\t\t\tif _, found := d.WordFrequency[word]; found {\n\t\t\t\td.WordFrequency[word]++\n\t\t\t} else {\n\t\t\t\td.WordFrequency[word] = 1\n\t\t\t}\n\t\t\tsyllables := Syllables(word)\n\t\t\twords = append(words, Word{Text: word, Syllables: syllables})\n\t\t\td.NumSyllables += float64(syllables)\n\t\t\tif syllables > 2 {\n\t\t\t\td.NumPolysylWords++\n\t\t\t}\n\t\t\tif isComplex(word, syllables) {\n\t\t\t\td.NumComplexWords++\n\t\t\t}\n\t\t\td.NumWords++\n\t\t}\n\t\td.Sentences = append(d.Sentences, Sentence{\n\t\t\tText: s, Length: int(d.NumWords - wordCount), Words: words})\n\t}\n}", "title": "" }, { "docid": "efd1f6b71acbc5660753c9f3ed0c5b26", "score": "0.4450134", "text": "func WordCount(phrase string) (o Frequency) {\n\to = make(map[string]int)\n\tsplitted_str := strings.FieldsFunc(phrase, Split)\n\tfor _, aword := range splitted_str {\n\t\to[withoutPunctuation(aword)]++\n\t}\n\treturn\n}", "title": "" }, { "docid": "bf564bb74afbbb09febcce50744b487e", "score": "0.44486234", "text": "func OfWords(words []string) Corrector {\n trie := frequencytrie.ForCharacters()\n loadTrieWords(words, &trie)\n dictWords := makeDictOfWords(words)\n numWords := strconv.Itoa(len(dictWords))\n desc := \"Spelling corrector (words loaded: \" + numWords + \")\"\n return Corrector{descriptor: desc, dictionaryWords: dictWords, prefixTrie: &trie}\n}", "title": "" }, { "docid": "972754ba7ffa3cf2c3e22ecac7d5e92c", "score": "0.4444121", "text": "func Score(input string) int {\n\ttotal := 0\n\n\tfor _, ch := range input {\n\t\ti := unicode.ToLower(ch)\n\t\ttotal += values[i]\n\t}\n\treturn total\n}", "title": "" }, { "docid": "6b06bfae17e822d13ce30881dca54256", "score": "0.44434482", "text": "func wordPower(e *Expense, db *sql.DB) map[string]*([]int64) {\n\twords := make(map[string]*[]int64)\n\trows, err := db.Query(`\n\t\tselect\n\t\t\tdescription,\n\t\t\tc.cid\n\t\tfrom\n\t\t\texpenses e,\n\t\t\tclassifications c,\n\t\t\tclassificationdef cd\n\t\twhere\n\t\t\te.eid = c.eid\n\t\t\tand c.cid = cd.cid\n\t\t\tand c.confirmed\n\t\t\tand cd.validto = \"\"`)\n\tdefer rows.Close()\n\tif err != nil {\n\t\terrors.Print(err)\n\t}\n\tfor rows.Next() {\n\t\tvar desc string\n\t\tvar clas int64\n\t\trows.Scan(&desc, &clas)\n\t\tfor _, i := range strings.Split(strings.ToLower(desc), \" \") {\n\t\t\t// Minumum word length of 2\n\t\t\tif len(i) < 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif _, ok := words[i]; !ok {\n\t\t\t\twords[i] = new([]int64)\n\t\t\t}\n\t\t\t// extend the slice when we've got more classifications than expected\n\t\t\tfor int64(len(*words[i])) < clas+1 {\n\t\t\t\t*words[i] = append(*words[i], 0)\n\t\t\t}\n\t\t\t(*words[i])[clas]++\n\t\t}\n\t}\n\treturn words\n}", "title": "" }, { "docid": "084b54a2ec11d69c486d80b2f363b6ee", "score": "0.44406983", "text": "func CalculateAnagram(fileName string) (int, []string) {\n\tdefer utils.TimeTrack(time.Now(), \"calculate anagram \"+fileName)\n\twords := utils.ReadLines(fileName)\n\tanagrams := make(map[string][]string)\n\n\tvar largest string\n\tlargestLen := 0\n\tcount := 0\n\n\tfor _, word := range words {\n\t\tsorted := utils.SortAndLowercase(word)\n\t\t_, ok := anagrams[sorted]\n\t\tif !ok {\n\t\t\tanagrams[sorted] = []string{word}\n\t\t} else {\n\t\t\tif len(anagrams[sorted]) == 1 {\n\t\t\t\tcount++\n\t\t\t}\n\t\t\tanagrams[sorted] = append(anagrams[sorted], word)\n\t\t}\n\n\t\tif len(anagrams[sorted]) > largestLen {\n\t\t\tlargest = sorted\n\t\t\tlargestLen = len(anagrams[sorted])\n\t\t}\n\t}\n\n\treturn count, anagrams[largest]\n}", "title": "" }, { "docid": "02f4074ced2a2734a8c699fa03234595", "score": "0.44325322", "text": "func tallyWords(filename string, dict *words) error {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer file.Close()\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanWords)\n\tfor scanner.Scan() {\n\t\tword := strings.ToLower(scanner.Text())\n\t\tdict.add(word, 1)\n\t}\n\treturn scanner.Err()\n}", "title": "" }, { "docid": "2b9096c75556b1e5a6d3113e549d6413", "score": "0.4430015", "text": "func analyzeString(input string) (int, int) {\n\tdoubles := 0\n\ttriples := 0\n\n\t// Count the frequency of runes in the input string.\n\tdict := make(map[rune]int)\n\tfor _, r := range input {\n\t\tdict[r]++\n\t}\n\n\t// Tally up the doubles and triples.\n\tfor _, v := range dict {\n\t\tif v == 2 {\n\t\t\tdoubles = 1 // Per the instructions, count only once\n\t\t} else if v == 3 {\n\t\t\ttriples = 1 // Per the instructions, count only once\n\t\t}\n\t}\n\n\treturn doubles, triples\n}", "title": "" }, { "docid": "f2b57ec771293bc5bfa1d5247beaebb7", "score": "0.44261196", "text": "func Score(s string) int {\n\tscore := 0\n\n\tfor _, r := range strings.ToLower(s) {\n\t\tscore += characters[r]\n\t}\n\n\treturn score\n\n}", "title": "" }, { "docid": "5cb530e7934a6eee862d82453f020091", "score": "0.4420843", "text": "func WordCount(s string) map[string]int {\n\tresult:= make(map[string]int)\n\twords:=strings.Fields(s)\n\tfor i:= range words{\n\t\tword:=words[i]\n\t\tv, _ := result[word]\n\t\tv++\n\t\tresult[word]=v\n\t}\n\treturn result\n}", "title": "" }, { "docid": "2bf02a365d71920370deb1e487567238", "score": "0.44141155", "text": "func WordCount(s string) map[string]int {\n\twcMap := make(map[string]int)\n\tfor _, word := range strings.Fields(s) {\n\t\twcMap[word]++\n\t}\n\treturn wcMap\n}", "title": "" }, { "docid": "abe89f607501d06afa1742219b1661b6", "score": "0.44137162", "text": "func CharFreqScore(b []byte) float64 {\n\t// freq := map[byte]float64{'E': 12.02, 'T': 9.10, 'A': 8.12, 'O': 7.68, 'I': 7.31, 'N': 6.95, 'S': 6.28, 'R': 6.02, 'H': 5.92, 'D': 4.32, 'L': 3.98, 'U': 2.88, 'C': 2.71, 'M': 2.61, 'F': 2.30, 'Y': 2.11, 'W': 2.09, 'G': 2.03, 'P': 1.82, 'B': 1.49, 'V': 1.11, 'K': 0.69, 'X': 0.17, 'Q': 0.11, 'J': 0.10, 'Z': 0.07}\n\t/*\n\t\tswitched to this frequency distro\n\t\thttp://www.fitaly.com/board/domper3/posts/136.html\n\t*/\n\n\tfreqMap := map[byte]float64{9: 0.0057, 23: 0.0000, 32: 17.1662, 33: 0.0072, 34: 0.2442, 35: 0.0179, 36: 0.0561, 37: 0.0160, 38: 0.0226, 39: 0.2447, 40: 0.2178, 41: 0.2233, 42: 0.0628, 43: 0.0215, 44: 0.7384, 45: 1.3734, 46: 1.5124, 47: 0.1549, 48: 0.5516, 49: 0.4594, 50: 0.3322, 51: 0.1847, 52: 0.1348, 53: 0.1663, 54: 0.1153, 55: 0.1030, 56: 0.1054, 57: 0.1024, 58: 0.4354, 59: 0.1214, 60: 0.1225, 61: 0.0227, 62: 0.1242, 63: 0.1474, 64: 0.0073, 65: 0.3132, 66: 0.2163, 67: 0.3906, 68: 0.3151, 69: 0.2673, 70: 0.1416, 71: 0.1876, 72: 0.2321, 73: 0.3211, 74: 0.1726, 75: 0.0687, 76: 0.1884, 77: 0.3529, 78: 0.2085, 79: 0.1842, 80: 0.2614, 81: 0.0316, 82: 0.2519, 83: 0.4003, 84: 0.3322, 85: 0.0814, 86: 0.0892, 87: 0.2527, 88: 0.0343, 89: 0.0304, 90: 0.0076, 91: 0.0086, 92: 0.0016, 93: 0.0088, 94: 0.0003, 95: 0.1159, 96: 0.0009, 97: 5.1880, 98: 1.0195, 99: 2.1129, 100: 2.5071, 101: 8.5771, 102: 1.3725, 103: 1.5597, 104: 2.7444, 105: 4.9019, 106: 0.0867, 107: 0.6753, 108: 3.1750, 109: 1.6437, 110: 4.9701, 111: 5.7701, 112: 1.5482, 113: 0.0747, 114: 4.2586, 115: 4.3686, 116: 6.3700, 117: 2.0999, 118: 0.8462, 119: 1.3034, 120: 0.1950, 121: 1.1330, 122: 0.0596, 123: 0.0026, 124: 0.0007, 125: 0.0026, 126: 0.0003, 131: 0.0000, 149: 0.6410, 183: 0.0010, 223: 0.0000, 226: 0.0000, 229: 0.0000, 230: 0.0000, 237: 0.0000}\n\n\tvar sum float64\n\tfor _, j := range b {\n\t\tif f, ok := freqMap[j]; ok {\n\t\t\tsum += f\n\t\t}\n\t}\n\n\treturn sum\n}", "title": "" }, { "docid": "a8f7fc5408b2e8685d4dcca5e5606c98", "score": "0.4402351", "text": "func fmt_wordslen(f []fmt_, beg int32, end int32) int32 {\n\t// the total width of the specified words in f->words[]\n\tvar i int32\n\tvar w int32\n\tfor i = beg; i < end; i++ {\n\t\tw += f[0].words[i].wid + f[0].words[i].gap\n\t}\n\tif beg < end {\n\t\treturn w + f[0].words[end-1].hy\n\t}\n\treturn 0\n}", "title": "" }, { "docid": "10970e2e8c6ca79380e768f997233f80", "score": "0.4400417", "text": "func CountLettersAndSymbols(word string, letters map[string]int, \n symbols map[string]int, l_mu *sync.Mutex,\n s_mu *sync.Mutex, lc *uint64, sc *uint64) {\n for _, r := range word {\n s := strings.ToLower(string(r))\n if m, _ := regexp.MatchString(\"[a-z]\", s); m {\n l_mu.Lock()\n l_mu.Unlock()\n atomic.AddUint64(lc, 1)\n } else {\n s_mu.Lock()\n _, prs := symbols[s]\n if prs {\n symbols[s] = symbols[s] + 1\n } else {\n symbols[s] = 1\n }\n s_mu.Unlock()\n atomic.AddUint64(sc, 1)\n }\n }\n}", "title": "" }, { "docid": "3d61a8ea663554fd3d9b6191d9f256f5", "score": "0.43978322", "text": "func WordCount(s string) map[string]int {\n\tvar wcmap = make(map[string]int)\n\tvar ss = strings.Fields(s)\n\tfor _, v := range ss {\n\t\telem, ok := wcmap[string(v)]\n\t\tif ok == false {\n\t\t\twcmap[string(v)] = 1\n\t\t} else {\n\t\t\twcmap[string(v)] = elem + 1\n\t\t}\n\t}\n\treturn wcmap\n}", "title": "" }, { "docid": "abab17edd394f27105297ff70f547d5e", "score": "0.43935946", "text": "func (m *FontMetrics) Width(pt float64, text string) float64 {\n\tvar w float64\n\tfor _, r := range text {\n\t\tw += float64(m.RuneWidth[r]) * pt / 1000.0\n\t}\n\treturn w\n}", "title": "" }, { "docid": "aac4f3e05ad7c3bef2cff822c0ec65f9", "score": "0.4381315", "text": "func countConsistentStrings(allowed string, words []string) int {\n\tcount := 0\n\tfor _, v := range words {\n\t\ttoStr := strings.Split(v, \"\")\n\t\tallow := strings.Split(allowed, \"\")\n\t\twordLen := len(toStr)\n\t\tcountNum := 0\n\t\tfor _, v2 := range toStr {\n\t\t\tstatus := stringContain(allow, v2)\n\t\t\tif status {\n\t\t\t\tcountNum++\n\t\t\t}\n\t\t}\n\t\tif countNum == wordLen {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count\n\n}", "title": "" }, { "docid": "eb55251db7ad0dfc90f0c2f6a934e621", "score": "0.43792984", "text": "func sentencesIntersection(sent1, sent2 string) int {\n // split the sentence into words/tokens\n s1 := strings.Split(sent1, \" \") //unique\n s2 := strings.Split(sent2, \" \") //unique\n\n // if no intersection return 0\n if len(s1) + len(s2) == 0 {\n return 0\n }\n\n // normalize result by average number of words\n return len(wordIntersection(s1, s2)) / ((len(s1) + len(s2)) / 2)\n}", "title": "" }, { "docid": "d4340b7c4d195ca2d13cc47f06112266", "score": "0.4375192", "text": "func WordCount(s string) map[string]int {\n\tdic := make(map[string]int)\n\twords := strings.Fields(s);\n\tfor _, word := range words {\n\t\tif _, ok := dic[word]; ok {\n\t\t\tdic[word] += 1;\n\t\t} else {\n\t\t\tdic[word] = 1;\n\t\t}\n\t}\n\treturn dic\n}", "title": "" }, { "docid": "5c533085bf2933079df3fbd2e78d8f46", "score": "0.43695447", "text": "func WordCount(phrase string) Frequency {\n\tresult := Frequency{}\n\tisSeparator := func(c rune) bool {\n\t\tisInWord := unicode.IsLetter(c) || unicode.IsDigit(c) || c == '\\''\n\t\treturn !isInWord\n\t}\n\twords := strings.FieldsFunc(strings.ToLower(phrase), isSeparator)\n\tfor _, word := range words {\n\t\tword = removeQuotes(word)\n\t\tresult[word]++\n\t}\n\treturn result\n}", "title": "" }, { "docid": "42b977308128f4bd85026d3f6133f0ca", "score": "0.43666518", "text": "func main() {\n\tfmt.Println(WordsToMarks(\"attitude\"))\n}", "title": "" }, { "docid": "7b63ad24b4acfad41be15bd7a3ccfca2", "score": "0.43614587", "text": "func processText(text string) {\n\n\tresult := Result{\n\t\tPrepositions: 0,\n\t\tVerbs: 0,\n\t\tSubVerbs: 0,\n\t\tPrettyNumbers: 0,\n\t}\n\n\tseen := make(map[string]struct{})\n\n\twords := strings.Split(text, \" \")\n\n\tfor _, word := range words {\n\n\t\tif isPreposition(word) {\n\t\t\tresult.Prepositions++\n\t\t}\n\n\t\tif isVerb(word) {\n\t\t\tresult.Verbs++\n\n\t\t\tif isSubjunctiveVerb(word) {\n\t\t\t\tresult.SubVerbs++\n\t\t\t}\n\t\t}\n\n\t\tif _, seenBefore := seen[word]; !seenBefore {\n\t\t\tresult.Vocabulary = append(result.Vocabulary, word)\n\t\t\tseen[word] = struct{}{}\n\t\t}\n\t}\n\n\tgooglonSort(result.Vocabulary)\n\n\tfor _, distinctWord := range result.Vocabulary {\n\t\tif isPrettyNumber(distinctWord) {\n\t\t\tresult.PrettyNumbers++\n\t\t}\n\t}\n\n\tprintResults(result)\n}", "title": "" }, { "docid": "56263e48248a1518335e37cd1301b6a4", "score": "0.43595263", "text": "func WordCount(s string) map[string]int {\n\twords := strings.Fields(s)\n\tm := make(map[string]int)\n\tfor _, word := range words {\n\t\tm[word] += 1\n\t}\n\treturn m\n}", "title": "" }, { "docid": "f6adf46af3a47e9e90a66a40684fd066", "score": "0.4344441", "text": "func WordCount(word string, chatName string) {\n\twordCount.With(prometheus.Labels{\n\t\t\"host\": host,\n\t\t\"chat_name\": chatName,\n\t\t\"word\": word,\n\t}).Inc()\n}", "title": "" }, { "docid": "3d41ae187c05c3228c9f0ddc1b2b0592", "score": "0.43429005", "text": "func TestWidthGraphemesFunctionString(t *testing.T) {\n\tfor index, testCase := range widthTestCases {\n\t\tvar actual, width int\n\t\tstate := -1\n\t\ttext := testCase.original\n\t\tfor len(text) > 0 {\n\t\t\t_, text, width, state = FirstGraphemeClusterInString(text, state)\n\t\t\tactual += width\n\t\t}\n\t\tif actual != testCase.expected {\n\t\t\tt.Errorf(\"Width of %q is %d, expected %d (test case %d)\", testCase.original, actual, testCase.expected, index)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "49586cd57bd8fdd22d31e6b2099141db", "score": "0.4337753", "text": "func AddWordsToInterests (interestsMap []map[string]int, words trendings.WordsList, interests []string) {\n\t//fmt.Println(interests)\n\t// We calculate totalWords\n\ttotalWords := 0\n\tfor i:=0; i<len(words); i++ {\n\t\ttotalWords = totalWords + words[i].Value\n\t}\n\tfmt.Println(\"Palabras totales:\", totalWords)\n\tnormalizedWords := make(trendings.WordsList, len(words)) \n\tmod := 1\n\tfor i:=0; i<len(words); i++ {\n\t\tmod = 1\n\t\tif i == 0 {mod = 3}\n\t\tif i == 1 {mod = 3}\n\t\tif i == 2 {mod = 12}\n\t\tif i == 3 {mod = 6}\n\t\tif i == 4 {mod = 4}\n\t\tif i == 5 {mod = 1}\n\t\tif i == 6 {mod = 3}\n\t\tif i == 7 {mod = 3}\n\t\tif i == 8 {mod = 6}\n\t\tif i == 9 {mod = 24}\n\t\tif i == 10 {mod = 4}\n\t\tif i == 11 {mod = 2}\n\t\tif i == 12 {mod = 2}\n\t\tif i == 13 {mod = 6}\n\t\tif i == 14 {mod = 3}\n\t\tnormalizedWords[i].Word = words[i].Word\n\t\tnormalizedWords[i].Value = (words[i].Value * 1000000 * mod) / totalWords\n\t}\n\tfor i:=0; i<len(interests); i++ {\n\n\t\tswitch interests[i]{\n\t\t\tcase \"famosos\": \t\t\t// 0 \n\t\t\t\tAddWordsToMapGeneric(interestsMap[0], normalizedWords)\n\t\t\tcase \"futbol\": \t\t\t\t// 1\n\t\t\t\tAddWordsToMapGeneric(interestsMap[1], normalizedWords)\n\t\t\tcase \"tenis\":\t\t\t\t// 2\n\t\t\t\tAddWordsToMapGeneric(interestsMap[2], normalizedWords)\n\t\t\tcase \"baloncesto\":\t\t\t// 3\n\t\t\t\tAddWordsToMapGeneric(interestsMap[3], normalizedWords)\n\t\t\tcase \"otrosdeportes\":\t\t// 4\n\t\t\t\tAddWordsToMapGeneric(interestsMap[4], normalizedWords)\n\t\t\tcase \"tecnologia\":\t\t\t// 5\n\t\t\t\tAddWordsToMapGeneric(interestsMap[5], normalizedWords)\n\t\t\tcase \"lectura\":\t\t\t\t// 6\n\t\t\t\tAddWordsToMapGeneric(interestsMap[6], normalizedWords)\n\t\t\tcase \"cine\":\t\t\t\t// 7\n\t\t\t\tAddWordsToMapGeneric(interestsMap[7], normalizedWords)\n\t\t\tcase \"arte\":\t\t\t\t// 8\n\t\t\t\tAddWordsToMapGeneric(interestsMap[8], normalizedWords)\n\t\t\tcase \"anime\":\t\t\t\t// 9\n\t\t\t\tAddWordsToMapGeneric(interestsMap[9], normalizedWords)\n\t\t\tcase \"videojuegos\":\t\t\t// 10\n\t\t\t\tAddWordsToMapGeneric(interestsMap[10], normalizedWords)\n\t\t\tcase \"musica\":\t\t\t\t// 11\n\t\t\t\tAddWordsToMapGeneric(interestsMap[11], normalizedWords)\n\t\t\tcase \"series\":\t\t\t\t// 12\n\t\t\t\tAddWordsToMapGeneric(interestsMap[12], normalizedWords)\n\t\t\tcase \"marketing\":\t\t\t// 13\n\t\t\t\tAddWordsToMapGeneric(interestsMap[13], normalizedWords)\n\t\t\tcase \"moda\":\t\t\t\t// 14\n\t\t\t\tAddWordsToMapGeneric(interestsMap[14], normalizedWords)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f488ebaa0675f70d50a8d2b7109e144d", "score": "0.43356803", "text": "func ScoreResult(inBytes []byte) float64 {\n\t// [rune]flat64 map\n\t// Statistical letter frequencies taken from https://cs.wellesley.edu/~fturbak/codman/letterfreq.html\n\t// Value for space was estimated to 0.20\n\tvar letterFreq = make(map[rune]float64)\n\tletterFreq['E'] = 0.124167\n\tletterFreq['T'] = 0.0969225\n\tletterFreq['A'] = 0.0820011\n\tletterFreq['O'] = 0.0714095\n\tletterFreq['I'] = 0.0768052\n\tletterFreq['N'] = 0.0764055\n\tletterFreq['S'] = 0.0706768\n\tletterFreq['R'] = 0.0668132\n\tletterFreq['H'] = 0.0350386\n\tletterFreq['D'] = 0.0363709\n\tletterFreq['L'] = 0.0448308\n\tletterFreq['U'] = 0.028777\n\tletterFreq['C'] = 0.0344391\n\tletterFreq['M'] = 0.0281775\n\tletterFreq['F'] = 0.0235145\n\tletterFreq['Y'] = 0.0189182\n\tletterFreq['W'] = 0.0135225\n\tletterFreq['G'] = 0.0181188\n\tletterFreq['P'] = 0.0203171\n\tletterFreq['B'] = 0.0106581\n\tletterFreq['V'] = 0.0124567\n\tletterFreq['K'] = 0.00393019\n\tletterFreq['X'] = 0.00219824\n\tletterFreq['Q'] = 0.0009325\n\tletterFreq['J'] = 0.0019984\n\tletterFreq['Z'] = 0.000599\n\tletterFreq[' '] = 0.20\n\n\t// variable containing score\n\tvar phraseScore float64 = 0\n\n\t// iterates through byte string, looks for rune value in frequency table.\n\t// If in table, it adds the associated value to the phraseScore variable\n\tfor _, let := range inBytes {\n\t\tval, ok := letterFreq[unicode.ToUpper(rune(let))]\n\n\t\tif ok {\n\t\t\tphraseScore += val\n\t\t}\n\n\t}\n\treturn phraseScore\n}", "title": "" }, { "docid": "a7b86e8336064685e613648fd7d93356", "score": "0.43240374", "text": "func AddWordsToPersonality (personalityMap []map[string]int, words trendings.WordsList, timelineScores Scores) {\n\t// We calculate totalWords\n\ttotalWords := 0\n\tfor i:=0; i<len(words); i++ {\n\t\ttotalWords = totalWords + words[i].Value\n\t}\n\tmod := 1\n\tfmt.Println(\"Palabras totales:\", totalWords)\n\tnormalizedWords := make(trendings.WordsList, len(words)) \n\tfor i:=0; i<len(words); i++ {\n\t\tmod = 1\n\t\tif i == 0 {mod = 2}\n\t\tif i == 2 {mod = 2}\n\t\tif i == 5 {mod = 3}\n\t\tif i == 7 {mod = 2}\n\t\tif i == 8 {mod = 3}\n\t\t\n\t\tnormalizedWords[i].Word = words[i].Word\n\t\tnormalizedWords[i].Value = (words[i].Value * 1000000 * mod) / totalWords\n\t}\n\t\n\t\n\t// Aqui se podria añadir mas palabras si el score es mayor... de momento si pasa de 6 añadimos las palabras y ya sta\n\tif timelineScores.Introvertido > 6 \t\t{\tAddWordsToMapGeneric(personalityMap[0], normalizedWords)\t}\n\tif timelineScores.Extrovertido > 6 \t\t{\tAddWordsToMapGeneric(personalityMap[1], normalizedWords)\t}\n\tif timelineScores.Agresivo > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[2], normalizedWords)\t}\n\tif timelineScores.Calmado > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[3], normalizedWords)\t}\n\tif timelineScores.Positivo > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[4], normalizedWords)\t}\n\tif timelineScores.Negativo > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[5], normalizedWords)\t}\n\tif timelineScores.Lider > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[6], normalizedWords)\t}\n\tif timelineScores.Sedejallevar > 6 \t\t{\tAddWordsToMapGeneric(personalityMap[7], normalizedWords)\t}\n\tif timelineScores.Metodico > 6 \t\t\t{\tAddWordsToMapGeneric(personalityMap[8], normalizedWords)\t}\n\tif timelineScores.Desordenado > 6 \t\t{\tAddWordsToMapGeneric(personalityMap[9], normalizedWords)\t}\n}", "title": "" }, { "docid": "6b75e6a07b8b319e995c1b7922b84930", "score": "0.43193692", "text": "func WordCount(text string) map[string]int {\n\tlog.Info().Msg(\"in WordCount\")\n\n\tif len(text) == 0 {\n\t\tlog.Error().Msg(\"in WordCount - empty text found\")\n\t\treturn nil\n\t}\n\n\twc := map[string]int{}\n\ttokens := TokenizeText(text)\n\tfor _, item := range tokens {\n\t\tif _, exist := wc[item]; exist {\n\t\t\twc[item] = wc[item] + 1\n\t\t} else {\n\t\t\twc[item] = 1\n\t\t}\n\t}\n\n\treturn wc\n}", "title": "" }, { "docid": "9e12dc885e75d9574a0346482959d313", "score": "0.42904463", "text": "func (p *Paragraph) getTextWidth() float64 {\n\tw := 0.0\n\n\tfor _, r := range p.text {\n\t\t// Ignore newline for this.. Handles as if all in one line.\n\t\tif r == '\\u000A' { // LF\n\t\t\tcontinue\n\t\t}\n\n\t\tmetrics, found := p.textFont.GetRuneMetrics(r)\n\t\tif !found {\n\t\t\tcommon.Log.Debug(\"ERROR: Rune char metrics not found! (rune 0x%04x=%c)\", r, r)\n\t\t\treturn -1 // FIXME: return error.\n\t\t}\n\t\tw += p.fontSize * metrics.Wx\n\t}\n\n\treturn w\n}", "title": "" }, { "docid": "a044e9558953de0207c41d2c2a8af853", "score": "0.42842522", "text": "func (s *Streeng) Words(index int) string {\n\tif index >= 0 {\n\t\treturn s.words[index]\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1fab6347f419519af36d9bc87981c82f", "score": "0.42822692", "text": "func KLengthWords(given string, k int) {\n\tcount = 0\n\tans := \"\"\n\thelperLengthWords(given, ans, k, 0, 0)\n\tfmt.Println(count)\n}", "title": "" } ]
4de984bc4d073bf07d49929922bd5bbc
NewAssigntokenCaller creates a new readonly instance of Assigntoken, bound to a specific deployed contract.
[ { "docid": "9c63e45a1da1accbc6bb26fe5bc6a247", "score": "0.7833713", "text": "func NewAssigntokenCaller(address common.Address, caller bind.ContractCaller) (*AssigntokenCaller, error) {\n\tcontract, err := bindAssigntoken(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AssigntokenCaller{contract: contract}, nil\n}", "title": "" } ]
[ { "docid": "758c0a4aa652140b986102347b1766f1", "score": "0.67624027", "text": "func NewAssigntoken(address common.Address, backend bind.ContractBackend) (*Assigntoken, error) {\n\tcontract, err := bindAssigntoken(address, backend, backend)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Assigntoken{AssigntokenCaller: AssigntokenCaller{contract: contract}, AssigntokenTransactor: AssigntokenTransactor{contract: contract}}, nil\n}", "title": "" }, { "docid": "113d8f9dcd178cb1614e497a08099ba5", "score": "0.6553007", "text": "func bindAssigntoken(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor) (*bind.BoundContract, error) {\n\tparsed, err := abi.JSON(strings.NewReader(AssigntokenABI))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bind.NewBoundContract(address, parsed, caller, transactor), nil\n}", "title": "" }, { "docid": "d79139be762a2b4d7f395be9e30b1d03", "score": "0.59013027", "text": "func DeployAssigntoken(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *Assigntoken, error) {\n\tparsed, err := abi.JSON(strings.NewReader(AssigntokenABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(AssigntokenBin), backend)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &Assigntoken{AssigntokenCaller: AssigntokenCaller{contract: contract}, AssigntokenTransactor: AssigntokenTransactor{contract: contract}}, nil\n}", "title": "" }, { "docid": "8d3e30e8bc98386850ceee165ef6924a", "score": "0.57802933", "text": "func NewAssigntokenTransactor(address common.Address, transactor bind.ContractTransactor) (*AssigntokenTransactor, error) {\n\tcontract, err := bindAssigntoken(address, nil, transactor)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AssigntokenTransactor{contract: contract}, nil\n}", "title": "" }, { "docid": "f3ec1e5ed34e60cc5649ca8d1cb0bab8", "score": "0.5581759", "text": "func (_Assigntoken *AssigntokenRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Assigntoken.Contract.AssigntokenCaller.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "481a19bae489141b52710acc1b906aa5", "score": "0.55095345", "text": "func (_Assigntoken *AssigntokenTransactor) AssignToken(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Assigntoken.contract.Transact(opts, \"assignToken\")\n}", "title": "" }, { "docid": "e46bef1e84a5d26562237de6040bf3d0", "score": "0.5393502", "text": "func NewAssign(securityTagID, vmID string) *AssignSecurityTagAPI {\n\tthis := new(AssignSecurityTagAPI)\n\tthis.BaseAPI = api.NewBaseAPI(http.MethodPut, \"/api/2.0/services/securitytags/tag/\"+securityTagID+\"/vm/\"+vmID, nil, nil)\n\treturn this\n}", "title": "" }, { "docid": "fb1c5b388084629a98cf7f13dd39dd25", "score": "0.53717196", "text": "func (_Assigntoken *AssigntokenCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error {\n\treturn _Assigntoken.Contract.contract.Call(opts, result, method, params...)\n}", "title": "" }, { "docid": "fd167fa846255ad4d4fd2289d29120b1", "score": "0.53000116", "text": "func (_Assigntoken *AssigntokenTransactorSession) AssignToken() (*types.Transaction, error) {\n\treturn _Assigntoken.Contract.AssignToken(&_Assigntoken.TransactOpts)\n}", "title": "" }, { "docid": "2590b72e56dcb8886ea82a29b1a2e5dd", "score": "0.5114458", "text": "func new_contract(caller ContractRef, object ContractRef, value *uint256.Int) *Contract {\n\tc := &Contract{CallerAddress: caller.Address(), caller: caller, self: object}\n\n\tc.value = value\n\n\treturn c\n}", "title": "" }, { "docid": "987c32722632031257addef63e81ab40", "score": "0.51119787", "text": "func (_Assigntoken *AssigntokenSession) AssignToken() (*types.Transaction, error) {\n\treturn _Assigntoken.Contract.AssignToken(&_Assigntoken.TransactOpts)\n}", "title": "" }, { "docid": "ecd333b7cbd970fa199cf4401da0cdf3", "score": "0.5034308", "text": "func (_Assigntoken *AssigntokenCallerSession) Impl() (common.Address, error) {\n\treturn _Assigntoken.Contract.Impl(&_Assigntoken.CallOpts)\n}", "title": "" }, { "docid": "7c3abd2b8d2c5d2dc95097f94752af50", "score": "0.5014426", "text": "func (_Assigntoken *AssigntokenSession) Impl() (common.Address, error) {\n\treturn _Assigntoken.Contract.Impl(&_Assigntoken.CallOpts)\n}", "title": "" }, { "docid": "7959583aa9eff2ceec8307e746bb589a", "score": "0.4999278", "text": "func NewEncTokenCaller(address common.Address, caller bind.ContractCaller) (*EncTokenCaller, error) {\n\tcontract, err := bindEncToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &EncTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "a4d37401fae9201bab24ad3383eb3e3c", "score": "0.49844933", "text": "func (ti *TokenIssue) newToken(\n\ttokenAddress types.Address,\n\towner types.Address,\n\tname string,\n\tsymbol string,\n\ttotalSupply bn.Number,\n\taddSupplyEnabled bool,\n\tburnEnabled bool,\n\tgasPrice int64,\n\torgName string) {\n\t// If it owns a token, it's not the genesis contract, cannot execute this function.\n\tsdk.Require(ti.sdk.Message().Contract().Token() == \"\",\n\t\ttypes.ErrNoAuthorization, \"The contract has already registered a token\")\n\n\tsdk.Require(totalSupply.IsEqualI(0) || totalSupply.IsGEI(minTotalsupply),\n\t\ttypes.ErrInvalidParameter, \"Invalid total supply\")\n\n\tsdk.Require(gasPrice >= ti.sdk.Helper().TokenHelper().BaseGasPrice() && gasPrice <= maxGasPrice,\n\t\ttypes.ErrInvalidParameter, \"Invalid gas price\")\n\n\tif orgName == \"\" {\n\t\ttoken := ti.setNewToken(tokenAddress, owner, name, symbol, totalSupply, addSupplyEnabled, burnEnabled, gasPrice, \"\", \"\")\n\t\tti.setNewContract(nil, token, ti.contractNameBRC20(name))\n\t} else {\n\t\ttoken := ti.setNewToken(tokenAddress, owner, name, symbol, totalSupply, addSupplyEnabled, burnEnabled, gasPrice, orgName, \"BRC30\")\n\t\tti.setNewContract(nil, token, ti.contractNameBRC30(orgName, name))\n\t}\n\n}", "title": "" }, { "docid": "892dbd8c49a547ba9966b15c252faebe", "score": "0.4967869", "text": "func newToken(client *api.Client, cred map[string]string) (string, error) {\n\tif cred[\"token\"] != \"\" {\n\t\treturn cred[\"token\"], nil\n\t}\n\n\tvar url string\n\tvar data map[string]interface{}\n\n\tswitch cred[\"method\"] {\n\tcase \"userpass\":\n\t\turl = \"/auth/userpass/login/\" + cred[\"username\"]\n\t\tdata = map[string]interface{}{\n\t\t\t\"password\": cred[\"password\"],\n\t\t}\n\tcase \"cert\":\n\t\turl = \"/auth/cert/login/\"\n\t\tdata = map[string]interface{}{\n\t\t\t\"name\": cred[\"certificate\"],\n\t\t}\n\t}\n\n\tresp, err := client.Logical().Write(url, data)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\ttoken := resp.Auth.ClientToken\n\n\treturn token, nil\n}", "title": "" }, { "docid": "be4ff90f3b0292ac177d389756d14877", "score": "0.49396005", "text": "func NewBEP20TokenCaller(address common.Address, caller bind.ContractCaller) (*BEP20TokenCaller, error) {\n\tcontract, err := bindBEP20Token(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BEP20TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "51601f6d8915b82d658e88b4c70fb98f", "score": "0.48328787", "text": "func NewStandardTokenCaller(address common.Address, caller bind.ContractCaller) (*StandardTokenCaller, error) {\n\tcontract, err := bindStandardToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &StandardTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "cb047c4d709f8ed243784ec9a0f10a92", "score": "0.48276395", "text": "func NewStandardTokenCaller(address common.Address, caller bind.ContractCaller) (*StandardTokenCaller, error) {\n\tcontract, err := bindStandardToken(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &StandardTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "1b24f8fbae725daf188332c7a8822ed4", "score": "0.48272893", "text": "func NewPausableTokenMockCaller(address common.Address, caller bind.ContractCaller) (*PausableTokenMockCaller, error) {\n\tcontract, err := bindPausableTokenMock(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &PausableTokenMockCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "1c43a462a1bae1a83568c0f4b113050c", "score": "0.4802432", "text": "func createAssigner(c context.Context, id string) *model.Assigner {\n\tvar cfg config.Assigner\n\tSo(proto.UnmarshalText(util.SampleValidAssignerCfg, &cfg), ShouldBeNil)\n\tcfg.Id = id\n\n\tSo(UpdateAssigners(c, []*config.Assigner{&cfg}, \"rev-1\"), ShouldBeNil)\n\tdatastore.GetTestable(c).CatchupIndexes()\n\tassigner, err := GetAssigner(c, id)\n\tSo(assigner.ID, ShouldEqual, id)\n\tSo(err, ShouldBeNil)\n\tSo(assigner, ShouldNotBeNil)\n\n\treturn assigner\n}", "title": "" }, { "docid": "6d59a13030eb91ee3e71130fcf00cf60", "score": "0.47671637", "text": "func (_StampCollection *StampCollectionCallerSession) NewContractAddress() (common.Address, error) {\n\treturn _StampCollection.Contract.NewContractAddress(&_StampCollection.CallOpts)\n}", "title": "" }, { "docid": "4c8d0543be5bbde4cf09a0e009de8f89", "score": "0.4761113", "text": "func NewStampMintingCaller(address common.Address, caller bind.ContractCaller) (*StampMintingCaller, error) {\n\tcontract, err := bindStampMinting(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &StampMintingCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "dec249b185ea8216ce98f6c3f99e1d22", "score": "0.46763358", "text": "func getNewToken(t *testing.T, authorizedAction string) string {\n\tctx := context.Background()\n\n\tauthnConnection, err := suite.connFactory.DialContext(\n\t\tctx,\n\t\t\"authn-service\",\n\t\tauthNAddress,\n\t\tgrpc.WithBlock(),\n\t)\n\trequire.NoError(t, err)\n\tdefer authnConnection.Close() // nolint: errcheck\n\n\tauthnClient := authn.NewTokensMgmtServiceClient(authnConnection)\n\n\tctx = auth_context.NewOutgoingContext(auth_context.NewContext(ctx,\n\t\t[]string{\"tls:service:deployment-service:internal\"}, []string{}, \"res\", \"act\"))\n\tresponse, err := authnClient.CreateToken(ctx, &authn.CreateTokenReq{\n\t\tId: uuid.Must(uuid.NewV4()).String(),\n\t\tName: \"token for event-service integration test\",\n\t\tActive: true,\n\t\tProjects: []string{},\n\t})\n\trequire.NoError(t, err)\n\n\tpolID := \"nats-test-policy-\" + uuid.Must(uuid.NewV4()).String()\n\t_, err = suite.AuthzClient.CreatePolicy(ctx, &policies.CreatePolicyReq{\n\t\tId: polID,\n\t\tName: polID,\n\t\tMembers: []string{fmt.Sprintf(\"token:%s\", response.Id)},\n\t\tStatements: []*policies.Statement{\n\t\t\t&policies.Statement{\n\t\t\t\tEffect: policies.Statement_ALLOW,\n\t\t\t\tActions: []string{authorizedAction},\n\t\t\t\tProjects: []string{\"*\"},\n\t\t\t},\n\t\t},\n\t\tProjects: []string{},\n\t})\n\trequire.NoError(t, err)\n\n\treturn response.Value\n}", "title": "" }, { "docid": "60ea038a60ef94cfd9a03ae6a552ceaa", "score": "0.46615997", "text": "func NewStockTokenCaller(address common.Address, caller bind.ContractCaller) (*StockTokenCaller, error) {\n\tcontract, err := bindStockToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &StockTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "11ef8546a729a7efbb7a29f0dc3f54d9", "score": "0.46613184", "text": "func (_Assigntoken *AssigntokenCallerSession) CheckAssignToken() (bool, error) {\n\treturn _Assigntoken.Contract.CheckAssignToken(&_Assigntoken.CallOpts)\n}", "title": "" }, { "docid": "fcc8ab7057e2acbc93355444f5325653", "score": "0.46534953", "text": "func (_Assigntoken *AssigntokenCaller) CheckAssignToken(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Assigntoken.contract.Call(opts, out, \"checkAssignToken\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e1b8a60da9749bad66cedba5c4c75189", "score": "0.46494377", "text": "func NewERC20AtomicSwapperCaller(address common.Address, caller ContractCaller) (*ERC20AtomicSwapperCaller, error) {\n\tcontract, err := bindERC20AtomicSwapper(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ERC20AtomicSwapperCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "645c8aafa3b44e7104b4e2ef8cd3c9a2", "score": "0.46355647", "text": "func (_KittyCore *KittyCoreCallerSession) NewContractAddress() (common.Address, error) {\n\treturn _KittyCore.Contract.NewContractAddress(&_KittyCore.CallOpts)\n}", "title": "" }, { "docid": "2d5b59d19cfaf6b9dc05206283726f7e", "score": "0.46320683", "text": "func newPermAddr(permission, name string) permAddr {\n\treturn permAddr{\n\t\tpermission: permission,\n\t\taddress: types.NewModuleAddress(name),\n\t}\n}", "title": "" }, { "docid": "4a50c35c68eb917b37d93a3f293f61a1", "score": "0.4586135", "text": "func NewDummyERC20TokenCaller(address common.Address, caller bind.ContractCaller) (*DummyERC20TokenCaller, error) {\n\tcontract, err := bindDummyERC20Token(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &DummyERC20TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "ae9b539a832aefd89aa3078432380e82", "score": "0.4573943", "text": "func newCPUGrant(n Node, c cache.Container, exclusive cpuset.CPUSet, portion int) CPUGrant {\n\treturn &cpuGrant{\n\t\tnode: n,\n\t\tcontainer: c,\n\t\texclusive: exclusive,\n\t\tportion: portion,\n\t}\n}", "title": "" }, { "docid": "b480ff1a7a493856de053e1c5a303cb7", "score": "0.45518625", "text": "func NewEditableCaller(address common.Address, caller bind.ContractCaller) (*EditableCaller, error) {\n\tcontract, err := bindEditable(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &EditableCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "c50ad462cab43435a00b45b74a16294f", "score": "0.4548822", "text": "func NewTestDepositTokenContractCaller(address common.Address, caller bind.ContractCaller) (*TestDepositTokenContractCaller, error) {\n\tcontract, err := bindTestDepositTokenContract(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TestDepositTokenContractCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "da7e54adfc47e846ef048ec6d5c973a8", "score": "0.45402473", "text": "func (_DummyERC20Token *DummyERC20TokenTransactor) Approve(opts *bind.TransactOpts, _spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _DummyERC20Token.contract.Transact(opts, \"approve\", _spender, _value)\n}", "title": "" }, { "docid": "69d0a66668ba19594d43c7346a971761", "score": "0.4529193", "text": "func NewContractSubmitter(t mockConstructorTestingTNewContractSubmitter) *ContractSubmitter {\n\tmock := &ContractSubmitter{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "a50b1d7d5f8b486c9dd89a44c477701d", "score": "0.4526717", "text": "func (_Assigntoken *AssigntokenRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) {\n\treturn _Assigntoken.Contract.AssigntokenTransactor.contract.Transact(opts, method, params...)\n}", "title": "" }, { "docid": "92a82a23cdb9e25384ca70c98930f76e", "score": "0.4498745", "text": "func NewStandardTokenMockCaller(address common.Address, caller bind.ContractCaller) (*StandardTokenMockCaller, error) {\n\tcontract, err := bindStandardTokenMock(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &StandardTokenMockCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "79237831506fe5530acd3f95b09c09a4", "score": "0.4487796", "text": "func (cidr *CidrMap) NewAssignment(dcid int, nickname string) *CidrAssignment {\n cidrAssign := &CidrAssignment{}\n cidrAssign.DatacenterId = dcid\n cidrAssign.Nickname = nickname\n\n return cidrAssign \n}", "title": "" }, { "docid": "00ec0f65abe48ab9c733854b62ba76a2", "score": "0.4480045", "text": "func NewMapperCaller(address common.Address, caller bind.ContractCaller) (*MapperCaller, error) {\n\tcontract, err := bindMapper(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &MapperCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "ee1c215808ac661b54b2bce047850e53", "score": "0.44687563", "text": "func NewAccessToken(name, issuer, clientID, scope string, persona *cpb.TestPersona) (ga4gh.AccessJWT, string, error) {\n\tnow := time.Now().Unix()\n\tsub := name\n\temail := name\n\tpatient := \"\"\n\tfhirUser := \"\"\n\tif persona != nil {\n\t\tif s := getStandardClaim(persona, \"sub\"); len(s) > 0 {\n\t\t\tsub = s\n\t\t\temail = s\n\t\t}\n\t\tif e := getStandardClaim(persona, \"email\"); len(e) > 0 {\n\t\t\temail = e\n\t\t}\n\t\tpatient = getStandardClaim(persona, \"patient\")\n\t\tfhirUser = getStandardClaim(persona, \"fhirUser\")\n\t}\n\tif len(scope) == 0 {\n\t\tscope = DefaultScope\n\t}\n\td := &ga4gh.AccessData{\n\t\tStdClaims: ga4gh.StdClaims{\n\t\t\tIssuer: issuer,\n\t\t\tSubject: sub,\n\t\t\tIssuedAt: now,\n\t\t\tExpiresAt: now + 10000,\n\t\t\tAudience: ga4gh.NewAudience(clientID),\n\t\t\tID: \"token-id-\" + name,\n\t\t},\n\t\tScope: scope,\n\t\tIdentities: map[string][]string{\n\t\t\temail: []string{\"IC\", \"DAM\"},\n\t\t},\n\t\tPatient: patient,\n\t\tFhirUser: fhirUser,\n\t}\n\n\tctx := context.Background()\n\tsigner := signer(&personaKey)\n\n\taccess, err := ga4gh.NewAccessFromData(ctx, d, signer)\n\tif err != nil {\n\t\treturn \"\", \"\", err\n\t}\n\treturn access.JWT(), sub, nil\n}", "title": "" }, { "docid": "bd5067cf0406398ef2d13ee725af6226", "score": "0.44650787", "text": "func (_DummyERC20Token *DummyERC20TokenSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _DummyERC20Token.Contract.Approve(&_DummyERC20Token.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "8bb0cabe13d3d01af866b277709dc46f", "score": "0.4463497", "text": "func (_Assigntoken *AssigntokenCaller) Impl(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Assigntoken.contract.Call(opts, out, \"impl\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "135f2c13575e7910ca5e5a9d97fab326", "score": "0.4458815", "text": "func newTokenManager(config *aws.Config, initFunc func() (*token.Token, error), authEndPoint string,\n\tadvisoryRefreshTimeout, mandatoryRefreshTimeout func(time.Duration) time.Duration, timeFunc func() time.Time,\n\tclient IBMClientDo) *defaultTMImplementation {\n\t// if no time function passed uses the time.Now\n\tif timeFunc == nil {\n\t\ttimeFunc = time.Now\n\t}\n\n\t// if no value passed use the one stored as global\n\tif advisoryRefreshTimeout == nil {\n\t\tadvisoryRefreshTimeout = DefaultAdvisoryTimeoutFunc\n\t}\n\n\t// if no value passed use the one stored as global\n\tif mandatoryRefreshTimeout == nil {\n\t\tmandatoryRefreshTimeout = DefaultMandatoryTimeoutFunc\n\t}\n\n\t// checks the logLevel and logger,\n\t// only sets the loveLevel when logLevel and logger are not ZERO values\n\t// helps reducing the logic since logLevel needs to be checked\n\tlogLevel := aws.LogLevel(aws.LogOff)\n\tif config != nil && config.LogLevel != nil && config.Logger != nil {\n\t\tlogLevel = config.LogLevel\n\t}\n\n\t// builds a defaultTMImplementation using the provided parameters\n\ttm := &defaultTMImplementation{\n\t\tauthEndPoint: authEndPoint,\n\t\tclient: client,\n\t\tadvisoryRefreshTimeout: advisoryRefreshTimeout,\n\t\tmandatoryRefreshTimeout: mandatoryRefreshTimeout,\n\t\ttimeProvider: timeFunc,\n\t\tinitFunc: initFunc,\n\n\t\tlogLevel: logLevel,\n\t\tlogger: config.Logger,\n\t}\n\treturn tm\n}", "title": "" }, { "docid": "e955a1376e44f237c7d8ab8011f59493", "score": "0.44559014", "text": "func (_DummyERC20Token *DummyERC20TokenTransactorSession) Approve(_spender common.Address, _value *big.Int) (*types.Transaction, error) {\n\treturn _DummyERC20Token.Contract.Approve(&_DummyERC20Token.TransactOpts, _spender, _value)\n}", "title": "" }, { "docid": "19740781edd6efbb9d907b18fdb19099", "score": "0.44508576", "text": "func (_Assigntoken *AssigntokenSession) CheckAssignToken() (bool, error) {\n\treturn _Assigntoken.Contract.CheckAssignToken(&_Assigntoken.CallOpts)\n}", "title": "" }, { "docid": "04c21ae1873f88d89d32ce63440dce06", "score": "0.44386345", "text": "func (s *BaseNuggetListener) EnterAssign(ctx *AssignContext) {}", "title": "" }, { "docid": "e522ba2b8a3861f9665bfa1b0a5ca58b", "score": "0.4437227", "text": "func newTokenSource(ctx context.Context, conf *clientcredentials.Config) oauth2.TokenSource {\n\tsource := &tokenSource{\n\t\tctx: ctx,\n\t\tconf: conf,\n\t\torig: conf.TokenSource(ctx),\n\t}\n\treturn source\n}", "title": "" }, { "docid": "d8e9f596bc2eae2c6161c2d9fec9bca2", "score": "0.44325873", "text": "func (_Assigntoken *AssigntokenRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Assigntoken.Contract.AssigntokenTransactor.contract.Transfer(opts)\n}", "title": "" }, { "docid": "73d16a4b9ed82ff00ff0c81c9a43652a", "score": "0.4423096", "text": "func newOauthToken(clientId string, ownerId OauthTokenOwnerId, duration time.Duration, scopes []string) *OauthToken {\n\toauthToken := GenerateRandomString(32)\n\n\treturn &OauthToken{\n\t\tToken: oauthToken,\n\t\tClientId: clientId,\n\t\tOwnerId: ownerId,\n\t\tExpiresAt: time.Now().Add(duration),\n\t\tScopes: scopes,\n\t}\n}", "title": "" }, { "docid": "24d650e7e7bca1b5aa2a9d319f64fddd", "score": "0.44225693", "text": "func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error) {\n\tcontract, err := bindToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "24d650e7e7bca1b5aa2a9d319f64fddd", "score": "0.44225693", "text": "func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error) {\n\tcontract, err := bindToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "24d650e7e7bca1b5aa2a9d319f64fddd", "score": "0.44225693", "text": "func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error) {\n\tcontract, err := bindToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "24d650e7e7bca1b5aa2a9d319f64fddd", "score": "0.44225693", "text": "func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error) {\n\tcontract, err := bindToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "24d650e7e7bca1b5aa2a9d319f64fddd", "score": "0.44225693", "text": "func NewTokenCaller(address common.Address, caller bind.ContractCaller) (*TokenCaller, error) {\n\tcontract, err := bindToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &TokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "cb3c8102f2e0114a97683a6bccbc7fb8", "score": "0.44183645", "text": "func NewAccessControlCaller(address common.Address, caller bind.ContractCaller) (*AccessControlCaller, error) {\n\tcontract, err := bindAccessControl(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AccessControlCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "240c043868bd23ef03d0f00cc5c2d9e5", "score": "0.44148976", "text": "func newCodeGenerator(conf architecture.Config, emitter architecture.Emitter) *CodeGenerator {\n\treturn &CodeGenerator{\n\t\tConfig: conf,\n\t\tEmitter: emitter,\n\t\tbssVars: make(map[string]ins.Instruction),\n\t\tfuncs: make(map[string]ins.Instruction),\n\t\tregs: ins.NewRegisterManager(conf.CalleeSavedRegs, conf.CallerSavedRegs, conf.NRegs),\n\t}\n}", "title": "" }, { "docid": "467065342b7baaf2a8e18b77ea9d262d", "score": "0.44105566", "text": "func reqNewToken(file string, oAuthConf *oauth2.Config) (*oauth2.Token, error) {\n\t// get authorization code from web (with user interaction)\n\tvar authCode string\n\tauthURL := oAuthConf.AuthCodeURL(\"state-token\", oauth2.AccessTypeOffline)\n\tfmt.Printf(\"\\nFollow the link and create a new token file: %v\\n\\nEnter the authorization code here: \", authURL)\n\t_, _ = fmt.Scan(&authCode) // read user input\n\n\t// convert authorization code to token\n\ttok, err := oAuthConf.Exchange(context.TODO(), authCode)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"gdrive/reqNewToken: %v\", err)\n\t}\n\n\t// open token file\n\tf, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600) // override file\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"gdrive/reqNewToken: %v\", err)\n\t}\n\tdefer f.Close()\n\n\t// write token to file\n\terr = json.NewEncoder(f).Encode(tok)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"gdrive/reqNewToken: %v\", err)\n\t}\n\n\t// success\n\treturn tok, nil\n}", "title": "" }, { "docid": "cd49844ed7bce84144acf3b5a9fcf7b0", "score": "0.4407256", "text": "func NewIncmodeCaller(address common.Address, caller bind.ContractCaller) (*IncmodeCaller, error) {\n\tcontract, err := bindIncmode(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &IncmodeCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "d395df094c4e3e9374074d2838d65a01", "score": "0.44031307", "text": "func newReconciledEksIAMServiceAccount(t *testing.T) func(...resource.ServiceAccountOption) *corev1.ServiceAccount {\n\treturn func(opts ...resource.ServiceAccountOption) *corev1.ServiceAccount {\n\t\tsrc := mustNewReconciledSource(t)(iamRole)\n\t\treturn NewServiceAccount(src)(append(opts, iamRoleAnnotation)...)\n\t}\n}", "title": "" }, { "docid": "86629a31c67083c7432495e2e5c6df4b", "score": "0.4393352", "text": "func NewAppRoleAssignment()(*AppRoleAssignment) {\n m := &AppRoleAssignment{\n DirectoryObject: *NewDirectoryObject(),\n }\n odataTypeValue := \"#microsoft.graph.appRoleAssignment\";\n m.SetOdataType(&odataTypeValue);\n return m\n}", "title": "" }, { "docid": "d611bfb3d936322e2240e9daf74482b8", "score": "0.43835664", "text": "func NewErc721Contract(adr *common.Address) *ERC721Contract {\n\t// get the total supply of the token and validate the token existence\n\ttoken, err := repository.R().Erc721Contract(adr)\n\tif err != nil {\n\t\treturn nil\n\t}\n\t// make the instance of the token\n\treturn &ERC721Contract{*token}\n}", "title": "" }, { "docid": "6f534aef9ba938f3e6d4f18acfb5620b", "score": "0.4383376", "text": "func (s *BaseAuroraListener) EnterAssign(ctx *AssignContext) {}", "title": "" }, { "docid": "0ea937ec07d8d992d0004e25d71e76c2", "score": "0.43626866", "text": "func NewInitializableCaller(address common.Address, caller bind.ContractCaller) (*InitializableCaller, error) {\n\tcontract, err := bindInitializable(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &InitializableCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "9c0f80305b2184169df82d316898d7fa", "score": "0.436131", "text": "func newTokenConfig() TokenConfig {\n\treturn TokenConfig{\n\t\tName: \"My awesome token\",\n\t\tSymbol: \"MAT\",\n\t\tDecimals: decimals,\n\t\tOwner: owner,\n\t\tTotalSupply: 10000000 * multiplier,\n\t\tInitialAmount: 5000000 * multiplier,\n\t\tAmountPerNEO: 60 * multiplier,\n\t\tAmountPerGas: 40 * multiplier,\n\t\tMaxExchangeLimitRound: 500 * 60 * multiplier,\n\t\tSaleStart: 75500,\n\t\tLimitRoundEnd: 75500 + 10000,\n\t\tCirculationKey: []byte(\"in_circulation\"),\n\t\tLimitRoundKey: []byte(\"r1\"),\n\t\tKYCKey: []byte(\"kyc_ok\"),\n\t}\n}", "title": "" }, { "docid": "7e6a1f9648ba30fee672a7f9d16bc249", "score": "0.43601406", "text": "func NewContractCaller(address common.Address, caller bind.ContractCaller) (*ContractCaller, error) {\n\tcontract, err := bindContract(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ContractCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "f7d04c0547649fa01ae76b276d91d6c8", "score": "0.4356531", "text": "func NewBasicTokenCaller(address common.Address, caller bind.ContractCaller) (*BasicTokenCaller, error) {\n\tcontract, err := bindBasicToken(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BasicTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "e206c860bf76f4cdb1eaa7ac29592154", "score": "0.43540436", "text": "func NewSNMTTokenCaller(address common.Address, caller bind.ContractCaller) (*SNMTTokenCaller, error) {\n\tcontract, err := bindSNMTToken(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &SNMTTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "aaea3623f9d70fb918417b2ab3750ae5", "score": "0.43496522", "text": "func NewBasicTokenCaller(address common.Address, caller bind.ContractCaller) (*BasicTokenCaller, error) {\n\tcontract, err := bindBasicToken(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &BasicTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "9227b61da892eb9675845d3bb8c66ffe", "score": "0.4343555", "text": "func newCachingTokenSource(cacheFilePath string, ctx context.Context, config *oauth2.Config) (oauth2.TokenSource, error) {\n\tvar tok *oauth2.Token = nil\n\tvar err error\n\n\tif cacheFilePath == \"\" {\n\t\tsklog.Warningf(\"cacheFilePath is empty. Not caching auth token.\")\n\t} else if _, err = os.Stat(cacheFilePath); err == nil {\n\t\t// If the file exists. Load from disk.\n\t\tf, err := os.Open(cacheFilePath)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttok = &oauth2.Token{}\n\t\tif err = json.NewDecoder(f).Decode(tok); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if !os.IsNotExist(err) {\n\t\treturn nil, err\n\t}\n\n\t// If there was no token, we run through the flow.\n\tif tok == nil {\n\t\t// Run through the flow.\n\t\turl := config.AuthCodeURL(\"state\", oauth2.AccessTypeOffline)\n\t\tfmt.Printf(\"Your browser has been opened to visit:\\n\\n%s\\n\\nEnter the verification code:\", url)\n\n\t\tvar code string\n\t\tif _, err = fmt.Scan(&code); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\ttok, err = config.Exchange(ctx, code)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err = saveToken(cacheFilePath, tok); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tsklog.Infof(\"Token saved to %s\", cacheFilePath)\n\t}\n\n\t// We have a token at this point.\n\ttokenSource := config.TokenSource(ctx, tok)\n\treturn &cachingTokenSource{\n\t\tcacheFilePath: cacheFilePath,\n\t\ttokenSource: tokenSource,\n\t\tlastToken: tok,\n\t}, nil\n}", "title": "" }, { "docid": "63749a8f3fc1db9f257b6316f659aa48", "score": "0.4342238", "text": "func newTaskAllocator(shard ShardContext) taskAllocator {\n\treturn &taskAllocatorImpl{\n\t\tcurrentClusterName: shard.GetService().GetClusterMetadata().GetCurrentClusterName(),\n\t\tshard: shard,\n\t\tdomainCache: shard.GetDomainCache(),\n\t\tlogger: shard.GetLogger(),\n\t}\n}", "title": "" }, { "docid": "faf35c17c33256d32d54e2dedd475994", "score": "0.43297556", "text": "func NewManagedEBookAssignment()(*ManagedEBookAssignment) {\n m := &ManagedEBookAssignment{\n Entity: *NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "35c3c6955fca9a652ca7322dd462c29a", "score": "0.4323193", "text": "func NewTaskNew() *TaskNew { return &TaskNew{} }", "title": "" }, { "docid": "967f0ff23707fac6c930d15bc2fcc4a4", "score": "0.43218136", "text": "func (_Assigntoken *AssigntokenCaller) AssginedTokensPerPeriodDefault(opts *bind.CallOpts) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _Assigntoken.contract.Call(opts, out, \"assginedTokensPerPeriodDefault\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "a582432f4112e2a09481f8a840567079", "score": "0.43192545", "text": "func (_ManagedGrant *ManagedGrantCaller) RequestedNewGrantee(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _ManagedGrant.contract.Call(opts, out, \"requestedNewGrantee\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "89e28d857f6ea2cdeb8eda4e320634c9", "score": "0.43172565", "text": "func (_StampCollection *StampCollectionSession) NewContractAddress() (common.Address, error) {\n\treturn _StampCollection.Contract.NewContractAddress(&_StampCollection.CallOpts)\n}", "title": "" }, { "docid": "a8138eade87d2773a8a4ed5d3d9d623c", "score": "0.43151325", "text": "func setupTestCVLTokenContract(client bind.ContractBackend, auth *bind.TransactOpts) (common.Address,\n\t*contract.CVLTokenContract, error) {\n\ttokenControllerAddress, _, _, err := deployCivilTokenController(client, auth)\n\tif err != nil {\n\t\treturn common.Address{}, nil, err\n\t}\n\taddress, _, contract, err := contract.DeployCVLTokenContract(\n\t\tauth,\n\t\tclient,\n\t\tbig.NewInt(9223372036854775807),\n\t\t\"CivilTokenTest\",\n\t\t18,\n\t\t\"CVLT\",\n\t\ttokenControllerAddress,\n\t)\n\tif err != nil {\n\t\treturn common.Address{}, nil, err\n\t}\n\treturn address, contract, nil\n}", "title": "" }, { "docid": "e837d48408ea7c481df854712e27c38d", "score": "0.43108526", "text": "func DeployPausableTokenMock(auth *bind.TransactOpts, backend bind.ContractBackend, initialAccount common.Address, initialBalance *big.Int) (common.Address, *types.Transaction, *PausableTokenMock, error) {\n\tparsed, err := abi.JSON(strings.NewReader(PausableTokenMockABI))\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\taddress, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(PausableTokenMockBin), backend, initialAccount, initialBalance)\n\tif err != nil {\n\t\treturn common.Address{}, nil, nil, err\n\t}\n\treturn address, tx, &PausableTokenMock{PausableTokenMockCaller: PausableTokenMockCaller{contract: contract}, PausableTokenMockTransactor: PausableTokenMockTransactor{contract: contract}}, nil\n}", "title": "" }, { "docid": "5973e7a56207592e850e4bb5da27abf8", "score": "0.43095028", "text": "func newContractorRegistration(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\n\t//Check the correct no. of arguments in an array\n\tif len(args) < 2 {\n\t\tstr := fmt.Sprintf(ArgumentErrorMessage)\n\t\treturn shim.Error(str)\n\t}\n\t\n\tuuid := args[0]\n\tregInfo := args[1]\n\n //Check same uuid exists in a ledger or not\n\tuuidAsBytes, err := stub.GetState(uuid)\n\tif uuidAsBytes != nil || err != nil {\n\t\treturn shim.Error(\"A UUID already exists in the system. Please provide new UUID.\")\n\t}\n\t\n\t//Storing new contractor detail corresponding to its UUID\n\terr = stub.PutState(uuid, []byte(regInfo))\n\tif err != nil {\n\t\treturn shim.Error(PutErrorMessage)\n\n\t}\n\n\treturn shim.Success([]byte(\"Contratcor Registered successfully.\"))\n}", "title": "" }, { "docid": "614be38f8542c7b5a2c0cb86083c5c81", "score": "0.4303178", "text": "func NewContract() *Contract {\n\treturn &Contract{}\n}", "title": "" }, { "docid": "614be38f8542c7b5a2c0cb86083c5c81", "score": "0.4303178", "text": "func NewContract() *Contract {\n\treturn &Contract{}\n}", "title": "" }, { "docid": "c08b527b26aacad8b748adba4e48a893", "score": "0.4294444", "text": "func newAzureReposAPIClient(ctx context.Context, token string) (*http.Client, error) {\n\taccessToken, tokenType := token, \"Bearer\"\n\n\tif len(token) == azurePATLength {\n\t\taccessToken = base64.StdEncoding.EncodeToString(\n\t\t\t[]byte(fmt.Sprintf(\":%s\", accessToken)),\n\t\t)\n\t\ttokenType = \"Basic\"\n\t}\n\n\tts := oauth2.StaticTokenSource(\n\t\t&oauth2.Token{\n\t\t\tAccessToken: accessToken,\n\t\t\tTokenType: tokenType,\n\t\t},\n\t)\n\thttpClient := oauth2.NewClient(ctx, ts)\n\n\treturn httpClient, nil\n}", "title": "" }, { "docid": "88ebe3a93be8428c185d5f78e8babe51", "score": "0.4292607", "text": "func (_KittyCore *KittyCoreSession) NewContractAddress() (common.Address, error) {\n\treturn _KittyCore.Contract.NewContractAddress(&_KittyCore.CallOpts)\n}", "title": "" }, { "docid": "8d36f7074ae9fbd36bdcab735605a457", "score": "0.42861944", "text": "func NewAccessibleCaller(address common.Address, caller bind.ContractCaller) (*AccessibleCaller, error) {\n\tcontract, err := bindAccessible(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &AccessibleCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "1caf32c48ebaa16ec2aed88db4bbf968", "score": "0.42847502", "text": "func (c *SessionClient) newToken(expiresAt time.Time, userID string) (string, error) {\n\n\tclaims := utils.Claims{\n\t\tUserID: userID,\n\t\tStandardClaims: jwt.StandardClaims{\n\t\t\tExpiresAt: expiresAt.Unix(),\n\t\t\tIssuer: \"creatix\",\n\t\t\tId: userID,\n\t\t},\n\t}\n\n\ttoken := jwt.NewWithClaims(jwt.GetSigningMethod(\"HS256\"), claims)\n\ttokenString, err := token.SignedString(c.TokenSecret)\n\tif err != nil {\n\t\tc.logger.Unsuccessful(\"not able to generate token string\", err)\n\t\treturn tokenString, err\n\t}\n\treturn tokenString, nil\n\n}", "title": "" }, { "docid": "efe71cc7d8a4eea105d89a5d7119d41f", "score": "0.426226", "text": "func TestInvoke_DeployToken(t *testing.T) {\n\tlog.LLvl1(\"Deploying Token Contract\")\n\n\t//Preparing ledger\n\tbct := newBCTest(t)\n\tbct.local.Check = onet.CheckNone\n\tdefer bct.Close()\n\n\t//Instantiating evm\n\targs := byzcoin.Arguments{}\n\tinstID := bct.createInstance(t, args)\n\n\t// Get the proof from byzcoin\n\treply, err := bct.cl.GetProof(instID.Slice())\n\trequire.Nil(t, err)\n\n\t// Make sure the proof is a matching proof and not a proof of absence.\n\tpr := reply.Proof\n\trequire.True(t, pr.InclusionProof.Match(instID.Slice()))\n\n\t_, err = bct.cl.WaitProof(instID, bct.gMsg.BlockInterval, nil)\n\trequire.Nil(t, err)\n\n\n\t//CREDIT\n\t//Preparing parameters to credit account to have enough ether to deploy\n\taddressA := \"0x2afd357E96a3aCbcd01615681C1D7e3398d5fb61\"\n\taddressABuffer := []byte(addressA)\n\targs = byzcoin.Arguments{\n\t\t{\n\t\t\tName: \"address\",\n\t\t\tValue: addressABuffer,\n\t\t},\n\t}\n\n\t//Send credit instructions to Byzcoin and incrementing nonce counter\n\tbct.creditAccountInstance(t, instID, args)\n\tbct.ct = bct.ct +1\n\n\t//Verifying account credit\n\tbct.displayAccountInstance(t, instID, args)\n\tbct.ct = bct.ct +1\n\n\t//DEPLOY\n\t//Getting smartcontract abi and bytecode\n\tRawAbi, bytecode := getSmartContract(\"MinimumToken\")\n\n\t//Getting transaction parameters\n\tgasLimit, gasPrice := transactionGasParameters()\n\n\t//Creating deploying transaction\n\tdeployTx := types.NewContractCreation(0, big.NewInt(0), gasLimit, gasPrice, common.Hex2Bytes(bytecode))\n\n\t//Signing transaction with private key corresponding to addressA\n\tprivateA := \"a33fca62081a2665454fe844a8afbe8e2e02fb66af558e695a79d058f9042f0d\"\n\tsignedTxBuffer, err := signAndMarshalTx(privateA, deployTx)\n\trequire.Nil(t, err)\n\targs = byzcoin.Arguments{\n\t\t{\n\t\t\tName: \"tx\",\n\t\t\tValue: signedTxBuffer,\n\t\t},\n\t}\n\n\tbct.transactionInstance(t, instID, args)\n\tbct.ct = bct.ct +1\n\n\targs = byzcoin.Arguments{\n\t\t{\n\t\t\tName: \"address\",\n\t\t\tValue: addressABuffer,\n\t\t},\n\t}\n\n\t//Verifying account credit\n\tbct.displayAccountInstance(t, instID, args)\n\tbct.ct = bct.ct +1\n\n\t//CONSTRUCTOR\n\t//Calling constructor method to mint 100 coins\n\tmethodBuf, err := abiMethodPack(RawAbi, \"constructor\", addressA, big.NewInt(100))\n\trequire.Nil(t, err)\n\n\n\t//Old hardcoded contract address : contractAddress := common.HexToAddress(\"0x45663483f58d687c8aF17B85cCCDD9391b567498\")\n\t//The contract address is derived from the sending address and its nonce\n\tcontractAddress := crypto.CreateAddress(common.HexToAddress(addressA), deployTx.Nonce())\n\n\n\tconstructorTx := types.NewTransaction(0, contractAddress, big.NewInt(0), gasLimit, gasPrice, methodBuf)\n\ttxBuffer, err := signAndMarshalTx(privateA, constructorTx)\n\trequire.Nil(t, err)\n\targs = byzcoin.Arguments{\n\t\t{\n\t\t\tName: \"tx\",\n\t\t\tValue: txBuffer,\n\n\t\t},\n\t}\n\tbct.transactionInstance(t,instID, args)\n\tbct.ct = bct.ct + 1\n\n\n\t//TRANSACT A to B\n\t//Now send a token transaction from A to B\n\taddressB := \"0x2887A24130cACFD8f71C479d9f9Da5b9C6425CE8\"\n\ttoAddress := common.HexToAddress(addressB)\n\tfromAddress := common.HexToAddress(addressA)\n\tmethodBuf, err = abiMethodPack(RawAbi, \"transferFrom\",fromAddress, toAddress, big.NewInt(1))\n\trequire.Nil(t, err)\n\n\t//create transaction\n\tsendTxAB := types.NewTransaction(0, contractAddress, big.NewInt(0), gasLimit, gasPrice, methodBuf)\n\ttxBufferAB, err := signAndMarshalTx(privateA, sendTxAB)\n\trequire.Nil(t, err)\n\targs = byzcoin.Arguments{\n\t\t{\n\t\t\tName: \"tx\",\n\t\t\tValue: txBufferAB,\n\n\t\t},\n\t}\n\tbct.transactionInstance(t,instID, args)\n\tbct.ct = bct.ct +1\n\n\n}", "title": "" }, { "docid": "8d7731626812baa1f250a871b064861e", "score": "0.42600662", "text": "func NewContract() *Contract {\n\tthis := Contract{}\n\treturn &this\n}", "title": "" }, { "docid": "2830a7554ec6ec84c738c0ada8a2627c", "score": "0.42600322", "text": "func New(api *apistruct.FullNodeStruct, maddr address.Address, iam big.Int) (*Module, error) {\n\tm := &Module{\n\t\tapi: api,\n\t\tiAmount: &iam,\n\t\tmasterAddr: maddr,\n\t}\n\treturn m, nil\n}", "title": "" }, { "docid": "328a7d81fe03b9dca44e454f38939b02", "score": "0.42565584", "text": "func NewNodeSpaceCaller(address common.Address, caller bind.ContractCaller) (*NodeSpaceCaller, error) {\n\tcontract, err := bindNodeSpace(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &NodeSpaceCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "b060c12720367421c3ff78a5a9eedccd", "score": "0.42531013", "text": "func NewPametteCaller(address common.Address, caller bind.ContractCaller) (*PametteCaller, error) {\n\tcontract, err := bindPamette(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &PametteCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "8e6f9402b7f644e4ced36983054ad8cc", "score": "0.42505494", "text": "func (_ManagedGrant *ManagedGrantCallerSession) RequestedNewGrantee() (common.Address, error) {\n\treturn _ManagedGrant.Contract.RequestedNewGrantee(&_ManagedGrant.CallOpts)\n}", "title": "" }, { "docid": "ebf55d752243efcc8c310b32141fa2b1", "score": "0.4250278", "text": "func (_ERC721BasicToken *ERC721BasicTokenTransactor) Approve(opts *bind.TransactOpts, _to common.Address, _tokenId *big.Int) (*types.Transaction, error) {\n\treturn _ERC721BasicToken.contract.Transact(opts, \"approve\", _to, _tokenId)\n}", "title": "" }, { "docid": "c13bc35448e0a80deabf5fb175f1cf9b", "score": "0.4245491", "text": "func NewManagedGrantCaller(address common.Address, caller bind.ContractCaller) (*ManagedGrantCaller, error) {\n\tcontract, err := bindManagedGrant(address, caller, nil, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &ManagedGrantCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "b857b80feccb2e01d7f918e1f6d60124", "score": "0.4234581", "text": "func assign(be pb.BackendServiceClient, agonesClient *versioned.Clientset, match *pb.Match) error {\n\tgsa, err := agonesClient.AllocationV1().GameServerAllocations(\"default\").Create(createAgonesGameServerAllocation())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// no game server can be allocated\n\tif gsa.Status.State != allocationv1.GameServerAllocationAllocated {\n\t\treturn errors.New(\"failed to allocate game server\")\n\t}\n\n\tassignTicketReq := createOMAssignTicketRequest(match, gsa)\n\t// display all of connection assinged\n\tfor _, assign := range assignTicketReq.GetAssignments() {\n\t\tconnection := assign.GetAssignment().GetConnection()\n\t\tfmt.Printf(\"Assignment ticket req connection:%s\", connection)\n\t\tfmt.Println()\n\t}\n\n\tresp, err := be.AssignTickets(context.Background(), assignTicketReq)\n\tif err != nil {\n\t\t// Corner case where we allocated a game server for players who left the queue after some waiting time.\n\t\t// Note that we may still leak some game servers when tickets got assigned but players left the queue before game frontend announced the assignments.\n\t\tif err = agonesClient.AgonesV1().GameServers(\"default\").Delete(gsa.Status.GameServerName, &metav1.DeleteOptions{}); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(resp.GetFailures()) > 0 {\n\t\t\tfmt.Printf(\"Assignment failed : %d\", len(resp.GetFailures()))\n\t\t\tfmt.Println()\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d0a99d9429632dd1633d02d85168f9dd", "score": "0.4232489", "text": "func newTask(f any, p ...any) task {\n\tt := task{funcCache: reflect.ValueOf(f)}\n\tt.params(p...)\n\n\treturn t\n}", "title": "" }, { "docid": "3415433eb1222206e05e1ec604c8a37a", "score": "0.42321527", "text": "func NewNectarTokenCaller(address common.Address, caller bind.ContractCaller) (*NectarTokenCaller, error) {\n\tcontract, err := bindNectarToken(address, caller, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &NectarTokenCaller{contract: contract}, nil\n}", "title": "" }, { "docid": "2945888c30e291450cc10e23b25a0101", "score": "0.42292482", "text": "func (_StampCollection *StampCollectionCaller) NewContractAddress(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _StampCollection.contract.Call(opts, out, \"newContractAddress\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "57fe9f445804c95d1592ba0335625f75", "score": "0.42285773", "text": "func (_HashedTimelock *HashedTimelockTransactor) NewContract(opts *bind.TransactOpts, _receiver common.Address, _hashlock [32]byte, _timelock *big.Int) (*types.Transaction, error) {\n\treturn _HashedTimelock.contract.Transact(opts, \"newContract\", _receiver, _hashlock, _timelock)\n}", "title": "" }, { "docid": "5f637988c92e7add91300f84449fb0c0", "score": "0.42259106", "text": "func NewToken(name string, symbol string, totalSupply sdk.Int, owner sdk.AccAddress,\n\tmintable bool, burnable bool, addrForbiddable bool, tokenForbiddable bool,\n\turl string, description string, identity string) (*BaseToken, sdk.Error) {\n\n\tt := &BaseToken{}\n\tvar err sdk.Error\n\tif err = t.SetName(name); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetOwner(owner); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetSymbol(symbol); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetTotalSupply(totalSupply); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetURL(url); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetDescription(description); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetIdentity(identity); err != nil {\n\t\treturn nil, err\n\t}\n\n\tt.SetMintable(mintable)\n\tt.SetBurnable(burnable)\n\tt.SetAddrForbiddable(addrForbiddable)\n\tt.SetTokenForbiddable(tokenForbiddable)\n\n\tif err = t.SetTotalMint(sdk.ZeroInt()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetTotalBurn(sdk.ZeroInt()); err != nil {\n\t\treturn nil, err\n\t}\n\tif err = t.SetSendLock(sdk.ZeroInt()); err != nil {\n\t\treturn nil, err\n\t}\n\tt.SetIsForbidden(false)\n\n\treturn t, nil\n}", "title": "" }, { "docid": "4a65735210f5105c8c7f6f00d3ef9032", "score": "0.42237544", "text": "func (_Assigntoken *AssigntokenSession) Owner() (common.Address, error) {\n\treturn _Assigntoken.Contract.Owner(&_Assigntoken.CallOpts)\n}", "title": "" } ]
e08402a72691758c47f3c55b445e2e2a
get note data via post
[ { "docid": "c61f2f487b468437dd69a66c81ff6798", "score": "0.0", "text": "func getCannedResponseFromPost(r *http.Request) *CannedResponse {\n\tvar cannedResponse CannedResponse\n\n\tapi.GetFromPost(r, &cannedResponse)\n\n\treturn &cannedResponse\n}", "title": "" } ]
[ { "docid": "3c5a19963527654174da8d7cddeba982", "score": "0.6809769", "text": "func PostNoteHandler(w http.ResponseWriter, r *http.Request) {\n\t// objeto que va a contener la nota\n\tvar note Note\n\n\t// decodifica el json (el json viene en el body del request -r-)\n\terr := json.NewDecoder(r.Body).Decode(&note) //con el puntero, lo decodificado se guarda ennote directamente\n\n\t// maneja el error si lo hay\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// agrega la fecha al Note\n\tnote.CreatedAt = time.Now()\n\n\t// incrementa el id\n\tid++\n\n\t// pasa el int a string\n\tk := strconv.Itoa(id)\n\n\t// guarda la nota en el map de almacenamiento (en un indice en particular)\n\tnoteStore[k] = note\n\n\t// respuesta json\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// convertir a json\n\tj, err := json.Marshal(note) //devuelve un slice de byte\n\n\tif err != nil {\n\t\t// no usar panic en produccion\n\t\tpanic(err)\n\t}\n\n\t// agrega codigo de status a la respuesta\n\tw.WriteHeader(http.StatusCreated) //201\n\n\t// cuerpo de la respuesta\n\tw.Write(j)\n\n}", "title": "" }, { "docid": "94ee2fcee6795d1f2b7c8ebc66f08dc8", "score": "0.6677909", "text": "func (app *application) getNote(w http.ResponseWriter, r *http.Request) {\n\tdate, err := app.readDateParam(r)\n\tif err != nil {\n\t\tapp.notFound(w)\n\t\treturn\n\t}\n\n\tnote, err := app.models.Notes.Get(date, app.currentUser(r).ID)\n\tif err != nil {\n\t\tif errors.Is(err, data.ErrRecordNotFound) {\n\t\t\tapp.apiOK(w)\n\t\t\treturn\n\t\t}\n\n\t\tapp.errorJSONResponse(w, http.StatusInternalServerError, \"server error\")\n\t\treturn\n\t}\n\n\tapp.writeJSON(w, 200, envelope{\"note\": note}, nil)\n}", "title": "" }, { "docid": "cfd71b02e831b4c963108d9a238d1773", "score": "0.6620392", "text": "func PostNoteHandler(w http.ResponseWriter, r *http.Request) {\n\t//objeto nota que se debe rellenar con el json\n\tvar note Note\n\t//Json q va decodificar en el body:Cuerpo de la peticion del usuario\n\t// se asigna a la variable err porque podria generar un error\n\t//si por ej el usuario envia una estructura json invalida\n\terr := json.NewDecoder(r.Body).Decode(&note)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//agregar fecha de creacion\n\tnote.CreatedAt = time.Now()\n\t//incrementar el id\n\tid++\n\t//crear un indice valido para nuestro mapa\n\tk := strconv.Itoa(id)\n\tnoteStore[k] = note\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tj, err := json.Marshal(note)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.WriteHeader(http.StatusCreated)\n\tw.Write(j)\n\n}", "title": "" }, { "docid": "fa031babf5d026e137cc5bf20fa77788", "score": "0.6384959", "text": "func GetNoteHandler(w http.ResponseWriter, r *http.Request) {\n\t// objeto que va a contener las notas\n\tvar notes []Note //slice de Note\n\n\tfor _, value := range noteStore {\n\t\tnotes = append(notes, value)\n\t}\n\n\t// cabecera para la solicitud\n\t// el seteo de la cabecera debe ser ANTES que WriteHeader (sino WriteHeader no lo tiene en cuenta)\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\n\t// convertir a json\n\tj, err := json.Marshal(notes) //devuelve un slice de byte\n\n\tif err != nil {\n\t\t// no usar panic en produccion\n\t\tpanic(err)\n\t}\n\n\t// agrega codigo de status a la respuesta\n\tw.WriteHeader(http.StatusOK) //200\n\n\t// cuerpo de la respuesta\n\tw.Write(j)\n}", "title": "" }, { "docid": "234ab823d4061954ee7c670a76364337", "score": "0.6353723", "text": "func (re *Record) GetNote(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodGet {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tid := r.URL.Query().Get(\"id\")\n\tif id == \"\" {\n\t\thttp.Error(w, \"Missing query parameter: 'id'\", http.StatusBadRequest)\n\t\treturn\n\t}\n\n\tvar note Note\n\tresult := re.DB.Where(filterByID, id).Find(&note)\n\tif result.Error != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"%s\", result.Error), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif result.RowsAffected == 0 {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tdetails, err := json.Marshal(note)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(details)\n}", "title": "" }, { "docid": "b03b21e218fca86ac4fa23083d5e07de", "score": "0.6347355", "text": "func PostNote(context *Context) http.HandlerFunc {\n\treturn func (w http.ResponseWriter, r *http.Request) {\n\t\t// Create response.\n\t\tresp := NewJSONResponse()\n\t\tdefer resp.Respond(w)\n\n\t\t// Retrieve form values.\n\t\ttitle := r.FormValue(\"title\")\n\t\tcontent := r.FormValue(\"content\")\n\t\ttime := r.FormValue(\"time\")\n\t\treadUserID := r.FormValue(\"user_id\")\n\n\t\t// Perform validation on the form values.\n\t\tif len(title) == 0 {\n\t\t\tresp.Fields[\"title\"] = \"Title must be specified.\"\n\t\t}\n\n\t\tif len(resp.Fields) > 0 {\n\t\t\treturn\n\t\t}\n\n\t\t// Retrieve the logged in user's data.\n\t\tuserID, currentUserAdmin, err := context.LoggedInUser(r)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not retrieve logged in user.\"\n\t\t\treturn\n\t\t}\n\n\t\t// If the user ID was specified, and the logged in user is admin, the\n\t\t// user ID will be set. If not, it will default to the current user's.\n\t\tif len(readUserID) > 0 {\n\t\t\t// Make sure the logged in user is admin.\n\t\t\tif !currentUserAdmin {\n\t\t\t\tresp.StatusCode = 403\n\t\t\t\tresp.ErrorMessage = \"Could not add a note to this user.\"\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Attempt to read the ID as an int64.\n\t\t\tconvUserID, err := strconv.Atoi(readUserID)\n\t\t\tif err != nil {\n\t\t\t\tresp.Fields[\"user_id\"] = \"Improper user ID.\"\n\t\t\t\treturn\n\t\t\t}\n\t\t\tuserID = int64(convUserID)\n\t\t}\n\n\t\t// Create a new note model.\n\t\tn := NewNote(context.DB)\n\n\t\t// Set the values.\n\t\tn.Title = title\n\n\t\tn.Content.String = content\n\t\tn.Content.Valid = len(content) > 0\n\n\t\tn.Time.String = time\n\t\tn.Time.Valid = len(time) > 0\n\n\t\tn.UserID = userID\n\n\t\t// Save the new note.\n\t\terr = n.Save()\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not save note.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Add the note model to the response.\n\t\tresp.Models = append(resp.Models, n)\n\t}\n}", "title": "" }, { "docid": "00d0055c91f18f22ce4c32d038482037", "score": "0.6295676", "text": "func getNote(event *types.Event) (string, error) {\n\teventJSON, err := json.Marshal(event)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn fmt.Sprintf(\"Event data update:\\n\\n%s\", eventJSON), nil\n}", "title": "" }, { "docid": "bc65f1b2775bf1e8df2e99e723f95685", "score": "0.6167414", "text": "func (c *Client) Notes(blogname, postID string, options url.Values) (NotesResponse, error) {\n\treqURL := fmt.Sprintf(\"/v2/blog/%s/notes\", blogname)\n\toptions.Set(\"api_key\", c.apiKey)\n\toptions.Set(\"id\", postID)\n\tdata, err := c.Get(reqURL, options)\n\tif err != nil {\n\t\treturn NotesResponse{}, err\n\t}\n\tvar res NotesResponse\n\treturn res, json.Unmarshal(data.Response, &res)\n}", "title": "" }, { "docid": "9f862d08d519c276aa4ce56ff2da4969", "score": "0.60141426", "text": "func (_ChatViews *ChatViewsCallerSession) GetPost(postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\treturn _ChatViews.Contract.GetPost(&_ChatViews.CallOpts, postId)\n}", "title": "" }, { "docid": "bbbd92b8e386d7ab38f6dc64450c8a70", "score": "0.59984404", "text": "func IndexNote() http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t//Insert Data\n\t\tif r.Method == http.MethodPost {\n\t\t\t// Take some data\n\t\t\tdata := views.PostRequestNote{}\n\t\t\tjson.NewDecoder(r.Body).Decode(&data)\n\t\t\t// Save it\n\t\t\tif err := models.InsertNote(data.Title, data.Desc); err != nil {\n\t\t\t\tw.Write([]byte(\"Some Error\"))\n\t\t\t\treturn\n\t\t\t}\n\t\t\tres := views.ResponseWithData{\n\t\t\t\tCode: http.StatusCreated,\n\t\t\t\tStatus: true,\n\t\t\t\tMessage: \"Succes Create Note\",\n\t\t\t\tData: data,\n\t\t\t}\n\t\t\tw.WriteHeader(http.StatusCreated)\n\t\t\tjson.NewEncoder(w).Encode(res)\n\t\t\t//Select All Data\n\t\t} else if r.Method == http.MethodGet {\n\t\t\ttitle := r.URL.Query().Get(\"title\")\n\t\t\tdesc := r.URL.Query().Get(\"desctiption\")\n\t\t\t// id := r.URL.Path[1:]\n\t\t\tif title == \"\" && desc == \"\" {\n\t\t\t\tdata, err := models.SelectAllNote()\n\t\t\t\tSetReturnGet(w, data, err)\n\t\t\t} else {\n\t\t\t\tdata, err := models.SelectValueNote(title, desc)\n\t\t\t\tSetReturnGet(w, data, err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9e1f6f59fcce6e3fff14ee6307fb27fd", "score": "0.59906155", "text": "func (c *Client) GetNote(ctx context.Context, id int, out ResponseModel) error {\n\n\turi := fmt.Sprintf(\"/notes/%v\", id)\n\treq, err := c.NewRequest(http.MethodGet, uri, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Do(ctx, req, out)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !out.Successful() {\n\t\treturn fmt.Errorf(\"not successful, error: %v\", out.ErrorString())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "289217b0a08fd0a76292e05608c15a2d", "score": "0.5933104", "text": "func (_ChatViews *ChatViewsSession) GetPost(postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\treturn _ChatViews.Contract.GetPost(&_ChatViews.CallOpts, postId)\n}", "title": "" }, { "docid": "5caf8bcc3c0b12da99b0f8dc667a0000", "score": "0.5931977", "text": "func getPartOfNote(r *http.Request) (note Note) {\n\t//Check to see if user has read permission or is note owner\n\tif readPermissions(r) {\n\t\t//Connect to database\n\t\tdb := connectDatabase()\n\t\tdefer db.Close()\n\t\t//Get username\n\t\tusername := getUserName(r)\n\t\tnoteid := getNoteID(r)\n\t\t//prepare statment\n\t\tstmt, err := db.Prepare(\"SELECT _note.note_id, note_owner, title, body, date_created, read, write FROM _note JOIN _note_privileges ON _note.note_id = _note_privileges.note_id WHERE _note.note_id = $2 AND user_name = $1\")\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t}\n\t\terr = stmt.QueryRow(username, noteid).Scan(&note.NoteID, &note.NoteOwner, &note.NoteTitle, &note.NoteBody, &note.CreatedDate, &note.Read, &note.Write)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn note\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\treturn note\n}", "title": "" }, { "docid": "28466541ed5eaceae05dee3f5badcc51", "score": "0.59135544", "text": "func (qv *QATaskVideo) GetNote() (note string, err error) {\n\tsubmit := map[string]string{}\n\tif err = json.Unmarshal([]byte(qv.AuditSubmit), &submit); err != nil {\n\t\treturn\n\t}\n\n\tnote = submit[\"note\"]\n\treturn\n}", "title": "" }, { "docid": "4598c23c599c540cec946b4f36217efe", "score": "0.590125", "text": "func PostNoteTag(context *Context) http.HandlerFunc {\n\treturn func (w http.ResponseWriter, r *http.Request) {\n\t\t// Create a response.\n\t\tresp := NewJSONResponse()\n\t\tdefer resp.Respond(w)\n\t\t\n\t\t// Retrieve the note ID.\n\t\tnID, ok := GetURLID(r, &resp)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\t// Retrieve the tag ID.\n\t\ttIDform := r.FormValue(\"tag_id\")\n\t\t\n\t\t// Ensure a tag ID was given.\n\t\tif len(tIDform) == 0 {\n\t\t\tresp.Fields[\"tag_id\"] = \"No tag ID given.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Ensure that the tag ID is a valid int.\n\t\ttIDint, err := strconv.Atoi(tIDform)\n\t\tif err != nil {\n\t\t\tresp.Fields[\"tag_id\"] = \"Invalid tag ID.\"\n\t\t\treturn\n\t\t}\n\t\ttID := int64(tIDint)\n\n\t\t// Make sure the note exists.\n\t\tif e, err := CheckExistence(nID, \"notes\", context.DB); !e {\n\t\t\tif err == nil {\n\t\t\t\tresp.StatusCode = 404\n\t\t\t\tresp.ErrorMessage = \"Note not found.\"\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tresp.StatusCode = 500\n\t\t\t\tresp.ErrorMessage = \"Could not verify existence of note.\"\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Load the note model.\n\t\tn, err := LoadNote(nID, context.DB)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not load note.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the tag exists.\n\t\tif e, err := CheckExistence(tID, \"tags\", context.DB); !e {\n\t\t\tif err == nil {\n\t\t\t\tresp.Fields[\"tag_id\"] = \"Tag does not exist.\"\n\t\t\t\treturn\n\t\t\t} else {\n\t\t\t\tresp.StatusCode = 500\n\t\t\t\tresp.ErrorMessage = \"Could not verify existence of tag.\"\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\t// Load the tag as a model.\n\t\tt, err := LoadTag(tID, context.DB)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not load tag.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Retrieve the logged in user.\n\t\tcurrentUserID, currentUserAdmin, err := context.LoggedInUser(r)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not retrieve logged in user.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Make sure the user is either admin or owns the note and the tag.\n\t\tif !currentUserAdmin && (currentUserID != t.UserID || currentUserID != n.UserID) {\n\t\t\tresp.StatusCode = 403\n\t\t\tresp.ErrorMessage = \"Access Denied.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Add the tag to the note.\n\t\terr = n.AddTag(t.ID)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not add tag to note.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Add the tag model to the response.\n\t\tresp.Models = append(resp.Models, t)\n\t}\n}", "title": "" }, { "docid": "c1aa8306077a73d00e5b590a16b6bc16", "score": "0.5878737", "text": "func (_ChatViews *ChatViewsCaller) GetPost(opts *bind.CallOpts, postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\tret := new(struct {\n\t\tIpfsHash string\n\t\tPoster common.Address\n\t\tBlockNumber *big.Int\n\t\tTimestamp *big.Int\n\t\tContentType string\n\t})\n\tout := ret\n\terr := _ChatViews.contract.Call(opts, out, \"getPost\", postId)\n\treturn *ret, err\n}", "title": "" }, { "docid": "187a160340c3d8c56df3a957e1a50511", "score": "0.58068204", "text": "func (m *memStore) GetNote(pID, nID string) (*swagger.Note, *errors.AppError) {\n\tnName := name.NoteName(pID, nID)\n\tn, ok := m.notesByID[nName]\n\tif !ok {\n\t\treturn nil, &errors.AppError{Err: fmt.Sprintf(\"Note with name %q does not Exist\", nName),\n\t\t\tStatusCode: http.StatusBadRequest}\n\t}\n\treturn &n, nil\n}", "title": "" }, { "docid": "18d57550b68b9299f6318cc04952274a", "score": "0.5798562", "text": "func (yc *YnoteClient) NoteInfo(path string) (*NoteInfo, error) {\n\treqUrl := yc.URLBase + \"/yws/open/note/get.json\"\n\n\tparams := make(url.Values)\n\tparams.Set(\"path\", path)\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\n\tvar noteInfo struct {\n\t\tTitle string `json:\"title\"`\n\t\tAuthor string `json:\"author\"`\n\t\tSource string `json:\"source\"`\n\t\tSize int64 `json:\"size\"`\n\t\tCreateTime int64 `json:\"create_time\"` // in seconds\n\t\tModifyTime int64 `json:\"modify_time\"` // in seconds\n\t\tContent string `json:\"content\"`\n\t}\n\n\terr = json.Unmarshal(js, &noteInfo)\n\tif err != nil {\n\t\treturn nil, errors.New(\"Response is not a JSON: \" + string(js))\n\t}\n\n\treturn &NoteInfo{\n\t\tTitle: noteInfo.Title,\n\t\tAuthor: noteInfo.Author,\n\t\tSource: noteInfo.Source,\n\t\tSize: noteInfo.Size,\n\t\tCreateTime: time.Unix(noteInfo.CreateTime, 0),\n\t\tModifyTime: time.Unix(noteInfo.ModifyTime, 0),\n\t\tContent: noteInfo.Content,\n\t}, nil\n}", "title": "" }, { "docid": "a5b9818e848ba99c7feb635d2ef7901a", "score": "0.5795667", "text": "func (_PermaChat *PermaChatCallerSession) GetPost(postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\treturn _PermaChat.Contract.GetPost(&_PermaChat.CallOpts, postId)\n}", "title": "" }, { "docid": "da06b151c26b76e59f853c13e899fd82", "score": "0.5794527", "text": "func (m *BookingService) GetNotes()(*string) {\n val, err := m.GetBackingStore().Get(\"notes\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "19a294416bf6343babc2682817a58ced", "score": "0.57406", "text": "func readNote(note []byte) {\n\t// fmt.Printf(\"Note size: %d\\n\", len(transaction.Note))\n\tvar m interface{}\n\terr := msgpack.Decode(note, &m)\n\tif err != nil {\n\t\tfmt.Printf(\"Cannot decode note - %s\\n\", err)\n\t}\n\tfmt.Printf(\"Decoded type: %T\\n\", m)\n\tfmt.Printf(\"Decoded byte: %v\\n\", m)\n\tif fmt.Sprintf(\"%T\", m) == \"[]uint8\" {\n\t\tfmt.Printf(\"Decoded text: %s\\n\", m)\n\t} else if fmt.Sprintf(\"%T\", m) == \"map[interface {}]interface {}\" {\n\t\tvar m map[interface{}]string\n\t\terr := msgpack.Decode(note, &m)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"Cannot decode note - %s\\n\", err)\n\t\t}\n\t\tfmt.Print(\"Decoded text:\\n\")\n\t\tfor k, v := range m {\n\t\t\tfmt.Printf(\"\\t%v: %v\\n\", k, v)\n\t\t}\n\t} else {\n\t\tfmt.Println(\"Cannot recognize encoding\")\n\t}\n}", "title": "" }, { "docid": "f1daca1a4aff5a59e4e25abbbfe8f98e", "score": "0.57209444", "text": "func GetNote(context *Context) http.HandlerFunc {\n\treturn func (w http.ResponseWriter, r *http.Request) {\n\t\t// Create response.\n\t\tresp := NewJSONResponse()\n\t\tdefer resp.Respond(w)\n\n\t\t// Get the note ID.\n\t\tnID, ok := GetURLID(r, &resp)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\t// Check for the note's existence.\n\t\tif e, err := CheckExistence(nID, \"notes\", context.DB); !e {\n\t\t\tif err == nil {\n\t\t\t\tresp.StatusCode = 404\n\t\t\t\tresp.ErrorMessage = \"Note not found.\"\n\t\t\t} else {\n\t\t\t\tresp.StatusCode = 500\n\t\t\t\tresp.ErrorMessage = \"Could not verify note's existence.\"\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\t\n\t\t// Load the note model.\n\t\tn, err := LoadNote(nID, context.DB)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not load note.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Get the logged in user's data.\n\t\tcurrentUserID, currentUserAdmin, err := context.LoggedInUser(r)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not retrieve logged in user.\"\n\t\t\treturn\n\t\t}\n\n\t\t// If the currently logged in user does not own the note, or is not\n\t\t// admin, access will be denied to the note.\n\t\tif !currentUserAdmin && currentUserID != n.UserID {\n\t\t\tresp.StatusCode = 403\n\t\t\tresp.ErrorMessage =\"Access denied.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Add the note model to the response.\n\t\tresp.Models = append(resp.Models, n)\n\t}\n}", "title": "" }, { "docid": "7ba389a72da8f038b464a4998c7a8a6d", "score": "0.5717158", "text": "func (_PermaChat *PermaChatSession) GetPost(postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\treturn _PermaChat.Contract.GetPost(&_PermaChat.CallOpts, postId)\n}", "title": "" }, { "docid": "d3d760442c6d4c8814265d2653faa456", "score": "0.56678313", "text": "func (c *Client) GetPost(id int) (Item, error) {\n\turl := fmt.Sprintf(\"https://hacker-news.firebaseio.com/v0/item/%s.json\", strconv.Itoa(id))\n\trequest, err := http.NewRequest(\"GET\", url, nil)\n\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\tresponse, err := c.httpClient.Do(request)\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\tvar result Item\n\terr = json.NewDecoder(response.Body).Decode(&result)\n\tif err != nil {\n\t\treturn Item{}, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "6dad1da168efac1862aebc497a780869", "score": "0.5651798", "text": "func (re *Record) CreateNote(w http.ResponseWriter, r *http.Request) {\n\tif r.Method != http.MethodPost {\n\t\tw.WriteHeader(http.StatusMethodNotAllowed)\n\t\treturn\n\t}\n\n\tbody, err := io.ReadAll(r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tvar note Note\n\tif err := json.Unmarshal(body, &note); err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tresult := re.DB.Create(&note)\n\tif result.Error != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"%s\", result.Error), http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tw.WriteHeader(http.StatusCreated)\n}", "title": "" }, { "docid": "662218adcd8627596940c9aad8e41a92", "score": "0.5648245", "text": "func getPost(res http.ResponseWriter, req *http.Request) {\n\tres.Header().Set(\"content-type\", \"application/json\")\n\t// get the params to get id of user\n\tparams := mux.Vars(req) \n\tid,_ := primitive.ObjectIDFromHex(params[\"id\"]) \n\n\t//declaring variable\n\tvar post Post\n\n\t//refernce the collection\n\tcollection:= client.Database(\"appointy\").Collection(\"posts\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\n\t//get the required data by matching id\n\terr:=collection.FindOne(ctx,Post{Id:id}).Decode(&post)\t\n\n\t//error handling\n\tif err!= nil {\n\t\tres.WriteHeader(http.StatusInternalServerError)\n\t\tres.Write([]byte(`{\"message\" :\"`+ err.Error() +`\"}`))\n\t\treturn\n\t}\n\t//send json data\n\tjson.NewEncoder(res).Encode(post)\n}", "title": "" }, { "docid": "9babe5fe8cf8ed90b83926c220558429", "score": "0.5638972", "text": "func getNoteID(r *http.Request) (noteid string) {\n\tnoteid = mux.Vars(r)[\"id\"]\n\treturn noteid\n}", "title": "" }, { "docid": "0c7a984be785082fcc7a58088cbf1f42", "score": "0.562741", "text": "func (_PermaChat *PermaChatCaller) GetPost(opts *bind.CallOpts, postId *big.Int) (struct {\n\tIpfsHash string\n\tPoster common.Address\n\tBlockNumber *big.Int\n\tTimestamp *big.Int\n\tContentType string\n}, error) {\n\tret := new(struct {\n\t\tIpfsHash string\n\t\tPoster common.Address\n\t\tBlockNumber *big.Int\n\t\tTimestamp *big.Int\n\t\tContentType string\n\t})\n\tout := ret\n\terr := _PermaChat.contract.Call(opts, out, \"getPost\", postId)\n\treturn *ret, err\n}", "title": "" }, { "docid": "688fc50b8e95be170446fe3cdc66b638", "score": "0.55711555", "text": "func (c *Client) CreateNote(ctx context.Context, note Note, out ResponseModel) error {\n\n\treq, err := c.NewRequest(http.MethodPost, \"/notes\", nil, note)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_, err = c.Do(ctx, req, out)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !out.Successful() {\n\t\treturn fmt.Errorf(\"not successful, error: %v\", out.ErrorString())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fe3504addf172c1305bfddc73dbf9359", "score": "0.5570174", "text": "func HandleGetNotes(w http.ResponseWriter, r *http.Request) {\n\tnotes, err := fetchNotes()\n\tif err != nil {\n\t\tlog.Printf(\"Error fetching notes: %s\\n\", err)\n\t\thttp.Error(w, \"Error fetching notes\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(notes)\n}", "title": "" }, { "docid": "2e576c245c5fa0f182bd2ccf957a4a79", "score": "0.55632025", "text": "func (req *request) Post() (*response.Response, error) {\n\tdeliveryTime := time.Now()\n\tres, err := http.Post(req.url, ContentType, bytes.NewBuffer(req.Body))\n\tif err != nil {\n\t\treturn &response.Response{}, err\n\t}\n\tr, err := req.extractData(res, deliveryTime)\n\tif err != nil {\n\t\treturn &response.Response{}, err\n\t}\n\treturn r, nil\n}", "title": "" }, { "docid": "9bfee2448c9b69ae2d8938001392418b", "score": "0.5556205", "text": "func (o *Event) GetNote() (value string, ok bool) {\n\tok = o != nil && o.bitmap_&8192 != 0\n\tif ok {\n\t\tvalue = o.note\n\t}\n\treturn\n}", "title": "" }, { "docid": "4172845265d35ace662172b34f2dfe60", "score": "0.55493635", "text": "func (m *ServicePrincipal) GetNotes()(*string) {\n return m.notes\n}", "title": "" }, { "docid": "357dac9384335c965e5373a52f49efae", "score": "0.55376816", "text": "func saveNote(w http.ResponseWriter, r *http.Request) {\n r.ParseForm()\n title := r.PostFormValue(\"title\")\n desc := r.PostFormValue(\"description\")\n note := Note{title, desc, time.Now()}\n //increment the value of id for generating key for the map\n id++\n //convert id value to string\n k := strconv.Itoa(id)\n noteStore[k] = note\n http.Redirect(w, r, \"/\", 302)\n}", "title": "" }, { "docid": "3f4ca6dbfe10e2bfb36059a621af900d", "score": "0.5492479", "text": "func GetPost(w http.ResponseWriter, r *http.Request, app *api.AppService) error {\n\n\tvars := mux.Vars(r)\n\tid, _ := strconv.Atoi(vars[\"id\"])\n\tpost := &models.Post{ID: id}\n\n\terr := post.GetPost(app.DB)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcookie := shared.GetCookie(r)\n\tdata := shared.Wrapper{*post, cookie}\n\treturn renderer.RenderTemplate(w, \"post.tmpl\", data)\n}", "title": "" }, { "docid": "f58d20f95938e7a714770dc7d3c789b6", "score": "0.54922533", "text": "func GetPost(postId string, simplified bool, session *r.Session) interface{} {\n\tvar simplePost ct.SimplePost\n\tvar post ct.Post\n\tfullPost := make(map[string]interface{})\n\tdb := os.Getenv(\"DB\")\n\tpostTable := os.Getenv(\"POSTTABLE\")\n\tcur, _ := r.DB(db).Table(postTable).Get(postId).Run(session)\n\tcur.One(&post)\n\tsimplePost = ct.SimplePost{\n\t\tId: post.Id,\n\t\tTitle: post.Title,\n\t\tCreatedOn: post.CreatedOn,\n\t\tMessage: post.PostBody.Message,\n\t\tImage: post.PostBody.Img.Link,\n\t}\n\t// post.PostBody.Img.Link = \"https://ipfs.io/ipfs/\" + post.PostBody.Img.Link\n\tfmt.Println(simplePost)\n\tif simplified {\n\t\tfullPost[\"post\"] = simplePost\n\t} else {\n\t\tfullPost[\"post\"] = post\n\t}\n\tfullPost[\"comments\"] = GetComments(postId, session)\n\treturn fullPost\n}", "title": "" }, { "docid": "9e468a1449333187de02336e5e97d3a4", "score": "0.5476865", "text": "func getPost(w http.ResponseWriter, r *http.Request){\n\t\tfmt.Println(r.Method,r.URL.Path)\n\t\tif r.Method == \"GET\" {\n\n\t\t\t\tre := regexp.MustCompile(\"/posts/([0-9a-zA-Z]+)\")\n\t\t\t\tpost_id:=re.FindStringSubmatch(r.URL.Path)[0][7:]\n\t\t\t\tfmt.Println(post_id)\n\t\t\t\tvar result Post\n\t\t\t\tfilter := bson.D{{\"id\", post_id}}\n\n\t\t\t\terr := p_collection.FindOne(context.TODO(), filter).Decode(&result)\n\t\t\t\tif err != nil {\n \t\t\tlog.Fatal(err)\n\t\t\t\t}\n\n \t\tfmt.Printf(\"Found a single document: %+v\\n\", result)\n\t\t\t\tb, err := json.Marshal(result)\n\t\t\t\tif err!=nil {\n\t\t\t\t\tfmt.Println(\"error converting struct to json\")\n\t\t\t\t}else {\n\t\t\t\t\tfmt.Fprintf(w, string(b))\n\t\t\t\t}\n\t\t}\n}", "title": "" }, { "docid": "407b35f452025cebe13d26293faf5822", "score": "0.5464097", "text": "func (s *service) GetPost(ctx context.Context, params model.GetItemRequest) (interface{}, error) {\n\tp, err := s.post.PostByID(ctx, *params.ID, \"post\")\n\tif err == sql.ErrNoRows {\n\t\treturn nil, model.ErrInvalidPostID\n\t}\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"params\": fmt.Sprintf(\"ID: %d, Type: %s\", params.ID, \"post\"),\n\t\t\t\"func\": \"s.post.PostByID\",\n\t\t}).Errorf(\"Failed to get post by id: %s\", err)\n\t\treturn nil, err\n\t}\n\n\t// pull required related data to construct complete post response\n\tpostData, err := s.PullRawPostData(ctx, []uint64{p.ID}, []uint64{p.Author}, params.IsEmbed)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"params\": fmt.Sprintf(\"ID: %v, Authors: %s, IsEmbed: %t\", []uint64{p.ID}, []uint64{p.Author}, params.IsEmbed),\n\t\t\t\"func\": \"s..PullRawPostData\",\n\t\t}).Errorf(\"Failed to get raw post: %s\", err)\n\t\treturn nil, err\n\t}\n\n\tp.FeaturedMedia = postData.FeaturedMedia[p.ID]\n\tp.SetLinks(ctx)\n\tpredecessorVersions, err := s.post.GetPredecessorVersion(ctx, []uint64{p.ID})\n\tp.SetPredecessorVersion(model.GetBaseURL(ctx), predecessorVersions[p.ID][0])\n\n\t// if post is embed ( _embed is on query string ) we need to pull all embedded attributes like author, term, replies, and featured media\n\tif params.IsEmbed {\n\t\terr = s.SetPostEmbedded(ctx, p, postData.TermTaxonomies[p.ID], postData.FormatMap, postData.User[p.ID])\n\t\tif err != nil {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"params\": fmt.Sprintf(\"termtaxonomies :%v, formatmap: %v, user : %v\", postData.TermTaxonomies[p.ID], postData.FormatMap, postData.User[p.ID]),\n\t\t\t\t\"func\": \"s.SetPostEmbedded\",\n\t\t\t}).Errorf(\"Failed to set post embedded: %s\", err)\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\t// if context = embed, we only return core attributes of post\n\tif params.Context == model.EmbedContext {\n\t\treturn &model.ContentBase{Base: p.Base, SharedContent: p.SharedContent, Embedded: p.Embedded}, err\n\t}\n\n\tp.SetViewAttributes(postData.Metas, postData.Taxonomies, postData.FormatMap)\n\tp.SetSticky(postData.StickyPostIDs)\n\n\treturn p, err\n}", "title": "" }, { "docid": "26d0bf74a534ed8ba783a29e89586db3", "score": "0.54511756", "text": "func (db *DB) GetNote(notebookName string, reqNoteId uint64) (Note, error) {\n\tvar note Note\n\terr := db.View(func(tx *bolt.Tx) error {\n\t\treqNoteIdBytes := []byte(strconv.FormatUint(reqNoteId, 10))\n\t\tnotebookBucket := tx.Bucket([]byte(\"Notebook\")).Bucket([]byte(notebookName))\n\n\t\tfoundNoteIdBytes, foundNoteContentBytes := notebookBucket.Cursor().Seek(reqNoteIdBytes)\n\t\tif foundNoteIdBytes != nil && bytes.Equal(reqNoteIdBytes, foundNoteIdBytes) {\n\t\t\treturn json.Unmarshal(foundNoteContentBytes, &note)\n\t\t}\n\n\t\treturn nil\n\t})\n\treturn note, err\n}", "title": "" }, { "docid": "026cd2534bfdcc5c6ab75f6f8231e85c", "score": "0.5448841", "text": "func postToPostData(post *Post, previewContent bool) postData {\n\treturn postData{\n\t\tTitle: post.title,\n\t\tContent: template.HTML(post.content),\n\t\tPreview: template.HTML(post.preview),\n\t\tPublishDate: post.metadata.publishDate.Format(\"2 Jan 2006\"),\n\t\tUrl: post.urlPath,\n\t\tTags: post.metadata.tags,\n\t}\n}", "title": "" }, { "docid": "440d2162586417b3c7c132128b67afdd", "score": "0.5428633", "text": "func (NotesController) Create(w http.ResponseWriter, req *http.Request, _ httprouter.Params) {\n\tbody, err := ioutil.ReadAll(req.Body)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tparams := allowedParams{}\n\terr = json.Unmarshal(body, &params)\n\tnote := models.Note{Title: params.Title}\n\tnote.Save()\n}", "title": "" }, { "docid": "480f71c1a213157a3ddf9fab191cbd19", "score": "0.5417613", "text": "func apiNotes(rw http.ResponseWriter, req *http.Request) {\r\n\tif req.Method == http.MethodGet {\r\n\t\tparams, err := GetParams(apiNotesPathWithParams, req)\r\n\t\tif err != nil {\r\n\t\t\tInternalError(rw, req, err)\r\n\t\t\treturn\r\n\t\t}\r\n\r\n\t\tlst := note.List(params[\"author\"])\r\n\t\tWriteJSON(rw, req, lst)\r\n\t} else {\r\n\t\tNotFound(rw, req)\r\n\t}\r\n}", "title": "" }, { "docid": "c356d80023f9a421d2de2482ac8131b1", "score": "0.54161155", "text": "func (no *Notification) PostGet(db gorp.SqlExecutor) error {\n\tres, err := db.SelectNullStr(\"SELECT settings FROM workflow_notification WHERE id = $1\", no.ID)\n\tif err != nil {\n\t\treturn sdk.WrapError(err, \"Unable to load marshalled workflow notification\")\n\t}\n\n\tif err := gorpmapping.JSONNullString(res, &no.Settings); err != nil {\n\t\treturn sdk.WrapError(err, \"cannot parse user notification\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5b0dafd698109100019285162dd4c845", "score": "0.5414538", "text": "func (t *TodoResource) Post(c *goweb.Context) goweb.Responder {\n\tid := t.counter\n\tt.counter++\n\tt.Todos[strconv.Itoa(id)] = Todo{Text: \"new from post\"}\n\treturn c.JSON(http.StatusOK, id)\n}", "title": "" }, { "docid": "61bdc58b470edd84649a928f16cdbd4e", "score": "0.53809166", "text": "func readPostData(req *http.Request) []byte {\n\tvar ret []byte\n\t{\n\t\tbuf := bytes.NewBuffer(make([]byte, 0, 1024))\n\t\treq.Write(buf)\n\t\tret = buf.Bytes()\n\t}\n\tpos := bytes.Index(ret, []byte(\"\\r\\n\\r\\n\")) // skip HTTP headers\n\tif pos != -1 {\n\t\tret = ret[pos+4:]\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "c31102d08d379d5cd04b1bd53351757b", "score": "0.5369452", "text": "func (w *WatcherComponent) Post (post *reddit.Post) error {\n\treturn w.storage.SavePost(*post)\n}", "title": "" }, { "docid": "10e9f6757af24a65819d6f488e50afe2", "score": "0.53686184", "text": "func (n *NoteResource) updateNote(request *restful.Request, response *restful.Response) {\n note := new(Note)\n err := request.ReadEntity(&note)\n if err == nil {\n //n.notes[note.ID] = note\n response.WriteEntity(note)\n //response.WriteHeaderAndEntity(http.StatusCreated, note)\n } else {\n response.AddHeader(\"Content-Type\", \"text/plain\")\n response.WriteErrorString(http.StatusInternalServerError, err.Error())\n }\n}", "title": "" }, { "docid": "9b83724af465173ce582d744f43f5b91", "score": "0.53625613", "text": "func (b *BackendHandler) getPost(w http.ResponseWriter, r *http.Request) {\n\n\tvars := mux.Vars(r)\n\tidStr := vars[\"id\"]\n\n\tid, err := strconv.ParseUint(idStr, 10, 64)\n\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusBadRequest)\n\t\tw.Write([]byte(\"Missing required post id as unsigned int PATH variable\"))\n\t\treturn\n\t}\n\n\tpost, err := goboardbackend.GetPost(b.Db, id)\n\tif err != nil {\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tif post.ID == 0 {\n\t\tw.WriteHeader(http.StatusNotFound)\n\t\treturn\n\t}\n\n\tvar data []byte\n\tformat := guessFormat(vars[\"format\"], r.Header.Get(\"Accept\"))\n\tswitch format {\n\tcase \"json\":\n\t\tpost.RawMessage = \"\"\n\t\tdata, err = json.Marshal(post)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tcase \"tsv\":\n\t\tstr := fmt.Sprintf(\"%d\\t%s\\t%s\\t%s\\t%s\\n\",\n\t\t\tpost.ID, post.Time.Format(goboardbackend.PostTimeFormat), post.Info, post.Login, post.Message)\n\t\tdata = []byte(str)\n\t\tw.Header().Set(\"Content-Type\", \"text/tab-separated-values\")\n\tcase \"raw\":\n\t\tdata = []byte(post.RawMessage)\n\t\tw.Header().Set(\"Content-Type\", \"text/plain\")\n\n\tdefault:\n\t\tpost.RawMessage = \"\"\n\t\tdata, err = xml.Marshal(post)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\treturn\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", \"application/xml\")\n\t}\n\n\tw.WriteHeader(http.StatusOK)\n\tw.Write(data)\n\n\treturn\n}", "title": "" }, { "docid": "cc61b9c50fc298f1174ad379ed28c10a", "score": "0.5359907", "text": "func servePost(w http.ResponseWriter, r *http.Request) error {\n\tid, _ := strconv.Atoi(mux.Vars(r)[\"ID\"])\n\n\t// Push Datastore-related logic from API HTTP handlers into Datastore // HL\n\tpost, _ := store.Posts.Get(id) // HL\n\n\treturn writeJSON(w, post)\n}", "title": "" }, { "docid": "4f271f081113150849c8b99185d98da9", "score": "0.5359454", "text": "func CreateNote(ctx context.Context, request events.APIGatewayProxyRequest) (Response, error) {\n\tvar buf bytes.Buffer\n\n\tid, err := uuid.NewUUID()\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\n\tcognitoIdentityID := request.RequestContext.Identity.CognitoIdentityID\n\tmyNote := note{\n\t\tUserID: cognitoIdentityID,\n\t\tNoteID: id.String(),\n\t\tContent: request.Body,\n\t}\n\n\tdattr, err := dynamodbattribute.MarshalMap(myNote)\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\n\tsvc := dynamodb.New(session.Must(session.NewSession()))\n\tinput := &dynamodb.PutItemInput{\n\t\tItem: dattr,\n\t\tTableName: aws.String(os.Getenv(\"tableName\")),\n\t}\n\t_, err = svc.PutItem(input)\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\n\tbody, err := json.Marshal(map[string]interface{}{\n\t\t\"message\": \"Note created successfully!\",\n\t})\n\tif err != nil {\n\t\treturn Response{StatusCode: 404}, err\n\t}\n\n\tjson.HTMLEscape(&buf, body)\n\n\tresp := Response{\n\t\tStatusCode: 201,\n\t\tIsBase64Encoded: false,\n\t\tBody: buf.String(),\n\t\tHeaders: map[string]string{\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\t\"X-MyCompany-Func-Reply\": \"notes-handler\",\n\t\t},\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "4325aabd762f6220cb4f3617328d2f62", "score": "0.53414893", "text": "func HandleAddNote(w http.ResponseWriter, r *http.Request) {\n\tvar newNote NewNote\n\terr := json.NewDecoder(r.Body).Decode(&newNote)\n\tif err != nil {\n\t\thttp.Error(w, \"Invalid request body\", http.StatusBadRequest)\n\t\tlog.Printf(\"Error decoding request body: %s\\n\", err)\n\t\treturn\n\t}\n\tnoteID, err := getNextID()\n\tif err != nil {\n\t\thttp.Error(w, \"Error creating the new note\", http.StatusBadRequest)\n\t\tlog.Printf(\"Error fetching next note id: %s\\n\", err)\n\t\treturn\n\t}\n\tnote := Note{ID: noteID, Content: newNote.Content}\n\terr = addNote(note)\n\tif err != nil {\n\t\thttp.Error(w, \"Error creating the new note\", http.StatusBadRequest)\n\t\tlog.Printf(\"Error adding new note to store: %s\\n\", err)\n\t}\n\tjson.NewEncoder(w).Encode(note)\n}", "title": "" }, { "docid": "2b5f21997fefc00f83aaf7ebae15fe03", "score": "0.5327263", "text": "func (uc MongoPostController) GetPost(w http.ResponseWriter, r *http.Request, p httprouter.Params) {\n\tid := p.ByName(\"id\")\n\tfmt.Printf(\"GetPost %s called \\n\", id)\n\n\tif !bson.IsObjectIdHex(id){\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\n\toid := bson.ObjectIdHex(id)\n\n\tpst := models.Post{}\n\n\t// Fetch user\n\tif err := uc.session.DB(\"sense\").C(\"posts\").FindId(oid).One(&pst); err != nil {\n\t\tw.WriteHeader(404)\n\t\treturn\n\t}\n\tpj, _ := json.Marshal(pst);\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(200)\n\tfmt.Fprintf(w, \"%s\", pj)\n}", "title": "" }, { "docid": "fbf658318bd16a458b58ee575394748c", "score": "0.53222", "text": "func get_post() fiber.Handler {\n\treturn func(c *fiber.Ctx) error {\n\t\t// Get params\n\t\tgetUsername := c.Params(\"username\")\n\t\tgetPostId := c.Params(\"post_id\")\n\n\t\t// Not enough values given\n\t\tif getPostId == \"\" || getUsername == \"\" {\n\t\t\treturn c.Status(fiber.StatusPartialContent).JSON(fiber.Map{\n\t\t\t\t\"error\": \"invalid credentials\",\n\t\t\t})\n\t\t}\n\n\t\t// Transform post id in int64\n\t\tpostId, err := strconv.ParseInt(getPostId, 10, 64)\n\t\tif err != nil {\n\t\t\treturn c.Status(fiber.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\t\"error\": \"invalid post id\",\n\t\t\t})\n\t\t}\n\n\t\t// Check if post exists\n\t\thasPost, postRequest, _, err := utils.GetPost(postId)\n\t\tif err != nil {\n\t\t\treturn c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{\n\t\t\t\t\"error\": \"database error\",\n\t\t\t})\n\t\t}\n\t\tif !hasPost {\n\t\t\treturn c.Status(fiber.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\t\"error\": \"post not found\",\n\t\t\t})\n\t\t}\n\n\t\t// Get username id\n\t\t_, userRequest, _, err := utils.GetUserByUsername(getUsername)\n\t\tif err != nil {\n\t\t\treturn c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{\n\t\t\t\t\"error\": \"database error\",\n\t\t\t})\n\t\t}\n\n\t\t// Compare user id and post owner id\n\t\tif postRequest.OwnerId != userRequest.Id {\n\t\t\treturn c.Status(fiber.StatusBadRequest).JSON(fiber.Map{\n\t\t\t\t\"error\": \"invalid user and post combination\",\n\t\t\t})\n\t\t}\n\n\t\t// Get post comments\n\t\thasComments, postCommentsRequest, _, err := utils.GetPostComments(postId)\n\t\tif err != nil {\n\t\t\treturn c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{\n\t\t\t\t\"error\": \"database error\",\n\t\t\t})\n\t\t}\n\t\tif !hasComments {\n\t\t\tpostCommentsRequest = nil\n\t\t}\n\n\t\treturn c.Status(fiber.StatusOK).JSON(fiber.Map{\n\t\t\t\"post\": postRequest,\n\t\t\t\"comments\": postCommentsRequest,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "f1e3038b77c5886a95fcf1f369105de2", "score": "0.5315752", "text": "func (yc *YnoteClient) CreateNote(notebookPath, title, author, source, content string) (string, error) {\n\treqUrl := yc.URLBase + \"/yws/open/note/create.json\"\n\n\tparams := make(url.Values)\n\tparams.Set(\"notebook\", notebookPath)\n\tparams.Set(\"title\", title)\n\tparams.Set(\"author\", author)\n\tparams.Set(\"source\", source)\n\tparams.Set(\"content\", content)\n\n\tres, err := multipartPost(&yc.oauthClient, http.DefaultClient, (*oauth.Credentials)(yc.AccToken), reqUrl, params, nil)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\tdefer res.Body.Close()\n\n\tjs, err := ioutil.ReadAll(res.Body)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tif res.StatusCode == 500 {\n\t\treturn \"\", parseFailInfo(js)\n\t}\n\n\tvar path struct {\n\t\tPath string `json:\"path\"`\n\t}\n\terr = json.Unmarshal(js, &path)\n\tif err != nil {\n\t\treturn \"\", errors.New(\"Response is not a JSON: \" + string(js))\n\t}\n\n\treturn path.Path, nil\n}", "title": "" }, { "docid": "1f3e0c097277ae821918640275ede2df", "score": "0.53143656", "text": "func (h *Http) GetPost() url.Values {\n\treturn *h.post\n}", "title": "" }, { "docid": "77f2e06b7ec780e4334f29bf73047954", "score": "0.53138083", "text": "func getPost(c *gin.Context) {\n\tid := c.Param(\"id\")\n\tpost, err := models.GetPost(id)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tc.HTML(200, \"post.tmpl\", gin.H{\n\t\t\"Title\": post.Title,\n\t\t\"Post\": post,\n\t\t\"Prev\": nil,\n\t\t\"Next\": nil,\n\t})\n}", "title": "" }, { "docid": "8c4134a72f9cd2fd46c39b5514098145", "score": "0.5313133", "text": "func PutNote(context *Context) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Create a response.\n\t\tresp := NewJSONResponse()\n\t\tdefer resp.Respond(w)\n\n\t\t// Retrieve the form values.\n\t\ttitle := r.FormValue(\"title\")\n\t\tcontent := r.FormValue(\"content\")\n\t\ttime := r.FormValue(\"time\")\n\n\t\t// Make sure the title is not empty.\n\t\tif len(title) == 0 {\n\t\t\tresp.Fields[\"title\"] = \"Title must not be empty.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Retrieve the note ID.\n\t\tnID, ok := GetURLID(r, &resp)\n\t\tif !ok {\n\t\t\treturn\n\t\t}\n\n\t\t// Check for the note's existence.\n\t\tif e, err := CheckExistence(nID, \"notes\", context.DB); !e {\n\t\t\tif err == nil {\n\t\t\t\tresp.StatusCode = 404\n\t\t\t\tresp.ErrorMessage = \"Note not found.\"\n\t\t\t} else {\n\t\t\t\tresp.StatusCode = 500\n\t\t\t\tresp.ErrorMessage = \"Could not verify note's existence.\"\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Load the note model.\n\t\tn, err := LoadNote(nID, context.DB)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Note not found.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Retrieve the logged in user's data.\n\t\tuserID, currentUserAdmin, err := context.LoggedInUser(r)\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 403\n\t\t\tresp.ErrorMessage = \"Could not retrieve logged in user.\"\n\t\t\treturn\n\t\t}\n\n\t\t// If the user does not own this note, and isn't an admin, deny access.\n\t\tif !currentUserAdmin && userID != n.UserID {\n\t\t\tresp.StatusCode = 403\n\t\t\tresp.ErrorMessage = \"Access denied.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Update the note's values.\n\t\tn.Title = title\n\n\t\tn.Content.String = content\n\t\tn.Content.Valid = len(content) > 0\n\n\t\tn.Time.String = time\n\t\tn.Time.Valid = len(time) > 0\n\n\t\t// Save the note.\n\t\terr = n.Save()\n\t\tif err != nil {\n\t\t\tresp.StatusCode = 500\n\t\t\tresp.ErrorMessage = \"Could not save note.\"\n\t\t\treturn\n\t\t}\n\n\t\t// Add the newly updated note to the response.\n\t\tresp.Models = append(resp.Models, n)\n\t}\n}", "title": "" }, { "docid": "9afa43acb89bdc9bd7236d1950e0e90b", "score": "0.5298072", "text": "func GetNote(repo *Repository, commitID string, note *Note) error {\n\tnotes, err := repo.GetCommit(NotesRef)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tremainingCommitID := commitID\n\tpath := \"\"\n\tcurrentTree := notes.Tree.gogitTree\n\tvar file *object.File\n\tfor len(remainingCommitID) > 2 {\n\t\tfile, err = currentTree.File(remainingCommitID)\n\t\tif err == nil {\n\t\t\tpath += remainingCommitID\n\t\t\tbreak\n\t\t}\n\t\tif err == object.ErrFileNotFound {\n\t\t\tcurrentTree, err = currentTree.Tree(remainingCommitID[0:2])\n\t\t\tpath += remainingCommitID[0:2] + \"/\"\n\t\t\tremainingCommitID = remainingCommitID[2:]\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tblob := file.Blob\n\tdataRc, err := blob.Reader()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdefer dataRc.Close()\n\td, err := ioutil.ReadAll(dataRc)\n\tif err != nil {\n\t\treturn err\n\t}\n\tnote.Message = d\n\n\tcommitNodeIndex, commitGraphFile := repo.CommitNodeIndex()\n\tif commitGraphFile != nil {\n\t\tdefer commitGraphFile.Close()\n\t}\n\n\tcommitNode, err := commitNodeIndex.Get(notes.ID)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tlastCommits, err := GetLastCommitForPaths(commitNode, \"\", []string{path})\n\tif err != nil {\n\t\treturn err\n\t}\n\tnote.Commit = convertCommit(lastCommits[path])\n\n\treturn nil\n}", "title": "" }, { "docid": "5185feeba3e50e100f084d594bda7be3", "score": "0.5265054", "text": "func (c *grafeasV1Beta1RESTClient) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) {\n\tbaseUrl, err := url.Parse(c.endpoint)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbaseUrl.Path += fmt.Sprintf(\"/v1beta1/%v\", req.GetName())\n\n\tparams := url.Values{}\n\tparams.Add(\"$alt\", \"json;enum-encoding=int\")\n\n\tbaseUrl.RawQuery = params.Encode()\n\n\t// Build HTTP headers from client and context metadata.\n\thds := []string{\"x-goog-request-params\", fmt.Sprintf(\"%s=%v\", \"name\", url.QueryEscape(req.GetName()))}\n\n\thds = append(c.xGoogHeaders, hds...)\n\thds = append(hds, \"Content-Type\", \"application/json\")\n\theaders := gax.BuildHeaders(ctx, hds...)\n\topts = append((*c.CallOptions).GetNote[0:len((*c.CallOptions).GetNote):len((*c.CallOptions).GetNote)], opts...)\n\tunm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}\n\tresp := &grafeaspb.Note{}\n\te := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {\n\t\tif settings.Path != \"\" {\n\t\t\tbaseUrl.Path = settings.Path\n\t\t}\n\t\thttpReq, err := http.NewRequest(\"GET\", baseUrl.String(), nil)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\thttpReq = httpReq.WithContext(ctx)\n\t\thttpReq.Header = headers\n\n\t\thttpRsp, err := c.httpClient.Do(httpReq)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer httpRsp.Body.Close()\n\n\t\tif err = googleapi.CheckResponse(httpRsp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tbuf, err := io.ReadAll(httpRsp.Body)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := unm.Unmarshal(buf, resp); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}, opts...)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\treturn resp, nil\n}", "title": "" }, { "docid": "f2e115f7952fabe214a66f8ed9c7b3ea", "score": "0.5262338", "text": "func getPost(w http.ResponseWriter, r *http.Request) {\n\tloggedIn := 0\n\tsession, _ := store.Get(r, \"blog_admin\")\n\n\tif session.Values[\"logged_in\"] != nil {\n\t\tloggedIn = 1\n\t}\n\n\ttitle := strings.Replace(mux.Vars(r)[\"title\"], \"-\", \" \", -1)\n\n\tpost, blankCheck := Post{}, Post{}\n\n\tdb.Get(&post, \"select id, title, body, create_date, modify_date from posts where title = $1 and draft in (0,$2)\", title, loggedIn)\n\n\tif post == blankCheck {\n\t\thttp.Redirect(w, r, \"/\", 302)\n\t\treturn\n\t}\n\n\terr = templates.ExecuteTemplate(w, \"post\", post)\n\tcheckErr(err)\n}", "title": "" }, { "docid": "588cac7f4f794dff83c439e32afb4f86", "score": "0.5256978", "text": "func (r *Repo) GetNote(ctx context.Context, rev, notesRef string, note interface{}) (bool, error) {\n\treturn getNote(ctx, r.Dir(), notesRef, rev, note)\n}", "title": "" }, { "docid": "54f67cbdd2e20e8d6597deac51afaf50", "score": "0.5248171", "text": "func (c Client) Post(path string, params interface{}, holder interface{}) error {\n\treturn c.rpc.Request(http.MethodPost, path, params, &holder)\n}", "title": "" }, { "docid": "1d2c01d9790e65f2a0fd7bdbf0638744", "score": "0.52290547", "text": "func CreateNoteHandler(w http.ResponseWriter, r *http.Request) {\n\tdefer r.Body.Close()\n\tvar note Note\n\tif err := json.NewDecoder(r.Body).Decode(&note); err != nil {\n\t\trespondWithError(w, http.StatusBadRequest, \"Invalid request payload\")\n\t\treturn\n\t}\n\tnote.ID = bson.NewObjectId()\n\tif err := dao.Insert(note); err != nil {\n\t\trespondWithError(w, http.StatusInternalServerError, err.Error())\n\t\treturn\n\t}\n\trespondWithJson(w, http.StatusCreated, note)\n}", "title": "" }, { "docid": "9395c9d83f16de7e68e84280367f3c72", "score": "0.5228766", "text": "func (c *Controller) GetPost(field string) string {\n\treturn c.Context.Request.PostFormValue(field)\n}", "title": "" }, { "docid": "0eddff2d0fca7bcb7a2f4d149dfd2e03", "score": "0.52139395", "text": "func (d *Decoder) note(xref string) *NoteRecord {\n\tif xref == \"\" {\n\t\treturn &NoteRecord{}\n\t}\n\n\tref, found := d.refs[xref].(*NoteRecord)\n\tif !found {\n\t\trec := &NoteRecord{Xref: xref}\n\t\td.refs[rec.Xref] = rec\n\t\treturn rec\n\t}\n\treturn ref\n}", "title": "" }, { "docid": "bc84fbc056325663fca8ff9322b2e9f7", "score": "0.5204107", "text": "func (c *GrafeasV1Beta1Client) GetNote(ctx context.Context, req *grafeaspb.GetNoteRequest, opts ...gax.CallOption) (*grafeaspb.Note, error) {\n\treturn c.internalClient.GetNote(ctx, req, opts...)\n}", "title": "" }, { "docid": "e96f03a7003c45c8a2127dd3a5ed4779", "score": "0.5199048", "text": "func (h *requestHandler) GetPost(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"content-type\", \"application/json\")\n\tmatches := getPostRe.FindStringSubmatch(request.URL.Path)\n\tif len(matches) < 2 {\n\t\tnotFound(response, request)\n\t\treturn\n\t}\n\tid := matches[1]\n\n\tvar p post\n\tcollection := client.Database(\"appointy\").Collection(\"posts\")\n\tctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)\n\tdefer cancel()\n\n\terr := collection.FindOne(ctx, bson.M{\"id\": id}).Decode(&p)\n\tif err != nil {\n\t\tinternalServerError(response, request)\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(p)\n}", "title": "" }, { "docid": "885337224949098d4aba242aa398e00e", "score": "0.5187343", "text": "func getNote(id int64, db *sql.DB) models.Note {\n\tPingOrPanic(db) //error checking for if the database connection exists\n\tvar note models.Note // create a user of models.User type\n\tsqlStatement := `SELECT * FROM notes WHERE id=$1` // create the select sql query\n\trow := QueryRowForType(db, sqlStatement, id) // execute the sql statement\n\tnote = models.ParseSingleNote(row) // scan the note properly\n\treturn note // return empty user on error\n}", "title": "" }, { "docid": "b16e3dbd878faf6278a73c1970f22c48", "score": "0.51744914", "text": "func HandlePatientNote(ctx *fasthttp.RequestCtx) error {\n\tswitch string(ctx.Request.Header.Method()) {\n\tcase \"POST\":\n\t\treturn handleMethodNotePost(ctx)\n\tdefault:\n\t\tctx.NotFound()\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "2ce552f7755acdb213efe3210694e699", "score": "0.51688737", "text": "func (db *Database) Post(body Body) (string, string, error) {\n\tif body[\"_rev\"] != nil {\n\t\treturn \"\", \"\", &base.HTTPError{Status: http.StatusNotFound,\n\t\t\tMessage: \"No previous revision to replace\"}\n\t}\n\tdocid := createUUID()\n\trev, err := db.Put(docid, body)\n\tif err != nil {\n\t\tdocid = \"\"\n\t}\n\treturn docid, rev, err\n}", "title": "" }, { "docid": "038a60ed0252423c87b25cbac49f5ee2", "score": "0.5166616", "text": "func (handler *CommandHandler) handleNote(args []string) []string {\n\tparsedArg := parseNoteArg(args)\n\n\tcatalog, err := handler.conbotClient.GetCatalog(parsedArg.servicePrefixes, parsedArg.tagExacts)\n\tif err != nil {\n\t\treturn []string{err.Error()}\n\t}\n\n\tnote, err := handler.conbotClient.GetNote(catalog, parsedArg.tagExacts)\n\tif err != nil {\n\t\treturn []string{err.Error()}\n\t}\n\n\treturn []string{note.ToSlackFormat()}\n}", "title": "" }, { "docid": "694930552225f1c656d41fdba0697670", "score": "0.5152672", "text": "func (w *warning) PostGet(db gorp.SqlExecutor) error {\n\tvar fields = struct {\n\t\tMessageParams sql.NullString `db:\"message_params\"`\n\t}{}\n\n\tif err := db.QueryRow(\"select message_params from warning where id = $1\", w.ID).Scan(&fields.MessageParams); err != nil {\n\t\treturn err\n\t}\n\n\tif err := gorpmapping.JSONNullString(fields.MessageParams, &w.MessageParams); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bfb9af51f98bf59459809ea20f3da53d", "score": "0.5131851", "text": "func GetPostEndpoint(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"content-type\", \"application/json\")\n\tparams := mux.Vars(request)\n\tid, _ := primitive.ObjectIDFromHex(params[\"id\"])\n\tvar post Posts\n\tcollection := client.Database(\"InstagramBackendAPI\").Collection(\"post\")\n\tctx, _ := context.WithTimeout(context.Background(), 10*time.Second)\n\terr := collection.FindOne(ctx, Posts{ID: id}).Decode(&post)\n\tif err != nil {\n\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\tresponse.Write([]byte(`{ \"message\": \"` + err.Error() + `\" }`))\n\t\treturn\n\t}\n\tjson.NewEncoder(response).Encode(post)\n}", "title": "" }, { "docid": "a84df9aedcc287ed6cc4b43bfa57264f", "score": "0.51233137", "text": "func GetPost(id int64) (model.Post, *utils.ErrorAPI) {\n\n\t//Change data access to a variable to improve performance\n\taccess := data.CreateDataAccess()\n\tpost, resourceError := access.GetPost(id)\n\n\t//post, resourceError := domainVar.GetPost(id)\n\n\t//Post not found\n\tif resourceError != nil {\n\t\treturn post, &utils.ErrorAPI{ErrorCode: http.StatusNotFound, ErrorMessage: resourceError.Error()}\n\t}\n\n\treturn post, nil\n}", "title": "" }, { "docid": "9d52aa645fcaee913008d418b555b2b2", "score": "0.51166785", "text": "func (a *AnkiClient) AddNote(note *AnkiNoteMeta) error {\n\tpath := a.endpoint\n\n\tbs, err := json.Marshal(buildPayloadFromAnkiNote(note))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", path, bytes.NewReader(bs))\n\tif err != nil {\n\t\treturn err\n\t}\n\treq.Header.Add(\"Content-Type\", \"application/json\")\n\n\tresp, err := a.client.Do(req)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn fmt.Errorf(\"get an unexpected status code %d\", resp.StatusCode)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a95bf5ecd15a88aa089e49e7b3045152", "score": "0.5112421", "text": "func notes(w http.ResponseWriter, r *http.Request) {\n\tvar data string\n\tt := template.Must(template.ParseFiles(\n\t\tconfig.Templates+\"/notes.html\",\n\t\tconfig.Templates+\"/navigation.html\"))\n\tt.ExecuteTemplate(w, \"notes\", data)\n}", "title": "" }, { "docid": "1e2aea32f86a7d3a3cbd29d393b4611e", "score": "0.5111604", "text": "func handleAjaxShowReplies(w http.ResponseWriter, r *http.Request) {\n var rp ShowRepliesRequest\n //fmt.Println(\"got Request: \", r.Body)\n //parse the json in the body text into a Post object\n err := json.NewDecoder(r.Body).Decode(&rp)\n if err != nil {\n //fmt.Println(\"Decoding error: \", err)\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n\n //get the ip from the request header\n //ip := ReadUserIP(r)\n //the reply object\n var res ShowRepliesRequestResponse\n //call the addPost method to add the post to db\n res = showReplies(rp)\n\n // create json response from serializing a CreatePostReply struct\n a, err := json.Marshal(res)\n if err != nil {\n //fmt.Println(\"Encoding error: \", err)\n http.Error(w, err.Error(), http.StatusInternalServerError)\n return\n }\n w.Write(a)\n}", "title": "" }, { "docid": "b2d7431abf98d99a58b6e10fdb16d310", "score": "0.5108107", "text": "func postTrack(w http.ResponseWriter, r *http.Request) {\n\tvar data map[string]string\n\tif err := json.NewDecoder(r.Body).Decode(&data); err != nil {\n\t\thttp.Error(w, \"Invalid body\", http.StatusBadRequest)\n\t} else if url, ok := data[\"url\"]; !ok {\n\t\thttp.Error(w, \"Missing url\", http.StatusBadRequest)\n\t} else if id, err := dbPostTrack(url); err != nil {\n\t\thttp.Error(w, \"Url does not contain track data\", http.StatusBadRequest)\n\t} else {\n\t\tresponse := make(map[string]int)\n\t\tresponse[\"id\"] = id\n\t\trender.JSON(w, r, response)\n\t}\n}", "title": "" }, { "docid": "e209dfc0dc807102a4cfd24c03409d1e", "score": "0.51054204", "text": "func PutNoteHandler(w http.ResponseWriter, r *http.Request) {\n\t// extraer los parametros de la ruta\n\tparams := mux.Vars(r) //devuelve un slice\n\n\t// id de la nota\n\tk := params[\"id\"]\n\n\t// mantiene los datos enviados para actualizar\n\tvar noteUpdate Note\n\n\t// extrae lo enviado en el request\n\terr := json.NewDecoder(r.Body).Decode(&noteUpdate)\n\n\t// manejo de error\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// sentencia antes de conficion (ok)\n\tif buscarNota, ok := noteStore[k]; ok {\n\t\t// mantiene la fecha de creacion\n\t\tnoteUpdate.CreatedAt = buscarNota.CreatedAt\n\n\t\t// borra la nota anterior\n\t\tdelete(noteStore, k)\n\n\t\t// pone la nota nueva (actualizada)\n\t\tnoteStore[k] = noteUpdate\n\t} else {\n\t\tlog.Printf(\"No se encontro la nota con el id %s\", k)\n\t}\n\n\t// respuesta de id no encontrado\n\tw.WriteHeader(http.StatusNoContent) // 204 //se devuelve por convencion en update y delete, que no hay contenido que devolver\n}", "title": "" }, { "docid": "7b34c7b53550ac36ccbe26bfb7fbdd5f", "score": "0.5099809", "text": "func (ths *MainController) Post() {\n\tSetCxtRespHeader(ths.Ctx)\n\tths.Data[\"Website\"] = \"ebitgo.com\"\n\tths.Data[\"Email\"] = \"support@ebitgo.com\"\n\tths.TplName = \"index.tpl\"\n}", "title": "" }, { "docid": "92c87fd96e34cc686b5c0744281db387", "score": "0.50973153", "text": "func (r *Request) Post(key string, value ...string) (string, error) {\n\tif v, ok := r.post[key]; ok {\n\t\treturn v, nil\n\t}\n\n\tif len(value) > 0 {\n\t\treturn value[0], nil\n\t}\n\treturn \"\", errors.New(\"named post not present\")\n}", "title": "" }, { "docid": "fb140e2564f88bbb0840b57eef161c8d", "score": "0.509464", "text": "func (c Cerberus) CreateNote(messageID int, note string) error {\n\tparams := url.Values{}\n\tparams.Set(\"fields[author__context]\", \"message\")\n\tparams.Set(\"fields[author_id]\", strconv.Itoa(messageID))\n\tparams.Set(\"fields[comment]\", note)\n\tparams.Set(\"fields[target__context]\", \"message\")\n\tparams.Set(\"fields[target_id]\", strconv.Itoa(messageID))\n\n\tvar ticket CreateCommentResponse\n\terr := c.performRequest(http.MethodPost, \"records/comment/create.json\", params, nil, &ticket)\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Failed to create ticket sticky note: %v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4a1552902b42924035922d471d659386", "score": "0.5092658", "text": "func (m *OnenotePatchContentPostRequestBody) GetAdditionalData()(map[string]interface{}) {\n return m.additionalData\n}", "title": "" }, { "docid": "310fd2e3ed97665cb00fb88850d34691", "score": "0.5091467", "text": "func GetPost(db *mongo.Client) func(response http.ResponseWriter, request *http.Request) {\n\treturn func(response http.ResponseWriter, request *http.Request) {\n\t\tresponse.Header().Add(\"content-type\", \"application/json; charset=utf-8\")\n\n\t\tauthID, _, ok := request.BasicAuth()\n\t\tparams := mux.Vars(request)\n\n\t\tid, err := primitive.ObjectIDFromHex(params[\"id\"])\n\t\tif err != nil {\n\t\t\tresponse.WriteHeader(http.StatusBadRequest)\n\t\t\tresponse.Write([]byte(`{ \"message\": \"` + err.Error() + `\" }`))\n\t\t\treturn\n\t\t}\n\n\t\tif ok {\n\t\t\tcollection := db.Database(os.Getenv(\"DATABASE_NAME\")).Collection(\"posts\")\n\t\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\n\t\t\tdefer cancel()\n\n\t\t\toID, _ := primitive.ObjectIDFromHex(authID)\n\n\t\t\tmatch := bson.D{\n\t\t\t\tprimitive.E{\n\t\t\t\t\tKey: \"$match\",\n\t\t\t\t\tValue: bson.D{\n\t\t\t\t\t\tprimitive.E{Key: \"_id\", Value: id},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\n\t\t\tproject := bson.D{\n\t\t\t\tprimitive.E{\n\t\t\t\t\tKey: \"$project\",\n\t\t\t\t\tValue: bson.D{\n\t\t\t\t\t\tprimitive.E{Key: \"_id\", Value: \"$_id\"},\n\t\t\t\t\t\tprimitive.E{Key: \"community\", Value: \"$community\"},\n\t\t\t\t\t\tprimitive.E{Key: \"images\", Value: \"$images\"},\n\t\t\t\t\t\tprimitive.E{Key: \"tags\", Value: \"$tags\"},\n\t\t\t\t\t\tprimitive.E{Key: \"title\", Value: \"$title\"},\n\t\t\t\t\t\tprimitive.E{Key: \"content\", Value: \"$content\"},\n\t\t\t\t\t\tprimitive.E{Key: \"date\", Value: \"$date\"},\n\t\t\t\t\t\tprimitive.E{Key: \"author\", Value: \"$author\"},\n\t\t\t\t\t\tprimitive.E{Key: \"upvoted\", Value: bson.D{\n\t\t\t\t\t\t\tprimitive.E{Key: \"$in\", Value: []interface{}{oID, \"$upvotes\"}},\n\t\t\t\t\t\t}},\n\t\t\t\t\t\tprimitive.E{Key: \"answers\", Value: bson.D{\n\t\t\t\t\t\t\tprimitive.E{Key: \"$size\", Value: \"$answers\"},\n\t\t\t\t\t\t}},\n\t\t\t\t\t\tprimitive.E{Key: \"upvotes\", Value: bson.D{\n\t\t\t\t\t\t\tprimitive.E{Key: \"$size\", Value: \"$upvotes\"},\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\tlookupAuthor := bson.D{\n\t\t\t\tprimitive.E{\n\t\t\t\t\tKey: \"$lookup\",\n\t\t\t\t\tValue: bson.M{\n\t\t\t\t\t\t\"from\": \"users\",\n\t\t\t\t\t\t\"localField\": \"author\",\n\t\t\t\t\t\t\"foreignField\": \"_id\",\n\t\t\t\t\t\t\"as\": \"author\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t}\n\n\t\t\topts := options.Aggregate().SetMaxTime(2 * time.Second)\n\n\t\t\tcursor, err := collection.Aggregate(ctx, mongo.Pipeline{\n\t\t\t\tmatch,\n\t\t\t\tproject,\n\t\t\t\tlookupAuthor,\n\t\t\t}, opts)\n\n\t\t\tif err != nil {\n\t\t\t\tresponse.WriteHeader(http.StatusInternalServerError)\n\t\t\t\tresponse.Write([]byte(`{ \"message\": \"` + err.Error() + `\" }`))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresults := []bson.M{}\n\t\t\tif err = cursor.All(context.TODO(), &results); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t}\n\n\t\t\tif len(results) == 0 {\n\t\t\t\tresponse.WriteHeader(http.StatusNotFound)\n\t\t\t\tresponse.Write([]byte(`{ \"message\": \"Not Found\" }`))\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\tresults[0][\"author\"] = formatAuthor(results[0][\"author\"].(primitive.A)[0].(primitive.M))\n\n\t\t\tjson.NewEncoder(response).Encode(results[0])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ab180766912d1f943932c64487b0ca2a", "score": "0.5089289", "text": "func Post(w http.ResponseWriter, r *http.Request) error {\n\tdefer r.Body.Close()\n\n\tvar (\n\t\tin SaveInput\n\t\te error\n\t)\n\tif e = json.NewDecoder(r.Body).Decode(&in); e != nil {\n\t\treturn e\n\t}\n\tif config.Verbose {\n\t\tlog.Printf(\"http.Post %+v\\n\", in)\n\t}\n\n\tfound, e := db.Exists(in.Msgid)\n\tif e != nil {\n\t\treturn e\n\t}\n\tif found {\n\t\thttpd.FlushJson(w, httpd.DefaultResponse{\n\t\t\tStatus: false, Text: \"Already have this msg\",\n\t\t})\n\t\treturn nil\n\t}\n\n\traw, e := base64.StdEncoding.DecodeString(in.Body)\n\tif e != nil {\n\t\treturn e\n\t}\n\tif e := db.Save(in.Msgid, bytes.NewBuffer(raw)); e != nil {\n\t\treturn e\n\t}\n\n\thttpd.FlushJson(w, httpd.DefaultResponse{\n\t\tStatus: true, Text: \"Saved\",\n\t})\n\treturn nil\n}", "title": "" }, { "docid": "43b4bd285f81ce4958de372971413e16", "score": "0.50808346", "text": "func (a *Agent) Post(url string, postData []byte) (content []byte, err error) {\n\tresponse, err := a.PostRequest(url, postData)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"getting post request: %w\", err)\n\t}\n\tdefer response.Body.Close()\n\n\treturn a.readResponse(response)\n}", "title": "" }, { "docid": "812b2bcd8b7a6ff204f91accf23832ad", "score": "0.50799507", "text": "func (r *Repo) ReadPostBody(hash string) (*plumbing2.PostBody, *object.Commit, error) {\n\treturn plumbing2.ReadPostBody(r, hash)\n}", "title": "" }, { "docid": "5fc1a6d48f7881d8d20168d08b080433", "score": "0.5078281", "text": "func (c *Client) Post(resource string, data []byte) (response *Response, err error) {\n\tif c.debug {\n\t\tlog.Printf(\"[marketo/Post] %s, %s\", resource, string(data))\n\t\tdefer func() {\n\t\t\tlog.Print(\"[marketo/Post] DONE\")\n\t\t}()\n\t}\n\treq, err := http.NewRequest(\"POST\", c.endpoint+resource, bytes.NewBuffer(data))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\n\treturn c.doWithRetry(req)\n}", "title": "" }, { "docid": "77118e86a7526af1821fdd37b96674b3", "score": "0.5072542", "text": "func NewNote(rWriter http.ResponseWriter, req *http.Request, db *Statements) {\n\tdefer panicRecovery(rWriter)\n\n\tnote, err := CreateNoteFromReader(req.Body)\n\tif err != nil {\n\t\tbadRequest(rWriter, err)\n\t}\n\n\tdb.CreateNote(note)\n\n\tnoteCreated(rWriter, note)\n}", "title": "" }, { "docid": "2ce047099a00f22daa038fbb25173d75", "score": "0.5068777", "text": "func PutNoteHandler(w http.ResponseWriter, r *http.Request) {\n\t//extraer el id de la nota q se va actualizar\n\tvars := mux.Vars(r)\n\t//se pasa el id como string porque así es como esta en el map\n\tk := vars[\"id\"]\n\t//obtener los datos q el usuario nos manda\n\tvar noteUpdate Note\n\terr := json.NewDecoder(r.Body).Decode(&noteUpdate)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\t//confirmar que hace ese ok\n\tif note, ok := noteStore[k]; ok {\n\t\tnoteUpdate.CreatedAt = note.CreatedAt\n\t\tdelete(noteStore, k)\n\t\tnoteStore[k] = noteUpdate\n\t} else {\n\t\tlog.Printf(\"No encontramos el id %s\", k)\n\t}\n\tw.WriteHeader(http.StatusNoContent)\n}", "title": "" }, { "docid": "9d0704938ec9dd9375e40ff7c9dabe53", "score": "0.50643486", "text": "func (driver *Driver) Post(path string, params eygo.Params, data []byte) eygo.Response {\n\treturn driver.makeRequest(\"POST\", path, paramsToValues(params), data)\n}", "title": "" }, { "docid": "3515d1332b7a2e242c6b69d5c48afa14", "score": "0.5061388", "text": "func GetPostByID() {\n\tvar result response\n\terr := HTTPGet(\"https://jsonplaceholder.typicode.com/posts/1\", &result)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(\"POST REQUEST:\", result)\n}", "title": "" }, { "docid": "260f3e6f14b2ef80cee32ea52161c7c6", "score": "0.5054837", "text": "func (o *MicrosoftGraphManagedIosLobApp) GetNotes() string {\n\tif o == nil || o.Notes == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Notes\n}", "title": "" }, { "docid": "4517a34875795e35396672fb82f211f0", "score": "0.504476", "text": "func (ec *executionContext) field_Mutation_createNote_args(ctx context.Context, rawArgs map[string]interface{}) (map[string]interface{}, error) {\n\tvar err error\n\targs := map[string]interface{}{}\n\tvar arg0 *string\n\tif tmp, ok := rawArgs[\"title\"]; ok {\n\t\targ0, err = ec.unmarshalOString2ᚖstring(ctx, tmp)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\targs[\"title\"] = arg0\n\treturn args, nil\n}", "title": "" }, { "docid": "08d6ae4b1d5225e53eb6d73bc9df76b5", "score": "0.5041507", "text": "func Post(purl string, params ...interface{}) *Client {\n\treturn getRequestWithBody(\"POST\", purl, params)\n}", "title": "" }, { "docid": "0ca08794dd67ae152aca3327d818c2a2", "score": "0.5039445", "text": "func (o *TransactionLinkUpdate) GetNotes() string {\n\tif o == nil || o.Notes.Get() == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Notes.Get()\n}", "title": "" }, { "docid": "e801605d460d74599e9156c11fb930be", "score": "0.50367016", "text": "func makePost(url string, points io.Reader) (*http.Response, error) {\n\n\tresp, err := http.Post(url, \"text/plain\", points)\n\n\tif err != nil {\n\t\treturn resp, fmt.Errorf(\"Error making write POST request\\n error: %v\\n url: %v\\n\", err, url)\n\t}\n\n\tbody, _ := ioutil.ReadAll(resp.Body)\n\n\tif resp.StatusCode != 204 {\n\t\treturn resp, fmt.Errorf(\"Write returned non-204 status code\\n StatusCode: %v\\n InfluxDB Error: %v\\n\", resp.StatusCode, string(body))\n\t}\n\n\tresp.Body.Close()\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "d9da1b16c5769f4906d296d226f82569", "score": "0.50335723", "text": "func (a *API) Post(endpoint, payload string) ([]byte, error) {\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/%s\", a.URL, endpoint), bytes.NewBuffer([]byte(payload)))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Header.Set(\"Content-Type\", \"application/json\")\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\treturn ioutil.ReadAll(resp.Body)\n}", "title": "" }, { "docid": "57b8e86f79b3f159b97704157b39adc1", "score": "0.5020927", "text": "func (c *Client) Post(method string, body []byte) ([]byte, error) {\n\treturn c.GenericWithBody(\"POST\", method, body)\n}", "title": "" }, { "docid": "4d76af5590cf887c06ff4f2c6d0699b1", "score": "0.50172794", "text": "func getOwnedNote(r *http.Request) (note Note) {\n\tif noteOwner(r) {\n\t\t//Connect to database\n\t\tdb := connectDatabase()\n\t\tdefer db.Close()\n\t\t//get username\n\t\tusername := getUserName(r)\n\t\tnoteid := getNoteID(r)\n\t\t//prepare statment\n\t\tstmt, err := db.Prepare(\"SELECT _note.note_id, note_owner, title, body, date_created FROM _note WHERE note_owner = $1 AND note_id = $2;\")\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t\treturn note\n\t\t}\n\t\terr = stmt.QueryRow(username, noteid).Scan(&note.NoteID, &note.NoteOwner, &note.NoteTitle, &note.NoteBody, &note.CreatedDate)\n\t\tif err == sql.ErrNoRows {\n\t\t\treturn note\n\t\t}\n\t\tif err != nil {\n\t\t\tlog.Panic(err)\n\t\t\treturn note\n\t\t}\n\n\t}\n\treturn note\n}", "title": "" }, { "docid": "5578bb65e367780beb25dd3e1a747cb8", "score": "0.50157326", "text": "func (a *ofFlowAction) Note(notes string) FlowBuilder {\n\tnoteAct := &ofctrl.NXNoteAction{Notes: []byte(notes)}\n\ta.builder.ApplyAction(noteAct)\n\treturn a.builder\n}", "title": "" } ]
9a0a66661a44832c6c88885e42c15f27
WithWWIDs adds the given value to the WWIDs field in the declarative configuration and returns the receiver, so that objects can be build by chaining "With" function invocations. If called multiple times, values provided by each call will be appended to the WWIDs field.
[ { "docid": "e98308bd6b9645342e550dcf78a282e2", "score": "0.7305299", "text": "func (b *FCVolumeSourceApplyConfiguration) WithWWIDs(values ...string) *FCVolumeSourceApplyConfiguration {\n\tfor i := range values {\n\t\tb.WWIDs = append(b.WWIDs, values[i])\n\t}\n\treturn b\n}", "title": "" } ]
[ { "docid": "8bd3c9e699271efbc50f0e998298d3f5", "score": "0.55132675", "text": "func (wuo *WifiUpdateOne) AddWifiIDs(ids ...int) *WifiUpdateOne {\n\twuo.mutation.AddWifiIDs(ids...)\n\treturn wuo\n}", "title": "" }, { "docid": "9ad1f0f55ed724bf0c3516b530ecea85", "score": "0.5326247", "text": "func (wu *WifiUpdate) AddWifiIDs(ids ...int) *WifiUpdate {\n\twu.mutation.AddWifiIDs(ids...)\n\treturn wu\n}", "title": "" }, { "docid": "45f5c5adacffcae0e6cae384a024fbc5", "score": "0.5004524", "text": "func (luo *LocationUpdateOne) AddWifiScanIDs(ids ...int) *LocationUpdateOne {\n\tluo.mutation.AddWifiScanIDs(ids...)\n\treturn luo\n}", "title": "" }, { "docid": "21fcad57641b68826d38f26bffc2c225", "score": "0.4928968", "text": "func (receiver T) WWXW() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "b10d4d21bb4ff1fc1d5194c40218ed20", "score": "0.49000645", "text": "func WithWidth(w ui.Value) WindowOption {\n\tif w.V <= 0 {\n\t\tpanic(\"width must be larger than or equal to 0\")\n\t}\n\treturn WindowOption{\n\t\tapply: func(opts *windowOptions) {\n\t\t\topts.Width = w\n\t\t},\n\t}\n}", "title": "" }, { "docid": "5f893a229e4177d13ae0d3096092f214", "score": "0.48741153", "text": "func (c *DeleteCommand) WithW(w uint32) *DeleteCommand {\n\tc.builder.WithW(w)\n\treturn c\n}", "title": "" }, { "docid": "24602a8e288eb0d4a85a15a6000c72c4", "score": "0.48728943", "text": "func (receiver T) WXXW() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "39412add7103a39766b66276588126cc", "score": "0.48441625", "text": "func NewWlRegistryWithID(c *wire.Conn, id wire.ID) *WlRegistry {\n\to := &WlRegistry{Base: Base{c, id}}\n\tc.RegisterObject(o)\n\treturn o\n}", "title": "" }, { "docid": "93f56d1fd63af14475ae1985abe9118f", "score": "0.48285997", "text": "func (wu *WatchlisttypeUpdate) AddWatchlistIDs(ids ...int) *WatchlisttypeUpdate {\n\twu.mutation.AddWatchlistIDs(ids...)\n\treturn wu\n}", "title": "" }, { "docid": "907466564b34c0c2f4955c4a1542c84b", "score": "0.48268938", "text": "func (wuo *WatchlisttypeUpdateOne) AddWatchlistIDs(ids ...int) *WatchlisttypeUpdateOne {\n\twuo.mutation.AddWatchlistIDs(ids...)\n\treturn wuo\n}", "title": "" }, { "docid": "6b815a27d2f707aaa2c9d7040f693166", "score": "0.4817812", "text": "func WithWitnesses(witnesses []*metapb.Peer) RegionCreateOption {\n\treturn func(region *RegionInfo) {\n\t\tpeers := region.meta.GetPeers()\n\t\tfor i := range peers {\n\t\t\tfor _, l := range witnesses {\n\t\t\t\tif peers[i].GetId() == l.GetId() {\n\t\t\t\t\tpeers[i].IsWitness = true\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9da3eadc75c0e4c50cda076fbd686697", "score": "0.4803941", "text": "func (receiver T) WXWW() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "88aa4732c1212795aceaf736d3280176", "score": "0.4793559", "text": "func (lu *LocationUpdate) AddWifiScanIDs(ids ...int) *LocationUpdate {\n\tlu.mutation.AddWifiScanIDs(ids...)\n\treturn lu\n}", "title": "" }, { "docid": "fdeee004a2ad34a9f8d5aed827c33985", "score": "0.47511032", "text": "func (receiver T) WWXX() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[x],\n receiver[x],\n }\n}", "title": "" }, { "docid": "2706ffe296c0fdafa013a605a7c2c68d", "score": "0.47408274", "text": "func (squ *SurveyQuestionUpdate) AddWifiScanIDs(ids ...int) *SurveyQuestionUpdate {\n\tsqu.mutation.AddWifiScanIDs(ids...)\n\treturn squ\n}", "title": "" }, { "docid": "272e04941652e6cf8ada4256d47c1582", "score": "0.4728627", "text": "func WithWitness(peerID uint64) RegionCreateOption {\n\treturn func(region *RegionInfo) {\n\t\tfor _, p := range region.GetPeers() {\n\t\t\tif p.GetId() == peerID {\n\t\t\t\tp.IsWitness = true\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "4655dc20d0e976b5faa71c215c2de62f", "score": "0.47205368", "text": "func (receiver T) WYWW() T {\n return T{\n receiver[w],\n receiver[y],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "12077210f168e847ca6b50b50caa9a5f", "score": "0.46681702", "text": "func (squo *SurveyQuestionUpdateOne) AddWifiScanIDs(ids ...int) *SurveyQuestionUpdateOne {\n\tsquo.mutation.AddWifiScanIDs(ids...)\n\treturn squo\n}", "title": "" }, { "docid": "16d4f615c63c9bd90519332d24e83d3e", "score": "0.46579212", "text": "func (fr *apiRouter) With(inlineMw ...router.Middleware) router.Router {\n\n\t// Remove nil middleware\n\tvar mwArr = []router.Middleware{}\n\tfor i := range inlineMw {\n\t\tif inlineMw[i] != nil {\n\t\t\tmwArr = append(mwArr, inlineMw[i])\n\t\t}\n\t}\n\n\t// Return router\n\treturn &apiRouter{\n\t\trt: fr.rt,\n\t\tconfig: fr.config,\n\t\tmiddlewares: fr.middlewares,\n\t\tpanicsHandler: fr.panicsHandler,\n\t\tinlineMiddlewares: mwArr,\n\t}\n}", "title": "" }, { "docid": "556bd1a20b559fbb93b8e3d22a8a8197", "score": "0.465536", "text": "func (s *ServerBindingsObject) WithWs(val interface{}) *ServerBindingsObject {\n\ts.Ws = &val\n\treturn s\n}", "title": "" }, { "docid": "0a1179e9726a2ff1278d6608214339bc", "score": "0.46423444", "text": "func (duo *DRoomUpdateOne) SetWUserID(s string) *DRoomUpdateOne {\n\tduo.mutation.SetWUserID(s)\n\treturn duo\n}", "title": "" }, { "docid": "38e323e4627611f0ff171df8af9c8941", "score": "0.46275708", "text": "func (du *DRoomUpdate) SetWUserID(s string) *DRoomUpdate {\n\tdu.mutation.SetWUserID(s)\n\treturn du\n}", "title": "" }, { "docid": "eb0ae4eef4bf47db86bf2aeb22c77fb2", "score": "0.46264613", "text": "func (wu *WifiUpdate) AddWifis(l ...*Lease) *WifiUpdate {\n\tids := make([]int, len(l))\n\tfor i := range l {\n\t\tids[i] = l[i].ID\n\t}\n\treturn wu.AddWifiIDs(ids...)\n}", "title": "" }, { "docid": "6df141bd56702821db83a48fe97910be", "score": "0.46247637", "text": "func (receiver T) XWXW() T {\n return T{\n receiver[x],\n receiver[w],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "514331649c39209cf57a116852cad429", "score": "0.46173286", "text": "func (c *ChannelBindingsObject) WithWs(val WebsocketsChannel) *ChannelBindingsObject {\n\tc.Ws = &val\n\treturn c\n}", "title": "" }, { "docid": "503a4dbef8b81e62c1c59e9e437e1d12", "score": "0.46162874", "text": "func (wc *WithCode) With(a ...interface{}) {\n\tWith(a...)\n}", "title": "" }, { "docid": "16778153f282eae77d8994f2925288d3", "score": "0.4612005", "text": "func (receiver T) WWYW() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[y],\n receiver[w],\n }\n}", "title": "" }, { "docid": "570ba26ebfde107acbef103124c228d9", "score": "0.46084037", "text": "func (wuo *WifiUpdateOne) AddWifis(l ...*Lease) *WifiUpdateOne {\n\tids := make([]int, len(l))\n\tfor i := range l {\n\t\tids[i] = l[i].ID\n\t}\n\treturn wuo.AddWifiIDs(ids...)\n}", "title": "" }, { "docid": "39fa5d69dde886969b46b1cc00a7f299", "score": "0.46009013", "text": "func (receiver T) YWXW() T {\n return T{\n receiver[y],\n receiver[w],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "05b790b2730402ecad8e07e044c2a0b0", "score": "0.45530713", "text": "func (woc *WorkOrderCreate) AddPropertyIDs(ids ...string) *WorkOrderCreate {\n\tif woc.properties == nil {\n\t\twoc.properties = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twoc.properties[ids[i]] = struct{}{}\n\t}\n\treturn woc\n}", "title": "" }, { "docid": "75642886645931127c2c27eb17b8554a", "score": "0.45055485", "text": "func (wuo *WorkflowUpdateOne) AddWfeventIDs(ids ...int) *WorkflowUpdateOne {\n\twuo.mutation.AddWfeventIDs(ids...)\n\treturn wuo\n}", "title": "" }, { "docid": "f09d9dccec4bb48f96978f993325dbdb", "score": "0.44807476", "text": "func (lvs LabelValues) With(labelValues ...string) LabelValues {\n\tif len(labelValues)%2 != 0 {\n\t\tlabelValues = append(labelValues, \"unknown\")\n\t}\n\treturn append(lvs, labelValues...)\n}", "title": "" }, { "docid": "b8be27e682e87e4ed301c21efd8f9700", "score": "0.44514796", "text": "func WithMCP23017Disslw(val uint8) func(Config) {\n\treturn func(c Config) {\n\t\td, ok := c.(*MCP23017Driver)\n\t\tif ok {\n\t\t\td.mcpConf.disslw = val\n\t\t} else if mcp23017Debug {\n\t\t\tlog.Printf(\"Trying to set disslw for non-MCP23017Driver %v\", c)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "36e21cf5a8050eec6d4a449d32870715", "score": "0.44370645", "text": "func (wu *WorkflowUpdate) AddWfeventIDs(ids ...int) *WorkflowUpdate {\n\twu.mutation.AddWfeventIDs(ids...)\n\treturn wu\n}", "title": "" }, { "docid": "0c1c2b2cd3f83dbfc8a3e785d3de984e", "score": "0.44352826", "text": "func (receiver T) YXXW() T {\n return T{\n receiver[y],\n receiver[x],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "509972e8e05d7f8d7dd1792fdf08e8d2", "score": "0.44343543", "text": "func (receiver T) WWWY() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[w],\n receiver[y],\n }\n}", "title": "" }, { "docid": "838fbb3d63d800e02f2ee887f80327c2", "score": "0.44332144", "text": "func (b *FCVolumeSourceApplyConfiguration) WithTargetWWNs(values ...string) *FCVolumeSourceApplyConfiguration {\n\tfor i := range values {\n\t\tb.TargetWWNs = append(b.TargetWWNs, values[i])\n\t}\n\treturn b\n}", "title": "" }, { "docid": "fb088511dd53667e04d6c57ea685b9f5", "score": "0.442965", "text": "func Warnw(msg string, keysAndValues ...interface{}) {\n\tDefault().Warnw(msg, keysAndValues...)\n}", "title": "" }, { "docid": "3bed4f393f775d972da299e4d4fbf0aa", "score": "0.44273263", "text": "func (receiver T) WXWX() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[w],\n receiver[x],\n }\n}", "title": "" }, { "docid": "eef2e070132c86f1f5acbd700286fe05", "score": "0.4425759", "text": "func (receiver T) WYWX() T {\n return T{\n receiver[w],\n receiver[y],\n receiver[w],\n receiver[x],\n }\n}", "title": "" }, { "docid": "c440cf235b1d15dbf34563a4ce209718", "score": "0.44192052", "text": "func WithWords(words ...string) Interface {\n\tdict := &inMemory{\n\t\twords: make(map[string]struct{}),\n\t}\n\n\tfor _, w := range words {\n\t\tdict.words[strings.ToUpper(w)] = struct{}{}\n\t}\n\n\treturn dict\n}", "title": "" }, { "docid": "a90ee30cebf561e6ebdffd6b67dc1150", "score": "0.44020835", "text": "func (receiver T) WWWW() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "d21b11fccd04f90d000fe411e1c1638f", "score": "0.43993694", "text": "func (hc *HistogramCreate) SetWID(s string) *HistogramCreate {\n\thc.mutation.SetWID(s)\n\treturn hc\n}", "title": "" }, { "docid": "90733825dab6563b6db0d9aa02a61457", "score": "0.43673497", "text": "func (l tendermintLogger) With(ctx ...interface{}) tmlog.Logger {\n\tl.keyvals = append(l.keyvals, ctx...)\n\n\treturn l\n}", "title": "" }, { "docid": "ef83ef7833c7af4b9007cf7845e2565e", "score": "0.43565413", "text": "func (m *MessageBindingsObject) WithWs(val interface{}) *MessageBindingsObject {\n\tm.Ws = &val\n\treturn m\n}", "title": "" }, { "docid": "1620113bd8ad53108262d12b10acca8d", "score": "0.43354222", "text": "func With(m ...Handler) Option {\n\treturn func(o *Options) (err error) {\n\t\tfor _, mid := range m {\n\t\t\tif mid == nil {\n\t\t\t\treturn errors.New(\"middleware is nil\")\n\t\t\t}\n\t\t}\n\t\to.Middleware = append(o.Middleware, m...)\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "eea60cdd28f1c0f9a29625939d9d05a6", "score": "0.43342337", "text": "func (f *Fmt) W(x int) *Fmt {\n\tf.wid_present = true;\n\tf.wid = x;\n\treturn f;\n}", "title": "" }, { "docid": "95a7c772a4479573c0ddfc81fea4d9b7", "score": "0.43340343", "text": "func (receiver T) XWYW() T {\n return T{\n receiver[x],\n receiver[w],\n receiver[y],\n receiver[w],\n }\n}", "title": "" }, { "docid": "2ddb9330be7cd36b8bcea7b6e9cc1c44", "score": "0.43293703", "text": "func (receiver T) WYWY() T {\n return T{\n receiver[w],\n receiver[y],\n receiver[w],\n receiver[y],\n }\n}", "title": "" }, { "docid": "d8c7298c6018542774e937329f01072d", "score": "0.43257567", "text": "func (tuo *TechnicianUpdateOne) AddWorkOrderIDs(ids ...string) *TechnicianUpdateOne {\n\tif tuo.work_orders == nil {\n\t\ttuo.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\ttuo.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn tuo\n}", "title": "" }, { "docid": "6c07cc3acf0b9f52a176653e93db7bbf", "score": "0.43254492", "text": "func (tu *TechnicianUpdate) AddWorkOrderIDs(ids ...string) *TechnicianUpdate {\n\tif tu.work_orders == nil {\n\t\ttu.work_orders = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\ttu.work_orders[ids[i]] = struct{}{}\n\t}\n\treturn tu\n}", "title": "" }, { "docid": "44fe9fe038ae0140b52ec7ad412fe87f", "score": "0.43157429", "text": "func (o *OperationBindingsObject) WithWs(val interface{}) *OperationBindingsObject {\n\to.Ws = &val\n\treturn o\n}", "title": "" }, { "docid": "d1cb663dbb6b75f0e660a99a1794d19f", "score": "0.43037757", "text": "func (receiver T) XXWW() T {\n return T{\n receiver[x],\n receiver[x],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "c4e9f9937482df8407162e138cd8c700", "score": "0.43024316", "text": "func (receiver T) WWXY() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[x],\n receiver[y],\n }\n}", "title": "" }, { "docid": "48a5d46db15f5497d32c1de620b4ccce", "score": "0.42896572", "text": "func (receiver T) WZXW() T {\n return T{\n receiver[w],\n receiver[z],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "f58c68c478ce028952e59ea95988c739", "score": "0.42764276", "text": "func (cu *CounterUpdate) SetWID(s string) *CounterUpdate {\n\tcu.mutation.SetWID(s)\n\treturn cu\n}", "title": "" }, { "docid": "1051589048e5434a488cc5fc1a6eccbe", "score": "0.4275766", "text": "func (b Builder) With(v interface{}) Builder {\n\treturn append(b, v)\n}", "title": "" }, { "docid": "64374ccd3beb677fd147c7026fa96518", "score": "0.4274914", "text": "func (app *builder) WithUint32(uintThirtyTwo uint32) Builder {\n\tapp.uintThirtyTwo = &uintThirtyTwo\n\treturn app\n}", "title": "" }, { "docid": "e0ee7a2ad8fcdb3ad1e4d6d8306137b4", "score": "0.42673928", "text": "func AddSetFlagsForApplicationWebhookIdentifiers(flags *pflag.FlagSet, prefix string, hidden bool) {\n\tAddSetFlagsForApplicationIdentifiers(flags, flagsplugin.Prefix(\"application-ids\", prefix), hidden)\n\tflags.AddFlag(flagsplugin.NewStringFlag(flagsplugin.Prefix(\"webhook-id\", prefix), \"\", flagsplugin.WithHidden(hidden)))\n}", "title": "" }, { "docid": "e944c334df28a6e0ba6c883516564b6b", "score": "0.42636412", "text": "func (m *MessageExtendedMediaPreview) SetW(value int) {\n\tm.Flags.Set(0)\n\tm.W = value\n}", "title": "" }, { "docid": "24bca6789fb13d2016ede0591e741d36", "score": "0.4259364", "text": "func (receiver T) YXWW() T {\n return T{\n receiver[y],\n receiver[x],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "5ed434d2bf6e41bf0890c26bec1e1b57", "score": "0.4256022", "text": "func (receiver T) WYXW() T {\n return T{\n receiver[w],\n receiver[y],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "0659fe523af4d04c4ddb1fb5a888b487", "score": "0.4250567", "text": "func (p *PageBlockEmbed) SetW(value int) {\n\tp.Flags.Set(5)\n\tp.W = value\n}", "title": "" }, { "docid": "e0ed26a7d412a64a97817cee7253718a", "score": "0.4248914", "text": "func WithWindow(d time.Duration) Option {\n\treturn func(o *options) {\n\t\to.Window = d\n\t}\n}", "title": "" }, { "docid": "d7f33d7dfda516c9749cb3d4f4b684fd", "score": "0.42371187", "text": "func (receiver T) WZWW() T {\n return T{\n receiver[w],\n receiver[z],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "8439d940fefe7b64bfb58f0d18d17b19", "score": "0.4235895", "text": "func WithMiddlewares(opts ...func(*dynamic.Middleware) string) func(*dynamic.HTTPConfiguration) {\n\treturn func(c *dynamic.HTTPConfiguration) {\n\t\tc.Middlewares = make(map[string]*dynamic.Middleware)\n\t\tfor _, opt := range opts {\n\t\t\tb := &dynamic.Middleware{}\n\t\t\tname := opt(b)\n\t\t\tc.Middlewares[name] = b\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f84960b263735da75026356caee4c3c2", "score": "0.4220387", "text": "func (o *PutWifiNetworkIDParams) WithContext(ctx context.Context) *PutWifiNetworkIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "34d9a148ec6a8f0219618dcc3e97bb7a", "score": "0.42192778", "text": "func (receiver T) WWWX() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[w],\n receiver[x],\n }\n}", "title": "" }, { "docid": "3a696d2d270072236cbf4bb3639ffda0", "score": "0.42182294", "text": "func WithWindow(d time.Duration) Option {\n\treturn func(c *options) {\n\t\tc.window = d\n\t}\n}", "title": "" }, { "docid": "7754b6e6ccfef3f5061b7b509f3c26c0", "score": "0.42148325", "text": "func (woc *WorkOrderCreate) AddEquipmentIDs(ids ...string) *WorkOrderCreate {\n\tif woc.equipment == nil {\n\t\twoc.equipment = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\twoc.equipment[ids[i]] = struct{}{}\n\t}\n\treturn woc\n}", "title": "" }, { "docid": "ba8dc0608707b880ab321a0f8611c741", "score": "0.4212152", "text": "func With(keyvals ...interface{}) Context {\n\tvar ctx context\n\treturn ctx.With(keyvals...)\n}", "title": "" }, { "docid": "df43fe452c49907a903326918426e201", "score": "0.42085636", "text": "func (receiver T) WXXY() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[x],\n receiver[y],\n }\n}", "title": "" }, { "docid": "370be1222d3fa70ec4ee3520500449b0", "score": "0.42075256", "text": "func WithAppID(a string) source.Option {\n\treturn func(o *source.Options) {\n\t\tif o.Context == nil {\n\t\t\to.Context = context.Background()\n\t\t}\n\t\to.Context = context.WithValue(o.Context, appIDKey{}, a)\n\t}\n}", "title": "" }, { "docid": "bf8d793ec9882aa1213e2e78caa792c7", "score": "0.4203119", "text": "func AddWitToContext(ctx context.Context, witMessage *wit.Message) context.Context {\n\treturn context.WithValue(ctx, \"__WIT__\", witMessage)\n}", "title": "" }, { "docid": "bf08a02f3785fcee439e43f1ff9c5958", "score": "0.4201858", "text": "func NewPutWifiNetworkIDParamsWithHTTPClient(client *http.Client) *PutWifiNetworkIDParams {\n\tvar ()\n\treturn &PutWifiNetworkIDParams{\n\t\tHTTPClient: client,\n\t}\n}", "title": "" }, { "docid": "5490f2353a3fafa57965baf654b9d685", "score": "0.41888645", "text": "func Warnw(msg string, keysAndValues ...interface{}) {\n\tsugarLogger.Warnw(msg, keysAndValues...)\n}", "title": "" }, { "docid": "ac3298fc3ea938c8069e857a3bddd5bc", "score": "0.41857034", "text": "func (receiver T) WXYW() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[y],\n receiver[w],\n }\n}", "title": "" }, { "docid": "0842a18c906605973e62a801062a775b", "score": "0.4185338", "text": "func (receiver T) WYXX() T {\n return T{\n receiver[w],\n receiver[y],\n receiver[x],\n receiver[x],\n }\n}", "title": "" }, { "docid": "06d36f823d4eedaab1e964286356081e", "score": "0.4181481", "text": "func (cuo *CounterUpdateOne) SetWID(s string) *CounterUpdateOne {\n\tcuo.mutation.SetWID(s)\n\treturn cuo\n}", "title": "" }, { "docid": "8293f2272c4daa1d8db326107c43fdbf", "score": "0.4180242", "text": "func (iob *IndexOptionsBuilder) Weights(weights interface{}) *IndexOptionsBuilder {\n\tiob.document = append(iob.document, bson.E{\"weights\", weights})\n\treturn iob\n}", "title": "" }, { "docid": "bd67bf16e7e03e9f284e283dbde636ff", "score": "0.41785368", "text": "func With(ctx context.Context) context.Context {\n\tif !FromContext(ctx).IsNil() {\n\t\treturn ctx\n\t}\n\treturn WithID(ctx, xid.New())\n}", "title": "" }, { "docid": "54762b72da840e36dbec2b68a4083b2f", "score": "0.41756094", "text": "func (receiver T) YWYW() T {\n return T{\n receiver[y],\n receiver[w],\n receiver[y],\n receiver[w],\n }\n}", "title": "" }, { "docid": "0a13e57c7c05b0d15d7828a0466abec7", "score": "0.4161756", "text": "func WithHwAddr(hwaddr net.HardwareAddr) Modifier {\n\treturn func(packet *layers.DHCPv4) {\n\t\tpacket.ClientHWAddr = hwaddr\n\t\tpacket.HardwareLen = uint8(len(packet.ClientHWAddr))\n\t}\n}", "title": "" }, { "docid": "048eabf9494f8cea406d4fd90bcd3a7a", "score": "0.41612023", "text": "func (receiver T) WWZW() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[z],\n receiver[w],\n }\n}", "title": "" }, { "docid": "880bb8c201a6857717b01cf2b297a197", "score": "0.41582572", "text": "func (eu *EmployeeUpdate) AddWhoseIDs(ids ...int) *EmployeeUpdate {\n\teu.mutation.AddWhoseIDs(ids...)\n\treturn eu\n}", "title": "" }, { "docid": "ca55e9fd793b1fdb240bac27dcd984a7", "score": "0.41524985", "text": "func (h *Helper) Warnw(kv ...interface{}) {\n\th.warn.Log(kv...)\n}", "title": "" }, { "docid": "c574251948e2e304ef08c086d69cdad1", "score": "0.41515803", "text": "func (wuo *WifiUpdateOne) RemoveWifiIDs(ids ...int) *WifiUpdateOne {\n\twuo.mutation.RemoveWifiIDs(ids...)\n\treturn wuo\n}", "title": "" }, { "docid": "5312f984f05740a19334113943b06da7", "score": "0.41507295", "text": "func (receiver T) XWWY() T {\n return T{\n receiver[x],\n receiver[w],\n receiver[w],\n receiver[y],\n }\n}", "title": "" }, { "docid": "274273bc45b6acc33c10347d8362709c", "score": "0.41497412", "text": "func (app *builder) WithInt32(intThirtyTwo int32) Builder {\n\tapp.intThirtyTwo = &intThirtyTwo\n\treturn app\n}", "title": "" }, { "docid": "3cd28ec598df87aa9f6fffaa436802e2", "score": "0.41469812", "text": "func (receiver T) WXWY() T {\n return T{\n receiver[w],\n receiver[x],\n receiver[w],\n receiver[y],\n }\n}", "title": "" }, { "docid": "19e5a87f65558bf9deaa90314d5382b3", "score": "0.4143514", "text": "func (receiver T) WWYX() T {\n return T{\n receiver[w],\n receiver[w],\n receiver[y],\n receiver[x],\n }\n}", "title": "" }, { "docid": "d2ac5935ca7a26f28c1b6eeb7142da28", "score": "0.4139156", "text": "func (receiver T) WZZW() T {\n return T{\n receiver[w],\n receiver[z],\n receiver[z],\n receiver[w],\n }\n}", "title": "" }, { "docid": "689f2064ea22de20c757a8c2db5f6da1", "score": "0.41235316", "text": "func (receiver T) WZWX() T {\n return T{\n receiver[w],\n receiver[z],\n receiver[w],\n receiver[x],\n }\n}", "title": "" }, { "docid": "7ad668bfa14764c10165867f444a3bcc", "score": "0.41197222", "text": "func WithMiddleware(mw ...Middleware) Option {\n\treturn func(request *ClientRequest) {\n\t\tif request.mw != nil {\n\t\t\trequest.mw = chain(append(mw, request.mw)...)\n\t\t} else {\n\t\t\trequest.mw = chain(mw...)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eb60ee2da5cb57bd10e4173f4540617d", "score": "0.41134468", "text": "func (receiver T) XYWW() T {\n return T{\n receiver[x],\n receiver[y],\n receiver[w],\n receiver[w],\n }\n}", "title": "" }, { "docid": "453a6622e3a4e853987ff64303db47df", "score": "0.41132927", "text": "func (o *PutWifiNetworkIDParams) WithHTTPClient(client *http.Client) *PutWifiNetworkIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "88816a2e96611c3ed2715de033a358cb", "score": "0.41116285", "text": "func (l *Logger) With(keyvals ...interface{}) tmlog.Logger {\n\tif len(keyvals) <= 2 || len(keyvals)%2 != 0 {\n\t\treturn l\n\t}\n\n\tfields := genFields4Log(keyvals...)\n\n\treturn &Logger{\n\t\tlogger: l.logger.With(fields...),\n\t}\n}", "title": "" }, { "docid": "f01b93526fc3ac09eb1d6069fe981104", "score": "0.4105035", "text": "func (w *WebsocketsChannel) WithHeaders(val map[string]interface{}) *WebsocketsChannel {\n\tw.Headers = val\n\treturn w\n}", "title": "" }, { "docid": "0dd02ac8ee1174b4ef1b327cb98c9402", "score": "0.40952554", "text": "func (receiver T) ZWXW() T {\n return T{\n receiver[z],\n receiver[w],\n receiver[x],\n receiver[w],\n }\n}", "title": "" }, { "docid": "30c8fbdd5adc8f7aa9d44974fdf89f13", "score": "0.409407", "text": "func (wuo *WatchlisttypeUpdateOne) AddWatchlist(w ...*Watchlist) *WatchlisttypeUpdateOne {\n\tids := make([]int, len(w))\n\tfor i := range w {\n\t\tids[i] = w[i].ID\n\t}\n\treturn wuo.AddWatchlistIDs(ids...)\n}", "title": "" } ]
500cbebff224b889e2f421f4677a6efa
RegisterRequestC2B implements the RegisterRequestC2B interface according to TubeMQ RPC protocol.
[ { "docid": "ec20cdc0e83795c5c262e0d11b7c96b6", "score": "0.8586416", "text": "func (c *rpcClient) RegisterRequestC2B(ctx context.Context, metadata *metadata.Metadata,\n\tsub *sub.SubInfo, r *remote.RmtDataCache) (*protocol.RegisterResponseB2C, error) {\n\treqC2B := &protocol.RegisterRequestC2B{\n\t\tOpType: proto.Int32(register),\n\t\tClientId: proto.String(sub.GetClientID()),\n\t\tGroupName: proto.String(metadata.GetSubscribeInfo().GetGroup()),\n\t\tTopicName: proto.String(metadata.GetSubscribeInfo().GetPartition().GetTopic()),\n\t\tPartitionId: proto.Int32(metadata.GetSubscribeInfo().GetPartition().GetPartitionID()),\n\t\tQryPriorityId: proto.Int32(r.GetQryPriorityID()),\n\t\tReadStatus: proto.Int32(metadata.GetReadStatus()),\n\t\tAuthInfo: sub.GetAuthorizedInfo(),\n\t}\n\tif sub.IsFiltered(metadata.GetSubscribeInfo().GetPartition().GetTopic()) {\n\t\ttfs := sub.GetTopicFilters()\n\t\treqC2B.FilterCondStr = make([]string, 0, len(tfs[metadata.GetSubscribeInfo().GetPartition().GetTopic()]))\n\t\tfor _, tf := range tfs[metadata.GetSubscribeInfo().GetPartition().GetTopic()] {\n\t\t\treqC2B.FilterCondStr = append(reqC2B.FilterCondStr, tf)\n\t\t}\n\t}\n\toffset := sub.GetAssignedPartOffset(metadata.GetSubscribeInfo().GetPartition().GetPartitionKey())\n\tif offset != util.InvalidValue {\n\t\treqC2B.CurrOffset = proto.Int64(offset)\n\t}\n\treq := codec.NewRPCRequest()\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(0),\n\t}\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerConsumerRegister),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.Body = reqC2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspC2B := &protocol.RegisterResponseB2C{}\n\terr = proto.Unmarshal(rspBody.Data, rspC2B)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\treturn rspC2B, nil\n}", "title": "" } ]
[ { "docid": "85ea47069d629d6a4d7940bc7bf31286", "score": "0.78604054", "text": "func (c *rpcClient) UnregisterRequestC2B(ctx context.Context, metadata *metadata.Metadata,\n\tsub *sub.SubInfo) (*protocol.RegisterResponseB2C, error) {\n\treqC2B := &protocol.RegisterRequestC2B{\n\t\tOpType: proto.Int32(unregister),\n\t\tClientId: proto.String(sub.GetClientID()),\n\t\tGroupName: proto.String(metadata.GetSubscribeInfo().GetGroup()),\n\t\tTopicName: proto.String(metadata.GetSubscribeInfo().GetPartition().GetTopic()),\n\t\tPartitionId: proto.Int32(metadata.GetSubscribeInfo().GetPartition().GetPartitionID()),\n\t\tReadStatus: proto.Int32(metadata.GetReadStatus()),\n\t\tAuthInfo: sub.GetAuthorizedInfo(),\n\t}\n\treq := codec.NewRPCRequest()\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(0),\n\t}\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerConsumerRegister),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.Body = reqC2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspC2B := &protocol.RegisterResponseB2C{}\n\terr = proto.Unmarshal(rspBody.Data, rspC2B)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\treturn rspC2B, nil\n}", "title": "" }, { "docid": "d95f72a4a7dd64f0dc8cee115486c7d2", "score": "0.67649555", "text": "func (service Service) RequestB2C(body B2CRequest) (*B2CResponse, error) {\n\turl := util.GetMobilePaymentB2CURL(service.Env)\n\n\treqBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal b2c req body %v: \", err)\n\t}\n\n\tresponse, err := service.newRequest(url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\n\tvar b2cResponse B2CResponse\n\tjson.NewDecoder(response.Body).Decode(&b2cResponse)\n\treturn &b2cResponse, nil\n}", "title": "" }, { "docid": "5f613a552b59625dc4f9f80a7b09d62a", "score": "0.61129504", "text": "func (service Service) RequestB2B(body B2BRequest) (*B2BResponse, error) {\n\turl := util.GetMobilePaymentB2BURL(service.Env)\n\n\treqBody, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not marshal b2b req body %v: \", err)\n\t}\n\n\tresponse, err := service.newRequest(url, reqBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer response.Body.Close()\n\n\tvar b2bResponse B2BResponse\n\tjson.NewDecoder(response.Body).Decode(&b2bResponse)\n\treturn &b2bResponse, nil\n}", "title": "" }, { "docid": "eb8d98518f646095e8bade4ea005d1d3", "score": "0.59800076", "text": "func (c *rpcClient) GetMessageRequestC2B(ctx context.Context, metadata *metadata.Metadata,\n\tsub *sub.SubInfo, r *remote.RmtDataCache) (*protocol.GetMessageResponseB2C, error) {\n\treqC2B := &protocol.GetMessageRequestC2B{\n\t\tClientId: proto.String(sub.GetClientID()),\n\t\tPartitionId: proto.Int32(metadata.GetSubscribeInfo().GetPartition().GetPartitionID()),\n\t\tGroupName: proto.String(metadata.GetSubscribeInfo().GetGroup()),\n\t\tTopicName: proto.String(metadata.GetSubscribeInfo().GetPartition().GetTopic()),\n\t\tEscFlowCtrl: proto.Bool(r.GetUnderGroupCtrl()),\n\t\tLastPackConsumed: proto.Bool(metadata.GetSubscribeInfo().GetPartition().GetLastConsumed()),\n\t\tManualCommitOffset: proto.Bool(false),\n\t}\n\treq := codec.NewRPCRequest()\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(0),\n\t}\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerConsumerGetMsg),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.Body = reqC2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspC2B := &protocol.GetMessageResponseB2C{}\n\terr = proto.Unmarshal(rspBody.Data, rspC2B)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\treturn rspC2B, nil\n}", "title": "" }, { "docid": "2e13c34b684c1582e5766038003710d2", "score": "0.5873932", "text": "func (*RegisterRequestC2B) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "69ea236ed1f27dfe151d6b3ecd906081", "score": "0.55891645", "text": "func (c *rpcClient) HeartbeatRequestC2B(ctx context.Context, metadata *metadata.Metadata,\n\tsub *sub.SubInfo, r *remote.RmtDataCache) (*protocol.HeartBeatResponseB2C, error) {\n\treqC2B := &protocol.HeartBeatRequestC2B{\n\t\tClientId: proto.String(sub.GetClientID()),\n\t\tGroupName: proto.String(metadata.GetSubscribeInfo().GetGroup()),\n\t\tReadStatus: proto.Int32(metadata.GetReadStatus()),\n\t\tQryPriorityId: proto.Int32(r.GetQryPriorityID()),\n\t\tAuthInfo: sub.GetAuthorizedInfo(),\n\t}\n\tpartitions := r.GetPartitionByBroker(metadata.GetNode())\n\treqC2B.PartitionInfo = make([]string, 0, len(partitions))\n\tfor _, partition := range partitions {\n\t\treqC2B.PartitionInfo = append(reqC2B.PartitionInfo, partition.String())\n\t}\n\treq := codec.NewRPCRequest()\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerConsumerHeartbeat),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(0),\n\t}\n\treq.Body = reqC2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspC2B := &protocol.HeartBeatResponseB2C{}\n\terr = proto.Unmarshal(rspBody.Data, rspC2B)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\treturn rspC2B, nil\n}", "title": "" }, { "docid": "2e00975265806933a457c8131960d604", "score": "0.55443835", "text": "func (c *rpcClient) CommitOffsetRequestC2B(ctx context.Context, metadata *metadata.Metadata,\n\tsub *sub.SubInfo) (*protocol.CommitOffsetResponseB2C, error) {\n\treqC2B := &protocol.CommitOffsetRequestC2B{\n\t\tClientId: proto.String(sub.GetClientID()),\n\t\tTopicName: proto.String(metadata.GetSubscribeInfo().GetPartition().GetTopic()),\n\t\tPartitionId: proto.Int32(metadata.GetSubscribeInfo().GetPartition().GetPartitionID()),\n\t\tGroupName: proto.String(metadata.GetSubscribeInfo().GetGroup()),\n\t\tLastPackConsumed: proto.Bool(metadata.GetSubscribeInfo().GetPartition().GetLastConsumed()),\n\t}\n\treq := codec.NewRPCRequest()\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(10),\n\t}\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerConsumerCommit),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.Body = reqC2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspC2B := &protocol.CommitOffsetResponseB2C{}\n\terr = proto.Unmarshal(rspBody.Data, rspC2B)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\treturn rspC2B, nil\n}", "title": "" }, { "docid": "573afda1fa6ace2737d3449c8a734d8e", "score": "0.54420394", "text": "func waitSBCRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) []byte {\n\tsize := 16\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"DRI2\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 11 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Drawable))\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetSbcHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetSbcLo)\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "7031e90d9ebf8c5407def817533c51d6", "score": "0.51761025", "text": "func (l *LwM2MClient) register() error {\n\tmsg := coap.Message{}\n\tmsg.MessageID = l.msgID()\n\tmsg.Token = l.token()\n\tmsg.Type = coap.Confirmable\n\tmsg.Code = coap.POST\n\tmsg.SetPath([]string{\"rd\"})\n\tmsg.AddOption(coap.URIQuery, fmt.Sprintf(\"lt=%d\", l.SessionTimeout))\n\tmsg.AddOption(coap.URIQuery, fmt.Sprintf(\"lwm2m=%s\", l.LwM2MVersion))\n\tmsg.AddOption(coap.URIQuery, fmt.Sprintf(\"b=%s\", l.Binding))\n\tmsg.AddOption(coap.LocationQuery, fmt.Sprintf(\"id=%s\", l.ClientID))\n\n\t_, err := l.Connection.Send(msg)\n\treturn err\n}", "title": "" }, { "docid": "7e985b2e780d03dbd998a903b753e1a3", "score": "0.51272845", "text": "func (c *rpcClient) SendMessageRequestP2B(ctx context.Context, metadata *metadata.Metadata,\n\tclientID string, partition *metadata.Partition, messageData []byte, flag int32) (*protocol.SendMessageResponseB2P, error) {\n\treqP2B := &protocol.SendMessageRequestP2B{\n\t\tClientId: proto.String(clientID),\n\t\tTopicName: proto.String(partition.GetTopic()),\n\t\tPartitionId: proto.Int32(partition.GetPartitionID()),\n\t\tData: messageData,\n\t\tFlag: &flag,\n\t\tCheckSum: proto.Int32(-1),\n\t\tSentAddr: proto.Int32(util.Ipv4ToInt(util.GetLocalHost())),\n\t}\n\n\treq := codec.NewRPCRequest()\n\treq.RpcHeader = &protocol.RpcConnHeader{\n\t\tFlag: proto.Int32(0),\n\t}\n\treq.RequestHeader = &protocol.RequestHeader{\n\t\tServiceType: proto.Int32(brokerReadService),\n\t\tProtocolVer: proto.Int32(2),\n\t}\n\treq.RequestBody = &protocol.RequestBody{\n\t\tMethod: proto.Int32(brokerProducerSendMsg),\n\t\tTimeout: proto.Int64(c.config.Net.ReadTimeout.Milliseconds()),\n\t}\n\treq.Body = reqP2B\n\n\trspBody, err := c.doRequest(ctx, metadata.GetNode().GetAddress(), req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\trspB2P := &protocol.SendMessageResponseB2P{}\n\terr = proto.Unmarshal(rspBody.Data, rspB2P)\n\tif err != nil {\n\t\treturn nil, errs.New(errs.RetUnMarshalFailure, err.Error())\n\t}\n\n\treturn rspB2P, nil\n}", "title": "" }, { "docid": "a7cb00e73913af2d8572d2e418ccf8bc", "score": "0.50619584", "text": "func registerClientsRequest(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) []byte {\n\tsize := xgb.Pad((((20 + xgb.Pad((int(NumClientSpecs) * 4))) + 4) + xgb.Pad((int(NumRanges) * 24))))\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"RECORD\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 2 // request opcode\n\tb += 1\n\n\tblen := b\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Context))\n\tb += 4\n\n\tbuf[b] = byte(ElementHeader)\n\tb += 1\n\n\tb += 3 // padding\n\n\txgb.Put32(buf[b:], NumClientSpecs)\n\tb += 4\n\n\txgb.Put32(buf[b:], NumRanges)\n\tb += 4\n\n\tfor i := 0; i < int(NumClientSpecs); i++ {\n\t\txgb.Put32(buf[b:], uint32(ClientSpecs[i]))\n\t\tb += 4\n\t}\n\n\tb = (b + 3) & ^3 // alignment gap\n\n\tb += RangeListBytes(buf[b:], Ranges)\n\n\tb = xgb.Pad(b)\n\txgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units\n\treturn buf[:b]\n}", "title": "" }, { "docid": "5eaf9a4c04d2432c5fbe1873de0f7db5", "score": "0.49621254", "text": "func (*RegisterResponseB2C) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "45a768b88f9615e65e4c124fb47cb9a1", "score": "0.48982248", "text": "func NewMBC2(data []byte) BankingController {\n\treturn &MBC2{\n\t\trom: data,\n\t\tromBank: 1,\n\t\tram: make([]byte, 0x2000),\n\t}\n}", "title": "" }, { "docid": "3b4cc408f7f469c62aeeaeb0a93c9f59", "score": "0.4823076", "text": "func (cmd *UpdateAccountbbbCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n\tvar accountbbbID int\n\tcc.Flags().IntVar(&cmd.AccountbbbID, \"accountbbbID\", accountbbbID, `accountbbb ID`)\n}", "title": "" }, { "docid": "d9ee18fa2fb3976b83ab927d3b770e53", "score": "0.4775724", "text": "func (sm *smanage) HandleBReq(breq []byte) (brep []byte) {\n\tlog.Info(\"PMS smanage receive %s \", string(breq))\n\tvar req csp.Request\n\tmsgpack.Unmarshal(breq, &req)\n\tif handle, ok := pmsfuncrouter[req.CMD]; ok {\n\t\trep := handle(&req)\n\t\tbrep, _ = msgpack.Marshal(rep)\n\t} else {\n\t\tvar rep csp.Response\n\t\tcsp.SetRepV(&req, &rep)\n\t\trep.MSG = \"PMS smanage can't route to '\" + req.CMD + \"' cmd\"\n\t\trep.RET = -1\n\t\tbrep, _ = msgpack.Marshal(rep)\n\t\tlog.Error(rep.MSG)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6fb200a5766e1e5f526b8349d6258f87", "score": "0.47597918", "text": "func NewMBC2(rom []byte) *MBC2 {\n\n\tm := MBC2{\n\t\trom: memory.NewROM(rom, 0x0000),\n\t\totherBanks: memory.NewROM(rom, 0x4000),\n\t\tram: memory.NewRAM(make([]byte, 512), 0xA000),\n\t\tbankROM: 1}\n\n\treturn &m\n}", "title": "" }, { "docid": "f49ebe88e0b47844fd85b2ae1ab8ae7a", "score": "0.474459", "text": "func (c *Client) Register(r *http.Request, b *body.Data) {\n\tif r.Method != \"PUT\" {\n\t\tc.log.Sugar().Warnw(\"method not implemented\", \"path\", r.URL.Path, \"method\", r.Method, \"remote_addr\", r.RemoteAddr)\n\t\tb.Status = 501\n\t\treturn\n\t}\n\n\treqBody, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tc.log.Sugar().Warnw(\"read body failed\", \"path\", r.URL.Path, \"error\", err.Error(), \"remote_addr\", r.RemoteAddr)\n\t\tb.Status = 401\n\t\treturn\n\t}\n\n\treqData, err := mRegister.Unpack(&reqBody)\n\tif err != nil {\n\t\tc.log.Sugar().Warnw(\"unmarshal body failed\", \"path\", r.URL.Path, \"error\", err.Error(), \"remote_addr\", r.RemoteAddr)\n\t\tb.Status = 401\n\t\treturn\n\t}\n\n\tmodelUser := usernew.New()\n\tmodelUser.Base = c.ldapPool.GetBase()\n\tmodelUser.Name = reqData.GetName()\n\tmodelUser.Username = reqData.GetUsername()\n\tmodelUser.Password = reqData.GetPassword()\n\tmodelUser.Email = reqData.GetEmail()\n\tmodelUser.Mobile = reqData.GetMobile()\n\tmodelUser.Address = reqData.GetAddress()\n\n\tif err := modelUser.Create(c.ldapPool); err != nil {\n\t\tc.log.Sugar().Warnw(\"add user failed\", \"path\", r.URL.Path, \"error\", err.Error(), \"remote_addr\", r.RemoteAddr)\n\t\tb.Status = 401\n\t\treturn\n\t}\n\n\tb.Status = 200\n}", "title": "" }, { "docid": "d07f5268d3c7d285df92379cb24789b2", "score": "0.4736883", "text": "func WaitSBC(c *xgb.Conn, Drawable xproto.Drawable, TargetSbcHi uint32, TargetSbcLo uint32) WaitSBCCookie {\n\tc.ExtLock.RLock()\n\tdefer c.ExtLock.RUnlock()\n\tif _, ok := c.Extensions[\"DRI2\"]; !ok {\n\t\tpanic(\"Cannot issue request 'WaitSBC' using the uninitialized extension 'DRI2'. dri2.Init(connObj) must be called first.\")\n\t}\n\tcookie := c.NewCookie(true, true)\n\tc.NewRequest(waitSBCRequest(c, Drawable, TargetSbcHi, TargetSbcLo), cookie)\n\treturn WaitSBCCookie{cookie}\n}", "title": "" }, { "docid": "1cc89af451b337628411f42eeafe2189", "score": "0.47335392", "text": "func (*SmartContractRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_src_protobuf_smartcontract_pb2_smartcontract_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d135dbeb5bd99ef235915b4dddfde0ca", "score": "0.47241718", "text": "func NewOperandRequestCR2(name, namespace string) *v1alpha1.OperandRequest {\n\treturn &v1alpha1.OperandRequest{\n\t\tObjectMeta: metav1.ObjectMeta{\n\t\t\tName: name,\n\t\t\tNamespace: namespace,\n\t\t},\n\t\tSpec: v1alpha1.OperandRequestSpec{\n\t\t\tRequests: []v1alpha1.Request{\n\t\t\t\t{\n\t\t\t\t\tRegistry: config.OperandRegistryCrName,\n\t\t\t\t\tRegistryNamespace: config.TestNamespace1,\n\t\t\t\t\tOperands: []v1alpha1.Operand{\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tName: \"jenkins\",\n\t\t\t\t\t\t\tBindings: map[string]v1alpha1.SecretConfigmap{\n\t\t\t\t\t\t\t\t\"public\": {\n\t\t\t\t\t\t\t\t\tSecret: \"jenkins-operator-credentials-example\",\n\t\t\t\t\t\t\t\t\tConfigmap: \"jenkins-operator-init-configuration-example\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c78f9e7a0c99827081dc15eb5d711245", "score": "0.47229245", "text": "func (b *Broker) Register(ctx context.Context, id types.LayerID) (chan *Msg, error) {\n\tresErr := make(chan error, 1)\n\tresCh := make(chan chan *Msg, 1)\n\tregRequest := func() {\n\t\tctx := log.WithNewSessionID(ctx)\n\t\tb.updateLatestLayer(ctx, id)\n\n\t\t// first performing a check to see whether we are synced for this layer\n\t\tif b.isSynced(ctx, id) {\n\t\t\t// This section of code does not need to be protected against possible race conditions\n\t\t\t// because this function will be added to a queue of tasks that will all be\n\t\t\t// executed sequentially and synchronously. There is still the concern that two or more\n\t\t\t// calls to Register will be executed out of order, but Register is only called\n\t\t\t// on a new layer tick, and anyway updateLatestLayer would panic in this case.\n\t\t\tb.mu.RLock()\n\t\t\toutboxLen := len(b.outbox)\n\t\t\tb.mu.RUnlock()\n\t\t\tif outboxLen >= b.limit {\n\t\t\t\t// unregister the earliest layer to make space for the new layer\n\t\t\t\t// cannot call unregister here because unregister blocks and this would cause a deadlock\n\t\t\t\tb.mu.RLock()\n\t\t\t\tinstance := b.minDeleted.Add(1)\n\t\t\t\tb.mu.RUnlock()\n\t\t\t\tb.cleanState(instance)\n\t\t\t\tb.With().Info(\"unregistered layer due to maximum concurrent processes\", types.LayerID(instance))\n\t\t\t}\n\n\t\t\toutboxCh := make(chan *Msg, inboxCapacity)\n\n\t\t\tb.mu.Lock()\n\t\t\tb.outbox[id.Uint32()] = outboxCh\n\t\t\tpendingForInstance := b.pending[id.Uint32()]\n\t\t\tb.mu.Unlock()\n\n\t\t\tif pendingForInstance != nil {\n\t\t\t\tfor _, mOut := range pendingForInstance {\n\t\t\t\t\toutboxCh <- mOut\n\t\t\t\t}\n\t\t\t\tb.mu.Lock()\n\t\t\t\tdelete(b.pending, id.Uint32())\n\t\t\t\tb.mu.Unlock()\n\t\t\t}\n\n\t\t\tresErr <- nil\n\t\t\tresCh <- outboxCh\n\n\t\t\treturn\n\t\t}\n\n\t\t// if we are not synced, we return an InstanceNotSynced error\n\t\tresErr <- errInstanceNotSynced\n\t\tresCh <- nil\n\t}\n\n\tb.WithContext(ctx).With().Debug(\"queueing register task\", types.LayerID(id))\n\tb.tasks <- regRequest // send synced task\n\n\t// wait for result\n\terr := <-resErr\n\tresult := <-resCh\n\tb.WithContext(ctx).With().Debug(\"register task result received\", types.LayerID(id), log.Err(err))\n\tif err != nil { // reg failed\n\t\treturn nil, err\n\t}\n\n\treturn result, nil // reg ok\n}", "title": "" }, { "docid": "efb7de31a751bcae792e861e092f8f2d", "score": "0.47134727", "text": "func Register(ctx context.Context, conn *itermctl.Connection, rpc RPC) error {\n\trole := iterm2.RPCRegistrationRequest_GENERIC\n\n\treq := newRegistrationRequest(role, rpc)\n\n\trecv, err := conn.Subscribe(ctx, req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"register rpc: %s\", err)\n\t}\n\n\trecv.SetName(fmt.Sprintf(\"receive rpc: %s\", rpc.Name))\n\trecv.SetAcceptFunc(acceptFunctionInvocation(rpc))\n\n\tgo func() {\n\t\tfor msg := range recv.Ch() {\n\t\t\trpcNotification := msg.GetNotification().GetServerOriginatedRpcNotification()\n\t\t\targs := getInvocationArguments(ctx, conn, rpcNotification)\n\t\t\tinvoke(conn, rpc, args)\n\t\t}\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "66ec6540993165052ef423ab571194f1", "score": "0.46852824", "text": "func swapBuffersRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte {\n\tsize := 32\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"DRI2\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 8 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Drawable))\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetMscHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetMscLo)\n\tb += 4\n\n\txgb.Put32(buf[b:], DivisorHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], DivisorLo)\n\tb += 4\n\n\txgb.Put32(buf[b:], RemainderHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], RemainderLo)\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "58b7e38f270fb286efcc5175a5b1d3f8", "score": "0.4679144", "text": "func (c *Challenge) RegisterRequest() *RegisterRequest {\n\tvar rr RegisterRequest\n\trr.Version = u2fVersion\n\trr.AppID = c.AppID\n\trr.Challenge = encodeBase64(c.Challenge)\n\treturn &rr\n}", "title": "" }, { "docid": "c3e67a852667f151d6e18aef9dfb53a3", "score": "0.46593285", "text": "func DecodeRegisterRequest(mux goahttp.Muxer, decoder func(*http.Request) goahttp.Decoder) func(*http.Request) (interface{}, error) {\n\treturn func(r *http.Request) (interface{}, error) {\n\t\tvar (\n\t\t\tbody RegisterRequestBody\n\t\t\terr error\n\t\t)\n\t\terr = decoder(r).Decode(&body)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\treturn nil, goa.MissingPayloadError()\n\t\t\t}\n\t\t\treturn nil, goa.DecodePayloadError(err.Error())\n\t\t}\n\t\terr = ValidateRegisterRequestBody(&body)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayload := NewRegisterPayload(&body)\n\n\t\treturn payload, nil\n\t}\n}", "title": "" }, { "docid": "5ad715a29943d53e1c7b56d520f6bf24", "score": "0.46195453", "text": "func (o *CreateAzureB2CIDPParams) 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.AzureB2CIDP != nil {\n\t\tif err := r.SetBodyParam(o.AzureB2CIDP); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// path param aid\n\tif err := r.SetPathParam(\"aid\", o.Aid); err != nil {\n\t\treturn err\n\t}\n\n\t// path param tid\n\tif err := r.SetPathParam(\"tid\", o.Tid); err != nil {\n\t\treturn err\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6dacb36014d901f0203d5dd298f8d35b", "score": "0.45880836", "text": "func (c *Controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {\n\tc.log = logf.FromContext(ctx.RootContext, ControllerName)\n\tc.queue = workqueue.NewNamedRateLimitingQueue(controllerpkg.DefaultItemBasedRateLimiter(), ControllerName)\n\n\tcertificateRequestInformer := ctx.SharedInformerFactory.Certmanager().V1().CertificateRequests()\n\tmustSync := []cache.InformerSynced{certificateRequestInformer.Informer().HasSynced}\n\tcertificateRequestInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: c.queue})\n\n\tc.certificateRequestLister = certificateRequestInformer.Lister()\n\tc.cmClient = ctx.CMClient\n\tc.fieldManager = ctx.FieldManager\n\tc.recorder = ctx.Recorder\n\n\tc.log.V(logf.DebugLevel).Info(\"certificate request approver controller registered\")\n\n\treturn c.queue, mustSync, nil\n}", "title": "" }, { "docid": "a08876346eb48ca21482683a300d993f", "score": "0.45826948", "text": "func (cmd *CreateAccountbbbCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tcc.Flags().StringVar(&cmd.Payload, \"payload\", \"\", \"Request body encoded in JSON\")\n\tcc.Flags().StringVar(&cmd.ContentType, \"content\", \"\", \"Request content type override, e.g. 'application/x-www-form-urlencoded'\")\n}", "title": "" }, { "docid": "5644766988a4841f59ffd37dc1be6b5d", "score": "0.4574026", "text": "func (client *providersOperations) registerCreateRequest(ctx context.Context, resourceProviderNamespace string) (*azpolicy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register\"\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceProviderNamespace}\", url.PathEscape(resourceProviderNamespace))\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.u, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tquery := req.Raw().URL.Query()\n\tquery.Set(\"api-version\", \"2019-05-01\")\n\treq.Raw().URL.RawQuery = query.Encode()\n\treturn req, nil\n}", "title": "" }, { "docid": "e2275713e6fafe8e18baaecca9469e10", "score": "0.45423946", "text": "func (ec *executionContext) unmarshalNAccountConfirmationReq2githubᚗcomᚋnirajgeorgianᚋgatewayᚋsrcᚋmodelsᚐAccountConfirmationReq(ctx context.Context, v interface{}) (models.AccountConfirmationReq, error) {\n\treturn ec.unmarshalInputAccountConfirmationReq(ctx, v)\n}", "title": "" }, { "docid": "3b4de053411cc6f4069f7c948afa8fd9", "score": "0.45309573", "text": "func (r *Resolver) TRBRequest() generated.TRBRequestResolver { return &tRBRequestResolver{r} }", "title": "" }, { "docid": "d3b243da6d27db7addc5a25adc25a5b6", "score": "0.45210287", "text": "func RegisterImCoreBMServer(e *bm.Engine, server ImCoreBMServer, midMap map[string]bm.HandlerFunc) {\n\tImCoreSvc = server\n\te.GET(\"/imCore.service.v1.imCore/Connect\", imCoreConnect)\n}", "title": "" }, { "docid": "0d064739720aba99b44db3b02047b69d", "score": "0.45194128", "text": "func newB2(endpoint, keyID, applicationKey, token string) (ObjectStorage, error) {\n\tif !strings.Contains(endpoint, \"://\") {\n\t\tendpoint = fmt.Sprintf(\"https://%s\", endpoint)\n\t}\n\turi, err := url.ParseRequestURI(endpoint)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"Invalid endpoint: %v, error: %v\", endpoint, err)\n\t}\n\thostParts := strings.Split(uri.Host, \".\")\n\tname := hostParts[0]\n\tclient, err := backblaze.NewB2(backblaze.Credentials{\n\t\tKeyID: keyID,\n\t\tApplicationKey: applicationKey,\n\t})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create B2 client: %s\", err)\n\t}\n\tclient.MaxIdleUploads = 20\n\tbucket, err := client.Bucket(name)\n\tif err != nil {\n\t\tlogger.Warnf(\"access bucket %s: %s\", name, err)\n\t\tbucket, err = client.CreateBucket(name, \"allPrivate\")\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"create bucket %s: %s\", name, err)\n\t\t}\n\t}\n\tif bucket == nil {\n\t\treturn nil, fmt.Errorf(\"can't find bucket %s with provided Key ID\", name)\n\t}\n\treturn &b2client{bucket: bucket}, nil\n}", "title": "" }, { "docid": "35ba32adf8acb02ace9352141daaf9df", "score": "0.45150533", "text": "func FIDO2Register(\n\tctx context.Context,\n\torigin string, cc *wanlib.CredentialCreation, prompt RegisterPrompt,\n) (*proto.MFARegisterResponse, error) {\n\treturn fido2Register(ctx, origin, cc, prompt)\n}", "title": "" }, { "docid": "817ca8dab2a1d2e24b25ba9f9c243b74", "score": "0.4513446", "text": "func waitMSCRequest(c *xgb.Conn, Drawable xproto.Drawable, TargetMscHi uint32, TargetMscLo uint32, DivisorHi uint32, DivisorLo uint32, RemainderHi uint32, RemainderLo uint32) []byte {\n\tsize := 32\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"DRI2\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 10 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Drawable))\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetMscHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], TargetMscLo)\n\tb += 4\n\n\txgb.Put32(buf[b:], DivisorHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], DivisorLo)\n\tb += 4\n\n\txgb.Put32(buf[b:], RemainderHi)\n\tb += 4\n\n\txgb.Put32(buf[b:], RemainderLo)\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "889a66222a861ac2d7da5194a518ae70", "score": "0.4499772", "text": "func (ss *Storageserver) RegisterRPC(args *storageproto.RegisterArgs, reply *storageproto.RegisterReply) error {\n ss.registerRequestChan <- args\n ret := <-ss.registerReplyChan\n reply.Ready = ret.Ready\n reply.Clients = ret.Clients\n return nil\n}", "title": "" }, { "docid": "8a92750101fd7ff003819dd4df1c1875", "score": "0.4494762", "text": "func (client *ProvidersClient) registerCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProvidersClientRegisterOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/providers/{resourceProviderNamespace}/register\"\n\tif resourceProviderNamespace == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceProviderNamespace cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceProviderNamespace}\", url.PathEscape(resourceProviderNamespace))\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-04-01\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\tif options != nil && options.Properties != nil {\n\t\tif err := runtime.MarshalAsJSON(req, *options.Properties); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn req, nil\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "d0c8cffe660118d02210e0eb4052b1db", "score": "0.44883716", "text": "func (o *GetRiotMessagingServiceV1MessageByAByBByCByDParams) 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 a\n\tif err := r.SetPathParam(\"a\", o.A); err != nil {\n\t\treturn err\n\t}\n\n\t// path param b\n\tif err := r.SetPathParam(\"b\", o.B); err != nil {\n\t\treturn err\n\t}\n\n\t// path param c\n\tif err := r.SetPathParam(\"c\", o.C); err != nil {\n\t\treturn err\n\t}\n\n\t// path param d\n\tif err := r.SetPathParam(\"d\", o.D); 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": "caad28fdd7e7d936a1d72c68c2e57e42", "score": "0.44860822", "text": "func (o *OneTwoClimbAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) {\n\to.customConsumers[mediaType] = consumer\n}", "title": "" }, { "docid": "bf8678d690a91d54409931a744992cd5", "score": "0.4477654", "text": "func unregisterClientsRequest(c *xgb.Conn, Context Context, NumClientSpecs uint32, ClientSpecs []ClientSpec) []byte {\n\tsize := xgb.Pad((12 + xgb.Pad((int(NumClientSpecs) * 4))))\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"RECORD\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 3 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Context))\n\tb += 4\n\n\txgb.Put32(buf[b:], NumClientSpecs)\n\tb += 4\n\n\tfor i := 0; i < int(NumClientSpecs); i++ {\n\t\txgb.Put32(buf[b:], uint32(ClientSpecs[i]))\n\t\tb += 4\n\t}\n\n\treturn buf\n}", "title": "" }, { "docid": "d3c3b78e0d7df2fd3f74f72042998839", "score": "0.44751602", "text": "func (client *MediaTypesClient) binaryBodyWithTwoContentTypesCreateRequest(ctx context.Context, contentType ContentType1, message io.ReadSeekCloser, options *MediaTypesClientBinaryBodyWithTwoContentTypesOptions) (*policy.Request, error) {\n\turlPath := \"/mediatypes/binaryBodyTwoContentTypes\"\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treq.Raw().Header[\"Content-Type\"] = []string{string(contentType)}\n\treq.Raw().Header[\"Accept\"] = []string{\"text/plain\"}\n\tif err := req.SetBody(message, string(contentType)); err != nil {\n\t\treturn nil, err\n\t}\n\treturn req, nil\n}", "title": "" }, { "docid": "6bb26a1b4ed8505e607b369849eab6f3", "score": "0.44573277", "text": "func _cgoexp_ebd397278953_new_holochain_BSReq(a unsafe.Pointer, n int32, ctxt uintptr) {\n\tfn := _cgoexpwrap_ebd397278953_new_holochain_BSReq\n\t_cgo_runtime_cgocallback(**(**unsafe.Pointer)(unsafe.Pointer(&fn)), a, uintptr(n), ctxt);\n}", "title": "" }, { "docid": "ed2528536a2007984aa6e0ae3889c1ba", "score": "0.44564202", "text": "func (c *commonCtl) register(r tb.Recipient, msgID int) uuid.UUID {\n\tc.mu.Lock()\n\tdefer c.mu.Unlock()\n\n\tc.requestEnsure(r)\n\n\treqID := uuid.Must(uuid.NewUUID())\n\tc.reqCache[r.Recipient()][msgID] = reqID\n\tc.messages[r.Recipient()] = msgID\n\treturn reqID\n}", "title": "" }, { "docid": "b2cef7ca027361db12a0841af6274e23", "score": "0.4449285", "text": "func (r *cluster) Register(_ context.Context, req *clusterpb.RegisterRequest) (*clusterpb.RegisterResponse, error) {\n\tif req.MemberInfo == nil {\n\t\treturn nil, ErrInvalidRegisterReq\n\t}\n\n\t//目前的逻辑是,必需有一个node为master,当有新结点发送register时,该master结点会通知其他结点更新服务\n\t//master结点承担了消息广播的作用。不过也有单点问题。\n\n\t//几种方式:\n\t//1、配表方式:\n\t//每个结点启动时本地有一张配表获取其他结点的地址,当结点启动时,会主动连接配表里的结点,并进行服务登记,如果是新结点并更新本地配表\n\n\t//2、依赖etcd\n\t//所有结点在配表里已配置好etcd地址,当启动时会主动发送自己的信息到etcd,所有结点订阅该事件,并进行更新\n\n\t//3、nats分布式消息队列\n\t//所有结点进行通信时,消息都会发送到nats消息队列,各结点也会订阅相关的事件进行消息收发处理\n\n\tresp := &clusterpb.RegisterResponse{}\n\tfor _, m := range r.members {\n\t\tif m.memberInfo.ServiceAddr == req.MemberInfo.ServiceAddr {\n\t\t\treturn nil, fmt.Errorf(\"address %s has registered\", req.MemberInfo.ServiceAddr)\n\t\t}\n\t}\n\n\t// Notify registered node to update remote services\n\tnewMember := &clusterpb.NewMemberRequest{MemberInfo: req.MemberInfo}\n\tfor _, m := range r.members {\n\t\t//append\n\t\tresp.Members = append(resp.Members, m.memberInfo)\n\t\tif m.isMaster {\n\t\t\tcontinue\n\t\t}\n\t\tpool, err := r.currentNode.rpcConnPool.getConnPool(m.memberInfo.ServiceAddr)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\t//收到注册信息,通信所有成员。。。\n\t\t//这里应该可以不用每次new client,每次从对象池拿就可以了\n\t\tclient := clusterpb.NewMemberClient(pool.Get())\n\t\t_, err = client.NewMember(context.Background(), newMember)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tlog.Println(\"New peer register to cluster\", req.MemberInfo.ServiceAddr)\n\n\t// Register services to current node\n\t//远程服务信息添加至本机remote service\n\tr.currentNode.handler.addRemoteService(req.MemberInfo)\n\tr.Lock()\n\tr.members = append(r.members, &Member{isMaster: false, memberInfo: req.MemberInfo})\n\tr.Unlock()\n\treturn resp, nil\n}", "title": "" }, { "docid": "1eea0b9b4e860793ef04c7169d917474", "score": "0.44464225", "text": "func (xm *AChainMG) RegisterSubscriber() error {\n\txm.Log.Trace(\"Start to Register Subscriber\")\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(xm.msgChan, amper_p2p.AmperMessage_POSTTX, nil, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(xm.msgChan, amper_p2p.AmperMessage_SENDBLOCK, nil, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(xm.msgChan, amper_p2p.AmperMessage_BATCHPOSTTX, nil, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(nil, amper_p2p.AmperMessage_GET_BLOCK, xm.handleGetBlock, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(nil, amper_p2p.AmperMessage_GET_BLOCKCHAINSTATUS, xm.handleGetBlockChainStatus, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(nil, amper_p2p.AmperMessage_CONFIRM_BLOCKCHAINSTATUS, xm.handleConfirmBlockChainStatus, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := xm.P2pv2.Register(p2pv2.NewSubscriber(nil, amper_p2p.AmperMessage_GET_RPC_PORT, xm.handleGetRPCPort, \"\")); err != nil {\n\t\treturn err\n\t}\n\n\txm.Log.Trace(\"Stop to Register Subscriber\")\n\treturn nil\n}", "title": "" }, { "docid": "216462ee4bd9337ade59d21bafb42526", "score": "0.4445562", "text": "func RegisterRtcBMServer(e *bm.Engine, server RtcBMServer) {\n\tv1RtcSvc = server\n\te.POST(\"/live.rtc.v1.Rtc/JoinChannel\", rtcJoinChannel)\n\te.POST(\"/live.rtc.v1.Rtc/LeaveChannel\", rtcLeaveChannel)\n\te.POST(\"/live.rtc.v1.Rtc/PublishStream\", rtcPublishStream)\n\te.POST(\"/live.rtc.v1.Rtc/TerminateStream\", rtcTerminateStream)\n\te.GET(\"/live.rtc.v1.Rtc/Channel\", rtcChannel)\n\te.GET(\"/live.rtc.v1.Rtc/Stream\", rtcStream)\n\te.POST(\"/live.rtc.v1.Rtc/SetRtcConfig\", rtcSetRtcConfig)\n\te.GET(\"/live.rtc.v1.Rtc/VerifyToken\", rtcVerifyToken)\n}", "title": "" }, { "docid": "15233fc80e16e72902f10090cae3e16e", "score": "0.44365528", "text": "func createBlackDuckCRRequest(data []byte) error {\n\tbdConfig := BlackDuckUIRequest{}\n\terr := json.Unmarshal(data, &bdConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal Black Duck request: %s\", err)\n\t}\n\tblackDuckCR := &synopsysV1.Blackduck{\n\t\tObjectMeta: v1.ObjectMeta{\n\t\t\tName: bdConfig.Name,\n\t\t\tNamespace: bdConfig.Namespace,\n\t\t},\n\t\tSpec: synopsysV1.BlackduckSpec{\n\t\t\tNamespace: bdConfig.Namespace,\n\t\t\tSize: bdConfig.Size,\n\t\t\tVersion: bdConfig.Version,\n\t\t\tExposeService: bdConfig.ExposeService,\n\t\t\tPVCStorageClass: bdConfig.PVCStorageClass,\n\t\t\tLivenessProbes: bdConfig.LivenessProbes,\n\t\t\tScanType: bdConfig.ScanType,\n\t\t\tPersistentStorage: bdConfig.PersistentStorage,\n\t\t\tLicenseKey: bdConfig.LicenseKey,\n\t\t\tAdminPassword: bdConfig.PostgresSQLAdminPassword,\n\t\t\tUserPassword: bdConfig.PostgresSQLUserPassword,\n\t\t\tPostgresPassword: bdConfig.PostgresSQLPostgresPassword,\n\t\t},\n\t}\n\tblackDuckCR.Kind = \"Blackduck\"\n\tblackDuckCR.APIVersion = \"synopsys.com/v1\"\n\t_, err = utils.CreateBlackduck(restClient, blackDuckCR)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error creating Black Duck CR: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ea8cb1544d4665416ccf63dfe67dc909", "score": "0.44277075", "text": "func (*HeartBeatRequestC2B) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "c09d4172998441fac93dfec4ea9b7a55", "score": "0.44263908", "text": "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_rpc_CommonService_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "99869e8d463861e58ac4c7cfc5eba397", "score": "0.4421342", "text": "func (cmd *ShowAccountbbbCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar accountbbbID int\n\tcc.Flags().IntVar(&cmd.AccountbbbID, \"accountbbbID\", accountbbbID, `accountbbb ID`)\n}", "title": "" }, { "docid": "e45a2ca468f84ec600db0e9072903eb1", "score": "0.44151762", "text": "func (s *FarmtoFork) registerBid(stub shim.ChaincodeStubInterface, args []string) sc.Response {\n\tvar err error\n\tvar wholeid string \n\tvar aggrid string \n\tvar produceid string \n\tvar bidid string \n\tvar wholekey string \n\tvar aggrkey string \n\tvar producekey string \n\tvar bidkey string \n\tvar bid_amount uint64\n\tvar weight uint64\n\n\tfmt.Println(\"running registerBid()\")\n\t\n\tif len(args) != 10{\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 10\")\n\t}\n\t\n\twholeid = args[0]\n\taggrid = args[1]\n\tproduceid = args[2]\n\tbidid = args[3]\n\tweight,err = strconv.ParseUint(args[4], 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\tbid_amount,err = strconv.ParseUint(args[5], 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\twholekey = creatwholesalekey(wholeid)\n\twholeAsBytes, err := stub.GetState(wholekey)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if wholeAsBytes == nil {\n\t\tfmt.Println(\"Wholesaler id: \" + wholeid + \" does not exist\")\n\t\treturn shim.Error(\"Wholesaler id: \" + wholeid + \" does not exist\")\n\t}\n\n\taggrkey = createaggrkey(aggrid)\n\taggrAsBytes, err := stub.GetState(aggrkey)\n\tif err != nil {\n\t\t\treturn shim.Error(err.Error())\n\t} else if aggrAsBytes == nil {\n\t\t\tfmt.Println(\"Aggregator id: \" + aggrid + \" does not exist\")\n\t\t\treturn shim.Error(\"Aggregator id: \" + aggrid + \" does not exist\")\n\t}\n\n\tproducekey = createproducekey(produceid)\n\tproduceAsBytes, err := stub.GetState(producekey)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if produceAsBytes == nil {\n\t\tfmt.Println(\"Produce id: \" + produceid + \" does not exist\")\n\t\treturn shim.Error(\"Produce id: \" + produceid+ \" does not exist\")\n\t}\n\n\tbidkey = createbidkey(bidid)\n\tbAsBytes, err := stub.GetState(bidkey)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} else if bAsBytes != nil {\n\t\tfmt.Println(\"Bid: \" + bidid + \" exists\")\n\t\treturn shim.Error(\"Bid: \" + bidid + \"exists\")\n\t}\n\n\tb := BidProduce{}\n\t\n\tb.WholeSalerId,err = strconv.ParseUint(wholeid, 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} \n\tb.AggrId,err = strconv.ParseUint(aggrid, 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} \n\tb.Produceid,err = strconv.ParseUint(produceid, 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} \n\tb.Weight = weight\n\tb.BidId,err = strconv.ParseUint(bidid, 10, 64)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t} \n\tb.BidAmt = bid_amount\n\tb.Bidstatus = \"PENDING\"\n\tb.Paidstatus = \"PENDING\"\n\tb.Deliverystatus = \"PENDING\"\n\tb.Transportpaystatus = \"PENDING\"\n\n\tbidDetAsBytes, _ := json.Marshal(b)\n\terr = stub.PutState(bidkey, bidDetAsBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "06ec0e7c825594b16b53abe907226ad2", "score": "0.44040337", "text": "func (b *broker) RegisterModel(ctx context.Context, req *pbMS.RegistrationRequest) (*pbMS.RegistrationResponse, error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tlog.WithFields(log.Fields{\n\t\t\"model_address\": req.GetAddress(),\n\t}).Debug(\"Received model registration request.\")\n\taddress := modelAddress(req.GetAddress())\n\tclient, err := newModelClient(address)\n\tif err != nil {\n\t\tlog.WithFields(log.Fields{\n\t\t\t\"model_address\": req.GetAddress(),\n\t\t}).Error(\"Failed to create model result client.\")\n\t\treturn &pbMS.RegistrationResponse{Success: false}, err\n\t}\n\tb.modelClients[address] = client\n\treturn &pbMS.RegistrationResponse{Success: true}, nil\n}", "title": "" }, { "docid": "a13b4df8f743dba8432a4dcdc931961d", "score": "0.44035384", "text": "func (lb *MyLoadBalancer) RegisterInstance(ch chan Request) {\n\n\tlb.mutex.Lock() // to make that load balancer is accessible\n\tdefer lb.mutex.Unlock()\n\tfmt.Printf(\"RegisterInstance : %#v \\n\", ch)\n\tlb.requestsChannels = append(lb.requestsChannels, &RequestChannel{\n\t\tch: ch,\n\t})\n\treturn\n}", "title": "" }, { "docid": "35e216a6d53c81989f7c732fd4631796", "score": "0.44029957", "text": "func cardTransactionI2C(context *Context, reqJSON []byte) (rspJSON []byte, err error) {\n\n\t// Transmit the request in chunks, but also in segments so as not to overwhelm the notecard's interrupt buffers\n\tchunkoffset := 0\n\tjsonbufLen := len(reqJSON)\n\tsentInSegment := 0\n\tfor jsonbufLen > 0 {\n\t\tchunklen := CardI2CMax\n\t\tif jsonbufLen < chunklen {\n\t\t\tchunklen = jsonbufLen\n\t\t}\n\t\terr = i2cWriteBytes(reqJSON[chunkoffset : chunkoffset+chunklen])\n\t\tif err != nil {\n\t\t\terr = fmt.Errorf(\"chunk write error: %s\", err)\n\t\t\treturn\n\t\t}\n\t\tchunkoffset += chunklen\n\t\tjsonbufLen -= chunklen\n\t\tsentInSegment += chunklen\n\t\tif sentInSegment > CardRequestSegmentMaxLen {\n\t\t\tsentInSegment -= CardRequestSegmentMaxLen\n\t\t\ttime.Sleep(CardRequestSegmentDelayMs * time.Millisecond)\n\t\t}\n\t}\n\n\t// Loop, building a reply buffer out of received chunks. We'll build the reply in the same\n\t// buffer we used to transmit, and will grow it as necessary.\n\tjsonbufLen = 0\n\treceivedNewline := false\n\tchunklen := 0\n\texpires := time.Now().Add(time.Duration(10 * time.Second))\n\tfor {\n\n\t\t// Read the next chunk\n\t\treadbuf, available, err2 := i2cReadBytes(chunklen)\n\t\tif err2 != nil {\n\t\t\terr = fmt.Errorf(\"error reading chunk: %s\", err2)\n\t\t\treturn\n\t\t}\n\n\t\t// Append to the JSON being accumulated\n\t\trspJSON = append(rspJSON, readbuf...)\n\t\treadlen := len(readbuf)\n\t\tjsonbufLen += readlen\n\n\t\t// If the last byte of the chunk is \\n, chances are that we're done. However, just so\n\t\t// that we pull everything pending from the module, we only exit when we've received\n\t\t// a newline AND there's nothing left available from the module.\n\t\tif readlen > 0 && readbuf[readlen-1] == '\\n' {\n\t\t\treceivedNewline = true\n\t\t}\n\n\t\t// For the next iteration, reaad the min of what's available and what we're permitted to read\n\t\tchunklen = available\n\t\tif chunklen > CardI2CMax {\n\t\t\tchunklen = CardI2CMax\n\t\t}\n\n\t\t// If there's something available on the notecard for us to receive, do it\n\t\tif chunklen > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\t// If there's nothing available and we received a newline, we're done\n\t\tif receivedNewline {\n\t\t\tbreak\n\t\t}\n\n\t\t// If we've timed out and nothing's available, exit\n\t\tif time.Now().After(expires) {\n\t\t\terr = fmt.Errorf(\"transaction timeout\")\n\t\t\treturn\n\t\t}\n\n\t\t// Delay, simply waiting for the Notecard to process the request\n\t\ttime.Sleep(50 * time.Millisecond)\n\n\t}\n\n\t// Done\n\treturn\n}", "title": "" }, { "docid": "177ea94558bc11a375a013d06c3283c5", "score": "0.43970725", "text": "func PacketBuddyReceiveRequest(fromID int32, fromName string, fromChannelID int32) mpacket.Packet {\n\tp := mpacket.CreateWithOpcode(opcode.SendChannelBuddyInfo)\n\tp.WriteByte(0x9)\n\tp.WriteInt32(fromID)\n\tp.WriteString(fromName)\n\tp.WriteInt32(fromID)\n\tp.WritePaddedString(fromName, 13)\n\tp.WriteByte(1)\n\tp.WriteInt32(fromChannelID)\n\tp.WriteBool(false) // sender in cash shop\n\n\treturn p\n}", "title": "" }, { "docid": "0065412f7b232c3fc34e6a67b8df9535", "score": "0.4390961", "text": "func (customer *Customer) Register(ctx context.Context, req *customerpb.RegisterRequest) (*customerpb.RegisterResponse, error) {\n\n\tuuid := randString(32)\n\n\t_, err := customer.strg.Lookup(ctx, uuid)\n\tif err != nil && err != customer.strg.ErrUserDoesNotExist() {\n\t\treturn nil, err\n\t}\n\tif err == nil {\n\t\treturn nil, errCustomerExists\n\t}\n\n\terr = customer.strg.Register(ctx, uuid, req.FirstName, req.LastName, req.DOB)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &customerpb.RegisterResponse{}, nil\n\n}", "title": "" }, { "docid": "fd30cceee42091634b8f9f2fd7050a59", "score": "0.43805635", "text": "func RegisterWithELBv2(service *bridge.Service, registration *fargo.Instance, client fargo.EurekaConnection) error {\n\tif CheckELBFlags(service) {\n\t\tlog.Debugf(\"Found ELBv2 flags, will attempt to register LB for: %s\\n\", GetUniqueID(*registration))\n\t\telbReg := mutateRegistrationInfo(service, registration)\n\t\tif elbReg != nil {\n\t\t\ttestHealth(service, client, elbReg)\n\t\t\terr := client.ReregisterInstance(elbReg)\n\t\t\treturn err\n\t\t}\n\t\tseed := rand.NewSource(time.Now().UnixNano())\n\t\tr2 := rand.New(seed)\n\t\tfor i := 1; i < 4; i++ {\n\t\t\t// If there's no ELBv2 data, we need to retry a couple of times, as it takes a little while to propogate target group membership\n\t\t\t// To avoid any wait, the endpoints can be specified manually as eureka_elbv2_hostname and eureka_elbv2_port vars\n\t\t\trandom := r2.Intn(5000)\n\t\t\tmodifier := +time.Duration(time.Millisecond * 5000)\n\t\t\tperiod := time.Duration(time.Millisecond*time.Duration(random)) + modifier + time.Duration(DEFAULT_EXP_TIME*time.Duration(i))\n\t\t\tlog.Debugf(\"Retrying retrieval of ELBv2 data, attempt %v/3 - Waiting for %v seconds\", i, period)\n\t\t\ttime.Sleep(period)\n\t\t\telbReg = mutateRegistrationInfo(service, registration)\n\t\t\tif elbReg != nil {\n\t\t\t\ttestHealth(service, client, elbReg)\n\t\t\t\terr := client.ReregisterInstance(elbReg)\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn fmt.Errorf(\"unable to register ELBv2: %v\", GetUniqueID(*registration))\n}", "title": "" }, { "docid": "720eab0b7db2a043be333c95b6ccaeb5", "score": "0.43792564", "text": "func MPI_Bsend_init(sendBuffer interface{},\n\tcount int,\n\tdataType Datatype,\n\tdest int,\n\ttag int,\n\tcomm Comm) (Request, int) {\n\n\tvar request C.MPI_Request\n\tsendBufferVoidPointer := Get_void_ptr(sendBuffer)\n\n\terr := C.MPI_Bsend_init(sendBufferVoidPointer,\n\t\tC.int(count),\n\t\tC.MPI_Datatype(dataType),\n\t\tC.int(dest),\n\t\tC.int(tag),\n\t\tC.MPI_Comm(comm),\n\t\t&request)\n\n\treturn Request(request), int(err)\n}", "title": "" }, { "docid": "d314d0028624e78038381c7be3752af2", "score": "0.43759936", "text": "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_loadtesting_agent_v1_agent_registration_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b2416b0f949524904ef2b3e192f5c869", "score": "0.43740827", "text": "func register(c *bm.Context) {\n\tc.JSON(map[string]interface{}{}, nil)\n}", "title": "" }, { "docid": "b2416b0f949524904ef2b3e192f5c869", "score": "0.43740827", "text": "func register(c *bm.Context) {\n\tc.JSON(map[string]interface{}{}, nil)\n}", "title": "" }, { "docid": "ebbc1e586137611c97b215d6a30f6422", "score": "0.43690804", "text": "func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Context, resourceGroupName string, registryName string, connectedRegistryName string, options *ConnectedRegistriesBeginDeactivateOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerRegistry/registries/{registryName}/connectedRegistries/{connectedRegistryName}/deactivate\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\tif registryName == \"\" {\n\t\treturn nil, errors.New(\"parameter registryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{registryName}\", url.PathEscape(registryName))\n\tif connectedRegistryName == \"\" {\n\t\treturn nil, errors.New(\"parameter connectedRegistryName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{connectedRegistryName}\", url.PathEscape(connectedRegistryName))\n\treq, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2021-08-01-preview\")\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header.Set(\"Accept\", \"application/json\")\n\treturn req, nil\n}", "title": "" }, { "docid": "5eb01d883b1db921b36d06cd64c19e2b", "score": "0.43670982", "text": "func (*CommitOffsetRequestC2B) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "22e16d3ba091731ba9e432fe853511d1", "score": "0.4361941", "text": "func RegisterSpecWithCspSpecName(nsId string, u *TbSpecReq) (TbSpecInfo, error) {\n\n\tresourceType := common.StrSpec\n\n\terr := common.CheckString(nsId)\n\tif err != nil {\n\t\ttemp := TbSpecInfo{}\n\t\tcommon.CBLog.Error(err)\n\t\treturn temp, err\n\t}\n\terr = common.CheckString(u.Name)\n\tif err != nil {\n\t\ttemp := TbSpecInfo{}\n\t\tcommon.CBLog.Error(err)\n\t\treturn temp, err\n\t}\n\tcheck, _ := CheckResource(nsId, resourceType, u.Name)\n\n\tif check {\n\t\ttemp := TbSpecInfo{}\n\t\terr := fmt.Errorf(\"The spec \" + u.Name + \" already exists.\")\n\t\treturn temp, err\n\t}\n\n\tres, err := LookupSpec(u.ConnectionName, u.CspSpecName)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\terr := fmt.Errorf(\"an error occurred while lookup spec via CB-Spider\")\n\t\temptySpecInfoObj := TbSpecInfo{}\n\t\treturn emptySpecInfoObj, err\n\t}\n\n\tcontent := TbSpecInfo{}\n\tcontent.Namespace = nsId\n\t//content.Id = common.GenUuid()\n\tcontent.Id = u.Name\n\tcontent.Name = u.Name\n\tcontent.CspSpecName = res.Name\n\tcontent.ConnectionName = u.ConnectionName\n\tcontent.AssociatedObjectList = []string{}\n\n\ttempUint64, _ := strconv.ParseUint(res.VCpu.Count, 10, 16)\n\tcontent.Num_vCPU = uint16(tempUint64)\n\n\t//content.Num_core = res.Num_core\n\n\ttempFloat64, _ := strconv.ParseFloat(res.Mem, 32)\n\tcontent.Mem_GiB = uint16(tempFloat64 / 1024)\n\n\t//content.Storage_GiB = res.Storage_GiB\n\t//content.Description = res.Description\n\n\t// cb-store\n\tfmt.Println(\"=========================== PUT registerSpec\")\n\tKey := common.GenResourceKey(nsId, resourceType, content.Id)\n\tVal, _ := json.Marshal(content)\n\terr = common.CBStore.Put(string(Key), string(Val))\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn content, err\n\t}\n\tkeyValue, _ := common.CBStore.Get(string(Key))\n\tfmt.Println(\"<\" + keyValue.Key + \"> \\n\" + keyValue.Value)\n\tfmt.Println(\"===========================\")\n\n\t// register information related with MCIS recommendation\n\terr = RegisterRecommendList(nsId, content.ConnectionName, content.Num_vCPU, content.Mem_GiB, content.Storage_GiB, content.Id, content.Cost_per_hour)\n\tif err != nil {\n\t\tcommon.CBLog.Error(err)\n\t\treturn content, err\n\t}\n\n\t// \"INSERT INTO `spec`(`namespace`, `id`, ...) VALUES ('nsId', 'content.Id', ...);\n\t_, err = common.ORM.Insert(&content)\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t} else {\n\t\tfmt.Println(\"Data inserted successfully..\")\n\t}\n\n\treturn content, nil\n}", "title": "" }, { "docid": "c27b03981cc375898209b3cea8d425d8", "score": "0.43599677", "text": "func (*GetMessageRequestC2B) Descriptor() ([]byte, []int) {\n\treturn file_BrokerService_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "9b12f86e7122969ed9ba78f3d6369c15", "score": "0.4358584", "text": "func DecodeGRPCBuyRequest(_ context.Context, grpcReq interface{}) (interface{}, error) {\n\treq := grpcReq.(*pb.HelloRequest)\n\treturn req, nil\n}", "title": "" }, { "docid": "d705d34cad81a111ac44aa9cf2a171f3", "score": "0.43545496", "text": "func getBuffersRequest(c *xgb.Conn, Drawable xproto.Drawable, Count uint32, Attachments []uint32) []byte {\n\tsize := xgb.Pad((12 + xgb.Pad((len(Attachments) * 4))))\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"DRI2\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 5 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Drawable))\n\tb += 4\n\n\txgb.Put32(buf[b:], Count)\n\tb += 4\n\n\tfor i := 0; i < int(len(Attachments)); i++ {\n\t\txgb.Put32(buf[b:], Attachments[i])\n\t\tb += 4\n\t}\n\n\treturn buf\n}", "title": "" }, { "docid": "3183b7d7ef14b71971c995378b35e5a3", "score": "0.434101", "text": "func (orh *OutgoingRequestHooks) Register(hook graphsync.OnOutgoingRequestHook) graphsync.UnregisterHookFunc {\n\treturn graphsync.UnregisterHookFunc(orh.pubSub.Subscribe(hook))\n}", "title": "" }, { "docid": "e0cbabfdb1a6c9aeea78942943c2de24", "score": "0.43299177", "text": "func (c *Checker) Cb(cb Callback) {\n\tcb(c.response)\n}", "title": "" }, { "docid": "5977c83a152e16be2432e7963559ca80", "score": "0.43295485", "text": "func (cmd *ListAccountbbbCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n}", "title": "" }, { "docid": "d99ea7e524c3f16338d2b57c929b913c", "score": "0.43262514", "text": "func register(c *bm.Context) {\n\tc.JSON(map[string]struct{}{}, nil)\n}", "title": "" }, { "docid": "a810f1c8f2bc5afd055cf3fee61d902e", "score": "0.432583", "text": "func RegisterResourceBMServer(e *bm.Engine, server ResourceBMServer) {\n\tv1ResourceSvc = server\n\te.POST(\"/live.liveadmin.v1.Resource/add\", resourceAdd)\n\te.POST(\"/live.liveadmin.v1.Resource/addEx\", resourceAddEx)\n\te.POST(\"/live.liveadmin.v1.Resource/edit\", resourceEdit)\n\te.POST(\"/live.liveadmin.v1.Resource/offline\", resourceOffline)\n\te.GET(\"/live.liveadmin.v1.Resource/getList\", resourceGetList)\n\te.GET(\"/live.liveadmin.v1.Resource/getPlatformList\", resourceGetPlatformList)\n\te.GET(\"/live.liveadmin.v1.Resource/getListEx\", resourceGetListEx)\n}", "title": "" }, { "docid": "6baf9209cf65b2e078580774f0972ce4", "score": "0.43174067", "text": "func (o *RegisterUsingPUT2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {\n\n\tif err := r.SetTimeout(o.timeout); err != nil {\n\t\treturn err\n\t}\n\tvar res []error\n\n\t// path param namespaceSelfLinkId\n\tif err := r.SetPathParam(\"namespaceSelfLinkId\", o.NamespaceSelfLinkID); err != nil {\n\t\treturn err\n\t}\n\tif o.SvNamespace != nil {\n\t\tif err := r.SetBodyParam(o.SvNamespace); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif len(res) > 0 {\n\t\treturn errors.CompositeValidationError(res...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94b5c02f86c51522829ace1bacec2174", "score": "0.4311551", "text": "func createGCRequest(c *xgb.Conn, Cid Gcontext, Drawable Drawable, ValueMask uint32, ValueList []uint32) []byte {\n\tsize := xgb.Pad((12 + (4 + xgb.Pad((4 * xgb.PopCount(int(ValueMask)))))))\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tbuf[b] = 55 // request opcode\n\tb += 1\n\n\tb += 1 // padding\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Cid))\n\tb += 4\n\n\txgb.Put32(buf[b:], uint32(Drawable))\n\tb += 4\n\n\txgb.Put32(buf[b:], ValueMask)\n\tb += 4\n\tfor i := 0; i < xgb.PopCount(int(ValueMask)); i++ {\n\t\txgb.Put32(buf[b:], ValueList[i])\n\t\tb += 4\n\t}\n\tb = xgb.Pad(b)\n\n\treturn buf\n}", "title": "" }, { "docid": "9c058c4627149a7c854d5221e6ef5196", "score": "0.43067634", "text": "func RegisterCodec(cdc *codec.Codec) {\n\tcdc.RegisterConcrete(MsgCreate{}, \"paychan/MsgCreate\", nil)\n\tcdc.RegisterConcrete(MsgSubmitUpdate{}, \"paychan/MsgSubmitUpdate\", nil)\n}", "title": "" }, { "docid": "c2e05d584b7cb1e9165e05f90527c5a4", "score": "0.4302519", "text": "func (routes *BtcRoutes) RegisterBtcRoutes(r *mux.Router, p string) {\n\tur := r.PathPrefix(p).Subrouter()\n\n\t// swagger:route GET /btc-rpc/block BtcRpc getBlocksRpcReq\n\t// ---\n\t// Returns last 10 blocks.\n\t//\n\t// responses:\n\t// 200: blocksRpcResp\n\t// 404: notFound\n\t//\t 500: internal\n\tur.HandleFunc(\"/block\", routes.getBlocks).Methods(\"GET\")\n\n\t// swagger:route GET /btc-rpc/block/{BlockID} BtcRpc getBlockRpcReq\n\t// ---\n\t// Returns a block by id.\n\t// If the block id is null, Error Bad Request will be returned.\n\t// responses:\n\t// 200: blockRpcResp\n\t// 404: notFound\n\t//\t 500: internal\n\tur.HandleFunc(\"/block/{BlockID}\", routes.getBlock).Methods(\"GET\")\n\n\t// swagger:route GET /btc-rpc/tx/{TxHash} BtcRpc getTransactionRpcReq\n\t// ---\n\t// Returns a transaction by hash.\n\t// If the transaction hash is null, Error Bad Request will be returned.\n\t// responses:\n\t// 200: transactionRpcResp\n\t// 404: notFound\n\t//\t 500: internal\n\tur.HandleFunc(\"/tx/{TxHash}\", routes.getTransaction).Methods(\"GET\")\n}", "title": "" }, { "docid": "057de84657fd4fbdd2d8e0c6b1c99f7f", "score": "0.4292936", "text": "func RegisterWeChatBMServer(e *bm.Engine, server WeChatBMServer) {\n\tWeChatSvc = server\n\te.POST(\"/weChat/getOpenId\", weChatGetWeChatOpenID)\n\te.POST(\"/weChat/login\", weChatLogin)\n}", "title": "" }, { "docid": "9d6b94fde6fc56be04dc6aa7a5a6979e", "score": "0.42862526", "text": "func (c *Controller) Register(ctx *controllerpkg.Context) (workqueue.RateLimitingInterface, []cache.InformerSynced, error) {\n\tcomponentName := \"certificaterequests-issuer-\" + c.issuerType\n\n\t// construct a new named logger to be reused throughout the controller\n\tc.log = logf.FromContext(ctx.RootContext, componentName)\n\n\t// create a queue used to queue up items to be processed\n\tc.queue = workqueue.NewNamedRateLimitingQueue(controllerpkg.DefaultItemBasedRateLimiter(), componentName)\n\n\tsecretsInformer := ctx.KubeSharedInformerFactory.Secrets()\n\tissuerInformer := ctx.SharedInformerFactory.Certmanager().V1().Issuers()\n\tc.issuerLister = issuerInformer.Lister()\n\tc.secretLister = secretsInformer.Lister()\n\n\t// obtain references to all the informers used by this controller\n\tcertificateRequestInformer := ctx.SharedInformerFactory.Certmanager().V1().CertificateRequests()\n\n\t// build a list of InformerSynced functions that will be returned by the\n\t// Register method. The controller will only begin processing items once all\n\t// of these informers have synced.\n\n\tmustSync := []cache.InformerSynced{\n\t\tcertificateRequestInformer.Informer().HasSynced,\n\t\tissuerInformer.Informer().HasSynced,\n\t\tsecretsInformer.Informer().HasSynced,\n\t}\n\tfor _, reg := range c.registerExtraInformers {\n\t\tms, err := reg(ctx, c.log, c.queue)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"failed to register extra informer: %w\", err)\n\t\t}\n\t\tmustSync = append(mustSync, ms...)\n\t}\n\n\t// if scoped to a single namespace\n\t// if we are running in non-namespaced mode (i.e. --namespace=\"\"), we also\n\t// register event handlers and obtain a lister for clusterissuers.\n\tif ctx.Namespace == \"\" {\n\t\tclusterIssuerInformer := ctx.SharedInformerFactory.Certmanager().V1().ClusterIssuers()\n\t\tc.clusterIssuerLister = clusterIssuerInformer.Lister()\n\t\t// register handler function for clusterissuer resources\n\t\tclusterIssuerInformer.Informer().AddEventHandler(&controllerpkg.BlockingEventHandler{WorkFunc: c.handleGenericIssuer})\n\t\tmustSync = append(mustSync, clusterIssuerInformer.Informer().HasSynced)\n\t}\n\n\t// set all the references to the listers for used by the Sync function\n\tc.certificateRequestLister = certificateRequestInformer.Lister()\n\n\t// register handler functions\n\tcertificateRequestInformer.Informer().AddEventHandler(&controllerpkg.QueuingEventHandler{Queue: c.queue})\n\tissuerInformer.Informer().AddEventHandler(&controllerpkg.BlockingEventHandler{WorkFunc: c.handleGenericIssuer})\n\t// create an issuer helper for reading generic issuers\n\tc.helper = issuer.NewHelper(c.issuerLister, c.clusterIssuerLister)\n\n\t// clock is used to set the FailureTime of failed CertificateRequests\n\tc.clock = ctx.Clock\n\t// recorder records events about resources to the Kubernetes api\n\tc.recorder = ctx.Recorder\n\tc.reporter = util.NewReporter(c.clock, c.recorder)\n\tc.cmClient = ctx.CMClient\n\tc.fieldManager = ctx.FieldManager\n\n\t// Construct the issuer implementation with the built component context.\n\tc.issuer = c.issuerConstructor(ctx)\n\n\tc.log.V(logf.DebugLevel).Info(\"new certificate request controller registered\",\n\t\t\"type\", c.issuerType)\n\n\treturn c.queue, mustSync, nil\n}", "title": "" }, { "docid": "bdc3d79b657f1624c3d283acea94610c", "score": "0.42852497", "text": "func createContextRequest(c *xgb.Conn, Context Context, ElementHeader ElementHeader, NumClientSpecs uint32, NumRanges uint32, ClientSpecs []ClientSpec, Ranges []Range) []byte {\n\tsize := xgb.Pad((((20 + xgb.Pad((int(NumClientSpecs) * 4))) + 4) + xgb.Pad((int(NumRanges) * 24))))\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"RECORD\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 1 // request opcode\n\tb += 1\n\n\tblen := b\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Context))\n\tb += 4\n\n\tbuf[b] = byte(ElementHeader)\n\tb += 1\n\n\tb += 3 // padding\n\n\txgb.Put32(buf[b:], NumClientSpecs)\n\tb += 4\n\n\txgb.Put32(buf[b:], NumRanges)\n\tb += 4\n\n\tfor i := 0; i < int(NumClientSpecs); i++ {\n\t\txgb.Put32(buf[b:], uint32(ClientSpecs[i]))\n\t\tb += 4\n\t}\n\n\tb = (b + 3) & ^3 // alignment gap\n\n\tb += RangeListBytes(buf[b:], Ranges)\n\n\tb = xgb.Pad(b)\n\txgb.Put16(buf[blen:], uint16(b/4)) // write request size in 4-byte units\n\treturn buf[:b]\n}", "title": "" }, { "docid": "9f8a7bb197c79822a662e71aa8b270f3", "score": "0.42842427", "text": "func installColormapRequest(c *xgb.Conn, Cmap Colormap) []byte {\n\tsize := 8\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tbuf[b] = 81 // request opcode\n\tb += 1\n\n\tb += 1 // padding\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Cmap))\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "8b0576dd0ee532163634f433b626cbd3", "score": "0.42790583", "text": "func allocColorRequest(c *xgb.Conn, Cmap Colormap, Red uint16, Green uint16, Blue uint16) []byte {\n\tsize := 16\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tbuf[b] = 84 // request opcode\n\tb += 1\n\n\tb += 1 // padding\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Cmap))\n\tb += 4\n\n\txgb.Put16(buf[b:], Red)\n\tb += 2\n\n\txgb.Put16(buf[b:], Green)\n\tb += 2\n\n\txgb.Put16(buf[b:], Blue)\n\tb += 2\n\n\tb += 2 // padding\n\n\treturn buf\n}", "title": "" }, { "docid": "9191d66769d282ebe97376f6e2c86ce2", "score": "0.42732176", "text": "func (infra *Infra) NewH2CRequest(url string, transferBus ...bool) requests.Request {\n\treq := requests.NewH2CRequest(url)\n\tif len(transferBus) > 0 && !transferBus[0] {\n\t\treturn req\n\t}\n\tif infra.worker == nil {\n\t\t//The singleton object does not have a Worker component\n\t\treturn req\n\t}\n\treq.SetHeader(infra.worker.Bus().Header)\n\treturn req\n}", "title": "" }, { "docid": "684a783e89a0c1292b5b6652b959f953", "score": "0.42661083", "text": "func CreateRefundCdiBagRequest() (request *RefundCdiBagRequest) {\n\trequest = &RefundCdiBagRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"Green\", \"2017-08-23\", \"RefundCdiBag\", \"green\", \"openAPI\")\n\treturn\n}", "title": "" }, { "docid": "3b470f51920aeb21a907451b0807f1a5", "score": "0.42580414", "text": "func connectRequest(c *xgb.Conn, Window xproto.Window, DriverType uint32) []byte {\n\tsize := 12\n\tb := 0\n\tbuf := make([]byte, size)\n\n\tc.ExtLock.RLock()\n\tbuf[b] = c.Extensions[\"DRI2\"]\n\tc.ExtLock.RUnlock()\n\tb += 1\n\n\tbuf[b] = 1 // request opcode\n\tb += 1\n\n\txgb.Put16(buf[b:], uint16(size/4)) // write request size in 4-byte units\n\tb += 2\n\n\txgb.Put32(buf[b:], uint32(Window))\n\tb += 4\n\n\txgb.Put32(buf[b:], DriverType)\n\tb += 4\n\n\treturn buf\n}", "title": "" }, { "docid": "7ca78b61faede161b1e24c8423aa4902", "score": "0.42561826", "text": "func register(self Server) {\n\tregistered := false\n\n\tfor !registered {\n\t\t// Bluebook IP has to be hardcoded... think of it like a DNS server !\n\t\t// Request the IP address of the SLD server for this client\n\t\tresponseBlueBook, err := http.Get(\"http://192.168.1.3:8888/bluebook/\" +\n\t\t\tself.Name)\n\n\t\t// If there was a failure during registration, maybe the Blue Book server\n\t\t// doesn't exist (404) or is unresponsive (5xx), then don't let the MSA\n\t\t// client startup. log and loop again\n\t\tif err != nil {\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t} else if responseBlueBook.StatusCode > 299 {\n\t\t\tlog.Print(\"The bluebook service is unavailabe, or there was a\" +\n\t\t\t\t\" problem while sending the request : \" + responseBlueBook.Status)\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tbodyBlueBook, err := ioutil.ReadAll(responseBlueBook.Body)\n\n\t\tif err != nil {\n\t\t\t// again, if we couldn't read the response from the bluebook, no point\n\t\t\t// in starting up, so loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar MTAServ Server\n\t\terr = json.Unmarshal(bodyBlueBook, &MTAServ)\n\n\t\tif err != nil {\n\t\t\t// again, if we couldn't read the response from the bluebook, no point\n\t\t\t// in starting up, so loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tselfJSON, err := json.Marshal(self)\n\n\t\tif err != nil {\n\t\t\t// If we can't create json string to describe this client, loop again\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Print(\"Registering with:\", MTAServ.Address+\"email/server/register\")\n\n\t\trespMTA, err := http.Post(MTAServ.Address+\"email/server/register\", \"application/json\",\n\t\t\tbytes.NewReader(selfJSON))\n\n\t\t// If there was a failure during registration, maybe the MTA server\n\t\t// doesn't exist (404) or is unresponsive (5xx), then don't let the MSA\n\t\t// client startup. log and loop again\n\t\tif err != nil {\n\t\t\tlog.Print(err.Error())\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t} else if responseBlueBook.StatusCode > 299 {\n\t\t\tlog.Print(\"The bluebook service is unavailabe, or there was a\" +\n\t\t\t\t\" problem while sending the request : \" + respMTA.Status)\n\t\t\ttime.Sleep(2 * time.Second)\n\t\t\tcontinue\n\t\t}\n\n\t\t// Finally registered ! Log and break out of the loop\n\t\tregistered = true\n\n\t\tlog.Print(\"Registered!\")\n\t}\n}", "title": "" }, { "docid": "a6faec3ce37e83418e89b81dcdc65124", "score": "0.42557144", "text": "func RegisterRoomBMServer(e *bm.Engine, server RoomBMServer) {\n\tRoomSvc = server\n\te.GET(\"/live.xroom.v1.Room/getMultiple\", roomGetMultiple)\n\te.GET(\"/live.xroom.v1.Room/getMultipleByUids\", roomGetMultipleByUids)\n\te.GET(\"/live.xroom.v1.Room/isAnchor\", roomIsAnchor)\n}", "title": "" }, { "docid": "73b973922744acc2b2e61ce567d81580", "score": "0.42526263", "text": "func RegisterRequest(baseURL string, subject Subject, body *SchemaJSON) (*http.Request, error) {\n\treturn post(baseURL, path.Join(\"subjects\", string(subject), \"versions\"), body)\n}", "title": "" }, { "docid": "0f8b5cda652d1d276fe85a342179f8d7", "score": "0.42497265", "text": "func (w *worker) loopRegister() {\n\tfor {\n\t\tselect {\n\t\tcase <-w.shutdownCh:\n\t\t\treturn\n\n\t\tdefault:\n\t\t\t// Take a look at the code for job request loop for the other side of this\n\t\t\t// channel.\n\t\t\tw.capacityCh <- true\n\n\t\t\tif err := w.RPCParams.RetryWithDelay(w.registerWithMaster)(); err != nil {\n\t\t\t\t<-w.capacityCh\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e539f7f3261b77fa25539b345aa665ce", "score": "0.42488804", "text": "func (s *AuthServer) CreateSignupU2FRegisterRequest(tokenID string) (u2fRegisterRequest *u2f.RegisterRequest, e error) {\n\tcap, err := s.GetAuthPreference()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tuniversalSecondFactor, err := cap.GetU2F()\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\t_, err = s.GetResetPasswordToken(context.TODO(), tokenID)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\tc, err := u2f.NewChallenge(universalSecondFactor.AppID, universalSecondFactor.Facets)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\terr = s.UpsertU2FRegisterChallenge(tokenID, c)\n\tif err != nil {\n\t\treturn nil, trace.Wrap(err)\n\t}\n\n\trequest := c.RegisterRequest()\n\treturn request, nil\n}", "title": "" }, { "docid": "2b87931e796fa64b0ea1711cf9ae51c0", "score": "0.42451406", "text": "func (*ProviderRegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_auth_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "c4fab3e5e4062aa756847e32ae5501d0", "score": "0.42447442", "text": "func (*RegisterRequest) Descriptor() ([]byte, []int) {\n\treturn file_roveapi_roveapi_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "33d5db5b304fd81185b9a48248ce4149", "score": "0.42445463", "text": "func RequestBundle(code, base string, recursive bool) map[string]string {\n\treply := make(chan map[string]string)\n\tdefer close(reply)\n\n\tbundleRequests <- bundleRequest{\n\t\tcode: code,\n\t\tbundlePrefix: base,\n\t\trecursive: recursive,\n\t\treply: reply,\n\t}\n\n\treturn <-reply\n}", "title": "" }, { "docid": "6af5102a5095b47f9e3bf57cf0755833", "score": "0.42408141", "text": "func (rh *registerHandler) Register(w http.ResponseWriter, r *http.Request) {\n\treq := registerRequest{}\n\tdecoder := json.NewDecoder(r.Body)\n\terr := decoder.Decode(&req)\n\toptionalBadRequestPanic(err, \"Could not decode request body\")\n\n\t// Assert that the registration presented to us was successful\n\tif !req.Successful {\n\t\tfailedData := req.Data.(failedRegistrationData)\n\t\tpanic(bubbledError{\n\t\t\tStatusCode: failedData.ErrorCode,\n\t\t\tMessage: failedData.ErrorMessage,\n\t\t})\n\t}\n\n\tmappedValues := req.Data.(map[string]interface{})\n\tvar successData successfulRegistrationData\n\n\t// There were problems with deserialization. This is gross. Will fix later.\n\tif value, ok := mappedValues[\"clientData\"]; ok {\n\t\tsuccessData.ClientData = value.(string)\n\t}\n\tif value, ok := mappedValues[\"registrationData\"]; ok {\n\t\tsuccessData.RegistrationData = value.(string)\n\t}\n\tif value, ok := mappedValues[\"deviceName\"]; ok {\n\t\tsuccessData.DeviceName = value.(string)\n\t}\n\tif value, ok := mappedValues[\"type\"]; ok {\n\t\tsuccessData.Type = value.(string)\n\t}\n\tif value, ok := mappedValues[\"fcmToken\"]; ok {\n\t\tsuccessData.FCMToken = value.(string)\n\t}\n\n\t// Decode the client data\n\tdecoded, err := decodeBase64(successData.ClientData)\n\toptionalBadRequestPanic(err, \"Could not decode client data\")\n\n\tclientData := u2f.ClientData{}\n\treader := bytes.NewReader(decoded)\n\tdecoder = json.NewDecoder(reader)\n\terr = decoder.Decode(&clientData)\n\toptionalBadRequestPanic(err, \"Could not decode client data\")\n\n\t// Assert that the challenge exists\n\trequestID, found := rh.s.cache.challengeToRequestID.Get(clientData.Challenge)\n\tpanicIfFalse(found, http.StatusForbidden, \"Challenge does not exist\")\n\n\t// Get challenge data\n\trr, err := rh.s.cache.GetRegistrationRequest(requestID.(string))\n\toptionalInternalPanic(err, \"Failed to look up data for valid challenge\")\n\n\t// Verify signature\n\tresp := u2f.RegisterResponse{\n\t\tRegistrationData: successData.RegistrationData,\n\t\tClientData: successData.ClientData,\n\t}\n\treg, err := u2f.Register(resp, *rr.Challenge, &u2f.Config{\n\t\tSkipAttestationVerify: true,\n\t})\n\toptionalBadRequestPanic(err, \"Could not verify signature\")\n\n\t// Record valid public key in database\n\tmarshalledRegistration, err := reg.MarshalBinary()\n\n\ttx := rh.s.DB.Begin()\n\n\t// Save key\n\terr = rh.s.DB.Model(&Key{}).Create(&Key{\n\t\tID: EncodeBase64(reg.KeyHandle),\n\t\tType: successData.Type,\n\t\tName: successData.DeviceName,\n\t\tUserID: rr.UserID,\n\t\tAppID: rr.AppID,\n\t\tMarshalledRegistration: marshalledRegistration,\n\t\tCounter: 0,\n\t}).Error\n\tif err != nil {\n\t\ttx.Rollback()\n\t\toptionalInternalPanic(err, \"Could not save key to database\")\n\t}\n\n\t// Notify request listeners\n\terr = rh.q.MarkCompleted(requestID.(string))\n\tif err != nil {\n\t\ttx.Rollback()\n\t\toptionalInternalPanic(err, \"Could not notify request listeners\")\n\t}\n\n\ttx.Commit()\n\n\twriteJSON(w, http.StatusOK, registerResponse{\n\t\tSuccessful: true,\n\t\tMessage: \"OK\",\n\t})\n}", "title": "" }, { "docid": "f18624834421338dccac3e8719834c2f", "score": "0.42388305", "text": "func (s *ChannelService) RegisterP2p(p2p interfaces.P2p) {\n\ts.P2p = p2p\n}", "title": "" }, { "docid": "66a39262ad9802ed744bc59f38e0c059", "score": "0.42380512", "text": "func CreateRegisterUemDeviceRequest() (request *RegisterUemDeviceRequest) {\n\trequest = &RegisterUemDeviceRequest{\n\t\tRpcRequest: &requests.RpcRequest{},\n\t}\n\trequest.InitWithApiInfo(\"aliyuncvc\", \"2019-10-30\", \"RegisterUemDevice\", \"aliyuncvc\", \"openAPI\")\n\trequest.Method = requests.POST\n\treturn\n}", "title": "" }, { "docid": "f6c0cb7611c0ea388bda51eddc77290a", "score": "0.4236835", "text": "func RegisterCodec(cdc *codec.Codec) {\n\tcdc.RegisterConcrete(MsgSetAsset{}, \"assetservice/SetAsset\", nil)\n\tcdc.RegisterConcrete(MsgBuyAsset{}, \"assetservice/BuyAsset\", nil)\n}", "title": "" }, { "docid": "0b7dee9f3f9e53d0f169510a41da9d3e", "score": "0.4236424", "text": "func TestConcurrency2(t *testing.T) {\n\twg := sync.WaitGroup {}\n\twg.Add(2)\n\n\tgo func() {\n\t\tblubber2(t, \"A\")\n\t\twg.Done()\n\t}()\n\n\tgo func() {\n\t\tblubber2(t, \"B\")\n\t\twg.Done()\n\t}()\n\n\twg.Wait()\n}", "title": "" }, { "docid": "50a42e611eb808d6f11119c91e6da266", "score": "0.42362577", "text": "func (cmd *DeleteAccountbbbCommand) RegisterFlags(cc *cobra.Command, c *client.Client) {\n\tvar accountbbbID int\n\tcc.Flags().IntVar(&cmd.AccountbbbID, \"accountbbbID\", accountbbbID, `accountbbb ID`)\n}", "title": "" }, { "docid": "52b63800bafc51ab4f814d842eefac27", "score": "0.42342484", "text": "func ContribRequestHandlerFn(cdc *wire.Codec, kb keys.Keybase, cliCtx context.CLIContext) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// collect data\n\t\tvars := mux.Vars(r)\n\t\tbech32addr := vars[\"address\"]\n\t\tctbtype := vars[\"ctbtype\"]\n\n\t\tto, err := sdk.AccAddressFromBech32(bech32addr)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tvar m contribBody\n\t\tbody, err := ioutil.ReadAll(r.Body)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\t\terr = msgCdc.UnmarshalJSON(body, &m)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tinfo, err := kb.Get(m.LocalAccountName)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\t// to, err := sdk.AccAddressFromHex(address.String())\n\t\t// if err != nil {\n\t\t// \tw.WriteHeader(http.StatusBadRequest)\n\t\t// \tw.Write([]byte(err.Error()))\n\t\t// \treturn\n\t\t// }\n\n\t\tctbTime, err := time.Parse(time.RFC3339, m.Time)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tctbContent, err := hex.DecodeString(m.Content)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tkey, err := hex.DecodeString(m.Key)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tvar ctb contrib.Contrib\n\t\tswitch ctbtype {\n\t\tcase \"invite\":\n\t\t\tctb = contrib.Invite{contrib.BaseContrib2{contrib.BaseContrib{key, sdk.AccAddress(info.GetPubKey().Address()), ctbTime}, to}, ctbContent}\n\t\tcase \"recommend\":\n\t\t\tctb = contrib.Recommend{contrib.BaseContrib2{contrib.BaseContrib{key, sdk.AccAddress(info.GetPubKey().Address()), ctbTime}, to}, ctbContent}\n\t\tcase \"post\":\n\t\t\tctb = contrib.Post{contrib.BaseContrib2{contrib.BaseContrib{key, sdk.AccAddress(info.GetPubKey().Address()), ctbTime}, to}, ctbContent}\n\t\tcase \"vote\":\n\t\t\tswitch m.VoteType {\n\t\t\tcase \"upvote\":\n\t\t\t\tctb = contrib.Vote{contrib.BaseContrib3{contrib.BaseContrib{key, sdk.AccAddress(info.GetPubKey().Address()), ctbTime}, to, 1}, ctbContent}\n\t\t\tcase \"downvote\":\n\t\t\t\tctb = contrib.Vote{contrib.BaseContrib3{contrib.BaseContrib{key, sdk.AccAddress(info.GetPubKey().Address()), ctbTime}, to, -1}, ctbContent}\n\t\t\tdefault:\n\t\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\t\tw.Write([]byte(err.Error()))\n\t\t\t\treturn\n\t\t\t}\n\t\tdefault:\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\t// build message\n\t\tmsg := client.BuildContribMsg(ctb)\n\t\tif err != nil { // XXX rechecking same error ?\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\ttxCtx := authctx.TxContext{\n\t\t\tCodec: cdc,\n\t\t\tChainID: m.ChainID,\n\t\t\tAccountNumber: m.AccountNumber,\n\t\t\tSequence: m.Sequence,\n\t\t\tGas: m.Gas,\n\t\t}\n\n\t\ttxBytes, err := txCtx.BuildAndSign(m.LocalAccountName, m.Password, []sdk.Msg{msg})\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\t// send\n\t\tres, err := cliCtx.BroadcastTx(txBytes)\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\toutput, err := json.MarshalIndent(res, \"\", \" \")\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\t\tw.Write([]byte(err.Error()))\n\t\t\treturn\n\t\t}\n\n\t\tw.Write(output)\n\t}\n}", "title": "" }, { "docid": "02212689053af49bee2b32321cd70caa", "score": "0.4233153", "text": "func RegisterGroupBMServer(e *bm.Engine, server GroupBMServer, midMap map[string]bm.HandlerFunc) {\n\tauth := midMap[\"auth\"]\n\tGroupSvc = server\n\te.POST(\"/group/create\", auth, groupCreateGroup)\n\te.GET(\"/group/info\", groupGetGroupInfo)\n\te.GET(\"/group/all\", groupGetAllGroups)\n\te.GET(\"/group/all/user\", auth, groupGetAllGroupsByUid)\n\te.POST(\"/group/addMember\", auth, groupAddMember)\n}", "title": "" } ]
fba8b908a1d7725381d61df511a19380
/ PostPamAssets creates a new p a m asset This endpoint allows you to create a new PAM asset.
[ { "docid": "2ca0224149fec571f2429a035e755395", "score": "0.83679336", "text": "func (a *Client) PostPamAssets(params *PostPamAssetsParams) (*PostPamAssetsCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostPamAssetsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"post_pam_assets\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/rest/v1/assets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PostPamAssetsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostPamAssetsCreated)\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 post_pam_assets: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" } ]
[ { "docid": "eb74de01f5f7ee0d3fefacc44d1a2a26", "score": "0.6330187", "text": "func (a *Client) PatchPamAssets(params *PatchPamAssetsParams) (*PatchPamAssetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchPamAssetsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"patch_pam_assets\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/api/rest/v1/assets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PatchPamAssetsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PatchPamAssetsOK)\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 patch_pam_assets: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "c5481a1e3820d794bbf670b339e61520", "score": "0.6128125", "text": "func (a *Client) PostAssets(params *PostAssetsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAssetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAssetsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"postAssets\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/1.0/assets/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PostAssetsReader{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.(*PostAssetsOK)\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 postAssets: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "7d11e6aad85909494385372c0a345201", "score": "0.55873394", "text": "func (a *Client) GetPamAssets(params *GetPamAssetsParams) (*GetPamAssetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPamAssetsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_pam_assets\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/rest/v1/assets\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetPamAssetsReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetPamAssetsOK)\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 get_pam_assets: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "2e0700d8cf4622f123f94c5754bc9887", "score": "0.5518126", "text": "func (a *WalletApiService) WalletIssueAssetPost(ctx context.Context, issueAssetRequest IssueAssetRequest) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/wallet/issue_asset\"\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{}\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 = &issueAssetRequest\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-auth-token\"] = key\n\t\t}\n\t}\n\n\tr, err := a.client.prepareRequest(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 := 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 := 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, nil\n}", "title": "" }, { "docid": "5206e55866efe4c6c64aa4de958c200e", "score": "0.51707", "text": "func (a *WalletApiService) WalletTransferAssetPost(ctx context.Context, transferAssetRequest TransferAssetRequest) (*http.Response, error) {\n\tvar (\n\t\tlocalVarHttpMethod = strings.ToUpper(\"Post\")\n\t\tlocalVarPostBody interface{}\n\t\tlocalVarFormFileName string\n\t\tlocalVarFileName string\n\t\tlocalVarFileBytes []byte\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/wallet/transfer_asset\"\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{}\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 = &transferAssetRequest\n\tif ctx != nil {\n\t\t// API Key Authentication\n\t\tif auth, ok := ctx.Value(ContextAPIKey).(APIKey); ok {\n\t\t\tvar key string\n\t\t\tif auth.Prefix != \"\" {\n\t\t\t\tkey = auth.Prefix + \" \" + auth.Key\n\t\t\t} else {\n\t\t\t\tkey = auth.Key\n\t\t\t}\n\t\t\tlocalVarHeaderParams[\"x-auth-token\"] = key\n\t\t}\n\t}\n\n\tr, err := a.client.prepareRequest(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 := 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 := 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, nil\n}", "title": "" }, { "docid": "5cd0d18bde180c9cf19165caf0b638cb", "score": "0.51153713", "text": "func (client *RestClient) CreateAsset(asset *corev2.Asset) error {\n\tbytes, err := json.Marshal(types.WrapResource(asset))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tpath := AssetsPath(asset.Namespace)\n\tres, err := client.R().SetBody(bytes).Post(path)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif res.StatusCode() >= 400 {\n\t\treturn UnmarshalError(res)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ec38f4afbd935f9f476ebb4df907f6c7", "score": "0.50945103", "text": "func (a *Client) CreateApm(params *CreateApmParams, authInfo runtime.ClientAuthInfoWriter) (*CreateApmOK, *CreateApmCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewCreateApmParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"create-apm\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/clusters/apm\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &CreateApmReader{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, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *CreateApmOK:\n\t\treturn value, nil, nil\n\tcase *CreateApmCreated:\n\t\treturn nil, value, nil\n\t}\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 clusters_apm: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "b430544c810c6e8314c32b9ba3084311", "score": "0.50569594", "text": "func createAsset(asset Asset) (int, error) {\n\tresp, err := post(\"asset\", asset)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\tvar result Asset\n\tif err = json.Unmarshal(resp, &result); err != nil {\n\t\treturn 0, err\n\t}\n\treturn result.ID, nil\n}", "title": "" }, { "docid": "6a6a8083d1603463b649b5d4740523fc", "score": "0.49940053", "text": "func (a *Client) PatchPamAssetsCode(params *PatchPamAssetsCodeParams) (*PatchPamAssetsCodeCreated, *PatchPamAssetsCodeNoContent, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPatchPamAssetsCodeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"patch_pam_assets__code_\",\n\t\tMethod: \"PATCH\",\n\t\tPathPattern: \"/api/rest/v1/assets/{code}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PatchPamAssetsCodeReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tswitch value := result.(type) {\n\tcase *PatchPamAssetsCodeCreated:\n\t\treturn value, nil, nil\n\tcase *PatchPamAssetsCodeNoContent:\n\t\treturn nil, value, nil\n\t}\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 p_a_m_asset: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "32c0da77a4cfc75a09f51c09d7d99336", "score": "0.48070294", "text": "func (m *Metrc) PostHarvestsCreatePackages(packages []HarvestPackagePost, licenseNumber string) ([]byte, error) {\n\tendpoint := \"harvests/v1/create/packages\"\n\tendpoint += fmt.Sprintf(\"?licenseNumber=%s\", licenseNumber)\n\n\tbody, err := json.Marshal(packages)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"could not marshal harvest packages: %s\", err)\n\t}\n\n\tresp, err := m.Client.Post(endpoint, body)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"failed posting packages: %s\", err)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "0568005f48931bde58b67b9ef98d6f3b", "score": "0.47351608", "text": "func (a *Client) PostAssetManagedDevices(params *PostAssetManagedDevicesParams) (*PostAssetManagedDevicesCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAssetManagedDevicesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAssetManagedDevices\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/asset/ManagedDevices\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAssetManagedDevicesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostAssetManagedDevicesCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PostAssetManagedDevicesDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "e2220af50240658a2e9c9fc144fefcf0", "score": "0.46759072", "text": "func (o *Format) AddAssetsP(exec boil.Executor, insert bool, related ...*Asset) {\n\tif err := o.AddAssets(exec, insert, related...); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "ebf53d8bce7e8f5c4d7ed3925ee32d09", "score": "0.4586139", "text": "func (a *Client) GetPamAssetsCode(params *GetPamAssetsCodeParams) (*GetPamAssetsCodeOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewGetPamAssetsCodeParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"get_pam_assets__code_\",\n\t\tMethod: \"GET\",\n\t\tPathPattern: \"/api/rest/v1/assets/{code}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &GetPamAssetsCodeReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*GetPamAssetsCodeOK)\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 get_pam_assets__code_: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "303ce6d27eefb0faa2fdb07a345c98f8", "score": "0.45662493", "text": "func (a *Client) PutAssets(params *PutAssetsParams, authInfo runtime.ClientAuthInfoWriter) (*PutAssetsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPutAssetsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"putAssets\",\n\t\tMethod: \"PUT\",\n\t\tPathPattern: \"/api/1.0/assets/\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"application/x-www-form-urlencoded\"},\n\t\tSchemes: []string{\"http\", \"https\"},\n\t\tParams: params,\n\t\tReader: &PutAssetsReader{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.(*PutAssetsOK)\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 putAssets: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "d16047b429052c1cb8b88da09dd0779a", "score": "0.45661253", "text": "func postAlbums(c *gin.Context) {\n\tvar newAlbum album\n\n\tif err := c.BindJSON(&newAlbum); err != nil {\n\t\treturn\n\t}\n\n\talbums = append(albums, newAlbum)\n\tc.IndentedJSON(http.StatusCreated, newAlbum)\n}", "title": "" }, { "docid": "ed145968aad1057365a6f93245d76d22", "score": "0.45606336", "text": "func (s *Service) CreateAsset(Asset *nmodel.Asset) (*nmodel.Asset, error) {\n\t//Send data to repository\n\tresult, err := s.Repository.CreateAsset(Asset)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn result, nil\n}", "title": "" }, { "docid": "0c1c9295c5aa29fcad5505d5e2e49f6b", "score": "0.45258674", "text": "func (a *API) PostBundle(w http.ResponseWriter, r *http.Request) {\n\terr := r.ParseMultipartForm(maxFileSize)\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusBadRequest, err.Error(), w)\n\t\treturn\n\t}\n\n\tbundleName, ok := getBundleName(r.Form)\n\n\tif !ok {\n\t\thttputil.WriteErrorResponse(http.StatusBadRequest, \"You must specifiy the bundleName parameter\", w)\n\t\treturn\n\t}\n\n\tfile, _, err := r.FormFile(\"bundleData\")\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusInternalServerError, fmt.Sprintf(\"Unable to upload file. Make sure bundleData is present in the form with file data. Err is %s\", err), w)\n\t\treturn\n\t}\n\n\tdefer file.Close()\n\n\tprincipal, err := oauth2.GetPrincipalFromRequest(r)\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusInternalServerError, \"Unable to validate user\", w)\n\t\treturn\n\t}\n\n\tsubject, err := principal.GetSubject()\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusInternalServerError, \"Unable to validate user\", w)\n\t\treturn\n\t}\n\n\tbundleMeta := &storage.BundleMeta{\n\t\tBundleID: bundleName,\n\t\tOwnerUserID: subject,\n\t}\n\n\tsha, err := a.storage.SaveBundle(file, bundleMeta)\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusInternalServerError, fmt.Sprintf(\"Unable to upload bundle %s\", err), w)\n\t\treturn\n\t}\n\n\t//TODO, not sure this is the best way to render the URL. Review the http package in more detail and figure out something better before launch\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.WriteHeader(http.StatusCreated)\n\n\tresponse := &BundleCreatedResponse{\n\t\tRevision: sha,\n\t\tSelf: createRevisionURL(r, bundleName, sha),\n\t}\n\n\terr = json.NewEncoder(w).Encode(response)\n\n\tif err != nil {\n\t\thttputil.WriteErrorResponse(http.StatusInternalServerError, fmt.Sprintf(\"Unable to serialize response %s\", err), w)\n\t}\n}", "title": "" }, { "docid": "b582c26e935938a8a3b992dd6b6f795c", "score": "0.45058006", "text": "func (a *Client) PostApplianceDataExportPoliciesMoid(params *PostApplianceDataExportPoliciesMoidParams) (*PostApplianceDataExportPoliciesMoidCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostApplianceDataExportPoliciesMoidParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostApplianceDataExportPoliciesMoid\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/appliance/DataExportPolicies/{moid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostApplianceDataExportPoliciesMoidReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostApplianceDataExportPoliciesMoidCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PostApplianceDataExportPoliciesMoidDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "cfce78c146d0fce6df9ec1bc0a2fbcf2", "score": "0.44482914", "text": "func (c *Client) CreateIpam(ctx context.Context, params *CreateIpamInput, optFns ...func(*Options)) (*CreateIpamOutput, error) {\n\tif params == nil {\n\t\tparams = &CreateIpamInput{}\n\t}\n\n\tresult, metadata, err := c.invokeOperation(ctx, \"CreateIpam\", params, optFns, c.addOperationCreateIpamMiddlewares)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tout := result.(*CreateIpamOutput)\n\tout.ResultMetadata = metadata\n\treturn out, nil\n}", "title": "" }, { "docid": "f5d901df06c5ff3aed6fafec8a515631", "score": "0.43409872", "text": "func (m *Metrc) PostHarvestsCreatePackagesTesting(packages []HarvestPackagePost, licenseNumber string) ([]byte, error) {\n\tendpoint := \"harvests/v1/create/packages/testing\"\n\tendpoint += fmt.Sprintf(\"?licenseNumber=%s\", licenseNumber)\n\n\tbody, err := json.Marshal(packages)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"could not marshal harvest testing packages: %s\", err)\n\t}\n\n\tresp, err := m.Client.Post(endpoint, body)\n\tif err != nil {\n\t\treturn []byte{}, fmt.Errorf(\"failed posting testing packages: %s\", err)\n\t}\n\n\treturn resp, nil\n}", "title": "" }, { "docid": "f486c66e91b3c41d6af306848ba2b3fd", "score": "0.43247017", "text": "func (a Flows) AddFlow(processId string, flowCreateItem FlowCreateItem) (*FlowItem, *APIResponse, error) {\n\n\tvar httpMethod = \"Post\"\n\t// create path and map variables\n\tpath := a.Configuration.BasePath + \"/processes/{process_id}/flows\"\n\tpath = strings.Replace(path, \"{\"+\"process_id\"+\"}\", fmt.Sprintf(\"%v\", processId), -1)\n\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(PasswordGrant)' required\n\t// oauth required\n\tif a.Configuration.AccessToken != \"\"{\n\t\theaderParams[\"Authorization\"] = \"Bearer \" + a.Configuration.AccessToken\n\t}\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\theaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ \"application/vnd.api+json\", }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/vnd.api+json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &flowCreateItem\n\n\tvar successPayload = new(FlowItem)\n\thttpResponse, err := a.Configuration.APIClient.CallAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tif err != nil {\n\t\treturn successPayload, NewAPIResponse(httpResponse.RawResponse), err\n\t}\n\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\treturn successPayload, NewAPIResponse(httpResponse.RawResponse), err\n}", "title": "" }, { "docid": "b147b52aedca406f76a7c6e847f7be9f", "score": "0.43012068", "text": "func (o *VerificationOfAssetResponse) SetASSETS(v Assets) {\n\to.ASSETS = v\n}", "title": "" }, { "docid": "f7ba1a32d455a8851e157121187ccb02", "score": "0.42914563", "text": "func CreateNFTAsset(data utils.Payload, uri utils.URI) {\n\tnftAsset := NFTPayload{\n\t\tJsonrpc: data.Jsonrpc,\n\t\tID: data.ID,\n\t\tMethod: data.Method,\n\t\tParams: nftParams{\n\t\t\tName: data.Params.Name,\n\t\t\tSymbol: data.Params.Symbol,\n\t\t\tMintersets: data.Params.Mintersets,\n\t\t\tUsername: data.Params.Username,\n\t\t\tPassword: data.Params.Password,\n\t\t},\n\t}\n\n\tpayloadBytes, err := json.Marshal(nftAsset)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tutils.SendRequest(uri, payloadBytes)\n}", "title": "" }, { "docid": "40b42995640fec4482ad91389c9b292d", "score": "0.4280309", "text": "func AddAsset(groupName, name, value string) {\n\tfileGroup := mainAssetDirectory.GetGroup(groupName)\n\tif fileGroup == nil {\n\t\tfileGroup, err = mainAssetDirectory.NewFileGroup(groupName)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\tfileGroup.AddAsset(name, value)\n}", "title": "" }, { "docid": "5a178701400a874bfeb0260298c2ff9f", "score": "0.42525643", "text": "func (a *Client) PostAssetManagedDevicesMoid(params *PostAssetManagedDevicesMoidParams) (*PostAssetManagedDevicesMoidCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAssetManagedDevicesMoidParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAssetManagedDevicesMoid\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/asset/ManagedDevices/{moid}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostAssetManagedDevicesMoidReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostAssetManagedDevicesMoidCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PostAssetManagedDevicesMoidDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "a9b502a89f4877e6054c04d80cf0b265", "score": "0.42387816", "text": "func (c *Client) CreateAsset(ctx context.Context, req *dataplexpb.CreateAssetRequest, opts ...gax.CallOption) (*CreateAssetOperation, error) {\n\treturn c.internalClient.CreateAsset(ctx, req, opts...)\n}", "title": "" }, { "docid": "f9a85693fb27ae2c3835166beca526ed", "score": "0.42376122", "text": "func NewPostAssetManagedDevicesMoidCreated() *PostAssetManagedDevicesMoidCreated {\n\treturn &PostAssetManagedDevicesMoidCreated{}\n}", "title": "" }, { "docid": "ebfa1df8de3864add3e5c77a52003107", "score": "0.42341182", "text": "func (req *MarkdownRequest) Assets(fpaths ...string) error {\n\tfor _, fpath := range fpaths {\n\t\tif !fileExists(fpath) {\n\t\t\treturn fmt.Errorf(\"%s: file does not exist\", fpath)\n\t\t}\n\t}\n\treq.assetFilePaths = fpaths\n\treturn nil\n}", "title": "" }, { "docid": "d01e3d9a155d638413b612273e17c21e", "score": "0.4221543", "text": "func (service *AssetsService) Publish(spaceID string, asset *Asset) error {\n\tpath := fmt.Sprintf(\"/spaces/%s/assets/%s/published\", spaceID, asset.Sys.ID)\n\tmethod := \"PUT\"\n\n\treq, err := service.c.newRequest(method, path, nil, nil)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tversion := strconv.Itoa(asset.Sys.Version)\n\treq.Header.Set(\"X-Contentful-Version\", version)\n\n\treturn service.c.do(req, asset)\n}", "title": "" }, { "docid": "10f6f7e10e91066f3a9dff99224ee431", "score": "0.4220655", "text": "func (service *AssetsService) Upsert(spaceID string, asset *Asset) error {\n\tbytesArray, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar path string\n\tvar method string\n\n\tif asset.Sys.CreatedAt != \"\" {\n\t\tpath = fmt.Sprintf(\"/spaces/%s/assets/%s\", spaceID, asset.Sys.ID)\n\t\tmethod = \"PUT\"\n\t} else {\n\t\tpath = fmt.Sprintf(\"/spaces/%s/assets\", spaceID)\n\t\tmethod = \"POST\"\n\t}\n\n\treq, err := service.c.newRequest(method, path, nil, bytes.NewReader(bytesArray))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq.Header.Set(\"X-Contentful-Version\", strconv.Itoa(asset.GetVersion()))\n\n\treturn service.c.do(req, asset)\n}", "title": "" }, { "docid": "a4c2266e6b6c02c8d168572398427760", "score": "0.42172548", "text": "func (a *ASA) Post(endpoint string, asaReq interface{}) (bodyText []byte, err error) {\n\tr := requestParameters{\n\t\tASARequest: asaReq,\n\t}\n\treturn a.request(endpoint, apiPOST, &r)\n}", "title": "" }, { "docid": "a3b8ff360c0cbbd79514151a7bcbbb61", "score": "0.42069507", "text": "func NewPostIPAMMacsForbidden() *PostIPAMMacsForbidden {\n\treturn &PostIPAMMacsForbidden{}\n}", "title": "" }, { "docid": "8408c866974ded38b82a008e514be972", "score": "0.4205977", "text": "func (driver *DBClient) PostPackage(w http.ResponseWriter, r *http.Request) {\n\tvar Package = Package{}\n\tpostBody, _ := ioutil.ReadAll(r.Body)\n\tPackage.Data = string(postBody)\n\tdriver.db.Save(&Package)\n\tresponseMap := map[string]interface{}{\"id\": Package.ID}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tresponse, _ := json.Marshal(responseMap)\n\tw.Write(response)\n}", "title": "" }, { "docid": "712293781475b9a890bea3fffb04075a", "score": "0.42023602", "text": "func NewPostIPAMMacsUnauthorized() *PostIPAMMacsUnauthorized {\n\treturn &PostIPAMMacsUnauthorized{}\n}", "title": "" }, { "docid": "19f4033fdec25247901eea5450900e7f", "score": "0.42002177", "text": "func CreatePost(travelcapsule, title, message, imgloc string, hashtags []string, username, location string, session *r.Session) string {\n\tcapsule := travelcapsule\n\t// Location parsing\n\tpoint, place := parseLocation(location)\n\tfmt.Println(place)\n\t\n\tif travelcapsule != \"\" {\n\t\tvar body ct.Body\n\t\tbody = ct.Body{\n\t\t\tMessage: message,\n\t\t}\n\t\t\n\t\tpost := ct.Post{\n\t\t\tTitle: title,\n\t\t\tCreatedOn: time.Now(),\n\t\t\tCreatedBy: username,\n\t\t\tPostBody: body,\n\t\t\tHashtags: hashtags,\n\t\t\tLikes: 0,\n\t\t\tLocation: point,\n\t\t\tPlace: place, \n\t\t}\n\t\tcreator := CheckTravelCapsuleExists(travelcapsule, session)\n\t\tfmt.Println(\"Creator: \" + creator + \" User: \" + username)\n\t\tif creator == username {\n\t\t\tgo addImageToPost(imgloc, travelcapsule, username, post, session)\n\t\t\tfmt.Println(\"Added image\")\n\t\t\treturn capsule\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "c9d1470290ad048b9a414f006261b606", "score": "0.41961166", "text": "func (driver *DBClient) PostPackage(w http.ResponseWriter, r *http.Request) {\n\tvar Package = helper.Package{}\n\tpostBody, _ := ioutil.ReadAll(r.Body)\n\tPackage.Data = string(postBody)\n\tdriver.db.Save(&Package)\n\tresponseMap := map[string]interface{}{\"id\": Package.ID}\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tresponse, _ := json.Marshal(responseMap)\n\tw.Write(response)\n}", "title": "" }, { "docid": "24c317de751892e06d29eb3f2e508760", "score": "0.41826317", "text": "func (a *Client) PostApplianceDataExportPolicies(params *PostApplianceDataExportPoliciesParams) (*PostApplianceDataExportPoliciesCreated, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostApplianceDataExportPoliciesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostApplianceDataExportPolicies\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/appliance/DataExportPolicies\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"https\"},\n\t\tParams: params,\n\t\tReader: &PostApplianceDataExportPoliciesReader{formats: a.formats},\n\t\tContext: params.Context,\n\t\tClient: params.HTTPClient,\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsuccess, ok := result.(*PostApplianceDataExportPoliciesCreated)\n\tif ok {\n\t\treturn success, nil\n\t}\n\t// unexpected success response\n\tunexpectedSuccess := result.(*PostApplianceDataExportPoliciesDefault)\n\treturn nil, runtime.NewAPIError(\"unexpected success response: content available as default response in error\", unexpectedSuccess, unexpectedSuccess.Code())\n}", "title": "" }, { "docid": "d96bb2e2de58d2d1bdef0334a0134ab3", "score": "0.4174394", "text": "func (tp *TemplateProcessor) Assets(\n\tpath string,\n\texcluded []string,\n\trecursive bool,\n) (payloads [][]byte, err error) {\n\tnames, err := tp.AssetNamesInPath(path, excluded, recursive)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, name := range names {\n\t\tb, err := tp.reader.Asset(name)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tpayloads = append(payloads, b)\n\t}\n\treturn payloads, nil\n}", "title": "" }, { "docid": "de007e324793c7cedf5aa3f2a2fe0f38", "score": "0.41699973", "text": "func (pipeline *Pipeline) AddAsset(asset *Asset) {\n\tif asset == nil {\n\t\treturn\n\t}\n\tasset.Pipeline = pipeline\n\tpipeline.Assets = append(pipeline.Assets, asset)\n}", "title": "" }, { "docid": "b9daeb8ae10a4971c671aefa8a0c5e4c", "score": "0.4167295", "text": "func ActivityCreate(w http.ResponseWriter, r *http.Request) {\n\tvar activity domain.Activity\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, &activity); err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\t\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\t\tw.WriteHeader(422) // unprocessable entity\n\t\tif err := json.NewEncoder(w).Encode(err); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\tfmt.Println(string(body));\n\ta := business.CreateActivity(activity)\n\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n\tw.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n\tw.WriteHeader(http.StatusCreated)\n\tif err := json.NewEncoder(w).Encode(a); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "19f5b8e0b48f2b092a1fb16be57f6c96", "score": "0.4135319", "text": "func (a ProductsApi) ProjectsProjectIdMembersPost(projectId int64, roles RoleParam) (*APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Post\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/projects/{project_id}/members/\"\n\tlocalVarPath = strings.Replace(localVarPath, \"{\"+\"project_id\"+\"}\", fmt.Sprintf(\"%v\", projectId), -1)\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\"text/plain\", \"application/json\"}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"application/json\",\n\t\t\"text/plain\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &roles\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"ProjectsProjectIdMembersPost\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn localVarAPIResponse, err\n\t}\n\treturn localVarAPIResponse, err\n}", "title": "" }, { "docid": "8fdd10c1ac7aa1baaf0063ee332ce8c9", "score": "0.41158414", "text": "func (cc *Chaincode) createAsset(stub shim.ChaincodeStubInterface, params []string) sc.Response {\n\t// Check if sufficient Params passed\n\tif len(params) != 3 {\n\t\treturn shim.Error(\"Incorrect number of arguments. Expecting 2\")\n\t}\n\n\t// Check if Params are non-empty\n\tif len(params[0]) <= 0 {\n\t\treturn shim.Error(\"1st argument must be a non-empty string\")\n\t}\n\tif len(params[1]) <= 0 {\n\t\treturn shim.Error(\"2nd argument must be a non-empty string\")\n\t}\n\tif len(params[2]) <= 0 {\n\t\treturn shim.Error(\"3rd argument must be a non-empty string\")\n\t}\n\n\t// Check if Asset exists with Key => params[0]\n\tassetAsBytes, err := stub.GetState(params[0])\n\tif err != nil {\n\t\treturn shim.Error(\"Failed to check if Asset exists!\")\n\t} else if assetAsBytes != nil {\n\t\treturn shim.Error(\"Asset Already Exists!\")\n\t}\n\n\t// Generate Asset from params provided\n\tasset := &asset{params[0], params[1], params[2]}\n\tassetJSONasBytes, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Put State of newly generated Asset with Key => params[0]\n\terr = stub.PutState(params[0], assetJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\t// Returned on successful execution of the function\n\treturn shim.Success(nil)\n}", "title": "" }, { "docid": "ed46687e6bd98d03bff7d15371056669", "score": "0.41103774", "text": "func (req *MarkdownRequest) Assets(assets ...Document) {\n\treq.assets = assets\n}", "title": "" }, { "docid": "80f5adc0d875ee6c2be5fe42eae19e97", "score": "0.41063634", "text": "func NewPostAssumedStrainSimulationParams() *PostAssumedStrainSimulationParams {\n\tvar ()\n\treturn &PostAssumedStrainSimulationParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "c1e5e2c017b1660e1e11565e7183e483", "score": "0.4090098", "text": "func PostStageEndpoint(w http.ResponseWriter, r *http.Request) {\n\tctx := appengine.NewContext(r)\n\tstage, err := models.NewStage(ctx, r.Body)\n\tif err != nil {\n\t\thttp.Error(w, err.Error(), http.StatusInternalServerError)\n\t\treturn\n\t}\n\tjson.NewEncoder(w).Encode(stage)\n}", "title": "" }, { "docid": "83ad4663a1c500545a68e64b1ae86329", "score": "0.40749773", "text": "func (r *GitLabRelease) addAssets(assets []ent.Attachment) *GitLabRelease {\n\tr.assets = append(r.assets, assets...)\n\n\treturn r\n}", "title": "" }, { "docid": "379ced0aa1b0b535c2832394fc995e6a", "score": "0.4062464", "text": "func (a *Client) PostAPIAgents(params *PostAPIAgentsParams, authInfo runtime.ClientAuthInfoWriter) (*PostAPIAgentsOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPostAPIAgentsParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"PostAPIAgents\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/api/Agents\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\", \"text/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PostAPIAgentsReader{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.(*PostAPIAgentsOK)\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 PostAPIAgents: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "e982e13d09f25681452fae82f8c5fc65", "score": "0.4054144", "text": "func NewPostIPAMDNSRecordsParams() *PostIPAMDNSRecordsParams {\n\tvar ()\n\treturn &PostIPAMDNSRecordsParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "5bc0ff549af766c06b6023380ba8356c", "score": "0.40503678", "text": "func PostVideo(w http.ResponseWriter, r *http.Request) {\n\tconfig := config.Get()\n\n\tasset := models.NewAsset()\n\tasset.Save()\n\n\tfilename, err := util.FileUpload(r, path.Join(\n\t\tconfig.HomeDir,\n\t\t\"Desktop\",\n\t\t\"SYNC\",\n\t\tfmt.Sprintf(\"%05d\", asset.ID)))\n\n\tif err != nil {\n\t\tspew.Dump(err)\n\t}\n\n\tasset.Filename = filename\n\tasset.Save()\n\n\tw.Write([]byte(\"Success!\\n\"))\n}", "title": "" }, { "docid": "f484019a2293e4319ba75c67d07f5b17", "score": "0.40406144", "text": "func (b *backendImpl) ManagerCreateVodAppeals(ctx context.Context, request *models.ManagerCreateVodAppealsRequest) (*models.ManagerCreateVodAppealsResponse, error) {\n\tb.Stat(managerCreateVodAppealsAttemptStatStr)\n\n\tresp, err := b.vinyl.CreateAppeals(ctx, converters.ConvertInternalToVinylCreateAppeals(request), &twitchclient.ReqOpts{\n\t\tAuthorizationToken: shared.AuthorizationTokenFromContext(ctx),\n\t\tClientID: shared.ClientIDFromContext(ctx),\n\t})\n\n\tif err != nil {\n\t\treturn nil, b.ErrorHandle(ctx, err)\n\t}\n\n\ttrackAppeals := make([]models.TrackAppealsResponse, len(resp.TrackAppeals))\n\tfor i, ta := range resp.TrackAppeals {\n\t\ttrackAppeals[i] = models.TrackAppealsResponse{\n\t\t\tID: strconv.FormatInt(ta.TrackAppealID, 10),\n\t\t\tCreatedAt: ta.CreatedAt,\n\t\t\tUpdatedAt: ta.UpdatedAt,\n\t\t}\n\t}\n\n\treturn &models.ManagerCreateVodAppealsResponse{\n\t\tID: strconv.FormatInt(resp.VodAppeal.VodAppealID, 10),\n\t\tCreatedAt: resp.VodAppeal.CreatedAt,\n\t\tUpdatedAt: resp.VodAppeal.UpdatedAt,\n\t\tTrackAppeals: trackAppeals,\n\t}, nil\n}", "title": "" }, { "docid": "585b5bd3c5d3ad43e2927ebeb763c2fc", "score": "0.40346393", "text": "func CreatePost(w http.ResponseWriter, r *http.Request) {\n\tr.ParseForm()\n\n\tpost, err := json.Marshal(map[string]string{\n\t\t\"title\": r.FormValue(\"title\"),\n\t\t\"content\": r.FormValue(\"content\"),\n\t})\n\tif err != nil {\n\t\tresponses.ReturnJSON(\n\t\t\tw,\n\t\t\thttp.StatusBadRequest,\n\t\t\tresponses.APIError{Error: err.Error()},\n\t\t)\n\t\treturn\n\t}\n\n\turl := fmt.Sprintf(\"%s/posts\", config.APIURL)\n\tresponse, err := UserAuthenticatedRequest(\n\t\tr,\n\t\thttp.MethodPost,\n\t\turl,\n\t\tbytes.NewBuffer(post),\n\t)\n\tif err != nil {\n\t\tresponses.ReturnJSON(\n\t\t\tw,\n\t\t\thttp.StatusInternalServerError,\n\t\t\tresponses.APIError{Error: err.Error()},\n\t\t)\n\t\treturn\n\t}\n\tdefer response.Body.Close()\n\n\t// Check if the status code returned from API is an error\n\tif response.StatusCode >= 400 {\n\t\tresponses.HandleAPIStatusCodeError(w, response)\n\t\treturn\n\t}\n\n\tresponses.ReturnJSON(w, response.StatusCode, nil)\n}", "title": "" }, { "docid": "703e48e18fd2b0d26d7a298cdd0a7852", "score": "0.4032651", "text": "func (a *Air) POST(path string, h Handler, gases ...Gas) {\n\ta.add(POST, path, h, gases...)\n}", "title": "" }, { "docid": "6b877b9e19d28cc392c6c7ecd6ec0e5e", "score": "0.40323034", "text": "func NewPostIPAMMacsOK() *PostIPAMMacsOK {\n\treturn &PostIPAMMacsOK{}\n}", "title": "" }, { "docid": "1cec05ec8c849bac8b946a80bf977ebb", "score": "0.40200946", "text": "func ItemPost(c *gin.Context) {\n\titem := models.NewItem()\n\terr := c.Bind(item)\n\tcheck(err)\n\tmodels.SaveItem(item, nil)\n\tc.JSON(http.StatusOK, gin.H{\"message\": \"OK\", \"item\": item})\n}", "title": "" }, { "docid": "57150161efd5dd05392b75796f417142", "score": "0.40083703", "text": "func (p *PostPackageView) POST(w http.ResponseWriter, r *http.Request) response.Response {\n\n\tvar (\n\t\terr error\n\t)\n\n\tresp := response.New(http.StatusInternalServerError)\n\n\tvar action int\n\n\t// get action from request\n\tif action, err = GetPostAction(r); err != nil {\n\t\treturn response.New(http.StatusBadRequest).Error(err)\n\t}\n\n\t// call by action\n\tswitch action {\n\tcase POST_PACKAGE_ACTION_FILE_UPLOAD:\n\t\treturn p.ActionFileUpload(r)\n\tcase POST_PACKAGE_ACTION_SUBMIT:\n\t\treturn response.New(http.StatusNotAcceptable)\n\t}\n\n\t// return response\n\treturn resp\n}", "title": "" }, { "docid": "3aeb30654a214206676acc7167872931", "score": "0.40027285", "text": "func NewAccountAssets(accountId string, balances AccountBalance, mask NullableString, name string, officialName NullableString, type_ AccountType, subtype NullableAccountSubtype, daysAvailable float32, transactions []AssetReportTransaction, owners []Owner, historicalBalances []HistoricalBalance) *AccountAssets {\n\tthis := AccountAssets{}\n\tthis.AccountId = accountId\n\tthis.Balances = balances\n\tthis.Mask = mask\n\tthis.Name = name\n\tthis.OfficialName = officialName\n\tthis.Type = type_\n\tthis.Subtype = subtype\n\tthis.DaysAvailable = daysAvailable\n\tthis.Transactions = transactions\n\tthis.Owners = owners\n\tthis.HistoricalBalances = historicalBalances\n\treturn &this\n}", "title": "" }, { "docid": "7efccdf13801b26fd51e52257ddc8333", "score": "0.39846814", "text": "func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface,\n\tid string,\n\ttitle string,\n\tartistName string,\n\tcreationDate string,\n\tartMedium string,\n\tdimension string,\n\tdescription string,\n\tpriceValue string,\n\tlastSoldPrice string,\n\tlastSoldDate string,\n\towner string,\n\tpreviousOwner string) error {\n\n\texists, err := s.AssetExists(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the asset %s already exists\", id)\n\t}\n\n\tasset := Asset{\n\t\tID: id,\n\t\tTitle: title,\n\t\tArtistName: artistName,\n\t\tCreationDate: creationDate,\n\t\tArtMedium: artMedium,\n\t\tDimension: dimension,\n\t\tDescription: description,\n\t\tPriceValue: priceValue,\n\t\tLastSoldPrice: lastSoldPrice,\n\t\tLastSoldDate: lastSoldDate,\n\t\tOwner: owner,\n\t\tPreviousOwner: previousOwner,\n\t}\n\tassetJSON, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(id, assetJSON)\n}", "title": "" }, { "docid": "580703545e3c43ea4a68c173c6e87c42", "score": "0.39842007", "text": "func (c *Client) Assets(reqParams *AssetsRequest) ([]*Asset, *Timestamp, error) {\n\n\t// Prepare the query and encode optional parameters\n\treq, err := http.NewRequest(\"GET\", c.baseURL+\"/assets\", nil)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tparams := req.URL.Query()\n\tparams.Add(\"search\", reqParams.Search)\n\tif reqParams.Limit > 0 {\n\t\tparams.Add(\"limit\", strconv.Itoa(reqParams.Limit))\n\t}\n\tif reqParams.Offset > 0 {\n\t\tparams.Add(\"offset\", strconv.Itoa(reqParams.Offset))\n\t}\n\treq.URL.RawQuery = params.Encode()\n\n\t// make the request\n\tccResp, err := c.fetchAndParse(req)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// Unmarshal the deferred json from the data field\n\tvar assets []*Asset\n\tjson.Unmarshal(*ccResp.Data, &assets)\n\n\treturn assets, ccResp.Timestamp, nil\n}", "title": "" }, { "docid": "7d2c12e581a3af42e9e39b7136419aa3", "score": "0.39736623", "text": "func ServeAssets(assets ...Asset) {\n\tfor _, a := range assets {\n\t\tServeFileOnRoute(a.Routing())\n\t}\n}", "title": "" }, { "docid": "eb8a309ff53c4b752f9bed5a51d927b9", "score": "0.3973581", "text": "func (p *PortraitApp) PostAddPost(w rest.ResponseWriter, req *rest.Request) {\n\tvalueMap := make(map[string]interface{})\n\n\tdefer req.Body.Close()\n\t/*\n\t *\texception: no multipart boundary param in Content-Type means ...\n\t * \tnormal multipart/form-data should be like this where the \"boundary\" param is available for parsing\n\t * \tmultipart/form-data; boundary=----WebKitFormBoundaryIox6yH4Vs0P82Y5O\n\t *\n\t *\tfor jQuery; if you set the headers to Content-Type: multipart/form-data;\n\t *\tthen the boundary would not be supplied at all; hence got this exception\n\t *\n\t *\tjQuery bug has a workaround but setting BOTH: (check add.html => jQueryFileUpload)\n\t *\t1. enctype => multipart/form-data,\n\t *\t2. contentType => false\n\t */\n\tdefer req.Body.Close()\n\tif err := req.ParseMultipartForm(10 << 20); err != nil {\n\t\tvalueMap[\"error\"] = err.Error()\n\t\tw.WriteJson(valueMap)\n\t\treturn\n\t}\n\t// create folder for portrait\n\tuuidFolder, err := p.fileRepoService.CreateFolder()\n\tif err != nil {\n\t\tvalueMap[\"error\"] = err.Error()\n\t\tw.WriteJson(valueMap)\n\t\treturn\n\t}\n\t// write the uploaded photo file\n\tfileParts := req.MultipartForm.File[\"file\"]\n\tif fileParts != nil && len(fileParts) > 0 {\n\t\t// since only 1 file should be uploaded via the param named \"file\"... get only the 1st file-part\n\t\tuploadedFile, err2 := fileParts[0].Open()\n\t\tif err2 != nil {\n\t\t\tvalueMap[\"error\"] = err2.Error()\n\t\t\tw.WriteJson(valueMap)\n\t\t\treturn\n\t\t}\n\t\tbContent, err2 := ioutil.ReadAll(uploadedFile)\n\t\tif err2 != nil {\n\t\t\tvalueMap[\"error\"] = err2.Error()\n\t\t\tw.WriteJson(valueMap)\n\t\t\treturn\n\t\t}\n\t\terr2 = p.fileRepoService.WriteFileFromBytes(bContent, uuidFolder, fileParts[0].Filename)\n\t\tif err2 != nil {\n\t\t\tvalueMap[\"error\"] = err2.Error()\n\t\t\tw.WriteJson(valueMap)\n\t\t\treturn\n\t\t}\n\t\tdefer uploadedFile.Close()\n\t}\n\t// write meta-info (desc, create_date, photographer, id, photo_location)\n\tmodel := new(PortraitModel)\n\tmodel.Id = uuidFolder\n\tcDate, err := time.Parse(\"2006-01-02\", req.Form.Get(\"createDate\"))\n\tif err != nil {\n\t\tcDate = time.Unix(0,0)\n\t}\n\tmodel.CreateDate = cDate\n\tmodel.Description = req.Form.Get(\"desc\")\n\tmodel.Photographer = req.Form.Get(\"photographer\")\n\tmodel.PhotoLocation = fileParts[0].Filename\n\n\tbContent, err := json.Marshal(model)\n\tif err != nil {\n\t\tvalueMap[\"error\"] = err.Error()\n\t\tw.WriteJson(valueMap)\n\t\treturn\n\t}\n\tif err = p.fileRepoService.WriteFileFromBytes(bContent, uuidFolder, repo.FILE_INFO); err != nil {\n\t\tvalueMap[\"error\"] = err.Error()\n\t\tw.WriteJson(valueMap)\n\t\treturn\n\t}\n\t// all good!\n\tvalueMap[\"status\"] = \"success\"\n\tvalueMap[\"message\"] = \"portrait successfully created\"\n\tvalueMap[\"portrait_id\"] = uuidFolder\n\tw.WriteJson(valueMap)\n}", "title": "" }, { "docid": "7f15610d0d1e16e0fefd7082f648384f", "score": "0.3970415", "text": "func (a *AppScreenshotSetsApiService) AppScreenshotSetsCreateInstance(ctx _context.Context, appScreenshotSetCreateRequest AppScreenshotSetCreateRequest) (AppScreenshotSetResponse, *_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 AppScreenshotSetResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/v1/appScreenshotSets\"\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 = &appScreenshotSetCreateRequest\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 == 400 {\n\t\t\tvar v ErrorResponse\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 ErrorResponse\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 == 409 {\n\t\t\tvar v ErrorResponse\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": "95f72cb840a5e34fe4ad96c78521adc7", "score": "0.39658552", "text": "func (a AccountsApi) ApiAccountsPost(accountResource AccountResource) (*AccountResource, *APIResponse, error) {\n\n\tvar localVarHttpMethod = strings.ToUpper(\"Post\")\n\t// create path and map variables\n\tlocalVarPath := a.Configuration.BasePath + \"/api/accounts\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := make(map[string]string)\n\tvar localVarPostBody interface{}\n\tvar localVarFileName string\n\tvar localVarFileBytes []byte\n\t// authentication '(APIKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-Octopus-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-Octopus-ApiKey\")\n\t// authentication '(APIKeyQuery)' required\n\t// set key with prefix in query string\n\tlocalVarQueryParams[\"ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"ApiKey\")\n\t// authentication '(NugetApiKeyHeader)' required\n\t// set key with prefix in header\n\tlocalVarHeaderParams[\"X-NuGet-ApiKey\"] = a.Configuration.GetAPIKeyWithPrefix(\"X-NuGet-ApiKey\")\n\t// add default headers if any\n\tfor key := range a.Configuration.DefaultHeader {\n\t\tlocalVarHeaderParams[key] = a.Configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{ }\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\tlocalVarHeaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\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 := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\tlocalVarHeaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tlocalVarPostBody = &accountResource\n\tvar successPayload = new(AccountResource)\n\tlocalVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)\n\n\tvar localVarURL, _ = url.Parse(localVarPath)\n\tlocalVarURL.RawQuery = localVarQueryParams.Encode()\n\tvar localVarAPIResponse = &APIResponse{Operation: \"ApiAccountsPost\", Method: localVarHttpMethod, RequestURL: localVarURL.String()}\n\tif localVarHttpResponse != nil {\n\t\tlocalVarAPIResponse.Response = localVarHttpResponse.RawResponse\n\t\tlocalVarAPIResponse.Payload = localVarHttpResponse.Body()\n\t}\n\n\tif err != nil {\n\t\treturn successPayload, localVarAPIResponse, err\n\t}\n\terr = json.Unmarshal(localVarHttpResponse.Body(), &successPayload)\n\treturn successPayload, localVarAPIResponse, err\n}", "title": "" }, { "docid": "5d8f51f9118b5aa64e6a6394399a2f2e", "score": "0.3959545", "text": "func (m *WindowsUpdatesUpdatePoliciesItemAudienceExclusionsMicrosoftGraphWindowsUpdatesEnrollAssetsByIdRequestBuilder) Post(ctx context.Context, body WindowsUpdatesUpdatePoliciesItemAudienceExclusionsMicrosoftGraphWindowsUpdatesEnrollAssetsByIdEnrollAssetsByIdPostRequestBodyable, requestConfiguration *WindowsUpdatesUpdatePoliciesItemAudienceExclusionsMicrosoftGraphWindowsUpdatesEnrollAssetsByIdRequestBuilderPostRequestConfiguration)(error) {\n requestInfo, err := m.ToPostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n err = m.BaseRequestBuilder.RequestAdapter.SendNoContent(ctx, requestInfo, errorMapping)\n if err != nil {\n return err\n }\n return nil\n}", "title": "" }, { "docid": "765ba9b6e40512d0268164c696606c0e", "score": "0.3958656", "text": "func (ih *itemHandler) PostItem(w http.ResponseWriter, r *http.Request) {\n\n\tvar item entities.Item\n\t_ = json.NewDecoder(r.Body).Decode(&item)\n\n\tlog.WithField(\"item\", item.Name).Info(\"Creating new Item\")\n\n\tif storedItem, err := ih.itemsService.GetItemsRepository().Store(&item); err != nil {\n\t\tih.httpResponder.ERROR(w, http.StatusNotFound)\n\t} else {\n\t\tih.httpResponder.JSON(w, http.StatusOK, storedItem)\n\t}\n\n}", "title": "" }, { "docid": "2cc1c0e360b5020e3eccec6f841e20f6", "score": "0.39453456", "text": "func (n *Network) createPumba(ctx context.Context, effectedNode *Node, targetIPs []string) (*DockerContainer, error) {\n\tname := effectedNode.Name() + containerNameSuffixPumba\n\tcontainer := NewDockerContainer(n.docker)\n\terr := container.CreatePumba(ctx, name, effectedNode.Name(), targetIPs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = container.Start(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn container, nil\n}", "title": "" }, { "docid": "c0a7396601573be4f51c7352d906d5e0", "score": "0.39384255", "text": "func (o *PostPdusPortsParams) WithAssetID(assetID *string) *PostPdusPortsParams {\n\to.SetAssetID(assetID)\n\treturn o\n}", "title": "" }, { "docid": "730d665558d8e62f41d083b31848de48", "score": "0.39372137", "text": "func (grc *GithubReleaseCreate) AddAssets(g ...*GithubAsset) *GithubReleaseCreate {\n\tids := make([]int, len(g))\n\tfor i := range g {\n\t\tids[i] = g[i].ID\n\t}\n\treturn grc.AddAssetIDs(ids...)\n}", "title": "" }, { "docid": "824f07437fbfaa0b83e519173dd71744", "score": "0.39275894", "text": "func (domain *PlanetsDomain) Create(body string) (map[string]string, error) {\n\tvar planet Planet\n\tjson.Unmarshal([]byte(body), &planet)\n\n\tv := validator.New()\n\tvalidationErrors := v.Struct(planet)\n\n\tif validationErrors != nil {\n\t\treturn nil, validationErrors\n\t}\n\n\tmovieAppearances, err := domain.PlanetsCache.GetCache(planet.Name)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif movieAppearances == -1 {\n\t\tplanet.MovieAppearances = 0\n\t} else {\n\t\tplanet.MovieAppearances = movieAppearances\n\t}\n\n\tfmt.Printf(\"%s has %d movie appearances\\n\", planet.Name, planet.MovieAppearances)\n\n\tres, err := domain.PlanetsDB.Create(context.Background(), &planet)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tid, _ := res.InsertedID.(primitive.ObjectID)\n\tresponse := map[string]string{\"id\": id.Hex()}\n\n\treturn response, err\n}", "title": "" }, { "docid": "88864dd369c207b8ff88907bbaa5e4f4", "score": "0.3926111", "text": "func (r *GitLabRelease) addAsset(asset ent.Attachment) *GitLabRelease {\n\tr.assets = append(r.assets, asset)\n\n\treturn r\n}", "title": "" }, { "docid": "16ba930e174bd358671da6637322b0da", "score": "0.39219776", "text": "func (a *SnapshotApiService) CreateSnapshotAlias(ctx context.Context, snapshotAlias SnapshotAliasCreateParams) (CreateSnapshotAliasResponse, *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 CreateSnapshotAliasResponse\n\t)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/platform/1/snapshot/aliases\"\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 = &snapshotAlias\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": "7454de9bb16d30e847a327295e896af6", "score": "0.3911221", "text": "func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error {\n\texists, err := s.AssetExists(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the asset %s already exists\", id)\n\t}\n\n\tasset := Asset{\n\t\tID: id,\n\t\tColor: color,\n\t\tSize: size,\n\t\tOwner: owner,\n\t\tAppraisedValue: appraisedValue,\n\t}\n\tassetJSON, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(id, assetJSON)\n}", "title": "" }, { "docid": "a218801bab98ab00dd8d8cb04dd18c00", "score": "0.39077154", "text": "func (a *GroupsApiService) GroupsGroupsHostsCreate(ctx _context.Context, id string, localVarOptionals *GroupsGroupsHostsCreateOpts) (*_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)\n\n\t// create path and map variables\n\tlocalVarPath := a.client.cfg.BasePath + \"/api/v2/groups/{id}/hosts/\"\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\tif localVarOptionals != nil && localVarOptionals.Data.IsSet() {\n\t\tlocalVarPostBody = localVarOptionals.Data.Value()\n\t}\n\n\tr, err := a.client.prepareRequest(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 := a.client.callAPI(r)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\t\tlocalVarHTTPResponse.Body.Close()\n\t\tif err != nil {\n\t\t\treturn localVarHTTPResponse, err\n\t\t}\n\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, nil\n}", "title": "" }, { "docid": "458651949712f2765d6fc6f354db0978", "score": "0.39076245", "text": "func FzWritePixmapAsPam(ctx *FzContext, out *FzOutput, pixmap []FzPixmap) {\n\tcctx, _ := (*C.fz_context)(unsafe.Pointer(ctx)), cgoAllocsUnknown\n\tcout, _ := (*C.fz_output)(unsafe.Pointer(out)), cgoAllocsUnknown\n\tcpixmap, _ := unpackArgSFzPixmap(pixmap)\n\tC.fz_write_pixmap_as_pam(cctx, cout, cpixmap)\n\tpackSFzPixmap(pixmap, cpixmap)\n}", "title": "" }, { "docid": "002df3db451b5682bd9a1963337d3d1a", "score": "0.3906722", "text": "func (s *Record) CreateAsset(ctx contractapi.TransactionContextInterface, uuid string, timestamp string, owner string, expiration string) error {\n\texists, err := s.AssetExists(ctx, uuid)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the asset %s already exists\", uuid)\n\t}\n\n\tasset := Asset{\n\t\tUUID: uuid,\n\t\tTimestamp: timestamp,\n\t\tOwner: owner,\n\t\tExpiration: expiration,\n\t}\n\tassetJSON, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(uuid, assetJSON)\n}", "title": "" }, { "docid": "659c8255514a6eb12fba2c1adca116ae", "score": "0.38974613", "text": "func (t *assetChaincode) addAsset(stub shim.ChaincodeStubInterface, args []string) pb.Response {\n\tasset_name := args[0]\n\n\t// check whether the name starts with letters\n\tif len(asset_name) == 0 {\n\t\treturn shim.Error(\"Asset's Name needed.\")\n\t}\n\tif !((asset_name[0] >= 'a' && asset_name[0] <= 'z') || (asset_name[0] >= 'A' && asset_name[0] <= 'Z')) {\n\t\treturn shim.Error(\"The name of an asset must start with letters.\")\n\t}\n\n\tasset_key := AssetPrefix + asset_name\n\n\tasset_type := args[1]\n\tasset_content := args[2]\n\tasset_price_type := args[3]\n\t// price\n\tasset_price := big.NewInt(0)\n\t_, good := asset_price.SetString(args[4], 10)\n\tif !good {\n\t\treturn shim.Error(\"Expecting integer value for amount\")\n\t}\n\towner_name := args[5]\n\n\t// verify weather the owner exists\n\towner_key := UserPrefix + owner_name\n\tuserAsBytes, err := stub.GetState(owner_key)\n\tif err != nil {\n\t\treturn shim.Error(\"Fail to get user: \" + err.Error())\n\t}\n\tif userAsBytes == nil {\n\t\tfmt.Println(\"This owner doesn't exist: \" + owner_name)\n\t\treturn shim.Error(\"This owner doesn't exist: \" + owner_name)\n\t}\n\n\t// check the user's address\n\tvar userJSON user\n\terr = json.Unmarshal([]byte(userAsBytes), &userJSON)\n\tif err != nil {\n\t\treturn shim.Error(\"Fail to unmarshal the userBytes.\")\n\t}\n\n\tsender_add, err := stub.GetSender()\n\tif sender_add != userJSON.Address {\n\t\treturn shim.Error(\"Not the right user invoke address.\")\n\t}\n\n\t// register asset\n\tasset := &asset{asset_name, asset_type, asset_content, asset_price_type, asset_price, owner_name}\n\tassetJSONasBytes, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\terr = stub.PutState(asset_key, assetJSONasBytes)\n\tif err != nil {\n\t\treturn shim.Error(err.Error())\n\t}\n\n\treturn shim.Success([]byte(\"asset register success.\"))\n}", "title": "" }, { "docid": "f7e48696952f03d5778f1a242a363ee8", "score": "0.3893674", "text": "func (s *Item) Post(path string, fn http.HandlerFunc, c ...alice.Constructor) {\n\ts.record(\"POST\", path)\n\ts.r.Post(path, alice.New(c...).ThenFunc(fn).(http.HandlerFunc))\n}", "title": "" }, { "docid": "b0e6ce480cf68dfb74a65d0e2ce6c986", "score": "0.38654912", "text": "func (_PermaChat *PermaChatTransactor) NewPost(opts *bind.TransactOpts, ipfsHash string, contentType string) (*types.Transaction, error) {\n\treturn _PermaChat.contract.Transact(opts, \"newPost\", ipfsHash, contentType)\n}", "title": "" }, { "docid": "29c5aa160cf647677b2d9a45108bc45a", "score": "0.38648108", "text": "func (_PermaChat *PermaChatTransactorSession) NewPost(ipfsHash string, contentType string) (*types.Transaction, error) {\n\treturn _PermaChat.Contract.NewPost(&_PermaChat.TransactOpts, ipfsHash, contentType)\n}", "title": "" }, { "docid": "75339f65f59c1a3178fbe76eda881c51", "score": "0.3862731", "text": "func (s *SmartContract2) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error {\n\texists, err := s.AssetExists(ctx, id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif exists {\n\t\treturn fmt.Errorf(\"the asset %s already exists\", id)\n\t}\n\n\tasset := Asset2{\n\t\tID: id,\n\t\tColor: color,\n\t\tSize: size,\n\t\tOwner: owner,\n\t\tAppraisedValue: appraisedValue,\n\t}\n\tassetJSON, err := json.Marshal(asset)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ctx.GetStub().PutState(id, assetJSON)\n}", "title": "" }, { "docid": "cbe95d6a1933c362e4a386f18e1cce2d", "score": "0.38611937", "text": "func (m *AccessPackageAssignmentApprovalsRequestBuilder) Post(ctx context.Context, body iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Approvalable, requestConfiguration *AccessPackageAssignmentApprovalsRequestBuilderPostRequestConfiguration)(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Approvalable, error) {\n requestInfo, err := m.CreatePostRequestInformation(ctx, body, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": ia572726a95efa92ddd544552cd950653dc691023836923576b2f4bf716cf204a.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.requestAdapter.SendAsync(ctx, requestInfo, iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.CreateApprovalFromDiscriminatorValue, errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(iadcd81124412c61e647227ecfc4449d8bba17de0380ddda76f641a29edf2b242.Approvalable), nil\n}", "title": "" }, { "docid": "03ad6b8f764e4baa24e51f43a0fb9b45", "score": "0.38552073", "text": "func CreatePost(w http.ResponseWriter, r *http.Request) {\n\tuserID, err := authentication.ExtractUserId(r)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnauthorized, err)\n\t\treturn\n\t}\n\n\tbodyRequest, err := ioutil.ReadAll(r.Body)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusUnprocessableEntity, err)\n\t\treturn\n\t}\n\n\tvar post models.Post\n\tif err = json.Unmarshal(bodyRequest, &post); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tpost.AuthorID = userID\n\tif err := post.Prepare(); err != nil {\n\t\tresponses.Error(w, http.StatusBadRequest, err)\n\t\treturn\n\t}\n\n\tdb, err := database.Connect()\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\tdefer db.Close()\n\n\tpost.AuthorID = userID\n\trepository := repository.NewRepositoryPosts(db)\n\tpost.Id, err = repository.Insert(post)\n\tif err != nil {\n\t\tresponses.Error(w, http.StatusInternalServerError, err)\n\t\treturn\n\t}\n\n\tresponses.JSON(w, http.StatusCreated, post)\n\n}", "title": "" }, { "docid": "50c17fef65bc4d6c52ecb9a80332b7c0", "score": "0.38524723", "text": "func NewAssetSet(start, end time.Time, assets ...Asset) *AssetSet {\n\tas := &AssetSet{\n\t\tAssets: map[string]Asset{},\n\t\tWindow: NewWindow(&start, &end),\n\t}\n\n\tfor _, a := range assets {\n\t\tas.Insert(a, nil)\n\t}\n\n\treturn as\n}", "title": "" }, { "docid": "e9a6322a56b5155442b1c017111bf09f", "score": "0.38450995", "text": "func (a *Client) PcloudPvminstancesVolumesPost(params *PcloudPvminstancesVolumesPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PcloudPvminstancesVolumesPostOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewPcloudPvminstancesVolumesPostParams()\n\t}\n\top := &runtime.ClientOperation{\n\t\tID: \"pcloud.pvminstances.volumes.post\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/pcloud/v1/cloud-instances/{cloud_instance_id}/pvm-instances/{pvm_instance_id}/volumes/{volume_id}\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\"},\n\t\tParams: params,\n\t\tReader: &PcloudPvminstancesVolumesPostReader{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.(*PcloudPvminstancesVolumesPostOK)\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 pcloud.pvminstances.volumes.post: API contract not enforced by server. Client expected to get an error, but got: %T\", result)\n\tpanic(msg)\n}", "title": "" }, { "docid": "04a5d44c6aa015ffa3381d55ddb5a0d4", "score": "0.38375792", "text": "func (a *ArtifactsApiService) CreateArtifact(ctx _context.Context, groupId string) ApiCreateArtifactRequest {\n\treturn ApiCreateArtifactRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tgroupId: groupId,\n\t}\n}", "title": "" }, { "docid": "8053466f569f8f0a3e9ad1453f947189", "score": "0.38366798", "text": "func (a *EsmeAccountResourceApiService) CreateEsmeAccountUsingPOSTExecute(r ApiCreateEsmeAccountUsingPOSTRequest) (EsmeAccount, *_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 EsmeAccount\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"EsmeAccountResourceApiService.CreateEsmeAccountUsingPOST\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/esme-accounts\"\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{\"*/*\"}\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.esmeAccount\n\treq, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes)\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, err\n\t}\n\n\tlocalVarHTTPResponse, err := a.client.callAPI(req)\n\tif err != nil || localVarHTTPResponse == nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tlocalVarBody, err := _ioutil.ReadAll(localVarHTTPResponse.Body)\n\tlocalVarHTTPResponse.Body.Close()\n\tlocalVarHTTPResponse.Body = _ioutil.NopCloser(bytes.NewBuffer(localVarBody))\n\tif err != nil {\n\t\treturn localVarReturnValue, localVarHTTPResponse, err\n\t}\n\n\tif localVarHTTPResponse.StatusCode >= 300 {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: localVarHTTPResponse.Status,\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\terr = a.client.decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get(\"Content-Type\"))\n\tif err != nil {\n\t\tnewErr := GenericOpenAPIError{\n\t\t\tbody: localVarBody,\n\t\t\terror: err.Error(),\n\t\t}\n\t\treturn localVarReturnValue, localVarHTTPResponse, newErr\n\t}\n\n\treturn localVarReturnValue, localVarHTTPResponse, nil\n}", "title": "" }, { "docid": "ad6b700c4dbe2435d702d7bdfc8e7729", "score": "0.38344175", "text": "func NewPostIPAMMacsBadRequest() *PostIPAMMacsBadRequest {\n\treturn &PostIPAMMacsBadRequest{}\n}", "title": "" }, { "docid": "c95a6185e7b8921a1e8b38b00c998faa", "score": "0.38316476", "text": "func Links_create_by_project() {\n\n // POST /projects/{project_id}/links.json\n\n}", "title": "" }, { "docid": "1941b2f5088829ced9e2af124988fcf2", "score": "0.38282394", "text": "func (s *SmartContract) CreateAsset(ctx contractapi.TransactionContextInterface, id string, color string, size int, owner string, appraisedValue int) error {\n exists, err := s.AssetExists(ctx, id)\n if err != nil {\n return err\n }\n if exists {\n return fmt.Errorf(\"the asset %s already exists color: %s, size: %s , owner: %s, appraisedvalue: %s\",id, color, size, owner, appraisedValue)\n }\n\n asset := Asset{\n ID: id,\n Color: color,\n Size: size,\n Owner: owner,\n AppraisedValue: appraisedValue,\n }\n assetJSON, err := json.Marshal(asset)\n if err != nil {\n return err\n }\n\n err = ctx.GetStub().PutState(id, assetJSON)\n if err != nil {\n return fmt.Errorf(\"failed to put to world state. %v\", err)\n }\n\n return assetJSON\n}", "title": "" }, { "docid": "bca9d1769ac3dbd0d60cc7c90114f406", "score": "0.38260666", "text": "func postProducts(c *gin.Context) {\n\tvar newProduct product\n\n\t// Call BindJSON to bind the received JSON to\n\t// newAlbum.\n\tif err := c.BindJSON(&newProduct); err != nil {\n\t\treturn\n\t}\n\n\t// Add the new album to the slice.\n\tproducts = append(products, newProduct)\n\tc.IndentedJSON(http.StatusCreated, newProduct)\n}", "title": "" }, { "docid": "d3637d9e04368f295a03c21df1809519", "score": "0.38250485", "text": "func postProcessAssetSet(assetSet *AssetSet) {\n\tfor key, as := range assetSet.Assets {\n\t\taddToConcreteMap(assetSet, key, as)\n\t}\n}", "title": "" }, { "docid": "44c67396e4c9b16554bfd62dd71bbdd7", "score": "0.38161045", "text": "func CreatePostEndpoint(response http.ResponseWriter, request *http.Request) {\n\tresponse.Header().Set(\"content-type\", \"application/json\")\n\tvar post Posts\n\t_ = json.NewDecoder(request.Body).Decode(&post)\n\tcollection := client.Database(\"InstagramBackendAPI\").Collection(\"post\")\n\tctx, _ := context.WithTimeout(context.Background(), 5*time.Second)\n\tresult, _ := collection.InsertOne(ctx, post)\n\tjson.NewEncoder(response).Encode(result)\n}", "title": "" }, { "docid": "12a60bd28fae8738912b175400ea20ef", "score": "0.38029447", "text": "func NewPostAPIAgentsRunParams() *PostAPIAgentsRunParams {\n\treturn &PostAPIAgentsRunParams{\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "440afe8987d8572aa77962c215114d58", "score": "0.38024953", "text": "func (k Keeper) AddAsset(ctx sdk.Context, nominee string, asset types.Asset) error {\n\tk.modulePerms.AutoCheck(types.PermWrite)\n\n\tif err := k.IsNominee(ctx, nominee); err != nil {\n\t\treturn err\n\t}\n\n\tif _, exists := k.GetAsset(ctx, asset.AssetCode); exists {\n\t\treturn fmt.Errorf(\"asset %q: already exists\", asset.AssetCode)\n\t}\n\n\tassets := k.GetAssetParams(ctx)\n\tassets = append(assets, asset)\n\n\tparams := k.GetParams(ctx)\n\tparams.Assets = assets\n\tk.SetParams(ctx, params)\n\n\treturn nil\n}", "title": "" }, { "docid": "d8d358ef43bfca1ac844be4cdb8a81ee", "score": "0.38024604", "text": "func (ac *Client) PostArguments(flowName string, flowTemplateID string, flowID string, sparkArgs map[string]interface{}) error {\n\targsReq := ArgsRequest{\n\t\tName: flowName,\n\t\tSparkArguments: sparkArgs,\n\t}\n\n\targsBytes, err := json.Marshal(argsReq)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"[PostArguments] Failed to marshal arguments into json\")\n\t}\n\targsReader := bytes.NewReader(argsBytes)\n\n\t// Create new save args request\n\treq, err := http.NewRequest(\"POST\", fmt.Sprintf(\"%s/api/v1/flow-templates/%s/flows/%s\", ac.APIHost, flowTemplateID, flowID), argsReader)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"[PostArguments] Failed to create POST request\")\n\t}\n\treq.Header.Add(\"predix-zone-id\", ac.TenantID)\n\treq.Header.Add(\"authorization\", ac.Token)\n\treq.Header.Add(\"content-type\", \"application/json\")\n\tac.dumpRequest(req)\n\n\t// Execute and handle request\n\tres, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"[PostArguments] Failed to execute POST request\")\n\t}\n\tdefer res.Body.Close()\n\tac.dumpResponse(res)\n\n\tif res.StatusCode != 202 {\n\t\tbody, err := ioutil.ReadAll(res.Body)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, fmt.Sprintf(\"[PostArguments] Request failed, and the response body could not be read. Status code: %d\", res.StatusCode))\n\t\t}\n\t\treturn fmt.Errorf(\"[PostArguments] Request returned %d. Body: %s\", res.StatusCode, string(body))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "16c2ce4b38110edf23afbc95cb91c7c2", "score": "0.3798133", "text": "func Assets(namespace string) (*packr.Box, error) {\n\tboxOnce.Do(func() {\n\t\tboxes = map[string]packr.Box{\n\t\t\t\"auth\": packr.NewBox(\"../controllers/auth/schema\"),\n\t\t\t\"task\": packr.NewBox(\"../controllers/task/schema\"),\n\t\t\t\"user\": packr.NewBox(\"../controllers/user/schema\"),\n\t\t}\n\t})\n\n\tbox, ok := boxes[namespace]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"No box found for namespace '%s'\", namespace)\n\t}\n\n\treturn &box, nil\n}", "title": "" }, { "docid": "cd56284c22b0327840af191710a92f83", "score": "0.37979412", "text": "func (app *Application) Post(pattern string, handlers ...Handler) {\n\tapp.routes = append(app.routes, newRoute(MethodPOST, pattern, handlers))\n}", "title": "" }, { "docid": "918421f5a2b6fecdcaf54c43a25775f4", "score": "0.3792497", "text": "func PostTask(c *gin.Context) {\n\n\tvar task Task\n\tc.BindJSON(&task)\n\n\tfmt.Println(\":>> \", task.Name, task.Type, task.Content)\n\tif task.Name == \"\" || task.Type == \"\" || task.Content == \"\" {\n\t\tc.AbortWithStatusJSON(NOTOK, gin.H{\n\t\t\t\"status\": \"ok\",\n\t\t\t\"message\": \"Name, Type, Content is mandatory\",\n\t\t})\n\t\treturn\n\t}\n\n\ttaskToCreate := &Task{Name: task.Name, Type: task.Type, Content: task.Content}\n\tdb.Create(taskToCreate)\n\n\tresp := gin.H{\n\t\t\"status\": \"ok\",\n\t\t\"data\": taskToCreate,\n\t}\n\tc.JSON(OK, resp)\n}", "title": "" }, { "docid": "c489e43d07d0c32841b9140131d510c3", "score": "0.37904772", "text": "func (c *WorkbenchesAPI) Assets() (*Assets, error) {\n\treq := c.client.restyClient.R().\n\t\tSetResult(Assets{})\n\n\tc.ApplyCommonFilters(req)\n\n\tr, err := req.Get(\"/workbenches/assets\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tswitch r.StatusCode() {\n\tcase 200:\n\t\treturn r.Result().(*Assets), nil\n\tdefault:\n\t\treturn nil, errorResponseFormatter(r)\n\t}\n}", "title": "" }, { "docid": "a3d2f28c3440ac8ad1d285c9566647f0", "score": "0.37901622", "text": "func NewPBIAM(tb testing.TB) *PBIAM {\n\tiam := &PBIAM{\n\t\tServer: grpc.NewServer(\n\t\t\tgrpc.UnaryInterceptor(func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp any, err error) {\n\t\t\t\tctx = test.ContextWithTB(ctx, tb)\n\t\t\t\treturn handler(ctx, req)\n\t\t\t}),\n\t\t),\n\t}\n\tiampb.RegisterNetworkRegistryServer(iam.Server, &pbIAMRegistry{PBIAM: iam})\n\tiampb.RegisterTenantRegistryServer(iam.Server, &pbIAMRegistry{PBIAM: iam})\n\tiampbv2.RegisterCatalogServer(iam.Server, &pbIAMCatalog{PBIAM: iam})\n\treturn iam\n}", "title": "" }, { "docid": "f0d9caf77dad587774a279eaed9a7245", "score": "0.3784148", "text": "func AddTorrent(w http.ResponseWriter, r *http.Request) {\n if !Validate(r.Header.Get(\"Authorization\")) {\n w.WriteHeader(401)\n return\n }\n\n file, _, err := r.FormFile(\"torrent\")\n if err != nil {\n w.WriteHeader(500)\n panic(err)\n }\n defer file.Close()\n\n out, err := os.Create(\"./torrents/\" + RandomFilename() + \".torrent\")\n if err != nil {\n w.WriteHeader(500)\n fmt.Println(\"error creating file\")\n panic(err)\n }\n defer out.Close()\n\n // verify file data\n _, err = io.Copy(out, file)\n if err != nil {\n panic(err)\n }\n\n w.WriteHeader(201)\n}", "title": "" } ]
3ab679763dcaf333cfb5c3a8b54c98fb
This function returns three maps. The corresponding keys are strings containing the valid options for the user.
[ { "docid": "be454d997e4fbab3ea3917cd44d13bf4", "score": "0.76066387", "text": "func valid_opts() (map[string] bool, map[string] bool, map[string] bool) {\n\n // The keys of this map are the available commands.\n opts_c := make(map[string] bool)\n opts_c[\"newanimal\"] = true\n opts_c[\"query\"] = true\n\n // The keys of this map are the types of animal the user can create.\n opts_a := make(map[string] bool)\n opts_a[\"cow\"] = true\n opts_a[\"bird\"] = true\n opts_a[\"snake\"] = true\n\n // The keys of this map are the types of information the user can retrieve.\n opts_i := make(map[string] bool)\n opts_i[\"eat\"] = true\n opts_i[\"move\"] = true\n opts_i[\"speak\"] = true\n\n return opts_c, opts_a, opts_i\n\n}", "title": "" } ]
[ { "docid": "45c59ae9fe2a6570b2a7d48299c337b1", "score": "0.58590764", "text": "func options(spec *sqlparser.TableSpec) map[string]string {\n\tif spec == nil || spec.Options == \"\" {\n\t\treturn nil\n\t}\n\tres := make(map[string]string)\n\tfor _, s := range strings.Split(spec.Options, space) {\n\t\tkv := strings.SplitN(s, equal, pair)\n\t\tif len(kv) == pair {\n\t\t\tres[strings.ToLower(kv[0])] = kv[1]\n\t\t}\n\t}\n\treturn res\n}", "title": "" }, { "docid": "8d9637ce9ae49928855ef15d13715426", "score": "0.5567682", "text": "func optionList(options ...string) []string {\n\tvalueMap := make(map[string]bool, len(options))\n\tvalues := make([]string, 0, len(options))\n\tfor _, option := range options {\n\t\tif option != \"\" && !valueMap[option] {\n\t\t\tvalues = append(values, option)\n\t\t\tvalueMap[option] = true\n\t\t}\n\t}\n\treturn values\n}", "title": "" }, { "docid": "7639bf9f8b1db32a4e93adbcfc793d0d", "score": "0.55501455", "text": "func extractOptions(arrptr *C.struct_mosquitto_opt, length C.int) map[string]string {\n\topts := make(map[string]string, length)\n\tvar i C.int\n\tfor i = 0; i < length; i++ {\n\t\tc_opt := C.accessArray(arrptr, i)\n\t\topts[C.GoString(c_opt.key)] = C.GoString(c_opt.value)\n\t}\n\treturn opts\n}", "title": "" }, { "docid": "b90e7ef9dfe4b8c4da530e7019433bc9", "score": "0.54934955", "text": "func getUserOptions() (*common.Options, []string) {\n\topts, keys := parseCommandLine()\n\topts.SetAndVerifyDeleteOptions()\n\treturn opts, keys\n}", "title": "" }, { "docid": "998613d359d5bbfa219dfa56a093ce76", "score": "0.53906924", "text": "func ParseFlags(flags []string, privilly string) map[string]string {\n\n cmap := make(map[string]string)\n cmd := \"Error\"; strexp := \"OK.\"\n\n if CmdArrayHas(flags[0]) {\n cmd = flags[0]\n } else {\n cmd = \"Error\"\n strexp = \"No such command: \" + flags[0]\n } // endif cmd.\n\n if len(flags) > 1 {\n cmap = methods.GetConfigs(flags[1])\n } else {\n cmd = \"Error\"\n strexp = \"Usage: ...\"\n } // endif flags.\n\n switch(cmd) {\n\n case \"Quit\":\n if !AuthorizedBy(cmap[\"pubkey\"], privilly) {\n cmd = \"Error\"\n strexp = \"Unauthorized Quit instance.\"\n } // endif authorized.\n\n case \"Utxos\":\n strexp = \"Update Balances in Listener.\"\n\n\n case \"Balance\":\n if methods.NoFile(flags[1]) || !strings.HasSuffix(flags[1], \".conf\") {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n case \"Transactions\":\n if methods.NoFile(flags[1]) || !strings.HasSuffix(flags[1], \".conf\") {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n case \"Multitest\":\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } else {\n cmap[\"scriptfile\"] = flags[1]\n } // endif NoFile.\n\n case \"Autotest\":\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad Directory Name: \" + flags[1]\n } else {\n cmap[\"allpay\"] = flags[1]\n cmap[\"throttle\"] = flags[2]\n } // endif NoFile.\n\n case \"PayCoins\":\n cmap[\"amount\"] = flags[2]\n if methods.NoFile(flags[3]) {\n cmd = \"Error\"\n strexp = \"Bad pubkey filename: \" + flags[3]\n } else {\n cmap[\"payee\"] = flags[3]\n cmap[\"payhash\"] = himitsu.HashPublicKey(cmap[\"payee\"])\n } // endif NoFile.\n\n case \"CreateCoins\":\n if !AuthorizedBy(cmap[\"pubkey\"], privilly) {\n cmd = \"Error\"\n strexp = \"Unauthorized Coin Creation.\"\n } // endif unauthorized.\n\n if methods.NoFile(flags[1]) {\n cmd = \"Error\"\n strexp = \"Bad filename: \" + flags[1]\n } // endif NoFile.\n\n // Coin specs are already in cmap[\"coin\"] and cmap[\"denom\"] so we're good.\n\n default:\n strexp = \"Unknown command.\"\n cmd = \"Error\"\n\n } // end switch.\n\n cmap[\"cmd\"] = cmd\n cmap[\"strexp\"] = strexp\n return cmap\n\n}", "title": "" }, { "docid": "2a80e986e9117be3dbe5a8cd94b1b351", "score": "0.523493", "text": "func ValidateMountOptions(options string,\n protoValidation func([]string, map[string]bool) error) error {\n\n // Split the list of options passed by their comma seperated values\n optList := strings.Split(options, \",\")\n optMap := make(map[string]bool)\n\n // Iterate over options which are of two types:\n // 1. option (OR)\n // 2. option=value\n for _, optStr := range optList {\n\n // Split the option based on the \"=\" sign and check the slice length.\n optSlice := strings.Split(optStr, \"=\")\n if len(optSlice) < 1 || len(optSlice) > 2 {\n return errors.New(\"Invalid option\")\n }\n\n // Is option repeated ?\n if val, ok := optMap[optSlice[0]]; ok {\n if val == true {\n return errors.New(\"Repeated option\")\n }\n }\n\n // Run the protocol based validation function.\n if err := protoValidation(optSlice, optMap); err != nil {\n return err\n }\n\n }\n return nil\n}", "title": "" }, { "docid": "0e617bff65d829da96983a0665c24b7f", "score": "0.52157915", "text": "func (cmd *createSnapshotCmd) validateFlags(c context.Context) (map[string]string, error) {\n\tif cmd.disk == \"\" {\n\t\treturn nil, errors.New(\"-disk is required\")\n\t}\n\tlabels := make(map[string]string, len(cmd.labels))\n\tfor _, label := range cmd.labels {\n\t\tparts := strings.SplitN(label, \":\", 2)\n\t\tif len(parts) != 2 {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"-label %q must be in key:value form\", label))\n\t\t}\n\t\tif _, ok := labels[parts[0]]; ok {\n\t\t\treturn nil, errors.New(fmt.Sprintf(\"-label %q has duplicate key\", label))\n\t\t}\n\t\tlabels[parts[0]] = parts[1]\n\t}\n\tif cmd.name == \"\" {\n\t\treturn nil, errors.New(\"-name is required\")\n\t}\n\tif cmd.project == \"\" {\n\t\treturn nil, errors.New(\"-project is required\")\n\t}\n\tif cmd.zone == \"\" {\n\t\treturn nil, errors.New(\"-zone is required\")\n\t}\n\treturn labels, nil\n}", "title": "" }, { "docid": "468d63afcc0700758478aebd9382c0e1", "score": "0.51791555", "text": "func read(opts_c, opts_a, opts_i map[string] bool,\n animals map[string] Animal) (string, string, string, error) {\n\n var key_exists bool\n\n // Reads and processes the user's input.\n fmt.Print(\"> \")\n reader := bufio.NewReader(os.Stdin)\n input, _ := reader.ReadString('\\n')\n input = strings.TrimSuffix(input, \"\\n\")\n input = strings.Trim(input, \" \")\n input = strings.ToLower(input)\n\n // Checks if the user wants to quit.\n if strings.Compare(input, \"q\") == 0 {\n err := errors.New(\"Quitting.\\n\")\n return \"\", \"\", \"\", err\n }\n\n // Validates the user's input.\n\n input_pts := strings.Fields(input)\n\n if len(input_pts) < 3 {\n err := errors.New(\"Not enough arguments!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n\n optc := input_pts[0]\n _, key_exists = opts_c[optc]\n if !key_exists {\n err := errors.New(\"Command unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n\n name := input_pts[1]\n _, key_exists = animals[name]\n if strings.Compare(optc, \"newanimal\") == 0 {\n if key_exists {\n err := errors.New(\"An animal with this name already exists!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n } else {\n if !key_exists {\n err := errors.New(\"There's no animal with this name!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n }\n\n opt := input_pts[2]\n if strings.Compare(optc, \"newanimal\") == 0 {\n _, key_exists = opts_a[opt]\n if !key_exists {\n err := errors.New(\"Animal unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n } else {\n _, key_exists = opts_i[opt]\n if !key_exists {\n err := errors.New(\"Information unavailable!\\n\\n\")\n return \"\", \"\", \"\", err\n }\n }\n\n return optc, name, opt, nil\n\n}", "title": "" }, { "docid": "04ea84cda3a980e12468eb16a61a6cbf", "score": "0.5093069", "text": "func parseAndFilterOptions(opts []string, allowedKeys ...string) ([]string, error) {\n\tvar out []string\n\tfor _, o := range opts {\n\t\tok, err := parseMountOption(o, allowedKeys...)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif ok {\n\t\t\tout = append(out, o)\n\t\t}\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "f28e1fe9a420aedc45674df37ba15eb6", "score": "0.50035805", "text": "func get_options(args []string)(string, string){\n\ti := 0\n\tmy_string := strings.Join(args, \" \")\n\tfor len(my_string) > i && my_string[i] != ' '{\n\t\ti++\n\t}\n\treturn my_string[:i], my_string[i:]\n}", "title": "" }, { "docid": "74ecec3a923a30843110e25a55f62164", "score": "0.4989929", "text": "func (req *TextRequirement) Options() []UserInput {\n\tvar options []UserInput\n\treturn options\n}", "title": "" }, { "docid": "3ab6b9b24482d113ab9eb01e8324d37c", "score": "0.49342045", "text": "func (p *TfInitParams) Opts() map[string][]string {\n\topts := make(map[string][]string)\n\n\tif p.Backend != nil && *p.Backend == false {\n\t\topts[\"backend\"] = []string{\"false\"}\n\t} else {\n\t\topts[\"backend\"] = []string{\"true\"}\n\t}\n\n\tif len(p.BackendConfig) > 0 {\n\t\topts[\"backend-config\"] = p.BackendConfig\n\t}\n\n\tif p.ForceCopy {\n\t\topts[\"force-copy\"] = []string{\"\"}\n\t}\n\n\tif p.FromModule != \"\" {\n\t\topts[\"from-module\"] = []string{p.FromModule}\n\t}\n\n\tif p.Get != nil && *p.Get == false {\n\t\topts[\"get\"] = []string{\"false\"}\n\t}\n\n\tif p.GetPlugins != nil && *p.GetPlugins == false {\n\t\topts[\"get-plugins\"] = []string{\"false\"}\n\t}\n\n\tif p.Input != nil && *p.Input == false {\n\t\topts[\"input\"] = []string{\"false\"}\n\t}\n\n\tif p.Lock != nil {\n\t\tif *p.Lock == true {\n\t\t\topts[\"lock\"] = []string{\"true\"}\n\t\t} else {\n\t\t\topts[\"lock\"] = []string{\"false\"}\n\t\t}\n\t}\n\n\tif p.LockTimeout != 0 {\n\t\topts[\"lock-timeout\"] = []string{strconv.Itoa(p.LockTimeout) + \"s\"}\n\t}\n\n\tif p.NoColor {\n\t\topts[\"no-color\"] = []string{\"\"}\n\t}\n\n\tif p.PluginDir != \"\" {\n\t\topts[\"plugin-dir\"] = []string{p.PluginDir}\n\t}\n\n\tif p.Reconfigure {\n\t\topts[\"reconfigure\"] = []string{\"\"}\n\t}\n\n\tif p.Upgrade != nil && *p.Upgrade == true {\n\t\topts[\"upgrade\"] = []string{\"true\"}\n\t}\n\n\tif p.VerifyPlugins != nil && *p.VerifyPlugins == false {\n\t\topts[\"verify-plugins\"] = []string{\"false\"}\n\t}\n\n\treturn opts\n}", "title": "" }, { "docid": "eb56ddb3866010cb41c0b8d20a4fde84", "score": "0.49280125", "text": "func userRoleMap() map[string]string {\n\troleMap := make(map[string]string)\n\troleMap[\"CNS-DATASTORE\"] = \"Datastore.FileManagement\"\n\troleMap[\"CNS-HOST-CONFIG-STORAGE\"] = \"Host.Config.Storage\"\n\troleMap[\"CNS-VM\"] = \"VirtualMachine.Config.AddExistingDisk VirtualMachine.Config.AddRemoveDevice\"\n\troleMap[\"CNS-SEARCH-AND-SPBM\"] = \"Cns.Searchable StorageProfile.View\"\n\troleMap[\"ReadOnly\"] = \"ReadOnly\"\n\n\treturn roleMap\n}", "title": "" }, { "docid": "e799e01c527eef00728010d8a3ef4346", "score": "0.48831475", "text": "func OptionsFromStringSlice(values []string) OptionsFunc {\n\treturn func() (map[string]string, error) {\n\t\tmapValues := map[string]string{}\n\t\tfor _, val := range values {\n\t\t\tmapValues[val] = val\n\t\t}\n\n\t\treturn mapValues, nil\n\t}\n}", "title": "" }, { "docid": "d3760b9edafe39ba6755294c6aea466d", "score": "0.4870939", "text": "func GetOptions(s interface{}, key string) ([]string, []interface{}) {\n\tvar (\n\t\topts []string\n\t\tvals []interface{}\n\t)\n\tv := reflect.ValueOf(s)\n\tt := v.Type()\n\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tif t.Field(i).Name == key {\n\t\t\tf := v.Field(i)\n\t\t\tft := f.Type()\n\t\t\tfor j := 0; j < f.NumField(); j++ {\n\t\t\t\tvals = append(vals, f.Field(j))\n\t\t\t\topts = append(opts, ft.Field(j).Name)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\treturn opts, vals\n}", "title": "" }, { "docid": "1cb0258afddeb674181aff8f031ed936", "score": "0.48704907", "text": "func extractRequiredFields(required []string) map[string]bool {\n\trequiredFields := map[string]bool{}\n\n\tfor _, key := range required {\n\t\trequiredFields[key] = true\n\t}\n\n\treturn requiredFields\n}", "title": "" }, { "docid": "b71c20cadceb73ef688958281b1ae3d4", "score": "0.48658207", "text": "func readOptions(optionsDir string) (map[string]bool, error) {\n\tif _, err := os.Stat(optionsDir); os.IsNotExist(err) {\n\t\tlog.Warning(\"Options directory does not exist, returning nil options\")\n\t\treturn nil, nil\n\t}\n\toptions := map[string]bool{}\n\terr := filepath.Walk(optionsDir, 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 info.IsDir() {\n\t\t\t// Do nothing\n\t\t\treturn nil\n\t\t}\n\n\t\toptionsFileContents, err := ioutil.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error opening %s for reading: %s\", path, err)\n\t\t}\n\t\toptionValue, err := strconv.ParseInt(strings.TrimSpace(string(optionsFileContents)), 10, 64)\n\t\tif err != nil || (optionValue != 0 && optionValue != 1) {\n\t\t\treturn fmt.Errorf(\"error parsing option file at %q. expected value to be either \\\"0\\\" or \\\"1\\\"\\n%s\", path, err)\n\t\t}\n\t\toptions[info.Name()] = !(optionValue == 0)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn options, nil\n}", "title": "" }, { "docid": "3bf5dbea0d116c8c821bd565f23af4bc", "score": "0.48498455", "text": "func convertOptions(q url.Values, pairs ...string) url.Values {\n\tn := make(url.Values)\n\tfor k, v := range q {\n\t\tx := make([]string, len(v))\n\t\tfor i, z := range v {\n\t\t\tfor j := 0; j < len(pairs); j += 2 {\n\t\t\t\tif pairs[j] == z {\n\t\t\t\t\tz = pairs[j+1]\n\t\t\t\t}\n\t\t\t}\n\t\t\tx[i] = z\n\t\t}\n\t\tn[k] = x\n\t}\n\treturn n\n}", "title": "" }, { "docid": "37700241233fe2c9a4bdff927086f1a8", "score": "0.48487222", "text": "func validateOptions(options *Options) error {\n\tif len(options.Password) == 0 {\n\t\treturn fmt.Errorf(\"password can not be empty\")\n\t}\n\tif len(options.Email) == 0 {\n\t\treturn fmt.Errorf(\"email can not be empty\")\n\t}\n\tif len(options.BaseURL) == 0 {\n\t\treturn fmt.Errorf(\"base url can not be empty\")\n\t}\n\tif options.BaseURL[len(options.BaseURL)-1:] == \"/\" {\n\t\toptions.BaseURL = options.BaseURL[:len(options.BaseURL)-1]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47b914a19126516057e75faf32092d08", "score": "0.48485065", "text": "func getSupportedAuthAlgo() map[AuthAlgoType]AuthAlgoValues {\n\tret := map[AuthAlgoType]AuthAlgoValues{}\n\tlen := C.size_t(0)\n\talgos := C.get_supported_auth_algos(&len)\n\tslice := (*[1 << 30]C.struct_supported_auth_algo)(unsafe.Pointer(algos))[:len]\n\tfor _, a := range slice {\n\t\tk := AuthAlgoType(a.algo)\n\t\tv := AuthAlgoValues{\n\t\t\tDigestLen: uint16(a.digest_len),\n\t\t\tKeyLen: uint16(a.key_len),\n\t\t\tKeyNotReq: (a.key_not_req == 1),\n\t\t\tKeyword: C.GoString(a.keyword),\n\t\t}\n\t\tret[k] = v\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "082d9625522bdc40e2f3c641fce4df9a", "score": "0.48396352", "text": "func hasConflictingOptions(ctx *cli.Context) (bool, error) {\n\t// Disallow conflicting format options.\n\tif numericutil.BoolToInt(ctx.Bool(\"format-shell\"))+numericutil.BoolToInt(ctx.Bool(\"format-shell-unexported\"))+\n\t\tnumericutil.BoolToInt(ctx.Bool(\"format-json\"))+numericutil.BoolToInt(ctx.Bool(\"format-raw\")) > 1 {\n\t\treturn true, errors.New(\"multiple output formats are not supported\")\n\t}\n\n\t// Disallow conflicting environment pass through options.\n\tif numericutil.BoolToInt(ctx.Bool(\"preserve-env\"))+numericutil.BoolToInt(ctx.Bool(\"ignore-preserve-env\")) > 1 {\n\t\treturn true, errors.New(\"multiple preserve environment options are not supported\")\n\t}\n\n\t// Disallow conflicting key source options.\n\tif numericutil.StringToBoolInt(ctx.String(\"key-file\"))+numericutil.StringToBoolInt(ctx.String(\"key-value\")) > 1 {\n\t\treturn true, errors.New(\"multiple key source formats are not supported\")\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "09dbae8e06e96aa0a5bbd51a27fb1b4a", "score": "0.48284847", "text": "func CreateAllowedContextMap(contexts []string) map[string]string {\n\taContextMap := make(map[string]string)\n\n\tfor _, context := range contexts {\n\t\taContextMap[context] = context\n\t}\n\n\treturn aContextMap\n}", "title": "" }, { "docid": "a22ffc6b0969ed6de585fa35e43c570c", "score": "0.4807779", "text": "func (this *ServerConfigType) GetValidCollections() map[string]string {\n\n\t// TODO Read in from a database the collections we offer for this authenticated\n\t// user and put them in a map\n\t// TODO switch from a map to a struct so we can track more than just name and description\n\n\t// Open connection to database\n\tfilename := this.System.DbFileFullPath\n\tdb, err := sql.Open(\"sqlite3\", filename)\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to open file %s due to error %v\", filename, err)\n\t}\n\tdefer db.Close()\n\n\trows, err := db.Query(\"SELECT collection, description FROM Collections\")\n\tif err != nil {\n\t\tlog.Printf(\"error running query, %v\", err)\n\t}\n\tdefer rows.Close()\n\n\tc := make(map[string]string)\n\n\tfor rows.Next() {\n\t\tvar collection string\n\t\tvar description string\n\t\terr = rows.Scan(&collection, &description)\n\n\t\tif err != nil {\n\t\t\tlog.Printf(\"error reading from database, %v\", err)\n\t\t}\n\n\t\tc[collection] = description\n\t}\n\n\t// c[\"ip-watch-list\"] = \"List of interesting IP addresses\"\n\t// c[\"url-watch-list\"] = \"List of interesting URL addresses\"\n\treturn c\n}", "title": "" }, { "docid": "e654a751da4552f4023c14317db52c33", "score": "0.4787606", "text": "func (*validator) validationKeys(config string) map[string]string {\n\tkeys := map[string]string{}\n\n\ta := strings.FieldsFunc(config, split)\n\tfor _, k := range a {\n\t\tkey := k\n\t\tvalue := \"\"\n\t\tif strings.Contains(k, \"=\") {\n\t\t\tkey = strings.Split(k, \"=\")[0]\n\t\t\tvalue = strings.Split(k, \"=\")[1]\n\t\t}\n\t\tkey = strings.Trim(key, \" \")\n\t\tkeys[key] = value\n\t}\n\n\treturn keys\n}", "title": "" }, { "docid": "57ba29b23d1e5eb53fba4fcb9b81090b", "score": "0.4748265", "text": "func readopts() {\n\t// TODO: implement readopts\n\t/*\n\t\tconst char *i;\n\t\tint j, k;\n\t\tint flag;\n\n\t\tflag = 1;\t\t// set to 0 if a name is specified\n\n\t\tif !lopen(optsfile) {\n\t\t\tstrcpy(logname, loginname);\n\t\t\treturn;\t\t// user name if no character name\n\t\t}\n\t\ti = \" \";\n\t\twhile (*i) {\n\t\t\tif ((i = lgetw()) == NULL)\n\t\t\t\tbreak;\t// check for EOF\n\t\t\twhile ((*i == ' ') || (*i == '\\t'))\n\t\t\t\ti++;\t// eat leading whitespace\n\n\t\t\tif (strcmp(i, \"bold-objects\") == 0)\n\t\t\t\tboldon = true\n\t\t\telse if (strcmp(i, \"enable-checkpointing\") == 0)\n\t\t\t\tckpflag = true\n\t\t\telse if (strcmp(i, \"inverse-objects\") == 0)\n\t\t\t\tboldon = false\n\t\t\telse if (strcmp(i, \"monster:\") == 0) {\t// name favorite monster\n\t\t\t\tif ((i = lgetw()) == 0)\n\t\t\t\t\tbreak;\n\t\t\t\tstrlcpy(usermonster[usermpoint], i, MAXMNAME);\n\t\t\t\tif (usermpoint >= MAXUM)\n\t\t\t\t\tcontinue;\t// defined all of em\n\t\t\t\tif (isalpha(j = usermonster[usermpoint][0])) {\n\t\t\t\t\tfor (k = 1; k < MAXMONST + 8; k++)\t// find monster\n\t\t\t\t\t\tif (monstnamelist[k] == j) {\n\t\t\t\t\t\t\tmonster[k].name = &usermonster[usermpoint++][0];\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\telse if (strcmp(i, \"name:\") == 0) {\t// defining players name\n\t\t\t\tif ((i = lgetw()) == 0)\n\t\t\t\t\tbreak;\n\t\t\t\tstrlcpy(logname, i, LOGNAMESIZE);\n\t\t\t\tflag = 0;\n\t\t\t} else if (strcmp(i, \"no-introduction\") == 0)\n\t\t\t\tnowelcome = true\n\t\t\telse if (strcmp(i, \"no-beep\") == 0)\n\t\t\t\tnobeep = true\n\t\t\t} else if (strcmp(i, \"play-day-play\") == 0) {\n\t\t\t\t// bypass time restrictions: ignored\n\t\t\t} else if (strcmp(i, \"savefile:\") == 0) {\t// defining savefilename\n\t\t\t\tif ((i = lgetw()) == 0)\n\t\t\t\t\tbreak;\n\t\t\t\tstrcpy(savefilename, i);\n\t\t\t\tflag = 0;\n\t\t\t}\n\t\t}\n\t\tif (flag)\n\t\t\tstrcpy(logname, loginname);\n\t*/\n}", "title": "" }, { "docid": "11393f95d46a23949be912f4ca07eade", "score": "0.47461423", "text": "func extraFlags(flags *pflag.FlagSet, args []string) map[string]string {\n\tallFlagsMap := parseFlags(args)\n\textra := map[string]string{}\n\n\tfor k, v := range allFlagsMap {\n\t\tvar f *pflag.Flag\n\t\tif len(k) == 1 {\n\t\t\tf = flags.ShorthandLookup(k)\n\t\t} else {\n\t\t\tf = flags.Lookup(k)\n\t\t}\n\t\t// It isn't a \"known\" flag, so it must be an extra one.\n\t\tif f == nil {\n\t\t\textra[k] = v\n\t\t}\n\t}\n\treturn extra\n}", "title": "" }, { "docid": "93834c6a051f468483c32771412f8d5e", "score": "0.47386983", "text": "func Flags(prefix string) map[string]*string {\n\treturn map[string]*string{\n\t\t`network`: flag.String(tools.ToCamel(fmt.Sprintf(`%sNetwork`, prefix)), `traefik`, `[deploy] Default Network`),\n\t\t`tag`: flag.String(tools.ToCamel(fmt.Sprintf(`%sTag`, prefix)), `latest`, `[deploy] Default image tag)`),\n\t\t`containerUser`: flag.String(tools.ToCamel(fmt.Sprintf(`%sContainerUser`, prefix)), `1000`, `[deploy] Default container user`),\n\t\t`appURL`: flag.String(tools.ToCamel(fmt.Sprintf(`%sAppURL`, prefix)), `https://dashboard.vibioh.fr`, `[deploy] Application web URL`),\n\t\t`notification`: flag.String(tools.ToCamel(fmt.Sprintf(`%sNotification`, prefix)), `onError`, `[deploy] Send email notification when deploy ends (possibles values ares \"never\", \"onError\", \"all\")`),\n\t}\n}", "title": "" }, { "docid": "975a671cead6d12bb132c47871e4a28e", "score": "0.47355253", "text": "func NfsValidation(optSlice []string, optMap map[string]bool) error {\n // Check various options based on slice length.\n if len(optSlice) == 1 {\n switch optSlice[0] {\n case kMountOptionNolock:\n break\n case kMountOptionIntr:\n break\n case kMountOptionSync:\n break\n case kMountOptionNoac:\n break\n case kMountOptionNoatime:\n break\n case kMountOptionRo:\n break\n case kMountOptionHard:\n fallthrough\n case kMountOptionSoft:\n // Check and record for mutally exclusive options.\n if optMap[kMountOptionType] == true {\n return errors.New(\"Mutually exclusive options set\")\n }\n optMap[kMountOptionType] = true\n break\n default:\n return errors.New(\"Invalid option\")\n }\n } else if len(optSlice) == 2 {\n switch optSlice[0] {\n case kMountOptionRsize:\n fallthrough\n case kMountOptionWsize:\n fallthrough\n case kMountOptionRetrans:\n fallthrough\n case kMountOptionTimeo:\n fallthrough\n case kMountOptionRetry:\n fallthrough\n case kMountOptionNfsVers:\n // Check for validity of value (an integer)\n if _, err := strconv.ParseInt(optSlice[1], 10, 64); err != nil {\n return errors.New(\"Invalid value (expected integer)\")\n }\n break\n case kMountOptionUid:\n break\n case kMountOptionGid:\n break\n default:\n return errors.New(\"Invalid option\")\n }\n }\n\n // Remember the option that was just checked.\n optMap[optSlice[0]] = true\n return nil\n}", "title": "" }, { "docid": "fb95741aab6b2de68d80a04e8875b51c", "score": "0.4694471", "text": "func pikpakOAuthOptions() []fs.Option {\n\topts := []fs.Option{}\n\tfor _, opt := range oauthutil.SharedOptions {\n\t\tif opt.Name == config.ConfigClientID {\n\t\t\topt.Advanced = true\n\t\t} else if opt.Name == config.ConfigClientSecret {\n\t\t\topt.Advanced = true\n\t\t}\n\t\topts = append(opts, opt)\n\t}\n\treturn opts\n}", "title": "" }, { "docid": "cdb18f2457b9e43b9605a36c96f0bd7f", "score": "0.46940804", "text": "func (l MultiLoader) parseFlags(args []string, flagsHandler func(*flag.FlagSet)) (flagVals map[string]*string, err error) {\n\tflags := flag.NewFlagSet(\"\", flag.ContinueOnError)\n\tflagsHandler(flags)\n\n\tflagVals = make(map[string]*string)\n\tfor name, option := range l.Options {\n\t\tif desc := option.Desc; desc != \"\" {\n\t\t\tflagVals[name] = flags.String(name, \"\", desc)\n\t\t} else {\n\t\t\tflagVals[name] = flags.String(name, \"\", name)\n\t\t}\n\t}\n\n\tif l.JSONKey != \"\" {\n\t\tflagVals[l.JSONKey] = flags.String(l.JSONKey, \"\", \"JSON configuration file\")\n\t}\n\n\terr = flags.Parse(args)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing flags: %s\", err)\n\t}\n\n\treturn flagVals, nil\n}", "title": "" }, { "docid": "67680baff457c335bec54a0771cd62ff", "score": "0.4693658", "text": "func Getopts(userInput, envVar, dfault string) string {\n\n\tif len(strings.TrimSpace(userInput)) > 0 {\n\t\treturn userInput\n\t}\n\tvalue := os.Getenv(envVar)\n\tif value == \"\" {\n\t\tvalue = dfault\n\t}\n\treturn value\n}", "title": "" }, { "docid": "250c192edaf166a1b94797d139737714", "score": "0.46849874", "text": "func FlagsToOptions(c *cli.Context, args []string) map[string]string {\n\toptions := ParseOpts(args)\n\tfor key, value := range options {\n\t\tif value == \"\" {\n\t\t\toptions[key] = \"true\"\n\t\t}\n\t}\n\treturn options\n}", "title": "" }, { "docid": "b79c8b43a8bff66affcfeb6b30d3cba1", "score": "0.4682647", "text": "func FlagsCheckerOptions() []cli.Flag {\n\treturn []cli.Flag{\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.min_roe\",\n\t\t\tValue: 8.0,\n\t\t\tUsage: \"最新一期 ROE 不低于该值\",\n\t\t\tDefaultText: \"8.0\",\n\t\t},\n\t\t&cli.IntFlag{\n\t\t\tName: \"checker.check_years\",\n\t\t\tValue: 5,\n\t\t\tUsage: \"连续增长年数\",\n\t\t\tDefaultText: \"5\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.no_check_years_roe\",\n\t\t\tValue: 20.0,\n\t\t\tUsage: \"ROE 高于该值时不做连续增长检查\",\n\t\t\tDefaultText: \"20.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.max_debt_asset_ratio\",\n\t\t\tValue: 60.0,\n\t\t\tUsage: \"最大资产负债率百分比(%)\",\n\t\t\tDefaultText: \"60.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.max_hv\",\n\t\t\tValue: 1.0,\n\t\t\tUsage: \"最大历史波动率\",\n\t\t\tDefaultText: \"1.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.min_total_market_cap\",\n\t\t\tValue: 100.0,\n\t\t\tUsage: \"最小市值(亿)\",\n\t\t\tDefaultText: \"100.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.bank_min_roa\",\n\t\t\tValue: 0.5,\n\t\t\tUsage: \"银行股最小 ROA\",\n\t\t\tDefaultText: \"0.5\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.bank_min_zbczl\",\n\t\t\tValue: 8.0,\n\t\t\tUsage: \"银行股最小资本充足率\",\n\t\t\tDefaultText: \"8.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.bank_max_bldkl\",\n\t\t\tValue: 3.0,\n\t\t\tUsage: \"银行股最大不良贷款率\",\n\t\t\tDefaultText: \"3.0\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.bank_min_bldkbbfgl\",\n\t\t\tValue: 100.0,\n\t\t\tUsage: \"银行股最低不良贷款拨备覆盖率\",\n\t\t\tDefaultText: \"100.0\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"checker.is_check_mll_stability\",\n\t\t\tValue: false,\n\t\t\tUsage: \"是否检测毛利率稳定性\",\n\t\t\tDefaultText: \"false\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"checker.is_check_jll_stability\",\n\t\t\tValue: false,\n\t\t\tUsage: \"是否检测净利率稳定性\",\n\t\t\tDefaultText: \"false\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"checker.is_check_price_by_calc\",\n\t\t\tValue: true,\n\t\t\tUsage: \"是否使用估算合理价进行检测,高于估算价将被过滤\",\n\t\t\tDefaultText: \"true\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.max_peg\",\n\t\t\tValue: 1.5,\n\t\t\tUsage: \"最大 PEG\",\n\t\t\tDefaultText: \"1.5\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.min_byys_ratio\",\n\t\t\tValue: 0.9,\n\t\t\tUsage: \"最小本业营收比\",\n\t\t\tDefaultText: \"0.9\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.max_byys_ratio\",\n\t\t\tValue: 1.1,\n\t\t\tUsage: \"最大本业营收比\",\n\t\t\tDefaultText: \"1.1\",\n\t\t},\n\t\t&cli.Float64Flag{\n\t\t\tName: \"checker.min_fzldb\",\n\t\t\tValue: 1.0,\n\t\t\tUsage: \"最小负债流动比\",\n\t\t\tDefaultText: \"1.0\",\n\t\t},\n\t\t&cli.BoolFlag{\n\t\t\tName: \"checker.is_check_cashflow\",\n\t\t\tValue: false,\n\t\t\tUsage: \"是否检测现金流量\",\n\t\t\tDefaultText: \"false\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "cb46fd03d8c1571b89da701c36e5170c", "score": "0.4678472", "text": "func (o Options) Tuples() []map[string]interface{} {\n\t// mapそのままだと順番がgenerateするごとに変わるの配列のmapにしてる\n\tvar res []map[string]interface{}\n\n\tfmt.Printf(\"%+v\\n\", o)\n\n\tv := reflect.ValueOf(o)\n\tt := v.Type()\n\tfor i := 0; i < v.NumField(); i++ {\n\t\tvar value interface{}\n\t\tval := v.Field(i)\n\t\tif val.Kind() == reflect.String {\n\t\t\tvalue = fmt.Sprintf(`\"%s\"`, val.String())\n\t\t} else if val.Kind() == reflect.Bool {\n\t\t\tvalue = val.Bool()\n\t\t} else {\n\t\t\tvalue = val.Int()\n\t\t}\n\n\t\tname := t.Field(i).Name\n\t\tres = append(res, map[string]interface{}{name: value})\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "a004f1a03cd81ac7ab783b050c252c0e", "score": "0.46783072", "text": "func checkSpecialOptions(w http.ResponseWriter, r *http.Request, mode, FL_COUNTRY_SPECIFIC string) (res string) {\n\t//c := appengine.NewContext(r)\n\tif strings.TrimSpace(FL_COUNTRY_SPECIFIC) == \"\" {\n\t\treturn\n\t}\n\tswitch mode {\n\t\tcase \"R\":\n\t\t\t//if to be redirected\n\t\t\tif strings.Index(FL_COUNTRY_SPECIFIC, \"--REDIRECT=\") != -1 {\n\t\t\t\tSPL := strings.Split(FL_COUNTRY_SPECIFIC,\"--\")\n\t\t\t\tfor i:=0; i < len(SPL); i++ {\n\t\t\t\t\tstr := strings.TrimSpace(SPL[i])\n\t\t\t\t\tif str != \"\" {\n\t\t\t\t\t\tif strings.Index(str, \"REDIRECT=\") != -1 {\n\t\t\t\t\t\t\tSPR := strings.Split(str,\"=\")\n\t\t\t\t\t\t\tif len(SPR) > 1 {\n\t\t\t\t\t\t\t\tTARGET := SPR[1]\n\t\t\t\t\t\t\t\tvalidateURL(w,r,TARGET)\n\t\t\t\t\t\t\t\tres = TARGET\n\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\n\t\tcase \"T\":\n\t\t\t//if to be redirected\n\t\t\tif strings.Index(FL_COUNTRY_SPECIFIC, \"--THEME_MEDIA_ID=\") != -1 {\n\t\t\t\tSPL := strings.Split(FL_COUNTRY_SPECIFIC,\"--\")\n\t\t\t\tfor i:=0; i < len(SPL); i++ {\n\t\t\t\t\tstr := strings.TrimSpace(SPL[i])\n\t\t\t\t\tif str != \"\" {\n\t\t\t\t\t\tif strings.Index(str, \"THEME_MEDIA_ID=\") != -1 {\n\t\t\t\t\t\t\tSPR := strings.Split(str,\"=\")\n\t\t\t\t\t\t\tif len(SPR) > 1 {\n\t\t\t\t\t\t\t\tTHEME_ID := SPR[1]\n\t\t\t\t\t\t\t\tres = THEME_ID\n\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}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t}\n\treturn res\n \n}", "title": "" }, { "docid": "19611658cbe31873d97cbe54a7d995e9", "score": "0.4651587", "text": "func keyAndOpts(tag string) (string, *options, error) {\n\tparts := strings.Split(tag, \",\")\n\tkey, tagOpts := strings.TrimSpace(parts[0]), parts[1:]\n\n\tif key != \"\" && !validateEnvName(key) {\n\t\treturn \"\", nil, fmt.Errorf(\"%q: %w \", key, ErrInvalidEnvvarName)\n\t}\n\n\tvar opts options\n\nLOOP:\n\tfor i, o := range tagOpts {\n\t\to = strings.TrimLeftFunc(o, unicode.IsSpace)\n\t\tswitch {\n\t\tcase o == optOverwrite:\n\t\t\topts.Overwrite = true\n\t\tcase o == optRequired:\n\t\t\topts.Required = true\n\t\tcase o == optNoInit:\n\t\t\topts.NoInit = true\n\t\tcase strings.HasPrefix(o, optPrefix):\n\t\t\topts.Prefix = strings.TrimPrefix(o, optPrefix)\n\t\tcase strings.HasPrefix(o, optDelimiter):\n\t\t\topts.Delimiter = strings.TrimPrefix(o, optDelimiter)\n\t\tcase strings.HasPrefix(o, optSeparator):\n\t\t\topts.Separator = strings.TrimPrefix(o, optSeparator)\n\t\tcase strings.HasPrefix(o, optDefault):\n\t\t\t// If a default value was given, assume everything after is the provided\n\t\t\t// value, including comma-seprated items.\n\t\t\to = strings.TrimLeft(strings.Join(tagOpts[i:], \",\"), \" \")\n\t\t\topts.Default = strings.TrimPrefix(o, optDefault)\n\t\t\tbreak LOOP\n\t\tdefault:\n\t\t\treturn \"\", nil, fmt.Errorf(\"%q: %w\", o, ErrUnknownOption)\n\t\t}\n\t}\n\n\treturn key, &opts, nil\n}", "title": "" }, { "docid": "28a3bd43f2e761f01c16411f618c8ff4", "score": "0.4649868", "text": "func parseFlags() options {\n var opt options\n var fs = setupFlags(&opt)\n fs.Parse(os.Args[1:])\n verifyFlags(&opt, fs)\n // Process the verified options...\n return opt\n}", "title": "" }, { "docid": "65194ca86a36de8311372cf1016101f8", "score": "0.46458232", "text": "func parseCropString(s string) (values map[string]int, err error) {\n\tvalues = make(map[string]int)\n\n\tpairs := strings.Split(s, \"|\")\n\tfor _, pair := range pairs {\n\t\tv := strings.Split(pair, \":\")\n\t\tif len(v) != 2 {\n\t\t\treturn nil, ErrInvalidOptionValues\n\t\t}\n\n\t\tkey := v[0]\n\t\tvalue, e := strconv.Atoi(v[1])\n\t\tif e != nil {\n\t\t\treturn nil, ErrInvalidOptionValues\n\t\t}\n\n\t\t// check boundaries - fast fail\n\t\tif value < 0 {\n\t\t\treturn nil, ErrInvalidOptionValues\n\t\t}\n\n\t\tvalues[key] = value\n\t}\n\n\treturn values, nil\n}", "title": "" }, { "docid": "23f1a64d7768660d4dc6a42669c6c6fe", "score": "0.4639247", "text": "func GetUserdataDefaults() (map[string]interface{}, map[string]interface{}) {\n\treturn udPathsDefaults, udValuesDefaults\n}", "title": "" }, { "docid": "22119f95ea61730667279e6aeae6e032", "score": "0.46285263", "text": "func ParseValid(u *User) map[string]ValidPair {\n\tvalid := make(map[string]ValidPair)\n\tt := reflect.TypeOf(*u)\n\tv := reflect.ValueOf(*u)\n\tval := reflect.Indirect(reflect.ValueOf(u))\n\tfor i := 0; i < val.NumField(); i++ {\n\t\tfield := val.Type().Field(i).Name\n\t\tfieldName, found := t.FieldByName(field)\n\t\tif !found {\n\t\t\tcontinue\n\t\t}\n\t\ttemp := fmt.Sprint(v.Field(i).Interface())\n\t\tvalid[field] = ValidPair{\n\t\t\ttag: fieldName.Tag.Get(\"valid\"),\n\t\t\tvalue: temp,\n\t\t}\n\t}\n\treturn valid\n}", "title": "" }, { "docid": "dccabe6d95b377d57624a27badda9b14", "score": "0.46244445", "text": "func (opts Options) Validate() error {\n\t// Check that the required flags did not get a flag as their value\n\t// We can safely look for a '-' as the first char as none of the fields accepts it\n\t// NOTE: We must do this for all the required flags first or we may output the wrong\n\t// error as flags may seem to be missing because Cobra assigned them to another flag.\n\tif strings.HasPrefix(opts.Group, \"-\") {\n\t\treturn fmt.Errorf(groupPresent)\n\t}\n\tif strings.HasPrefix(opts.Version, \"-\") {\n\t\treturn fmt.Errorf(versionPresent)\n\t}\n\tif strings.HasPrefix(opts.Kind, \"-\") {\n\t\treturn fmt.Errorf(kindPresent)\n\t}\n\n\t// Now we can check that all the required flags are not empty\n\tif len(opts.Group) == 0 && len(opts.Domain) == 0 {\n\t\treturn fmt.Errorf(groupRequired)\n\t}\n\tif len(opts.Version) == 0 {\n\t\treturn fmt.Errorf(versionRequired)\n\t}\n\tif len(opts.Kind) == 0 {\n\t\treturn fmt.Errorf(kindRequired)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "5c132dc6ff8121fc9e9022d87c47c8ff", "score": "0.4604429", "text": "func GetOptions() string {\n\n\tvar ch string\n\tfmt.Println(\"Choose options\")\n\tfmt.Println(\"*********************************************\")\n\tfmt.Println(\"1. Get States names List\")\n\tfmt.Println(\"2. Get States based district names List (Please get State Id from Opt.1)\")\n\tfmt.Println(\"3. State-Dist-Center list !!Help from #Opts {1 & 2} \")\n\tfmt.Println(\"4. PIN based Center list\")\n\tfmt.Println(\"5. Exit\")\n\tfmt.Println(\"*********************************************\")\n\tfmt.Print(\">>\")\n\tfmt.Scanf(\"%s\\n\", &ch)\n\treturn ch\n}", "title": "" }, { "docid": "90631e3a26e14be96a74ba010983148c", "score": "0.458943", "text": "func PossiblePasswordNameValues() []PasswordName {\n\treturn []PasswordName{Password, Password2}\n}", "title": "" }, { "docid": "cc369e60d76b01a99683899e91a3629e", "score": "0.45872822", "text": "func toMap(strings []string) map[string]bool {\n\tresult := make(map[string]bool)\n\tfor _, s := range strings {\n\t\tresult[s] = true\n\t}\n\treturn result\n}", "title": "" }, { "docid": "86924df922c5a9ba04c7163a3f7d16f2", "score": "0.457399", "text": "func init() {\n\tDataLists[\"anime-character-roles\"] = []*Option{\n\t\t{\"main\", \"Main character\"},\n\t\t{\"supporting\", \"Supporting character\"},\n\t}\n}", "title": "" }, { "docid": "ae1bf8ccca247e8ee02cdf0fb2ba735e", "score": "0.4570445", "text": "func flags() []cli.Flag {\n\treturn []cli.Flag{\n\t\t// key-file represents the path to a text file containing a JSON-formatted service account key for accessing the\n\t\t// target secret manager document. It is an error to specify both `key-file` and `key-value`.\n\t\t&cli.StringFlag{\n\t\t\tName: \"key-file\",\n\t\t\tAliases: []string{\"k\"},\n\t\t\tUsage: \"Path to file containing JSON format service account key.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// key-value is a text string containing a base64 encoded JSON-formatted service account key for accessing the\n\t\t// target secret manager document. It is an error to specify both `key-file` and `key-value`. This value can be\n\t\t// set via the cli or via an environment variable.\n\t\t&cli.StringFlag{\n\t\t\tName: \"key-value\",\n\t\t\tAliases: []string{\"K\"},\n\t\t\tUsage: \"Base64 encoded string containing JSON format service account key.\",\n\t\t\tRequired: false,\n\t\t\tEnvVars: []string{envVarInjectorKeyValue},\n\t\t},\n\t\t// format-shell outputs contents from the secret document as a list of exported shell key/value settings. A\n\t\t// typical use case would be to write the output to a file and then `source` it elsewhere.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"format-shell\",\n\t\t\tAliases: []string{\"e\"},\n\t\t\tUsage: \"Parse secret contents and convert to exported shell key/value settings.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// format-shell-unexported outputs contents from the secret document as a list of shell key/value settings. A\n\t\t// typical use case would be to write the output to a file and then `source` it elsewhere.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"format-shell-unexported\",\n\t\t\tAliases: []string{\"u\"},\n\t\t\tUsage: \"Parse secret contents and convert to unexported shell key/value settings.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// format-json outputs contents from the secret document as a standard JSON object.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"format-json\",\n\t\t\tAliases: []string{\"j\"},\n\t\t\tUsage: \"Parse secret contents and convert from hJSON to JSON.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// format-raw outputs contents from the secret document as returned by the secret manager. The format returned\n\t\t// should be either hJSON (human JSON) or standard JSON.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"format-raw\",\n\t\t\tAliases: []string{\"r\"},\n\t\t\tUsage: \"Output unparsed secret contents. This will likely be hJSON or JSON.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// ignore would generally be used for deployments where the command line includes one or more secret retrieval\n\t\t// options (for instance, in a container run command) and other values are intended to be pulled from env vars\n\t\t// but could be missing while debugging locally. Specifying this option would\n\t\t&cli.BoolFlag{\n\t\t\tName: \"ignore\",\n\t\t\tAliases: []string{\"i\"},\n\t\t\tUsage: \"Ignore missing secret options.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// ignore-preserve-env is different from supplying -i and -E in that specifying this option will only pass\n\t\t// parent environment variables if secret retrieval options are missing (i.e. an incomplete set of options were\n\t\t// specified). In contrast, specifying -E will always pass parent environment variables.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"ignore-preserve-env\",\n\t\t\tAliases: []string{\"I\"},\n\t\t\tUsage: \"Ignore missing secret options, pass environment variables from parent OS into command shell.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// preserve-env will pass through environment varisables from the parent to the child process (that is, the\n\t\t// process that is specified as the command to run).\n\t\t&cli.BoolFlag{\n\t\t\tName: \"preserve-env\",\n\t\t\tAliases: []string{\"E\"},\n\t\t\tUsage: \"Pass environment variables from parent OS into command shell.\",\n\t\t\tRequired: false,\n\t\t},\n\t\t// output-file sets the output destination which is stdout by default but can also be set to a file path. The\n\t\t// \"-\" character, as the path, also identifies stdout as the destination.\n\t\t&cli.StringFlag{\n\t\t\tName: \"output-file\",\n\t\t\tAliases: []string{\"o\"},\n\t\t\tUsage: `Write output to file. Default is stdout; passing \"-\" also represents stdout.`,\n\t\t\tRequired: false,\n\t\t},\n\t\t// project sets the GCP project id in which the secret manager document is stored. This value can be set via the\n\t\t// cli or via an environment variable.\n\t\t&cli.StringFlag{\n\t\t\tName: \"project\",\n\t\t\tAliases: []string{\"p\"},\n\t\t\tUsage: \"GCP project id.\",\n\t\t\tRequired: false,\n\t\t\tEnvVars: []string{envVarInjectorProject},\n\t\t},\n\t\t// secret-name sets the GCP secret manager document name which identifies the specific document to retrieve.\n\t\t// This value can be set via the cli or via an environment variable.\n\t\t&cli.StringFlag{\n\t\t\tName: \"secret-name\",\n\t\t\tUsage: \"Name of secret containing environment variables and values.\",\n\t\t\tAliases: []string{\"S\"},\n\t\t\tRequired: false,\n\t\t\tEnvVars: []string{envVarInjectorSecretName},\n\t\t},\n\t\t// secret-version set the version (revision) of the GCP secret manager document to retrieve. This setting is\n\t\t// strictly option and the behavior is to retrieve the `latest` version of the named secret. Beware that setting\n\t\t// a non-existent version will return an empty value (this is desired behavior).\n\t\t&cli.StringFlag{\n\t\t\tName: \"secret-version\",\n\t\t\tUsage: `Version of secret containing environment variables and values. (\"latest\" if not specified)`,\n\t\t\tAliases: []string{\"V\"},\n\t\t\tRequired: false,\n\t\t\tEnvVars: []string{envVarInjectorSecretVersion},\n\t\t},\n\t\t// debug enables the output of debugging information which is specifically helpful in identifying misconfigured\n\t\t// and possibly conflicting settings.\n\t\t&cli.BoolFlag{\n\t\t\tName: \"debug\",\n\t\t\tUsage: \"Show debug information.\",\n\t\t\tAliases: []string{\"d\"},\n\t\t\tRequired: false,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "e1dde45783255815b2a27d99c93bab5b", "score": "0.45633867", "text": "func OptionsFromMap(values map[string]string) OptionsFunc {\n\treturn func() (map[string]string, error) {\n\t\treturn values, nil\n\t}\n}", "title": "" }, { "docid": "418626d682d525db047529b61fe0084b", "score": "0.45581797", "text": "func (f *flags) validate() error {\n\tvar result error\n\tinvalidCases := []struct {\n\t\tname string\n\t\tcond bool\n\t}{\n\t\t{\"cannot specify both of --cli and --repl\", f.mode.cli && f.mode.repl},\n\t}\n\tfor _, c := range invalidCases {\n\t\tif c.cond {\n\t\t\tresult = multierror.Append(result, errors.New(c.name))\n\t\t}\n\t}\n\treturn result\n}", "title": "" }, { "docid": "ded9bf3189670f872aaa632216d6c787", "score": "0.45547804", "text": "func getSupportedCipherAlgo() map[CipherAlgoType]CipherAlgoValues {\n\tret := map[CipherAlgoType]CipherAlgoValues{}\n\tlen := C.size_t(0)\n\talgos := C.get_supported_cipher_algos(&len)\n\tslice := (*[1 << 30]C.struct_supported_cipher_algo)(unsafe.Pointer(algos))[:len]\n\tfor _, a := range slice {\n\t\tk := CipherAlgoType(a.algo)\n\t\tv := CipherAlgoValues{\n\t\t\tIvLen: uint16(a.iv_len),\n\t\t\tBlockSize: uint16(a.block_size),\n\t\t\tKeyLen: uint16(a.key_len),\n\t\t\tKeyword: C.GoString(a.keyword),\n\t\t}\n\t\tret[k] = v\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "4216837d75eafae24fb95c2b195cda0c", "score": "0.45417935", "text": "func argsToMap(args []string) (out rc.Params, err error) {\n\tout = rc.Params{}\n\tfor i := 0; i < len(args); i++ {\n\t\tkey := args[i]\n\t\tequals := strings.IndexRune(key, '=')\n\t\tvar value string\n\t\tif equals >= 0 {\n\t\t\tkey, value = key[:equals], key[equals+1:]\n\t\t} else {\n\t\t\ti++\n\t\t\tif i >= len(args) {\n\t\t\t\treturn nil, errors.New(\"found key without value\")\n\t\t\t}\n\t\t\tvalue = args[i]\n\t\t}\n\t\tout[key] = value\n\t}\n\treturn out, nil\n}", "title": "" }, { "docid": "db682d667bd6bd1d465229726314b41d", "score": "0.45398542", "text": "func (opts PutObjectOptions) validate() (err error) {\n\tfor k, v := range opts.UserMetadata {\n\t\tif !httpguts.ValidHeaderFieldName(k) || isStandardHeader(k) || isSSEHeader(k) || isStorageClassHeader(k) {\n\t\t\treturn errInvalidArgument(k + \" unsupported user defined metadata name\")\n\t\t}\n\t\tif !httpguts.ValidHeaderFieldValue(v) {\n\t\t\treturn errInvalidArgument(v + \" unsupported user defined metadata value\")\n\t\t}\n\t}\n\tif opts.Mode != \"\" && !opts.Mode.IsValid() {\n\t\treturn errInvalidArgument(opts.Mode.String() + \" unsupported retention mode\")\n\t}\n\tif opts.LegalHold != \"\" && !opts.LegalHold.IsValid() {\n\t\treturn errInvalidArgument(opts.LegalHold.String() + \" unsupported legal-hold status\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8703ac5c398bf9f5380f167c36a394e", "score": "0.4538566", "text": "func GetTemplateOptions(template string) (map[string]interface{}, bool) {\n\to, ok := defaultTemplatesOptions[template]\n\treturn o, ok\n}", "title": "" }, { "docid": "4057f8856aa7095922fee3ca452a4e99", "score": "0.45319024", "text": "func NewOptions() Options {\n\treturn &optionMap{\n\t\tvalues: make(map[string]string),\n\t}\n}", "title": "" }, { "docid": "540ffc61e17992e67e473baf9e5dfd9f", "score": "0.45261455", "text": "func allowed(allowed [][]byte) (m map[string]bool) {\n\tm = make(map[string]bool)\n\n\tfor _, a := range allowed {\n\t\tm[string(a)] = true\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "e1c44ec8da8a760970bb3f216397aa24", "score": "0.45248368", "text": "func VolumeOptions(opts map[string]string) ([]libpod.VolumeCreateOption, error) {\n\tlibpodOptions := []libpod.VolumeCreateOption{}\n\tvolumeOptions := make(map[string]string)\n\n\tfor key, value := range opts {\n\t\tswitch key {\n\t\tcase \"o\":\n\t\t\t// o has special handling to parse out UID, GID.\n\t\t\t// These are separate Libpod options.\n\t\t\tsplitVal := strings.Split(value, \",\")\n\t\t\tfinalVal := []string{}\n\t\t\tfor _, o := range splitVal {\n\t\t\t\t// Options will be formatted as either \"opt\" or\n\t\t\t\t// \"opt=value\"\n\t\t\t\tsplitO := strings.SplitN(o, \"=\", 2)\n\t\t\t\tswitch strings.ToLower(splitO[0]) {\n\t\t\t\tcase \"size\":\n\t\t\t\t\tsize, err := units.FromHumanSize(splitO[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"cannot convert size %s to integer: %w\", splitO[1], err)\n\t\t\t\t\t}\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeSize(uint64(size)))\n\t\t\t\t\tfinalVal = append(finalVal, o)\n\t\t\t\t\t// set option \"SIZE\": \"$size\"\n\t\t\t\t\tvolumeOptions[\"SIZE\"] = splitO[1]\n\t\t\t\tcase \"inodes\":\n\t\t\t\t\tinodes, err := strconv.ParseUint(splitO[1], 10, 64)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"cannot convert inodes %s to integer: %w\", splitO[1], err)\n\t\t\t\t\t}\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeInodes(inodes))\n\t\t\t\t\tfinalVal = append(finalVal, o)\n\t\t\t\t\t// set option \"INODES\": \"$size\"\n\t\t\t\t\tvolumeOptions[\"INODES\"] = splitO[1]\n\t\t\t\tcase \"uid\":\n\t\t\t\t\tif len(splitO) != 2 {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"uid option must provide a UID: %w\", define.ErrInvalidArg)\n\t\t\t\t\t}\n\t\t\t\t\tintUID, err := strconv.Atoi(splitO[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"cannot convert UID %s to integer: %w\", splitO[1], err)\n\t\t\t\t\t}\n\t\t\t\t\tlogrus.Debugf(\"Removing uid= from options and adding WithVolumeUID for UID %d\", intUID)\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeUID(intUID), libpod.WithVolumeNoChown())\n\t\t\t\t\tfinalVal = append(finalVal, o)\n\t\t\t\t\t// set option \"UID\": \"$uid\"\n\t\t\t\t\tvolumeOptions[\"UID\"] = splitO[1]\n\t\t\t\tcase \"gid\":\n\t\t\t\t\tif len(splitO) != 2 {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"gid option must provide a GID: %w\", define.ErrInvalidArg)\n\t\t\t\t\t}\n\t\t\t\t\tintGID, err := strconv.Atoi(splitO[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"cannot convert GID %s to integer: %w\", splitO[1], err)\n\t\t\t\t\t}\n\t\t\t\t\tlogrus.Debugf(\"Removing gid= from options and adding WithVolumeGID for GID %d\", intGID)\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeGID(intGID), libpod.WithVolumeNoChown())\n\t\t\t\t\tfinalVal = append(finalVal, o)\n\t\t\t\t\t// set option \"GID\": \"$gid\"\n\t\t\t\t\tvolumeOptions[\"GID\"] = splitO[1]\n\t\t\t\tcase \"noquota\":\n\t\t\t\t\tlogrus.Debugf(\"Removing noquota from options and adding WithVolumeDisableQuota\")\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeDisableQuota())\n\t\t\t\t\t// set option \"NOQUOTA\": \"true\"\n\t\t\t\t\tvolumeOptions[\"NOQUOTA\"] = \"true\"\n\t\t\t\tcase \"timeout\":\n\t\t\t\t\tif len(splitO) != 2 {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"timeout option must provide a valid timeout in seconds: %w\", define.ErrInvalidArg)\n\t\t\t\t\t}\n\t\t\t\t\tintTimeout, err := strconv.Atoi(splitO[1])\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"cannot convert Timeout %s to an integer: %w\", splitO[1], err)\n\t\t\t\t\t}\n\t\t\t\t\tif intTimeout < 0 {\n\t\t\t\t\t\treturn nil, fmt.Errorf(\"volume timeout cannot be negative (got %d)\", intTimeout)\n\t\t\t\t\t}\n\t\t\t\t\tlogrus.Debugf(\"Removing timeout from options and adding WithTimeout for Timeout %d\", intTimeout)\n\t\t\t\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeDriverTimeout(uint(intTimeout)))\n\t\t\t\tdefault:\n\t\t\t\t\tfinalVal = append(finalVal, o)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif len(finalVal) > 0 {\n\t\t\t\tvolumeOptions[key] = strings.Join(finalVal, \",\")\n\t\t\t}\n\t\tdefault:\n\t\t\tvolumeOptions[key] = value\n\t\t}\n\t}\n\n\tif len(volumeOptions) > 0 {\n\t\tlibpodOptions = append(libpodOptions, libpod.WithVolumeOptions(volumeOptions))\n\t}\n\n\treturn libpodOptions, nil\n}", "title": "" }, { "docid": "aa3aaac655737cdff785d90a863059c9", "score": "0.45163098", "text": "func (o *options) validate() error {\n\tswitch {\n\tcase o.kclient == nil:\n\t\treturn errors.New(\"k8sops client cannot be nil\")\n\tcase o.crdClient == nil:\n\t\treturn errors.New(\"CRD client cannot be nil\")\n\tcase o.kubeClient == nil:\n\t\treturn errors.New(\"kubeclient cannot be nil\")\n\tcase o.kubeInformerFactory == nil:\n\t\treturn errors.New(\"kubeInformerFactory cannot be nil\")\n\tcase o.m3dbClusterInformerFactory == nil:\n\t\treturn errors.New(\"m3dbClusterInformerFactory cannot be nil\")\n\tcase o.podIDProvider == nil:\n\t\treturn errors.New(\"pod ID provider cannot be nil\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8c01567e29d67825f9db29b87433aa81", "score": "0.45153728", "text": "func PossibleLoginModeValues() []LoginMode {\n\treturn []LoginMode{Batch, Interactive}\n}", "title": "" }, { "docid": "8c01567e29d67825f9db29b87433aa81", "score": "0.45153728", "text": "func PossibleLoginModeValues() []LoginMode {\n\treturn []LoginMode{Batch, Interactive}\n}", "title": "" }, { "docid": "f021f01d3cdadcf783075575dd5a5e0b", "score": "0.45129117", "text": "func parseOptions(hours, minutes *int, period *string) {\n\tflagHours := flag.Int(\"h\", 8, \"Hour to wake up\")\n\tflagMinutes := flag.Int(\"m\", 0, \"Minute to wake up in the given hour\")\n\tflagPeriod := flag.String(\"p\", \"am\", \"Period of the day: am/pm\")\n\n\tflag.Parse()\n\n\t*hours = *flagHours\n\t*minutes = *flagMinutes\n\t*period = strings.ToUpper(*flagPeriod)\n\n\tif *period != morning && *period != evening {\n\t\t*period = morning\n\t}\n}", "title": "" }, { "docid": "e935b061e56d5c6a05c45f300afa4ae6", "score": "0.45108277", "text": "func createValueMap(valueMap map[string]interface{}, values []string, stringValues []string) (map[string]interface{}, error) {\n\tvals := make(map[string]interface{})\n\n\tif valueMap != nil {\n\t\tfor k, v := range valueMap {\n\t\t\tvals[k] = v\n\t\t}\n\t}\n\n\t// User specified a value via --value\n\tfor _, value := range values {\n\t\tif err := strvals.ParseInto(value, vals); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed parsing --value data: %s\", err)\n\t\t}\n\t}\n\n\t// User specified a value via --string-value\n\tfor _, value := range stringValues {\n\t\tif err := strvals.ParseIntoString(value, vals); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed parsing --string-value data: %s\", err)\n\t\t}\n\t}\n\n\treturn map[string]interface{}{\n\t\t\"values\": vals,\n\t}, nil\n}", "title": "" }, { "docid": "251f04c5e79d0ef6f11743e5e2d439bf", "score": "0.45082635", "text": "func (opts SetOpts) ToACLSetMap() (map[string]interface{}, error) {\n\tb := make(map[string]interface{})\n\tfor _, v := range opts {\n\t\tm, err := gophercloud.BuildRequestBody(v, v.Type)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb[v.Type] = m[v.Type]\n\t}\n\treturn b, nil\n}", "title": "" }, { "docid": "f5aa8318bc57d7390e4d2f1d24a5810c", "score": "0.45081562", "text": "func createValidParametersMap(endPointStruct interface{}, disabledParameters ...string) map[string]reflect.Kind {\n\tvalidParametersMap := make(map[string]reflect.Kind)\n\ttyp := reflect.TypeOf(endPointStruct)\n\tval := reflect.ValueOf(endPointStruct)\n\tif typ.Kind() == reflect.Ptr {\n\t\ttyp = typ.Elem()\n\t\tval = val.Elem()\n\t}\n\tfor i := 0; i < typ.NumField(); i++ {\n\t\tfield := typ.Field(i)\n\n\t\tfieldName := getFieldNameFromTag(field.Tag)\n\t\tif len(fieldName) == 0 {\n\t\t\t// mgo driver converts field names to lower case\n\t\t\tfieldName = strings.ToLower(field.Name)\n\t\t}\n\t\tif field.Type.Kind() == reflect.Struct {\n\t\t\tif field.Type == reflect.TypeOf(time.Time{}) && !contains(disabledParameters, fieldName) {\n\t\t\t\tvalidParametersMap[fieldName] = field.Type.Kind()\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor k, v := range createValidParametersMap(val.Field(i).Interface(), disabledParameters...) {\n\t\t\t\tvalidParametersMap[k] = v\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tif field.Type.Kind() == reflect.Slice && !contains(disabledParameters, fieldName) {\n\t\t\tvalidParametersMap[fieldName] = field.Type.Elem().Kind()\n\t\t\tcontinue\n\t\t}\n\t\tif !contains(disabledParameters, fieldName) {\n\t\t\tvalidParametersMap[fieldName] = field.Type.Kind()\n\t\t}\n\t}\n\n\tfor k, v := range validMetaParameters {\n\t\tif !contains(disabledParameters, k) {\n\t\t\tvalidParametersMap[k] = v\n\t\t}\n\t}\n\n\treturn validParametersMap\n}", "title": "" }, { "docid": "328cc48bd3ee5a3d077e83c003af5288", "score": "0.45064428", "text": "func enterFlags() (string,string,string) {\n\n\tDbName := flag.String(\"database\", \"Prevoz_Mk\", \"the name of you database\")\n\n\tUserName := flag.String(\"username\", \"root\", \"the username to make a connection to the database\")\n\n\tPassword := flag.String(\"password\", \"12345\", \"the password for your username to make a conection to the database\")\n\n\tflag.Parse()\n\n\treturn *DbName,*UserName,*Password\n}", "title": "" }, { "docid": "730b5816d74c5f10a239bc2bac6ed7d1", "score": "0.45009202", "text": "func (s GlobalFiftyOneDegreesOptions) Diff(t GlobalFiftyOneDegreesOptions, opts ...Options) map[string][]interface{} {\n\tdiff := make(map[string][]interface{})\n\tif s.CacheSize != t.CacheSize {\n\t\tdiff[\"CacheSize\"] = []interface{}{s.CacheSize, t.CacheSize}\n\t}\n\n\tif s.DataFile != t.DataFile {\n\t\tdiff[\"DataFile\"] = []interface{}{s.DataFile, t.DataFile}\n\t}\n\n\tif s.PropertyNameList != t.PropertyNameList {\n\t\tdiff[\"PropertyNameList\"] = []interface{}{s.PropertyNameList, t.PropertyNameList}\n\t}\n\n\tif s.PropertySeparator != t.PropertySeparator {\n\t\tdiff[\"PropertySeparator\"] = []interface{}{s.PropertySeparator, t.PropertySeparator}\n\t}\n\n\treturn diff\n}", "title": "" }, { "docid": "247dc34d14a4ac5b81384db8bd5dc1ec", "score": "0.4497839", "text": "func (self *TraitApplicationCommandLine) GetOptionsDict() (return__ *C.GVariantDict) {\n\treturn__ = C.g_application_command_line_get_options_dict(self.CPointer)\n\treturn\n}", "title": "" }, { "docid": "b7ba4bdf67dd85813d871170bd77315e", "score": "0.44954523", "text": "func TestValidateAccessSettings(t *testing.T) {\n\n\t// Define test data\n\tvar tests = []struct {\n\t\tname string\n\t\tconfig map[string]interface{}\n\t\twant string\n\t}{\n\t\t// Valid\n\t\t{name: \"checkFieldsNotPresent\", config: map[string]interface{}{}, want: \"valid\"},\n\t\t{name: \"checkNoLoginFeature\", config: map[string]interface{}{\"FEATURE_DIRECT_LOGIN\": false}, want: \"invalid\"},\n\t\t{name: \"checkBadAuthType\", config: map[string]interface{}{\"AUTHENTICATION_TYPE\": \"notarealauthtype\"}, want: \"invalid\"},\n\t\t{name: \"checkGithubLogin\", config: map[string]interface{}{\"FEATURE_DIRECT_LOGIN\": false, \"FEATURE_GITHUB_LOGIN\": true}, want: \"valid\"},\n\t\t{name: \"checkGoogleLogin\", config: map[string]interface{}{\"FEATURE_DIRECT_LOGIN\": false, \"FEATURE_GOOGLE_LOGIN\": true}, want: \"valid\"},\n\t\t{name: \"checkOIDC\", config: map[string]interface{}{\"FEATURE_DIRECT_LOGIN\": false, \"FEATURE_GOOGLE_LOGIN\": false, \"AUTH0_LOGIN_CONFIG\": map[string]interface{}{}}, want: \"valid\"},\n\t\t{name: \"checkInviteUser0\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": true, \"FEATURE_INVITE_ONLY_USER_CREATION\": false}, want: \"valid\"},\n\t\t{name: \"checkInviteUser1\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": true, \"FEATURE_INVITE_ONLY_USER_CREATION\": true}, want: \"valid\"},\n\t\t{name: \"checkInviteUser2\", config: map[string]interface{}{\"FEATURE_INVITE_ONLY_USER_CREATION\": true}, want: \"valid\"},\n\t\t{name: \"checkInviteUser3\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": false, \"FEATURE_INVITE_ONLY_USER_CREATION\": true}, want: \"invalid\"},\n\t\t{name: \"checkInviteUser4\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": false, \"FEATURE_INVITE_ONLY_USER_CREATION\": false}, want: \"valid\"},\n\t\t{name: \"checkIncorrectPattern\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": false, \"FEATURE_INVITE_ONLY_USER_CREATION\": false, \"USER_RECOVERY_TOKEN_LIFETIME\": \"badpattern\"}, want: \"invalid\"},\n\t\t{name: \"checkCorrectPattern\", config: map[string]interface{}{\"FEATURE_USER_CREATION\": false, \"FEATURE_INVITE_ONLY_USER_CREATION\": false, \"USER_RECOVERY_TOKEN_LIFETIME\": \"1m\"}, want: \"valid\"},\n\t}\n\n\t// Iterate through tests\n\tfor _, tt := range tests {\n\n\t\t// Run specific test\n\t\tt.Run(tt.name, func(t *testing.T) {\n\n\t\t\t// Get validation result\n\t\t\tfg, err := NewAccessSettingsFieldGroup(tt.config)\n\t\t\tif err != nil && tt.want != \"typeError\" {\n\t\t\t\tt.Errorf(\"Expected %s. Received %s\", tt.want, err.Error())\n\t\t\t}\n\n\t\t\topts := shared.Options{\n\t\t\t\tMode: \"testing\",\n\t\t\t}\n\n\t\t\tvalidationErrors := fg.Validate(opts)\n\n\t\t\t// Get result type\n\t\t\treceived := \"\"\n\t\t\tif len(validationErrors) == 0 {\n\t\t\t\treceived = \"valid\"\n\t\t\t} else {\n\t\t\t\treceived = \"invalid\"\n\t\t\t}\n\n\t\t\t// Compare with expected\n\t\t\tif tt.want != received {\n\t\t\t\tt.Errorf(\"Expected %s. Received %s\", tt.want, received)\n\t\t\t}\n\n\t\t})\n\t}\n\n}", "title": "" }, { "docid": "7bb4175a622c4df001718bb6a2182ced", "score": "0.44950572", "text": "func (u *AddUserPreferenceValidation) Valid(v *validation.Validation) {\n\tfor _, preference := range u.Preferences{\n\t\tif preference == 0{\n\t\t\tv.SetError(\"Preferences\", \"Minimum 3 preferences is required.\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "768f77eeaff2b507bbfc279c8628e933", "score": "0.44902214", "text": "func extractPredefinedHelpStrings(g prometheus.Gatherer) (map[string]string, error) {\n\tif g == nil {\n\t\treturn nil, nil\n\t}\n\tmfs, err := g.Gather()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := map[string]string{}\n\tfor _, mf := range mfs {\n\t\tresult[mf.GetName()] = mf.GetHelp()\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "768f77eeaff2b507bbfc279c8628e933", "score": "0.44902214", "text": "func extractPredefinedHelpStrings(g prometheus.Gatherer) (map[string]string, error) {\n\tif g == nil {\n\t\treturn nil, nil\n\t}\n\tmfs, err := g.Gather()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult := map[string]string{}\n\tfor _, mf := range mfs {\n\t\tresult[mf.GetName()] = mf.GetHelp()\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "1166d91cd91b63a3d17e97ac1572926f", "score": "0.4488267", "text": "func (o *Options) validateFlags() error {\n\tif err := o.validateProfile(); err != nil {\n\t\treturn err\n\t}\n\tif err := o.validateSource(); err != nil {\n\t\treturn err\n\t}\n\tif err := o.validateTLSCertAndKey(); err != nil {\n\t\treturn err\n\t}\n\treturn o.validateTimeout()\n}", "title": "" }, { "docid": "88fcea2c8af1e6187b452da78ddea8fe", "score": "0.4483535", "text": "func s_client_options(opts ...string) []string {\n\tvar (\n\t\tciphers = \"notpresent\"\n\t\ttls13Ciphers = \"notpresent\"\n\t\trxCipher = regexp.MustCompile(`\\s-cipher\\s+(.+)\\s`)\n\t\trxCipherSuites = regexp.MustCompile(`\\s-ciphersuites\\s+(.+)\\s`)\n\t\trxSsl2Ssl3 = regexp.MustCompile(`\\s-ssl[23]\\s`)\n\t\trxTls1dot123 = regexp.MustCompile(`\\s-tls1_[123]\\s`)\n\t)\n\n\toptions := strings.Join(opts, \" \")\n\n\t// Extract the TLSv1.3 ciphers and the non-TLSv1.3 ciphers\n\tif matches := rxCipher.FindStringSubmatch(options); matches != nil {\n\t\tciphers = \"'\" + matches[1] + \"'\"\n\t}\n\n\tif matches := rxCipherSuites.FindStringSubmatch(options); matches != nil {\n\t\ttls13Ciphers = \"'\" + matches[1] + \"'\"\n\t\tif tls13Ciphers == \"ALL\" {\n\t\t\ttls13Ciphers = TLS13_OSSL_CIPHERS\n\t\t}\n\t}\n\n\t// Don't include the -servername option for an SSLv2 or SSLv3 ClientHello.\n\tif SNI != \"\" && rxSsl2Ssl3.MatchString(options) {\n\t\tstrings.Replace(options, SNI, \"\", -1)\n\t}\n\n\t// The server_name extension should not be included in the ClientHello unless\n\t// the -servername option is provided. However, OpenSSL 1.1.1 will include the\n\t// server_name extension unless the -noservername option is provided. So, if\n\t// the command line doesn't include -servername and the -noservername option is\n\t// supported, then add -noservername to the options.\n\tif Meta.HasNoServerName && !strings.Contains(options, \" -servername \") {\n\t\toptions += \" -noservername\"\n\t}\n\n\t// Newer versions of OpenSSL have dropped support for the -no_ssl2 option, so\n\t// remove any -no_ssl2 option if the option isn't supported. (Since versions of\n\t// OpenSSL that don't support -no_ssl2 also don't support SSLv2, the option\n\t// isn't needed for these versions of OpenSSL.)\n\tif !Meta.HasNoSsl2 {\n\t\tstrings.Replace(options, \"-no_ssl2\", \"\", -1)\n\t}\n\n\t// At least one server will fail under some circumstances if compression methods are offered.\n\t// So, only offer compression methods if necessary for the test. In OpenSSL 1.1.0 and\n\t// 1.1.1 compression is only offered if the \"-comp\" option is provided.\n\t// OpenSSL 1.0.0, 1.0.1, and 1.0.2 offer compression unless the \"-no_comp\" option is provided.\n\t// OpenSSL 0.9.8 does not support either the \"-comp\" or the \"-no_comp\" option.\n\tif strings.Contains(options, \" -comp \") {\n\t\t// Compression is needed for the test. So, remove \"-comp\" if it isn't supported, but\n\t\t// otherwise make no changes.\n\t\tif ! Meta.HasComp {\n\t\t\tstrings.Replace(options, \"-comp\", \"\", -1)\n\t\t}\n\t} else {\n\t\t// Compression is not needed. So, specify \"-no_comp\" if that option is supported.\n\t\tif Meta.HasNoComp {\n\t\t\toptions += \" -no_comp\"\n\t\t}\n\t}\n\n\t// If $OPENSSL is compiled with TLSv1.3 support and s_client is called without\n\t// specifying a protocol, but specifying a list of ciphers that doesn't include\n\t// any TLSv1.3 ciphers, then the command will always fail. So, if $OPENSSL supports\n\t// TLSv1.3 and a cipher list is provided, but no protocol is speci}ed, then add\n\t// -no_tls1_3 if no TLSv1.3 ciphers are provided.\n\tif Meta.HasTls13 && ciphers != \"notpresent\" &&\n\t\t(tls13Ciphers == \"notpresent\" || tls13Ciphers == \"\") &&\n\t\t!rxSsl2Ssl3.MatchString(options) &&\n\t\t!strings.Contains(options, \"-tls1\") &&\n\t\t!rxTls1dot123.MatchString(options) {\n\t\toptions += \" -no_tls1_3\"\n\t}\n\n\tif ciphers != \"notpresent\" || tls13Ciphers != \"notpresent\" {\n\t\tif ! Meta.HasCipherSuites {\n\t\t\tif ciphers == \"notpresent\" {\n\t\t\t\tciphers = \"\"\n\t\t\t}\n\t\t\tif tls13Ciphers == \"notpresent\" {\n\t\t\t\ttls13Ciphers = \"\"\n\t\t\t}\n\t\t\tif ciphers != \"\" && tls13Ciphers != \"\" {\n\t\t\t\tciphers = \":\" + ciphers\n\t\t\t}\n\t\t\tciphers = \"$tls13_ciphers$ciphers\"\n\t\t\toptions += \" -cipher $ciphers\"\n\t\t} else if ciphers != \"notpresent\" && ciphers != \"\" {\n\t\t\toptions += \" -cipher $ciphers\"\n\t\t}\n\t\tif tls13Ciphers != \"notpresent\" && tls13Ciphers != \"\" {\n\t\t\toptions += \" -ciphersuites $tls13_ciphers\"\n\t\t}\n\t}\n\n\treturn strings.Fields(options)\n}", "title": "" }, { "docid": "eb2097c49b24653bfb45a6f7219dacf7", "score": "0.44608453", "text": "func parseFlags(c *cli.Context) (bool, string, string, string, bool) {\n\tcurrent_cluster := false\n\tcluster := \"\"\n\taws_region := \"\"\n\tif c.String(\"c\") == \"\" {\n\t\tcurrent_cluster = true\n\t} else {\n\t\tcluster = c.String(\"c\")\n\t\tif c.String(\"r\") == \"\" {\n\t\t\tfmt.Printf(\"Error: If Cluster (-c) is specified, AWS Region (-r) is also required. Cannot proceed.\\n\\n\")\n\t\t\tcli.ShowAppHelp(c)\n\t\t\tos.Exit(1)\n\t\t}\n\t\taws_region = c.String(\"r\")\n\t}\n\tif c.String(\"s\") == \"\" {\n\t\tfmt.Printf(\"Error: Service (-s) must not be empty. Cannot proceed.\\n\\n\")\n\t\tcli.ShowAppHelp(c)\n\t\tos.Exit(1)\n\t}\n\treturn current_cluster, aws_region, cluster, c.String(\"s\"), c.Bool(\"d\")\n}", "title": "" }, { "docid": "f313c0d35ab58aff521821f69af755c3", "score": "0.445838", "text": "func getDriverOpts(ctx *cli.Context) rpcDriver.DriverOptions {\n\tdriverOptions := rpcDriver.DriverOptions{\n\t\tBoolOptions: make(map[string]bool),\n\t\tStringOptions: make(map[string]string),\n\t\tIntOptions: make(map[string]int64),\n\t\tStringSliceOptions: make(map[string]*rpcDriver.StringSlice),\n\t}\n\tfor _, flag := range ctx.Command.Flags {\n\t\tswitch flag.(type) {\n\t\tcase cli.StringFlag:\n\t\t\tdriverOptions.StringOptions[flag.GetName()] = ctx.String(flag.GetName())\n\t\tcase cli.BoolFlag:\n\t\t\tdriverOptions.BoolOptions[flag.GetName()] = ctx.Bool(flag.GetName())\n\t\tcase cli.Int64Flag:\n\t\t\tdriverOptions.IntOptions[flag.GetName()] = ctx.Int64(flag.GetName())\n\t\tcase cli.StringSliceFlag:\n\t\t\tdriverOptions.StringSliceOptions[flag.GetName()] = &rpcDriver.StringSlice{\n\t\t\t\tValue: ctx.StringSlice(flag.GetName()),\n\t\t\t}\n\t\t}\n\t}\n\treturn driverOptions\n}", "title": "" }, { "docid": "5f69b740fee095191c2e6a98b23f3582", "score": "0.44513363", "text": "func parseFlags() {\n\t// Parse command line\n\tflag.StringVar(&opt.clientID, \"id\", \"\", \"Client ID\")\n\tflag.StringVar(&opt.clientSecret, \"secret\", \"\", \"Client Secret\")\n\tflag.StringVar(&opt.code, \"code\", \"\", \"Authorization Code\")\n\tflag.BoolVar(&opt.dryrun, \"dry-run\", defaultOptDryRun, \"Dry-run mode\")\n\tflag.BoolVar(&opt.dryrun, \"n\", defaultOptDryRun, \"Dry-run mode (shorthand)\")\n\tflag.BoolVar(&opt.inplace, \"inplace\", false, \"Upload files in place (faster, but may leave incomplete files behind if program dies)\")\n\tflag.Var(&opt.exclude, \"exclude\", \"List of paths to exclude (glob)\")\n\tflag.Var(&opt.verbose, \"verbose\", \"Verbose mode (use multiple times to increase level)\")\n\tflag.Var(&opt.verbose, \"v\", \"Verbose mode (use multiple times to increase level)\")\n\tflag.Parse()\n}", "title": "" }, { "docid": "9091fdb937dd440eb15f1a6bcb3191c3", "score": "0.4441703", "text": "func validateLogfmtConfig(c *LogfmtConfig) (map[string]string, error) {\n\tif c == nil {\n\t\treturn nil, ErrEmptyLogfmtStageConfig\n\t}\n\n\tif len(c.Mapping) == 0 {\n\t\treturn nil, ErrMappingRequired\n\t}\n\n\tinverseMapping := make(map[string]string)\n\tfor k, v := range c.Mapping {\n\t\t// if value is not set, use the key for setting data in extracted map.\n\t\tif v == \"\" {\n\t\t\tv = k\n\t\t}\n\t\tinverseMapping[v] = k\n\t}\n\n\treturn inverseMapping, nil\n}", "title": "" }, { "docid": "be5a101723c1dbff0c2df64e87193686", "score": "0.44337058", "text": "func CheckUserInput() (map[string]string, error) {\n\n\tif len(os.Args) < 2 {\n\t\tusage()\n\t\tmsg := \"add or delete sub command is required\"\n\t\treturn nil, errors.New(msg)\n\t}\n\n\tinput := map[string]string{}\n\tinput[\"url\"] = os.Getenv(\"PDNS_URL\")\n\tinput[\"apikey\"] = os.Getenv(\"PDNS_APIKEY\")\n\tinput[\"apipasswd\"] = os.Getenv(\"PDNS_APIPASSWD\")\n\n\tif input[\"url\"] == \"\" || input[\"apikey\"] == \"\" || input[\"apipasswd\"] == \"\" {\n\t\tusage()\n\t\tmsg := \"PDNS_URL, PDNS_APIKEY & PDNS_APIPASSWD need to set as environmental variables\"\n\t\treturn nil, errors.New(msg)\n\t}\n\n\tcreateCommand := flag.NewFlagSet(createArg, flag.ExitOnError)\n\tdomainPtr := createCommand.String(\"domain\", \"\", \"Domain where the record is to be modified e.g. example.org\")\n\trecordPtr := createCommand.String(\"record\", \"\", \" The record to add to the domain e.g. demo.example.org\")\n\tttlPtr := createCommand.String(\"ttl\", \"\", \"DNS ttl in seconds to set e.g. 3600\")\n\tipPtr := createCommand.String(\"ip\", \"\", \"The ip to assign to the record\")\n\tdeleteCommand := flag.NewFlagSet(deleteArg, flag.ExitOnError)\n\tdeleteDomainPtr := deleteCommand.String(\"domain\", \"\", \"Domain where the record is to be deleted e.g. example.org\")\n\tdeleteRecordPtr := deleteCommand.String(\"record\", \"\", \" The record to remove from the domain e.g. demo.example.org\")\n\n\tswitch os.Args[1] {\n\tcase createArg:\n\t\terr := createCommand.Parse(os.Args[2:])\n\t\tLogErr(err)\n\tcase deleteArg:\n\t\terr := deleteCommand.Parse(os.Args[2:])\n\t\tLogErr(err)\n\tdefault:\n\t\tusage()\n\t\tos.Exit(1)\n\t}\n\n\tif createCommand.Parsed() {\n\t\tif *domainPtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"domain needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"domain\"] = *domainPtr\n\t\tif *recordPtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"record needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"record\"] = *recordPtr + \".\" + input[\"domain\"] + \".\"\n\t\tif *ttlPtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"ttl needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"ttl\"] = *ttlPtr\n\t\tif *ipPtr == \"\" {\n\t\t\tcreateCommand.PrintDefaults()\n\t\t\tmsg := \"ttl needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"ip\"] = *ipPtr\n\t\tinput[\"action\"] = \"add\"\n\t}\n\tif deleteCommand.Parsed() {\n\t\tif *deleteDomainPtr == \"\" {\n\t\t\tdeleteCommand.PrintDefaults()\n\t\t\tmsg := \"domain needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"domain\"] = *deleteDomainPtr\n\t\tif *deleteRecordPtr == \"\" {\n\t\t\tdeleteCommand.PrintDefaults()\n\t\t\tmsg := \"record needs to be provided\"\n\t\t\treturn nil, errors.New(msg)\n\t\t}\n\t\tinput[\"record\"] = *deleteRecordPtr + \".\" + input[\"domain\"] + \".\"\n\t\tinput[\"action\"] = \"delete\"\n\t}\n\n\treturn input, nil\n\n}", "title": "" }, { "docid": "f537f630e4d9cb3919b13065ad6d22cc", "score": "0.44313762", "text": "func (m Options) Validate(formats strfmt.Registry) error {\n\treturn nil\n}", "title": "" }, { "docid": "0ad3d26d4f8e6f8124d3285e6678a795", "score": "0.44294268", "text": "func SmbValidation(optSlice []string, optMap map[string]bool) error {\n // Check various options based on slice length.\n if len(optSlice) == 1 {\n switch optSlice[0] {\n case kMountOptionHard:\n fallthrough\n case kMountOptionSoft:\n // Check and record for mutally exclusive options.\n if optMap[kMountOptionType] == true {\n return errors.New(\"Mutually exclusive options set\")\n }\n optMap[kMountOptionType] = true\n break\n default:\n return errors.New(\"Invalid option\")\n }\n } else if len(optSlice) == 2 {\n switch optSlice[0] {\n case kMountOptionSmbVers:\n // Check for validity of value (an integer)\n if _, err := strconv.ParseInt(optSlice[1], 10, 64); err != nil {\n return errors.New(\"Invalid value (expected integer)\")\n }\n break\n case kMountOptionUsername:\n break\n case kMountOptionPassword:\n break\n case kMountOptionUid:\n break\n case kMountOptionGid:\n break\n default:\n return errors.New(\"Invalid option\")\n }\n }\n\n // Remember the option that was just checked.\n optMap[optSlice[0]] = true\n return nil\n}", "title": "" }, { "docid": "4695da02a8fec0492631356bc12c8e65", "score": "0.4424511", "text": "func getMethodsMap(methodsStr string) map[string]bool {\n\tresult := map[string]bool{}\n\tif methodsStr == \"\" {\n\t\tgenerators.Each(func(gen Generator) {\n\t\t\tresult[gen.name] = true\n\t\t})\n\t\treturn result\n\t}\n\n\tvalidMethods := map[string]bool{}\n\tgenerators.Each(func(gen Generator) {\n\t\tvalidMethods[gen.name] = true\n\t})\n\n\tfor _, method := range strings.Split(methodsStr, \",\") {\n\t\tif _, ok := validMethods[method]; ok {\n\t\t\tresult[method] = true\n\t\t} else {\n\t\t\tlog.Fatalf(\"Error: -method parameter '%s' is not valid\", method)\n\t\t}\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "310cf15b52dfbe350206c2c7389de48c", "score": "0.44035533", "text": "func GetTagsMap(flagValue string) (map[string]*string, error) {\n\ttags := make(map[string]*string)\n\tkeyValPairs := strings.Split(flagValue, \",\")\n\tfor _, pair := range keyValPairs {\n\t\tsplit := strings.SplitN(pair, \"=\", 2)\n\t\tif len(split) != 2 {\n\t\t\treturn nil, fmt.Errorf(\"Tag input not formatted correctly: %s\", pair)\n\t\t}\n\t\ttags[split[0]] = aws.String(split[1])\n\t}\n\treturn tags, nil\n}", "title": "" }, { "docid": "a5d60bd510b7413e368b1c407a760a17", "score": "0.43879405", "text": "func QueryOptions(\n\tws WriteScanner,\n\tquestion string,\n\tDefault rune,\n\toptions ...Opt,\n) (answer rune, err error) {\n\t// need this because scan can panic if you send it too much stuff\n\tdefer func() {\n\t\tpanicErr := recover()\n\t\tif panicErr == nil {\n\t\t\treturn\n\t\t}\n\t\tif e, ok := panicErr.(error); ok {\n\t\t\terr = e\n\t\t\treturn\n\t\t}\n\t\terr = fmt.Errorf(\"%v\", panicErr)\n\t}()\n\n\t_, err = io.WriteString(ws, question)\n\tif err != nil {\n\t\treturn utf8.RuneError, err\n\t}\n\tif !strings.HasSuffix(question, \"\\n\") {\n\t\t_, err := io.WriteString(ws, \"\\n\")\n\t\tif err != nil {\n\t\t\treturn utf8.RuneError, err\n\t\t}\n\t}\n\tfor _, opt := range options {\n\t\tif opt.Key == Default {\n\t\t\t_, err = fmt.Fprintf(ws, \"%c - %s (default)\\n\", opt.Key, opt.Text)\n\t\t\tif err != nil {\n\t\t\t\treturn utf8.RuneError, err\n\t\t\t}\n\t\t} else {\n\t\t\t_, err = fmt.Fprintf(ws, \"%c - %s\\n\", opt.Key, opt.Text)\n\t\t\tif err != nil {\n\t\t\t\treturn utf8.RuneError, err\n\t\t\t}\n\t\t}\n\t}\n\n\tfor {\n\t\t_, err := io.WriteString(ws, \"\\nPlease choose one of the options above: \")\n\t\tif err != nil {\n\t\t\treturn utf8.RuneError, err\n\t\t}\n\t\tif !ws.Scan() {\n\t\t\tif err = ws.Err(); err != nil {\n\t\t\t\treturn utf8.RuneError, err\n\t\t\t}\n\t\t\treturn utf8.RuneError, fmt.Errorf(\"Connection closed\")\n\t\t}\n\t\tb := ws.Bytes()\n\t\tif len(b) == 0 {\n\t\t\tif Default != 0 {\n\t\t\t\treturn Default, nil\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tr, _ := utf8.DecodeRune(b)\n\t\tif r == utf8.RuneError {\n\t\t\tcontinue\n\t\t}\n\t\tfor _, o := range options {\n\t\t\tif r == o.Key {\n\t\t\t\treturn r, nil\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "82d93f411f99decf7f4580b86c15b010", "score": "0.43849853", "text": "func mapToFlags(params map[string]string) []string {\n\targs := make([]string, 0, len(params))\n\tfor key, value := range params {\n\t\tif value == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\targs = append(args, fmt.Sprintf(\"--%s=%s\", key, value))\n\t}\n\treturn args\n}", "title": "" }, { "docid": "24868e66cd4bb78db3d3f6e32951b582", "score": "0.43848687", "text": "func validateServeOpts(cmd *cobra.Command, args []string) error {\n\tcaPair := 0\n\tif serveOpts.caCrtFile != \"\" && serveOpts.caKeyFile != \"\" {\n\t\tcaPair++\n\t}\n\tif serveOpts.mCACrtFile != \"\" && serveOpts.mCAKeyFile != \"\" {\n\t\tcaPair++\n\t}\n\tif caPair == 0 {\n\t\treturn errors.New(\"no signer CA flags passed one cert/key pair is required\")\n\t}\n\n\tif cl, kl := len(serveOpts.sCrtFiles), len(serveOpts.sKeyFiles); cl == 0 || kl == 0 {\n\t\treturn errors.New(\"at least one pair of --servcrt and --servkey is required\")\n\t} else if cl != kl {\n\t\treturn fmt.Errorf(\"%d --servercrt does not match %d --servkey\", cl, kl)\n\t}\n\tif serveOpts.csrDir == \"\" {\n\t\treturn errors.New(\"missing required flag: --csrdir\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "243746a9fb260575f9fac2e441337282", "score": "0.4381348", "text": "func (o *Options) Values() map[string]interface{} {\n\treturn map[string]interface{}{\n\t\t\"route\": map[string]interface{}{\n\t\t\t\"pod\": map[string]interface{}{\n\t\t\t\t\"extraArgs\": []interface{}{\n\t\t\t\t\t\"--route.vxlan-vtep-port=5050\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\n\t\t\"openshiftConfig\": map[string]interface{}{\n\t\t\t\"enable\": true,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "8d0856b2951a5f0f0aedd9e4f61c5af1", "score": "0.43796706", "text": "func getServiceStatesMap(serviceState []string) map[string]string {\n\tvar serviceStatesMap = make(map[string]string)\n\tfor _, value := range serviceState {\n\t\t// --service-state flag is formatted \"name=value\", split on the \"=\" and return a map of the values.\n\t\tsplitServiceState := strings.Split(value, \"=\")\n\t\tserviceStatesMap[splitServiceState[0]] = splitServiceState[1]\n\t}\n\treturn serviceStatesMap\n}", "title": "" }, { "docid": "3d50ffb46772e2590638b8d7c375a7e3", "score": "0.43786833", "text": "func berthaUUIDmap() map[string]string {\n\treturn map[string]string{\n\t\t\"QnJhbmRzXzE4-QnJhbmRz\": \"6773e864-78ab-4051-abc2-f4e9ab423ebb\",\n\t\t\"ZDIyZjNlOWQtZDNlMy00Yzk4LTkwOTctNzFiYjc5ZjNjYTkw-QnJhbmRz\": \"164d0c3b-8a5a-4163-9519-96b57ed159bf\",\n\t\t\"YmE1NjE5NjMtNWUzOC00MGVlLWJjNjEtYjY5NmMzYTA1MDBk-QnJhbmRz\": \"806d05b8-3d29-4e81-8668-e9cdae0ab086\",\n\t\t\"QnJhbmRzXzg2-QnJhbmRz\": \"fd4459b2-cc4e-4ec8-9853-c5238eb860fb\",\n\t\t\"QnJhbmRzXzIwOA==-QnJhbmRz\": \"5e5dba2b-8031-4a65-b193-84a58882c62e\",\n\t\t\"ZDkyYTVhMzYtYjAyOS00OWI1LWI5ZTgtM2QyYTIzYjk4Y2Jj-QnJhbmRz\": \"89d15f70-640d-11e4-9803-0800200c9a66\",\n\t\t\"N2I3NDY4ODktYTRjMC00NWNkLTgwZDEtNjgyMTgzM2Q2MmZl-QnJhbmRz\": \"0cfee514-db0b-4474-b7a6-bf4db16a1380\",\n\t\t\"ZDIzYmQzNjgtYzAzMS00MDg3LTg3MTEtMDUyZTZkZTkzMTc4-QnJhbmRz\": \"3a37a89e-14ce-4ac8-af12-961a9630dce3\",\n\t\t\"NDdkYzA2MzgtNzczNS00OGMxLWFhNjgtMjI0YWU0MzkyNmJh-QnJhbmRz\": \"cfc05027-a3fa-472a-a14b-fa2506df665f\",\n\t\t\"YmRhODE3ODMtMTYzZi00NDdjLTg5MmUtY2E2ZGQ5ZTA2NDJh-QnJhbmRz\": \"13006c72-7d1b-47a0-96fe-d1ad1f12de9f\",\n\t\t\"MGY2ZTQ3MTYtYjJiNS00ODVhLTlkYTktNzZlNzc3YTcxOWYy-QnJhbmRz\": \"b8513403-7892-4901-bb97-1765fc0ba190\",\n\t\t\"MGM0NTAxM2YtOWIwNS00ODhkLWI0NTgtMTgzMjJjNzUyNTVj-QnJhbmRz\": \"2f5d019b-9aa4-43bb-b204-c7437bf0f031\",\n\t\t\"NTQ2MGRhM2UtMGNlOC00NDBjLTgyNWEtY2VmMWZkMjk5NDdk-QnJhbmRz\": \"cd5e45bd-707a-47e9-a478-b18c02ef685f\",\n\t\t\"Yjg0NDNlODEtNjc1YS00ZWU1LWE2MzUtOTA5MDIyNjhhMzQw-QnJhbmRz\": \"8348b79b-5665-409c-8696-6904f9a26fc6\",\n\t\t\"MmYyZGMzZmQtNmMzZi00OTQ1LThlMmQtZDI0OGU2ZDk2N2M0-QnJhbmRz\": \"b4fac748-a2b1-4b7d-8e1f-03ba743ff717\",\n\t\t\"MjI0Zjk2YzctZmFiYS00YWY2LWEzZjktZjgxOWU0ODE1YWUz-QnJhbmRz\": \"72349b8e-1cac-45b4-89df-a1afb55b782e\",\n\t\t\"MWM5NjVlYTYtZGUyMy00NjUwLWEwNWMtYTIwMDJjMTcwMTYw-QnJhbmRz\": \"e363dfb8-f6d9-4f2c-beba-5162b334272b\",\n\t\t\"YzhlNzZkYTctMDJiNy00NTViLTk3NmYtNmJjYTE5NDEyM2Yw-QnJhbmRz\": \"2d3e16e0-61cb-4322-8aff-3b01c59f4daa\",\n\t\t\"Y2ZjNGRkNmItMDEzYi00ZTgyLWI4YzYtMjMwODA2OWM2NmU5-QnJhbmRz\": \"e180d0e0-9d13-4212-9696-f86ef197d2bd\",\n\t\t\"NGY0ZGU0MTUtZTczZC00NzNjLWI2NTgtMjAwOTExMDMwZjI0-QnJhbmRz\": \"462507e2-e20a-431d-9648-a9131770b3aa\",\n\t\t\"NWE4ZjU5ZWYtNThjNS00ZjhjLWE5MzEtZTQ3ZjczNjEzY2Jk-QnJhbmRz\": \"556f7ab4-474c-40e9-b7a3-c3af60d34156\",\n\t\t\"ODEwNmQ2NGItOTdlNS00MzBiLThjYmMtMjhiMDhmYjU3YjE2-QnJhbmRz\": \"a98e560a-e5ef-49c4-9af8-2d7419a77c31\",\n\t\t\"N2Y2ZjFlMDgtNjY3OS00NTU5LThjNWMtNWNiYzcwNTQyNmFj-QnJhbmRz\": \"0b8b1a83-5897-408a-9232-821c62afa231\",\n\t\t\"MDVlM2Q2OGMtOWRkZi00NzI5LWJlNjctNzhlYmE1MGE3YzJk-QnJhbmRz\": \"2a2c87f8-eb14-48c2-900f-2cffc2d7c168\",\n\t\t\"QnJhbmRzXzEwOQ==-QnJhbmRz\": \"95d802a1-106a-4393-a143-e39a364b31e6\",\n\t\t\"OTk5ZDY2OTUtZWNlYS00MjA4LWE0ZmUtYmQzNDY4NTUxMTYx-QnJhbmRz\": \"b7564b93-9809-4ecd-9b82-bd2efaeb282f\",\n\t\t\"OTI1YmZiNzgtN2IzMS00NjVjLThiODgtY2EzMmQwOGZkMDFh-QnJhbmRz\": \"51d51df0-a824-4ec7-aa33-faa013c2d3f9\",\n\t\t\"MjQyNGVmODUtYTk3NC00ZWU5LWFhMWUtMjhkYjI3M2ZkZTFm-QnJhbmRz\": \"d56ac153-41e4-4f3d-aec8-14184d7e1048\",\n\t\t\"NGM5MDA1ZWQtZTI3Zi00NWQwLWI3NWItMjMyMGFlNzY4NTFj-QnJhbmRz\": \"c5f12e29-f178-4b37-8a81-e9029d0c2609\",\n\t\t\"YmQ4Y2VlMjQtOGY0OS00NmZjLWE1NWItYjgxNzJiMjhlMTRh-QnJhbmRz\": \"51d51df0-a814-4ec7-aa33-faa013c2d3f9\",\n\t\t\"NDY0OWQ2YjgtMTI0NC00MTk4LTg3OGEtNjFjODFmYzZmZWU1-QnJhbmRz\": \"27142330-e0bb-49c7-91e7-c51648f0ce68\",\n\t\t\"N2NkMjJiYzQtOGI3MC00NTM4LTgzYmYtMTQ3YmJkZGZkODJj-QnJhbmRz\": \"5c21e52f-48f9-3a77-ad36-318163f284be\",\n\t\t\"MjFjOTI0Y2YtNGFlOS00OTMzLWJhMjEtNjBjNjE2YTRhMmJi-QnJhbmRz\": \"7c938825-8c72-3458-b484-54c4d95bf7bd\",\n\t\t\"MWM0NzM0NjEtNjQ0Yi00OGEzLTgxZTgtZWY0NzA5ZDM3ZjU2-QnJhbmRz\": \"6b82551f-f532-3460-aded-07e1dde00103\",\n\t\t\"ZWQzZDQwOWMtNTAzNy00ZjlhLWExZmMtMzRhZjU4ZTVjOWRk-QnJhbmRz\": \"b11c39db-ce7f-3e2a-ba30-4781ef63491e\",\n\t\t\"YzQ5NjY4NjEtNjFkMS00M2Q2LTlmNmQtYzcxMzBkMzc1MTg4-QnJhbmRz\": \"ebd0c569-dd8d-3787-b77e-4db976bcfab1\",\n\t\t\"QnJhbmRzXzIwNA==-QnJhbmRz\": \"ea1da823-3ab2-3b00-805e-2d3c75994e73\",\n\t\t\"ZjJjOTIxN2EtYTg5NS00YTQ0LTkzZmYtZmU2NGM5MTkzNTIx-QnJhbmRz\": \"a54fda40-7fe7-339a-9b83-2d7b964ff3a4\",\n\t\t\"MTg2ZmNhMGEtZmE4MC00Y2VlLWI0YjItNGQ5Njc1NzQ1YjJk-QnJhbmRz\": \"01438770-10b4-343d-97cc-8bd6e27a4fd1\",\n\t\t\"MGY3OTBkZGEtYjIyZC00MDkxLWI1Y2EtZWJlNTVkYzk1YjZh-QnJhbmRz\": \"c24d6335-076a-366a-98e2-500bb26401d6\",\n\t\t\"OGQ0NzZkYTEtZTRjZS00MTNlLTk1MDYtNzFmOWI1YTIxNGNj-QnJhbmRz\": \"e258a9b2-1049-3171-b55c-16cab615c47c\",\n\t\t\"NTlhNzEyMzMtZjBjZi00Y2U1LTg0ODUtZWVjNmEyYmU1NzQ2-QnJhbmRz\": \"5c7592a8-1f0c-11e4-b0cb-b2227cce2b54\",\n\t\t\"ZWQzYjZlYzUtNjQ2Ni00N2VmLWIxZDgtMTY5NTJmZDUyMmM3-QnJhbmRz\": \"ed3b6ec5-6466-47ef-b1d8-16952fd522c7\",\n\t}\n}", "title": "" }, { "docid": "9a238769e81659f9c6c671c73371a3b5", "score": "0.4377257", "text": "func ValidateRequiredCredentials(m map[string]string, keys []string) error {\n\tvar missing []string\n\tfor _, key := range keys {\n\t\tif _, ok := m[key]; !ok {\n\t\t\tmissing = append(missing, key)\n\t\t}\n\t}\n\tif len(missing) > 0 {\n\t\treturn fmt.Errorf(\"missing required credentials: %s\", strings.Join(missing, \", \"))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c880bfc941dceeeb5705ef1b22aed934", "score": "0.4370552", "text": "func defaultOptions(args []string) (json.RawMessage, string, cmn.HexBytes, error) {\n\tpub, secret, err := readOrGenerateKey(args)\n\tif err != nil {\n\t\treturn nil, \"\", nil, err\n\t}\n\topts := fmt.Sprintf(`{\n \"ch_admin\": {\n\t\t\"public_key\": \"%s\",\n\t\t\"entity_name\": \"%s\"\n\t }\n\t}`, hex.EncodeToString(pub.Bytes()), viper.GetString(flagClearingHouseName))\n\treturn json.RawMessage(opts), secret, pub.Address(), nil\n}", "title": "" }, { "docid": "4a69f065b881e42fd4146bbe87b4cfa3", "score": "0.43621114", "text": "func (s *OssutilCommandSuite) TestInvalidOptions(c *C) {\n\tstr := \"-1\"\n\toptions := OptionMapType{OptionTimeout: &str}\n\terr := checkOption(options)\n\tc.Assert(strings.Contains(err.Error(), \"invalid option value of timeout\"), Equals, true)\n\n\tstr = \"xxxx\"\n\toptions = OptionMapType{OptionEncodingType: &str}\n\terr = checkOption(options)\n\tc.Assert(strings.Contains(err.Error(), \"invalid option value of encodingType\"), Equals, true)\n}", "title": "" }, { "docid": "d34d5bfd39e49a359b547238fd7f4003", "score": "0.43559375", "text": "func RequiredFlags() (flags []cli.Flag) {\n\tfor _, flag := range requiredFlags {\n\t\tflags = append(flags, cli.StringFlag{Name: flag})\n\t}\n\treturn\n}", "title": "" }, { "docid": "ea9fd1ee456018b26bf9f3fb5aafc30d", "score": "0.4355519", "text": "func (o *ViewCustomField) GetOptionsOk() (*map[string]interface{}, bool) {\n\tif o == nil || o.Options == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Options, true\n}", "title": "" }, { "docid": "c74a95b4d3be89f9def31f8f9a0f5923", "score": "0.4354373", "text": "func (o *Options) Validate() error {\n\n\to.Name = strings.TrimSpace(o.Name)\n\to.Name = strings.ToLower(o.Name)\n\n\tif o.Name == \"\" {\n\t\treturn errors.New(\"No name provided\")\n\t}\n\n\tif !nameLegal(o.Name) {\n\t\treturn errors.New(\"illegal characters in gamename. Must be a valid go package name\")\n\t}\n\n\tif o.MinNumPlayers != 0 && o.MaxNumPlayers != 0 {\n\t\tif o.MaxNumPlayers < o.MinNumPlayers {\n\t\t\treturn errors.New(\"Max num players less than min\")\n\t\t}\n\n\t\tif o.DefaultNumPlayers != 0 {\n\t\t\tif o.DefaultNumPlayers < o.MinNumPlayers || o.DefaultNumPlayers > o.MaxNumPlayers {\n\t\t\t\treturn errors.New(\"Default num players not within min/max range\")\n\t\t\t}\n\t\t}\n\t}\n\n\t//We don't verify that the name is fully legal according to the boardgame\n\t//framework, because that test will fail given the test generated in\n\t//main_test.go.\n\n\t//Disallow illegal combinations\n\tif o.EnableExampleDynamicComponentValues {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleEndState {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleComputedProperties {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleConstants {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleClient {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleMoves {\n\t\to.EnableExampleDeck = true\n\t}\n\n\tif o.EnableExampleMoves {\n\t\to.SuppressPhase = false\n\t}\n\n\tif o.EnableExampleClient {\n\t\to.SuppressClientRenderGame = false\n\t\to.SuppressClientRenderPlayerInfo = false\n\t}\n\n\tif o.EnableExampleDeck {\n\t\to.SuppressComponentsStubs = false\n\t}\n\n\tif o.EnableInactivePlayer {\n\t\to.EnableSeatPlayer = true\n\t}\n\n\tif o.EnableSeatPlayer {\n\t\to.SuppressPhase = false\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4021330233ee9f062b252b7a7fd016a9", "score": "0.43539923", "text": "func Validate(config interface{}, validators []string, schema string, toValidate map[string]interface{}) (map[string]interface{}, map[string]string) {\n\n\t//fmt.Println(toRequired[\"age\"].(string))\n\n\t//error map\n\t// errorMap := make(map[string]string)\n\n\t//Compare schema and toValidate data\n\t//schema : $schema.user\n\tresources := strings.Split(schema, \".\") //[$schema, user]\n\t// resources[0][1:] :: $schema =>schema\n\t_, tmpToRequired := (getresource.GetResource(config, resources[0][1:], resources[1]))\n\ttoRequired := tmpToRequired.(map[string]interface{})\n\t//data type of schema\n\tdataTypeOfSchema := make(map[string]string)\n\n\tfor field, dType := range toRequired {\n\t\tdataType := dType.(string)\n\t\tif dataType[len(dataType)-1] == '!' {\n\t\t\tdataTypeOfSchema[field] = dataType[:len(dataType)-1]\n\t\t\t//check if required values exists in body\n\t\t\t//todo\n\t\t\terrorMap := checkIfExists(field, toValidate)\n\t\t\tif len(errorMap) != 0 {\n\t\t\t\treturn map[string]interface{}{}, errorMap\n\t\t\t}\n\t\t} else {\n\t\t\tdataTypeOfSchema[field] = dataType\n\t\t}\n\t}\n\n\t// validate type : returns error and updates errorMap\n\thasTypeError, errorMap := ValidateType(toValidate, dataTypeOfSchema)\n\n\tif hasTypeError {\n\t\treturn map[string]interface{}{}, errorMap\n\t}\n\n\t//get all data within schema\n\tdata := make(map[string]interface{})\n\tfor i, v := range toValidate {\n\t\tif _, ok := toRequired[i]; ok {\n\t\t\tdata[i] = v\n\t\t}\n\t}\n\n\thasSchemaError, errorMap := schemaValidation(config, data, validators)\n\tif hasSchemaError {\n\t\treturn data, errorMap\n\t}\n\n\treturn data, map[string]string{}\n}", "title": "" }, { "docid": "0864617dc0e670d030917c78d71933f4", "score": "0.43477985", "text": "func filterByString(str string) (bool, []map[string]string) {\n\tvar flag bool\n\tvar u []map[string]string\n\tfor _, user := range users {\n\t\tfor _, userValue := range user {\n\t\t\tif userValue == str {\n\t\t\t\tflag = true\n\t\t\t\tu = append(u, user)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\treturn flag, u\n}", "title": "" }, { "docid": "47fce09d1464240dea0daf672e0cf795", "score": "0.43470252", "text": "func ExtractOptions(p interface{}) []string {\n\tvar result []string\n\traw := p.([]interface{})\n\n\tfor _, v := range raw {\n\t\tresult = append(result, fmt.Sprintf(\"%v\", v))\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "955304fc57df9198b9bd6c528c6ee5a0", "score": "0.43465614", "text": "func PossibleClientCertModeValues() []ClientCertMode {\n\treturn []ClientCertMode{\n\t\tClientCertModeRequired,\n\t\tClientCertModeOptional,\n\t\tClientCertModeOptionalInteractiveUser,\n\t}\n}", "title": "" }, { "docid": "ffd8a0b8340a4b25c50463c9659d7962", "score": "0.43456876", "text": "func getopts(args []string, optstring string) (parsedOpts, []string, error) {\n\tvar specs []*getopt.OptionSpec\n\tfor i := 0; i < len(optstring); i++ {\n\t\tspec := &getopt.OptionSpec{Short: rune(optstring[i])}\n\t\tif i+1 < len(optstring) && optstring[i+1] == ':' {\n\t\t\tspec.Arity = getopt.RequiredArgument\n\t\t\ti++\n\t\t}\n\t\tspecs = append(specs, spec)\n\t}\n\t// GNU style allows options to be mixed with operands, like \"ls a -l b\",\n\t// whereas BSD style doesn't. POSIX says all options \"should\" precede\n\t// options (12.2 Utility Syntax Guidelines, Guideline 9) - in other words,\n\t// BSD style - but it's not a hard requirement (which would use \"shall\"\n\t// instead).\n\t//\n\t// All of dash, ksh and zsh use the BSD style, while bash uses the GNU\n\t// style. We follow the advice of POSIX as well as the majority.\n\topts, args, err := getopt.Parse(args, specs, getopt.BSD)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tparsed := make(parsedOpts, len(opts))\n\tfor i, opt := range opts {\n\t\tparsed[i] = parsedOpt{byte(opt.Spec.Short), opt.Argument}\n\t}\n\treturn parsed, args, nil\n}", "title": "" }, { "docid": "e84fb564222ed62aa5a0b5a3f1316e1d", "score": "0.43424574", "text": "func (o Options) Validate() error {\n\tif o.InPlace && o.Output != \"\" {\n\t\treturn fmt.Errorf(\"cannot specify both --in-place and --output\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cc87cd6de01e69c6cb91806eb6e18d87", "score": "0.43421325", "text": "func keysFromMap(used map[string]bool) []string {\n\tkeys := make([]string, 0, len(used))\n\tfor k := range used {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" }, { "docid": "cc87cd6de01e69c6cb91806eb6e18d87", "score": "0.43421325", "text": "func keysFromMap(used map[string]bool) []string {\n\tkeys := make([]string, 0, len(used))\n\tfor k := range used {\n\t\tkeys = append(keys, k)\n\t}\n\treturn keys\n}", "title": "" } ]
3856f55f8361092bf670df0239d847af
Deprecated: Use Profile_Control_ResultTotals.ProtoReflect.Descriptor instead.
[ { "docid": "6d03413c3ab4faf304a635acfbd0ef1d", "score": "0.71284443", "text": "func (*Profile_Control_ResultTotals) Descriptor() ([]byte, []int) {\n\treturn file_interservice_notifications_service_events_proto_rawDescGZIP(), []int{2, 0, 1}\n}", "title": "" } ]
[ { "docid": "78bcbc9624d2bd9b0d789ec1ff566d5c", "score": "0.6478163", "text": "func (*Result) Descriptor() ([]byte, []int) {\n\treturn file_internal_services_profile_proto_profile_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "21f870c47d1784989ae20d4183bdb806", "score": "0.6476789", "text": "func (*Profile_Control_Result) Descriptor() ([]byte, []int) {\n\treturn file_interservice_notifications_service_events_proto_rawDescGZIP(), []int{2, 0, 0}\n}", "title": "" }, { "docid": "54f196eaa662c5bc7400713ae6d08e57", "score": "0.6429432", "text": "func (CMsgProfileUpdateResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{278, 0}\n}", "title": "" }, { "docid": "9a98404a14e087eca16556596bf79f5b", "score": "0.6396643", "text": "func (*QueryPlanStatusResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "34f6ff93f8e98f9a2fc4429e78ada8c1", "score": "0.638578", "text": "func (*AddPeerResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "689e5d9521295a4e74f39c6cf6bc0094", "score": "0.6361703", "text": "func (*CMsgPredictionResults_Result) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{177, 1}\n}", "title": "" }, { "docid": "1e74fe27c778160331b97d230aa805cb", "score": "0.63417065", "text": "func (*Profile_ControlTotals) Descriptor() ([]byte, []int) {\n\treturn file_interservice_notifications_service_events_proto_rawDescGZIP(), []int{2, 2}\n}", "title": "" }, { "docid": "23b0616115dc179ed17e91c9db8c2fd4", "score": "0.6323877", "text": "func (*CalculationResult) Descriptor() ([]byte, []int) {\n\treturn file_orc8r_cloud_go_services_analytics_protos_collector_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "04b935a942c5b8e6aaff355d572b1015", "score": "0.6303131", "text": "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "title": "" }, { "docid": "2afe6cd9edaf49fc958d20eb9f2dca94", "score": "0.63029855", "text": "func (*GetMetricsInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "3c783d520f849ef3e942dc0e21448fa5", "score": "0.62788826", "text": "func (*ComplianceFailure_ControlTotals) Descriptor() ([]byte, []int) {\n\treturn file_interservice_notifications_service_events_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "69ae9962c4bd1368b1a4a780e6406da5", "score": "0.62642527", "text": "func (*ReportGetLastServiceResponse_Results) Descriptor() ([]byte, []int) {\n\treturn file_src_report_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "3464cb071f0a438206006f951cad165f", "score": "0.6245962", "text": "func (*GetPeerInfoResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "a584c8b4713fe492d79eb6d2ddccafbc", "score": "0.62098336", "text": "func (*GetStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{45}\n}", "title": "" }, { "docid": "31654e3719fa667acf4e866c60585643", "score": "0.620882", "text": "func (*CMsgPredictionResults) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{177}\n}", "title": "" }, { "docid": "e901b762b30bb0a4f10346c3c319cf63", "score": "0.6190737", "text": "func (*ContractQueryResponse) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "69124f8da1b539755bd7444056c4b0d6", "score": "0.61843765", "text": "func (*AddPeerRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "d029c1e4fe8b4f468e24ce5649ee591f", "score": "0.6182455", "text": "func (CMsgClientToGCGiveTipResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{240, 0}\n}", "title": "" }, { "docid": "c116e024053b2a9e550f959515b5cba6", "score": "0.61753297", "text": "func (CMsgSocialFeedResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{305, 0}\n}", "title": "" }, { "docid": "519d778c85b1425f6615ab5b9af0619e", "score": "0.6174603", "text": "func (*CallHierarchyOutgoingCallsResponse_Result) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{49, 0}\n}", "title": "" }, { "docid": "6b5fa8e03b1ae2c58c2a3fb9092ad865", "score": "0.61423457", "text": "func (CMsgGCToClientRemoveFilteredPlayerResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{329, 0}\n}", "title": "" }, { "docid": "d58ff8c943f8ad8bafadee12aa7c1e27", "score": "0.6138002", "text": "func (*GetPeerInfoRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "a4cf85e0a6d8fa654ca1b7269ce9532a", "score": "0.6106484", "text": "func (*Result) Descriptor() ([]byte, []int) {\n\treturn file_pkg_apis_tra_v1alpha1_tra_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "1f0494bf51d1cbf066bc9bfc3a62b773", "score": "0.6104602", "text": "func (*ReportBenchmarkResultRequest) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_bench_reporting_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "7351508e1a3996e11fd7e2939a04cb7a", "score": "0.6098276", "text": "func (RuleModResult_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_pipelined_proto_rawDescGZIP(), []int{8, 0}\n}", "title": "" }, { "docid": "ea1e085b04b0639342712dec0f15104d", "score": "0.6096146", "text": "func (*CMsgClientToGCGetProfileCardStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{139}\n}", "title": "" }, { "docid": "66b24f24d8ffee171aecec53862a51d8", "score": "0.60884553", "text": "func (*OnTargetAudienceMetrics) Descriptor() ([]byte, []int) {\n\treturn file_google_ads_googleads_v2_services_reach_plan_service_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "05b238cbebb6a95e1be0adf6606def28", "score": "0.6078969", "text": "func (*ReportBenchmarkResultResponse) Descriptor() ([]byte, []int) {\n\treturn file_xsuportal_services_bench_reporting_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "cf09870181797b8ecb1fa39a93ed75d8", "score": "0.60623926", "text": "func (x *fastReflection_QueryAccountInfoResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryAccountInfoResponse\n}", "title": "" }, { "docid": "e1f417a52d64093d498cce4fd3cb6ec9", "score": "0.60595405", "text": "func (*CallHierarchyIncomingCallsResponse_Result) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{48, 0}\n}", "title": "" }, { "docid": "5963b8693fbfee69fb0c15f17d9ce1b3", "score": "0.60580194", "text": "func (*CMsgPredictionResults_ResultBreakdown) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{177, 0}\n}", "title": "" }, { "docid": "321bb0a142ae4a91cfc97252aed3a591", "score": "0.60508615", "text": "func (*QueryPlanStatusRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "eefad4fc0a6190fc1e581704fd3037af", "score": "0.6050703", "text": "func (*MetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{25}\n}", "title": "" }, { "docid": "e46ec92fd21bed55d6853fb7c4320520", "score": "0.60467094", "text": "func (*AddResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_calculator_proto_calc_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "6f1f16814ced4e1ff71e04e2856fafc5", "score": "0.6045048", "text": "func (*MultiTrendingMetricsViewResponse) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{173}\n}", "title": "" }, { "docid": "e10dc519317c206411ced9ba1f391cf6", "score": "0.60420394", "text": "func (CMsgActivatePlusFreeTrialResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{288, 0}\n}", "title": "" }, { "docid": "05433baf952b913e0b74f129d0ccd4e8", "score": "0.6038897", "text": "func (*CMsgProfileResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{276}\n}", "title": "" }, { "docid": "b77002da2c910e66893190a36c04c116", "score": "0.60321206", "text": "func (*MetricsReport) Descriptor() ([]byte, []int) {\n\treturn file_determined_trial_v1_trial_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "10eb7e322fab973c99213df2ff3ec5b6", "score": "0.60297275", "text": "func (*CMsgClientToGCTeammateStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{188}\n}", "title": "" }, { "docid": "d870ce3d59749094efb4885b215b7064", "score": "0.6028503", "text": "func (*CMsgClientToGCRequestPlusWeeklyChallengeResult) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{273}\n}", "title": "" }, { "docid": "4a2ca3ddf6ad06be5f8aa44ad78a4dc9", "score": "0.602134", "text": "func (*CMsgClientToGCTeammateStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{187}\n}", "title": "" }, { "docid": "cde51f3526caa8983507a835165eebe4", "score": "0.60197705", "text": "func (*LoadStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "4563933d2cd9c94e9a4f45cd8a79a600", "score": "0.60188305", "text": "func (*DescribeResultV1) Descriptor() ([]byte, []int) {\n\treturn file_checker_v1_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "c749de52b6a1f97813e5a86bdfd6c8a2", "score": "0.60157794", "text": "func (*CLRMetric) Descriptor() ([]byte, []int) {\n\treturn file_language_agent_CLRMetric_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3f6f64941a9d58478f5632ec365fc49a", "score": "0.601504", "text": "func (*CMsgDOTAMatchmakingStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{50}\n}", "title": "" }, { "docid": "6aef2c7c1851e8e591f95b15c1887307", "score": "0.6013826", "text": "func (CMsgPurchaseItemWithEventPointsResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{262, 0}\n}", "title": "" }, { "docid": "8e830669368f0750a9ae5969ca1bba1d", "score": "0.6013465", "text": "func (CMsgGCToClientPrivateChatResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_chat_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "f45692b99e125c0885a6d0126558338e", "score": "0.6013065", "text": "func (*CMsgProfileUpdateResponse) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{278}\n}", "title": "" }, { "docid": "1fadbf2dba9d35da8d7e06c35e681ebc", "score": "0.60112953", "text": "func (x *fastReflection_QueryAccountResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryAccountResponse\n}", "title": "" }, { "docid": "f3b7fa6ca8c3c910f00776a1a81c5dac", "score": "0.6007239", "text": "func (CMsgDOTAUnanchorPhoneNumberResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{244, 0}\n}", "title": "" }, { "docid": "aab97e40930921511eb07502bcbc28e0", "score": "0.6006843", "text": "func (*ListMetricsResponse) Descriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_analysis_proto_v1_metrics_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "ac1e8c70267578805020f17aeb8263de", "score": "0.6000217", "text": "func (CMsgClientToGCRecycleHeroRelicResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{268, 0}\n}", "title": "" }, { "docid": "082aabf5adf0e1a9f6082ca8f5a3b68a", "score": "0.5998063", "text": "func (*LoadStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_envoy_service_load_stats_v3_lrs_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "b82bc40d52fa4c364e20ac57ce577a4a", "score": "0.59969854", "text": "func (*MetricsServiceRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "710387482c0eab37315053cd88dc318b", "score": "0.59799045", "text": "func (EDevEventRequestResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "c3ff355c5694590b7abd46b0b0b391b6", "score": "0.5972184", "text": "func (*CMsgDOTAMatchmakingStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{49}\n}", "title": "" }, { "docid": "25a4c4bbeb51776eda76c623815485e9", "score": "0.5972063", "text": "func (*ComputeAverageResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_calculator_proto_calc_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "707dedd52c006837a3d147de346bda25", "score": "0.59704566", "text": "func (CMsgClientToGCRecyclePlayerCardResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{215, 0}\n}", "title": "" }, { "docid": "37d0528d2c9641819264fbc50218f222", "score": "0.59680605", "text": "func (x *fastReflection_MsgUpdateParamsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_MsgUpdateParamsResponse\n}", "title": "" }, { "docid": "c57986d4c03c64eda1be65f9e86335a7", "score": "0.5967409", "text": "func (TxAcknowledgment_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_ttn_lorawan_v3_messages_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "4a9a49eeea88d37013d62ff07c5a2857", "score": "0.59632874", "text": "func (CMsgSocialFeedCommentsResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{307, 0}\n}", "title": "" }, { "docid": "5a13deaf8afef9791bb2b8d859f1cb0e", "score": "0.5960313", "text": "func (CMsgGCToClientGetFilteredPlayersResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{327, 0}\n}", "title": "" }, { "docid": "1380b4b497d914b400c68ea320b434e9", "score": "0.5953487", "text": "func (*MemberStatisticsInfoUpdateResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{105}\n}", "title": "" }, { "docid": "046190ca9a89f4f59d92c81c5eaeabaa", "score": "0.5952865", "text": "func (*SemanticTokensDeltaPartialResult) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{225}\n}", "title": "" }, { "docid": "8621979fd362f8672c2552ebaa9203dc", "score": "0.59524435", "text": "func (*Result) Descriptor() ([]byte, []int) {\n\treturn file_grpc_service_message_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "2f2c891e2663832508192ec2ce0d9f19", "score": "0.5948639", "text": "func (x *fastReflection_QueryAccountInfoRequest) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryAccountInfoRequest\n}", "title": "" }, { "docid": "5c13e6ad1884d541be6c4970fad7bcd9", "score": "0.5948367", "text": "func (*CMsgDOTACompendiumInGamePredictionResults) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{209}\n}", "title": "" }, { "docid": "0b64d0839fc9c8fa8876a58ce87ed847", "score": "0.594652", "text": "func (*MemberStatisticsInfoAddResp) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{100}\n}", "title": "" }, { "docid": "50d5d7b7c81edd8533e64ce24a45fc35", "score": "0.5940552", "text": "func (*FoldingRangeResponse_Result) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{45, 0}\n}", "title": "" }, { "docid": "f5be3320d2d74645aef0fc5ea13d4acb", "score": "0.5938002", "text": "func (*MetricsRequest) Descriptor() ([]byte, []int) {\n\treturn file_ssn_dataservice_v1_dataservice_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "a0549a3d7ae9bd8eaf24ea74f4a20829", "score": "0.5937388", "text": "func (x *fastReflection_QueryAccountsResponse) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_QueryAccountsResponse\n}", "title": "" }, { "docid": "50cf72b81cd58b51aee50df309d612f9", "score": "0.5935586", "text": "func (*ClientGroupedStats) Descriptor() ([]byte, []int) {\n\treturn file_datadog_trace_stats_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d10dc73ef8482fb49021293a4c5f62c9", "score": "0.5934304", "text": "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "ff23333e48dbd246fedea09c4af5fba6", "score": "0.5933193", "text": "func (TestSize) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_resultstore_v2_target_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "a191c310b0c731d37f9ad180ce7d4536", "score": "0.5930842", "text": "func (*LanguageCoverageSummary) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_resultstore_v2_coverage_summary_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "d13f175852c3894b1f5f3416579261d9", "score": "0.59255767", "text": "func (*ValidationResult) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2_validation_result_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "dd4ba39fcf8dbbbf0e28968c73391bff", "score": "0.5924806", "text": "func (*CMsgProfileRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{275}\n}", "title": "" }, { "docid": "b011a91d7c2725e3fdc009e8ecb41cdf", "score": "0.5920209", "text": "func (*CMsgDraftTrivia_PreviousResult) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{385, 2}\n}", "title": "" }, { "docid": "d992c01a2e534547f578315f34e28656", "score": "0.5918498", "text": "func (*LoadBalancerStatsResponse) Descriptor() ([]byte, []int) {\n\treturn file_grpc_test_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "d2e451a030b880925995b9833ae42b0b", "score": "0.5916594", "text": "func (x *fastReflection_ValidatorAccumulatedCommissionRecord) Descriptor() protoreflect.MessageDescriptor {\n\treturn md_ValidatorAccumulatedCommissionRecord\n}", "title": "" }, { "docid": "b75074dbb1ed936de505b643da5bc819", "score": "0.59162295", "text": "func (FlowResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_pipelined_proto_rawDescGZIP(), []int{12, 0}\n}", "title": "" }, { "docid": "8e3a8dc994848f33ffcda40b1e331a7c", "score": "0.59148914", "text": "func (*CMsgDOTAUpdateMatchmakingStats) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{51}\n}", "title": "" }, { "docid": "439554eca2e0f235ee2421f86a94a18f", "score": "0.59140503", "text": "func (CMsgDOTAGameAutographRewardResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{256, 0}\n}", "title": "" }, { "docid": "85c2a724269b73f593cb470ffb22c94e", "score": "0.59123164", "text": "func (*CallHierarchyOutgoingCallsResponse_PartialResult) Descriptor() ([]byte, []int) {\n\treturn file_protocol_rpc_rpc_proto_rawDescGZIP(), []int{49, 1}\n}", "title": "" }, { "docid": "4a09ec061a8e157d0cef15db3a3ba845", "score": "0.5911302", "text": "func (*ContractQueryRequest) Descriptor() ([]byte, []int) {\n\treturn file_github_com_yahuizhan_dappley_metrics_go_api_rpc_pb_rpc_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "6f26f50d4aecb0b4a608579a074eb6c6", "score": "0.59043247", "text": "func (*LoadBalancerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_test_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "817880f7dfa7b43d3ea4d9a0e03df30c", "score": "0.59027755", "text": "func (*Metrics) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "6c946ca57fe7127714670f2733073629", "score": "0.5901982", "text": "func (ManualRoll_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_rpc_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "d3c6da89272f3da3e8267fba7b9c88af", "score": "0.590087", "text": "func (*PointsPerChallengeResponse) Descriptor() ([]byte, []int) {\n\treturn file_educode_statistic_api_v1_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "38c4bac5fa95bea9fe6529c66d2af032", "score": "0.5900652", "text": "func (CMsgClientToGCPlayerCardSpecificPurchaseResponse_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{309, 0}\n}", "title": "" }, { "docid": "a13c4da25d2848ae823b5973288f2b28", "score": "0.5899423", "text": "func (EPurchaseHeroRelicResult) EnumDescriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "f1a73597aa9cadf908d4f9ef8b9e71ce", "score": "0.5897439", "text": "func (*NumericValue) Descriptor() ([]byte, []int) {\n\treturn file_google_analytics_admin_v1alpha_access_report_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "b5392d871de8256dda1dded51f9fa4c3", "score": "0.5896044", "text": "func (*LineCoverageSummary) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_resultstore_v2_coverage_summary_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "a25f92665ab3edaec91b3d75bf4237e6", "score": "0.58952546", "text": "func (DeactivateFlowsResult_Result) EnumDescriptor() ([]byte, []int) {\n\treturn file_pipelined_proto_rawDescGZIP(), []int{10, 0}\n}", "title": "" }, { "docid": "16907b811c88f9f532bc866348d7643a", "score": "0.589036", "text": "func (*BaseMetrics) Descriptor() ([]byte, []int) {\n\treturn file_mitre_cvss_v3_cvss_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "8b28fca342ec13a63a47e30f310a7cb1", "score": "0.5889622", "text": "func (*CalculatorResponse) Descriptor() ([]byte, []int) {\n\treturn file_basicpb_unary_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "baceee67d0dc1c2e2b5e11cf2f911be9", "score": "0.5888276", "text": "func (*GetStateSummaryResponse) Descriptor() ([]byte, []int) {\n\treturn file_vm_vm_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "4ddf40f8e43efd227d992115af056c96", "score": "0.5888103", "text": "func (*EvalState_Result) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_eval_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "e827d13a8ef72b02503fbf2057316d35", "score": "0.58874655", "text": "func (*CMsgProfileUpdate) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{277}\n}", "title": "" }, { "docid": "dfcd9dc61cc96184d91575df22ec5902", "score": "0.5887401", "text": "func (*FetchNumberOfTotalConnectionsResponse) Descriptor() ([]byte, []int) {\n\treturn file_api_protobuf_spec_connection_user_v1_proto_rawDescGZIP(), []int{27}\n}", "title": "" } ]
25488d378c687b0f1e845c3220bcdca1
ReadLocalEnvConfig is For test
[ { "docid": "c4195edffa5e2dbb413c2a1427122f63", "score": "0.7882045", "text": "func ReadLocalEnvConfig() {\n\tconf := ConfigList{}\n\terr := envconfig.Process(\"\", &conf)\n\tif err != nil {\n\t\tlog.Fatal(err.Error())\n\t}\n\tEnvConfig = &conf\n}", "title": "" } ]
[ { "docid": "aae4f89596c2589617134ca3557cbdfe", "score": "0.69453603", "text": "func readEnv(cfg *Config) {\n\terr := envconfig.Process(\"\", cfg)\n\tif err != nil {\n\t\tpanic(\"Could not read environment configuration\")\n\t}\n}", "title": "" }, { "docid": "6c329ef6f6def02af2e05124a67607f7", "score": "0.68932265", "text": "func ReadEnv() {\n\tConfig = &configMailer{\n\t\tSMTPIdentity: env.GetString(\"SMTP_IDENTITY\", \"\"),\n\t\tSMTPUsername: env.GetString(\"SMTP_USERNAME\", \"euvoriaMail\"),\n\t\tSMTPPassword: env.GetString(\"SMTP_PASSWORD\", \"euvoriacom3S15cwXPm\"),\n\t\tSMTPHost: env.GetString(\"SMTP_HOST\", \"smtp.sendgrid.net\"),\n\t\tSMTPPort: env.GetString(\"SMTP_PORT\", \"587\"),\n\t\tSenderEmail: env.GetString(\"SMTP_SENDER\", \"noreply@konektifa.com\"),\n\t\tSenderName: env.GetString(\"SMTP_SENDER_NAME\", \"Konektifa System\"),\n\t}\n}", "title": "" }, { "docid": "09ea8e6ff513a77b19c29ee1bbff5ad5", "score": "0.6866576", "text": "func readConfigFromENV() error {\n\tlog.Println(\"Looking for ENV configuration\")\n\treturn envconfig.Process(\"BOW_API\", &Config)\n}", "title": "" }, { "docid": "98be44ea5900e0665d1c73ff61ae08a2", "score": "0.6791416", "text": "func ReadFromEnv(key string) string {\n\tcheckConfiguration()\n\n\tvalue, ok := Viper.Get(key).(string)\n\tif !ok {\n\t\tlog.Fatalf(\"Invalid type assertion\")\n\t}\n\treturn value\n}", "title": "" }, { "docid": "114fadd794882e11d5c714b17b50ff8f", "score": "0.66571337", "text": "func (c *Config) loadFromEnv() {\n\t// Make sure the server id looks presentable.\n\tc.ServerID = GetEnv(\"WPARK_SERVER_ID\", \"wpark-server-1\")\n\tc.Host = GetEnv(\"WPARK_CORE_API_HOST\", \"localhost\")\n\tc.Port = GetEnvAsInt(\"WPARK_CORE_API_PORT\", 11111)\n\n\tc.IsProduction = GetEnv(\"WPARK_PRODUCTION\", \"\") != \"\"\n\n\tc.MySQLURL = GetEnv(\"WPARK_MYSQL_URL\", \"root:password@tcp(localhost:13306)\")\n\tc.MySQLDBName = GetEnv(\"WPARK_MYSQL_DB_NAME\", \"wpark\")\n\n\tc.Debug = GetEnv(\"WPARK_DUMP_CONFIG\", \"true\") != \"false\"\n}", "title": "" }, { "docid": "00e3dc818933aa489c95d9a4642b231b", "score": "0.66529936", "text": "func ReadEnv(cfg interface{}) error {\n\treturn readEnvVars(cfg, false)\n}", "title": "" }, { "docid": "6e0101da1f2a37809fe9595df644fe1f", "score": "0.6645878", "text": "func (c *Config) readEnv() {\n\tfor _, envVar := range os.Environ() {\n\t\tpair := strings.Split(envVar, \"=\")\n\t\tc.properties[pair[0]] = pair[1]\n\t}\n}", "title": "" }, { "docid": "ad5648206df7d0f1acb8644a0918b903", "score": "0.6577509", "text": "func readLocalConfiguration() (map[string]string, bool) {\n\tvar filterMap map[string]string\n\n\tvar mapFunc = func(file string, match []string, vars map[string]string) {\n\t\tif len(match) >= 1 {\n\t\t\tif filterMap == nil {\n\t\t\t\tfilterMap = vars\n\t\t\t}\n\t\t}\n\t}\n\n\treduceConfigs(*localRegexp, mapFunc, parentConfigs, globalConfigs)\n\n\treturn filterMap, filterMap != nil\n}", "title": "" }, { "docid": "386a11c065e21b8d60ef49eaa766504d", "score": "0.6558112", "text": "func ReadEnvironment(cfg *Config) {\n\tenvconfig.Process(\"MELKOR\", cfg)\n}", "title": "" }, { "docid": "46da3eb399377449f1e8425007ba68da", "score": "0.65433437", "text": "func readFromEnv(keys ...string) string {\n\tfor _, key := range keys {\n\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "46da3eb399377449f1e8425007ba68da", "score": "0.65433437", "text": "func readFromEnv(keys ...string) string {\n\tfor _, key := range keys {\n\t\tif value, ok := os.LookupEnv(key); ok {\n\t\t\treturn value\n\t\t}\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "d530815207edb2e7e76cdcd35345a2ab", "score": "0.6539601", "text": "func readEnv(c *gin.Context) {\n\tenv := make([]string, 0)\n\tfor _, pair := range os.Environ() {\n\t\tenv = append(env, pair)\n\t}\n\tc.JSON(200, gin.H{\n\t\t\"environments\": env,\n\t})\n}", "title": "" }, { "docid": "3875b08960881b2497e0479c209f4751", "score": "0.65222687", "text": "func TestLocalConfiguration(t *testing.T) {\n\tvar configManager Manager\n\tconfiguration, _ := configManager.Load(\"\", \"yaml\")\n\trequire.Equal(t, configuration, localconfiguration, \"configuration read from yaml should be equal to local configuration object\")\n}", "title": "" }, { "docid": "f6d69e7c1184636baba4d1859c153528", "score": "0.65038633", "text": "func readenv(name string) string {\n\tvalue, has := os.LookupEnv(name)\n\tif !has {\n\t\tpanic(fmt.Sprintf(\"Environment variable %s not set\", name))\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "0b1589907be10eadedac24fc0769251d", "score": "0.6451318", "text": "func (suite *Suite) readEnv() error {\n\tif env := suite.env.Get(\"name\"); env != \"\" {\n\t\tsuite.SetName(env)\n\t}\n\tif env := suite.env.Get(\"test_hook\"); env != \"\" {\n\t\tsuite.TestHook = env\n\t}\n\tif env := suite.env.Get(\"parameters_file\"); env != \"\" {\n\t\tsuite.ParametersFile = env\n\t}\n\tif env := suite.env.Get(\"sources\"); env != \"\" {\n\t\tsuite.Sources = strings.Split(env, \" \")\n\t}\n\tif env := suite.env.Get(\"imports\"); env != \"\" {\n\t\tsuite.Imports = strings.Split(env, \" \")\n\t}\n\tif env := suite.env.Get(\"timeout\"); env != \"\" {\n\t\tf, err := strconv.ParseFloat(env, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsuite.Timeout = f\n\t}\n\n\tsuite.SetDir(suite.env.Expand(suite.Dir()))\n\tsuite.SetName(suite.env.Expand(suite.Name))\n\n\treturn nil\n}", "title": "" }, { "docid": "f0042188506e3518012eeeab37b0bca0", "score": "0.6391888", "text": "func readConfig(c *config) error {\n\tfmt.Println(\"Reading local config..\")\n\n\t// read config file from local file\n\tjsonFile, err := os.Open(ConfigFileName)\n\tif err != nil {\n\t\treturn errors.New(\"Config file missing or failed to load. \" + err.Error())\n\t}\n\tdefer jsonFile.Close() // closes the stream at the end of the function\n\n\t// transform payload into type\n\tbyteValue, _ := ioutil.ReadAll(jsonFile)\n\n\tif errUnmarshal := json.Unmarshal(byteValue, &c); errUnmarshal != nil {\n\t\treturn errors.New(\"Error while parsing config json file\" + errUnmarshal.Error())\n\t}\n\n\tsetDefaultValues(c)\n\n\treturn nil\n}", "title": "" }, { "docid": "fe0b0415dd02d23b4ee4028504f3cd83", "score": "0.6363744", "text": "func GetLocalConfig() *rest.Config {\n\tvar kubeconfig *string\n\tif home := homedir.HomeDir(); home != \"\" {\n\t\tkubeconfig = flag.String(\"kubeconfig\", filepath.Join(home, \".kube\", \"config\"), \"(optional) absolute path to the kubeconfig file\")\n\t} else {\n\t\tkubeconfig = flag.String(\"kubeconfig\", \"\", \"absolute path to the kubeconfig file\")\n\t}\n\tflag.Parse()\n\n\tconfig, err := clientcmd.BuildConfigFromFlags(\"\", *kubeconfig)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn config\n}", "title": "" }, { "docid": "fafb0508b98198ba33b5f4ccea5309cc", "score": "0.63519794", "text": "func readConfig(env_type string) (*Config, error) {\n\tservice_type, ok := os.LookupEnv(env_type)\n\tif !ok || service_type == \"\" {\n\t\treturn nil, errors.New(env_type + \" is not set!\")\n\t}\n\tconfig_path := form_config_file_path(service_type + \".json\")\n\tcfg_file, err := os.Open(config_path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer cfg_file.Close()\n\n\tvar cfg Config\n\tif err := json.NewDecoder(cfg_file).Decode(&cfg); err != nil {\n\t\treturn nil, err\n\t}\n\n\treplaceFromEnv(&cfg.Server.ServerUploadCfg.Host, SERVER_UPLOAD_HOST_ENV)\n\treplaceFromEnv(&cfg.Server.ServerUploadCfg.Port, SERVER_UPLOAD_PORT_ENV)\n\treplaceFromEnv(&cfg.Server.ServerUploadCfg.StoragePath, SERVER_UPLOAD_STORAGE_ENV)\n\n\treturn &cfg, nil\n}", "title": "" }, { "docid": "865f4802865652d84760516e5e9e385e", "score": "0.6349415", "text": "func ReadEnv(val string, structure interface{}) (string, error) {\n\tenvVal, ok := os.LookupEnv(val)\n\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Environment variable %q not found\", val)\n\t}\n\n\treturn ReadStructuredCfg(envVal, structure)\n}", "title": "" }, { "docid": "7bdd162617235c4a02cc89ac5d06d7b4", "score": "0.63473535", "text": "func ReadFromEnv() *Config {\n\treturn &Config{\n\t\tValidatorRpcEndpoint: getEnv(\"validator_rpc_endpoint\", \"\"),\n\t\tValOperatorAddress: getEnv(\"VAL_OPERATOR_ADDR\", \"\"),\n\t\tAccountAddress: getEnv(\"ACCOUNT_ADDR\", \"\"),\n\t\tLCDEndpoint: getEnv(\"LCD_ENDPOINT\", \"\"),\n\t\tRPCEndpoint: getEnv(\"EXTERNAL_RPC\", \"\"),\n\t}\n}", "title": "" }, { "docid": "12bea2e78ed743116e664e7f4b14489c", "score": "0.6310925", "text": "func readRequireenv(name string, defaultValue string) string {\n\tvalue := os.Getenv(name)\n\tif len(value) < 1 {\n\t\tif len(defaultValue) > 0 {\n\t\t\treturn defaultValue\n\t\t}\n\t\tlog.Fatalf(\"%s needs to be specified in the environment variables.\", name)\n\t}\n\treturn value\n}", "title": "" }, { "docid": "5c2ab6a59a0246f0951a71c6f4d3cb15", "score": "0.6290773", "text": "func GetLocal() string {\n\treturn ENV_LOCAL\n}", "title": "" }, { "docid": "70c31b6b8ee1b577f4716c7a2f31a9ce", "score": "0.628451", "text": "func ReadEnv(key string, def Env) Env {\n\tv := Getenv(key, def.String())\n\tif v == \"\" {\n\t\treturn def\n\t}\n\n\tenv := Env(strings.ToLower(v))\n\tswitch env {\n\tcase PROD, DEV: // allowed.\n\tdefault:\n\t\tpanic(\"unexpected environment \" + v)\n\t}\n\n\treturn env\n}", "title": "" }, { "docid": "f2562869851d153e40da970cc644755a", "score": "0.6259253", "text": "func ReadFromEnv(prefix string) Config {\n\tresult := NewConfig()\n\n\tresult.AddEnvironment(prefix, \"\", false)\n\n\treturn result\n}", "title": "" }, { "docid": "ddaf0e8e4141efd2f0247cdd59ec2a9d", "score": "0.6252146", "text": "func ReadJsonFileWithLocalConfig(filePath string) []byte {\n\t// get message printer\n\tmsgPrinter := i18n.GetMessagePrinter()\n\n\tinputFile, err := filepath.Abs(filePath)\n\tif err != nil {\n\t\tcliutils.Fatal(cliutils.CLI_GENERAL_ERROR, \"%v\", err)\n\t}\n\tlocalConfigFile := filepath.Join(filepath.Dir(inputFile), \"hzn.json\")\n\tlocalConfigFile = filepath.Clean(localConfigFile)\n\n\t// no local configuration file\n\tif _, err := os.Stat(localConfigFile); err == nil {\n\t\treturn cliutils.ReadJsonFile(filePath)\n\t}\n\n\t// check if the local configuration file has been used already\n\tuseLocalConfig := true\n\tif localConfigFile == PROJECT_CONFIG_FILE || localConfigFile == PACKAGE_CONFIG_FILE || localConfigFile == USER_CONFIG_FILE {\n\t\tuseLocalConfig = false\n\t\tcliutils.Verbose(msgPrinter.Sprintf(\"Local configuration %v has been setup at the beginning of this command. Will not setup twice.\", localConfigFile))\n\t}\n\n\torig_env_vars := map[string]string{}\n\thzn_vars := map[string]string{}\n\tmetadata_vars := map[string]string{}\n\tif useLocalConfig {\n\t\torig_env_vars = GetEnvVars()\n\t\thzn_vars, metadata_vars, err = SetEnvVarsFromConfigFile(localConfigFile, orig_env_vars, false)\n\t\tif err != nil {\n\t\t\tcliutils.Fatal(cliutils.CLI_GENERAL_ERROR, msgPrinter.Sprintf(\"Failed to set the environment variable from the local configuration file %v for file %v. Error: %v\", localConfigFile, filePath, err))\n\t\t}\n\t}\n\n\tcontents := cliutils.ReadJsonFile(filePath)\n\n\tif useLocalConfig {\n\t\t// restore the env vars\n\t\terr = RestoreEnvVars(orig_env_vars, hzn_vars, metadata_vars)\n\t\tif err != nil {\n\t\t\tcliutils.Fatal(cliutils.CLI_GENERAL_ERROR, msgPrinter.Sprintf(\"Failed to restore the environment variable after using local configuration file %v. %v\", useLocalConfig, err))\n\t\t}\n\t}\n\n\treturn contents\n}", "title": "" }, { "docid": "1c05a3d3b5eaa9b717429a90a12ece72", "score": "0.62393147", "text": "func initConfig() {\n\tviper.AutomaticEnv() // read in environment variables that match\n}", "title": "" }, { "docid": "1c05a3d3b5eaa9b717429a90a12ece72", "score": "0.62393147", "text": "func initConfig() {\n\tviper.AutomaticEnv() // read in environment variables that match\n}", "title": "" }, { "docid": "1c05a3d3b5eaa9b717429a90a12ece72", "score": "0.62393147", "text": "func initConfig() {\n\tviper.AutomaticEnv() // read in environment variables that match\n}", "title": "" }, { "docid": "9b4e16252be2b99ad5cab142a778665b", "score": "0.6235234", "text": "func getTestCredsFromEnv() string {\n\tcwd, err := os.Getwd()\n\tif err != nil {\n\t\tlog.Fatalf(\"cannot get current directory: %v\", err)\n\t}\n\n\tcredentials := multiEnvSearch([]string{\"TEST_CREDENTIALS\", \"GOOGLE_APPLICATION_CREDENTIALS\"})\n\tif credentials != \"\" {\n\t\t// Make credentials path relative to repo root rather than\n\t\t// test/ dir if it is a relative path.\n\t\tif !filepath.IsAbs(credentials) {\n\t\t\tcredentials = filepath.Join(cwd, \"..\", credentials)\n\t\t}\n\t} else {\n\t\tlog.Printf(\"missing env var TEST_CREDENTIALS, will try to use Application Default Credentials\")\n\t}\n\n\treturn credentials\n}", "title": "" }, { "docid": "30b955d6da01e74677dbfcefeb323a9f", "score": "0.6226643", "text": "func (c *Config) loadFromEnv() error {\n\tif v := os.Getenv(\"FC_PRODUCER_QUEUE_ADDR\"); v != \"\" {\n\t\tc.Queue.Addr = v\n\t}\n\tif v := os.Getenv(\"FC_PRODUCER_QUEUE_USER\"); v != \"\" {\n\t\tc.Queue.User = v\n\t}\n\tif v := os.Getenv(\"FC_PRODUCER_QUEUE_PASS\"); v != \"\" {\n\t\tc.Queue.Pass = v\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d868b26742c82ca152f842a3994ca431", "score": "0.6207665", "text": "func loadEnvironmentConfig(env string) template.Options {\n\tconfigFile := \"config/\" + ServiceName + \"/\" + env + \".json\"\n\tif _, err := os.Stat(configFile); os.IsNotExist(err) {\n\t\tpanic(err)\n\t}\n\treturn parseConfigFile(configFile)\n}", "title": "" }, { "docid": "a7841384ace3db03129d0bb3a8414a8a", "score": "0.6201555", "text": "func (c *Config) TestingEnv() bool {\n\treturn c.LocalConfig.TestingEnv()\n}", "title": "" }, { "docid": "deead93dbb64159e4abdf5dfc209595e", "score": "0.6197209", "text": "func FindAndReadLocalBazenvFile() (*string, error) {\n\tcurrentDir, err := os.Getwd()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor {\n\t\t// Try reading .bazenv_version\n\t\tversionName, err := ioutil.ReadFile(filepath.Join(currentDir, \".\"+BazenvFile))\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif err == nil {\n\t\t\tversionNameString := strings.TrimSpace(string(versionName))\n\t\t\treturn &versionNameString, nil\n\t\t}\n\n\t\t// File not found - go up a level, if we can\n\t\tif currentDir == \"/\" {\n\t\t\t// got to root directory, but nothing was found\n\t\t\treturn nil, nil\n\t\t}\n\t\tcurrentDir = filepath.Dir(currentDir)\n\t}\n}", "title": "" }, { "docid": "c7edc02ea7f652a79ec37e24fb774767", "score": "0.61885965", "text": "func (c *Client) ReadFromEnv(env, key string) (string, error) {\n\treturn c.ReadValue(fmt.Sprintf(\"%s/%s\", env, key))\n}", "title": "" }, { "docid": "17d33664a5cd9d354ed4866f6d087bba", "score": "0.6185666", "text": "func loadEnviron(\n\tenv []string,\n\tprojectName, configName string) ([]string, error) {\n\tctx := context.Background()\n\tclient, err := google.DefaultClient(ctx, runtimeconfig.CloudruntimeconfigScope)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create client: %v\", err)\n\t}\n\n\tservice, err := runtimeconfig.New(client)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not create service: %v\", err)\n\t}\n\n\tvalues, err := listVariables(ctx, service, projectName, configName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not fetch config: %v\", err)\n\t}\n\n\treturn appendEnviron(env, values), nil\n}", "title": "" }, { "docid": "13238d8f776aafa2834c07464d072664", "score": "0.61780566", "text": "func ReadInConfig() error { return v.ReadInConfig() }", "title": "" }, { "docid": "e6d7b0cb87a30a9fc4dcfe804146aec8", "score": "0.6168923", "text": "func Example_Env() {\n\tos.Setenv(\"EXAMPLE_PORT\", \"3333\")\n\tos.Setenv(\"EXAMPLE_AUTH_USER\", \"env-user\")\n\tos.Setenv(\"EXAMPLE_AUTH_PASS\", \"env-pass\")\n\tdefer os.Clearenv()\n\n\tloader := aconfig.NewLoader(aconfig.LoaderConfig{\n\t\tSkipFlag: true,\n\t\tEnvPrefix: \"EXAMPLE\",\n\t\tFiles: []string{\"testdata/example_config.json\"},\n\t})\n\n\tvar cfg MyConfig\n\tif err := loader.Load(&cfg); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfmt.Printf(\"Port: %v\\n\", cfg.Port)\n\tfmt.Printf(\"Auth.User: %v\\n\", cfg.Auth.User)\n\tfmt.Printf(\"Auth.Pass: %v\\n\", cfg.Auth.Pass)\n\n\t// Output:\n\t//\n\t// Port: 3333\n\t// Auth.User: env-user\n\t// Auth.Pass: env-pass\n}", "title": "" }, { "docid": "2c8b2e16cefbeac9e8440b07c4d7da02", "score": "0.6158022", "text": "func (c *Client) SourceEnvironmentRead(r string) (SourceEnvironment, error) {\nvar err error\nvar result SourceEnvironment\nobj, err := c.FindObjectByReference(\"/environment\", r)\nresult = obj.(SourceEnvironment)\nreturn result, err\n}", "title": "" }, { "docid": "9486ae3ed0d459fadbcc8b43d7e43f53", "score": "0.61420965", "text": "func ReadAndCheckEnvVar(varName string) (varVal string) {\n\tif varVal = ReadEnvVar(varName); varVal == \"\" {\n\t\terr := fmt.Errorf(\"%s environment variable not set properly\", varName)\n\t\tlog.Fatal(err)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "185b339230d951aa1449b5263679fece", "score": "0.614018", "text": "func readEnvVariables() {\n\tfor k := range vkSchemaFiles {\n\t\tif tmp := os.Getenv(k); tmp != \"\" {\n\t\t\tvkSchemaFiles[k] = tmp\n\t\t}\n\t}\n\n\tif tmp := os.Getenv(\"VK_API_SCHEMA_OUTPUT\"); tmp != \"\" {\n\t\toutputDirName = tmp\n\t}\n}", "title": "" }, { "docid": "5b7b5e62a166f382aa3934e71e938a3e", "score": "0.61390775", "text": "func ReadRemoteConfig() error { return v.ReadRemoteConfig() }", "title": "" }, { "docid": "4b4fc7cc9151f0927f8229ac01c33e64", "score": "0.61252046", "text": "func readEnv() {\n\tif envdata, _ := ioutil.ReadFile(\".env\"); len(envdata) > 0 {\n\t\ts := bufio.NewScanner(bytes.NewReader(envdata))\n\t\tfor s.Scan() {\n\t\t\tparts := strings.Split(s.Text(), \"=\")\n\t\t\tif len(parts) != 2 {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tstrValue := strings.Trim(parts[1], `\"`)\n\t\t\tif err := os.Setenv(parts[0], strValue); err != nil {\n\t\t\t\tlog.WithField(\"name\", parts[0]).WithError(err).Warningln(\"failed to override ENV variable\")\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "eb28c87c1f739bed014d9b56f2c76846", "score": "0.6124094", "text": "func readConfig() {\n\tif url == \"\" {\n\t\turl = viper.GetString(\"url\")\n\t\tif url == \"\" {\n\t\t\tlog.Fatal(\"WebInspect API URL not found.\")\n\t\t}\n\t}\n\tif username == \"\" {\n\t\tusername = viper.GetString(\"username\")\n\t\tif username == \"\" {\n\t\t\tlog.Fatal(\"WebInspect username not found.\")\n\t\t}\n\t}\n\t// Do not read `password` from a configuration file.\n\tif password == \"\" {\n\t\tlog.Fatal(\"WebInspect password not found.\")\n\t}\n}", "title": "" }, { "docid": "7455c501b7c58d29993193fbfe615954", "score": "0.6120746", "text": "func initConfig() {\n\tviper.AutomaticEnv() // read in environment variables that match\n\n}", "title": "" }, { "docid": "95ec5181baa22ef9841f241a4e9d11a6", "score": "0.610309", "text": "func TestConfigRead(t *testing.T) {\n\tscenarios := []testReadScenario{\n\t\t{\n\t\t\tname: \"static config should be used when there is no local user config\",\n\t\t\tstaticConfig: staticConfig,\n\t\t},\n\t\t{\n\t\t\tname: \"static config should return an error when invalid\",\n\t\t\tstaticConfig: staticConfigInvalid,\n\t\t\twantError: config.ErrInvalidConfig.Error(),\n\t\t},\n\t\t{\n\t\t\tname: \"when user config is invalid (and the user accepts static config) but static config is also invalid, it should return an error\",\n\t\t\tstaticConfig: staticConfigInvalid,\n\t\t\tuserConfigFilename: \"config-invalid.toml\",\n\t\t\tuserResponseToPrompt: \"yes\",\n\t\t\twantError: config.ErrInvalidConfig.Error(),\n\t\t},\n\t\t{\n\t\t\tname: \"when user config is invalid (and the user rejects static config), it should return a specific remediation error\",\n\t\t\tremediation: true,\n\t\t\tstaticConfig: staticConfig,\n\t\t\tuserConfigFilename: \"config-invalid.toml\",\n\t\t\tuserResponseToPrompt: \"no\",\n\t\t\twantError: config.RemediationManualFix,\n\t\t},\n\t\t{\n\t\t\tname: \"when user config is in the legacy format, it should return a specific error\",\n\t\t\tstaticConfig: staticConfig,\n\t\t\tuserConfigFilename: \"config-legacy.toml\",\n\t\t\tuserResponseToPrompt: \"no\",\n\t\t\twantError: config.ErrLegacyConfig.Error(),\n\t\t},\n\t\t{\n\t\t\tname: \"when user config is valid, it should return no error\",\n\t\t\tstaticConfig: staticConfig,\n\t\t\tuserConfigFilename: \"config.toml\",\n\t\t},\n\t}\n\n\tfor _, testcase := range scenarios {\n\t\tt.Run(testcase.name, func(t *testing.T) {\n\t\t\t// We're going to chdir to an temp environment,\n\t\t\t// so save the PWD to return to, afterwards.\n\t\t\tpwd, err := os.Getwd()\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\n\t\t\t// Create test environment\n\t\t\topts := testutil.EnvOpts{T: t}\n\t\t\tif testcase.userConfigFilename != \"\" {\n\t\t\t\tb, err := os.ReadFile(filepath.Join(\"testdata\", testcase.userConfigFilename))\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\topts.Write = []testutil.FileIO{\n\t\t\t\t\t{Src: string(b), Dst: \"config.toml\"},\n\t\t\t\t}\n\t\t\t}\n\t\t\trootdir := testutil.NewEnv(opts)\n\t\t\tconfigPath := filepath.Join(rootdir, \"config.toml\")\n\t\t\tdefer os.RemoveAll(rootdir)\n\n\t\t\t// Before running the test, chdir into the temp environment.\n\t\t\t// When we're done, chdir back to our original location.\n\t\t\t// This is so we can reliably assert file structure.\n\t\t\tif err := os.Chdir(rootdir); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tdefer os.Chdir(pwd)\n\n\t\t\tif testcase.userConfigFilename == \"\" {\n\t\t\t\tif fi, err := os.Stat(configPath); err == nil {\n\t\t\t\t\tt.Fatalf(\"expected the user config to NOT exist at this point: %+v\", fi)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif _, err := os.Stat(configPath); err != nil {\n\t\t\t\t\tt.Fatalf(\"expected the user config to exist at this point: %v\", err)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tvar f config.File\n\t\t\tf.SetStatic(testcase.staticConfig)\n\n\t\t\tvar out bytes.Buffer\n\t\t\tin := strings.NewReader(testcase.userResponseToPrompt)\n\n\t\t\terr = f.Read(configPath, in, &out)\n\n\t\t\tif testcase.remediation {\n\t\t\t\te, ok := err.(fsterr.RemediationError)\n\t\t\t\tif !ok {\n\t\t\t\t\tt.Fatalf(\"unexpected error asserting returned error (%T) to a RemediationError type\", err)\n\t\t\t\t}\n\t\t\t\tif testcase.wantError != e.Remediation {\n\t\t\t\t\tt.Fatalf(\"want %v, have %v\", testcase.wantError, e.Remediation)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttestutil.AssertErrorContains(t, err, testcase.wantError)\n\t\t\t}\n\n\t\t\tif testcase.wantError == \"\" {\n\t\t\t\t// If we're not expecting an error, then we're expecting the user\n\t\t\t\t// configuration file to exist...\n\n\t\t\t\tif _, err := os.Stat(configPath); err == nil {\n\t\t\t\t\tbs, err := os.ReadFile(configPath)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatalf(\"unexpected err: %v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\terr = toml.Unmarshal(bs, &f)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatalf(\"unexpected err: %v\", err)\n\t\t\t\t\t}\n\n\t\t\t\t\tif f.CLI.LastChecked == \"\" || f.CLI.Version == \"\" {\n\t\t\t\t\t\tt.Fatalf(\"expected LastChecked/Version to be set: %+v\", f)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t}\n}", "title": "" }, { "docid": "1b02dc45ec0d077068a7e63caace1ba7", "score": "0.6101571", "text": "func loadConfig() *ConfigSpec {\n\tvar config ConfigSpec\n\tvar err error\n\n\tconfig.NoColor = false\n\n\tif fileExists(\".env.local\") {\n\t\terr = godotenv.Load(\".env.local\")\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\tif fileExists(\".env\") {\n\t\terr = godotenv.Load()\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\terr = envconfig.Process(\"\", &config)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn &config\n}", "title": "" }, { "docid": "1155781c25a6599080231a00417946f5", "score": "0.6093493", "text": "func TestLocalCustomPathConfiguration(t *testing.T) {\n\tvar path = \"./config_test/config.yml\"\n\tvar configManager Manager\n\tconfiguration, _ := configManager.Load(path, \"yaml\")\n\trequire.Equal(t, configuration, localconfiguration, \"configuration read from yaml should be equal to local configuration object\")\n}", "title": "" }, { "docid": "0261a7d5b50ce0cbc2deb6bce0656635", "score": "0.6086502", "text": "func findLocalConfig() (configDir string, configFile string) {\n\tif exePath, err := os.Executable(); err == nil {\n\t\tconfigDir = filepath.Dir(exePath)\n\t\tconfigFile = findFile(configDir, configFileName)\n\t}\n\treturn\n}", "title": "" }, { "docid": "e94119b333f663962315b23d44fb7151", "score": "0.608416", "text": "func ReadFromEnv() *Env {\n\ttoken := os.Getenv(\"GITHUB_AUTH_TOKEN\")\n\tif token == \"\" {\n\t\tlog.Fatal(\"Unauthorized: No token present\")\n\t}\n\treturn &Env{\n\t\tGitHubAuthToken: token,\n\t}\n}", "title": "" }, { "docid": "2c0af898e5c6fd42055aa4a8c5586f5a", "score": "0.6081003", "text": "func (r Repo) LocalConfigGet(ctx context.Context, section, key string) (string, error) {\n\ts, err := r.runCmd(ctx, \"git\", \"config\", \"--local\", \"--get\", fmt.Sprintf(\"%s.%s\", section, key))\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn s[:len(s)-1], nil\n}", "title": "" }, { "docid": "c2f614e4e6108646b80e4bd39951d241", "score": "0.6071704", "text": "func Example_Env() {\n\tos.Setenv(\"EXAMPLE_HTTP_PORT\", \"3333\")\n\tos.Setenv(\"EXAMPLE_AUTH_USER\", \"env-user\")\n\tos.Setenv(\"EXAMPLE_AUTH_PASS\", \"env-pass\")\n\tdefer os.Clearenv()\n\n\tvar cfg MyConfig\n\tloader := aconfig.LoaderFor(&cfg, aconfig.Config{\n\t\tSkipFlags: true,\n\t\tEnvPrefix: \"EXAMPLE\",\n\t\tFiles: []string{\"testdata/example_config.json\"},\n\t})\n\tif err := loader.Load(); err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\tfmt.Printf(\"HTTPPort: %v\\n\", cfg.HTTPPort)\n\tfmt.Printf(\"Auth.User: %v\\n\", cfg.Auth.User)\n\tfmt.Printf(\"Auth.Pass: %v\\n\", cfg.Auth.Pass)\n\n\t// Output:\n\t//\n\t// HTTPPort: 3333\n\t// Auth.User: env-user\n\t// Auth.Pass: env-pass\n}", "title": "" }, { "docid": "369f85f277b95e468bacfe88ee90a444", "score": "0.60684067", "text": "func readConfig() {\n\tvar errConfig error\n\tvar errRuntimeInfo error\n\tcredConfig, errConfig = CfgMgr.ReadInfluxConfig()\n\tif errConfig != nil {\n\t\tglog.Error(\"Error in reading the DB credentials : %v\" + errConfig.Error())\n\t\tos.Exit(-1)\n\t}\n\n\truntimeInfo, errRuntimeInfo = CfgMgr.ReadContainerInfo()\n\tif errRuntimeInfo != nil {\n\t\tglog.Error(\"Error in reading the Runtime Info : %v\" + errRuntimeInfo.Error())\n\t\tos.Exit(-1)\n\t}\n}", "title": "" }, { "docid": "cc5607afd32e0e8f23cee8e8e37fc6ab", "score": "0.60594726", "text": "func LoadFromEnv() (*Config, error) {\n\tvar config Config\n\terr := envconfig.Process(\"ATOME_EXPORTER\", &config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &config, nil\n}", "title": "" }, { "docid": "bef05dc99631bba54dcb0fdb9fb4440a", "score": "0.6054851", "text": "func readConfigFromEnv(prefix string, config interface{}) {\n\tvalues := reflect.ValueOf(config)\n\tif values.Kind() == reflect.Ptr {\n\t\tvalues = reflect.Indirect(values)\n\t}\n\ttypeOfConfig := values.Type()\n\tfor i := 0; i < values.NumField(); i++ {\n\t\tname := prefix + strcase.ToScreamingSnake(typeOfConfig.Field(i).Name)\n\t\tv := os.Getenv(name)\n\t\tswitch typeOfConfig.Field(i).Type.Kind() {\n\t\tcase reflect.String:\n\t\t\tif v != \"\" {\n\t\t\t\treflect.Indirect(values.Field(i)).SetString(v)\n\t\t\t}\n\t\tcase reflect.Int:\n\t\t\tif v != \"\" {\n\t\t\t\tval, err := strconv.Atoi(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(`Env: wrong value type for field \"%s\", need int\\n`, name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvalues.Field(i).SetInt(int64(val))\n\t\t\t}\n\t\tcase reflect.Float64:\n\t\t\tif v != \"\" {\n\t\t\t\tval, err := strconv.ParseFloat(v, 64)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(`Env: wrong value type for field \"%s\", need int\\n`, name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvalues.Field(i).SetFloat(val)\n\t\t\t}\n\t\tcase reflect.Bool:\n\t\t\tif v != \"\" {\n\t\t\t\tval, err := strconv.ParseBool(v)\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Printf(`Env: wrong value type for field \"%s\", need bool\\n`, name)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tvalues.Field(i).SetBool(val)\n\t\t\t}\n\t\tcase reflect.Struct:\n\t\t\treadConfigFromEnv(name + \".\", values.Field(i).Addr().Interface())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "d4a407eacc73b1a782faf25b72e8d548", "score": "0.60532594", "text": "func (er *envReader) Read(path string) (string, error) {\n\tif er.cached == \"\" {\n\t\ter.cached = os.Getenv(path)\n\t}\n\tif er.cached == \"\" {\n\t\treturn er.cached, errors.New(\"unable to read OS environment variable:\" + path)\n\t}\n\treturn er.cached, nil\n}", "title": "" }, { "docid": "656797a5cb8176f0487cd3ecf1e9f353", "score": "0.60528815", "text": "func loadConfigEnv(cfg interface{}) error {\n\terr := envconfig.Process(\"\", cfg)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to process environment config\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6d5d446014f374ded8a98ce9a28e3005", "score": "0.60482323", "text": "func ReadEnvironment(name string) (map[string]string, error) {\n\tif name == \"\" {\n\t\treturn nil, nil\n\t}\n\n\tif _, err := os.Stat(EnvironmentFileName); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tvar fileStruct EnvFile\n\n\tf, err := os.Open(EnvironmentFileName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\tif err := json.NewDecoder(f).Decode(&fileStruct); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif env, ok := fileStruct[name]; ok {\n\t\treturn env, nil\n\t}\n\n\treturn nil, fmt.Errorf(\"environment %s does not exist in file\", name)\n\n}", "title": "" }, { "docid": "377c84b6cbb6c5720b69c71345bf7b4e", "score": "0.6017706", "text": "func ReadEnv() (*Config, error) {\n\tcfg := &Config{}\n\tif err := envconfig.Process(\"\", cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to process environment variables: %v\", err)\n\t}\n\tprepare(cfg)\n\treturn cfg, nil\n}", "title": "" }, { "docid": "f56e63f7f9885a3a89e64441fd1980ac", "score": "0.59930706", "text": "func TestConfigEnv(t *testing.T) {\n reset()\n\n for _, env := range envs {\n os.Setenv(env, \"8\")\n }\n\n config := args.GetArgValues([]string{})\n\n for _, key := range keys {\n if (config[key] != \"8\") {\n t.Errorf(\"[%s] expected to be [8], found [%s]\", key, config[key])\n }\n }\n}", "title": "" }, { "docid": "5404e0e5a49c2eec3bde4167adb5006c", "score": "0.5992714", "text": "func GetConfigFromENV(kyberENV string) *configuration.Config {\n\tlog.Printf(\"Running in %s mode \\n\", kyberENV)\n\tvar config *configuration.Config\n\tconfig = configuration.GetConfig(kyberENV,\n\t\t!noAuthEnable,\n\t\tendpointOW,\n\t\tnoCore,\n\t\tenableStat)\n\treturn config\n}", "title": "" }, { "docid": "b987697e58b29af66a7409801bc86be8", "score": "0.5992394", "text": "func TestLoadEnvironmentInjectionConfig(t *testing.T) {\n\tcfg := env1\n\tc, err := LoadInjectionConfigFromFilePath(cfg)\n\tif err != nil {\n\t\tt.Error(err)\n\t\tt.Fail()\n\t}\n\texpectedName := \"env1\"\n\texpectedEnvVarCount := 3\n\texpectedContainerCount := 0\n\texpectedVolumeCount := 0\n\tnExpectedVolumeMounts := 0\n\tnExpectedHostAliases := 0\n\tif c.Name != expectedName {\n\t\tt.Errorf(\"expected %s Name loaded from %s but got %s\", expectedName, cfg, c.Name)\n\t\tt.Fail()\n\t}\n\tif len(c.Environment) != expectedEnvVarCount {\n\t\tt.Errorf(\"expected %d EnvVars loaded from %s but got %d\", expectedEnvVarCount, cfg, len(c.Environment))\n\t\tt.Fail()\n\t}\n\tif len(c.Containers) != expectedContainerCount {\n\t\tt.Errorf(\"expected %d Containers loaded from %s but got %d\", expectedContainerCount, cfg, len(c.Containers))\n\t\tt.Fail()\n\t}\n\tif len(c.Volumes) != expectedVolumeCount {\n\t\tt.Errorf(\"expected %d Volumes loaded from %s but got %d\", expectedVolumeCount, cfg, len(c.Volumes))\n\t\tt.Fail()\n\t}\n\tif len(c.VolumeMounts) != nExpectedVolumeMounts {\n\t\tt.Fatalf(\"expected %d VolumeMounts loaded from %s but got %d\", nExpectedVolumeMounts, cfg, len(c.VolumeMounts))\n\t}\n\tif len(c.HostAliases) != nExpectedHostAliases {\n\t\tt.Fatalf(\"expected %d HostAliases loaded from %s but got %d\", nExpectedHostAliases, cfg, len(c.HostAliases))\n\t}\n}", "title": "" }, { "docid": "3a96be558c698203b6e7525088c23adc", "score": "0.59836817", "text": "func LoadEnv() {\n\tjsonFile, error := os.Open(\"configs/env.json\")\n\n\tdefer jsonFile.Close()\n\n\tif error != nil {\n\t\tpanic(\"Failed to open env json file: \" + error.Error())\n\t}\n\n\tjsonByte, error := ioutil.ReadAll(jsonFile)\n\n\tif error != nil {\n\t\tpanic(\"Something went wrong with env.json file : \" + error.Error())\n\t}\n\n\terr := json.Unmarshal(jsonByte, &envs)\n\tif err != nil {\n\t\tpanic(\"Something went wrong with env keys file : \" + err.Error())\n\t}\n\n\tfor envKey, envValue := range envs {\n\t\tos.Setenv(envKey, envValue)\n\t}\n\n\tlog.Println(\"### ENVs setup done ####\")\n}", "title": "" }, { "docid": "8875f0fb949fe65a01450eabd5751204", "score": "0.5982191", "text": "func ReadFromEnvironment() error {\n\tmessengerAccessToken = os.Getenv(\"MESSENGER_ACCESS_TOKEN\")\n\tmessengerVerifyToken = os.Getenv(\"MESSENGER_VERIFY_TOKEN\")\n\tfnacCookie = os.Getenv(\"COOKIE_FNAC\")\n\tmessengerRecipientS := os.Getenv(\"MESSENGER_RECIPIENT_IDS\")\n\tchromeHost = os.Getenv(\"CHROME_HOST\")\n\tchromePort = os.Getenv(\"CHROME_PORT\")\n\tcronIntervalSecondsString := os.Getenv(\"CRON_INTERVAL_SECONDS\")\n\tserverPortS := os.Getenv(\"PORT\")\n\n\tmessengerRecipientIDs = strings.Split(messengerRecipientS, \",\")\n\n\tfor i, id := range messengerRecipientIDs {\n\t\tmessengerRecipientIDs[i] = strings.TrimSpace(id)\n\t}\n\n\tif messengerAccessToken == \"\" {\n\t\treturn errors.New(\"Expected MESSENGER_ACCESS_TOKEN defined in environment\")\n\t}\n\n\tif messengerVerifyToken == \"\" {\n\t\treturn errors.New(\"Expected MESSENGER_VERIFY_TOKEN defined in environment\")\n\t}\n\n\tif chromeHost == \"\" {\n\t\treturn errors.New(\"Expected CHROME_HOST defined in environment\")\n\t}\n\t\n\tif chromePort == \"\" {\n\t\treturn errors.New(\"Expected CHROME_PORT defined in environment\")\n\t}\n\n\tif cronIntervalSecondsString != \"\" {\n\t\tvar err error\n\t\tcronIntervalSeconds, err = strconv.Atoi(cronIntervalSecondsString)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Warning: `CRON_INTERVAL_SECONDS` is not a number, defaulting to 300 seconds\")\n\t\t\tcronIntervalSeconds = 300\n\t\t}\n\t} else {\n\t\tcronIntervalSeconds = 300\n\t}\n\n\tif serverPortS != \"\" {\n\t\tserverPortParsed, err := strconv.Atoi(serverPortS)\n\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tserverPort = serverPortParsed\n\t} else {\n\t\tserverPort = 5646\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "789a38ba45660d94162efaec5e9eee67", "score": "0.5981663", "text": "func readEnvs(env string) (envs []string) {\n\tfor _, e := range strings.Split(env, \",\") {\n\t\te := strings.TrimSpace(e)\n\t\tif e != \"\" {\n\t\t\tenvs = append(envs, e)\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "67ae5da325dab4fe8aaa792d53c21880", "score": "0.5973394", "text": "func readEnv() (bucketPath string, port string) {\n\tbucketPath = os.Getenv(\"BUCKET_URI\")\n\tif bucketPath == \"\" {\n\t\tlog.Fatalln(\"No Bucket URI set.\")\n\t}\n\tport = os.Getenv(\"PORT\")\n\tif port == \"\" {\n\t\tport = \"8080\"\n\t}\n\treturn bucketPath, port\n}", "title": "" }, { "docid": "2b4f47ddc24ffcc900c22691ed0834f2", "score": "0.5967047", "text": "func ReadFromEnv() (*Env, error) {\n\tvar env Env\n\tif err := envconfig.Process(\"\", &env); err != nil {\n\t\treturn nil, errors.Wrap(err, \"failed to process envconfig\")\n\t}\n\n\treturn &env, nil\n}", "title": "" }, { "docid": "e6fa24985f023dcefc89eecf63aa0f4e", "score": "0.5962812", "text": "func InitializeConfig() (*Config,error){\r\n\tif !envInitialized{\r\n\t\tenvInitialized = true\r\n\t\tgodotenv.Load()\r\n\t}\r\n\treturn ReadConfig()\r\n}", "title": "" }, { "docid": "22e78ab2bc639c3d09a650a3ff086bf1", "score": "0.59617525", "text": "func readConfig() config {\n\t// read config\n\texe, err := os.Executable()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tpath := fmt.Sprintf(\"%s/config.ini\", path.Dir(exe))\n\tcf, err := ini.Load(path)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to read config file: %v\\n\", err)\n\t}\n\n\tvar cfg config\n\tcfg.port = fmt.Sprintf(\":\" + cf.Section(\"grpc\").Key(\"port\").String())\n\tcfg.logfile = fmt.Sprintf(cf.Section(\"log\").Key(\"file\").String())\n\tcfg.dbname = fmt.Sprintf(\"%s\", cf.Section(\"sql\").Key(\"database\").String())\n\tcfg.user = cf.Section(\"sql\").Key(\"username\").String()\n\tcfg.pass = cf.Section(\"sql\").Key(\"password\").String()\n\n\treturn cfg\n}", "title": "" }, { "docid": "9635634c96805393f9e37fde4f18ac1f", "score": "0.5955695", "text": "func ReadEnvRecursive(val string, structure interface{}) (string, error) {\n\tenvVal, ok := os.LookupEnv(val)\n\n\tif !ok {\n\t\treturn \"\", fmt.Errorf(\"Environment variable %q not found\", val)\n\t}\n\n\treturn ReadStructuredCfgRecursive(envVal, structure)\n}", "title": "" }, { "docid": "4aab0bf75863714e4cd06298de5d407c", "score": "0.59461325", "text": "func LoadConfig(key string) (string, error) {\n\treturn requiredEnv(key)\n}", "title": "" }, { "docid": "86468bc0526aa17d2284303f9c02cdac", "score": "0.593707", "text": "func readEnvVars(vars map[string]string, prefixes []string) {\n\tenvs := os.Environ()\n\tfor _, e := range envs {\n\t\tevaluateEnvVar(vars, prefixes, e)\n\t}\n}", "title": "" }, { "docid": "a2088d4a60aeea6190abbf984a8731ca", "score": "0.59231496", "text": "func TestConfigEnv(t *testing.T) {\n\tt.Parallel()\n\n\tdata := []struct {\n\t\tname, x, key string\n\t}{\n\t\t{\"Version\", tVersion, EnvVarVersion},\n\t\t{\"Name\", tName, EnvVarName},\n\t\t{\"BundleID\", tBundleID, EnvVarBundleID},\n\t\t{\"UID\", tUID, EnvVarUID},\n\t\t{\"ConfigVersion\", tAlfredVersion, EnvVarAlfredVersion},\n\t\t{\"ConfigBuild\", tAlfredBuild, EnvVarAlfredBuild},\n\t\t{\"Theme\", tTheme, EnvVarTheme},\n\t\t{\"ThemeBackground\", tThemeBackground, EnvVarThemeBG},\n\t\t{\"ThemeSelectionBackground\", tThemeSelectionBackground, EnvVarThemeSelectionBG},\n\t\t{\"Preferences\", tPreferences, EnvVarPreferences},\n\t\t{\"Localhash\", tLocalhash, EnvVarLocalhash},\n\t\t{\"CacheDir\", tCacheDir, EnvVarCacheDir},\n\t\t{\"CacheDir\", tDataDir, EnvVarDataDir},\n\t}\n\n\tcfg := NewConfig(testEnv)\n\n\tv := cfg.GetBool(EnvVarDebug)\n\tassert.Equal(t, tDebug, v, \"unexpected Debug\")\n\n\tfor _, td := range data {\n\t\ttd := td // capture variable\n\t\tt.Run(fmt.Sprintf(\"Config.Get(%v)\", td.name), func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tassert.Equal(t, td.x, cfg.Get(td.key), \"unexpected result\")\n\t\t})\n\t}\n}", "title": "" }, { "docid": "a2088d4a60aeea6190abbf984a8731ca", "score": "0.59231496", "text": "func TestConfigEnv(t *testing.T) {\n\tt.Parallel()\n\n\tdata := []struct {\n\t\tname, x, key string\n\t}{\n\t\t{\"Version\", tVersion, EnvVarVersion},\n\t\t{\"Name\", tName, EnvVarName},\n\t\t{\"BundleID\", tBundleID, EnvVarBundleID},\n\t\t{\"UID\", tUID, EnvVarUID},\n\t\t{\"ConfigVersion\", tAlfredVersion, EnvVarAlfredVersion},\n\t\t{\"ConfigBuild\", tAlfredBuild, EnvVarAlfredBuild},\n\t\t{\"Theme\", tTheme, EnvVarTheme},\n\t\t{\"ThemeBackground\", tThemeBackground, EnvVarThemeBG},\n\t\t{\"ThemeSelectionBackground\", tThemeSelectionBackground, EnvVarThemeSelectionBG},\n\t\t{\"Preferences\", tPreferences, EnvVarPreferences},\n\t\t{\"Localhash\", tLocalhash, EnvVarLocalhash},\n\t\t{\"CacheDir\", tCacheDir, EnvVarCacheDir},\n\t\t{\"CacheDir\", tDataDir, EnvVarDataDir},\n\t}\n\n\tcfg := NewConfig(testEnv)\n\n\tv := cfg.GetBool(EnvVarDebug)\n\tassert.Equal(t, tDebug, v, \"unexpected Debug\")\n\n\tfor _, td := range data {\n\t\ttd := td // capture variable\n\t\tt.Run(fmt.Sprintf(\"Config.Get(%v)\", td.name), func(t *testing.T) {\n\t\t\tt.Parallel()\n\t\t\tassert.Equal(t, td.x, cfg.Get(td.key), \"unexpected result\")\n\t\t})\n\t}\n}", "title": "" }, { "docid": "9aec051fa35585831b5087339d93abf1", "score": "0.59064066", "text": "func loadConfig(config *Config) {\n\t// Load path to config from CONFIGPATH environment variable\n\tconfigpath := os.Getenv(\"CONFIGPATH\")\n\tfile, _ := os.Open(configpath)\n\tdecoder := json.NewDecoder(file)\n\terr := decoder.Decode(&config)\n\tif err != nil {\n\t\tlog.Fatal(\"Error loading config.json:\", err)\n\t}\n}", "title": "" }, { "docid": "d43d103dc58486fad765cb262ce19ac1", "score": "0.5904642", "text": "func LoadFromEnvironment() (Creds, error) {\n\tfmt.Print(\"Loading credentials from environment\\n\")\n\treturn Creds{\n\t\tTenantID: os.Getenv(\"AZURE_TENANT_ID\"),\n\t\tSubscriptionID: os.Getenv(\"AZURE_SUBSCRIPTION_ID\"),\n\t\tClientID: os.Getenv(\"AZURE_CLIENT_ID\"),\n\t\tClientSecret: os.Getenv(\"AZURE_CLIENT_SECRET\"),\n\t}, nil\n}", "title": "" }, { "docid": "9f52034444053f67a1c6ae55c4fdb8e1", "score": "0.59032077", "text": "func loadEnv() error {\n\tenvFile := os.Getenv(\"ALIBABA_CLOUD_CREDENTIALS_FILE\")\n\tif envFile == \"\" {\n\t\treturn nil\n\t}\n\n\tif err := godotenv.Overload(envFile); err != nil {\n\t\treturn errors.Wrapf(err, \"error loading environment from ALIBABA_CLOUD_CREDENTIALS_FILE (%s)\", envFile)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9f52034444053f67a1c6ae55c4fdb8e1", "score": "0.59032077", "text": "func loadEnv() error {\n\tenvFile := os.Getenv(\"ALIBABA_CLOUD_CREDENTIALS_FILE\")\n\tif envFile == \"\" {\n\t\treturn nil\n\t}\n\n\tif err := godotenv.Overload(envFile); err != nil {\n\t\treturn errors.Wrapf(err, \"error loading environment from ALIBABA_CLOUD_CREDENTIALS_FILE (%s)\", envFile)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b2f12a33ddc6d308e949c15901a0a738", "score": "0.59019643", "text": "func fromEnvFile(log logrus.FieldLogger, configFile string) error {\n\tfd, err := os.Open(configFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while opening config file: %s\", err)\n\t}\n\n\tcontents, err := io.ReadAll(fd)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while reading config file '%s': %s\", configFile, err)\n\t}\n\tfor i, line := range strings.Split(string(contents), \"\\n\") {\n\t\t// Skip comments, empty lines or lines with tabs\n\t\tif strings.HasPrefix(line, \"#\") || strings.HasPrefix(line, \" \") ||\n\t\t\tstrings.HasPrefix(line, \"\\t\") || len(line) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tlog.Debugf(\"config: [%d] '%s'\", i, line)\n\t\tparts := strings.SplitN(line, \"=\", 2)\n\t\tif len(parts) != 2 {\n\t\t\treturn errors.Errorf(\"malformed key=value on line '%d'\", i)\n\t\t}\n\n\t\tif err := os.Setenv(strings.TrimSpace(parts[0]), strings.TrimSpace(parts[1])); err != nil {\n\t\t\treturn errors.Wrapf(err, \"while settings environ for '%s=%s'\", parts[0], parts[1])\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7a2ac3ff83e4ece9f15ad509fae1f756", "score": "0.5901889", "text": "func (c *Config) loadEnv() error {\n\treturn envconfig.Process(\"ubirch\", c)\n}", "title": "" }, { "docid": "d36313d6ed262e6e9a1704cf8eaed6ba", "score": "0.59017926", "text": "func (c *Configuration) IsEnvLocal() bool {\n\treturn c.Environment == EnvLocal\n}", "title": "" }, { "docid": "ea8777439ed1b05f95d00d5896d02677", "score": "0.5898782", "text": "func ReadEnvVar(w http.ResponseWriter, r *http.Request) {\n\te := \"\"\n\tfor _, env := range os.Environ() {\n\t\te += env + \"\\n\"\n\t}\n\tfmt.Fprint(w, e)\n}", "title": "" }, { "docid": "a0cd3efef4d403e69271aee00950ebdf", "score": "0.5895205", "text": "func setUpEnvironment() error {\n\n\tif configFilePath != \"\" { // override default location for the configuration file\n\t\trest.SetConfigFilePath(configFilePath)\n\t}\n\n\t// First Check if an environment is defined via the context (flags or ENV vars)\n\tc := getCecConfigFromEnv()\n\n\tif c.Url == \"\" {\n\n\t\t// First check that we have a configuration file\n\t\t_, err := ioutil.ReadFile(configFilePath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcl, err := rest.GetConfigList()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tactiveConfig, err := cl.GetActiveConfig()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc = *activeConfig\n\n\t\t// Refresh token if required\n\t\tif refreshed, err := rest.RefreshIfRequired(&c); refreshed {\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatal(\"Could not refresh authentication token:\", err)\n\t\t\t}\n\t\t\t// Copy config as IdToken will be cleared\n\t\t\tstoreConfig := c\n\t\t\trest.UpdateConfig(&storeConfig)\n\t\t}\n\t}\n\n\t// Store current computed config in a public static singleton\n\trest.DefaultConfig = &c\n\n\treturn nil\n}", "title": "" }, { "docid": "74bbe11577d8fb7fe839f86782f51e65", "score": "0.5890335", "text": "func FromEnv() (*APIConfig, error) {\n\t// load from .env.dev file for development but skip if not found\n\treturn FromEnvFile(\".env.dev\")\n}", "title": "" }, { "docid": "125e39b5b695eb9bcb11fdb15b71302a", "score": "0.5884915", "text": "func readConfig() {\n\n\t// Read config file from --config flag, if present\n\tconfig := viper.GetString(\"config\")\n\tif config != \"\" {\n\t\tviper.SetConfigFile(config)\n\t\tif err := viper.ReadInConfig(); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Failed to read config file from command line: %v\\n\", err)\n\t\t\tos.Exit(1)\n\t\t}\n\t\treturn\n\t}\n\n\tviper.SetConfigName(\"config\")\n\tviper.AddConfigPath(\"$HOME/.jiracli\")\n\tviper.AddConfigPath(\".\")\n\tif err := viper.ReadInConfig(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"Error reading config file, continuing without : %v\", err)\n\t}\n}", "title": "" }, { "docid": "19e7fae6e6e24e60112bf42f43c30d51", "score": "0.5884045", "text": "func ReadConfig() error {\n\n\texecutableLocation, err := os.Executable()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\texPath := filepath.Dir(executableLocation)\n\tconfigLocation := exPath + \"/config.json\"\n\tfile, err := ioutil.ReadFile(configLocation)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(file, &config)\n\n\tif err != nil {\n\t\tfmt.Println(err.Error())\n\t\treturn err\n\t}\n\n\tSaveDiameter = config.SaveDiameter\n\tSaveDir = config.SaveDir\n\tSaveEnd = config.SaveEnd\n\tSaveName = config.SaveName\n\tSaveNether = config.SaveNether\n\tSaveEnd = config.SaveEnd\n\tServerName = config.ServerName\n\tServerRootDirectory = config.ServerRootDirectory\n\tWorldName = config.WorldName\n\tWebHookURL = config.WebHookURL\n\n\treturn nil\n}", "title": "" }, { "docid": "8310c8ef98f4cd8a1f328f1b843c2987", "score": "0.58832556", "text": "func (spec *configSpec) LocalConfig() loader.ConfigContainer {\n\treturn nil\n}", "title": "" }, { "docid": "8310c8ef98f4cd8a1f328f1b843c2987", "score": "0.58832556", "text": "func (spec *configSpec) LocalConfig() loader.ConfigContainer {\n\treturn nil\n}", "title": "" }, { "docid": "e5e83557efcc269ffc8968fa32d2ec2e", "score": "0.58716387", "text": "func Local() Pool {\n\tjsonFile := LocalFilePath\n\tconfigFile, err := ioutil.ReadFile(jsonFile)\n\tif err != nil {\n\t\tfmt.Printf(\"[ERROR] The file '%s' does not exist! Please, check your configuration...\\n\\n\", jsonFile)\n\t\tos.Exit(1)\n\t}\n\tvar values Pool\n\terr = json.Unmarshal(configFile, &values)\n\tif err != nil {\n\t\tw.Err(\"[ERROR > config/local.go:56] it was not possible to parse the JSON configuration file.\")\n\t}\n\treturn values\n}", "title": "" }, { "docid": "61a025049007063cf5bb75de62e5c613", "score": "0.58681875", "text": "func GetENV(testDetails *types.TestDetails, expName, engineName string) {\n\ttestDetails.ExperimentName = expName\n\ttestDetails.EngineName = engineName\n\ttestDetails.OperatorName = Getenv(\"OPERATOR_NAME\", \"chaos-operator-ce\")\n\ttestDetails.ChaosNamespace = Getenv(\"CHAOS_NAMESPACE\", \"litmus\")\n\ttestDetails.AppNS = Getenv(\"APP_NS\", \"litmus\")\n\ttestDetails.AppLabel = Getenv(\"APP_LABEL\", \"run=nginx\")\n\ttestDetails.JobCleanUpPolicy = Getenv(\"JOB_CLEANUP_POLICY\", \"retain\")\n\ttestDetails.AnnotationCheck = Getenv(\"ANNOTATION_CHECK\", \"false\")\n\ttestDetails.ApplicationNodeName = Getenv(\"APPLICATION_NODE_NAME\", \"\")\n\ttestDetails.NodeSelectorName = Getenv(\"APPLICATION_NODE_NAME\", \"\")\n\ttestDetails.ImagePullPolicy = Getenv(\"IMAGE_PULL_POLICY\", \"Always\")\n\ttestDetails.ExperimentImagePullPolicy = Getenv(\"EXPERIMENT_IMAGE_PULL_POLICY\", \"Always\")\n\ttestDetails.ChaosDuration, _ = strconv.Atoi(Getenv(\"TOTAL_CHAOS_DURATION\", \"\"))\n\ttestDetails.ChaosServiceAccount = Getenv(\"CHAOS_SERVICE_ACCOUNT\", \"\")\n\ttestDetails.NewExperimentName = Getenv(\"NEW_EXPERIMENT_NAME\", expName)\n\ttestDetails.Delay, _ = strconv.Atoi(Getenv(\"DELAY\", \"5\"))\n\ttestDetails.Duration, _ = strconv.Atoi(Getenv(\"DURATION\", \"180\"))\n\ttestDetails.FillPercentage, _ = strconv.Atoi(Getenv(\"FILL_PERCENTAGE\", \"20\"))\n\ttestDetails.CPUKillCommand = Getenv(\"CPU_KILL_COMMAND\", \"kill -9 $(ps afx | grep \\\"[md5sum] /dev/zero\\\" | awk '{print$1}' | tr '\\\\n' ' ')\")\n\ttestDetails.MemoryKillCommand = Getenv(\"MEMORY_KILL_COMMAND\", \"kill -9 $(ps afx | grep \\\"[dd] if /dev/zero\\\" | awk '{print$1}' | tr '\\\\n' ' ')\")\n\ttestDetails.InstanceID = Getenv(\"EC2_INSTANCE_ID\", \"\")\n\ttestDetails.InstanceTag = Getenv(\"EC2_INSTANCE_TAG\", \"\")\n\ttestDetails.EBSVolumeID = Getenv(\"EBS_VOLUME_ID\", \"\")\n\ttestDetails.EBSVolumeTag = Getenv(\"EBS_VOLUME_TAG\", \"\")\n\ttestDetails.VMInstanceNames = Getenv(\"VM_INSTANCE_NAMES\", \"\")\n\ttestDetails.GCPProjectID = Getenv(\"GCP_PROJECT_ID\", \"\")\n\ttestDetails.InstanceZones = Getenv(\"INSTANCE_ZONES\", \"\")\n\ttestDetails.DiskVolumeNames = Getenv(\"DISK_VOLUME_NAMES\", \"\")\n\ttestDetails.DiskZones = Getenv(\"DISK_ZONES\", \"\")\n\ttestDetails.DeviceNames = Getenv(\"DEVICE_NAMES\", \"\")\n\ttestDetails.VMIds = Getenv(\"APP_VM_MOIDS\", \"\")\n\ttestDetails.Region = Getenv(\"REGION\", \"us-west-1\")\n\ttestDetails.UpdateWebsite = Getenv(\"UPDATE_WEBSITE\", \"false\")\n\ttestDetails.TargetNodes = Getenv(\"TARGET_NODES\", \"\")\n\ttestDetails.NodeLabel = Getenv(\"NODE_LABEL\", \"\")\n\ttestDetails.AzureResourceGroup = Getenv(\"AZURE_RESOURCE_GROUP\", \"\")\n\ttestDetails.AzureInstanceName = Getenv(\"AZURE_INSTANCE_NAME\", \"\")\n\ttestDetails.AzureDiskName = Getenv(\"AZURE_DISK_NAME\", \"\")\n\ttestDetails.AzureScaleSet = Getenv(\"AZURE_SCALE_SET\", \"\")\n\ttestDetails.ProcessIds = Getenv(\"PROCESS_IDS\", \"\")\n\ttestDetails.Args = Getenv(\"ARGS\", \"\")\n\ttestDetails.Command = Getenv(\"COMMAND\", \"\")\n\n\t//All Images for running chaos test\n\ttestDetails.AnsibleExperimentImage = Getenv(\"ANSIBLE_EXPERIMENT_IMAGE\", \"litmuschaos/ansible-runner:ci\")\n\ttestDetails.ExperimentImage = Getenv(\"EXPERIMENT_IMAGE\", \"litmuschaos/go-runner:ci\")\n\ttestDetails.OperatorImage = Getenv(\"OPERATOR_IMAGE\", \"litmuschaos/chaos-operator:ci\")\n\ttestDetails.RunnerImage = Getenv(\"RUNNER_IMAGE\", \"litmuschaos/chaos-runner:ci\")\n\ttestDetails.LibImage = Getenv(\"LIB_IMAGE\", \"\")\n\n\t// All Links for running chaos testing\n\ttestDetails.RbacPath = Getenv(\"RBAC_PATH\", \"https://hub.litmuschaos.io/api/chaos/master?file=charts/generic/\"+expName+\"/rbac.yaml\")\n\ttestDetails.ExperimentPath = Getenv(\"EXPERIMENT_PATH\", \"https://hub.litmuschaos.io/api/chaos/master?file=charts/generic/\"+expName+\"/experiment.yaml\")\n\ttestDetails.EnginePath = Getenv(\"ENGINE_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/engine.yaml\")\n\ttestDetails.AnsibleRbacPath = Getenv(\"ANSIBLE_RBAC_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/rbac.yaml\")\n\ttestDetails.AnsibleExperimentPath = Getenv(\"ANSIBLE_EXPERIMENT_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/experiment.yaml\")\n\ttestDetails.AnsibleEnginePath = Getenv(\"ANSIBLE_ENGINE_PATH\", \"https://raw.githubusercontent.com/litmuschaos/chaos-charts/master/charts/generic/\"+expName+\"/ansible/engine.yaml\")\n\ttestDetails.InstallLitmus = Getenv(\"INSTALL_LITMUS\", \"https://litmuschaos.github.io/litmus/litmus-operator-latest.yaml\")\n\ttestDetails.AdminRbacPath = Getenv(\"ADMIN_RBAC_PATH\", \"https://litmuschaos.github.io/litmus/litmus-admin-rbac.yaml\")\n\n\t// Portal Envs\n\ttestDetails.Version = Getenv(\"RUN_VERSION\", \"ci\")\n}", "title": "" }, { "docid": "93b19af19c36f7b04888983fefe16616", "score": "0.5863033", "text": "func (cfg *Config) OnLocal() bool {\n return cfg.Env == env.Local\n}", "title": "" }, { "docid": "3fa86f8b25c4894e0bad02d07719fe1b", "score": "0.5862966", "text": "func ReadConfig(env string) *Config {\n\n\tviper.SetConfigName(env)\n\tviper.AddConfigPath(\".\")\n\tviper.AddConfigPath(\"$HOME/\")\n\tviper.AddConfigPath(\"$HOME/.cowherd\")\n\tviper.AddConfigPath(\"/etc/cowherd/\")\n\tviper.ReadInConfig()\n\n\tendpoint := viper.GetString(\"endpoint\")\n\tuser := viper.GetString(\"user\")\n\tpassword := viper.GetString(\"password\")\n\n\tfmt.Print(viper.ConfigFileUsed())\n\tfmt.Print(viper.AllSettings())\n\n\tviper.SetEnvPrefix(\"cowherd\")\n\tviper.AutomaticEnv()\n\n\tif endpoint == \"\" || user == \"\" || password == \"\" {\n\t\tfmt.Println(USAGE)\n\t\tos.Exit(1)\n\t}\n\n\treturn &Config{\n\t\tEndpoint: endpoint,\n\t\tUser: user,\n\t\tPassword: password,\n\t}\n\n}", "title": "" }, { "docid": "44c40c5aa9229d5d0047437c75687471", "score": "0.5861447", "text": "func (env *Config) Read(ptr interface{}, opts ...config.ReadOption) error {\n\tops := &config.ReadOptions{}\n\tops.Apply(opts...)\n\tif ops.File != \"\" {\n\t\tif err := loadEnvFromFile(ops.File); err != nil {\n\t\t\tlog.Printf(\"[ERROR] failed to read env config from file, err: %v\\n\", err)\n\t\t}\n\t}\n\treturn envconfig.Process(ops.Prefix, ptr)\n}", "title": "" }, { "docid": "d7b40da075d56d0fd2c3f6c961806f45", "score": "0.5852899", "text": "func TestEnvConfiguration(t *testing.T) {\n\t//set envrionment properties\n\tos.Setenv(databaseHost, \"10.55.22.196\")\n\tos.Setenv(databasePort, \"37017\")\n\tos.Setenv(databaseUsername, \"shubham\")\n\tos.Setenv(databasePassword, \"verekar\")\n\tos.Setenv(databaseName, \"mydatabase\")\n\tos.Setenv(serverPort, \"9090\")\n\tos.Setenv(cacheMem, \"512\")\n\tos.Setenv(mqHost, \"10.55.22.196\")\n\tos.Setenv(mqPort, \"5672\")\n\tos.Setenv(mqUsername, \"shubham\")\n\tos.Setenv(mqPassword, \"verekar\")\n\tos.Setenv(mqQueue, \"events\")\n\n\tvar configManager Manager\n\tconfiguration, _ := configManager.Load(\"\", \"yaml\")\n\trequire.Equal(t, configuration, envconfiguration, \"configuration should be equal to env configuration object\")\n\trequire.Equal(t, configManager.getConfiguration(), envconfiguration, \"configuration should be equal to env configuration object\")\n}", "title": "" }, { "docid": "e7e664f3ac626d9b944b79042bc97d2a", "score": "0.5852693", "text": "func ReadEnvFile() error {\n\tfmt.Println(\"reading env file\")\n\t// err := gotenv.Load() // to allow use of .env file\n\t// if err != nil && !strings.HasPrefix(err.Error(), \"open .env:\") {\n\t// \treturn errk\n\t// }\n\treturn nil\n}", "title": "" }, { "docid": "c076e43ecc37ddb11192905d516990a1", "score": "0.58510154", "text": "func getConfig() (config, error) {\n\tv := viper.New()\n\t// Support reading file & folder paths for nextcloud and local from flags\n\tpflag.String(\"nc_folder_path\", \"\", \"nextcloud folder path\")\n\tv.BindPFlag(\"nc_folder_path\", pflag.Lookup(\"nc_folder_path\"))\n\tpflag.String(\"nc_file_name\", \"\", \"nextcloud file name\")\n\tv.BindPFlag(\"nc_file_name\", pflag.Lookup(\"nc_file_name\"))\n\tpflag.String(\"local_folder_path\", \"\", \"local folder path\")\n\tv.BindPFlag(\"local_folder_path\", pflag.Lookup(\"local_folder_path\"))\n\tpflag.String(\"local_file_name\", \"\", \"local file name\")\n\tv.BindPFlag(\"local_file_name\", pflag.Lookup(\"local_file_name\"))\n\n\tpflag.Bool(\"d\", false, \"download from nextcloud server\")\n\tv.BindPFlag(\"d\", pflag.Lookup(\"d\"))\n\tpflag.Bool(\"u\", false, \"upload to nextcloud server\")\n\tv.BindPFlag(\"u\", pflag.Lookup(\"u\"))\n\n\tpflag.Parse()\n\tv.SetConfigName(\"config\")\n\tv.SetConfigType(\"env\")\n\tv.AddConfigPath(\".\")\n\tif err := v.ReadInConfig(); err != nil {\n\t\treturn config{}, errors.Wrap(err, \"Cannot read env config, env file should be named config.env\")\n\t}\n\tv.AutomaticEnv()\n\n\t// viper cannot unmarshal when using AutomaticEnv\n\tvar c config = config{\n\t\thostURL: v.GetString(\"host_url\"),\n\t\tusername: v.GetString(\"username\"),\n\t\tpassword: v.GetString(\"password\"),\n\t\tncFolderPath: v.GetString(\"nc_folder_path\"),\n\t\tncFileName: v.GetString(\"nc_file_name\"),\n\t\tlocalFolderPath: v.GetString(\"local_folder_path\"),\n\t\tlocalFileName: v.GetString(\"local_file_name\"),\n\t\tdownload: v.GetBool(\"d\"),\n\t\tupload: v.GetBool(\"u\"),\n\t}\n\treturn c, nil\n}", "title": "" }, { "docid": "546717e2e37e54883f5dbb3cbb9f81df", "score": "0.58494776", "text": "func ReadEnvironmentFile(path string) (map[string]string, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer f.Close()\n\n\tresult := map[string]string{}\n\n\tscanner := bufio.NewScanner(f)\n\tfor scanner.Scan() {\n\t\ts := strings.TrimSpace(scanner.Text())\n\t\t// Allow for comments in environment file\n\t\tif strings.HasPrefix(s, \"#\") || strings.HasPrefix(s, \"//\") {\n\t\t\tcontinue\n\t\t}\n\t\tparts := strings.SplitN(s, \"=\", 2)\n\t\tif len(parts) != 2 {\n\t\t\tcontinue\n\t\t}\n\t\tresult[strings.TrimSpace(parts[0])] = strings.TrimSpace(parts[1])\n\t}\n\n\treturn result, scanner.Err()\n}", "title": "" }, { "docid": "eb5f56aa6cc25072629962cca53bf526", "score": "0.58407503", "text": "func ReadEnvFile(path string) (map[string]interface{}, error) {\n\tmappedEnv := make(map[string]interface{})\n\n\tvar content io.Reader\n\tvar err error\n\n\tcontent, err = os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(content)\n\tenv, err := gotenv.StrictParse(buf)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tfor k, v := range env {\n\t\tmappedEnv[k] = v\n\t}\n\treturn mappedEnv, nil\n}", "title": "" }, { "docid": "9c78a4d660103e03c1263fdb3e9debdf", "score": "0.5839364", "text": "func init() {\n\t_ = env.Unmarshal(&cfgEnviron)\n}", "title": "" }, { "docid": "514e0ccaf25b28e989ba6ba3efe0e8a0", "score": "0.58387387", "text": "func GetEnv() {\n\tconfig.apiKey = GetEnvVar(\"APIKEY\")\n\tconfig.authKey = GetEnvVar(\"AUTHKEY\")\n\tconfig.authUrl = GetEnvVar(\"AUTHURL\")\n\tconfig.port = GetEnvVar(\"PORT\")\n}", "title": "" }, { "docid": "89d6757f971c578025e21bb489615d60", "score": "0.58383775", "text": "func init() {\n\tif err := cleanenv.ReadEnv(&cfg); err != nil {\n\t\te.Logger.Fatal(\"Unable to load configuration\")\n\t}\n\tfmt.Printf(\"Config: %+v\", cfg)\n}", "title": "" } ]
389e10afd25007ee498fca05834c0da2
HasPermissionsFor returns whether the committee is authorized to enact a proposal. As long as one permission allows the proposal then it goes through. Its the OR of all permissions.
[ { "docid": "d60a4986b785c8ac9f79a0d531d76cc5", "score": "0.84044987", "text": "func (c Committee) HasPermissionsFor(ctx sdk.Context, appCdc *codec.Codec, pk ParamKeeper, proposal PubProposal) bool {\n\tfor _, p := range c.Permissions {\n\t\tif p.Allows(ctx, appCdc, pk, proposal) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" } ]
[ { "docid": "ba772de00ca42c2307dca0acd4fc2999", "score": "0.6542542", "text": "func (o *IdentityTestIAMPermissionsRequest) HasPermissions() bool {\n\tif o != nil && o.Permissions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "dee85912bafecd4b0c2ffa1bc04dee84", "score": "0.64634705", "text": "func (o *ParameterContextReferenceEntity) HasPermissions() bool {\n\tif o != nil && o.Permissions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e205bbe6712d8ae277829922c67b2bad", "score": "0.62914836", "text": "func (c *Client) HasPermissions(orgID string, permissions ...string) bool {\n\tintrospect, _, err := c.Introspect(WithOrgContext(orgID))\n\tif err != nil {\n\t\treturn false\n\t}\n\tfoundOrg := false\n\tfor _, org := range introspect.Organizations.OrganizationList {\n\t\tif org.OrganizationID != orgID {\n\t\t\tcontinue\n\t\t}\n\t\tfoundOrg = true\n\t\t// Search in the organization effective permissions list\n\t\tfor _, p := range permissions {\n\t\t\tfound := false\n\t\t\tfor _, q := range org.EffectivePermissions {\n\t\t\t\tif p == q {\n\t\t\t\t\tfound = true\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !found {\n\t\t\t\t// Permission is missing so return false\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn foundOrg\n}", "title": "" }, { "docid": "b5f542926348db22cefe3d795096e0d9", "score": "0.62790585", "text": "func (o *InlineResponse20013People) HasPermissions() bool {\n\tif o != nil && o.Permissions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "d2ec8e2abaf5a845fb1c732273937111", "score": "0.6177645", "text": "func (a keystoneAuthorization) HasPermission(perm keppel.Permission, tenantID string) bool {\n\ta.t.Context.Request[\"target.project.id\"] = tenantID\n\tlogg.Debug(\"token has object attributes = %v\", a.t.Context.Request)\n\n\trule, hasRule := ruleForPerm[perm]\n\tif !hasRule {\n\t\treturn false\n\t}\n\n\tresult := a.t.Check(rule)\n\tlogg.Debug(\"policy rule %q evaluates to %t\", rule, result)\n\treturn result\n}", "title": "" }, { "docid": "beb9beba79bcdc83251f1da029554716", "score": "0.61151344", "text": "func (a *AuthorizationInfo) IsPermittedp(permission *Permission) bool {\n\tif permission == nil {\n\t\treturn false\n\t}\n\n\tfor _, rp := range a.permissions {\n\t\tif rp.Implies(permission) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "170835130ca2b0676e3e83112f7a85ea", "score": "0.5936292", "text": "func (c *Claims) Can(perms ...string) bool {\n\tfor _, p := range c.Permissions {\n\t\tfor _, v := range perms {\n\t\t\tif v == p {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ca47112801b6171101682daa5bb966f3", "score": "0.59286654", "text": "func (a *authorizer) PermissionsFor(sub types.Subject) (map[types.Object]types.Action, error) {\n\tperms, e := a.p.PermissionsFor(sub)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\tif a.sg != nil {\n\t\troles, e := a.sg.GroupsOf(sub)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\n\t\tif perms == nil {\n\t\t\tperms = make(map[types.Object]types.Action)\n\t\t}\n\n\t\tfor role := range roles {\n\t\t\tsp, e := a.p.PermissionsFor(role.(types.Role))\n\t\t\tif e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t\tfor obj, act := range sp {\n\t\t\t\tperms[obj] |= act\n\t\t\t}\n\t\t}\n\t}\n\n\treturn perms, nil\n}", "title": "" }, { "docid": "5d59bc2ce00720428969a9a8d9dba76c", "score": "0.59254664", "text": "func (dazeus *DaZeus) HasPermission(permission string, scope Scope, allow bool) (bool, error) {\n\tif scope.IsAll() {\n\t\treturn false, errors.New(\"Will not check permission for universal scope\")\n\t}\n\n\tresp, err := writeForSuccessResponse(dazeus, map[string]interface{}{\n\t\t\"do\": \"permission\",\n\t\t\"scope\": scope.ToSlice(),\n\t\t\"params\": []interface{}{\"has\", permission, allow},\n\t})\n\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\tperm, ok := resp[\"has_permission\"].(bool)\n\tif !ok {\n\t\treturn false, errors.New(\"Did not retrieve permission from server\")\n\t}\n\treturn perm, nil\n}", "title": "" }, { "docid": "a1154ac5cb9206b9e4c88536f71735ba", "score": "0.5896019", "text": "func (s *Server) HasPermissionForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) {\n\te, err := s.getEnforcer(int(in.EnforcerHandler))\n\tif err != nil {\n\t\treturn &pb.BoolReply{}, err\n\t}\n\n\treturn &pb.BoolReply{Res: e.HasPolicy(s.convertPermissions(in.User, in.Permissions...)...)}, nil\n}", "title": "" }, { "docid": "cc023d782cc5c1889b6494a0938d0406", "score": "0.58893365", "text": "func (a *AuthorizationInfo) IsPermittedAll(permissions ...string) bool {\n\tfor _, permission := range permissions {\n\t\tp, _ := NewPermission(permission)\n\t\tif !a.IsPermittedp(p) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "dd0c0899630f6c4c63a04ce7870546a9", "score": "0.5882484", "text": "func (o *IamAppRegistrationAllOf) HasPermission() bool {\n\tif o != nil && o.Permission != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "580d41a0f5f3737adb7c1753091434ab", "score": "0.58472586", "text": "func (a *keystoneUserIdentity) HasPermission(perm keppel.Permission, tenantID string) bool {\n\ta.t.Context.Request[\"target.project.id\"] = tenantID\n\tlogg.Debug(\"token has object attributes = %v\", a.t.Context.Request)\n\n\trule, hasRule := ruleForPerm[perm]\n\tif !hasRule {\n\t\treturn false\n\t}\n\n\tresult := a.t.Check(rule)\n\tlogg.Debug(\"policy rule %q evaluates to %t\", rule, result)\n\treturn result\n}", "title": "" }, { "docid": "73bfe2e5ad314879de31efd75c2edbb0", "score": "0.584503", "text": "func (o *PatchedTokenUpdate) HasPermissions() bool {\n\tif o != nil && !IsNil(o.Permissions) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e20481ca1a52acab14995b4bf5c175cd", "score": "0.58213997", "text": "func (s *Server) HasImplicitPermissionForUser(ctx context.Context, in *pb.PermissionRequest) (*pb.BoolReply, error) {\n\te, err := s.getEnforcer(int(in.EnforcerHandler))\n\tif err != nil {\n\t\treturn &pb.BoolReply{}, err\n\t}\n\n\tmatched := false\n\tfor _, fieldValue := range e.GetImplicitPermissionsForUser(in.User) {\n\t\tif arrayEquals(fieldValue[1:], in.Permissions) {\n\t\t\tmatched = true\n\t\t\tbreak\n\t\t}\n\t}\n\n\treturn &pb.BoolReply{Res: matched}, nil\n}", "title": "" }, { "docid": "d701458083e26667d652ea29cdaa500c", "score": "0.57009125", "text": "func (s *permissionServiceImpl) HasScope(ctx context.Context, identityID uuid.UUID, resourceID string, scopeName string) (bool, error) {\n\n\tidentityRoles, err := s.Repositories().IdentityRoleRepository().FindPermissions(ctx, identityID, resourceID, scopeName)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn len(identityRoles) > 0, nil\n}", "title": "" }, { "docid": "3b25bd2739614ee0997486bdd73ddefa", "score": "0.5682599", "text": "func (o *MzPermissionsList) HasPermissions() bool {\n\tif o != nil && o.Permissions != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "bf4f08d9a11282e1469986051fa62c6a", "score": "0.5593023", "text": "func (o *TeamPermission) HasPermission() bool {\n\tif o != nil && o.Permission != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e1ab513b1b1a1a1b40968a4d24bfe2fd", "score": "0.55793625", "text": "func (a *AuthorizationInfo) IsPermittedAllp(permissions ...*Permission) bool {\n\tfor _, permission := range permissions {\n\t\tif !a.IsPermittedp(permission) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ea8b58f09212262528ca3747a5fe557d", "score": "0.55503774", "text": "func (p Permissions) Can(action string, target string) (bool, error) {\n\tfor _, permission := range p {\n\t\tcan, err := permission(action, target)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tif can {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "a57666d6bdd548d90e6dc64fd90b5b64", "score": "0.5543638", "text": "func PermissionsEnabled() bool {\n\tif PermissionModel == V2 {\n\t\treturn qip714BlockReached\n\t} else {\n\t\treturn qip714BlockReached && networkBootUpCompleted\n\t}\n}", "title": "" }, { "docid": "25b1f02fc0502709472d14fad27a9e69", "score": "0.5540287", "text": "func (a *AuthorizationInfo) IsPermitted(permission string) bool {\n\tp, _ := NewPermission(permission)\n\treturn a.IsPermittedp(p)\n}", "title": "" }, { "docid": "3579cd0578b109741a5af02701ee968f", "score": "0.552703", "text": "func (u User) HasPermission(id string) bool {\n\tfor _, p := range u.Permissions {\n\t\tif p.ID == id {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "2d15df281afbc18cd317e8779db4ea9c", "score": "0.55095106", "text": "func (t *Manager) CanF(permission string, roles []string, f PermissionFunc) bool {\n\tfor _, name := range roles {\n\t\tif role, ok := t.roles[name]; ok {\n\t\t\treturn role.Permit(permission) && f(permission)\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "098520aa0c660b9188edf952fb913580", "score": "0.5458821", "text": "func (svc service) Can(ctx context.Context, res Resource, op Operation, ff ...CheckAccessFunc) bool {\n\t{\n\t\t// @todo remove this ASAP\n\t\t// for now, we need it because of complex init/setup relations under system\n\t\tctxTestingVal := ctx.Value(\"testing\")\n\t\tif t, ok := ctxTestingVal.(bool); ok && t {\n\t\t\treturn true\n\t\t}\n\t}\n\n\tu := auth.GetIdentityFromContext(ctx)\n\n\tif auth.IsSuperUser(u) {\n\t\treturn true\n\t}\n\n\tvar roles = u.Roles()\n\t// Checking rules\n\tvar v = svc.Check(res, op, roles...)\n\tif v != Inherit {\n\t\treturn v == Allow\n\t}\n\n\t// Checking fallback functions\n\tfor _, f := range ff {\n\t\tv = f()\n\n\t\tif v != Inherit {\n\t\t\treturn v == Allow\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e2fdd0a9dd93e7fdf331f6df90c73ab5", "score": "0.54439765", "text": "func (a *Auth) Can(capabilities ...string) bool {\n\tfor _, c := range capabilities {\n\t\tif a.can(c) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "da58cdda1d53a86b329425e168341a34", "score": "0.5436456", "text": "func (c *Negotiator) Permissions(opts ...Option) bool {\n\tif c.permissions != nil {\n\t\tnn := *c\n\t\tgetOpts(&nn, opts...)\n\t\treturn c.permissions(&nn)\n\t}\n\treturn false\n}", "title": "" }, { "docid": "85296fef214a8d160c804e9c0f97ec02", "score": "0.5434487", "text": "func (u *User) Can(actions ...string) bool {\n\tif u.Suspended {\n\t\treturn false\n\t}\n\tif len(actions) == 1 && actions[0] == \"\" {\n\t\treturn true\n\t}\n\tfor _, action := range actions {\n\t\tcanDo := false\n\t\tfor _, permission := range u.Permissions {\n\t\t\tif string(permission) == action {\n\t\t\t\tcanDo = true\n\t\t\t}\n\t\t}\n\t\tif canDo == false {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "653a495c1184b20a6779a87bcb7f244f", "score": "0.5432919", "text": "func (state PermissionState) IsGranted() bool {\n return state == PermissionGranted\n}", "title": "" }, { "docid": "60ac0f0d911e8510329fc102ffaba2f2", "score": "0.53992224", "text": "func HasPermission(permisson Permission) Checker {\n\treturn func(sub Sub, res Res) error {\n\t\tfor _, perm := range sub.Permissions {\n\t\t\tif perm == string(permisson) {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\treturn biz.NewErr(biz.CodeForbidden, fmt.Sprintf(\"[%s] required!\", permisson))\n\t}\n}", "title": "" }, { "docid": "de21caef3a9eb2fd1c1f0ea4ea62e405", "score": "0.5359006", "text": "func (p *Permissions) HasPermission(ctx context.Context, n *Node, check func(*provider.ResourcePermissions) bool) (can bool, err error) {\n\tvar u *userv1beta1.User\n\tvar perms *provider.ResourcePermissions\n\tif u, perms = p.getUserAndPermissions(ctx, n); perms != nil {\n\t\treturn check(perms), nil\n\t}\n\n\t// determine root\n\tvar rn *Node\n\tif rn, err = p.lu.RootNode(ctx); err != nil {\n\t\treturn false, err\n\t}\n\n\tcn := n\n\n\t// for an efficient group lookup convert the list of groups to a map\n\t// groups are just strings ... groupnames ... or group ids ??? AAARGH !!!\n\tgroupsMap := make(map[string]bool, len(u.Groups))\n\tfor i := range u.Groups {\n\t\tgroupsMap[u.Groups[i]] = true\n\t}\n\n\tvar g *provider.Grant\n\t// for all segments, starting at the leaf\n\tfor cn.ID != rn.ID {\n\t\tvar grantees []string\n\t\tif grantees, err = cn.ListGrantees(ctx); err != nil {\n\t\t\tappctx.GetLogger(ctx).Error().Err(err).Interface(\"node\", cn).Msg(\"error listing grantees\")\n\t\t\treturn false, err\n\t\t}\n\n\t\tuserace := xattrs.GrantPrefix + xattrs.UserAcePrefix + u.Id.OpaqueId\n\t\tuserFound := false\n\t\tfor i := range grantees {\n\t\t\t// we only need the find the user once per node\n\t\t\tswitch {\n\t\t\tcase !userFound && grantees[i] == userace:\n\t\t\t\tg, err = cn.ReadGrant(ctx, grantees[i])\n\t\t\tcase strings.HasPrefix(grantees[i], xattrs.GrantPrefix+xattrs.GroupAcePrefix):\n\t\t\t\tgr := strings.TrimPrefix(grantees[i], xattrs.GrantPrefix+xattrs.GroupAcePrefix)\n\t\t\t\tif groupsMap[gr] {\n\t\t\t\t\tg, err = cn.ReadGrant(ctx, grantees[i])\n\t\t\t\t} else {\n\t\t\t\t\t// no need to check attribute\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\t// no need to check attribute\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tswitch {\n\t\t\tcase err == nil:\n\t\t\t\tappctx.GetLogger(ctx).Debug().Interface(\"node\", cn).Str(\"grant\", grantees[i]).Interface(\"permissions\", g.GetPermissions()).Msg(\"checking permissions\")\n\t\t\t\tif check(g.GetPermissions()) {\n\t\t\t\t\treturn true, nil\n\t\t\t\t}\n\t\t\tcase isAttrUnset(err):\n\t\t\t\terr = nil\n\t\t\t\tappctx.GetLogger(ctx).Error().Interface(\"node\", cn).Str(\"grant\", grantees[i]).Interface(\"grantees\", grantees).Msg(\"grant vanished from node after listing\")\n\t\t\tdefault:\n\t\t\t\tappctx.GetLogger(ctx).Error().Err(err).Interface(\"node\", cn).Str(\"grant\", grantees[i]).Msg(\"error reading permissions\")\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\tif cn, err = cn.Parent(); err != nil {\n\t\t\treturn false, errors.Wrap(err, \"decomposedfs: error getting parent \"+cn.ParentID)\n\t\t}\n\t}\n\n\tappctx.GetLogger(ctx).Debug().Interface(\"permissions\", NoPermissions()).Interface(\"node\", n).Interface(\"user\", u).Msg(\"no grant found, returning default permissions\")\n\treturn false, nil\n}", "title": "" }, { "docid": "18852e5a5fbed7a3202f32996ef48e4a", "score": "0.5343993", "text": "func HasPermission(state AccountGetter, acc *acm.Account, perm ptypes.PermFlag) bool {\n\tif perm > ptypes.AllPermFlags {\n\t\tPanicSanity(\"Checking an unknown permission in state should never happen\")\n\t}\n\n\tif acc == nil {\n\t\t// TODO\n\t\t// this needs to fall back to global or do some other specific things\n\t\t// eg. a bondAcc may be nil and so can only bond if global bonding is true\n\t}\n\tpermString := ptypes.PermFlagToString(perm)\n\n\tv, err := acc.Permissions.Base.Get(perm)\n\tif _, ok := err.(ptypes.ErrValueNotSet); ok {\n\t\tif state == nil {\n\t\t\tPanicSanity(\"All known global permissions should be set!\")\n\t\t}\n\t\tlog.Info(\"Permission for account is not set. Querying GlobalPermissionsAddress\", \"perm\", permString)\n\t\treturn HasPermission(nil, state.GetAccount(ptypes.GlobalPermissionsAddress), perm)\n\t} else if v {\n\t\tlog.Info(\"Account has permission\", \"address\", Fmt(\"%X\", acc.Address), \"perm\", permString)\n\t} else {\n\t\tlog.Info(\"Account does not have permission\", \"address\", Fmt(\"%X\", acc.Address), \"perm\", permString)\n\t}\n\treturn v\n}", "title": "" }, { "docid": "d1d73219b054a3f8c6a8503218dfb4a9", "score": "0.5301067", "text": "func pubAllowed(perms *perm, subject string) bool {\n\tallowed := true\n\tif perms.allow != nil {\n\t\tr := perms.allow.Match(subject)\n\t\tallowed = len(r.psubs) != 0\n\t}\n\t// If we have a deny list and are currently allowed, check that as well.\n\tif allowed && perms.deny != nil {\n\t\tr := perms.deny.Match(subject)\n\t\tallowed = len(r.psubs) == 0\n\t}\n\treturn allowed\n}", "title": "" }, { "docid": "070fef5ddb7147b2c3b4b0bfdd052a40", "score": "0.5265285", "text": "func IsReferencePermitted(\n\tctx context.Context,\n\tclient kube_client.Client,\n\treference PolicyReference,\n) (bool, error) {\n\tif reference.from.Namespace == reference.toNamespace {\n\t\treturn true, nil\n\t}\n\n\tpolicies := &gatewayapi.ReferenceGrantList{}\n\tif err := client.List(ctx, policies, kube_client.InNamespace(reference.toNamespace)); err != nil {\n\t\treturn false, errors.Wrap(err, \"failed to list ReferencePolicies\")\n\t}\n\n\tfor _, policy := range policies.Items {\n\t\tif !someFromMatches(reference.from, policy.Spec.From) {\n\t\t\tcontinue\n\t\t}\n\n\t\tif someToMatches(reference.to, policy.Spec.To) {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "5732a99bf627c58258d524fa3a99c4c7", "score": "0.5257154", "text": "func (a *Manager) Can(userID int, subject, action string) bool {\n\tid := userIdentifier(userID)\n\tif !a.enforcer.Enforce(id, subject, action) {\n\t\ta.logger.Debugf(\"%+v\\n\", a.enforcer.GetPolicy())\n\t\ta.logger.Infof(\"permission denied to %s for %s.%s\\n\", id, subject, action)\n\t\treturn false\n\t}\n\n\ta.logger.Debugf(\"permission granted to %s for %s.%s\\n\", id, subject, action)\n\treturn true\n}", "title": "" }, { "docid": "71ff8ad7d8060d7118bdde1da171f697", "score": "0.5242625", "text": "func (o *AuthenticationMode) HasAuthorizationProvider() bool {\n\tif o != nil && o.AuthorizationProvider != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "85640f4832af2fd415a2ee8cefaa1a3d", "score": "0.5238159", "text": "func (o PluginOutput) GrantAllPermissions() pulumi.BoolPtrOutput {\n\treturn o.ApplyT(func(v *Plugin) pulumi.BoolPtrOutput { return v.GrantAllPermissions }).(pulumi.BoolPtrOutput)\n}", "title": "" }, { "docid": "96fd2d99d0734c098ffaf3f86916dbed", "score": "0.52274406", "text": "func (state PermissionState) IsLooselyGranted() bool {\n return (state == PermissionGranted) || (state == PermissionNeglected)\n}", "title": "" }, { "docid": "382d4b993958f98f082abf7c648ce6c3", "score": "0.52033013", "text": "func (c *charon) IsGranted(ctx context.Context, userID int64, perm Permission) (bool, error) {\n\treq := &IsGrantedRequest{\n\t\tUserId: userID,\n\t\tPermission: perm.String(),\n\t}\n\n\tres, err := c.client.IsGranted(ctx, req)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treturn res.Granted, nil\n}", "title": "" }, { "docid": "88430f0977a214f72c8b4284df6ffdc9", "score": "0.51980126", "text": "func Has(ctx context.Context, perm int) bool {\n\tmu.Lock()\n\tdefer mu.Unlock()\n\n\tval := ctx.Value(userKey)\n\tif val == nil {\n\t\treturn false\n\t}\n\n\tuser := val.(*model.User)\n\tif user == nil {\n\t\treturn false\n\t}\n\n\tallowedRoles, ok := perms[perm]\n\tif !ok {\n\t\treturn false\n\t}\n\n\tfor _, roleID := range user.GetRoles() {\n\t\tfor _, allowedRoleID := range allowedRoles {\n\t\t\tif roleID == allowedRoleID {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "245588834bf25a04f1a040ffc77791de", "score": "0.5187484", "text": "func (policy *AuthorizationPolicies) IsGlobalPermissiveEnabled() bool {\n\treturn policy != nil && policy.RbacConfig != nil &&\n\t\tpolicy.RbacConfig.EnforcementMode == rbacproto.EnforcementMode_PERMISSIVE\n}", "title": "" }, { "docid": "98d0ddfed0e06996a9d03668472d14f3", "score": "0.5157884", "text": "func ValidatePermissions(client Client, ic *types.InstallConfig) error {\n\t// Prepare requests for permissions check\n\treviewObjs := createReviewObjs(ic.Platform.Kubevirt.Namespace)\n\n\t// Collection of missing permissions\n\tvar notAllowedObjs []*authv1.SelfSubjectAccessReview\n\n\t// Test each permission\n\tfor _, reviewObj := range reviewObjs {\n\t\treviewObjPointer, err := client.CreateSelfSubjectAccessReview(context.Background(), &reviewObj)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif !reviewObjPointer.Status.Allowed {\n\t\t\tnotAllowedObjs = append(notAllowedObjs, reviewObjPointer)\n\t\t}\n\t}\n\n\t// Put all missing permissions in one error message\n\tif len(notAllowedObjs) > 0 {\n\t\tvar notAllowed []string\n\t\tfor _, obj := range notAllowedObjs {\n\t\t\tnotAllowed = append(notAllowed, fmt.Sprintf(\"%+v\", *obj.Spec.ResourceAttributes))\n\t\t}\n\n\t\treturn fmt.Errorf(\"the user is missing the following permissions: %s\", strings.Join(notAllowed, \", \"))\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "71a7029b09ff11f33a06866870e0c9a0", "score": "0.51554835", "text": "func (r Role) CanPerformAny(activities ...Activity) bool {\n\tfor _, act := range activities {\n\t\tif r.hasID(act.PublicID) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3cb51098da6314c8a925d7d782de6334", "score": "0.51092416", "text": "func (m AccessMode) IsApprover() bool {\n\treturn m&ModeApprove != 0\n}", "title": "" }, { "docid": "bd1e69929262da8c23435658514aec16", "score": "0.5104228", "text": "func (_Roles) HasPermission(rid RoleID, dtype DocTypeID, action DocActionID) (bool, error) {\n\tq := `\n\tSELECT rdas.id FROM wf_role_docactions rdas\n\tJOIN wf_doctypes_master dtm ON rdas.doctype_id = dtm.id\n\tJOIN wf_docactions_master dam ON rdas.docaction_id = dam.id\n\tWHERE rdas.role_id = ?\n\tAND dtm.id = ?\n\tAND dam.id = ?\n\tORDER BY rdas.id\n\tLIMIT 1\n\t`\n\trow := db.QueryRow(q, rid, dtype, action)\n\tvar n int64\n\terr := row.Scan(&n)\n\tif err != nil {\n\t\tswitch err {\n\t\tcase sql.ErrNoRows:\n\t\t\treturn false, nil\n\n\t\tdefault:\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "96110c63aa20a7a718f084316c7adef8", "score": "0.50980383", "text": "func (c *Client) HasAccess(ctx context.Context, waybill *kubeapplierv1alpha1.Waybill, email, verb string) (bool, error) {\n\tgvk := waybill.GroupVersionKind()\n\tplural, err := c.pluralName(gvk)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tresponse, err := c.clientset.AuthorizationV1().SubjectAccessReviews().Create(\n\t\tctx,\n\t\t&authorizationv1.SubjectAccessReview{\n\t\t\tSpec: authorizationv1.SubjectAccessReviewSpec{\n\t\t\t\tResourceAttributes: &authorizationv1.ResourceAttributes{\n\t\t\t\t\tNamespace: waybill.Namespace,\n\t\t\t\t\tVerb: verb,\n\t\t\t\t\tGroup: gvk.Group,\n\t\t\t\t\tVersion: gvk.Version,\n\t\t\t\t\tResource: plural,\n\t\t\t\t},\n\t\t\t\tUser: email,\n\t\t\t},\n\t\t},\n\t\tmetav1.CreateOptions{},\n\t)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn response.Status.Allowed, nil\n}", "title": "" }, { "docid": "6ee835f895efa8afb1ccba505bee23a2", "score": "0.5084779", "text": "func (db *FakeDB) HasPermission(ctx context.Context, id identity.Identity, perm realms.Permission, realm string, attrs realms.Attrs) (bool, error) {\n\t// This flips a flag forbidding registration of new permissions. Presumably\n\t// this should help catching \"dynamic\" permission registration in tests,\n\t// before it panics in production.\n\trealms.ForbidPermissionChanges()\n\n\tdb.m.RLock()\n\tdefer db.m.RUnlock()\n\n\tif db.err != nil {\n\t\treturn false, db.err\n\t}\n\n\tif mocked := db.perID[id]; mocked != nil {\n\t\tfor _, mockedPerm := range mocked.perms {\n\t\t\tif mockedPerm.realm == realm && mockedPerm.perm == perm && mockedPerm.cond(attrs) {\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t}\n\t}\n\n\treturn false, nil\n}", "title": "" }, { "docid": "eb0ba6ebc244352085ad0e86be9fe96d", "score": "0.50426507", "text": "func (u *noopUser) IsPermitted(procedure string) bool {\n\treturn true\n}", "title": "" }, { "docid": "9140882bb46aaac00335e0897c6d0b3e", "score": "0.50271475", "text": "func (o *Opa) IsAllowed(args Args) (bool, error) {\n\tif o == nil {\n\t\treturn false, nil\n\t}\n\n\t// OPA input\n\tbody := make(map[string]interface{})\n\tbody[\"input\"] = args\n\n\tinputBytes, err := json.Marshal(body)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treq, err := http.NewRequest(\"POST\", o.args.URL.String(), bytes.NewReader(inputBytes))\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\treq.Header.Set(\"Content-Type\", \"application/json\")\n\tif o.args.AuthToken != \"\" {\n\t\treq.Header.Set(\"Authorization\", o.args.AuthToken)\n\t}\n\n\tresp, err := o.client.Do(req)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tdefer o.args.CloseRespFn(resp.Body)\n\n\t// Read the body to be saved later.\n\topaRespBytes, err := ioutil.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn false, err\n\t}\n\n\t// Handle large OPA responses when OPA URL is of\n\t// form http://localhost:8181/v1/data/httpapi/authz\n\ttype opaResultAllow struct {\n\t\tResult struct {\n\t\t\tAllow bool `json:\"allow\"`\n\t\t} `json:\"result\"`\n\t}\n\n\t// Handle simpler OPA responses when OPA URL is of\n\t// form http://localhost:8181/v1/data/httpapi/authz/allow\n\ttype opaResult struct {\n\t\tResult bool `json:\"result\"`\n\t}\n\n\trespBody := bytes.NewReader(opaRespBytes)\n\n\tvar result opaResult\n\tif err = json.NewDecoder(respBody).Decode(&result); err != nil {\n\t\trespBody.Seek(0, 0)\n\t\tvar resultAllow opaResultAllow\n\t\tif err = json.NewDecoder(respBody).Decode(&resultAllow); err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\treturn resultAllow.Result.Allow, nil\n\t}\n\treturn result.Result, nil\n}", "title": "" }, { "docid": "a6a8f0bbd7a6cc65c6f0a21333532047", "score": "0.5026844", "text": "func (api *DatasetAPI) isAuthorisedForDatasets(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {\n\treturn api.datasetPermissions.Require(required, handler)\n}", "title": "" }, { "docid": "a6a8f0bbd7a6cc65c6f0a21333532047", "score": "0.5026844", "text": "func (api *DatasetAPI) isAuthorisedForDatasets(required auth.Permissions, handler http.HandlerFunc) http.HandlerFunc {\n\treturn api.datasetPermissions.Require(required, handler)\n}", "title": "" }, { "docid": "f6a5b3480c94a46816f014c8777603f0", "score": "0.50162816", "text": "func Contains(permissions, permission int) bool {\n\treturn permissions&permission == permission\n}", "title": "" }, { "docid": "bd86c8fc2be4cbdcd4a31c5ed1f3ae2e", "score": "0.50016046", "text": "func (ctx *PfCtxS) CheckPerms(what string, perms Perm) (ok bool, err error) {\n\t/* No error yet */\n\tsys := System_Get()\n\n\tctx.PDbgf(what, perms, \"Text: %s\", perms.String())\n\n\tif ctx.IsLoggedIn() {\n\t\tctx.PDbgf(what, perms, \"user = %s\", ctx.user.GetUserName())\n\t} else {\n\t\tctx.PDbgf(what, perms, \"user = ::NONE::\")\n\t}\n\n\tif ctx.HasSelectedUser() {\n\t\tctx.PDbgf(what, perms, \"sel_user = %s\", ctx.sel_user.GetUserName())\n\t} else {\n\t\tctx.PDbgf(what, perms, \"sel_user = ::NONE::\")\n\t}\n\n\tif ctx.HasSelectedGroup() {\n\t\tctx.PDbgf(what, perms, \"sel_group = %s\", ctx.sel_group.GetGroupName())\n\t} else {\n\t\tctx.PDbgf(what, perms, \"sel_group = ::NONE::\")\n\t}\n\n\t/* Nobody? */\n\tif ctx.IsPermSet(perms, PERM_NOBODY) {\n\t\tctx.PDbgf(what, perms, \"Nobody\")\n\t\treturn false, errors.New(\"Nobody is allowed\")\n\t}\n\n\tif ctx.IsPerm(perms, PERM_NOBODY) {\n\t\tpanic(\"EHMM\")\n\t}\n\n\t/* No permissions? */\n\tif ctx.IsPerm(perms, PERM_NOTHING) {\n\t\tctx.PDbgf(what, perms, \"Nothing\")\n\t\treturn true, nil\n\t}\n\n\t/* CLI when enabled and user is authenticated */\n\tif ctx.IsPermSet(perms, PERM_CLI) {\n\t\tctx.PDbgf(what, perms, \"CLI\")\n\t\tif ctx.IsLoggedIn() && sys.CLIEnabled {\n\t\t\tctx.PDbgf(what, perms, \"CLI - Enabled\")\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\terr = errors.New(\"CLI is not enabled\")\n\t\t}\n\t}\n\n\t/* Loopback calls can always access the API (for tcli) */\n\tif ctx.IsPermSet(perms, PERM_API) {\n\t\tctx.PDbgf(what, perms, \"API\")\n\t\tif sys.APIEnabled {\n\t\t\tctx.PDbgf(what, perms, \"API - Enabled\")\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\terr = errors.New(\"API is not enabled\")\n\t\t}\n\t}\n\n\t/* Is OAuth enabled? */\n\tif ctx.IsPermSet(perms, PERM_OAUTH) {\n\t\tctx.PDbgf(what, perms, \"OAuth\")\n\t\tif sys.OAuthEnabled {\n\t\t\tctx.PDbgf(what, perms, \"OAuth - Enabled\")\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\terr = errors.New(\"OAuth is not enabled\")\n\t\t}\n\t}\n\n\t/* Loopback? */\n\tif ctx.IsPermSet(perms, PERM_LOOPBACK) {\n\t\tctx.PDbgf(what, perms, \"Loopback\")\n\t\tif ctx.client_ip.IsLoopback() {\n\t\t\tctx.PDbgf(what, perms, \"Is Loopback\")\n\t\t\treturn true, nil\n\t\t} else {\n\t\t\terr = errors.New(\"Not a Loopback\")\n\t\t}\n\t}\n\n\t/* User must not be authenticated */\n\tif ctx.IsPermSet(perms, PERM_GUEST) {\n\t\tctx.PDbgf(what, perms, \"Guest\")\n\t\tif !ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"Guest - Not Logged In\")\n\t\t\treturn true, nil\n\t\t}\n\n\t\tctx.PDbgf(what, perms, \"Guest - Logged In\")\n\t\treturn false, errors.New(\"Must not be authenticated\")\n\t}\n\n\t/* User has to have selected themselves */\n\tif ctx.IsPermSet(perms, PERM_USER_SELF) {\n\t\tctx.PDbgf(what, perms, \"User Self\")\n\t\tif ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"User Self - Logged In\")\n\t\t\tif ctx.HasSelectedUser() {\n\t\t\t\tctx.PDbgf(what, perms, \"User Self - Has selected user\")\n\t\t\t\tif ctx.sel_user.GetUserName() == ctx.user.GetUserName() {\n\t\t\t\t\t/* Passed the test */\n\t\t\t\t\tctx.PDbgf(what, perms, \"User Self - It is me\")\n\t\t\t\t\treturn true, nil\n\t\t\t\t} else {\n\t\t\t\t\tctx.PDbgf(what, perms, \"User Self - Other user\")\n\t\t\t\t\terr = errors.New(\"Different user selected\")\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"No user selected\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.New(\"Not Authenticated\")\n\t\t}\n\t}\n\n\t/* User has to have selected themselves */\n\tif ctx.IsPermSet(perms, PERM_USER_VIEW) {\n\t\tctx.PDbgf(what, perms, \"User View\")\n\t\tif ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"User View - Logged In\")\n\t\t\tif ctx.HasSelectedUser() {\n\t\t\t\tctx.PDbgf(what, perms, \"User View - Has selected user\")\n\t\t\t\tif ctx.sel_user.GetUserName() == ctx.user.GetUserName() {\n\t\t\t\t\t/* Passed the test */\n\t\t\t\t\tctx.PDbgf(what, perms, \"User View - It is me\")\n\t\t\t\t\treturn true, nil\n\t\t\t\t} else {\n\t\t\t\t\tok, err = ctx.sel_user.SharedGroups(ctx, ctx.user)\n\t\t\t\t\tif ok {\n\t\t\t\t\t\t/* Passed the test */\n\t\t\t\t\t\tctx.PDbgf(what, perms, \"User View - It is in my group\")\n\t\t\t\t\t\treturn true, nil\n\t\t\t\t\t} else {\n\t\t\t\t\t\tctx.PDbgf(what, perms, \"User View - Other user\")\n\t\t\t\t\t\terr = errors.New(\"Different user selected\")\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"No user selected\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.New(\"Not Authenticated\")\n\t\t}\n\t}\n\n\t/* User has to be a group member + Wiki enabled */\n\tif ctx.IsPermSet(perms, PERM_GROUP_WIKI) {\n\t\tctx.PDbgf(what, perms, \"Group Wiki?\")\n\t\tif ctx.GroupHasWiki() {\n\t\t\tctx.PDbgf(what, perms, \"HasWiki - ok\")\n\t\t\tif ctx.IsGroupMember() {\n\t\t\t\tctx.PDbgf(what, perms, \"Group member - ok\")\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\terr = errors.New(\"Not a group member\")\n\t\t} else {\n\t\t\terr = errors.New(\"Group does not have a Wiki\")\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t/* User has to be a group member + File enabled */\n\tif ctx.IsPermSet(perms, PERM_GROUP_FILE) {\n\t\tctx.PDbgf(what, perms, \"Group File?\")\n\t\tif ctx.GroupHasFile() {\n\t\t\tctx.PDbgf(what, perms, \"HasFile - ok\")\n\t\t\tif ctx.IsGroupMember() {\n\t\t\t\tctx.PDbgf(what, perms, \"Group member - ok\")\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\terr = errors.New(\"Not a group member\")\n\t\t} else {\n\t\t\terr = errors.New(\"Group does not have a File\")\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t/* User has to be a group member + Calendar enabled */\n\tif ctx.IsPermSet(perms, PERM_GROUP_CALENDAR) {\n\t\tctx.PDbgf(what, perms, \"Group Calendar?\")\n\t\tif ctx.GroupHasCalendar() {\n\t\t\tctx.PDbgf(what, perms, \"HasCalendar - ok\")\n\t\t\tif ctx.IsGroupMember() {\n\t\t\t\tctx.PDbgf(what, perms, \"Group member - ok\")\n\t\t\t\treturn true, nil\n\t\t\t}\n\t\t\terr = errors.New(\"Not a group member\")\n\t\t} else {\n\t\t\terr = errors.New(\"Group does not have a Calendar\")\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t/* No permissions needed */\n\tif ctx.IsPermSet(perms, PERM_NONE) {\n\t\tctx.PDbgf(what, perms, \"None\")\n\t\t/* Always succeeds */\n\t\treturn true, nil\n\t}\n\n\t/* Everything else requires a login */\n\tif !ctx.IsLoggedIn() {\n\t\tctx.PDbgf(what, perms, \"Not Authenticated\")\n\t\terr = errors.New(\"Not authenticated\")\n\t\treturn false, err\n\t}\n\n\t/*\n\t * SysAdmin can get away with almost anything\n\t *\n\t * The perms only has the PERM_SYS_ADMIN bit set for clarity\n\t * that that one only has access for sysadmins\n\t */\n\tif ctx.IsSysAdmin() {\n\t\tctx.PDbgf(what, perms, \"SysAdmin?\")\n\t\treturn true, nil\n\t}\n\terr = errors.New(\"Not a SysAdmin\")\n\n\t/* User has to be authenticated */\n\tif ctx.IsPermSet(perms, PERM_USER) {\n\t\tctx.PDbgf(what, perms, \"User?\")\n\t\tif ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"User - Logged In\")\n\t\t\treturn true, nil\n\t\t}\n\n\t\terr = errors.New(\"Not Authenticated\")\n\t}\n\n\t/* User has to be a group admin */\n\tif ctx.IsPermSet(perms, PERM_GROUP_ADMIN) {\n\t\tctx.PDbgf(what, perms, \"Group admin?\")\n\t\tif ctx.IAmGroupAdmin() {\n\t\t\tctx.PDbgf(what, perms, \"Group admin - ok\")\n\t\t\treturn true, nil\n\t\t}\n\n\t\terr = errors.New(\"Not a group admin\")\n\t}\n\n\t/* User has to be a group member */\n\tif ctx.IsPermSet(perms, PERM_GROUP_MEMBER) {\n\t\tctx.PDbgf(what, perms, \"Group member?\")\n\t\tif ctx.IsGroupMember() {\n\t\t\tctx.PDbgf(what, perms, \"Group member - ok\")\n\t\t\treturn true, nil\n\t\t}\n\n\t\terr = errors.New(\"Not a group member\")\n\t}\n\n\t/* User wants to nominate somebody (even themselves) */\n\tif ctx.IsPermSet(perms, PERM_USER_NOMINATE) {\n\t\tctx.PDbgf(what, perms, \"User Nominate\")\n\t\tif ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"User Nominate - Logged In\")\n\t\t\tif ctx.HasSelectedUser() {\n\t\t\t\tctx.PDbgf(what, perms, \"User Nominate - User Selected\")\n\t\t\t\t/* Passed the test */\n\t\t\t\treturn true, nil\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"No user selected\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.New(\"Not Authenticated\")\n\t\t}\n\t}\n\n\t/* Can the user become a SysAdmin? */\n\tif ctx.IsPermSet(perms, PERM_SYS_ADMIN_CAN) {\n\t\tif ctx.IsLoggedIn() {\n\t\t\tctx.PDbgf(what, perms, \"Sys Admin Can - Logged In\")\n\t\t\tif ctx.CanBeSysAdmin() {\n\t\t\t\tctx.PDbgf(what, perms, \"Sys Admin Can\")\n\t\t\t\t/* Passed the test */\n\t\t\t\treturn true, nil\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"Can't become SysAdmin\")\n\t\t\t}\n\t\t} else {\n\t\t\terr = errors.New(\"Not Authenticated\")\n\t\t}\n\t}\n\n\t/* Let the App Check permissions */\n\tif ctx.f_appperms != nil {\n\t\tfinal, _ok, _err := ctx.f_appperms(ctx, what, perms)\n\t\tif final {\n\t\t\treturn _ok, _err\n\t\t}\n\n\t\t/* Otherwise we ignore the result as it is not a final decision */\n\t}\n\n\tif err == nil {\n\t\t/* Should not happen */\n\t\tpanic(\"Invalid permission bits\")\n\t}\n\n\t/* Default Deny + report error */\n\treturn false, err\n}", "title": "" }, { "docid": "73aca6fb19c5778a281234e732f76100", "score": "0.5000913", "text": "func (r Role) CanPerformAll(activities ...Activity) bool {\n\tfor _, act := range activities {\n\t\tif !r.hasID(act.PublicID) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "a7203514475ac2fc7f2d36dddf33c666", "score": "0.49781805", "text": "func GrantPermissions(itemVisibilityCode int32, itemCreatorID primitive.ObjectID, credentials *Credentials) error {\n\n\tif credentials.RoleCode == lookups.UserRoleAdmin {\n\t\treturn nil\n\t}\n\n\tif itemCreatorID == credentials.UserID {\n\t\treturn nil\n\t}\n\n\tif itemVisibilityCode == lookups.VisibilityMembers && credentials.RoleCode == lookups.UserRoleGuest {\n\t\t// get a log-in and make friends\n\t\treturn apperror.ErrGuest\n\t}\n\n\t// if (itemVisibilityCode == lookups.VisibilityMembers) && (UserReferenced(credentials.Friends, itemCreatorID) == false) && (itemCreatorID != credentials.UserID) {\n\tif (itemVisibilityCode == lookups.VisibilityMembers) && (!UserReferenced(credentials.Friends, itemCreatorID)) && (itemCreatorID != credentials.UserID) {\n\t\t// make friends with them\n\t\treturn apperror.ErrNotFriend\n\t}\n\n\tif itemVisibilityCode == lookups.VisibilityNone && (credentials.UserID != itemCreatorID) {\n\t\t// ask them to share\n\t\treturn apperror.ErrPrivate\n\t}\n\n\t// all checks passed\n\treturn nil\n}", "title": "" }, { "docid": "6aa2b0ea0ea456c7cc96353b66360cb5", "score": "0.49587354", "text": "func HasWritePermission(ac *pb.AccessControl) bool {\n\tif ac == nil {\n\t\treturn false\n\t}\n\treturn hasBit(ac.Permission, 1)\n}", "title": "" }, { "docid": "1fddec1df86f50ffe99294e6d088b3a3", "score": "0.49540994", "text": "func (acl *ACL) HasPerm(moduleName, permName string) bool {\n\tmodule, err := acl.GetModuleWithName(moduleName)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn module.HasPermWithName(permName)\n}", "title": "" }, { "docid": "3c3664e366930794d024cd2b5ba759ee", "score": "0.4948415", "text": "func (o *IamSystemAllOf) HasEndPointPrivileges() bool {\n\tif o != nil && o.EndPointPrivileges != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "c8a6d6521e49a41cf9bfd022fef6df39", "score": "0.4945752", "text": "func (o *AccessToken) HasScopes() bool {\n\tif o != nil && !IsNil(o.Scopes) {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "833232192d92e44fa6da46e9d0675a1e", "score": "0.49362886", "text": "func (auth AuthService) Can(role string, action string, resource string) bool {\n\tif role == RoleRoot {\n\t\treturn true\n\t}\n\treturn auth.Acl.Can(role, action, resource)\n}", "title": "" }, { "docid": "a70c27abe3f71727857ee3850047b357", "score": "0.4934907", "text": "func AuthorizedTeamManagement(teamID portainer.TeamID, context *RestrictedRequestContext) bool {\n\tif context.IsAdmin {\n\t\treturn true\n\t}\n\n\tfor _, membership := range context.UserMemberships {\n\t\tif membership.TeamID == teamID && membership.Role == portainer.TeamLeader {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "9841988599b31f1d245929d8341990d3", "score": "0.49345237", "text": "func (r *role) CheckPermissions(ctx context.Context, resource any, names ...string) bool {\n\tif len(names) == 0 {\n\t\tpanic(ErrInvalidCheckParams)\n\t}\n\tfor _, p := range r.permissions {\n\t\tif p.CheckPermissions(ctx, resource, names...) {\n\t\t\treturn true\n\t\t}\n\t}\n\tfor _, r := range r.roles {\n\t\tif r.CheckPermissions(ctx, resource, names...) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "0173bc54d9490a23a1ba5edace0057be", "score": "0.4924223", "text": "func (pk *PrivKey) CanEncrypt() bool {\n\tif pk.Type == KeyTypeRSA {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "66d534db2f5a8e77d05c60f94be3a533", "score": "0.49061298", "text": "func hasPermission(session *discordgo.Session, guildID string, userID string, permission int) (bool, error) {\n\t// Check if the user is the guild owner\n\tguild, err := session.State.Guild(guildID)\n\tif err != nil {\n\t\tguild, err = session.Guild(guildID)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\tif guild.OwnerID == userID {\n\t\treturn true, nil\n\t}\n\n\t// Retrieve the member object\n\tmember, err := session.State.Member(guildID, userID)\n\tif err != nil {\n\t\tmember, err = session.GuildMember(guildID, userID)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t}\n\n\t// Check every role for the required permission\n\tfor _, roleID := range member.Roles {\n\t\trole, err := session.State.Role(guildID, roleID)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\t\tif role.Permissions&permission != 0 {\n\t\t\treturn true, nil\n\t\t}\n\t}\n\treturn false, nil\n}", "title": "" }, { "docid": "e05c43a435dcb0cb33036ca5f7b9e4fd", "score": "0.49053884", "text": "func hasSendPermission(state AccountGetter, accs map[string]*acm.Account) bool {\n\tfor _, acc := range accs {\n\t\tif !HasPermission(state, acc, ptypes.Send) {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "1f800048acae04e3d8d7d54f7b1667f8", "score": "0.489555", "text": "func (a *authorizer) PermissionsOn(obj types.Object) (map[types.Subject]types.Action, error) {\n\tperms, e := a.p.PermissionsOn(obj)\n\tif e != nil {\n\t\treturn nil, e\n\t}\n\n\tif a.og != nil {\n\t\tcats, e := a.og.GroupsOf(obj)\n\t\tif e != nil {\n\t\t\treturn nil, e\n\t\t}\n\n\t\tif perms == nil {\n\t\t\tperms = make(map[types.Subject]types.Action)\n\t\t}\n\n\t\tfor cat := range cats {\n\t\t\tcp, e := a.p.PermissionsOn(cat.(types.Category))\n\t\t\tif e != nil {\n\t\t\t\treturn nil, e\n\t\t\t}\n\t\t\tfor sub, act := range cp {\n\t\t\t\tperms[sub] |= act\n\t\t\t}\n\t\t}\n\t}\n\n\treturn perms, nil\n}", "title": "" }, { "docid": "700e491d74da31b1494f8ca47043239e", "score": "0.48943368", "text": "func (a *Authorizer) IsAuthorized(ctx context.Context, payload interface{}) error {\n\tmd, ok := metadata.FromIncomingContext(ctx)\n\tif !ok {\n\t\treturn fmt.Errorf(\"signature not found in metadata, make sure to set it using the key %q\", RequestSignature)\n\t}\n\tif len(md[RequestSignature]) == 0 {\n\t\treturn fmt.Errorf(\"signature not found in metadata, make sure to set it using the key %q\", RequestSignature)\n\t}\n\tsignature := md[RequestSignature][0]\n\tsignatureBytes, err := base64.StdEncoding.DecodeString(signature)\n\tif err != nil {\n\t\treturn err\n\t}\n\tencodedValue, err := a.cdc.MarshalJSON(payload)\n\tif err != nil {\n\t\treturn err\n\t}\n\tencodedValueSorted, err := sdk.SortJSON(encodedValue)\n\tif err != nil {\n\t\treturn err\n\t}\n\tisAuthorized := false\n\tfor _, authorizedPubKey := range a.authorizedPubKeys {\n\t\tif authorizedPubKey.VerifyBytes(encodedValueSorted, signatureBytes) {\n\t\t\tisAuthorized = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !isAuthorized {\n\t\treturn fmt.Errorf(\"verification of the signature failed\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7faa9072cbf7d402480f12786b160d44", "score": "0.48941043", "text": "func CanMarkConversation(issue *Issue, doer *user_model.User) (permResult bool, err error) {\n\tif doer == nil || issue == nil {\n\t\treturn false, fmt.Errorf(\"issue or doer is nil\")\n\t}\n\n\tif doer.ID != issue.PosterID {\n\t\tif err = issue.LoadRepo(db.DefaultContext); err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tp, err := access_model.GetUserRepoPermission(db.DefaultContext, issue.Repo, doer)\n\t\tif err != nil {\n\t\t\treturn false, err\n\t\t}\n\n\t\tpermResult = p.CanAccess(perm.AccessModeWrite, unit.TypePullRequests)\n\t\tif !permResult {\n\t\t\tif permResult, err = IsOfficialReviewer(db.DefaultContext, issue, doer); err != nil {\n\t\t\t\treturn false, err\n\t\t\t}\n\t\t}\n\n\t\tif !permResult {\n\t\t\treturn false, nil\n\t\t}\n\t}\n\n\treturn true, nil\n}", "title": "" }, { "docid": "b2d8765ea95d5813793d76f9d69b3f00", "score": "0.48781648", "text": "func (i Permit) IsAPermit() bool {\n\tfor _, v := range _PermitValues {\n\t\tif i == v {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "606d40f13e7de0ddfa97f3d615cb2686", "score": "0.48750898", "text": "func (o GetUserStackscriptGrantOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserStackscriptGrant) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bfc49e5bcea5272b3dab847fc9b93a2b", "score": "0.4874226", "text": "func (d *Default) CanAppend(LogEntry, identityprovider.Interface, CanAppendAdditionalContext) error {\n\treturn nil\n}", "title": "" }, { "docid": "02018d3cf21154ab74716563dd252abe", "score": "0.4865007", "text": "func PermitWrite(perm Permission) bool {\n\treturn (perm & PermWrite) == PermWrite\n}", "title": "" }, { "docid": "2b22fcc902030bb264b47f2865958ced", "score": "0.48568374", "text": "func (o *IdentityTestIAMPermissionsRequest) GetPermissionsOk() (*[]string, bool) {\n\tif o == nil || o.Permissions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "title": "" }, { "docid": "b66b1481af2c5e20933c9e3365787a08", "score": "0.484215", "text": "func (s service) hasPermissionAccessApp(tokenInfo *TokenInfoGoogle) bool {\n\treturn tokenInfo.Aud == s.oathClientID\n}", "title": "" }, { "docid": "b92bfb7ff94760746645f776873c3576", "score": "0.483992", "text": "func (o PluginOutput) GrantPermissions() PluginGrantPermissionArrayOutput {\n\treturn o.ApplyT(func(v *Plugin) PluginGrantPermissionArrayOutput { return v.GrantPermissions }).(PluginGrantPermissionArrayOutput)\n}", "title": "" }, { "docid": "5be4d76cb4c73a36ed4f35b8ca08fc36", "score": "0.48385078", "text": "func IsPermission(err error) bool", "title": "" }, { "docid": "294e127f8be2154445c3e413a91571c9", "score": "0.48349372", "text": "func (o GetUserVolumeGrantOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserVolumeGrant) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fac2734bf1477aeaff2cc3d45d0b4416", "score": "0.48316222", "text": "func (o *ParameterContextReferenceEntity) GetPermissionsOk() (*PermissionsDTO, bool) {\n\tif o == nil || o.Permissions == nil {\n\t\treturn nil, false\n\t}\n\treturn o.Permissions, true\n}", "title": "" }, { "docid": "6b15f55fda55267077c05e04e4847dba", "score": "0.48297086", "text": "func (o *IamAppRegistrationAllOf) HasGrantTypes() bool {\n\tif o != nil && o.GrantTypes != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "e86eed8f7ffa185841c365383958977a", "score": "0.48234314", "text": "func (rbac *rbac) Can(role string, permission gorbac.Permission) bool {\n\treturn rbac.rbac.IsGranted(role, permission, nil)\n}", "title": "" }, { "docid": "850fb8ffa5fb9813a4e905600cd27517", "score": "0.48079377", "text": "func (_Nft *NftCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) {\n\tvar out []interface{}\n\terr := _Nft.contract.Call(opts, &out, \"isApprovedForAll\", owner, operator)\n\n\tif err != nil {\n\t\treturn *new(bool), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(bool)).(*bool)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "c203c8c1f8e56b4d7c833345c0747c68", "score": "0.4807143", "text": "func (s *Service) IsAuthorized(ctx context.Context, userContext am.UserContext, resource, action string) bool {\n\tif err := s.authorizer.IsUserAllowed(userContext.GetOrgID(), userContext.GetUserID(), resource, action); err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "f20903ba515da42c28179eee0c2ae070", "score": "0.4806844", "text": "func (c *Consumer) HasAnyGrant(grants ...string) bool {\n\treturn hasAny(c.Grants, grants...)\n}", "title": "" }, { "docid": "23fb8db1abead43952b9a8a1cc8007b7", "score": "0.48062146", "text": "func (dao *PermissionDao) IsPermit(system, uid string, permission string) (permit bool, err error) {\n\tkey := fmt.Sprintf(redisKeyFormatPermissions, system, uid)\n\tpermit, err = dao.SIsMembers(key, permission)\n\tif err != nil {\n\t\treturn\n\t}\n\t// check whether specified key exist when `exist` is false\n\tif !permit {\n\t\texist, err := dao.Exists(key)\n\t\tif err != nil {\n\t\t\treturn permit, err\n\t\t}\n\n\t\tif !exist { // reload from mongo when specified key is not in cache\n\t\t\terr = dao.ReloadPermissions(system, uid)\n\t\t\treturn dao.SIsMembers(key, permission)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "1a8bbf7f58f03ab66eef2517234a7f5c", "score": "0.48005062", "text": "func (_Identityregistry *IdentityregistryCaller) IsProviderFor(opts *bind.CallOpts, ein *big.Int, provider common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _Identityregistry.contract.Call(opts, out, \"isProviderFor\", ein, provider)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "77802bc04290529e7de7902ab584cc6b", "score": "0.47995743", "text": "func IsEnforceAdminEnabled(protection *githubpkg.Protection) bool {\n\tif protection.EnforceAdmins == nil {\n\t\treturn false\n\t}\n\n\treturn protection.EnforceAdmins.Enabled\n}", "title": "" }, { "docid": "0b98bccf660a82cc59a68431a66bea6a", "score": "0.4796912", "text": "func (o *InlineResponse20013People) HasAdministrator() bool {\n\tif o != nil && o.Administrator != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "ec1e981ffb5f2e4870574e6c2502bd77", "score": "0.47961497", "text": "func (i IAMSpec) PolicyAllows(arn string, actions, resources []string) (res bool, err error) {\n\tsvc := getIAMAPI(i.Session)\n\tver, err := i.findDefaultPolicyVersion(arn)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tin := &iam.GetPolicyVersionInput{\n\t\tPolicyArn: aws.String(arn),\n\t\tVersionId: aws.String(ver),\n\t}\n\tout, err := svc.GetPolicyVersion(in)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tdoc := PolicyDocument{}\n\tpolicy, err := url.QueryUnescape(aws.StringValue(out.PolicyVersion.Document))\n\tif err != nil {\n\t\treturn\n\t}\n\terr = json.Unmarshal([]byte(policy), &doc)\n\tfor _, v := range doc.Statement {\n\t\thasActions := v.Action.Contains(actions)\n\t\thasResources := v.Resource.Contains(resources)\n\t\tres = hasActions && hasResources\n\t\tif res {\n\t\t\treturn\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "2e78ecb4b7c49a50df28c10931941002", "score": "0.4788625", "text": "func (o GetUserFirewallGrantOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserFirewallGrant) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b8ce703d51c0ba0a48d69a9aca30a9a0", "score": "0.47871062", "text": "func (privs Privileges) Has(p PrivilegeType) bool {\n\tfor _, cp := range privs {\n\t\tif cp == p {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "5c40245ca55c30f87a77d815e2a8f48f", "score": "0.4784616", "text": "func (o GetUserLinodeGrantOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserLinodeGrant) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ef7d491539169580494125f6de1f518c", "score": "0.47831264", "text": "func (o GetUserDatabaseGrantOutput) Permissions() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetUserDatabaseGrant) string { return v.Permissions }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "f468462f974956a6756ae301edd842fc", "score": "0.4781747", "text": "func (r *REST) isAllowed(ctx kapi.Context, rar *authorizationapi.ResourceAccessReview) error {\n\tlocalRARAttributes := authorizer.DefaultAuthorizationAttributes{\n\t\tVerb: \"create\",\n\t\tResource: \"localresourceaccessreviews\",\n\t}\n\tallowed, reason, err := r.authorizer.Authorize(kapi.WithNamespace(ctx, rar.Action.Namespace), localRARAttributes)\n\n\tif err != nil {\n\t\treturn kapierrors.NewForbidden(authorizationapi.Resource(localRARAttributes.GetResource()), localRARAttributes.GetResourceName(), err)\n\t}\n\tif !allowed {\n\t\tforbiddenError := kapierrors.NewForbidden(authorizationapi.Resource(localRARAttributes.GetResource()), localRARAttributes.GetResourceName(), errors.New(\"\") /*discarded*/)\n\t\tforbiddenError.ErrStatus.Message = reason\n\t\treturn forbiddenError\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1beb4d18b60476e670c9fa1955c944bf", "score": "0.47798076", "text": "func (validator *PermissionValidator) HasPermission(userId int64, url string) error {\n\tu, body, err := validator.HasPermissionUrl(userId, url)\n\tif err != nil {\n\t\treturn err\n\t}\n\tret, err := PostByJson(u, body, validator.parent.logger)\n\tif err != nil {\n\t\treturn err\n\t}\n\tr := PermissionResponse{}\n\terr = JsonDecode(ret, &r)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif r.Code != 200 {\n\t\treturn errors.New(\"no permission\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "73496250898420077b4fb48caada192a", "score": "0.47784698", "text": "func (s *SecurityContext) Can(action rbac.Action, resource rbac.Resource) bool {\n\tns, err := resource.GetNamespace()\n\tif err == nil {\n\t\tswitch ns.Kind() {\n\t\tcase \"project\":\n\t\t\tprojectIDOrName := ns.Identity()\n\t\t\tisPublicProject, _ := s.pm.IsPublic(projectIDOrName)\n\t\t\tprojectNamespace := rbac.NewProjectNamespace(projectIDOrName, isPublicProject)\n\t\t\tuser := project.NewUser(s, projectNamespace, s.GetProjectRoles(projectIDOrName)...)\n\t\t\treturn rbac.HasPermission(user, resource, action)\n\t\t}\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "886e4456d08f7dfe5e40396e86b6ee05", "score": "0.4768157", "text": "func (_WizardPresale *WizardPresaleCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) {\n\treturn _WizardPresale.Contract.IsApprovedForAll(&_WizardPresale.CallOpts, owner, operator)\n}", "title": "" }, { "docid": "6ac717a6cfca29f4c021fb17e7c3f5e2", "score": "0.4765984", "text": "func repoAdminHasApproved(reviews map[string]review) bool {\n\tfor _, adminName := range ci.RepoAdmins {\n\t\tif hasApproved(adminName, reviews) {\n\t\t\treturn true\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d5361c3bd7ce48a8ccc7d011fc539d67", "score": "0.4764944", "text": "func (_WizardPresale *WizardPresaleSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) {\n\treturn _WizardPresale.Contract.IsApprovedForAll(&_WizardPresale.CallOpts, owner, operator)\n}", "title": "" }, { "docid": "4771ba75c2e70131871e2f291e1bf919", "score": "0.47646713", "text": "func (_WizardPresale *WizardPresaleCaller) IsApprovedForAll(opts *bind.CallOpts, owner common.Address, operator common.Address) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _WizardPresale.contract.Call(opts, out, \"isApprovedForAll\", owner, operator)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "2ec442400a8862e190b7b2132859f93d", "score": "0.47643873", "text": "func (_Nft *NftCallerSession) IsApprovedForAll(owner common.Address, operator common.Address) (bool, error) {\n\treturn _Nft.Contract.IsApprovedForAll(&_Nft.CallOpts, owner, operator)\n}", "title": "" } ]
a1c8692f3f1434072913a49de6826154
SetStatisticsIopsRawRead adds the statisticsIopsRawRead to the nvme namespace collection get params
[ { "docid": "001f4810cba9a2cbbf99f6b92a432c95", "score": "0.8199487", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsIopsRawRead(statisticsIopsRawRead *int64) {\n\to.StatisticsIopsRawRead = statisticsIopsRawRead\n}", "title": "" } ]
[ { "docid": "c3b558e6769558407a3b9f52dac63bd4", "score": "0.823258", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsIopsRawRead(statisticsIopsRawRead *int64) {\n\to.StatisticsIopsRawRead = statisticsIopsRawRead\n}", "title": "" }, { "docid": "4e55157ae479a5ede6b89e84104aca49", "score": "0.8170956", "text": "func (o *LunCollectionGetParams) SetStatisticsIopsRawRead(statisticsIopsRawRead *int64) {\n\to.StatisticsIopsRawRead = statisticsIopsRawRead\n}", "title": "" }, { "docid": "d1bdca81626f770bb18321a484730b92", "score": "0.7305159", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsIopsRawRead(statisticsIopsRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsIopsRawRead(statisticsIopsRawRead)\n\treturn o\n}", "title": "" }, { "docid": "1e39b8a9dd116335ed8aac54960c6c17", "score": "0.7261541", "text": "func (o *LunCollectionGetParams) SetStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) {\n\to.StatisticsIopsRawWrite = statisticsIopsRawWrite\n}", "title": "" }, { "docid": "c9f0d8ff23c53c2ccfa4efa66c275473", "score": "0.72087014", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) {\n\to.StatisticsIopsRawWrite = statisticsIopsRawWrite\n}", "title": "" }, { "docid": "b6dbe582caf07f57111b2731aaed76c7", "score": "0.71976376", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) {\n\to.StatisticsIopsRawWrite = statisticsIopsRawWrite\n}", "title": "" }, { "docid": "74dfb84053df73badc02657035ca0ad4", "score": "0.71753883", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcIopsRawRead(statisticsFcIopsRawRead *int64) {\n\to.StatisticsFcIopsRawRead = statisticsFcIopsRawRead\n}", "title": "" }, { "docid": "497a66d14bbcdd8b1cd6a768bb597b77", "score": "0.7054946", "text": "func (o *LunCollectionGetParams) WithStatisticsIopsRawRead(statisticsIopsRawRead *int64) *LunCollectionGetParams {\n\to.SetStatisticsIopsRawRead(statisticsIopsRawRead)\n\treturn o\n}", "title": "" }, { "docid": "e14c472c42fba2d390438ec76abbea45", "score": "0.7049245", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsIopsRawRead(statisticsIopsRawRead *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsIopsRawRead(statisticsIopsRawRead)\n\treturn o\n}", "title": "" }, { "docid": "397a4b433f7263e8614606b28535e94a", "score": "0.6872385", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPIopsRawRead(statisticsTCPIopsRawRead *int64) {\n\to.StatisticsTCPIopsRawRead = statisticsTCPIopsRawRead\n}", "title": "" }, { "docid": "362a551ceedcf0c0d966aeea56b91010", "score": "0.6710761", "text": "func (o *LunCollectionGetParams) WithStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) *LunCollectionGetParams {\n\to.SetStatisticsIopsRawWrite(statisticsIopsRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "ef73e4ff09805547570f30e315c54ee5", "score": "0.6575752", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsIopsRawWrite(statisticsIopsRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "9f71ca38d3c88031834746973fa8f9e5", "score": "0.65", "text": "func (o *LunCollectionGetParams) SetStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) {\n\to.StatisticsIopsRawTotal = statisticsIopsRawTotal\n}", "title": "" }, { "docid": "4b7525165ce16f491a57a55e33f552c3", "score": "0.6496731", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) {\n\to.StatisticsIopsRawTotal = statisticsIopsRawTotal\n}", "title": "" }, { "docid": "1e44344e609e6a718228bf7dc1b2616e", "score": "0.6486859", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) {\n\to.StatisticsIopsRawTotal = statisticsIopsRawTotal\n}", "title": "" }, { "docid": "2abdcf7b82a42627d6728be3ca91ace8", "score": "0.6442144", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPIopsRawRead(statisticsTCPIopsRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPIopsRawRead(statisticsTCPIopsRawRead)\n\treturn o\n}", "title": "" }, { "docid": "51011407cad4f35882a8b30630569c0f", "score": "0.6374381", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsIopsRawWrite(statisticsIopsRawWrite *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsIopsRawWrite(statisticsIopsRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "1236ab4b18320811210a3e09cca72619", "score": "0.63738245", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcIopsRawRead(statisticsFcIopsRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcIopsRawRead(statisticsFcIopsRawRead)\n\treturn o\n}", "title": "" }, { "docid": "a9d04e4e1679a0318f4ebbe920ee492c", "score": "0.63429046", "text": "func (o *LunCollectionGetParams) SetStatisticsIopsRawOther(statisticsIopsRawOther *int64) {\n\to.StatisticsIopsRawOther = statisticsIopsRawOther\n}", "title": "" }, { "docid": "5709ff97358e6d262fcab698ea89af44", "score": "0.6324017", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsIopsRawOther(statisticsIopsRawOther *int64) {\n\to.StatisticsIopsRawOther = statisticsIopsRawOther\n}", "title": "" }, { "docid": "e25db76af54fe7f14ae97488bcd57015", "score": "0.6287715", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) {\n\to.StatisticsThroughputRawRead = statisticsThroughputRawRead\n}", "title": "" }, { "docid": "a74c8c993b1e1a9f60ea561d6608fd92", "score": "0.62746686", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsIopsRawOther(statisticsIopsRawOther *int64) {\n\to.StatisticsIopsRawOther = statisticsIopsRawOther\n}", "title": "" }, { "docid": "4cbc485f041664ec6db1efa0334a046f", "score": "0.6243204", "text": "func (o *LunCollectionGetParams) SetStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) {\n\to.StatisticsThroughputRawRead = statisticsThroughputRawRead\n}", "title": "" }, { "docid": "b329281abed85d31f9d659e01c1d2125", "score": "0.6238848", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsIopsRawTotal(statisticsIopsRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "0621b874631151ac87f77afbbc1bfbe3", "score": "0.619625", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) {\n\to.StatisticsThroughputRawRead = statisticsThroughputRawRead\n}", "title": "" }, { "docid": "30bfc155e35505e4913115e9e88283ef", "score": "0.6188617", "text": "func (o *NvmeCollectionPerformanceMetricsGetParams) SetIopsRead(iopsRead *int64) {\n\to.IopsRead = iopsRead\n}", "title": "" }, { "docid": "d58fa33f30ee0a575e5f0ee2b38a34d0", "score": "0.6161468", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcIopsRawWrite(statisticsFcIopsRawWrite *int64) {\n\to.StatisticsFcIopsRawWrite = statisticsFcIopsRawWrite\n}", "title": "" }, { "docid": "a058d3360758ff5c255beda5e31e493b", "score": "0.6160539", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) {\n\to.StatisticsLatencyRawRead = statisticsLatencyRawRead\n}", "title": "" }, { "docid": "8cea4b89810a30b6d2660e3abecd9920", "score": "0.61118424", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsThroughputRawRead(statisticsThroughputRawRead)\n\treturn o\n}", "title": "" }, { "docid": "f2e2e7d091d100eb996963e3df42b27c", "score": "0.60885453", "text": "func (o *LunCollectionGetParams) SetStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) {\n\to.StatisticsLatencyRawRead = statisticsLatencyRawRead\n}", "title": "" }, { "docid": "1fd6a8f5edb20d53ec34596e01fd5ec9", "score": "0.60844463", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) {\n\to.StatisticsLatencyRawRead = statisticsLatencyRawRead\n}", "title": "" }, { "docid": "1107544dcdda4319c8f4007cadbdc601", "score": "0.6062971", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsIopsRawTotal(statisticsIopsRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "c1e6340d76c8d279678730dfbe407a32", "score": "0.60539716", "text": "func (o *LunCollectionGetParams) WithStatisticsIopsRawTotal(statisticsIopsRawTotal *int64) *LunCollectionGetParams {\n\to.SetStatisticsIopsRawTotal(statisticsIopsRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "21ea447cc11ecc85a3d38224483f4f51", "score": "0.60049707", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsThroughputRawRead(statisticsThroughputRawRead)\n\treturn o\n}", "title": "" }, { "docid": "cf6bf8514e6781a7a309038159cff95a", "score": "0.5979525", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsIopsRawOther(statisticsIopsRawOther *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsIopsRawOther(statisticsIopsRawOther)\n\treturn o\n}", "title": "" }, { "docid": "3cefd02bfea36f7e13d8761f3ea5ad64", "score": "0.5903939", "text": "func (o *LunCollectionGetParams) SetMetricIopsRead(metricIopsRead *int64) {\n\to.MetricIopsRead = metricIopsRead\n}", "title": "" }, { "docid": "d9f0c04a0fe18caf5f8b2fbbcc116685", "score": "0.5903475", "text": "func (o *NvmeServiceCollectionGetParams) SetMetricIopsRead(metricIopsRead *int64) {\n\to.MetricIopsRead = metricIopsRead\n}", "title": "" }, { "docid": "0bb81cc94ae3ad6924e47fa521721078", "score": "0.58949274", "text": "func (o *LunCollectionGetParams) WithStatisticsIopsRawOther(statisticsIopsRawOther *int64) *LunCollectionGetParams {\n\to.SetStatisticsIopsRawOther(statisticsIopsRawOther)\n\treturn o\n}", "title": "" }, { "docid": "6ea14862d131ceee6de79c0b1a4faaca", "score": "0.58789957", "text": "func (o *LunCollectionGetParams) WithStatisticsThroughputRawRead(statisticsThroughputRawRead *int64) *LunCollectionGetParams {\n\to.SetStatisticsThroughputRawRead(statisticsThroughputRawRead)\n\treturn o\n}", "title": "" }, { "docid": "2317749ae29ae0f31d03f6a24f1cb8b3", "score": "0.5876695", "text": "func (o *NvmeNamespaceCollectionGetParams) SetMetricIopsRead(metricIopsRead *int64) {\n\to.MetricIopsRead = metricIopsRead\n}", "title": "" }, { "docid": "c824f08a0ed06fb26ff4c78127126718", "score": "0.58357537", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsIopsRawOther(statisticsIopsRawOther *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsIopsRawOther(statisticsIopsRawOther)\n\treturn o\n}", "title": "" }, { "docid": "03ae1825c6a33f43fe406362515cc306", "score": "0.5832203", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPIopsRawWrite(statisticsTCPIopsRawWrite *int64) {\n\to.StatisticsTCPIopsRawWrite = statisticsTCPIopsRawWrite\n}", "title": "" }, { "docid": "8e0dc0563997be8ab6f504c5ecead731", "score": "0.5687631", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPIopsRawWrite(statisticsTCPIopsRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPIopsRawWrite(statisticsTCPIopsRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "66e52f4b5f4586ec36ccb82475a41538", "score": "0.565099", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsLatencyRawRead(statisticsLatencyRawRead)\n\treturn o\n}", "title": "" }, { "docid": "1d47cdfeccb5e17371be7539b7a24e4a", "score": "0.5593745", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcIopsRawWrite(statisticsFcIopsRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcIopsRawWrite(statisticsFcIopsRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "92f80bfdacd1951f3c788250ab2a46d1", "score": "0.55734026", "text": "func GetReadIOPS(param interface{}) (model.Response, error) {\n\tvar result model.Response\n\tlevel := param.(model.MAgentParam).Level\n\tstartingTime := getVolumeCreationTime(level)\n\tvalues, columns, statusCode := GetAIRData(param, ReadIOPSAggRPQ, ReadIOPSDefaultRPQ, ReadIOPSLastRecordQ, startingTime)\n\tresult.Result.Status, _ = util.GetStatusInfo(statusCode)\n\tif statusCode != 0 {\n\t\tresult.Result.Data = make([]string, 0)\n\t\treturn result, nil\n\t}\n\tres := extractValues(values, columns, \"iops\", \"iops\", IOPSReadField, level)\n\tresult.Result.Data = res\n\treturn result, nil\n}", "title": "" }, { "docid": "9fc9a2c43637fbc0d18978e42f96fb7e", "score": "0.5533919", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsLatencyRawRead(statisticsLatencyRawRead)\n\treturn o\n}", "title": "" }, { "docid": "82bf897690647a5e669fd33d2403c279", "score": "0.55224675", "text": "func (o *CloudSkuVolumeTypeAllOf) SetMaxReadIops(v float64) {\n\to.MaxReadIops = &v\n}", "title": "" }, { "docid": "6a5bd9da8e6eb82370d2126b9c10e41e", "score": "0.5496474", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPLatencyRawRead(statisticsTCPLatencyRawRead *int64) {\n\to.StatisticsTCPLatencyRawRead = statisticsTCPLatencyRawRead\n}", "title": "" }, { "docid": "7ede5aa735e87ffb6330a41583195b81", "score": "0.5466845", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPLatencyRawRead(statisticsTCPLatencyRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPLatencyRawRead(statisticsTCPLatencyRawRead)\n\treturn o\n}", "title": "" }, { "docid": "fc93e6ee48508f415f1dee119cd17fce", "score": "0.5372978", "text": "func (o *LunCollectionGetParams) WithStatisticsLatencyRawRead(statisticsLatencyRawRead *int64) *LunCollectionGetParams {\n\to.SetStatisticsLatencyRawRead(statisticsLatencyRawRead)\n\treturn o\n}", "title": "" }, { "docid": "cde84c57fb533ee6de18e0c23c8282ad", "score": "0.5343634", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcIopsRawTotal(statisticsFcIopsRawTotal *int64) {\n\to.StatisticsFcIopsRawTotal = statisticsFcIopsRawTotal\n}", "title": "" }, { "docid": "dd9c63fcf9ec41634aef411a88e77418", "score": "0.5307168", "text": "func (o *NvmeCollectionPerformanceMetricsGetParams) WithIopsRead(iopsRead *int64) *NvmeCollectionPerformanceMetricsGetParams {\n\to.SetIopsRead(iopsRead)\n\treturn o\n}", "title": "" }, { "docid": "966e976a637eb14710d8e9c6b92ed479", "score": "0.5281979", "text": "func (o *LunCollectionGetParams) WithStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) *LunCollectionGetParams {\n\to.SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "135e3c041a78160ea81a445fdb66765b", "score": "0.5244056", "text": "func (o *NvmeCollectionPerformanceMetricsGetParams) SetFcIopsRead(fcIopsRead *int64) {\n\to.FcIopsRead = fcIopsRead\n}", "title": "" }, { "docid": "82b07f0705a3628c7aad7b4aa5e56bf2", "score": "0.5239767", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcThroughputRawRead(statisticsFcThroughputRawRead *int64) {\n\to.StatisticsFcThroughputRawRead = statisticsFcThroughputRawRead\n}", "title": "" }, { "docid": "1e9eb947771960b7d8b492a37be49979", "score": "0.5230632", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcLatencyRawRead(statisticsFcLatencyRawRead *int64) {\n\to.StatisticsFcLatencyRawRead = statisticsFcLatencyRawRead\n}", "title": "" }, { "docid": "102bfebd6b1ab3748f713f420534d69f", "score": "0.52244365", "text": "func (o *LunCollectionGetParams) SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) {\n\to.StatisticsLatencyRawWrite = statisticsLatencyRawWrite\n}", "title": "" }, { "docid": "481cfd73a37e0a7ec6b1b644bae07256", "score": "0.51995075", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "b6976a3e701e9399e6a4dc70407dec7f", "score": "0.5172505", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) {\n\to.StatisticsLatencyRawWrite = statisticsLatencyRawWrite\n}", "title": "" }, { "docid": "b58326dcf7417d2a2c9c379c6b8bbfd8", "score": "0.5153324", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsFcIopsRawOther(statisticsFcIopsRawOther *int64) {\n\to.StatisticsFcIopsRawOther = statisticsFcIopsRawOther\n}", "title": "" }, { "docid": "bb0c08f5bee11e11db2e4d888cd26d1f", "score": "0.51281655", "text": "func (o *LunCollectionGetParams) SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) {\n\to.StatisticsThroughputRawWrite = statisticsThroughputRawWrite\n}", "title": "" }, { "docid": "30e28bfc864b090dc2ea8dd88f6af58c", "score": "0.51216054", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) {\n\to.StatisticsLatencyRawWrite = statisticsLatencyRawWrite\n}", "title": "" }, { "docid": "66596c51bb1c5c869b0cf9e36459a1c3", "score": "0.5108602", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) {\n\to.StatisticsThroughputRawWrite = statisticsThroughputRawWrite\n}", "title": "" }, { "docid": "83e3b03bf68173668366dc4b84e1a521", "score": "0.5103538", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPIopsRawTotal(statisticsTCPIopsRawTotal *int64) {\n\to.StatisticsTCPIopsRawTotal = statisticsTCPIopsRawTotal\n}", "title": "" }, { "docid": "82fd4e97b46ef471f477369946b6ec4a", "score": "0.50987244", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPIopsRawTotal(statisticsTCPIopsRawTotal *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPIopsRawTotal(statisticsTCPIopsRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "9d101f317d75f2d555e0589ace895986", "score": "0.5066715", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "b915139d469a9ddcffebd844783efbbc", "score": "0.5064059", "text": "func (o *LunCollectionGetParams) WithMetricIopsRead(metricIopsRead *int64) *LunCollectionGetParams {\n\to.SetMetricIopsRead(metricIopsRead)\n\treturn o\n}", "title": "" }, { "docid": "3ab0ff89d47885d81bc12886619fe72b", "score": "0.50373715", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcIopsRawTotal(statisticsFcIopsRawTotal *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcIopsRawTotal(statisticsFcIopsRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "563c9f905aa095982afa06e643709315", "score": "0.5006344", "text": "func (o *NvmeCollectionPerformanceMetricsGetParams) SetIopsWrite(iopsWrite *int64) {\n\to.IopsWrite = iopsWrite\n}", "title": "" }, { "docid": "9db6b981979fce747508d8f35e192a12", "score": "0.49988008", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcThroughputRawRead(statisticsFcThroughputRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcThroughputRawRead(statisticsFcThroughputRawRead)\n\treturn o\n}", "title": "" }, { "docid": "83a5801fbf9588f5bf8818afb787f5ed", "score": "0.4998306", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "4ad39e6779cf0f91a7d41889445bb3fe", "score": "0.49919313", "text": "func (o *NvmeNamespaceCollectionGetParams) SetStatisticsThroughputRawWrite(statisticsThroughputRawWrite *int64) {\n\to.StatisticsThroughputRawWrite = statisticsThroughputRawWrite\n}", "title": "" }, { "docid": "d37f3484a15c0b9d724cee67509af6d1", "score": "0.49881083", "text": "func (o *LunCollectionGetParams) WithStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) *LunCollectionGetParams {\n\to.SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "439987dd4d8c2957318e04486aeb34a9", "score": "0.49764815", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPThroughputRawRead(statisticsTCPThroughputRawRead *int64) {\n\to.StatisticsTCPThroughputRawRead = statisticsTCPThroughputRawRead\n}", "title": "" }, { "docid": "8a386be22a82785232b068bc2d14d7a3", "score": "0.4972445", "text": "func (o *NvmeServiceCollectionGetParams) WithMetricIopsRead(metricIopsRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetMetricIopsRead(metricIopsRead)\n\treturn o\n}", "title": "" }, { "docid": "fd7cb87cad21b6267ad2178557dd3768", "score": "0.49248412", "text": "func (o *NvmeNamespaceCollectionGetParams) WithMetricIopsRead(metricIopsRead *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetMetricIopsRead(metricIopsRead)\n\treturn o\n}", "title": "" }, { "docid": "39d0535467518f389eaa8f6e117ab8d4", "score": "0.4890573", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsLatencyRawWrite(statisticsLatencyRawWrite *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsLatencyRawWrite(statisticsLatencyRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "531b89afcc6133f5076c906e6b5e1856", "score": "0.4890401", "text": "func (o *CloudSkuVolumeTypeAllOf) GetMaxReadIops() float64 {\n\tif o == nil || o.MaxReadIops == nil {\n\t\tvar ret float64\n\t\treturn ret\n\t}\n\treturn *o.MaxReadIops\n}", "title": "" }, { "docid": "ffa47238ea425a439a4721c74028b85e", "score": "0.4875491", "text": "func (o *NvmeServiceCollectionGetParams) SetMetricFcIopsRead(metricFcIopsRead *int64) {\n\to.MetricFcIopsRead = metricFcIopsRead\n}", "title": "" }, { "docid": "b5ef51a7aef3ee8947c2e04dcfa5672b", "score": "0.4871816", "text": "func (o *NvmeServiceCollectionGetParams) SetStatisticsTCPIopsRawOther(statisticsTCPIopsRawOther *int64) {\n\to.StatisticsTCPIopsRawOther = statisticsTCPIopsRawOther\n}", "title": "" }, { "docid": "62122ab2bfed85d85804c3c1e262b3fb", "score": "0.48627466", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcIopsRawOther(statisticsFcIopsRawOther *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcIopsRawOther(statisticsFcIopsRawOther)\n\treturn o\n}", "title": "" }, { "docid": "be144ca57507babb9e9caf1bf98be467", "score": "0.4840803", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsFcLatencyRawRead(statisticsFcLatencyRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsFcLatencyRawRead(statisticsFcLatencyRawRead)\n\treturn o\n}", "title": "" }, { "docid": "8478158ce53b79b5591a59134691ea9e", "score": "0.48091552", "text": "func (s *SmfStorageClient) RawGet(ctx context.Context, req []byte) ([]byte, error) {\n\treturn s.Client.SendRecv(req, 212494116^1719559449)\n}", "title": "" }, { "docid": "faadb1a2e2b8e137f6df14914cc21796", "score": "0.47730935", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPIopsRawOther(statisticsTCPIopsRawOther *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPIopsRawOther(statisticsTCPIopsRawOther)\n\treturn o\n}", "title": "" }, { "docid": "b6110bb4fa1c1415281b33565f5733e8", "score": "0.47627643", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsThroughputRawTotal(statisticsThroughputRawTotal *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsThroughputRawTotal(statisticsThroughputRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "08f84bfc1ede4f4f62e388ab1f157500", "score": "0.4749651", "text": "func (o *LunCollectionGetParams) SetStatisticsThroughputRawOther(statisticsThroughputRawOther *int64) {\n\to.StatisticsThroughputRawOther = statisticsThroughputRawOther\n}", "title": "" }, { "docid": "a61706db65a10cff56009b806fdb8c8d", "score": "0.47330537", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPThroughputRawRead(statisticsTCPThroughputRawRead *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPThroughputRawRead(statisticsTCPThroughputRawRead)\n\treturn o\n}", "title": "" }, { "docid": "609a8cafbd2d760ac3e9c84be3f09a72", "score": "0.47015035", "text": "func (o *LunCollectionGetParams) WithStatisticsThroughputRawTotal(statisticsThroughputRawTotal *int64) *LunCollectionGetParams {\n\to.SetStatisticsThroughputRawTotal(statisticsThroughputRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "630df9e3daa0273727b4d05676e1bba6", "score": "0.46823317", "text": "func (o *CloudSkuVolumeTypeAllOf) HasMaxReadIops() bool {\n\tif o != nil && o.MaxReadIops != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "758603661c5aa12d1b11097612206571", "score": "0.4677588", "text": "func (o *LunCollectionGetParams) SetMetricIopsWrite(metricIopsWrite *int64) {\n\to.MetricIopsWrite = metricIopsWrite\n}", "title": "" }, { "docid": "56a29235f7451d70fbc689e0549ecf24", "score": "0.46765134", "text": "func (c *VaultClient) RawRead(token, path string) (*api.Secret, error) {\n\treq, err := http.NewRequest(http.MethodGet, fmt.Sprintf(\"%sv1/%s\", VaultURL, path), nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tsetVaultToken(req, token)\n\tresp, err := c.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdefer resp.Body.Close()\n\treturn api.ParseSecret(resp.Body)\n}", "title": "" }, { "docid": "dfdc9161bd1038bbd56e68be3a7ceeea", "score": "0.46753728", "text": "func (o *UpdateVolumeRequest) SetIops(v int32) {\n\to.Iops = &v\n}", "title": "" }, { "docid": "5b4e0cc58eb09758cc287b27c97f8489", "score": "0.4665049", "text": "func (o *VirtualizationVolumeInfoAllOf) SetIops(v int64) {\n\to.Iops = &v\n}", "title": "" }, { "docid": "dc71cea8b27a48de590a93b35716ed36", "score": "0.46502364", "text": "func (r i40eReader) ReadStats(pfName string, vfID string ) sriovStats {\n\tstats := make(sriovStats, 0)\n\tstatroot := fmt.Sprintf(\"/sys/class/net/%s/device/sriov/%s/stats/\", pfName, vfID)\n\tfiles , err := ioutil.ReadDir(statroot)\n\tif err != nil {\n\t\treturn stats\n\t}\n\tfor _, f := range files {\n\t\tpath:= filepath.Join(statroot,f.Name())\n\t\tstatRaw, err := ioutil.ReadFile(path)\n\t\tif err != nil{\n\t\t\tcontinue\n\t\t}\n\t\tstatString := strings.TrimSpace(string(statRaw))\n\t\tvalue, err := strconv.ParseFloat(statString,64)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\tstats[f.Name()] = value\n\t}\n\treturn stats\n}", "title": "" }, { "docid": "faf76d1f8c9a0662d63e49cf6df23cc7", "score": "0.4646271", "text": "func (o *NvmeNamespaceCollectionGetParams) WithStatisticsThroughputRawTotal(statisticsThroughputRawTotal *int64) *NvmeNamespaceCollectionGetParams {\n\to.SetStatisticsThroughputRawTotal(statisticsThroughputRawTotal)\n\treturn o\n}", "title": "" }, { "docid": "1b95e8c8aae5f2f466e6117bd1ffcb30", "score": "0.46329024", "text": "func (o *LunCollectionGetParams) WithStatisticsThroughputRawOther(statisticsThroughputRawOther *int64) *LunCollectionGetParams {\n\to.SetStatisticsThroughputRawOther(statisticsThroughputRawOther)\n\treturn o\n}", "title": "" }, { "docid": "c61b278718151c4b7415bc86d83f11ba", "score": "0.46068937", "text": "func (o *NvmeServiceCollectionGetParams) WithStatisticsTCPLatencyRawWrite(statisticsTCPLatencyRawWrite *int64) *NvmeServiceCollectionGetParams {\n\to.SetStatisticsTCPLatencyRawWrite(statisticsTCPLatencyRawWrite)\n\treturn o\n}", "title": "" }, { "docid": "cca569592047f1bee82e68ad5de0cb37", "score": "0.46002373", "text": "func (o *NvmeServiceCollectionGetParams) SetMetricIopsWrite(metricIopsWrite *int64) {\n\to.MetricIopsWrite = metricIopsWrite\n}", "title": "" }, { "docid": "4f754f7e9d337893e23af4c6a2f0bd89", "score": "0.4583423", "text": "func (o *NvmeNamespaceCollectionGetParams) SetMetricIopsWrite(metricIopsWrite *int64) {\n\to.MetricIopsWrite = metricIopsWrite\n}", "title": "" } ]
0fcaebfde7ebaf4b9c812f84488a1d70
MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of KeyValue_SetValueV2_Args.
[ { "docid": "d9700104f9cc67f51bb0600e69a36fcd", "score": "0.85178375", "text": "func (v *KeyValue_SetValueV2_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"key\", (string)(v.Key))\n\terr = multierr.Append(err, enc.AddObject(\"value\", v.Value))\n\treturn err\n}", "title": "" } ]
[ { "docid": "5fb4efb2145b4bf8eb9fbfe321eb3ee0", "score": "0.6171098", "text": "func (v *KeyValue_SetValueV2_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "fdec8c9470403fca0741f96d1fd93121", "score": "0.57943046", "text": "func (v *ServiceGenerator_Generate_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tif v.Request != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"request\", v.Request))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4c52736ceaca8f6844b0aaa99bef67e4", "score": "0.5749227", "text": "func (v *KeyValue_SetValueV2_Args) String() string {\n\tif v == nil {\n\t\treturn \"<nil>\"\n\t}\n\n\tvar fields [2]string\n\ti := 0\n\tfields[i] = fmt.Sprintf(\"Key: %v\", v.Key)\n\ti++\n\tfields[i] = fmt.Sprintf(\"Value: %v\", v.Value)\n\ti++\n\n\treturn fmt.Sprintf(\"KeyValue_SetValueV2_Args{%v}\", strings.Join(fields[:i], \", \"))\n}", "title": "" }, { "docid": "f23ca501f1adf114865278861ac0585c", "score": "0.5716229", "text": "func (v _Map_ServiceID_Service_Item_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tenc.AddInt32(\"key\", (int32)(v.Key))\n\terr = multierr.Append(err, enc.AddObject(\"value\", v.Value))\n\treturn err\n}", "title": "" }, { "docid": "bbdaf18ae2965f011fe55f8901e38667", "score": "0.5627733", "text": "func (v _Map_ModuleID_Module_Item_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tenc.AddInt32(\"key\", (int32)(v.Key))\n\terr = multierr.Append(err, enc.AddObject(\"value\", v.Value))\n\treturn err\n}", "title": "" }, { "docid": "846cb18c4ea330d9c80f6000005db17c", "score": "0.55752766", "text": "func (v *Argument) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"name\", v.Name)\n\terr = multierr.Append(err, enc.AddObject(\"type\", v.Type))\n\tif v.Annotations != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"annotations\", (_Map_String_String_Zapper)(v.Annotations)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cac378f7c5b3caa8d7bd241c0f61d418", "score": "0.54306763", "text": "func (v *Plugin_Handshake_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tif v.Request != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"request\", v.Request))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "059c766c9b6c9fe57b3a116645561a9f", "score": "0.54229736", "text": "func (m _Map_String_Binary_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tfor k, v := range m {\n\t\tenc.AddString((string)(k), base64.StdEncoding.EncodeToString(v))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "c6e5fbc861bd8980bda9ae032c597e13", "score": "0.54077166", "text": "func (m _Map_String_String_Zapper) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tfor k, v := range m {\n\t\tenc.AddString((string)(k), v)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "64349764103173031b21d93b3568e2c9", "score": "0.5406646", "text": "func (v *Plugin_Goodbye_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e36451230c5d019fb7bddb5c7f1878cb", "score": "0.5320955", "text": "func (v *Type) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tif v.SimpleType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"simpleType\", *v.SimpleType))\n\t}\n\tif v.SliceType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"sliceType\", v.SliceType))\n\t}\n\tif v.KeyValueSliceType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"keyValueSliceType\", v.KeyValueSliceType))\n\t}\n\tif v.MapType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"mapType\", v.MapType))\n\t}\n\tif v.ReferenceType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"referenceType\", v.ReferenceType))\n\t}\n\tif v.PointerType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"pointerType\", v.PointerType))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "9dc788939c38c98f719ffda76da6bbe8", "score": "0.5222895", "text": "func (v *Function) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"name\", v.Name)\n\tenc.AddString(\"thriftName\", v.ThriftName)\n\terr = multierr.Append(err, enc.AddArray(\"arguments\", (_List_Argument_Zapper)(v.Arguments)))\n\tif v.ReturnType != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"returnType\", v.ReturnType))\n\t}\n\tif v.Exceptions != nil {\n\t\terr = multierr.Append(err, enc.AddArray(\"exceptions\", (_List_Argument_Zapper)(v.Exceptions)))\n\t}\n\tif v.OneWay != nil {\n\t\tenc.AddBool(\"oneWay\", *v.OneWay)\n\t}\n\tif v.Annotations != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"annotations\", (_Map_String_String_Zapper)(v.Annotations)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b728fc5d8ae30d96bb3a840b87c659b5", "score": "0.51757747", "text": "func (v *TypePair) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\terr = multierr.Append(err, enc.AddObject(\"left\", v.Left))\n\terr = multierr.Append(err, enc.AddObject(\"right\", v.Right))\n\treturn err\n}", "title": "" }, { "docid": "06cd82c9a311878b282e29172af705a0", "score": "0.51553255", "text": "func (v *KeyValue_SetValueV2_Args) Equals(rhs *KeyValue_SetValueV2_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.Key == rhs.Key) {\n\t\treturn false\n\t}\n\tif !v.Value.Equals(rhs.Value) {\n\t\treturn false\n\t}\n\n\treturn true\n}", "title": "" }, { "docid": "54d26e073b253baeac588bc7cf0b8fa2", "score": "0.51331437", "text": "func (l _List_Argument_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {\n\tfor _, v := range l {\n\t\terr = multierr.Append(err, enc.AppendObject(v))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "606d749c5078c5656f3e8060d54c846c", "score": "0.5003032", "text": "func (v *DocumentStruct) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\terr = multierr.Append(err, enc.AddObject(\"second\", v.Second))\n\treturn err\n}", "title": "" }, { "docid": "122caa03900245e2be6be3acc17b7288", "score": "0.49838912", "text": "func (c *B) Log(args ...interface{})", "title": "" }, { "docid": "828ff722b9e9476d36ef5eceecdfcc40", "score": "0.4982759", "text": "func SetArgValue(name string, fval reflect.Value, value string) error {\n\tnptyp := kit.NonPtrType(fval.Type())\n\tvk := nptyp.Kind()\n\tswitch {\n\tcase vk >= reflect.Int && vk <= reflect.Uint64 && kit.Enums.TypeRegistered(nptyp):\n\t\treturn kit.Enums.SetAnyEnumValueFromString(fval, value)\n\tcase vk == reflect.Map:\n\t\tmval := make(map[string]any)\n\t\terr := toml.ReadBytes(&mval, []byte(\"tmp=\"+value)) // use toml decoder\n\t\tif err != nil {\n\t\t\tmpi.Println(err)\n\t\t\treturn err\n\t\t}\n\t\terr = kit.CopyMapRobust(fval.Interface(), mval[\"tmp\"])\n\t\tif err != nil {\n\t\t\tmpi.Println(err)\n\t\t\terr = fmt.Errorf(\"econfig.ParseArgs: not able to set map field from arg: %s val: %s\", name, value)\n\t\t\tmpi.Println(err)\n\t\t\treturn err\n\t\t}\n\tcase vk == reflect.Slice:\n\t\tmval := make(map[string]any)\n\t\terr := toml.ReadBytes(&mval, []byte(\"tmp=\"+value)) // use toml decoder\n\t\tif err != nil {\n\t\t\tmpi.Println(err)\n\t\t\treturn err\n\t\t}\n\t\terr = kit.CopySliceRobust(fval.Interface(), mval[\"tmp\"])\n\t\tif err != nil {\n\t\t\tmpi.Println(err)\n\t\t\terr = fmt.Errorf(\"econfig.ParseArgs: not able to set slice field from arg: %s val: %s\", name, value)\n\t\t\tmpi.Println(err)\n\t\t\treturn err\n\t\t}\n\tdefault:\n\t\tok := kit.SetRobust(fval.Interface(), value) // overkill but whatever\n\t\tif !ok {\n\t\t\terr := fmt.Errorf(\"econfig.ParseArgs: not able to set field from arg: %s val: %s\", name, value)\n\t\t\tmpi.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0bcd4bec870d6e6b7b27b6d1eb70b7b8", "score": "0.49442068", "text": "func (v *KeyValue_SetValueV2_Args) MethodName() string {\n\treturn \"setValueV2\"\n}", "title": "" }, { "docid": "b672393ba989072c9dbc9c2ee4fdfee6", "score": "0.48787174", "text": "func (user User) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tadd := func(key, value string) {\n\t\tif value != \"\" {\n\t\t\tenc.AddString(key, value)\n\t\t}\n\t}\n\n\tadd(\"email\", user.Email)\n\tadd(\"id\", user.ID)\n\tadd(\"ip_address\", user.IPAddress)\n\tadd(\"username\", user.Username)\n\treturn nil\n}", "title": "" }, { "docid": "ec2d16ce9f722fd65b0a8bacabf934fd", "score": "0.48418", "text": "func (v SimpleType) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddInt32(\"value\", int32(v))\n\tswitch int32(v) {\n\tcase 1:\n\t\tenc.AddString(\"name\", \"BOOL\")\n\tcase 2:\n\t\tenc.AddString(\"name\", \"BYTE\")\n\tcase 3:\n\t\tenc.AddString(\"name\", \"INT8\")\n\tcase 4:\n\t\tenc.AddString(\"name\", \"INT16\")\n\tcase 5:\n\t\tenc.AddString(\"name\", \"INT32\")\n\tcase 6:\n\t\tenc.AddString(\"name\", \"INT64\")\n\tcase 7:\n\t\tenc.AddString(\"name\", \"FLOAT64\")\n\tcase 8:\n\t\tenc.AddString(\"name\", \"STRING\")\n\tcase 9:\n\t\tenc.AddString(\"name\", \"STRUCT_EMPTY\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "200d5da5d4dcdb0bdb1e06f620d2d4c3", "score": "0.48389468", "text": "func (service_context serviceContext) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"service\", service_context.Name)\n\tif service_context.Version != \"\" {\n\t\tenc.AddString(\"version\", service_context.Version)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "4af31763bd09a1aae638930dacce9a14", "score": "0.4825023", "text": "func (c *T) Log(args ...interface{})", "title": "" }, { "docid": "0fb806539648de3d42d8640886649b2c", "score": "0.47953603", "text": "func (v *Viewer) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"tenant\", v.Tenant)\n\tenc.AddString(\"user\", v.User)\n\tenc.AddString(\"role\", v.Role)\n\treturn nil\n}", "title": "" }, { "docid": "974ba22b1eefe15a60512036e3f662ae", "score": "0.4743019", "text": "func (v Feature) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddInt32(\"value\", int32(v))\n\tswitch int32(v) {\n\tcase 1:\n\t\tenc.AddString(\"name\", \"SERVICE_GENERATOR\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6445ab945cc77953b2ad6eb29f32bf89", "score": "0.4720464", "text": "func (o operation) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"id\", o.id.String())\n\tenc.AddBool(\"first\", o.first)\n\tenc.AddBool(\"last\", o.last)\n\tif o.producer != \"\" {\n\t\tenc.AddString(\"producer\", o.producer)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "212cffbca5e1e72a1302af24e712b132", "score": "0.46855244", "text": "func (lg Logger) Log(level Level, v ...interface{}) {\n\tif level >= lg.level {\n\t\tlg.json.Timestamp = time.Now().Format(\"2006-01-02 15:04:05\")\n\t\tlg.json.Level = levelToString()[level]\n\t\tlg.json.Data = make(map[string]interface{})\n\t\tvar n = len(v)\n\t\tfor i := 0; i < n; i = i + 2 {\n\t\t\tif str, ok := v[i].(string); ok {\n\t\t\t\tlg.json.Data[str] = v[i+1]\n\t\t\t} else {\n\t\t\t\tpanic(\"json key must be a string\")\n\t\t\t}\n\t\t}\n\n\t\tlg.logger.Encode(lg.json)\n\t}\n}", "title": "" }, { "docid": "e50c3c7b24da9cc4cd54016b9ded36fd", "score": "0.4665098", "text": "func InfoKV(args ...interface{}) {\n\tcurrentLogger.InfoKVDepth(context.Background(), defaultDepth, args...)\n}", "title": "" }, { "docid": "dd5cf0bc1f14686de48568e81b192d95", "score": "0.46586335", "text": "func (r Args) Set(key string, value interface{}) {\n\tr[key] = value\n}", "title": "" }, { "docid": "714139308b4ba2e6f08d426e0852e2eb", "score": "0.46497768", "text": "func (v *Module) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"importPath\", v.ImportPath)\n\tenc.AddString(\"directory\", v.Directory)\n\tenc.AddString(\"thriftFilePath\", v.ThriftFilePath)\n\treturn err\n}", "title": "" }, { "docid": "c40b9b6a7ff3df90967f952265daf925", "score": "0.4648335", "text": "func (c config) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"provider\", c.Provider)\n\tenc.AddString(\"account-name\", c.AccountName)\n\tenc.AddString(\"account-secret\", \"****\")\n\tenc.AddString(\"dns-content\", c.DNSContent)\n\tenc.AddString(\"docker-label\", c.DockerLabel)\n\tenc.AddString(\"store\", c.Store)\n\tenc.AddBool(\"debug-logger\", c.DebugLogger)\n\tenc.AddString(\"data-directory\", c.DataDirectory)\n\treturn nil\n}", "title": "" }, { "docid": "8ab646514bea9c5259eef09ccc98a92e", "score": "0.4646086", "text": "func (u *URLField) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"path\", u.URL.Path)\n\tenc.AddString(\"query\", u.URL.RawQuery)\n\treturn nil\n}", "title": "" }, { "docid": "063912549b338058133dd0738314fcc2", "score": "0.45991576", "text": "func (args *Args) setFieldValue(job interface{}) {\n\tlog.Debugf(\"Assigning attrs: %v to job %v\", args, job)\n\ts := reflect.ValueOf(job)\n\tif res := s.Elem().FieldByName(args.Field); res.IsValid() {\n\t\tif res.CanSet() {\n\t\t\tswitch res.Kind() {\n\t\t\tcase reflect.String:\n\t\t\t\tres.SetString(args.Value)\n\t\t\tcase reflect.Map:\n\t\t\t\tif args.Del {\n\t\t\t\t\tdelete(res.Interface().(map[string]map[string]string), args.Value)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tif res.Type().String() == \"map[string]map[string]string\" {\n\t\t\t\t\tvar vMap map[string]map[string]string\n\t\t\t\t\tif err := json.Unmarshal([]byte(args.Value), &vMap); err != nil {\n\t\t\t\t\t\tlog.Error(err)\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t\tv := reflect.ValueOf(vMap)\n\t\t\t\t\tk := v.MapKeys()\n\t\t\t\t\tfor i := range k {\n\t\t\t\t\t\tres.SetMapIndex(k[i], v.MapIndex(k[i]))\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tres.SetMapIndex(reflect.ValueOf(args.Field), reflect.ValueOf(args.Value))\n\t\t\t\t}\n\t\t\tcase reflect.Bool:\n\t\t\t\tval, err := strconv.ParseBool(args.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(val)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tres.SetBool(val)\n\t\t\tcase reflect.Int:\n\t\t\t\tval, err := strconv.ParseInt(args.Value, 0, 0)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Error(val)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tres.SetInt(val)\n\t\t\tdefault:\n\t\t\t\tlog.Fatal(\"Unknown value type! Needs to be a String, Int, Bool or Map\")\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2c858cfd6335231babfd3ec880e5d2c4", "score": "0.45815027", "text": "func (l *FormattedJSONLogger) Log(keyvals ...interface{}) error {\n\tm := make(map[string]interface{}, (len(keyvals)+1)/2)\n\n\tfor i := 0; i < len(keyvals); i += 2 {\n\t\tvar v interface{} = \"(!MISSING)\"\n\t\tif i+1 < len(keyvals) {\n\t\t\tv = keyvals[i+1]\n\t\t}\n\t\tm[fmt.Sprintf(\"%s\", keyvals[i])] = v\n\t}\n\n\tb, err := json.Marshal(m)\n\tif err != nil {\n\t\t// TODO: Write this error to logs.\n\t\treturn err\n\t}\n\t_, err = fmt.Fprintln(l.w, string(b))\n\treturn err\n}", "title": "" }, { "docid": "9d01b125f66b27be2152607b8e4d4cf1", "score": "0.454095", "text": "func (w KitWrapper) Log(keyvals ...interface{}) error {\n\tconst msg = \"log.KitWrapper\"\n\tswitch zapcore.Level(w) {\n\tdefault:\n\t\t// for unknown values, fallback to info level.\n\t\tfallthrough\n\tcase zapcore.InfoLevel:\n\t\tInfow(msg, keyvals...)\n\tcase zapcore.DebugLevel:\n\t\tDebugw(msg, keyvals...)\n\tcase zapcore.ErrorLevel:\n\t\tErrorw(msg, keyvals...)\n\tcase zapcore.PanicLevel:\n\t\tPanicw(msg, keyvals...)\n\tcase zapcore.FatalLevel:\n\t\tFatalw(msg, keyvals...)\n\tcase ZapNopLevel:\n\t\t// do nothing\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a2e3ccda7d90e090958a18f814bc60f9", "score": "0.4532562", "text": "func (lg *logger) KV(k string, v interface{}) Logger {\n\n\tlg.buffer.Data[k] = v\n\treturn lg\n\n}", "title": "" }, { "docid": "87d49c8646f18d62ec44241f04459cb0", "score": "0.45238248", "text": "func (m _Map_ServiceID_Service_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {\n\tfor k, v := range m {\n\t\terr = multierr.Append(err, enc.AppendObject(_Map_ServiceID_Service_Item_Zapper{Key: k, Value: v}))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "f3f6de4dbe18522e37a4bbc388240af7", "score": "0.45156163", "text": "func (m _Map_ModuleID_Module_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {\n\tfor k, v := range m {\n\t\terr = multierr.Append(err, enc.AppendObject(_Map_ModuleID_Module_Item_Zapper{Key: k, Value: v}))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "1af35e89383bb5d122c54095d8a9f68f", "score": "0.4509513", "text": "func (l *ZapLogger) Log(level log.Level, keyvals ...interface{}) error {\n\tif len(keyvals) == 0 || len(keyvals)%2 != 0 {\n\t\tl.log.Warn(fmt.Sprint(\"Keyvalues must appear in pairs: \", keyvals))\n\t\treturn nil\n\t}\n\t// Zap.Field is used when keyvals pairs appear\n\tvar data []zap.Field\n\tfor i := 0; i < len(keyvals); i += 2 {\n\t\tdata = append(data, zap.Any(fmt.Sprint(keyvals[i]), fmt.Sprint(keyvals[i+1])))\n\t}\n\tswitch level {\n\tcase log.LevelDebug:\n\t\tl.log.Debug(\"\", data...)\n\tcase log.LevelInfo:\n\t\tl.log.Info(\"\", data...)\n\tcase log.LevelWarn:\n\t\tl.log.Warn(\"\", data...)\n\tcase log.LevelError:\n\t\tl.log.Error(\"\", data...)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b9f95e6a7b46702fd1c0674867b45018", "score": "0.45048723", "text": "func Log(fmt string, args ...interface{}) {}", "title": "" }, { "docid": "e75f5ba59791a297b0873dc29f5fbfef", "score": "0.4500816", "text": "func (v *Service) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"name\", v.Name)\n\tenc.AddString(\"thriftName\", v.ThriftName)\n\tif v.ParentID != nil {\n\t\tenc.AddInt32(\"parentID\", (int32)(*v.ParentID))\n\t}\n\terr = multierr.Append(err, enc.AddArray(\"functions\", (_List_Function_Zapper)(v.Functions)))\n\tenc.AddInt32(\"moduleID\", (int32)(v.ModuleID))\n\tif v.Annotations != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"annotations\", (_Map_String_String_Zapper)(v.Annotations)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "28bf30bef6aa977a6740df8e74180fa2", "score": "0.44918132", "text": "func logAsString(l map[string]interface{}) string {\n\tl[\"app\"] = AppName\n\tl[\"version\"] = Version\n\tb, err := json.Marshal(l)\n\tif err != nil {\n\t\tlog.Printf(\"unable to marshap map[string]interface{}. Wtf. %v \\n %#v\", err, l)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "b807d6a1b614d2e24c06f0d69c617ea4", "score": "0.44821733", "text": "func DebugKV(ctx context.Context, msg string, args ...field.Field) {\n\tglobal.DebugKV(ctx, msg, args...)\n}", "title": "" }, { "docid": "b29ea4b1acc21b2eac2635d57c5e07c5", "score": "0.44817108", "text": "func (m *Message) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"s\", m.s)\n\tenc.AddInt64(\"index\", m.i)\n\treturn nil\n}", "title": "" }, { "docid": "b7b4ee928f6febe2a61e5ef6388e1d26", "score": "0.44533545", "text": "func setMetadataForUpdate(existingObj *unstructured.Unstructured, objForUpdate *unstructured.Unstructured) {\n\tif logger.IsEnabled(LogTypeEntry) {\n\t\tlogger.Log(CallerName(), LogTypeEntry, fmt.Sprintf(\"setMetadataForUpdate\"))\n\t}\n\tvar objMap = existingObj.Object\n\tmetadataObj, ok := objMap[METADATA]\n\tvar metadata map[string]interface{}\n\tif !ok {\n\t\tmetadata = make(map[string]interface{})\n\t\tobjMap[METADATA] = metadata\n\t} else {\n\t\tmetadata = metadataObj.(map[string]interface{})\n\t}\n\n\tvar objMapForUpdate = objForUpdate.Object\n\tobjMapForUpdate[METADATA] = metadata\n\n\tif logger.IsEnabled(LogTypeExit) {\n\t\tlogger.Log(CallerName(), LogTypeExit, fmt.Sprintf(\"setMetadataForUpdate: update metadata %s is set\", metadata))\n\t}\n}", "title": "" }, { "docid": "bafc7d480016161bd744f1ecd116bc40", "score": "0.44531924", "text": "func (l _List_Function_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {\n\tfor _, v := range l {\n\t\terr = multierr.Append(err, enc.AppendObject(v))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "5683f05949d8adb66949cf142e5f28e5", "score": "0.44377053", "text": "func (mr *MockCacheMockRecorder) Set(ctx, key, value, expiration interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockCache)(nil).Set), ctx, key, value, expiration)\n}", "title": "" }, { "docid": "a742b05edbc7a6678477b7521d64566a", "score": "0.44298717", "text": "func setVal(v reflect.Value, pValue interface{}) string {\n\tswitch v.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tx, ok := pValue.(int64)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.OverflowInt(x) {\n\t\t\treturn fmt.Sprintf(\"value %v overflows struct field of type %v\", x, v.Type())\n\t\t}\n\t\tv.SetInt(x)\n\tcase reflect.Bool:\n\t\tx, ok := pValue.(bool)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.SetBool(x)\n\tcase reflect.String:\n\t\tswitch x := pValue.(type) {\n\t\tcase appengine.BlobKey:\n\t\t\tv.SetString(string(x))\n\t\tcase ByteString:\n\t\t\tv.SetString(string(x))\n\t\tcase string:\n\t\t\tv.SetString(x)\n\t\tdefault:\n\t\t\tif pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tx, ok := pValue.(float64)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.OverflowFloat(x) {\n\t\t\treturn fmt.Sprintf(\"value %v overflows struct field of type %v\", x, v.Type())\n\t\t}\n\t\tv.SetFloat(x)\n\tcase reflect.Ptr:\n\t\tx, ok := pValue.(*Key)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif _, ok := v.Interface().(*Key); !ok {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.Set(reflect.ValueOf(x))\n\tcase reflect.Struct:\n\t\tswitch v.Type() {\n\t\tcase typeOfTime:\n\t\t\tx, ok := pValue.(time.Time)\n\t\t\tif !ok && pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t\tv.Set(reflect.ValueOf(x))\n\t\tcase typeOfGeoPoint:\n\t\t\tx, ok := pValue.(appengine.GeoPoint)\n\t\t\tif !ok && pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t\tv.Set(reflect.ValueOf(x))\n\t\tdefault:\n\t\t\tent, ok := pValue.(*Entity)\n\t\t\tif !ok {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\n\t\t\t// Recursively load nested struct\n\t\t\tpls, err := newStructPLS(v.Addr().Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\n\t\t\t// if ent has a Key value and our struct has a Key field,\n\t\t\t// load the Entity's Key value into the Key field on the struct.\n\t\t\tif ent.Key != nil && pls.codec.keyField != -1 {\n\n\t\t\t\tpls.v.Field(pls.codec.keyField).Set(reflect.ValueOf(ent.Key))\n\t\t\t}\n\n\t\t\terr = pls.Load(ent.Properties)\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\t\t}\n\tcase reflect.Slice:\n\t\tx, ok := pValue.([]byte)\n\t\tif !ok {\n\t\t\tif y, yok := pValue.(ByteString); yok {\n\t\t\t\tx, ok = []byte(y), true\n\t\t\t}\n\t\t}\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.Type().Elem().Kind() != reflect.Uint8 {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.SetBytes(x)\n\tdefault:\n\t\treturn typeMismatchReason(pValue, v)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "0c86bf1531998cd1591392e4346a8447", "score": "0.44159895", "text": "func (location reportLocation) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"filePath\", location.File)\n\tenc.AddString(\"lineNumber\", location.Line)\n\tenc.AddString(\"functionName\", location.Function)\n\n\treturn nil\n}", "title": "" }, { "docid": "816f029f4b244d99f9e9d7afc3bdb0d8", "score": "0.43899795", "text": "func (s *SilentLogger) Log(v ...interface{}) {}", "title": "" }, { "docid": "e6e50927e5842c824f848d4631071684", "score": "0.43872735", "text": "func (m *KeyValue) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {\n {\n err := writer.WriteStringValue(\"key\", m.GetKey())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"@odata.type\", m.GetOdataType())\n if err != nil {\n return err\n }\n }\n {\n err := writer.WriteStringValue(\"value\", m.GetValue())\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": "857481f146dcdbfffd7484fe7a95615a", "score": "0.43857434", "text": "func (l _List_Feature_Zapper) MarshalLogArray(enc zapcore.ArrayEncoder) (err error) {\n\tfor _, v := range l {\n\t\terr = multierr.Append(err, enc.AppendObject(v))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "6b08d9bf7cb977305060f1ef2a233e46", "score": "0.43818885", "text": "func (server *p2pLogEx) GetValue(logEx *LogEx, key log.EncodedHash, object *[]byte) error {\n value, err := logEx.theLog.GetValue(key)\n if err != nil {\n return err\n }\n *object = value\n return nil\n}", "title": "" }, { "docid": "87ed50f6955fee743a91d03d590050cc", "score": "0.4376734", "text": "func (s *Server) Log(keyvals ...interface{}) error {\n\tlog.Warning(keyvals...)\n\treturn nil\n}", "title": "" }, { "docid": "6f33a96d10d3029f8e7cd1724f89bf91", "score": "0.43732166", "text": "func (ctx *context) SetValue(obj string, prop string, value interface{}) {\n\tctx.Data[obj+prop] = value\n\n}", "title": "" }, { "docid": "7c36ee8db88e699d6a607a205ffe4ace", "score": "0.43686178", "text": "func (bir *BuildInfoRecord) setkv(key, value string) {\n\tswitch key {\n\tcase \"vcs.revision\":\n\t\tbir.VcsRevision = value\n\tcase \"vcs.time\":\n\t\tbir.VcsTime = value\n\tcase \"vcs.modified\":\n\t\tbir.VcsModified = value\n\tcase \"vcs\":\n\t\tbir.VcsTool = value\n\t}\n}", "title": "" }, { "docid": "a6a81116c3bd4a2fa14320bbb75b366c", "score": "0.43644646", "text": "func (v *TypeReference) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tenc.AddString(\"name\", v.Name)\n\tenc.AddString(\"importPath\", v.ImportPath)\n\tif v.Annotations != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"annotations\", (_Map_String_String_Zapper)(v.Annotations)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "4daf289f2b5b7dcac0517a408410a52b", "score": "0.43620163", "text": "func InfoKV(ctx context.Context, msg string, args ...field.Field) {\n\tglobal.InfoKV(ctx, msg, args...)\n}", "title": "" }, { "docid": "3b1defcbf07591f2dcafeb9e40f2a661", "score": "0.43596348", "text": "func (d duration) MarshalZerologObject(e *zerolog.Event) {\n\te.Dur(\"duration\", time.Duration(d))\n}", "title": "" }, { "docid": "d244b4e52b40a7bb05a78f26795b465e", "score": "0.43547642", "text": "func (self *_object) set(name string, value Value, throw bool) {\n\tif !self.stash.canPut(name) {\n\t\ttypeErrorResult(throw)\n\t\treturn\n\t}\n\tself.stash.put(name, value)\n}", "title": "" }, { "docid": "daf885b6ad925a46b567518d14db6974", "score": "0.43545714", "text": "func logDataAdd(r *http.Request, key string, value interface{}) {\n\tvar data map[string]interface{}\n\n\tctx := r.Context()\n\td := ctx.Value(\"log\")\n\tswitch v := d.(type) {\n\tcase map[string]interface{}:\n\t\tdata = v\n\tdefault:\n\t\tdata = make(map[string]interface{})\n\t}\n\n\tdata[key] = value\n\n\tr = r.WithContext(context.WithValue(ctx, \"log\", data))\n}", "title": "" }, { "docid": "265bf2a175ce909a6fe319fd8ce084ab", "score": "0.434722", "text": "func (v *GenerateServiceResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tif v.Files != nil {\n\t\terr = multierr.Append(err, enc.AddObject(\"files\", (_Map_String_Binary_Zapper)(v.Files)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "79c54cc48b36fcdebe2863b0a7797b16", "score": "0.43433145", "text": "func (mr *MockStorageMockRecorder) Set(ctx, key, value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockStorage)(nil).Set), ctx, key, value)\n}", "title": "" }, { "docid": "3eb5ec9a1599c24ac824cf131aa15708", "score": "0.43363997", "text": "func (field *Field) SetValue(parser *ArgParse, args ...string) (size int, err error) {\n\tsize = 1\n\t// the basic setter\n\tif size, err = field.setValue(field.Value, args...); err != nil {\n\t\treturn\n\t}\n\n\tif fn := GetCallback(parser.Value, field.Callback); fn != nil {\n\t\tlog.Debug(\"try execute %v\", field.Callback)\n\t\t// trigger the callback, exit when callback return true\n\t\tif fn(parser) && ExitWhenCallback {\n\t\t\tlog.Info(\"execute callback %v, and exit 0\", field.Callback)\n\t\t\tos.Exit(0)\n\t\t}\n\t}\n\n\tfield.BeenSet = true\n\tif field.Value.Kind() == reflect.Ptr && field.Value.Elem().Kind() == reflect.Slice {\n\t\t// can set repeat\n\t\tfield.BeenSet = false\n\t}\n\tlog.Info(\"set %v as %v (%d)\", field.Name, field.Value, size)\n\treturn\n}", "title": "" }, { "docid": "71bb31a2e3d6a11297420e3c152c11d1", "score": "0.4325313", "text": "func (mr *MockClearableStorageMockRecorder) Set(ctx, key, value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockClearableStorage)(nil).Set), ctx, key, value)\n}", "title": "" }, { "docid": "4efa445e08f5965f814d8dc12f7186e0", "score": "0.4317712", "text": "func (l *Context) Log(keyvals ...interface{}) error {\n\tkvs := append(l.keyvals, keyvals...)\n\tif len(kvs)%2 != 0 {\n\t\tkvs = append(kvs, ErrMissingValue)\n\t}\n\tif l.hasValuer {\n\t\t// If no keyvals were appended above then we must copy l.keyvals so\n\t\t// that future log events will reevaluate the stored Valuers.\n\t\tif len(keyvals) == 0 {\n\t\t\tkvs = append([]interface{}{}, l.keyvals...)\n\t\t}\n\t\tbindValues(kvs[:len(l.keyvals)])\n\t}\n\treturn l.logger.Log(kvs...)\n}", "title": "" }, { "docid": "d9bf83706b751ade60b6964d3f5a54e0", "score": "0.43161777", "text": "func SetInObject(fieldPath []string, paramsData, key string, value interface{}, root string) (string, error) {\n\tprops, err := ToMap(key, paramsData, root)\n\tif err != nil {\n\t\tprops = make(map[string]interface{})\n\t}\n\n\tchanges := make(map[string]interface{})\n\tcur := changes\n\n\tfor i, k := range fieldPath {\n\t\tif i == len(fieldPath)-1 {\n\t\t\tcur[k] = value\n\t\t} else {\n\t\t\tif _, ok := cur[k]; !ok {\n\t\t\t\tm := make(map[string]interface{})\n\t\t\t\tcur[k] = m\n\t\t\t\tcur = m\n\t\t\t}\n\t\t}\n\t}\n\n\tif err = mergeMaps(props, changes, nil); err != nil {\n\t\treturn \"\", err\n\t}\n\n\tupdatePath := []string{root}\n\tif key != \"\" {\n\t\tupdatePath = []string{root, key}\n\t}\n\n\treturn updateFn(updatePath, paramsData, props)\n}", "title": "" }, { "docid": "c1fe650032bb52586e297c8a1cc7774e", "score": "0.43154758", "text": "func marshalKeyValue(keys []string, value interface{}) string {\n\tkey := strings.Join(keys, \".\")\n\tvalueStr := fmt.Sprint(value)\n\tif key != \"\" {\n\t\tvalueStr = key + \"=\" + valueStr\n\t}\n\treturn valueStr\n}", "title": "" }, { "docid": "849ef185d2721ccf1ddb73a0bfff5753", "score": "0.43090597", "text": "func (l *MemoryLogger) Info(msg string, keyvals ...interface{}) {\n\tl.println(\"INFO \", msg, keyvals)\n}", "title": "" }, { "docid": "f27815d5c76607fc7c01c2e19269c055", "score": "0.43076232", "text": "func (context reportContext) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddObject(\"reportLocation\", context.ReportLocation)\n\n\treturn nil\n}", "title": "" }, { "docid": "7ae72bf08378d4f3e739a8a3898c97bd", "score": "0.43017697", "text": "func (s SeederSummary) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"peer_id\", s.PeerID.String())\n\tenc.AddInt(\"requests_sent\", s.RequestsSent)\n\tenc.AddInt(\"good_pieces_received\", s.GoodPiecesReceived)\n\tenc.AddInt(\"duplicate_pieces_received\", s.DuplicatePiecesReceived)\n\treturn nil\n}", "title": "" }, { "docid": "efc683d850cbc2b25110c89d8f1bc307", "score": "0.429845", "text": "func Infow(msg string, keysAndValues ...interface{}) {\n\tlog.Infow(msg, keysAndValues...)\n}", "title": "" }, { "docid": "92aa9bb4781f1d3ddd46340f8a1f9a76", "score": "0.42979315", "text": "func (el *ZapEventLogger) LogKV(ctx context.Context, alternatingKeyValues ...interface{}) {\n\tspan := opentrace.SpanFromContext(ctx)\n\tif span == nil {\n\t\t_, file, line, _ := runtime.Caller(1)\n\t\tlog.Errorf(\"LogKV with no Span in context called on %s:%d\", path.Base(file), line)\n\t\treturn\n\t}\n\tspan.LogKV(alternatingKeyValues...)\n}", "title": "" }, { "docid": "63b5336d126f9e387a786dc92bcaf2a8", "score": "0.42972866", "text": "func (s LeecherSummary) MarshalLogObject(enc zapcore.ObjectEncoder) error {\n\tenc.AddString(\"peer_id\", s.PeerID.String())\n\tenc.AddInt(\"requests_received\", s.RequestsReceived)\n\tenc.AddInt(\"pieces_sent\", s.PiecesSent)\n\treturn nil\n}", "title": "" }, { "docid": "139f7690c7b6d3893b2426fe5630a536", "score": "0.42943737", "text": "func Log(ctx context.Context, keyvals ...interface{}) error {\n\treturn ReqLogger(ctx).Log(keyvals...)\n}", "title": "" }, { "docid": "549cda9dac37baa4d975b903273a0c3d", "score": "0.42859706", "text": "func (mr *MockSetWithTTLableStorageMockRecorder) Set(ctx, key, value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockSetWithTTLableStorage)(nil).Set), ctx, key, value)\n}", "title": "" }, { "docid": "69517c723412be9ce170ceafa9808fcb", "score": "0.42755568", "text": "func (node *JSONObjectParam) formatFast(buf *TrackedBuffer) {\n\tnode.Key.formatFast(buf)\n\tbuf.WriteString(\", \")\n\tnode.Value.formatFast(buf)\n}", "title": "" }, { "docid": "b28d6e7003e529b7dc4c759edd53bd4c", "score": "0.42727295", "text": "func (*jsonFormatterMapPool) PutObject(interface{}) { /* do nothing */ }", "title": "" }, { "docid": "9356aaae2befce4062cc84437807906f", "score": "0.42710686", "text": "func (_f9 *FakeContext) SetValueInvocation(calls_f10 []*ContextValueInvocation, fallback_f11 func() interface{}) {\n\t_f9.ValueHook = func(key interface{}) (ident3 interface{}) {\n\t\tfor _, call := range calls_f10 {\n\t\t\tif reflect.DeepEqual(call.Parameters.Key, key) {\n\t\t\t\tident3 = call.Results.Ident3\n\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\n\t\treturn fallback_f11()\n\t}\n}", "title": "" }, { "docid": "3782cdc48ff34210c4abda1d555495c3", "score": "0.4268201", "text": "func add(e *zerolog.Event, keysAndVals []interface{}) {\n\n\t// make sure we got an even number of arguments\n\tif len(keysAndVals)%2 != 0 {\n\t\te.Interface(\"args\", keysAndVals).\n\t\t\tAnErr(\"zerologr-err\", errors.New(\"odd number of arguments passed as key-value pairs for logging\")).\n\t\t\tStack()\n\t\treturn\n\t}\n\n\tfor i := 0; i < len(keysAndVals); {\n\t\t// process a key-value pair,\n\t\t// ensuring that the key is a string\n\t\tkey, val := keysAndVals[i], keysAndVals[i+1]\n\t\tkeyStr, isString := key.(string)\n\t\tif !isString {\n\t\t\t// if the key isn't a string, log additional error\n\t\t\te.Interface(\"invalid key\", key).\n\t\t\t\tAnErr(\"zerologr-err\", errors.New(\"non-string key argument passed to logging, ignoring all later arguments\")).\n\t\t\t\tStack()\n\t\t\treturn\n\t\t}\n\t\te.Interface(keyStr, val)\n\n\t\ti += 2\n\t}\n}", "title": "" }, { "docid": "3adbeddc218e690fdb4ac31581a4bb55", "score": "0.42569435", "text": "func (mr *MockDeletableStorageMockRecorder) Set(ctx, key, value interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockDeletableStorage)(nil).Set), ctx, key, value)\n}", "title": "" }, { "docid": "dcf5d8e746ff12cfd5b51d4e500a45ef", "score": "0.42556563", "text": "func (event appInfo) MarshalZerologObject(e *zerolog.Event) {\n\te.Dur(\"start_timeout\", event.StartTimeout())\n\te.Dur(\"stop_timeout\", event.StopTimeout())\n\n\ttypeNames := func(types []reflect.Type) []string {\n\t\tvar names []string\n\t\tfor _, t := range types {\n\t\t\tnames = append(names, t.String())\n\t\t}\n\t\treturn names\n\t}\n\n\te.Strs(\"provides\", typeNames(event.App.ConstructorTypes()))\n\te.Strs(\"invokes\", typeNames(event.App.FuncTypes()))\n\te.Str(\"dot_graph\", string(event.DotGraph))\n}", "title": "" }, { "docid": "fd4b234e45bca2cc761835589f4ee312", "score": "0.4255635", "text": "func SetValue(name string, value interface{}) error {\n\tif log.RootLogger().TraceEnabled() {\n\t\tlog.RootLogger().Tracef(\"Set App Value '%s': %v\", name, value)\n\t}\n\treturn appData.SetValue(name, value)\n}", "title": "" }, { "docid": "7ad339788dcf63447de80e93e59ad331", "score": "0.42542917", "text": "func (r *rds) Set(ctx context.Context, key string, value interface{}, duration time.Duration) error {\n\tp, err := json.Marshal(value)\n\tif err != nil {\n\t\tzapLogger.Prepare(logger).\n\t\t\tDevelopment().\n\t\t\tLevel(zap.ErrorLevel).\n\t\t\tCommit(err.Error())\n\t\treturn err\n\t}\n\treturn r.db.Set(ctx, key, p, duration).Err()\n}", "title": "" }, { "docid": "2f6b60b2fa577d494ddf77008c546376", "score": "0.42414647", "text": "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "title": "" }, { "docid": "2f6b60b2fa577d494ddf77008c546376", "score": "0.42414647", "text": "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "title": "" }, { "docid": "2f6b60b2fa577d494ddf77008c546376", "score": "0.42414647", "text": "func (f LoggerFunc) Log(keyvals ...interface{}) error {\n\treturn f(keyvals...)\n}", "title": "" }, { "docid": "e54ae645f9bc2a49e29c8de2c3ea2f11", "score": "0.4237573", "text": "func (mr *MockServerCacheMockRecorder) Set(key, data interface{}) *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"Set\", reflect.TypeOf((*MockServerCache)(nil).Set), key, data)\n}", "title": "" }, { "docid": "4222f7fefe02773df22f0ebe3436d7b7", "score": "0.4234014", "text": "func (node VindexParam) formatFast(buf *TrackedBuffer) {\n\tbuf.WriteString(node.Key.String())\n\tbuf.WriteByte('=')\n\tbuf.WriteString(node.Val)\n}", "title": "" }, { "docid": "726aad0199f34fefe4f2d7f704c1eb3f", "score": "0.42304152", "text": "func (v *GenerateServiceRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error) {\n\tif v == nil {\n\t\treturn nil\n\t}\n\terr = multierr.Append(err, enc.AddArray(\"rootServices\", (_List_ServiceID_Zapper)(v.RootServices)))\n\terr = multierr.Append(err, enc.AddArray(\"services\", (_Map_ServiceID_Service_Zapper)(v.Services)))\n\terr = multierr.Append(err, enc.AddArray(\"modules\", (_Map_ModuleID_Module_Zapper)(v.Modules)))\n\tenc.AddString(\"packagePrefix\", v.PackagePrefix)\n\tenc.AddString(\"thriftRoot\", v.ThriftRoot)\n\tif v.RootModules != nil {\n\t\terr = multierr.Append(err, enc.AddArray(\"rootModules\", (_List_ModuleID_Zapper)(v.RootModules)))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "cb724ab5fdb94444829dc5b801201569", "score": "0.42299238", "text": "func (el *ZapEventLogger) SetTag(ctx context.Context, k string, v interface{}) {\n\tspan := opentrace.SpanFromContext(ctx)\n\tif span == nil {\n\t\t_, file, line, _ := runtime.Caller(1)\n\t\tlog.Errorf(\"SetTag with no Span in context called on %s:%d\", path.Base(file), line)\n\t\treturn\n\t}\n\tspan.SetTag(k, v)\n}", "title": "" }, { "docid": "3613d58bfa3de3e08f7982105856e1ea", "score": "0.4228785", "text": "func setVal(v reflect.Value, pValue interface{}) string {\n\tswitch v.Kind() {\n\tcase reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:\n\t\tx, ok := pValue.(int64)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.OverflowInt(x) {\n\t\t\treturn fmt.Sprintf(\"value %v overflows struct field of type %v\", x, v.Type())\n\t\t}\n\t\tv.SetInt(x)\n\tcase reflect.Bool:\n\t\tx, ok := pValue.(bool)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.SetBool(x)\n\tcase reflect.String:\n\t\tswitch x := pValue.(type) {\n\t\tcase []byte:\n\t\t\tv.SetString(string(x))\n\t\tcase string:\n\t\t\tv.SetString(x)\n\t\tdefault:\n\t\t\tif pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t}\n\tcase reflect.Float32, reflect.Float64:\n\t\tx, ok := pValue.(float64)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.OverflowFloat(x) {\n\t\t\treturn fmt.Sprintf(\"value %v overflows struct field of type %v\", x, v.Type())\n\t\t}\n\t\tv.SetFloat(x)\n\tcase reflect.Ptr:\n\t\tx, ok := pValue.(*Key)\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif _, ok := v.Interface().(*Key); !ok {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.Set(reflect.ValueOf(x))\n\tcase reflect.Struct:\n\t\tswitch v.Type() {\n\t\tcase typeOfTime:\n\t\t\tx, ok := pValue.(time.Time)\n\t\t\tif !ok && pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t\tv.Set(reflect.ValueOf(x))\n\t\tcase typeOfGeoPoint:\n\t\t\tx, ok := pValue.(appengine.GeoPoint)\n\t\t\tif !ok && pValue != nil {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\t\t\tv.Set(reflect.ValueOf(x))\n\t\tdefault:\n\t\t\tent, ok := pValue.(*Entity)\n\t\t\tif !ok {\n\t\t\t\treturn typeMismatchReason(pValue, v)\n\t\t\t}\n\n\t\t\t// Recursively load nested struct\n\t\t\tpls, err := newStructPLS(v.Addr().Interface())\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\n\t\t\t// if ent has a Key value and our struct has a Key field,\n\t\t\t// load the Entity's Key value into the Key field on the struct.\n\t\t\tif ent.Key != nil && pls.codec.keyField != -1 {\n\n\t\t\t\tpls.v.Field(pls.codec.keyField).Set(reflect.ValueOf(ent.Key))\n\t\t\t}\n\n\t\t\terr = pls.Load(ent.Properties)\n\t\t\tif err != nil {\n\t\t\t\treturn err.Error()\n\t\t\t}\n\t\t}\n\tcase reflect.Slice:\n\t\tx, ok := pValue.([]byte)\n\t\tif !ok {\n\t\t\tif y, yok := pValue.(ByteString); yok {\n\t\t\t\tx, ok = []byte(y), true\n\t\t\t}\n\t\t}\n\t\tif !ok && pValue != nil {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tif v.Type().Elem().Kind() != reflect.Uint8 {\n\t\t\treturn typeMismatchReason(pValue, v)\n\t\t}\n\t\tv.SetBytes(x)\n\tdefault:\n\t\treturn typeMismatchReason(pValue, v)\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "7e127cea84383dfae81e3e1d824c2a61", "score": "0.42249626", "text": "func (mr *MockManagerMockRecorder) SerializeHelmValues(arg0, arg1 interface{}) *gomock.Call {\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"SerializeHelmValues\", reflect.TypeOf((*MockManager)(nil).SerializeHelmValues), arg0, arg1)\n}", "title": "" }, { "docid": "5dfaab37dcdd8a211d25bc113ac2e671", "score": "0.42162848", "text": "func (v *JSONValue) SetObject(val map[string]*JSONValue) {\n\n\tvar i int\n\tv.RawMessage = []byte{'{'}\n\tfor key, value := range val {\n\n\t\tif i != 0 {\n\t\t\tv.RawMessage = append(v.RawMessage, ',')\n\t\t}\n\t\ti++\n\n\t\tv.RawMessage = append(v.RawMessage, '\"')\n\t\tv.RawMessage = append(v.RawMessage, key...)\n\t\tv.RawMessage = append(v.RawMessage, '\"', ':')\n\t\tv.RawMessage = append(v.RawMessage, value.RawMessage...)\n\t}\n\tv.RawMessage = append(v.RawMessage, '}')\n\n\tv.valObject = val\n\tv.dataType = objectDataType\n}", "title": "" }, { "docid": "99e8f7d7dc3383e634ffd88af639b10d", "score": "0.42092952", "text": "func SetNestedField(obj interface{}, value interface{}, fields ...string) error {\n\tm := obj\n\n\tfor i, field := range fields[:len(fields)-1] {\n\t\tif mMap, ok := m.(map[string]interface{}); ok {\n\t\t\tif val, ok := mMap[field]; ok {\n\t\t\t\tif valMap, ok := val.(map[string]interface{}); ok {\n\t\t\t\t\tm = valMap\n\t\t\t\t} else if valSlice, ok := val.([]interface{}); ok {\n\t\t\t\t\tm = valSlice\n\t\t\t\t} else {\n\t\t\t\t\treturn fmt.Errorf(\"value cannot be set because %v is not a map[string]interface{} or a slice []interface{}\", JSONPath(fields[:i+1]))\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tnewVal := make(map[string]interface{})\n\t\t\t\tmMap[field] = newVal\n\t\t\t\tm = newVal\n\t\t\t}\n\t\t} else if mSlice, ok := m.([]interface{}); ok {\n\t\t\tsliceInd, err := strconv.Atoi(field)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"value cannot be set to the slice path %v because field %v is not integer\", JSONPath(fields[:i+1]), field)\n\t\t\t}\n\t\t\tif sliceInd < len(mSlice) {\n\t\t\t\tm = mSlice[sliceInd]\n\t\t\t} else if sliceInd == len(mSlice) {\n\t\t\t\tmSlice = append(mSlice, make(map[string]interface{}))\n\t\t\t\tm = mSlice[len(mSlice)-1]\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"value cannot be set to the slice path %v because index %v exceeds the slice length %v\", JSONPath(fields[:i+1]), field, len(mSlice))\n\t\t\t}\n\n\t\t} else {\n\t\t\treturn fmt.Errorf(\"value cannot be set because %v is not a map[string]interface{} or a slice []interface{}\", JSONPath(fields[:i+1]))\n\t\t}\n\t}\n\tlastField := fields[len(fields)-1]\n\tif mMap, ok := m.(map[string]interface{}); ok {\n\t\tmMap[lastField] = value\n\t} else if mSlice, ok := m.([]interface{}); ok {\n\t\tsliceInd, err := strconv.Atoi(lastField)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"value cannot be set to the slice because last field %v in path %v is not integer\", lastField, fields)\n\t\t}\n\t\tmSlice[sliceInd] = value\n\t} else {\n\t\treturn fmt.Errorf(\"value cannot be set because %v is not a map[string]interface{} or a slice []interface{}\", JSONPath(fields))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3ccc59c95fa0e3550176b7feb5997230", "score": "0.42043245", "text": "func vLogger(level int, values ...interface{}) {\n\tif level < logLevel {\n\t\ti := 1\n\t\tm := make(map[string]interface{})\n\t\tfor i < (len(values)) {\n\t\t\tkeyString := fmt.Sprintf(\"%v\", values[i-1])\n\t\t\tm[keyString] = values[i]\n\t\t\ti = i + 2\n\t\t}\n\n\t\tm[\"logLevel\"] = level\n\t\t// if the log message map fails marshell into JSON print the error and the raw map\n\t\tjsonLog, err := json.Marshal(m)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(&buf, \"Err:%v, %s\\n\", err, m)\n\t\t} else {\n\t\t\tfmt.Fprintf(&buf, \"%s\\n\", jsonLog)\n\t\t}\n\n\t}\n}", "title": "" }, { "docid": "d00530702a6a8c9134bae37c2ac5c300", "score": "0.41992372", "text": "func SetMeta(data map[string]interface{}) {\n\tlogr = logr.With(data)\n}", "title": "" }, { "docid": "714065a00d2cda8a6ed45ce9948bb1cc", "score": "0.4198818", "text": "func (k2h *K2hash) Set(k interface{}, v interface{}, options ...func(*K2hashParams)) (bool, error) {\n\t// 1. binary or text\n\tvar key string\n\tvar val string\n\tswitch k.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", k)\n\tcase string:\n\t\tkey = k.(string)\n\t}\n\tswitch v.(type) {\n\tdefault:\n\t\treturn false, fmt.Errorf(\"unsupported key data format %T\", v)\n\tcase string:\n\t\tval = v.(string)\n\t}\n\tfmt.Printf(\"key %v val %v\\n\", key, val)\n\n\t// 2. set params\n\tparams := K2hashParams{\n\t\tpassword: \"\",\n\t\texpirationDuration: 0,\n\t}\n\n\tfor _, option := range options {\n\t\toption(&params)\n\t}\n\n\t// 3. Sets a text(string) type variable and retrives it by using k2h_get_str_value_wp and k2h_set_str_value_wa\n\tcKey := C.CString(key)\n\tdefer C.free(unsafe.Pointer(cKey))\n\tcVal := C.CString(val)\n\tdefer C.free(unsafe.Pointer(cVal))\n\tcPass := C.CString(params.password)\n\tdefer C.free(unsafe.Pointer(cPass))\n\tvar expire *C.time_t\n\t// WARNING: You can't set zero expire.\n\tif params.expirationDuration != 0 {\n\t\texpire = (*C.time_t)(&params.expirationDuration)\n\t}\n\tok := C.k2h_set_str_value_wa(k2h.handle, (*C.char)(cKey), (*C.char)(cVal), cPass, expire)\n\tfmt.Printf(\"ok %v\\n\", ok)\n\tif ok != true {\n\t\treturn false, fmt.Errorf(\"C.k2h_set_str_value_wa return false\")\n\t}\n\treturn true, nil\n}", "title": "" }, { "docid": "75f9f0b6cd8af9d45cb760c7b18379d2", "score": "0.4197392", "text": "func (service *service) setKeyValue(key string, value interface{}, howLong time.Duration) error {\n\treturn service.client.Set(key, value, howLong).Err()\n}", "title": "" }, { "docid": "3b4df2a0375652538c6c4e202fb6a74c", "score": "0.41935027", "text": "func (l *TestLog) Info(msg string, kv ...KV) {\n\tl.lastMsg = msg\n\tl.lastKV = kv\n}", "title": "" } ]
d4f453489be7f93410fc7e47e63ef1a2
Less returns true iff hash a is less than hash b
[ { "docid": "252da218dcd901acdee4a7c4b18e0940", "score": "0.83421755", "text": "func Less(a *Hash, b *Hash) bool {\n\treturn a.Cmp(b) < 0\n}", "title": "" } ]
[ { "docid": "1c0f19d31657b04823e652c3d40e9040", "score": "0.7782647", "text": "func (t list) Less(a, b int) bool {\n\treturn t[a].hash < t[b].hash\n}", "title": "" }, { "docid": "3524dd00bc11b8d1b01571096dbb13ec", "score": "0.7065535", "text": "func (p *Ptr) Less(q *Ptr) bool {\n\tfor i := 0; i < 20; i++ {\n\t\tif q.hash[i] < p.hash[i] {\n\t\t\treturn true\n\t\t}\n\t\tif q.hash[i] != p.hash[i] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "930f26c6853ebdc55b653394f69ffb1c", "score": "0.69854516", "text": "func less(a, b map[string]string) bool {\n\tvar aKeys, bKeys sort.StringSlice\n\tfor k := range a {\n\t\taKeys = append(aKeys, k)\n\t}\n\tfor k := range b {\n\t\tbKeys = append(bKeys, k)\n\t}\n\taKeys.Sort()\n\tbKeys.Sort()\n\tfor i := 0; i < int(math.Min(float64(len(aKeys)), float64(len(bKeys)))); i++ {\n\t\tif aKeys[i] != bKeys[i] {\n\t\t\treturn aKeys[i] < bKeys[i]\n\t\t}\n\n\t\tva := a[aKeys[i]]\n\t\tvb := b[bKeys[i]]\n\t\tif va == vb {\n\t\t\tcontinue\n\t\t}\n\t\treturn va < vb\n\t}\n\treturn len(aKeys) < len(bKeys)\n}", "title": "" }, { "docid": "930f26c6853ebdc55b653394f69ffb1c", "score": "0.69854516", "text": "func less(a, b map[string]string) bool {\n\tvar aKeys, bKeys sort.StringSlice\n\tfor k := range a {\n\t\taKeys = append(aKeys, k)\n\t}\n\tfor k := range b {\n\t\tbKeys = append(bKeys, k)\n\t}\n\taKeys.Sort()\n\tbKeys.Sort()\n\tfor i := 0; i < int(math.Min(float64(len(aKeys)), float64(len(bKeys)))); i++ {\n\t\tif aKeys[i] != bKeys[i] {\n\t\t\treturn aKeys[i] < bKeys[i]\n\t\t}\n\n\t\tva := a[aKeys[i]]\n\t\tvb := b[bKeys[i]]\n\t\tif va == vb {\n\t\t\tcontinue\n\t\t}\n\t\treturn va < vb\n\t}\n\treturn len(aKeys) < len(bKeys)\n}", "title": "" }, { "docid": "a23bfeb7effb7e372cea290946e46099", "score": "0.6948674", "text": "func (h NuodbHealth) Less(other NuodbHealth) bool {\n\tl := nuodbHealthOrder[h]\n\tr := nuodbHealthOrder[other]\n\t// 0 is not found/unknown and less is not defined for that\n\treturn l != 0 && r != 0 && l < r\n}", "title": "" }, { "docid": "fb42efcc96ae7bce5d72d9ca30a4540d", "score": "0.69009906", "text": "func (s blockSorter) Less(i, j int) bool {\n\treturn s[i].hash.String() < s[j].hash.String()\n}", "title": "" }, { "docid": "9df4a23f6528bfc408bdcb9b76179fb8", "score": "0.682842", "text": "func (h *FibHeap) less(n1, n2 *FibHeapElement) bool {\n\tif n1 == nil && n2 == nil {\n\t\tpanic(\"both nodes are nil!\")\n\t} else if n1 == nil {\n\t\treturn false\n\t} else if n2 == nil {\n\t\treturn true\n\t}\n\treturn h.mixin.LessKey(n1.Key, n2.Key)\n}", "title": "" }, { "docid": "1589403dfebf061719e1461c9ab11344", "score": "0.67680454", "text": "func (x hashArray) Less(i, j int) bool { return x[i] < x[j] }", "title": "" }, { "docid": "f77d7857eaf0be0bcc0e3333bc88f731", "score": "0.6649693", "text": "func (r Ref) Less(o Ref) bool {\n\t// must sort in same order as if sorted on string representation\n\tif r.schema != o.schema {\n\t\treturn r.schema\n\t}\n\treturn bytes.Compare(r.hash[:], o.hash[:]) < 0\n}", "title": "" }, { "docid": "9800898e9974d601fe5f3a1c41a6d755", "score": "0.66336864", "text": "func (c ByteCompare) IsLess(lhs, rhs byte) bool { return c(lhs, rhs) }", "title": "" }, { "docid": "6545d2b4e7d0343d2973dbd30f6b10d1", "score": "0.6601281", "text": "func HashLT(v string) predicate.Question {\n\treturn predicate.Question(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldHash), v))\n\t})\n}", "title": "" }, { "docid": "92ef1687d288c530d73579059cae1eff", "score": "0.6596526", "text": "func (a ByKey) Less(i, j int) bool { return bytes.Compare(a[i].Key, a[j].Key) == -1 }", "title": "" }, { "docid": "59617d71c298e944488096b2cecfb839", "score": "0.6575976", "text": "func (n Nodes) Less(i, j int) bool {\n\treturn n[i].HashID < n[j].HashID\n}", "title": "" }, { "docid": "590c5a59998b3455be34d7613e37fb14", "score": "0.655696", "text": "func (a HexCoord) Less(b HexCoord) bool {\n\t// c < x\n\tif a.X < b.X {\n\t\treturn true\n\t}\n\tif a.X > b.X {\n\t\treturn false\n\t}\n\tif a.Y < b.Y {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "6c2fc4521198af1d4fba58a99dcb3ea5", "score": "0.64683765", "text": "func Less(a float64, b float64) bool {\n\treturn a < b\n}", "title": "" }, { "docid": "5325474fe5d7c7c2c2036a2817b206f2", "score": "0.64637136", "text": "func (b1 ball) lt(b2 ball) bool {\n\treturn b1.color < b2.color\n}", "title": "" }, { "docid": "81d62f9a1afbb2133439c1372e9bdcc5", "score": "0.6424761", "text": "func (a StoreAttributes) Less(b gossip.Ordered) bool {\n\treturn a.Capacity.PercentAvail() < b.(StoreAttributes).Capacity.PercentAvail()\n}", "title": "" }, { "docid": "81d62f9a1afbb2133439c1372e9bdcc5", "score": "0.6424761", "text": "func (a StoreAttributes) Less(b gossip.Ordered) bool {\n\treturn a.Capacity.PercentAvail() < b.(StoreAttributes).Capacity.PercentAvail()\n}", "title": "" }, { "docid": "3ff388f604aa7dece5c352c416079600", "score": "0.6316531", "text": "func (mh mapHeap) less(i, j int) bool {\n\tif mh.minHeap {\n\t\treturn mh.data[i].set.averageFee.Cmp(mh.data[j].set.averageFee) == -1\n\t}\n\treturn mh.data[i].set.averageFee.Cmp(mh.data[j].set.averageFee) == 1\n}", "title": "" }, { "docid": "3290aaae1a043c34691a054f7a16a869", "score": "0.6277516", "text": "func (e Decimal128) Less(r Object) (Boolean, error) {\n\treturn e.compareTypes(r, func(left, right decimal128.Num) Boolean {\n\t\treturn Boolean(left.HighBits() < right.HighBits() || (left.HighBits() == right.HighBits() && left.LowBits() < right.LowBits()))\n\t})\n}", "title": "" }, { "docid": "b59557c051496ea175a703e09935d3d2", "score": "0.6239339", "text": "func HashLT(v string) predicate.Revision {\n\treturn predicate.Revision(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldHash), v))\n\t})\n}", "title": "" }, { "docid": "79314f43026415327f6eb45a3158248a", "score": "0.6219362", "text": "func (id SerialNumber) Less(other SerialNumber) bool {\n\tfor k, v := range id {\n\t\tif v < other[k] {\n\t\t\treturn true\n\t\t} else if v > other[k] {\n\t\t\treturn false\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "44c92f188779a7482561c4a498b71503", "score": "0.6172499", "text": "func (txns SortableTransactions) Less(i, j int) bool {\n\tif txns.Fees[i] == txns.Fees[j] {\n\t\t// If fees match, hashes are sorted ascending\n\t\treturn bytes.Compare(txns.Hashes[i][:], txns.Hashes[j][:]) < 0\n\t}\n\t// Fees are sorted descending\n\treturn txns.Fees[i] > txns.Fees[j]\n}", "title": "" }, { "docid": "41059ae81407ee77579c31a1c607b98e", "score": "0.61514044", "text": "func (e *Elt) Less(o *Elt) bool {\n\tka := e.cmpKey()\n\tkb := o.cmpKey()\n\treturn ka < kb\n}", "title": "" }, { "docid": "5f16e66993b1e8f9e9a7a6661708bb2c", "score": "0.6111231", "text": "func (bn ByNet) Less(a, b int) bool {\n\tval := CompareNets(bn[a], bn[b])\n\tif val == -1 {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "66719f8b0ba53cceb6e95cf5dd89be74", "score": "0.6091776", "text": "func (b Benches) Less(i, j int) bool {\n\tif b[i].Ops < b[j].Ops {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d4cc64b271b09346554fa9855e5b0ad3", "score": "0.60729575", "text": "func Less(a Clock, b Clock) bool {\n\treturn Compare(a, b) > 0\n}", "title": "" }, { "docid": "ff85f2bbb8bc2154ec3a1148bd1fd64a", "score": "0.60492754", "text": "func (s byKey) Less(i, j int) bool {\n\tvar (\n\t\tiKey = s.Files[i].Key()\n\t\tjKey = s.Files[j].Key()\n\t)\n\n\tif s.isAscending {\n\t\treturn iKey < jKey\n\t}\n\treturn iKey >= jKey\n}", "title": "" }, { "docid": "6bfa4746dabaeb426ad526c12e5913c0", "score": "0.6049074", "text": "func (l EntryList) Less(i, j int) bool { return l[i].Key < l[j].Key }", "title": "" }, { "docid": "7af899ebe952953b5d9ff1e86e0971e4", "score": "0.60364884", "text": "func (c PackVersions) Less(a, b int) bool {\n\t// Failed parse pushes to the back.\n\ti, err := semver.NewVersion(c[a].Version)\n\tif err != nil {\n\t\treturn true\n\t}\n\tj, err := semver.NewVersion(c[b].Version)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn i.LessThan(j)\n}", "title": "" }, { "docid": "16d562952ab8fb83045226e90f8cf095", "score": "0.60121953", "text": "func (o ops) Less(i, j int) bool {\n\tfpi := o[i].Fingerprint()\n\tfpj := o[j].Fingerprint()\n\tif fpi.Equal(fpj) {\n\t\treturn currentTimeSort{o}.Less(i, j)\n\t}\n\treturn fpi.Less(fpj)\n}", "title": "" }, { "docid": "67e98b7aed461e8efc553fcd44244f2c", "score": "0.59980756", "text": "func LessThan(a, b int) bool { return a < b }", "title": "" }, { "docid": "aeca49bfac40c8eb1c7a500eb7ef78a0", "score": "0.5992229", "text": "func (keys *myKeys) Less(i, j int) bool {\n\treturn keys.compareFunc(keys.container[i], keys.container[j]) == -1\n}", "title": "" }, { "docid": "fbaaca5ae3415b9972f9ca980d901d7d", "score": "0.5986926", "text": "func (a Uint64s) Less(i, j int) bool {\n\treturn a[i] < a[j]\n}", "title": "" }, { "docid": "b45f9ca248572a0ea1954e47598d0878", "score": "0.5976842", "text": "func LessEqual(a float64, b float64) bool {\n\treturn a <= b\n}", "title": "" }, { "docid": "9dc3039cd7779fe720add33634637151", "score": "0.59067154", "text": "func ExpLess(left *FilterExpression, right *FilterExpression) *FilterExpression {\n\treturn &FilterExpression{\n\t\tcmd: &expOpLT,\n\t\tval: nil,\n\t\tbin: nil,\n\t\tflags: nil,\n\t\tmodule: nil,\n\t\texps: []*FilterExpression{left, right},\n\t\targuments: nil,\n\t}\n}", "title": "" }, { "docid": "ec19e42845b2e81b3d297d14571dd9aa", "score": "0.59039044", "text": "func (x MyItem) Less(than rbtree.Item) bool {\n\treturn x.key < (than.(MyItem).key)\n}", "title": "" }, { "docid": "df5d45ae14c945905f36d8cf114bd762", "score": "0.5896841", "text": "func (e *Element) LessThan(dd *Element) bool {\n\treturn lessthan(e.Key, dd.Key)\n}", "title": "" }, { "docid": "ef9a8368c29f791cf8426740f0f95795", "score": "0.58908594", "text": "func (p *MP) lessThan(b MP) bool {\n\treturn p.value < b.value\n}", "title": "" }, { "docid": "f1c636ba8b7213814f519800e82edbfd", "score": "0.5870216", "text": "func (utxo UTXO) Less(other UTXO) bool {\n\tif utxo.Locktime < other.Locktime {\n\t\treturn true\n\t} else if utxo.Locktime > other.Locktime {\n\t\treturn false\n\t}\n\n\tif utxo.Amount < other.Amount {\n\t\treturn true\n\t} else if utxo.Amount > other.Amount {\n\t\treturn false\n\t}\n\n\tutxoAddr, err := bech32ToID(utxo.Address)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\totherAddr, err := bech32ToID(other.Address)\n\tif err != nil {\n\t\treturn false\n\t}\n\n\treturn utxoAddr.Less(otherAddr)\n}", "title": "" }, { "docid": "f64b4c9e5b504d8c86290a051768181f", "score": "0.5866548", "text": "func (m *MinHash) LessCardinality(m2 Interface) int {\n\treturn LessCardinality(m, m2)\n}", "title": "" }, { "docid": "e28351455d665255999e44d24ec71421", "score": "0.58488053", "text": "func isLessThan(x, y []byte) bool {\n\ti := len(x) - 1\n\tfor i > 0 && x[i] == y[i] {\n\t\ti--\n\t}\n\treturn x[i] < y[i]\n}", "title": "" }, { "docid": "f09465d034f92c125268c634783a2f87", "score": "0.5848336", "text": "func hash_distance(hash1 []byte, hash2 []byte) (distance int) {\n\tfor index, value := range hash1 {\n\t\tif value != hash2[index] {\n\t\t\tdistance = index * 8\n\t\t\treturn\n\t\t}\n\t}\n\tdistance = len(hash1) * 8\n\treturn\n}", "title": "" }, { "docid": "e05e3189c49a01d3ce969ca0428fcabe", "score": "0.58417046", "text": "func (k bkeyLess) Less(item btree.Item) bool {\n\tcmp := item.(keyer).Key()\n\treturn bytes.Compare(k.key, cmp) <= 0\n}", "title": "" }, { "docid": "0cd43a7127494ea84ba28bd706b132b4", "score": "0.5840976", "text": "func (kademliaID KademliaID) Less(otherKademliaID *KademliaID) bool {\n\tfor i := 0; i < IDLength; i++ {\n\t\tif kademliaID[i] != otherKademliaID[i] {\n\t\t\treturn kademliaID[i] < otherKademliaID[i]\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "363540a62a3cd1b6dde30b173802b91a", "score": "0.5840249", "text": "func (hh HistoryHeap) Less(i, j int) bool { return true }", "title": "" }, { "docid": "a66b910ea326f1bcc98eb14105c1d443", "score": "0.5815857", "text": "func (h MinHeap) Less(i, j int) bool {\n\treturn h[i].count < h[j].count\n}", "title": "" }, { "docid": "5d0e079bd63ff93e0b075dc6b9111a18", "score": "0.581243", "text": "func (ac accumComparable) Less(o interface{}) bool {\n\tother := o.(accumComparable).Validator\n\tlarger := ac.CompareAccum(other)\n\treturn bytes.Equal(larger.Address, ac.Address)\n}", "title": "" }, { "docid": "54ce79f25fc43a1d395024d44cb6d0cd", "score": "0.5800284", "text": "func (c AppVersions) Less(a, b int) bool {\n\t// Failed parse pushes to the back.\n\taVersion := c[a]\n\tbVersion := c[b]\n\ti, err := semver.NewVersion(aVersion.GetSemver())\n\tif err != nil {\n\t\treturn true\n\t}\n\tj, err := semver.NewVersion(bVersion.GetSemver())\n\tif err != nil {\n\t\treturn false\n\t}\n\tif i.Equal(j) {\n\t\treturn aVersion.CreateTime.Before(bVersion.CreateTime)\n\t}\n\treturn i.LessThan(j)\n}", "title": "" }, { "docid": "ca73b4a5490e1e698e85bd8cf2fda436", "score": "0.5799321", "text": "func LessTxID(a *TxID, b *TxID) bool {\n\treturn Less((*Hash)(a), (*Hash)(b))\n}", "title": "" }, { "docid": "ee4d233a104fc2911d33bd5cf104f309", "score": "0.5793207", "text": "func (r *rangeProperty) Less(than btree.Item) bool {\n\tta := than.(*rangeProperty)\n\treturn bytes.Compare(r.Key, ta.Key) < 0\n}", "title": "" }, { "docid": "0063b5293809531e8715547df175af3f", "score": "0.57910424", "text": "func Tlt(a, b T) bool { return a < b }", "title": "" }, { "docid": "906b0eccb5ac03507a9f910d6c33f390", "score": "0.57883286", "text": "func (tid *TenantID) less(a *TenantID) bool {\n\tif tid.AccountID != a.AccountID {\n\t\treturn tid.AccountID < a.AccountID\n\t}\n\treturn tid.ProjectID < a.ProjectID\n}", "title": "" }, { "docid": "73c85725e3d020b2e4d5715828f412c3", "score": "0.5770912", "text": "func (s *StatsToUpdate) lt(other *StatsToUpdate) bool {\n\tif s.ProjectId < other.ProjectId {\n\t\treturn true\n\t} else if s.ProjectId == other.ProjectId {\n\t\tif s.Hour.UnixNano() < other.Hour.UnixNano() {\n\t\t\treturn true\n\t\t} else if s.Hour.UnixNano() == other.Hour.UnixNano() {\n\t\t\tif s.Requester < other.Requester {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t}\n\treturn false\n}", "title": "" }, { "docid": "3437a751fb1f6eb8c9bd51da98a3574f", "score": "0.57686603", "text": "func (sh *sortHeap) Less(i, j int) bool {\n\tfor _, c := range sh.comparers {\n\t\tif sh.err != nil {\n\t\t\treturn true\n\t\t}\n\t\tcmp, err := c.compare(sh.rows[i], sh.rows[j])\n\t\tif err != nil {\n\t\t\tsh.err = err\n\t\t\treturn true\n\t\t}\n\t\tif cmp == 0 {\n\t\t\tcontinue\n\t\t}\n\t\tif sh.reverse {\n\t\t\tcmp = -cmp\n\t\t}\n\t\treturn cmp < 0\n\t}\n\treturn true\n}", "title": "" }, { "docid": "b55079a0c61e7675fcd7f2cd79d92f8d", "score": "0.5765321", "text": "func (hds Heads) Less(i int, j int) bool {\n\treturn hds[i].X() < hds[j].X() || (hds[i].X() == hds[j].X() &&\n\t\thds[i].Y() < hds[j].Y())\n}", "title": "" }, { "docid": "17fc61e20866da0a301e26918d0a697a", "score": "0.57552946", "text": "func (s SortKey) Less(i, j int) bool {\n\treturn s[i] < s[j]\n}", "title": "" }, { "docid": "d339f6294025fd8f59b5ff53f55f6648", "score": "0.5738506", "text": "func (e Uint64) Less(r Object) (Boolean, error) {\n\treturn e.compareTypes(r, func(left, right uint64) Boolean {\n\t\treturn Boolean(left < right)\n\t})\n}", "title": "" }, { "docid": "9cab3dcc853d7e4d134eb9c19dddf420", "score": "0.57380205", "text": "func (a KeyValues) Less(i, j int) bool {\n\tki, kj := a[i].Key, a[j].Key\n\tif ki == kj {\n\t\treturn a[i].Value < a[j].Value\n\t}\n\treturn ki < kj\n}", "title": "" }, { "docid": "05d9f3a3449badc34f32d1adcca6a03b", "score": "0.5735201", "text": "func CompareHash(hash, key, in []byte) bool {\n\tmatched := 0\n\n\tin_hash, err := Hmac(key, in)\n\tif err != nil {\n\t\tin_hash = make([]byte, len(hash))\n\t} else if len(hash) < len(in_hash) {\n\t\textend := make([]byte, HashLen-len(hash))\n\t\thash = append(hash, extend...)\n\t}\n\n\tfor i := 0; i < HashLen; i++ {\n\t\tmatched += subtle.ConstantTimeByteEq(hash[i], in_hash[i])\n\t}\n\n\treturn matched == HashLen\n}", "title": "" }, { "docid": "7e6ca3ce20c83c8b1ee0ca44e6a2886a", "score": "0.5712018", "text": "func (e Uint32) Less(r Object) (Boolean, error) {\n\treturn e.compareTypes(r, func(left, right uint32) Boolean {\n\t\treturn Boolean(left < right)\n\t})\n}", "title": "" }, { "docid": "327f044f65b81ef08765ad69eb93292f", "score": "0.57109725", "text": "func (u UserList) Less(i, j int) bool {\n\treturn u[i].ETHVolume < u[j].ETHVolume\n}", "title": "" }, { "docid": "fcc8a0285640d174785d224a1f222bed", "score": "0.5709822", "text": "func (a Int) Less(b Item) bool {\n\treturn a < b.(Int)\n}", "title": "" }, { "docid": "fcc8a0285640d174785d224a1f222bed", "score": "0.5709822", "text": "func (a Int) Less(b Item) bool {\n\treturn a < b.(Int)\n}", "title": "" }, { "docid": "fbbf0d6b1e7e5c103dbae99e31e00d54", "score": "0.5707227", "text": "func (a Protocol) LT(b Protocol) bool {\n\treturn a.Major < b.Major ||\n\t\t(a.Major == b.Major && a.Minor < b.Minor)\n}", "title": "" }, { "docid": "d8e91cc304c5136e14362d5fa912af51", "score": "0.57054156", "text": "func (e *Edge) Less(other Edge) bool {\n\treturn e.weight < other.weight\n}", "title": "" }, { "docid": "b4b995e526639b132847238591c898ce", "score": "0.57025236", "text": "func (p1 Price) Less(p2 Price) (bool, error) {\n\tleft, err := p1.float()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\tright, err := p2.float()\n\tif err != nil {\n\t\treturn false, err\n\t}\n\treturn left < right, nil\n}", "title": "" }, { "docid": "8832cc98c1410faba9096733c1f2fba8", "score": "0.5698807", "text": "func (sh streamHeap) Less(i, j int) bool { return sh[i].lastAccess.Before(sh[j].lastAccess) }", "title": "" }, { "docid": "e888b8000d4cf54fcd83a9da58392ac3", "score": "0.5698175", "text": "func (e EdgeQueryResult) Less(other EdgeQueryResult) bool {\n\tif e.distance.less(other.distance) {\n\t\treturn true\n\t}\n\tif other.distance.less(e.distance) {\n\t\treturn false\n\t}\n\tif e.shapeID < other.shapeID {\n\t\treturn true\n\t}\n\tif other.shapeID < e.shapeID {\n\t\treturn false\n\t}\n\treturn e.edgeID < other.edgeID\n}", "title": "" }, { "docid": "7f95681fe94b7ea48181827e3fa25c44", "score": "0.56871355", "text": "func (this *InstanceKey) SmallerThan(other *InstanceKey) bool {\n\tif this.Hostname < other.Hostname {\n\t\treturn true\n\t}\n\tif this.Hostname == other.Hostname && this.Port < other.Port {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "fb8a0cb35982ff5eb58db5f9392de65d", "score": "0.5686312", "text": "func (h countHeap) Less(i, j int) bool { return h[i].count < h[j].count }", "title": "" }, { "docid": "d83949487d284fdcdd112977c61a63d2", "score": "0.5679537", "text": "func (h LogIteratorHeap) Less(i, j int) bool {\n\tif h.min {\n\t\treturn h.its[i].Item().Timestamp.Before(h.its[j].Item().Timestamp)\n\t} else {\n\t\treturn h.its[i].Item().Timestamp.After(h.its[j].Item().Timestamp)\n\t}\n}", "title": "" }, { "docid": "27df37ae32e7aec8b6ad2d80c3196616", "score": "0.5667656", "text": "func (stat *HotPeerStat) Less(dim int, than utils.TopNItem) bool {\n\treturn stat.GetLoad(dim) < than.(*HotPeerStat).GetLoad(dim)\n}", "title": "" }, { "docid": "b2fb2e4a8ce3348054d2a08d54988bb7", "score": "0.56593", "text": "func (s scoreSorter) Less(a, b int) bool {\n\tfirst := s[a]\n\tsecond := s[b]\n\n\tif first.Score > second.Score {\n\t\treturn false\n\t}\n\tif first.Score < second.Score {\n\t\treturn true\n\t}\n\tif first.Name == second.Name {\n\t\tv1, err := semver.NewVersion(first.Chart.Version)\n\t\tif err != nil {\n\t\t\treturn true\n\t\t}\n\t\tv2, err := semver.NewVersion(second.Chart.Version)\n\t\tif err != nil {\n\t\t\treturn true\n\t\t}\n\t\t// Sort so that the newest chart is higher than the oldest chart. This is\n\t\t// the opposite of what you'd expect in a function called Less.\n\t\treturn v1.GreaterThan(v2)\n\t}\n\treturn first.Name < second.Name\n}", "title": "" }, { "docid": "b768ce4dc46b3a567bc766b3fb04bb0f", "score": "0.56556857", "text": "func LessEq(a, b Value) bool {\n\treturn a.Less(b) || (!a.Less(b) && !b.Less(a))\n}", "title": "" }, { "docid": "31b0dd31ed005f082df37c351d409094", "score": "0.5653564", "text": "func (c ByteEnumCompare) IsLess(nLHS int, lhs byte, nRHS int, rhs byte) bool {\n\treturn c(nLHS, lhs, nRHS, rhs)\n}", "title": "" }, { "docid": "b6c436032887d1902b14e392a5c8a065", "score": "0.56448483", "text": "func HashLTE(v string) predicate.Question {\n\treturn predicate.Question(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldHash), v))\n\t})\n}", "title": "" }, { "docid": "7b93e3c523778240f97159e8d357d824", "score": "0.56437856", "text": "func (c *confirmationHeap) Less(i, j int) bool {\n\treturn c.items[i].triggerHeight < c.items[j].triggerHeight\n}", "title": "" }, { "docid": "882faaf744e52bc473826cc3fad17f35", "score": "0.5634587", "text": "func (s *scanner) Less(i, j int) bool {\n\tci, cj := s.heap[i], s.heap[j]\n\tif ri, rj := ci.readyCalls > 0, cj.readyCalls > 0; ri != rj {\n\t\treturn ri\n\t}\n\t// TODO: Consider API graph, try to satisfy dependencies\n\treturn ci.totalCalls < cj.totalCalls\n}", "title": "" }, { "docid": "cf8edf4df8be181ef8e2bba6ff8b8a07", "score": "0.56296337", "text": "func (pool Pool) Less(i, j int) bool {\n\treturn pool[i].pending < pool[j].pending\n}", "title": "" }, { "docid": "8aec52c64b11787b4107e70ec1c4f676", "score": "0.56287766", "text": "func Compare(hash, unhashed []byte) bool {\n\terr := bcrypt.CompareHashAndPassword(hash, unhashed)\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn true\n}", "title": "" }, { "docid": "29bde42af9058c496deff56053c5d13a", "score": "0.5616784", "text": "func (s sortableByKey) Less(i, j int) bool {\n\tvalues := map[int]string{i: \"\", j: \"\"}\n\tfor k := range values {\n\t\tif v := reflect.ValueOf(deepGet(s.data[k], s.key)); v.Kind() != reflect.Invalid {\n\t\t\tvalues[k] = v.Interface().(string)\n\t\t}\n\t}\n\treturn values[i] < values[j]\n}", "title": "" }, { "docid": "8f15e3d3ba0dc162f9399c7fead86400", "score": "0.56013125", "text": "func less(s1, s2 Sizer) Sizer {\n\tif s1.Area() < s2.Area() {\n\t\treturn s1\n\t}\n\treturn s2\n}", "title": "" }, { "docid": "bbb4b78817d355fd6c8d96acde2634f9", "score": "0.5599981", "text": "func (k bkey) Less(item btree.Item) bool {\n\tcmp := item.(keyer).Key()\n\treturn bytes.Compare(k.key, cmp) < 0\n}", "title": "" }, { "docid": "69399cfb44918b3e6328b0d7b5a6a46d", "score": "0.55986345", "text": "func (su *SortUser) Less(i, j int) bool {\r\n\t// TODO: Implement Less function.\r\n\treturn su.Followers[su.Keys[i]] > su.Followers[su.Keys[j]]\r\n}", "title": "" }, { "docid": "2ac546cc845d6dec4f8735791ea49e96", "score": "0.55964863", "text": "func (s VectorClock) LessThan(otherClock VectorClock) bool {\n\tfor nodeID, version := range s.countMap{\n\t\tif version > otherClock.countMap[nodeID]{\n\t\t\treturn false\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "ca5925445dd48dd3c3c93fed254c22be", "score": "0.55870354", "text": "func (r *Entry) Less(other *Entry) bool {\n\tleft := r.Priority\n\tright := other.Priority\n\treturn left > right\n}", "title": "" }, { "docid": "1532a596386a53679716dec2f31b3380", "score": "0.55823755", "text": "func (a Tuid) Before(b Tuid) bool {\n if a.t < b.t {\n return true\n }\n if a.t > b.t {\n return false\n }\n if a.msb < b.msb {\n return true\n }\n if a.msb > b.msb {\n return false\n }\n if a.lsb < b.lsb {\n return true\n }\n return false\n}", "title": "" }, { "docid": "045b4a611d013e30bab653388b83deed", "score": "0.55808854", "text": "func (ss Symbols) Less(i, j int) bool {\n\treturn ss[i] < ss[j]\n}", "title": "" }, { "docid": "89858cb86f466dc367409239765d3222", "score": "0.55720985", "text": "func (c VersionInterfaces) Less(a, b int) bool {\n\t// Failed parse pushes to the back.\n\ti, err := semver.NewVersion(c[a].GetVersion())\n\tif err != nil {\n\t\treturn true\n\t}\n\tj, err := semver.NewVersion(c[b].GetVersion())\n\tif err != nil {\n\t\treturn false\n\t}\n\treturn i.LessThan(j)\n}", "title": "" }, { "docid": "1e433dae191d27930c056bb1d8fc2a88", "score": "0.5571164", "text": "func (e *Event) Less(o *Event) bool {\n\treturn e.expire.Before(o.expire)\n}", "title": "" }, { "docid": "48a79dec71ce5b892cdb79e287d58a7a", "score": "0.5569873", "text": "func (s *States) Less(i, j int) bool {\n\treturn (*s)[i].uniformCost+(*s)[i].heuristicCost < (*s)[j].uniformCost+(*s)[j].heuristicCost\n}", "title": "" }, { "docid": "960c1bb91d3e7d86799952be39aab677", "score": "0.55579716", "text": "func (p *prefixItem) Less(iother btree.Item) bool {\n\tother := iother.(*item)\n\treturn !bytes.HasPrefix(other.Key, p.prefix)\n}", "title": "" }, { "docid": "8a713a237a3fe0342cc11d985615849f", "score": "0.5545455", "text": "func (l GroupList) Less(a, b int) bool {\n\treturn l[a].Name < l[b].Name\n}", "title": "" }, { "docid": "b69614c4c018f6c0318d7367a033fd33", "score": "0.5542013", "text": "func (a filesBySize) Less(i, j int) bool {\n\treturn a.Files[i].Size() < a.Files[j].Size()\n}", "title": "" }, { "docid": "3655197f1604b5a5dd4bbb51230d77f4", "score": "0.5529964", "text": "func (l sortLines) Less(i, j int) bool { return bytes.Compare(l[i], l[j]) > 0 }", "title": "" }, { "docid": "66549244e6633241fcdffbb0e0c9f5ef", "score": "0.5509484", "text": "func (e Time32) Less(r Object) (Boolean, error) {\n\treturn e.compareTypes(r, func(left, right arrow.Time32) Boolean {\n\t\treturn Boolean(left < right)\n\t})\n}", "title": "" }, { "docid": "b2e1bacf45777819f793870e62165850", "score": "0.5495826", "text": "func (b ByVersion) Less(i, j int) bool {\n\tcmp := version.CompareSimple(version.Normalize(b[i].ID), version.Normalize(b[j].ID))\n\n\tif cmp == 0 {\n\t\treturn b[i].ID < b[j].ID\n\t}\n\n\treturn cmp < 0\n}", "title": "" }, { "docid": "2bb383c85fbd17e0f3a9f40ec4a13b0b", "score": "0.5481484", "text": "func (r results) Less(i, j int) bool {\n\treturn r[i].id < r[j].id\n}", "title": "" }, { "docid": "af850b04b740f8d83722f6933c9ec8c7", "score": "0.5476881", "text": "func (h Headers) Less(i, j int) bool {\n\treturn h[i].Name() < h[j].Name()\n}", "title": "" } ]
e8147f4969d88f541e606e43372cebf7
DBConn returns a postgres connection pool.
[ { "docid": "d00028471d27f6de6f4b0f5f1e98a3a3", "score": "0.0", "text": "func DBConn() {\n\n\t//connectionString := viper.GetString(\"database_url\")\n\tvar err error\n\tdb, err = gorm.Open(\"mysql\", \"root:1234@/robi?charset=utf8&parseTime=True&loc=Local\")\n\t//defer db.Close()\n\n\tif err != nil {\n\t\tlog.Println(\"onnection Failed to Open \", err)\n\t}\n\n\tlog.Println(\"Connection Established\")\n\n\t//db.AutoMigrate(&Client{}, &Event{})\n}", "title": "" } ]
[ { "docid": "dbdca94aa0f0d368e5c8d9b08b7a090b", "score": "0.7418622", "text": "func ConnectionBDPostgreSQL() *sql.DB {\n\tvar host, dbname, user, password string\n\tvar port int\n\n\thost = Godotenv(\"host\")\n\tdbname = Godotenv(\"dbname\")\n\tport, _ = strconv.Atoi(Godotenv(\"port_banco\"))\n\tuser = Godotenv(\"user\")\n\tpassword = Godotenv(\"password\")\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", host, port, user, password, dbname)\n\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tdb.SetMaxOpenConns(50)\n\tdb.SetMaxIdleConns(25)\n\tdb.SetConnMaxLifetime(1 * time.Minute)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "177a9222451dc8582f2ba488427384f6", "score": "0.739137", "text": "func ConnectionPool(driver string, conParams map[string]interface{}) (*sqlx.DB, error) {\n\tvar (\n\t\tdb *sqlx.DB\n\t\tok bool\n\t\terr error\n\t)\n\tconnKey, err := json.Marshal(conParams)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// generate unique composit key\n\tkey := driver + string(connKey)\n\n\tconnMapMutex.Lock()\n\tdefer connMapMutex.Unlock()\n\n\t// Create connection, check if there is an existing connection\n\tif db, ok = connMap[key]; !ok {\n\t\tdb, err = Connect(driver, conParams)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb.SetMaxIdleConns(maxIdleConns)\n\t\tdb.SetConnMaxLifetime(maxConnMaxLifetime)\n\t\tconnMap[key] = db\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "787bf2493241385e6270c0c9c38db837", "score": "0.7368707", "text": "func NewPostgresPool(ctx context.Context, cfg *config.Kernel) (*sql.DB, func(), error) {\n\tdb, err := postgres.Open(ctx, cfg.DBMS.URL)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tdb.SetMaxOpenConns(50)\n\tdb.SetConnMaxLifetime(30 * time.Second)\n\tdb.SetMaxIdleConns(10)\n\n\tcleanup := func() {\n\t\t_ = db.Close()\n\t}\n\n\treturn db, cleanup, nil\n}", "title": "" }, { "docid": "549891a2b0f05d08ae6830d2092b0b28", "score": "0.72586024", "text": "func GetPostgreSQLConnection() (db *gorm.DB) {\n\tdsn := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\thost, port, user, password, dbname)\n\tdb, err := gorm.Open(\"postgres\", dsn)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "788cd1e451ac38e35c5a829d5511940e", "score": "0.72383726", "text": "func postgresConnection() *sql.DB {\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\",\n\t\thost, port, user, password, dbname)\n\t//Open the comunication with database and return a connection or a error\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "91364eab72a19c3c214f1091ebab12ec", "score": "0.723298", "text": "func newPostgresDB(connstring string, maxIdleConns, maxOpenConns int, maxIdleTime, maxOpenTime time.Duration) (db, error) {\n\tdb, err := sql.Open(\"pgx\", connstring)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdb.SetMaxIdleConns(maxIdleConns)\n\tdb.SetMaxOpenConns(maxOpenConns)\n\tdb.SetConnMaxIdleTime(maxIdleTime)\n\tdb.SetConnMaxLifetime(maxOpenTime)\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, errors.Errorf(\"failed to connect to database: %v\", err)\n\t}\n\treturn &postgresDB{\n\t\tdb: keyshare.DB{DB: db},\n\t}, nil\n}", "title": "" }, { "docid": "907969c98f5b2113f7431903c2a46d53", "score": "0.7224753", "text": "func (ts *TempSchema) ConnectionPool(params string) (*sqlx.DB, error) {\n\treturn ts.inst.Connect(ts.schemaName, params)\n}", "title": "" }, { "docid": "96bea64cb7d125317e3ccc9ee3eaa875", "score": "0.7152315", "text": "func (s *PostgreSQLStore) getConnection() (*gorm.DB, error) {\n\treturn gorm.Open(\"postgres\", s.url)\n}", "title": "" }, { "docid": "99f6a176f496a2514eb89fd3c537f29c", "score": "0.7112616", "text": "func PGconn(conf Config) (db *gorm.DB, err error) {\n\tdb, err = gorm.Open(conf.Dialect, fmt.Sprintf(configString, conf.User,\n\t\tconf.DataBaseName, conf.SSLMode, conf.Password))\n\tif err != nil {\n\t\tlogging.Log.Errorf(\"error during connection to Postgres: %s\", err.Error())\n\t\treturn nil, err\n\t}\n\tlogging.Log.Info(\"Connection to Postgres has been established\")\n\treturn db, nil\n}", "title": "" }, { "docid": "39fa0d28eeb51b7b78f36d05f814e74e", "score": "0.7082915", "text": "func NewPostgresConn(conf *PostgresConfig, log Logger) (rel.Repository, *postgres.Adapter) {\n\tdsn := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s?sslmode=disable&connect_timeout=%s\", conf.Username, conf.Password, conf.Host, conf.Port, conf.Database, conf.Timeout)\n\tadapter, err := postgres.Open(dsn)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// initialize REL's repo.\n\trepo := rel.New(adapter)\n\trepo.Instrumentation(logInstrument(log))\n\treturn repo, adapter\n}", "title": "" }, { "docid": "87d02a39409df633c0e79ed2d6e45419", "score": "0.70810956", "text": "func NewPostgresDatabase(connStr string) (database, error) {\n\tpoolConfig, err := pgxpool.ParseConfig(connStr)\n\tpoolConfig.MaxConns = 8\n\tpool, err := pgxpool.ConnectConfig(context.Background(), poolConfig)\n\tif err != nil {\n\t\tlog.Fatal(\"Unable to create connection pool\", \"error\", err)\n\t}\n\n\tstorage := database{\n\t\tDB: pool,\n\t\tSB: squirrel.StatementBuilder.PlaceholderFormat(squirrel.Dollar),\n\t}\n\treturn storage, nil\n}", "title": "" }, { "docid": "c8a5630a8cc37f7be7cf3dddbe4115f2", "score": "0.7051174", "text": "func createConnection() *pgxpool.Pool {\n\n\t// load .env file\n\terr := godotenv.Load(\".env\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading .env file\")\n\t}\n\n\tpool, err := pgxpool.Connect(context.Background(), os.Getenv(\"POSTGRES_URL\"))\n\tif err != nil {\n\t\tlog.Fatalf(\"Unable to connection to database: %v\\n\", err)\n\t}\n\n\t//fmt.Println(\"Successfully connected!\")\n\t// return the connection\n\treturn pool\n}", "title": "" }, { "docid": "756765e1b11ab518d6019db32d8a542d", "score": "0.6925714", "text": "func (db *PostgresDB) Conn() *sql.DB {\n\treturn db.conn\n}", "title": "" }, { "docid": "4f6a45e1c2ded86ee92b537eee4cfd4e", "score": "0.6916378", "text": "func Conn(service string, maxConnections int) (c *pgx.ConnPool, err error) {\n\tpoolConfig := pgx.ConnPoolConfig{\n\t\tConnConfig: connectionConfig(service),\n\t\tMaxConnections: maxConnections,\n\t}\n\treturn pgx.NewConnPool(poolConfig)\n}", "title": "" }, { "docid": "cb4c9a21d8f3dcabe5106a89461122de", "score": "0.6905105", "text": "func GetPostgres() (*pgxpool.Pool, error) {\n\n\tvar err error\n\tdb, err = pgxpool.Connect(context.Background(), \"postgresql://\"+host+\":\"+strconv.Itoa(port)+\"/\"+dbname+\"?user=\"+user+\"&password=\"+password)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinitTables()\n\n\tlog.Println(\"Established Database Connection...\")\n\treturn db, nil\n}", "title": "" }, { "docid": "fe44359fe44f7abcbc7c5fa4fd352e9e", "score": "0.68841517", "text": "func TakeConnectionFromPool_sync() refDBConnT {\n//\treturn mkDBConn()\n\tconn := Instance().connPool.Get()\n\treturn conn\n}", "title": "" }, { "docid": "3fb2326170fe9b51e768fb71e61f0ec7", "score": "0.6876916", "text": "func GetConnection() *sql.DB {\n\tcc := ConnectionCredentials{\n\t\tUSERDB: \"admin_rap\",\n\t\tPASSWORDDB: \"septimojinete\",\n\t\tHOSTDB: \"127.0.0.1\",\n\t\tPORTDB: \"5432\",\n\t\tDBNAME: \"db_rap\",\n\t}\n\n\tcc.ValidateCredentials()\n\n\tccString := fmt.Sprintf(\n\t\t\"postgres://%s:%s@%s:%s/%s?sslmode=disable\",\n\t\tcc.USERDB,\n\t\tcc.PASSWORDDB,\n\t\tcc.HOSTDB,\n\t\tcc.PORTDB,\n\t\tcc.DBNAME,\n\t)\n\n\tdb, err := sql.Open(\"postgres\", ccString)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "431d1b58bfd9251d0b4e8f4f300e28fa", "score": "0.6870166", "text": "func NewPool(conf Config) (*pgxpool.Pool, func(), error) {\n\tconnURL := url.URL{\n\t\tScheme: \"postgres\",\n\t\tUser: url.UserPassword(conf.User, conf.Password),\n\t\tHost: fmt.Sprintf(\"%s:%d\", conf.Host, conf.Port),\n\t\tPath: conf.Database,\n\t}\n\n\tpoolConf, err := pgxpool.ParseConfig(connURL.String())\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"postgres: could not initialize pool config: %w\", err)\n\t}\n\tpool, err := pgxpool.ConnectConfig(context.Background(), poolConf)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"postgres: could not initialize pool: %w\", err)\n\t}\n\n\treturn pool, pool.Close, nil\n}", "title": "" }, { "docid": "f0f5769a51476ec39121f5e24529f76d", "score": "0.6842445", "text": "func getDBConn(server, port string) (*sql.DB, error) {\n\tpw := os.Getenv(\"KENTIK_PG_PASS\")\n\tif pw == \"\" {\n\t\treturn nil, errors.New(\"KENTIK_PG_PASS is not set, cannot connect to Postgres\")\n\t}\n\n\tconnStr := pgpass.ConnStr(server, port, \"ch_www\", \"postgres\", pw)\n\n\tvar db *sql.DB\n\tvar err error\n\tif db, err = sql.Open(\"postgres\", connStr); err != nil {\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "d233c4e561bdb23d88f2209774829058", "score": "0.67806745", "text": "func NewConnectionPool(config *Configuration) (ConnectionPooler, error) {\n\tconnStr := fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s \", config.Host, config.Port, config.Username, config.Password, config.DBName)\n\n\tif config.SSLMode {\n\t\tconnStr += \"sslmode=enable\"\n\t} else {\n\t\tconnStr += \"sslmode=disable\"\n\t}\n\n\tdb, err := sql.Open(\"postgres\", connStr)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "8ac239b1f9aae25f992caca571823a33", "score": "0.67606646", "text": "func Pool() *sql.DB {\n\treturn db\n}", "title": "" }, { "docid": "8ac239b1f9aae25f992caca571823a33", "score": "0.67606646", "text": "func Pool() *sql.DB {\n\treturn db\n}", "title": "" }, { "docid": "1f914ef7a267306c2f14985a18f2eb50", "score": "0.6754246", "text": "func ConnectionBDPostgreSQLORM() (DB *gorm.DB) {\n\tvar host, dbname, user, password string\n\tvar port int\n\n\thost = Godotenv(\"host\")\n\tdbname = Godotenv(\"dbname\")\n\tport, _ = strconv.Atoi(Godotenv(\"port_banco\"))\n\tuser = Godotenv(\"user\")\n\tpassword = Godotenv(\"password\")\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", host, port, user, password, dbname)\n\tdb, err := gorm.Open(postgres.Open(psqlInfo), &gorm.Config{})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "e1d42d2d49b7402b477eebcbe80d9557", "score": "0.6752324", "text": "func Dial(ctx context.Context, connParams ConnectParameters) (*DB, error) {\n\tdsn, err := connParams.BuildDSN()\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Failed to create connection config for pgx\")\n\t}\n\n\tconfig, err := pgxpool.ParseConfig(dsn)\n\tif err != nil {\n\t\treturn nil, stacktrace.Propagate(err, \"Failed to parse connection config for pgx\")\n\t}\n\n\tif connParams.SSL.Mode == \"enable\" {\n\t\tconfig.ConnConfig.TLSConfig.ServerName = connParams.Host\n\t}\n\tconfig.MaxConns = int32(connParams.MaxOpenConns)\n\tconfig.MaxConnIdleTime = (time.Duration(connParams.MaxConnIdleSeconds) * time.Second)\n\tconfig.HealthCheckPeriod = (1 * time.Second)\n\tconfig.MinConns = 1\n\n\tdb, err := pgxpool.ConnectConfig(ctx, config)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &DB{\n\t\tPool: db,\n\t}, nil\n}", "title": "" }, { "docid": "79f18fe5559e41671557c0844d9e0240", "score": "0.67410797", "text": "func Postgres() (db *sql.DB, cleanup func()) {\n\tLogger.Debug(\"creating postgres instance\")\n\n\tdecrement := resourceLimit.allow()\n\n\tresource, err := pool.Run(\"circleci/postgres\", \"10\", []string{\"POSTGRES_USER=root\", \"POSTGRES_DB=db\", \"POSTGRES_PASSWORD=secret\"})\n\tif err != nil {\n\t\tLogger.Panic(\"Could not start postgres resource:\", zap.Error(err))\n\t}\n\n\tLogger.Debug(\"created postgres resource\")\n\n\t// exponential backoff-retry, because the application in the container might not be ready to accept connections yet\n\terr = pool.Retry(func() error {\n\t\tLogger.Debug(\"connecting to postgres resource\")\n\n\t\tdb, err = sql.Open(\"postgres\", fmt.Sprintf(\"postgres://root:secret@localhost:%s/db?sslmode=disable\", resource.GetPort(\"5432/tcp\")))\n\t\tif err != nil {\n\t\t\tLogger.Warn(\"error while dialing postgres\", zap.Error(err))\n\t\t\treturn err\n\t\t}\n\t\treturn db.Ping()\n\t})\n\tLogger.Debug(\"connected to postgres resource\")\n\n\tif err != nil {\n\t\tLogger.Panic(\"Could not connect to postgres docker image\", zap.Error(err))\n\t}\n\treturn db, func() {\n\t\terr := db.Close()\n\t\tif err != nil {\n\t\t\tLogger.Warn(\"unable to close postgres\", zap.Error(err))\n\t\t}\n\t\terr = resource.Close()\n\t\tif err != nil {\n\t\t\tLogger.Warn(\"unable to close postgres resource\", zap.Error(err))\n\t\t}\n\n\t\tdecrement()\n\t}\n}", "title": "" }, { "docid": "0c8aee5eceee04f94c861a904627d1cd", "score": "0.67337614", "text": "func PooledDB(conf map[string]string) (*sql.DB, error) {\n\tdsn := GetDsn(conf)\n\tdb, ok := sqlDbs.Load(dsn)\n\tif !ok {\n\t\tdb2, err := StandaloneDB(conf)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdb = db2\n\t\tsqlDbs.Store(dsn, db)\n\t}\n\treturn db.(*sql.DB), nil\n}", "title": "" }, { "docid": "637f9ad3220edb311750d92bc6425686", "score": "0.6730945", "text": "func NewDB(config *config.Config) *DB {\n\tconnStr := \"postgresql://\" + config.DBUser + \":\" + config.DBPassword + \"@\" + config.DBURL + \"/\" + config.DBName\n\tconn, err := pgxpool.Connect(context.Background(), connStr)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tlog.Info(\"database connection established\")\n\treturn &DB{conn}\n}", "title": "" }, { "docid": "60f70555703c3306c3064b9ed17cade6", "score": "0.67235494", "text": "func connectDb(dbUrl string) *pgxpool.Pool {\n\tpool, err := pgxpool.Connect(context.Background(), dbUrl)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to connect db: %s\", err)\n\t}\n\treturn pool\n}", "title": "" }, { "docid": "4914803b95200247efe3521270d95ae4", "score": "0.6704032", "text": "func (p *PostgreSQLCDC) NewConn() (*pgconn.PgConn, error) {\n\tdsn := fmt.Sprintf(\"postgres://%s:%s@%s:%d/%s?replication=database&sslmode=%s\", p.config.User, p.config.Password, p.config.Host, p.config.Port, p.config.Database, p.config.SslMode)\n\n\tconn, err := pgconn.Connect(p.ctx, dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "8246249f4da304b92b7a38766174fe9e", "score": "0.66953504", "text": "func New(config *config.Settings) (*pg.DB, error) {\n\tdb := pg.Connect(&pg.Options{\n\t\tAddr: config.Database.Address(),\n\t\tUser: config.Database.User,\n\t\tPassword: config.Database.Password,\n\t\tDatabase: config.Database.Name,\n\t\tPoolSize: config.Database.Pool,\n\t\tMaxRetries: config.Database.MaxRetries,\n\t\tNetwork: config.Database.Network,\n\t})\n\n\treturn db, nil\n}", "title": "" }, { "docid": "84deec437bc4b04f54ac01aa9d1b56b3", "score": "0.66949093", "text": "func GetDB() *pgxpool.Pool {\n\treturn DB\n}", "title": "" }, { "docid": "559a02a8125a0efca543e538067ae5b3", "score": "0.66856146", "text": "func NewPostgresConnection(dsn string) (*sqlx.DB, error) {\n\treturn sqlx.Open(\"postgres\", dsn)\n}", "title": "" }, { "docid": "a9978a8dd68159580deba12c65c4c74e", "score": "0.6630723", "text": "func GetDBConn() *sql.DB {\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"DATABASE_URL\"))\n\tif err != nil {\n\t\tpanic(fmt.Errorf(\"could not connect to database `%s`\", err))\n\t}\n\treturn db\n}", "title": "" }, { "docid": "aac5a9343c15fa7ac6fb611dcbd2d001", "score": "0.6624798", "text": "func Connection(ctx context.Context, cp ConnectionParams) *pg.DB {\n\treturn pg.Connect(&pg.Options{\n\t\tAddr: fmt.Sprintf(\"%v:%v\", cp.Host, cp.Port),\n\t\tUser: cp.User,\n\t\tPassword: cp.Password,\n\t\tDatabase: cp.Database,\n\t\tApplicationName: cp.Schema,\n\t\tTLSConfig: nil,\n\t\tPoolSize: 5,\n\t\tPoolTimeout: 5,\n\t}).WithParam(cp.Schema, pg.Safe(cp.Schema)).WithContext(ctx)\n}", "title": "" }, { "docid": "ef5d753f0bd516b70f36be263e09eb4a", "score": "0.65937436", "text": "func NewPostgreSQL(c *config.Config) (*sqlx.DB, error) {\n\tconn, err := sqlx.Open(\"postgres\", c.DatabaseURL)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn conn, nil\n}", "title": "" }, { "docid": "3226007bdc34ad664e17ab9842135161", "score": "0.6591559", "text": "func New(connStr string) (*Postgres, error) {\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Postgres{db}, nil\n}", "title": "" }, { "docid": "3b8e305d956ff9154bdd10d1f5c3b259", "score": "0.65673417", "text": "func (c *cluster) Conn(ctx context.Context, node int) *gosql.DB {\n\turl := c.ExternalPGUrl(ctx, c.Node(node))[0]\n\tdb, err := gosql.Open(\"postgres\", url)\n\tif err != nil {\n\t\tc.t.Fatal(err)\n\t}\n\treturn db\n}", "title": "" }, { "docid": "b2de3c3258dda09a6562794a88e0467f", "score": "0.6566488", "text": "func connectToPostgres(connStr string) (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", connStr)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"Failed to connect to the database with parameters '\"+connStr+\"'\")\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "e14c92ce9cd2fe86870f570225416c5e", "score": "0.6558136", "text": "func (o *Opts) pool(ctx context.Context) (*pgxpool.Pool, error) {\n\tcfg, err := pgxpool.ParseConfig(o.ConnString)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to parse ConnString: %v\", err)\n\t}\n\tcfg.MaxConns = o.MaxConnPool\n\n\tpool, err := pgxpool.ConnectConfig(ctx, cfg)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create Pool: %v\", err)\n\t}\n\treturn pool, nil\n}", "title": "" }, { "docid": "3ac356ebf529f3f63e22b02d14184839", "score": "0.65567034", "text": "func GetConnection() *pg.DB {\n\treturn db\n}", "title": "" }, { "docid": "73d425182b0dd0b78b567a739ea53e1b", "score": "0.6541113", "text": "func DbConneection() *dbr.Connection {\n\tconnectionString := dbconfig.PostgresConnectionString(\"disable\")\n\tconn, _ := dbr.Open(\"postgres\", connectionString, nil)\n\treturn conn\n}", "title": "" }, { "docid": "54c5e4884c888920416fccb6e1a51e97", "score": "0.65312314", "text": "func NewDB(ctx context.Context, t testing.TB) (*DB, error) {\n\t// if we find an environment variable use this inplace of the passed in DSN.\n\t// this will mostly be used in CI/CD settings to point to pipeline databases\n\tvar dsn string\n\tdsnFromEnv := os.Getenv(EnvPGConnString)\n\tif dsnFromEnv != \"\" {\n\t\tdsn = dsnFromEnv\n\t} else {\n\t\tdsn = DefaultDSN\n\t}\n\n\tcfg, err := pgxpool.ParseConfig(dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcfg.ConnConfig.Logger = testingadapter.NewLogger(t)\n\tcfg.MaxConns = 10\n\tdbid, roleid := mkIDs()\n\tdatabase := fmt.Sprintf(\"db%x\", dbid)\n\trole := fmt.Sprintf(\"role%x\", roleid)\n\n\tconn, err := pgx.ConnectConfig(ctx, cfg.ConnConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, fmt.Sprintf(createRole, role)); err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, fmt.Sprintf(createDatabase, role, database)); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := conn.Close(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg.ConnConfig.Database = database\n\tconn, err = pgx.ConnectConfig(ctx, cfg.ConnConfig)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif _, err := conn.Exec(ctx, loadUUID); err != nil {\n\t\treturn nil, err\n\t}\n\tif err := conn.Close(ctx); err != nil {\n\t\treturn nil, err\n\t}\n\n\tcfg.ConnConfig.User = role\n\tt.Logf(\"config: %+v\", struct {\n\t\tHost string\n\t\tPort uint16\n\t\tDatabase string\n\t\tUser string\n\t\tPassword string\n\t}{\n\t\tHost: cfg.ConnConfig.Host,\n\t\tPort: cfg.ConnConfig.Port,\n\t\tDatabase: cfg.ConnConfig.Database,\n\t\tUser: cfg.ConnConfig.User,\n\t\tPassword: cfg.ConnConfig.Password,\n\t})\n\tcfg.ConnConfig.Logger = nil\n\n\treturn &DB{\n\t\tdsn: dsn,\n\t\tcfg: cfg,\n\t}, nil\n}", "title": "" }, { "docid": "1ae23d96b544310a6ef381742e205ab4", "score": "0.652724", "text": "func getPgConnection() {\n\n\tconnectionString := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\",\n\t\tutils.AppConfig.DbHost,\n\t\tutils.AppConfig.DbPort,\n\t\tutils.AppConfig.DbUser,\n\t\tutils.AppConfig.DbPwd,\n\t\tutils.AppConfig.DbName)\n\n\tvar err error\n\tDb, err = sql.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\tlog.Fatalf(\"[GetPgConnection]: %s\\n\", err)\n\t}\n\n\terr = Db.Ping()\n\tif err != nil {\n\t\tlog.Fatalf(\"[TestDbConnection: %s\\n\", err)\n\t}\n\n\tlog.Println(\"Successfully connected to Database!\")\n\treturn\n}", "title": "" }, { "docid": "f0ad8fde3a8da118229a258aced7f67b", "score": "0.6488288", "text": "func GetConnection() *sqlx.DB {\n\tif sqlxConnection != nil {\n\t\treturn sqlxConnection\n\t}\n\n\tsqlxConnection, err := sqlx.Open(\"postgres\", config.GetConfig().ConnectionString)\n\tif err != nil {\n\t\tlog.Fatalln(\"Couldn't connect to data store\")\n\n\t\treturn nil\n\t}\n\n\tsqlxConnection.SetMaxOpenConns(maxOpenConns)\n\tsqlxConnection.SetMaxIdleConns(maxIdleConns)\n\n\treturn sqlxConnection\n}", "title": "" }, { "docid": "a5d8423a2e5a1af180b2f08ccadeabf9", "score": "0.64530605", "text": "func NewConn(logger *zap.Logger, user, password, dbName, host, sslmode string) (*sqlx.DB, error) {\n\tconnDetails := NewConnectionDetails(user, password, dbName, host, sslmode)\n\tconnString := connDetails.String()\n\n\tdb, err := sqlx.Open(\"postgres\", connString)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"failed to open database: %w\", err)\n\t}\n\n\tlogger.Info(\"Attempting to connect to database\",\n\t\tzap.String(\"host\", host), zap.String(\"dbName\", dbName), zap.String(\"user\", user),\n\t)\n\tmaxRetries := 20\n\tfor retry := 1; retry <= maxRetries; retry++ {\n\t\tif err = db.Ping(); err == nil {\n\t\t\t// If we can connect to the db okay then there is no point retrying\n\t\t\t// anymore so just exit here.\n\t\t\treturn db, nil\n\t\t}\n\t\tlogger.Info(\"Failed to connect to database\",\n\t\t\tzap.Int(\"attempt\", retry), zap.String(\"dbName\", dbName), zap.String(\"host\", host), zap.String(\"user\", user), zap.Error(err),\n\t\t)\n\t\t// Exponentially back off so we don't spam the db too much.\n\t\ttime.Sleep(time.Duration(retry) * time.Second)\n\t}\n\treturn nil, xerrors.Errorf(\"failed to connect to database %s after %d retries: %w\", dbName, maxRetries, err)\n}", "title": "" }, { "docid": "f25ddc749eda60a5193709ce8a35ab22", "score": "0.6452595", "text": "func NewPsqlConn(dsn string) (*PsqlConn, error) {\n\tdbConn, err := pgxpool.Connect(context.Background(), dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tconn := PsqlConn{dbConn}\n\n\treturn &conn, nil\n}", "title": "" }, { "docid": "2f510e2a3a260011a706033fbf8e4042", "score": "0.6423847", "text": "func connection(cfg Config, database string) (db *sql.DB, err error) {\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=disable\", cfg.UserID, cfg.Password, cfg.Host, database)\n\treturn sql.Open(\"postgres\", connStr)\n}", "title": "" }, { "docid": "3f43cba8f21eaf3f3b6091b566869e1b", "score": "0.64152896", "text": "func (obj *TGDBConnection) GetConnectionPool() tgdb.TGConnectionPool {\n\treturn obj.connPoolImpl\n}", "title": "" }, { "docid": "23a6c46ca9444bf4cb0ebd528e346138", "score": "0.6414902", "text": "func (p *provider) GetConn() (*sql.DB, error) {\n\treturn p.db, nil\n}", "title": "" }, { "docid": "34968a953c4790453aaf2834ccf54ad2", "score": "0.64070576", "text": "func NewPostgres(pool *dockertest.Pool) (*PostgresDocker, error) {\n\tres, err := pool.Run(\"postgres\", \"latest\", []string{\n\t\t\"POSTGRES_PASSWORD=test\",\n\t\t\"POSTGRES_USER=test\",\n\t\t\"POSTGRES_DB=test\",\n\t})\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"start postgres\")\n\t}\n\n\tpurge := func() {\n\t\tpool.Purge(res)\n\t}\n\n\terrChan := make(chan error)\n\tdone := make(chan struct{})\n\n\tvar db *sql.DB\n\n\tgo func() {\n\t\tif err := pool.Retry(func() error {\n\t\t\tdb, err = sql.Open(\"postgres\", fmt.Sprintf(\"user=test password=test dbname=test host=localhost port=%s sslmode=disable\", res.GetPort(\"5432/tcp\")))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := db.Ping(); err != nil {\n\t\t\t\tdb.Close()\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}); err != nil {\n\t\t\terrChan <- err\n\t\t}\n\n\t\tclose(done)\n\t}()\n\n\tselect {\n\tcase err := <-errChan:\n\t\tpurge()\n\t\treturn nil, errors.Wrap(err, \"check connection\")\n\tcase <-time.After(dockerStartWait):\n\t\tpurge()\n\t\treturn nil, errors.New(\"timeout on checking postgres connection\")\n\tcase <-done:\n\t\tclose(errChan)\n\t}\n\n\tpd := PostgresDocker{\n\t\tDB: db,\n\t\tResource: res,\n\t}\n\n\treturn &pd, nil\n}", "title": "" }, { "docid": "2a59aa4aaefd8b4cf48f4f57b5bd4287", "score": "0.64062124", "text": "func NewPostgresDB() {\n\tonce.Do(func() {\n\t\tvar err error\n\t\tdb, err = sql.Open(\"postgres\", \"postgres://postgres:example@localhost:5432/godb?sslmode=disable\")\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"can't open db: %v\", err)\n\t\t}\n\n\t\tif err = db.Ping(); err != nil {\n\t\t\tlog.Fatalf(\"can't do ping: %v\", err)\n\t\t}\n\n\t\tfmt.Println(\"connected to postgress\")\n\t})\n}", "title": "" }, { "docid": "206a90cd86b0fadb003608672924eeed", "score": "0.6403618", "text": "func (db *PostgresPersistence) Connect() error {\n\tlog.Debug(\"generating postgres connection pool...\")\n\t// connect to postgres server and set session in persistence\n\tconn, err := pgxpool.Connect(context.Background(), db.DatabaseURL)\n\tif err != nil {\n\t\tlog.Error(fmt.Errorf(\"error connecting to postgres service: %+v\", err))\n\t\treturn err\n\t}\n\tdb.Session = conn\n\treturn err\n}", "title": "" }, { "docid": "cc883064abf0e2dcd1196dd1a0fd04d9", "score": "0.63980085", "text": "func NewPostgreSQL(ctx context.Context) (*PostgreSQL, error) {\n\tdatabaseURL, found := os.LookupEnv(envVarDatabaseURL)\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", errEnvVarNotFound, envVarDatabaseURL)\n\t}\n\n\tdbConnectionPool, err := pgxpool.Connect(ctx, databaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to connect to db: %w\", err)\n\t}\n\n\treturn &PostgreSQL{conn: dbConnectionPool}, nil\n}", "title": "" }, { "docid": "272d2d637490a280279356cd5fb580eb", "score": "0.639797", "text": "func (e *Exporter) pgbNewConnection(psqlInfo string) (*sql.DB, error) {\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn db, nil\n}", "title": "" }, { "docid": "8f8aae2b071d623b11fbd5eab62cd59f", "score": "0.63850206", "text": "func Get() (*sqlx.DB, error) {\n\tvar DB *sqlx.DB\n\n\tDB = getDatabaseFromPool(GetDatabase())\n\tif DB != nil {\n\t\treturn DB, nil\n\t}\n\n\tDB, err = sqlx.Connect(\"postgres\", GetURI(GetDatabase()))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tDB.SetMaxIdleConns(config.PrestConf.PGMaxIdleConn)\n\tDB.SetMaxOpenConns(config.PrestConf.PGMaxOpenConn)\n\n\tAddDatabaseToPool(GetDatabase(), DB)\n\n\treturn DB, nil\n}", "title": "" }, { "docid": "7d0b5678b33f8ba95b9414d00ad5854b", "score": "0.63811564", "text": "func createConnection() *sql.DB {\n // load .env file\n err := godotenv.Load(\".env\")\n\n if err != nil {\n log.Fatalf(\"Error loading .env file\")\n }\n\n // Open the connection\n db, err := sql.Open(\"postgres\", os.Getenv(\"POSTGRES_URL\"))\n\n if err != nil {\n panic(err)\n }\n\n // check the connection\n err = db.Ping()\n\n if err != nil {\n panic(err)\n }\n\n fmt.Println(\"Successfully connected!\")\n // return the connection\n return db\n}", "title": "" }, { "docid": "7d0b5678b33f8ba95b9414d00ad5854b", "score": "0.63811564", "text": "func createConnection() *sql.DB {\n // load .env file\n err := godotenv.Load(\".env\")\n\n if err != nil {\n log.Fatalf(\"Error loading .env file\")\n }\n\n // Open the connection\n db, err := sql.Open(\"postgres\", os.Getenv(\"POSTGRES_URL\"))\n\n if err != nil {\n panic(err)\n }\n\n // check the connection\n err = db.Ping()\n\n if err != nil {\n panic(err)\n }\n\n fmt.Println(\"Successfully connected!\")\n // return the connection\n return db\n}", "title": "" }, { "docid": "9fc2626c583ecdfa2b99199f0545b6c0", "score": "0.6379647", "text": "func (p *Pool) NewConn() redis.Conn {\n\treturn p.redisPool.Get()\n}", "title": "" }, { "docid": "9e92a4305ccbbe9a430b95e71b93cb3d", "score": "0.6378128", "text": "func NewPostgresRepo(conn *sql.DB, a *config.AppConfig) repository.DatabaseRepo {\n\trepo := &postgresDBRepo{\n\t\tApp: a,\n\t\tDB: conn,\n\t}\n\treturn repo\n}", "title": "" }, { "docid": "963c9b352399fdb4f3129ffc258e5623", "score": "0.63697356", "text": "func Connect() error {\n\n\tconnPoolConfig := pgx.ConnPoolConfig{\n\t\tConnConfig: pgx.ConnConfig{\n\t\t\tHost: os.Getenv(\"POSTGRES_HOST\"),\n\t\t\tUser: os.Getenv(\"POSTGRES_USER\"),\n\t\t\tPassword: os.Getenv(\"POSTGRES_PASSWORD\"),\n\t\t\tDatabase: os.Getenv(\"POSTGRES_DB\"),\n\t\t\tTLSConfig: &tls.Config{\n\t\t\t\tInsecureSkipVerify: true,\n\t\t\t},\n\t\t},\n\t\tMaxConnections: MaxDBConnections,\n\t\tAfterConnect: afterConnect,\n\t\tAcquireTimeout: DBTimeout,\n\t}\n\tpool, err := pgx.NewConnPool(connPoolConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\tDBConnectionPool = pool\n\n\treturn nil\n}", "title": "" }, { "docid": "2612959c22d08028bab0074aabb6db1c", "score": "0.63669133", "text": "func getPostgresClient() (*sql.DB, error) {\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%s user=%s password=%s dbname=%s sslmode=disable\", host, port, user, password, dbName)\n\tcli, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn cli, err\n}", "title": "" }, { "docid": "e850821957e00916d7c3646256cc284d", "score": "0.6363822", "text": "func openDB(cfg config) (*sql.DB, error) {\n\t// Use sql.Open() to create an empty connection pool, using the DSN from the config\n\t// struct.\n\tdb, err := sql.Open(\"postgres\", cfg.db.dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Create a context with a 5-second timeout deadline.\n\tctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\n\tdefer cancel()\n\t// Use PingContext() to establish a new connection to the database, passing in the\n\t// context we created above as a parameter. If the connection couldn't be\n\t// established successfully within the 5 second deadline, then this will return an\n\t// error.\n\terr = db.PingContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// Return the sql.DB connection pool.\n\treturn db, nil\n}", "title": "" }, { "docid": "99f09cb0c00b0f8f079579941890d88d", "score": "0.6355378", "text": "func primeTxPoolWithConnection(t *testing.T) (*fakesqldb.DB, *TxPool, error) {\n\tdb := fakesqldb.New(t)\n\ttxPool := newTxPool()\n\t// Set the capacity to 1 to ensure that the db connection is reused.\n\ttxPool.conns.SetCapacity(1)\n\ttxPool.Open(db.ConnParams(), db.ConnParams(), db.ConnParams())\n\n\t// Run a query to trigger a database connection. That connection will be\n\t// reused by subsequent transactions.\n\tdb.AddQuery(\"begin\", &sqltypes.Result{})\n\tdb.AddQuery(\"rollback\", &sqltypes.Result{})\n\tctx := context.Background()\n\ttxConn, err := txPool.LocalBegin(ctx, &querypb.ExecuteOptions{})\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\ttxPool.LocalConclude(ctx, txConn)\n\n\treturn db, txPool, nil\n}", "title": "" }, { "docid": "0e6eff5667341ff550981534ce33700f", "score": "0.6354173", "text": "func NewPostgreSQL() (*PostgreSQL, error) {\n\tdatabaseURL, found := os.LookupEnv(envVarDatabaseURL)\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"%w: %s\", errEnvVarNotFound, envVarDatabaseURL)\n\t}\n\n\tdbConnectionPool, err := pgxpool.Connect(context.Background(), databaseURL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to connect to db: %w\", err)\n\t}\n\n\treturn &PostgreSQL{conn: dbConnectionPool}, nil\n}", "title": "" }, { "docid": "f95fc252e918afb578c50a733e757638", "score": "0.6353691", "text": "func NewDBConnection() (*gorm.DB, error) {\n\tdsn, err := prepareConnectionParams()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb, err := gorm.Open(postgres.Open(dsn), &gorm.Config{})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "3e77cab0e426f81329a23e1db2ecb9e6", "score": "0.6338938", "text": "func (c *postgresClient) GetConnection() *sqlx.DB {\n\treturn c.db\n}", "title": "" }, { "docid": "45b21cda95950872534555f99c665020", "score": "0.63149434", "text": "func connect() *sql.DB {\n\tdbConfig := config.New().DB\n\tconnectionString := dbConfig.BuildConnectionString()\n\n\tdb, err := sql.Open(\"postgres\", connectionString)\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tlog.Panic(err)\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "f57400ec75676993236aa6ba5bd075e3", "score": "0.63130826", "text": "func Conn() *gorm.DB {\n\tonce.Do(func() {\n\t\tconn = newConnection()\n\t})\n\n\treturn conn\n}", "title": "" }, { "docid": "00f7de237207f3f1f5dc316f96b86a0b", "score": "0.63120896", "text": "func ConnectPostgres(d ConnParams) (db *sql.DB, err error) {\n\t// connect_timeout\n\t//\n\t// https://www.postgresql.org/docs/9.6/static/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT\n\t// Maximum wait for connection, in seconds (write as a decimal integer string). Zero or not\n\t// specified means wait indefinitely. It is not recommended to use a timeout of less than 2\n\t// seconds.\n\t//\n\t// statement_timeout\n\t//\n\t// https://www.postgresql.org/docs/9.6/static/runtime-config-client.html#GUC-STATEMENT-TIMEOUT\n\t// Abort any statement that takes more than the specified number of milliseconds, starting from\n\t// the time the command arrives at the server from the client.\n\tconnParams := fmt.Sprintf(\n\t\t\"user=%s password=%s dbname=%s sslmode=disable host=%s connect_timeout=%d statement_timeout=%d\",\n\t\td.Username,\n\t\td.Password,\n\t\td.DatabaseName,\n\t\td.Host,\n\t\tint(d.ConnectTimeout.Seconds()),\n\t\tint(d.StatementTimeout.Seconds()*1000),\n\t)\n\n\tif db, err = sql.Open(PostgresDriver, connParams); err != nil {\n\t\treturn nil, err\n\t}\n\n\tdb.SetMaxIdleConns(d.MaxIdleConnections)\n\tdb.SetMaxOpenConns(d.MaxOpenConnections)\n\treturn\n}", "title": "" }, { "docid": "239bdb48371eb1382fb82ca237f5558a", "score": "0.63005304", "text": "func NewConnection(config DBConfig) (*sql.DB, error) {\n\tconnStr := fmt.Sprintf(\"postgres://%s:%s@%s/%s\",\n\t\tconfig.User,\n\t\tconfig.Password,\n\t\tconfig.Host,\n\t\tconfig.DBName)\n\treturn sql.Open(\"postgres\", connStr)\n}", "title": "" }, { "docid": "b8f78ef565a723e6d679efeec7649b43", "score": "0.6297997", "text": "func Conn() redis.Conn {\n\treturn pool.Get()\n}", "title": "" }, { "docid": "a821066198e64a17d6b74045a5949c9d", "score": "0.6294488", "text": "func newDB(l *logrus.Logger) *pgDB {\n\n\t// create a normal database connection through database/sql\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"API_DSN\"))\n\tif err != nil {\n\t\tl.WithError(err).Fatal(\"could not connect to DB\")\n\t}\n\n\t// ensures the database can be pinged with an exponential backoff (15 min)\n\trunner.MustPing(db)\n\n\t// set to reasonable values for production\n\tdb.SetMaxIdleConns(4)\n\tdb.SetMaxOpenConns(16)\n\n\t// set this to enable interpolation\n\tdat.EnableInterpolation = true\n\n\t// set to check things like sessions closing.\n\t// Should be disabled in production/release builds.\n\tdat.Strict = false\n\n\t// Log any query over 10ms as warnings. (optional)\n\trunner.LogQueriesThreshold = 10 * time.Millisecond\n\tl.Info(\"Connected to DB\")\n\treturn &pgDB{\n\t\tlog: l,\n\t\tdb: runner.NewDB(db, \"postgres\"),\n\t}\n}", "title": "" }, { "docid": "14ed52828ef118cfd126c260b17a44a5", "score": "0.6292662", "text": "func NewPostgresConfig(uri string) *ConnectionConfig {\n\treturn &ConnectionConfig{\n\t\tURI: uri,\n\t\tDatabase: \"postgres\",\n\t\tMaxConnectionLifetime: time.Duration(1) * time.Hour,\n\t\tMaxIdleConns: 20,\n\t\tMaxOpenConns: 50,\n\t\tConnectSleepStartSeconds: 1,\n\t\tMaxDBConnectAttempts: 5,\n\t\tDBConnectAttempts: 0,\n\t}\n}", "title": "" }, { "docid": "711aa961e4d20a16f313a25f604bec56", "score": "0.6292222", "text": "func GetPGHandle(t *testing.T, serverAddr string) *sql.DB {\n\tt.Helper()\n\n\tpg := sql.OpenDB(pgdriver.NewConnector(\n\t\tpgdriver.WithNetwork(\"tcp\"),\n\t\tpgdriver.WithAddr(serverAddr),\n\t\tpgdriver.WithInsecure(true),\n\t\tpgdriver.WithUser(\"admin\"),\n\t\tpgdriver.WithPassword(\"password\"),\n\t\tpgdriver.WithDatabase(\"testdb\"),\n\t))\n\n\treturn pg\n}", "title": "" }, { "docid": "d92580589e4ee7479119d3366cd834bd", "score": "0.6288138", "text": "func NewPostgreSQL(config Config) (DB, error) {\n\tconnString := fmt.Sprintf(\n\t\t\"postgres://%s:%s@%s:%d/%s?sslmode=%s\",\n\t\turl.PathEscape(config.Username),\n\t\turl.PathEscape(config.Password),\n\t\turl.PathEscape(config.Host),\n\t\tconfig.Port,\n\t\turl.PathEscape(config.Database),\n\t\turl.QueryEscape(config.SSLMode),\n\t)\n\n\tdb, err := sql.Open(\"postgres\", connString)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(err, \"open connection to database\")\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, errors.Wrap(err, \"ping database\")\n\t}\n\treturn &PostgreSQL{db}, nil\n}", "title": "" }, { "docid": "8c136c12e82ea3333e2b0a92c118a643", "score": "0.62663543", "text": "func InitDB() *sql.DB {\n\thost := MustHaveEnv(\"POSTGRES_HOST\")\n\tport := MustHaveEnvInt(\"POSTGRES_PORT\")\n\tuser := MustHaveEnv(\"POSTGRES_USER\")\n\tpassword := MustHaveEnv(\"POSTGRES_PASSWORD\")\n\tdbname := MustHaveEnv(\"POSTGRES_DATABASE\")\n\n\tpsqlInfo := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", host, port, user, password, dbname)\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\tlogrus.Fatal(err)\n\t}\n\n\t// Set Max Connection Life time\n\tmaxConLifeTime := MustHaveEnvInt(\"DB_MAX_CONN_LIFE_TIME_S\")\n\tif maxConLifeTime <= 0 {\n\t\tlogrus.Fatal(err, \"DB_MAX_CONN_LIFE_TIME_S is not well set \")\n\t}\n\tdb.SetConnMaxLifetime(time.Second * time.Duration(maxConLifeTime))\n\n\t// Set Max Open Connection\n\tmaxOpenConn := MustHaveEnvInt(\"DB_MAX_OPEN_CONNECTION\")\n\tif maxOpenConn <= 0 {\n\t\tlogrus.Fatal(err, \"DB_MAX_OPEN_CONNECTION is not well set \")\n\t}\n\tdb.SetMaxOpenConns(maxOpenConn)\n\n\t// Set max Idle Connection that can be reused\n\tmaxIdleConn := MustHaveEnvInt(\"DB_MAX_IDLE_CONNECTION\")\n\tif maxIdleConn <= 0 {\n\t\tlogrus.Fatal(err, \"DB_MAX_IDLE_CONNECTION is not well set \")\n\t}\n\tdb.SetMaxIdleConns(maxIdleConn)\n\n\treturn db\n}", "title": "" }, { "docid": "5d923861a02d7768021a75a30dbe70b8", "score": "0.6249831", "text": "func Conn() *sql.DB {\n return myDb\n}", "title": "" }, { "docid": "e043f38e6ac5c4dbd8d5e584b4f0658f", "score": "0.6247927", "text": "func NewConnPool(address string, maxOpenConns, maxIdleConns int) *ConnPool {\n\tcp := &ConnPool{\n\t\topenConnsPool: NewOpenPool(),\n\t\tmaxOpenConns: maxOpenConns,\n\t\tmaxIdleConns: maxIdleConns,\n\t\taddress: address,\n\t\tstatus: &ClientStatus{},\n\t}\n\tgo cp.ServeIdlePing()\n\tgo cp.GCTimer()\n\treturn cp\n}", "title": "" }, { "docid": "53d1186be282fe447d8e1a3e07750293", "score": "0.6244827", "text": "func Postgres() *dbr.Session {\n\treturn conn.Postgres.NewSession(nil)\n}", "title": "" }, { "docid": "9f04efa1134f3bd40e0dc2a3dd1c82a4", "score": "0.624084", "text": "func (store *RedisWrapper) NewConn() redis.Conn {\n\treturn store.pool.Get()\n}", "title": "" }, { "docid": "8c07f95ecf77b3fbac5cc134aebcc4ac", "score": "0.6233693", "text": "func NewPG() (*gorm.DB, func(), error) {\n\tconnectionString := fmt.Sprintf(\"user=%s dbname=%s sslmode=%s password=%s host=%s port=%s\",\n\t\tdbUsername,\n\t\tdbName,\n\t\tdbSSLModeOption,\n\t\tdbPassword,\n\t\tdbHostname,\n\t\tdbPort)\n\tdb, err := gorm.Open(\"postgres\", connectionString)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn db, func() {\n\t\tdb.Close()\n\t}, nil\n}", "title": "" }, { "docid": "53e484e9539a28867a0927b8738d2163", "score": "0.62293136", "text": "func (s *storage) Conn() *sql.DB { return s.conn }", "title": "" }, { "docid": "393c4f65633a2a40dbda28b376ec2705", "score": "0.6218935", "text": "func GetConnection() *sqlx.DB {\n\tdb, err := sqlx.Open(\"postgres\", config.GetConfig().ConnectionString)\n\tif err != nil {\n\t\tlog.Fatalln(\"Couldn't connect to data store\")\n\n\t\treturn nil\n\t}\n\n\treturn db\n}", "title": "" }, { "docid": "46776e511b72ae916e258b9f34e18eee", "score": "0.6209229", "text": "func NewConnection(cfg config.AppConfig) *gorp.DbMap {\n\tpattern := \"user=%s password=%s dbname=%s host=%s sslmode=disable\"\n\n\tdbInfo := fmt.Sprintf(pattern, cfg.GetDatabaseUser(), cfg.GetDatabasePassword(), cfg.GetDatabaseName(), cfg.GetDatabaseHost())\n\tdb, err := sql.Open(\"postgres\", dbInfo)\n\tcheckErr(err, \"sql.Open failed\")\n\n\t// construct a gorp DbMap\n\tdbmap := &gorp.DbMap{Db: db, Dialect: gorp.PostgresDialect{}}\n\n\tmapEntities(dbmap)\n\n\t// create the table. in a production system you'd generally\n\t// use a migration tool, or create the tables via scripts\n\terr = dbmap.CreateTablesIfNotExists()\n\tcheckErr(err, \"Create tables failed\")\n\n\treturn dbmap\n}", "title": "" }, { "docid": "d3572f4d4ce26da80a9041942c929f41", "score": "0.6202315", "text": "func New(dbURL string) (*DB, error) {\n\tconf, err := pgx.ParseConfig(dbURL)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Could not parse postgres config (%s): %v\", dbURL, err)\n\t}\n\tif config.Config.Debug {\n\t\tconf.Logger = log15adapter.NewLogger(log15.New(\"module\", \"pgx\"))\n\t}\n\n\tctx := context.Background()\n\tdb, err := pgx.ConnectConfig(ctx, conf)\n\tif err != nil {\n\t\treturn nil, xerrors.Errorf(\"Could not connect to postgres: %v\", err)\n\t}\n\tif err = db.Ping(ctx); err != nil {\n\t\treturn nil, xerrors.Errorf(\"postgres ping error: %v\", err)\n\t}\n\treturn &DB{db}, nil\n}", "title": "" }, { "docid": "5308b99594068db6b72e3b2a5ae2daa6", "score": "0.619176", "text": "func createPGContainerAndGetDbUrl(ctx context.Context) string {\n\tpostgres, err := testcontainers.GenericContainer(ctx, testcontainers.GenericContainerRequest{\n\t\tContainerRequest: testcontainers.ContainerRequest{\n\t\t\tImage: pgImage,\n\t\t\tExposedPorts: []string{string(pgPort)},\n\t\t\tEnv: map[string]string{\n\t\t\t\t\"POSTGRES_USER\": pgUser,\n\t\t\t\t\"POSTGRES_PASSWORD\": pgPassword,\n\t\t\t\t\"POSTGRES_DB\": pgDb,\n\t\t\t},\n\t\t\tWaitingFor: wait.ForAll(\n\t\t\t\twait.NewLogStrategy(\"database system is ready to accept connections\").WithOccurrence(2),\n\t\t\t\twait.ForListeningPort(pgPort),\n\t\t\t),\n\t\t\tCmd: []string{\"postgres\", \"-c\", \"fsync=off\"},\n\t\t},\n\t\tStarted: true,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tendpoint, err := postgres.Endpoint(ctx, \"\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn fmt.Sprintf(\"postgresql://%s:%s@%s/%s\", pgUser, pgPassword, endpoint, pgDb)\n}", "title": "" }, { "docid": "256a5718065975fb2a31b425dcea11d6", "score": "0.6187418", "text": "func Connect(c *config.PostgresConfig) (*sql.DB, error) {\n\tpsqlInfo := fmt.Sprintf(\"postgres://%s:%s@%s/%s?sslmode=%s\",\n\t\tc.User(),\n\t\tc.Password(),\n\t\tc.Host(),\n\t\tc.Database(),\n\t\tc.SSLMode(),\n\t)\n\n\tdb, err := sql.Open(\"postgres\", psqlInfo)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = db.Ping()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "2789fc9f70090980b0d1afbaf9be542d", "score": "0.6186247", "text": "func Conn() *sqlx.DB {\n\treturn defDB\n}", "title": "" }, { "docid": "e5cfb94d4b46590b21e7c43b0b259214", "score": "0.61819446", "text": "func NewPool(server, password string, db int) *redis.Pool {\n\treturn &redis.Pool{\n\t\tMaxIdle: 3,\n\t\tIdleTimeout: 240 * time.Second,\n\t\tDial: func() (redis.Conn, error) {\n\t\t\tc, err := redis.Dial(\"tcp\", server)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif password != \"\" {\n\t\t\t\tif _, err := c.Do(\"AUTH\", password); err != nil {\n\t\t\t\t\tc.Close()\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t}\n\t\t\tif _, err := c.Do(\"SELECT\", db); err != nil {\n\t\t\t\tc.Close()\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\treturn c, err\n\t\t},\n\t}\n}", "title": "" }, { "docid": "ce270fe4eb71d2b9c4f7d3317cbdf779", "score": "0.6168036", "text": "func OpenDBFromPool(pool *pgx.ConnPool, opts ...OptionOpenDBFromPool) *sql.DB {\n\tc := poolConnector{\n\t\tpool: pool,\n\t\tdriver: pgxDriver,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(&c)\n\t}\n\n\treturn sql.OpenDB(c)\n}", "title": "" }, { "docid": "3c6c2d8fb8717c651cec10ca3aeb5cdd", "score": "0.6166542", "text": "func connect() *sql.DB {\n\tdb, err := sql.Open(\"postgres\", getDbConnectionString())\n\tif err != nil {\n\t\tlog.Fatal(\"error connecting to the database: \", err)\n\t}\n\n\treturn db\n\n}", "title": "" }, { "docid": "1f7c44b82d5e5346fec664e3abdf9433", "score": "0.61594695", "text": "func InitDB() *pgxpool.Pool {\n\tvar db = DB\n\n\tconfiguration := config.InitConfig()\n\n\tdatabase := configuration.Database.Dbname\n\tusername := configuration.Database.Username\n\tpassword := configuration.Database.Password\n\thost := configuration.Database.Host\n\tport := configuration.Database.Port\n\n\tdb, err = pgxpool.Connect(context.Background(), \"host=\"+host+\" port=\"+port+\" user=\"+username+\" dbname=\"+database+\" sslmode=disable password=\"+password)\n\tif err != nil {\n\t\tfmt.Println(\"db err: \", err)\n\t}\n\n\tDB = db\n\treturn DB\n}", "title": "" }, { "docid": "3771000fab6d8232c085da3277e2fe7a", "score": "0.61482656", "text": "func NewDbCon(c DbConfig) (*sql.DB, error) {\n\tpg_con_string := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\tc.DbHostName, c.DbHostPort, c.DbUserName, c.DbPassword, c.DbName)\n\tdb, err := sql.Open(\"postgres\", pg_con_string)\n\n\tif err = db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" }, { "docid": "e11847589b041502e48dbe6cceacf98b", "score": "0.6144562", "text": "func (p *PostgresConn) Config() interface{} {\n\treturn *p\n}", "title": "" }, { "docid": "c912ba2fd2adbaf6ee81518c4e8a7aa1", "score": "0.6141877", "text": "func GetConn() redis.Conn {\n\treturn pool.Get()\n}", "title": "" }, { "docid": "34c184d6e8fe5553aa793f4a5cd1720a", "score": "0.6133074", "text": "func NewConnPool(capacity int, newConn func(ctx context.Context) (*grpc.ClientConn, error)) *Pool {\n\treturn &Pool{\n\t\tcap: capacity,\n\t\tconns: make([]*grpc.ClientConn, 0, capacity),\n\t\tnewConn: newConn,\n\n\t\tmu: sync.Mutex{},\n\t}\n}", "title": "" }, { "docid": "7cb21cee575ac9aee02d012cd8440d21", "score": "0.6131886", "text": "func OpenConnection() *sql.DB {\n\n\t// convert the config to a connection string\n\tpsqlConn := fmt.Sprintf(\"host=%s port=%d user=%s password=%s dbname=%s sslmode=disable\", host, port, user, password, dbname)\n\n\t// open the connect to the database\n\tdb, err := sql.Open(\"postgres\", psqlConn)\n\terrorhandlers.CheckError(err, nil)\n\n\t// verify that the connection is in fact open\n\terr = db.Ping()\n\terrorhandlers.CheckError(err, nil)\n\n\t// return the db instance\n\treturn db\n\n}", "title": "" }, { "docid": "b713631914321a95888b695673981224", "score": "0.6120585", "text": "func createConnection() *sql.DB {\n\n\terr := godotenv.Load(\".env\")\n\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading .env file\")\n\t}\n\n\tdb, err := sql.Open(\"postgres\", os.Getenv(\"POSTGRES_URL\"))\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = db.Ping()\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(\"Successfully connected!\")\n\treturn db\n}", "title": "" }, { "docid": "57634f1960567501cfeb1640abbb7b36", "score": "0.6119042", "text": "func connDB() *sqlx.DB {\n\tfmt.Println(\"Attempting to connect to DB\")\n\tu := config.DBUsername()\n\tpw := config.DBPassword()\n\tn := config.DBSchema()\n\th := config.DBHost()\n\tp := config.DBPort()\n\n\t// The API should not boot if the config values were not found.\n\tif u == \"\" || h == \"\" || n == \"\" || p == \"\" || pw == \"\" {\n\t\tpanic(\"Database config values not found.\")\n\t}\n\n\t// Connect to the database and ping, confirming connection was made.\n\t// Panic if the connection was not successful.\n\tconnString := fmt.Sprintf(\"%s:%s@tcp(%s:%s)/%s\", u, h, p, n)\n\tdb, err := sqlx.Connect(\"mysql\", connString)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdb.SetMaxIdleConns(10)\n\tdb.SetMaxOpenConns(60)\n\tfmt.Println(\"Connected to DB succesfully\")\n\treturn db\n}", "title": "" }, { "docid": "b8c7c6cb69177c826d7f3357aa7a3e66", "score": "0.6110884", "text": "func NewPostgres(config config.DatabaseConfig) (pg *Postgres, err error) {\n\tdataSourceName := fmt.Sprintf(\"host=%s port=%d user=%s \"+\n\t\t\"password=%s dbname=%s sslmode=disable\",\n\t\tconfig.Host,\n\t\tconfig.Port,\n\t\tconfig.User,\n\t\tconfig.Password,\n\t\tconfig.Name)\n\tdb, err := sql.Open(\"postgres\", dataSourceName)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tpg = &Postgres{\n\t\tdb: db,\n\t}\n\treturn\n}", "title": "" }, { "docid": "3f8fb9f31735bc48e1f212468b816550", "score": "0.61089385", "text": "func NewPostgres(dsn string) (*sqlx.DB, error) {\n\tdb, err := sqlx.Connect(\"postgres\", dsn)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif err := db.Ping(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn db, nil\n}", "title": "" } ]
c74f2accb9c7d3741b424e1725af6742
/ we change unique func to handle both standard input and file input note that standard input (os.Stdin) is also File pointer also we will need to extend our results for multiple file case so we pass results to function
[ { "docid": "ed11c641da3676949671a98c0a159ff5", "score": "0.51041865", "text": "func unique(file *os.File, result map[string]int) {\n\t/*\n\t\tunique prints the text of each line that appears more than\n\t\tonce in the text file (or standard input), preceded by its count\n\t*/\n\t/*\n\t\tcreate a map with key which is line\n\t\tlets loop over item and increase maps values by one\n\t*/\n\targs := bufio.NewScanner(file)\n\n\tfor args.Scan() {\n\t\tif args.Text() == \"exit\" || args.Text() == string(0) || args.Text() == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tresult[args.Text()] += 1\n\t}\n}", "title": "" } ]
[ { "docid": "02c7a774b9f8caf173340b4a1d242f25", "score": "0.633331", "text": "func processInput(filepath string) ([]string, error) {\n\tfile, err := os.Open(filepath)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tdefer file.Close()\n\n\tvar inputs []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tinputs = append(inputs, scanner.Text())\n\t}\n\n\treturn inputs, scanner.Err()\n}", "title": "" }, { "docid": "61255d7a2d40bf534b7f35bc4ee6b272", "score": "0.5794736", "text": "func readFile()(fileInfo string){\r\n\treader := bufio.NewReader(os.Stdin)\r\n\tfmt.Print(\"File name to import: \")\r\n\tfileName, _ := reader.ReadString('\\n')\r\n\tfileName = strings.TrimSpace(fileName)\r\n\t//fmt.Println(fileName)\r\n\r\n\tdata, err := ioutil.ReadFile(fileName)\r\n\tif err != nil{\t\t\t//Prints why file cannot be read.\r\n\t\twhatsMyError() \r\n\t\treturn\r\n\t}\r\n\tfileInfo = string(data)\r\n\t//fmt.Println(fileStr) \r\n\t//goodbyeNumbers(fileStr)\r\n\t\r\n\treturn fileInfo\r\n\t\r\n}", "title": "" }, { "docid": "1827d5b0af4d77f67481da50c4323772", "score": "0.5735065", "text": "func buildInputFiles(ifile string) ([]string,error) {\n\n\tvar (\n\t\tfiles []string\n\t\terr error\n\t)\n\n\tif len(ifile) == 0 { // all files that match datval filter will be processed\n\t\tgLog.Warning.Printf(\"All data files of the directory %s will be uploaded\", idir)\n\t\tif files, err = utils.ReadDirectory(idir, datval); err == nil {\n\t\t\treturn files, err\n\t\t}\n\t}\n\n\tif ranges = strings.Split(ifile, \"...\"); len(ranges) > 1 { // input files range ex: 001...020\n\n\t\ts, err1 := strconv.Atoi(ranges[0])\n\t\te, err2 := strconv.Atoi(ranges[1])\n\t\tif s > e {\n\t\t\tgLog.Fatal.Println(\"End suffix must be higher or equal to start prefix\")\n\t\t}\n\t\tif err1 != nil || err2 != nil {\n\t\t\tgLog.Fatal.Println(\"Suffix must be numeric\")\n\t\t}\n\t\tdf := \"%0\" + strconv.Itoa(len(ranges[0])) + \"d\"\n\n\t\tfor i := s; i <= e; i++ {\n\t\t\tk := fmt.Sprintf(df, i)\n\t\t\tfiles = append(files, datval+k)\n\t\t}\n\n\t} else {\n\t\t// input files separated by a comma\n\t\tfor _,v := range strings.Split(ifile, \",\") {\n\t\t\tfiles= append(files,datval+v)\n\t\t}\n\t}\n\treturn files,err\n}", "title": "" }, { "docid": "c0f26612cd365454ee43d7e64ca0a2f4", "score": "0.56218785", "text": "func baseDoFile(state *lua.State) int {\n\tvar (\n\t\tfile = state.OptString(1, \"\")\n\t\tsrc interface{} = nil\n\t)\n\tstate.SetTop(1)\n\tif file == \"\" {\n\t\tfile = \"stdin\"\n\t\tsrc = os.Stdin\n\t}\n\tif err := state.LoadChunk(file, src, 0); err != nil {\n\t\tpanic(err)\n\t}\n\tstate.Call(0, lua.MultRets)\n\treturn state.Top() - 1\n}", "title": "" }, { "docid": "7bf1a8eddcf5214c8cafec0f8e0314a5", "score": "0.561859", "text": "func inputToFuncToStdout(fn func([]byte) (interface{}, error), it InputType) {\n\tfp, input, err := (*os.File)(nil), []byte{}, error(nil)\n\n\tswitch it {\n\tcase INPUT_STDIN:\n\t\tfp = os.Stdin\n\n\tcase INPUT_FILEARG:\n\t\tfp, err = os.Open(os.Args[1])\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\tcase INPUT_CONSTANT:\n\t\tinput = []byte(FAKE_INPUT)\n\n\t// No Input\n\tdefault:\n\t\t//log.Println(\"No input\")\n\t}\n\n\tif fp != nil {\n\t\t// Read all of input from file pointer\n\t\tinput, err = ioutil.ReadAll(fp)\n\t\tif err != nil {\n\t\t\tfp.Close()\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfp.Close()\n\t}\n\n\t// Call fn with input\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tlog.Fatalf(\"Panic while running fn\\n\"+\n\t\t\t\t\"Input: %#v\\n\"+\n\t\t\t\t\"Error: %v\\n\", string(input), r)\n\t\t}\n\t}()\n\trv, err := fn(input)\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// Print result to stdout\n\tfmt.Println(rv)\n}", "title": "" }, { "docid": "7be29ebe2cb610c1b20e79931f4f2c21", "score": "0.5553551", "text": "func doMap(\n\tjobName string, // the name of the MapReduce job\n\tmapTaskNumber int, // which map task this is\n\tinFile string,\n\tnReduce int, // the number of reduce task that will be run (\"R\" in the paper)\n\tmapF func(file string, contents string) []KeyValue,\n) {\n\t//1.Read the input file\n\t//2.Call mapF(user-defined) split the input file into Key/Value pairs\n\t//3.Iterate the Key/Value pairs nReduce time\n\t// 3.1 Create nReduce intermediate files\n\t// 3.2 Hash the Key to get the corrsponding file\n\t// 3.3 Serialize the Key/Value pairs into corresponding intermediate file by json\n\tfile, err := os.Open(inFile)\n\tdebug(\"DEBUG[doMap]: JobName:%s, mapTaskNumber:%d, File:%s, reduceTask:%d\\n\", \n\t\t\tjobName, mapTaskNumber, inFile, nReduce);\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR[doMap]: Open file error \", err);\n\t}\n\tfileInfo, err := file.Stat()\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR[doMap]: Get file state error \", err);\n\t}\n\n\t//create a buffer, read the file into buffer\n\t//buffer is used to send argument for mapF\n\tfileSize := fileInfo.Size()\n\tbuffer := make([]byte, fileSize)\n\t_, err = file.Read(buffer)\n\tdebug(\"DEBUG[doMap]: Read from %s %dbyte\\n\", inFile, fileSize)\n\tif err != nil {\n\t\tlog.Fatal(\"ERROR[doMap]:Read error \", err)\n\t}\n\n\t//mapF is a user-defined function to process the data\n\t//it will return a middle result\n\tmiddle_res := mapF(inFile, string(buffer))\n\trSize := len(middle_res)\n\tdebug(\"DEBUG[doMap]: Map result pair size %d\\n\", rSize)\n\tfile.Close()\n\n\tfor i := 0; i < nReduce; i++ {\n\t\t//create an intermediate file according to [1]jobName [2]mapTaskNumber [3]i\n\t\tfileName := reduceName(jobName, mapTaskNumber, i)\n\t\tdebug(\"DEBUG[doMap]: Map intermediate filename: %s\\n\", fileName)\n\t\tmid_file, err := os.Create(fileName)\n\t\tif err != nil {\n\t\t\tlog.Fatal(\"ERROR[doMap]: Create intermediate file fail \", err)\n\t\t}\n\t\t//create an encoder for the middle file\n\t\t//encode each key/value pairs in middle_res into the intermediate file(mid_file)\n\t\tenc := json.NewEncoder(mid_file)\n\t\tfor r:=0;r<rSize;r++ {\n\t\t\tkv := middle_res[r]\n\t\t\t//hash the Key to determine which intermediate file it is located.\n\t\t\t//pairs with same Key will store in the same intermediate file\n\t\t\tif ihash(kv.Key) % uint32(nReduce) == uint32(i) {\n\t\t\t\terr := enc.Encode(&kv)\n\t\t\t\tif err != nil {\n\t\t\t\t\tlog.Fatal(\"ERROR[doMap]: Encode error: \", err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tmid_file.Close()\n\t}\n}", "title": "" }, { "docid": "781feb5788adae5f1759acb4381b6be3", "score": "0.5519974", "text": "func readInput(filename string) []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(filename + \".txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "781feb5788adae5f1759acb4381b6be3", "score": "0.5519974", "text": "func readInput(filename string) []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(filename + \".txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "781feb5788adae5f1759acb4381b6be3", "score": "0.5519974", "text": "func readInput(filename string) []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(filename + \".txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "781feb5788adae5f1759acb4381b6be3", "score": "0.5519974", "text": "func readInput(filename string) []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(filename + \".txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "7284b463b63d216b0c7b6d5a4b3ffd7f", "score": "0.55175364", "text": "func processFile(filename string, in io.Reader, out io.Writer, stdin bool, opts Options) error {\n\tif in == nil {\n\t\tf, err := os.Open(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer f.Close()\n\t\tin = f\n\t}\n\n\tsrc, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tres, err := printer.Format(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"In %s: %s\", filename, err)\n\t}\n\n\tif !bytes.Equal(src, res) {\n\t\t// formatting has changed\n\t\tif opts.List {\n\t\t\tfmt.Fprintln(out, filename)\n\t\t}\n\t\tif opts.Write {\n\t\t\terr = ioutil.WriteFile(filename, res, 0644)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif opts.Diff {\n\t\t\tdata, err := diff(src, res)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"computing diff: %s\", err)\n\t\t\t}\n\t\t\tfmt.Fprintf(out, \"diff a/%s b/%s\\n\", filename, filename)\n\t\t\tout.Write(data)\n\t\t}\n\t}\n\n\tif !opts.List && !opts.Write && !opts.Diff {\n\t\t_, err = out.Write(res)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "0108c18c2595aea682f65a4d57953481", "score": "0.54830486", "text": "func fakeStdin(str string) (stdin *os.File, err error) {\n\t// Creates temporary file.\n\tif stdin, err = ioutil.TempFile(os.TempDir(), \"stdin\"); err != nil {\n\t\treturn\n\t}\n\t// Mocks user interaction by writing required string into it.\n\tif _, err = stdin.WriteString(str); err != nil {\n\t\treturn\n\t}\n\t// Opens it in order to scan it as stdin.\n\treturn os.Open(stdin.Name())\n}", "title": "" }, { "docid": "1ec0b234abb6193f770c3da45515950f", "score": "0.54438484", "text": "func getInput(filename string) []string {\n\tlines := []string{}\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif len(lines) < 1 {\n\t\tfmt.Println(\"Input file had no lines.\")\n\t\tos.Exit(1)\n\t}\n\tif debug {\n\t\tinfo(fmt.Sprintf(\"Input file has %d lines / instructions.\", len(lines)))\n\t}\n\treturn lines\n}", "title": "" }, { "docid": "1ec0b234abb6193f770c3da45515950f", "score": "0.54438484", "text": "func getInput(filename string) []string {\n\tlines := []string{}\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\tos.Exit(1)\n\t}\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\tif len(lines) < 1 {\n\t\tfmt.Println(\"Input file had no lines.\")\n\t\tos.Exit(1)\n\t}\n\tif debug {\n\t\tinfo(fmt.Sprintf(\"Input file has %d lines / instructions.\", len(lines)))\n\t}\n\treturn lines\n}", "title": "" }, { "docid": "ae094cdfe65eedbdea32d8d4a17e8691", "score": "0.54323536", "text": "func fileReadMethod1(fileList []string, count map[string]int) {\n\n\tfmt.Printf(\"== FILE READ: METHOD 1 ==\\n\")\n\tfor _, file := range fileList {\n\t\tfmt.Printf(\"Reading file: %s\\n\", file)\n\t\tf, err := os.Open(file)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Failed to open the file: %v\\n\", err)\n\t\t\tcontinue\n\t\t}\n\t\tdefer f.Close()\n\t\tinput := bufio.NewScanner(f)\n\t\tfor input.Scan() {\n\t\t\tline := input.Text()\n\t\t\tfmt.Printf(\"Line: %s\\n\", line)\n\t\t\tcount[line]++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "0940cd29608014d17a383b053c2a9184", "score": "0.5430837", "text": "func readInput(filename string) []string {\n\tfile, err := os.Open(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer file.Close()\n\n\tscanner := bufio.NewScanner(file)\n\n\tvar lines []string\n\tfor scanner.Scan() {\n\t\tlines = append(lines, scanner.Text())\n\t}\n\treturn lines\n}", "title": "" }, { "docid": "77e2714f48ea80c5c9d3e76d91aa0ec5", "score": "0.5393471", "text": "func main() {\n\tinput := readFile(\"input.txt\")\n\tfmt.Printf(\"Task1: %v\\n\", task1(input))\n\tinput = readFile(\"input.txt\")\n\tfmt.Printf(\"Task2: %v\\n\", task2(input))\n}", "title": "" }, { "docid": "68d41d31c162f55098c0dce076faa852", "score": "0.53658646", "text": "func main() {\r\n\tfmt.Println(\"Enter the input data file name\")\r\n\tscanner := bufio.NewScanner(os.Stdin)\r\n\tscanner.Scan()\r\n\tinputfile := scanner.Text()\r\n\tif err := scanner.Err(); err != nil {\r\n\t\tfmt.Fprintln(os.Stderr, \"reading standard input:\", err)\r\n\t} else {\r\n\t\tfmt.Println(\"Enter the initial solution file name\")\r\n\t\tscanner.Scan()\r\n\t\tsolutionfile := scanner.Text()\r\n\t\tif err := scanner.Err(); err != nil {\r\n\t\t\tfmt.Fprintln(os.Stderr, \"reading standard input:\", err)\r\n\t\t} else {\r\n\t\t\tfindOptimalTransport(inputfile, solutionfile)\r\n\t\t}\r\n\t}\r\n\r\n}", "title": "" }, { "docid": "f88ca0ec6f83e2f44fa59186fb467581", "score": "0.53582215", "text": "func processFile(tool *Tool, f interface{}) (*File, error) {\n\n\t// if it's already of type File or *File, it requires no processing\n\tif obj, ok := f.(File); ok {\n\t\t// \"reset\" secondaryFiles field to nil\n\t\tobj.SecondaryFiles = nil\n\t\treturn &obj, nil\n\t}\n\tif p, ok := f.(*File); ok {\n\t\t// process a copy of the original file\n\t\t// reset secondaryFiles field to nil\n\t\tfileObj := *p\n\t\tfileObj.SecondaryFiles = nil\n\t\treturn &fileObj, nil\n\t}\n\n\tpath, err := filePath(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// handle the filepath prefix issue\n\t//\n\t// Mapping:\n\t// ---- COMMONS/<guid> -> /commons-data/by-guid/<guid>\n\t// ---- USER/<path> -> /user-data/<path> // not implemented yet\n\t// ---- <path> -> <path> // no path processing required, implies file lives in engine workspace\n\tswitch {\n\tcase strings.HasPrefix(path, commonsPrefix):\n\t\t/*\n\t\t\t~ Path represenations/handling for commons-data ~\n\n\t\t\tinputs.json: \t\t\t\t\"COMMONS/<guid>\"\n\t\t\tmariner: \"/commons-data/data/by-guid/<guid>\"\n\n\t\t\tgen3-fuse mounts those objects whose GUIDs appear in the manifest\n\t\t\tgen3-fuse mounts to /commons-data/data/\n\t\t\tand mounts the directories \"by-guid/\", \"by-filepath/\", and \"by-filename/\"\n\n\t\t\tcommons files can be accessed via the full path \"/commons-data/data/by-guid/<guid>\"\n\n\t\t\tso the mapping that happens in this path processing step is this:\n\t\t\t\"COMMONS/<guid>\" -> \"/commons-data/data/by-guid/<guid>\"\n\t\t*/\n\t\tGUID := strings.TrimPrefix(path, commonsPrefix)\n\t\tpath = strings.Join([]string{pathToCommonsData, GUID}, \"\")\n\t\tlog.Debugf(\"here is the uid path %s\", path)\n\tcase strings.HasPrefix(path, userPrefix):\n\t\t/*\n\t\t\t~ Path representations/handling for user-data ~\n\n\t\t\ts3: \t\t\t \"/userID/path/to/file\"\n\t\t\tinputs.json: \t \"USER/path/to/file\"\n\t\t\tmariner: \t\t\"/engine-workspace/path/to/file\"\n\n\t\t\tuser-data bucket gets mounted at the 'userID' prefix to dir /engine-workspace/\n\n\t\t\tso the mapping that happens in this path processing step is this:\n\t\t\t\"USER/path/to/file\" -> \"/engine-workspace/path/to/file\"\n\t\t*/\n\t\ttrimmedPath := strings.TrimPrefix(path, userPrefix)\n\t\tpath = strings.Join([]string{\"/\", engineWorkspaceVolumeName, \"/\", trimmedPath}, \"\")\n\n\tcase strings.HasPrefix(path, conformancePrefix):\n\t\ttrimmedPath := strings.TrimPrefix(path, conformancePrefix)\n\t\tpath = strings.Join([]string{\"/\", conformanceVolumeName, \"/\", trimmedPath}, \"\")\n\t}\n\treturn fileObject(path), nil\n}", "title": "" }, { "docid": "1bad23b659ca326e0e8cbb83aa770794", "score": "0.5356227", "text": "func ResolveInputData(cmd *cobra.Command) string {\n\tfileName, _ := cmd.Flags().GetString(\"file\")\n\tif fileName != \"\" {\n\t\treturn ConvertFileJSON(fileName)\n\t}\n\tfor _, command := range cmd.Commands() {\n\t\tfileName, _ := command.Flags().GetString(\"file\")\n\t\tif fileName != \"\" {\n\t\t\treturn ConvertFileJSON(fileName)\n\t\t}\n\t}\n\n\treturn ConvertStdInString()\n}", "title": "" }, { "docid": "9aeabddd35dd845f788a8f98af73a80a", "score": "0.5351752", "text": "func readInputFile() []string {\n\t//check for file argument\n\tif len(os.Args) < 2 {\n\t\terr := errors.New(\"Missing required argument! Please provide file containing list of urls!\")\n panic(err)\n }\n\n //read file\n data, err := ioutil.ReadFile(os.Args[1])\n if err != nil {\n panic(err)\n }\n\n //check if data exists\n if len(data) == 0 {\n \terr := errors.New(\"File of urls does not contain any data.\")\n panic(err)\n }\n\n //make into list to iterate later\n urlList := strings.Split(string(data), \"\\n\")\n return urlList\n}", "title": "" }, { "docid": "f3881476903db067e60f7842ad1c08eb", "score": "0.53418773", "text": "func mockInput(fs afero.Fs, assert *require.Assertions, input string) afero.File {\n\ttmp, err := afero.TempFile(fs, \"\", \"\")\n\tassert.NoError(err)\n\n\t_, err = tmp.WriteString(input)\n\tassert.NoError(err)\n\n\t_, err = tmp.Seek(0, os.SEEK_SET)\n\tassert.NoError(err)\n\n\treturn tmp\n}", "title": "" }, { "docid": "86d5bce8490453589bba828c36d31218", "score": "0.5339017", "text": "func Stdin() *os.File {\n\tstdin := os.Stdin\n\tif panicwrap.Wrapped(nil) {\n\t\tstdin = wrappedStdin\n\t}\n\n\treturn stdin\n}", "title": "" }, { "docid": "fb4ca08af1bd9d5604ecb5ea01f60069", "score": "0.5335596", "text": "func testInputParams() error {\n\t//rft (i) (infArc) \"описание архива\" \"notepad++ %1\" \"c:\\windows\\ShellNew\\(arcInfo).(i)\"\n\t//0 1 2 3 4 5\n\tif len(os.Args) < 2 {\n\t\treturn errors.New(\"required 4 parameters\")\n\t}\n\tif !xLib.StrIsPrintRune(os.Args[1]) {\n\t\treturn errors.New(\"1 arg: '\" + os.Args[1] + \"' contain non printable symbols!\")\n\t}\n\tif xLib.StrContainBackSlash(os.Args[1]) {\n\t\treturn errors.New(\"1 arg: '\" + os.Args[1] + \"' contain symbols '\\\\'\")\n\t}\n\tif !xLib.StrIsPrintRune(os.Args[2]) {\n\t\treturn errors.New(\"2 arg: '\" + os.Args[2] + \"' contain non printable symbols!\")\n\t}\n\tif xLib.StrContainBackSlash(os.Args[2]) {\n\t\treturn errors.New(\"2 arg: '\" + os.Args[2] + \"' contain symbols '\\\\'\")\n\t}\n\tif !xLib.StrIsPrintRune(os.Args[3]) {\n\t\treturn errors.New(\"3 arg: '\" + os.Args[3] + \"' contain non printable symbols!\")\n\t}\n\tif xLib.StrContainBackSlash(os.Args[3]) {\n\t\treturn errors.New(\"3 arg: '\" + os.Args[3] + \"' contain symbols '\\\\'\")\n\t}\n\n\tif len(os.Args) > 5 {\n\t\ttestFile, err := os.Open(os.Args[5]) //Open file to READ\n\t\tdefer testFile.Close()\n\t\tif err != nil {\n\t\t\treturn errors.New(\"Attantion file: \" + os.Args[5] + \" can't open to read!\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f3afadb4f5b25cf58a1686542124dd0d", "score": "0.53270674", "text": "func (f *fakeLocalFiles) mustInput(ctx context.Context, t *testing.T, fc fpb.FileServiceClient, fullpath, fname string) *gomapb.ExecReq_Input {\n\tdata := f.m[fullpath]\n\tinput := &gomapb.ExecReq_Input{\n\t\tFilename: proto.String(fname),\n\t\tContent: &gomapb.FileBlob{\n\t\t\tFileSize: proto.Int64(int64(len(data))),\n\t\t},\n\t}\n\terr := file.FromReader(ctx, fc, strings.NewReader(data), input.Content)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to read file %s: %v\", fullpath, err)\n\t}\n\thashKey, err := hash.SHA256Proto(input.Content)\n\tif err != nil {\n\t\tt.Fatalf(\"failed to compute sha256 %s: %v\", fullpath, err)\n\t}\n\tinput.HashKey = proto.String(hashKey)\n\tif fc == nil {\n\t\tinput.Content = nil\n\t}\n\treturn input\n}", "title": "" }, { "docid": "59d9e9f563d7f4412cc27663d21fbdcd", "score": "0.5324686", "text": "func processIntelInputFiles(args *intelArgs) error {\n\tif args.Filepaths.ExcludedSrcs != \"\" {\n\t\tlist, err := config.GetListFromFile(args.Filepaths.ExcludedSrcs)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse the exclude file: %v\", err)\n\t\t}\n\t\targs.Excluded.InsertMany(list...)\n\t}\n\tif args.Filepaths.IncludedSrcs != \"\" {\n\t\tlist, err := config.GetListFromFile(args.Filepaths.IncludedSrcs)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"Failed to parse the include file: %v\", err)\n\t\t}\n\t\targs.Included.InsertMany(list...)\n\t}\n\tif len(args.Filepaths.Domains) > 0 {\n\t\tfor _, f := range args.Filepaths.Domains {\n\t\t\tlist, err := config.GetListFromFile(f)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to parse the domain names file: %v\", err)\n\t\t\t}\n\n\t\t\targs.Domains.InsertMany(list...)\n\t\t}\n\t}\n\tif len(args.Filepaths.Resolvers) > 0 {\n\t\tfor _, f := range args.Filepaths.Resolvers {\n\t\t\tlist, err := config.GetListFromFile(f)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"Failed to parse the resolver file: %v\", err)\n\t\t\t}\n\n\t\t\targs.Resolvers.InsertMany(list...)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "57f90e7eb8020b67aa17077cbc9f7424", "score": "0.5301349", "text": "func main() {\r\n\tvar doRun bool = true\r\n\tscanner := bufio.NewReader(os.Stdin)\r\n\r\n\tintro()\r\n\r\n\tfor doRun {\r\n\t\tfmt.Print(\"(C)reate file, (V)iew file, (D)elete file, (Q)uit? \")\r\n\r\n\t\tuserInput, _ := scanner.ReadString('\\n')\r\n\t\t//c\\n\r\n\t\tuserInput = strings.TrimSpace(userInput)\r\n\t\t//c\\n\r\n\t\tuserInput = strings.ToUpper(userInput)\r\n\t\t//C\r\n\r\n\t\t// var userInput string\r\n\t\t// fmt.Scanln(&userInput)\r\n\t\t// userInput = strings.ToUpper(userInput)\r\n\r\n\t\tif userInput == \"C\" {\r\n\t\t\twriteFile(scanner)\r\n\t\t} else if userInput == \"V\" {\r\n\t\t\treadFile(scanner)\r\n\t\t} else if userInput == \"D\" {\r\n\t\t\tdeleteFile(scanner)\r\n\t\t} else if userInput == \"Q\" {\r\n\t\t\tdoRun = false\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "1393b16cf45780191f31ea88736d41ee", "score": "0.5291392", "text": "func (tool *Tool) processFile(f interface{}) (file *File, err error) {\n\tobj, err := processFile(tool, f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif strings.HasPrefix(obj.Path, commonsPrefix) {\n\n\t\terr = appendCommonsFileInfo(obj.Path, tool)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if !strings.HasPrefix(obj.Path, pathToCommonsData) {\n\n\t\t// user files\n\t\ttool.S3Input = append(tool.S3Input, &ToolS3Input{\n\t\t\tPath: obj.Path,\n\t\t\tInitWorkDir: false,\n\t\t})\n\n\t}\n\n\t// note: I don't think any input to this process will have secondary files loaded\n\t// into this field at this point in the process\n\tfor _, sf := range obj.SecondaryFiles {\n\t\tif strings.HasPrefix(sf.Path, commonsPrefix) {\n\t\t\terr = appendCommonsFileInfo(obj.Path, tool)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t} else if !strings.HasPrefix(sf.Path, pathToCommonsData) {\n\t\t\ttool.S3Input = append(tool.S3Input, &ToolS3Input{\n\t\t\t\tPath: sf.Path,\n\t\t\t\tInitWorkDir: false,\n\t\t\t})\n\t\t}\n\t}\n\treturn obj, nil\n}", "title": "" }, { "docid": "0ead50c734d860528fb32073734a2d73", "score": "0.52847695", "text": "func readFromStdinOrReadFromArgument(fileArg, defaultFileName string) (fileName string, reader io.Reader, err error) {\n\tif fileArg == \"-\" {\n\t\tfileName = defaultFileName\n\t\treader = os.Stdin\n\t} else {\n\t\tfileName = filepath.Base(fileArg)\n\t\treader, err = os.OpenFile(fileArg, os.O_RDONLY, 0755)\n\t\tif err != nil {\n\t\t\treturn fileName, nil, err\n\t\t}\n\t}\n\n\treturn fileName, reader, err\n}", "title": "" }, { "docid": "7404a38aa0b32980d568eb6d195820f7", "score": "0.5264067", "text": "func InputData(InputFileName string) (url string,depth int64) {\n\n InputFile, ERROR1 := os.Open(InputFileName)\n if ERROR1 != nil {\n fmt.Println(\"Error opening input file.\",ERROR1)\n }\n\n Iterator := bufio.NewScanner(InputFile)\n \n var InputData [2]string\n var i int = 0\n\n for Iterator.Scan() {\n InputData[i] = Iterator.Text()\n i++\n }\n\n url = InputData[0]\n depth,_ = strconv.ParseInt(InputData[1],10,64)\n\n return\n}", "title": "" }, { "docid": "4c54889a7bec35627989e457ef812a0c", "score": "0.5259071", "text": "func readInput(input io.Reader) ([]byte, error) {\n\t// If the given reader is providing a stat information (ie os.Stdin)\n\t// then check if the data is being piped. That should prevent us from\n\t// waiting for a data on a reader that no one ever writes to.\n\tif s, ok := input.(stater); ok {\n\t\tif info, err := s.Stat(); err == nil {\n\t\t\tisPipe := (info.Mode() & os.ModeCharDevice) == 0\n\t\t\tif !isPipe {\n\t\t\t\treturn nil, errNoPipe\n\t\t\t}\n\t\t}\n\t}\n\treturn ioutil.ReadAll(input)\n}", "title": "" }, { "docid": "f7c6406a2dd7cfc80cdfefab7259a7c8", "score": "0.52561843", "text": "func readInput(fileName string) (*rtd.Invocation, error) {\n\tdata, err := ioutil.ReadFile(fileName)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to read file %v: %v\", fileName, err)\n\t}\n\tinv, err := unmarshalInvocation(data)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"fail to unmarshal file %v: %v\", fileName, err)\n\t}\n\treturn inv, nil\n}", "title": "" }, { "docid": "7b2e6d9e393d83eb4a87cbbe904ed352", "score": "0.5223276", "text": "func parseInput(file *os.File) []core.QueryDoer {\n\tr := bufio.NewReader(file)\n\n\t// \"The first line contains a single integer, q, denoting the number of queries.\"\n\tx, _ := r.ReadString('\\n') // TODO check error\n\tx = strings.TrimSuffix(x, \"\\n\")\n\tq, _ := strconv.Atoi(x) // TODO check error\n\n\tvar queries = make([]core.QueryDoer, q)\n\tvar err error\n\n\tfor i := 0; i < q; i++ {\n\t\ts, _ := r.ReadString('\\n') // TODO check error\n\t\tqueries[i], err = convertToQuery(s)\n\t\tif err != nil {\n\t\t\tpanic(fmt.Sprintf(\"input line %d: %s\", i+1, err.Error()))\n\t\t}\n\t}\n\n\treturn queries\n}", "title": "" }, { "docid": "350ff2887cb5161e97e7c494e7e47738", "score": "0.5223229", "text": "func TestInput(t *testing.T) {\n\tvar inputTests = []struct {\n\t\tcontent string\n\t\tindent int\n\t\texpected string\n\t}{\n\t\t{\"trololo\\n lololo\\n lololo\\n\\n\", 1, \" trololo\\n lololo\\n lololo\\n \\n\"},\n\t\t{\"trololo\\n lololo\\n lololo\\n\\n\", 2, \" trololo\\n lololo\\n lololo\\n \\n\"},\n\t}\n\n\tfor tc, tt := range inputTests {\n\t\tin, err := ioutil.TempFile(\"\", \"\")\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tdefer in.Close()\n\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t_, err = io.WriteString(in, tt.content)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\t_, err = in.Seek(0, os.SEEK_SET)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\n\t\tresult := getInput(in, tt.indent)\n\n\t\tif result != tt.expected {\n\t\t\tt.Errorf(\"\\\"%s\\\" is not equal to \\\"%s\\\" in test case %d\", result, tt.expected, tc+1)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "5887c8a319e6c2e98faf2b2530b8a53d", "score": "0.5222239", "text": "func processOutput(t *testing.T, f *os.File) []string {\n\tbuffer, err := os.ReadFile(f.Name())\n\tif err != nil {\n\t\tt.Fatalf(\"ReadFile() failed: %v\", err)\n\t}\n\tscanner := bufio.NewScanner(bytes.NewReader(buffer))\n\tresult := make([]string, 0)\n\tfor scanner.Scan() {\n\t\tresult = append(result, scanner.Text())\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\tt.Fatalf(\"Scanning output file failed: %v\", err)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "bf6618a406b3df463354a130219ca7c8", "score": "0.5218316", "text": "func ReadInputStreamBuffer(reader *bufio.Reader) ([]gpsabl.InputFile, error) {\n\tvar fileArgs []gpsabl.InputFile\n\tvar inputBytes []byte\n\tfor {\n\t\tinput, errRead := reader.ReadByte()\n\t\tif errRead != nil {\n\t\t\tif errRead == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn nil, errRead\n\t\t\t}\n\t\t}\n\n\t\tinputBytes = append(inputBytes, input)\n\t}\n\n\tbuffers := getXMlFileBuffersFromInputStream(inputBytes)\n\n\tif len(buffers) != 0 {\n\t\t// fmt.Fprintln(os.Stdout, fmt.Sprintf(\"Got %d input files as stream\", len(buffers)))\n\n\t\tfor i, buffer := range buffers {\n\t\t\tres, input := gpsabl.GetInputFileFromBuffer(ValidReaders, buffer, fmt.Sprintf(\"Input stream buffer %d\", i+1))\n\t\t\tif res == true {\n\t\t\t\tfileArgs = append(fileArgs, input)\n\t\t\t}\n\t\t}\n\t\tif len(fileArgs) != 0 && VerboseFlag {\n\t\t\tfmt.Fprintln(os.Stdout, fmt.Sprintf(\"Got %d files as stream\", len(fileArgs)))\n\t\t}\n\t\treturn fileArgs, nil\n\t}\n\n\tfileArgsStr, errProcFileName := getFilePathFromInputStream(inputBytes)\n\tif errProcFileName != nil {\n\t\treturn nil, errProcFileName\n\t}\n\n\tfor _, fileArgStr := range fileArgsStr {\n\t\tres, input := gpsabl.GetInputFileFromPath(ValidReaders, fileArgStr)\n\t\tif res == true {\n\t\t\tfileArgs = append(fileArgs, input)\n\t\t} else {\n\t\t\treturn nil, newUnKnownFileTypeError(fileArgStr)\n\t\t}\n\t}\n\n\treturn fileArgs, nil\n}", "title": "" }, { "docid": "a3a0f45a9ca9ab95016f0d6c644e3575", "score": "0.5201157", "text": "func readInput() []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "a3a0f45a9ca9ab95016f0d6c644e3575", "score": "0.5201157", "text": "func readInput() []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "a3a0f45a9ca9ab95016f0d6c644e3575", "score": "0.5201157", "text": "func readInput() []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "a3a0f45a9ca9ab95016f0d6c644e3575", "score": "0.5201157", "text": "func readInput() []string {\n\n\tvar input []string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput = append(input, scanner.Text())\n\t}\n\treturn input\n}", "title": "" }, { "docid": "3c34175e457d1070f0331d57f833297f", "score": "0.5197813", "text": "func filenamesFromCommandLine() (inname, outname string, err error) {\n\tif len(os.Args) > 1 && (os.Args[1] == \"-h\" || os.Args[1] == \"--help\") {\n\t\terr = fmt.Errorf(\"usage: %s [<]infile.txt [>]outfile.txt\",\n\t\t\tfilepath.Base(os.Args[0]))\n\t\treturn \"\", \"\", err\n\t}\n\tif len(os.Args) > 1 {\n\t\tinname = os.Args[1]\n\t\tif len(os.Args) > 2 {\n\t\t\toutname = os.Args[2]\n\t\t}\n\t}\n\tif inname != \"\" && inname == outname {\n\t\tlog.Fatal(\"cannot overwrite the same file\")\n\t}\n\treturn inname, outname, nil\n}", "title": "" }, { "docid": "89037a1f71d6331e2088c974519df5bd", "score": "0.518471", "text": "func openFiles(args []string) (*bufio.Reader, *os.File) {\n\tvar reader *bufio.Reader\n\tvar out = os.Stdout\n\n\tif len(args) == 0 {\n\t\treturn bufio.NewReader(os.Stdin), out\n\t}\n\n\tif len(args) > 1 {\n\t\tf, err := os.OpenFile(args[1],\n\t\t\tos.O_CREATE|os.O_WRONLY|os.O_TRUNC,\n\t\t\tos.FileMode(0666))\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Error: %v\\n\", err)\n\t\t}\n\t\tout = f\n\t}\n\n\tf, err := os.Open(args[0])\n\tif err != nil {\n\t\tlog.Fatalf(\"Error: %v\\n\", err)\n\t}\n\treader = bufio.NewReader(f)\n\n\treturn reader, out\n}", "title": "" }, { "docid": "345404d5c0f4e11d38f8d389ec234878", "score": "0.51792246", "text": "func ProcessInput(f io.Reader) (inputs [][]string, err error) {\n\n\tscanner := bufio.NewScanner(f)\n\tscanner.Split(bufio.ScanLines)\n\n\tfor scanner.Scan() {\n\t\tinputs = append(inputs, strings.Split(scanner.Text(), \" \"))\n\t}\n\n\tif err = scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "76c7e65bcac3db82bd4597b02ece17bf", "score": "0.51689035", "text": "func main() {\n\tinputToFuncToStdout(DataRecovery, INPUT_FILEARG)\n}", "title": "" }, { "docid": "34870176939235cb7871cea5f2f5df69", "score": "0.5166673", "text": "func main() {\n\tfmt.Printf(\"Counting duplicate words:\\n\")\n\n\tfileList := os.Args[1:]\n\tcount := make(map[string]int)\n\n\tfileReadMethod1(fileList, count)\n\tfmt.Printf(\"Result1:\\n%v\\n\\n\", count)\n\n\tresetCount(count)\n\n\tfileReadMethod2(fileList, count)\n\tfmt.Printf(\"Result2:\\n%v\\n\\n\", count)\n}", "title": "" }, { "docid": "4ced2846d3bafe65f6e09fd268821281", "score": "0.5144197", "text": "func reset(ctx *Context, f *pasFile, componentSize int, name, mode string) {\n\tname = strings.TrimRight(name, \" \")\n\tif !strings.Contains(mode, modeNoIOPanic) {\n\t\tpanic(fmt.Errorf(\"unsupported file mode: %q (%q)\", mode, name))\n\t}\n\n\tf.close()\n\tf.ioFile = nil\n\tif name == stdioDev {\n\t\tif isMain {\n\t\t\tf.ioFile = &ioFile{\n\t\t\t\teof: false,\n\t\t\t\terstat: 0,\n\t\t\t\tcomponentSize: componentSize,\n\t\t\t\tname: os.Stdin.Name(),\n\t\t\t\tin: os.Stdin, //TODO bufio\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\tfname := os.Stdin.Name()\n\t\tif f, ok := ctx.stdin.(interface{ Name() string }); ok {\n\t\t\tfname = f.Name()\n\t\t}\n\n\t\tf.ioFile = &ioFile{\n\t\t\teof: false,\n\t\t\terstat: 0,\n\t\t\tcomponentSize: componentSize,\n\t\t\tname: fname,\n\t\t\tin: ctx.stdin,\n\t\t}\n\t\treturn\n\t}\n\n\tg, err := os.Open(name)\nok:\n\tswitch {\n\tcase err != nil:\n\t\tswitch {\n\t\tcase name == texPool:\n\t\t\tf.ioFile = &ioFile{\n\t\t\t\teof: false,\n\t\t\t\terstat: 0,\n\t\t\t\tcomponentSize: componentSize,\n\t\t\t\tname: name,\n\t\t\t\tin: readCloser{strings.NewReader(assets[\"/tex.pool\"])},\n\t\t\t}\n\t\t\tbreak ok\n\t\tcase strings.HasPrefix(name, texArea):\n\t\t\tif s, ok := assets[\"/texinputs/\"+name[len(texArea):]]; ok {\n\t\t\t\tf.ioFile = &ioFile{\n\t\t\t\t\teof: false,\n\t\t\t\t\terstat: 0,\n\t\t\t\t\tcomponentSize: componentSize,\n\t\t\t\t\tname: name,\n\t\t\t\t\tin: readCloser{strings.NewReader(s)},\n\t\t\t\t}\n\t\t\t\tbreak ok\n\t\t\t}\n\t\tcase strings.HasPrefix(name, texFontArea):\n\t\t\tif s, ok := assets[\"/texfonts/\"+name[len(texFontArea):]]; ok {\n\t\t\t\tf.ioFile = &ioFile{\n\t\t\t\t\teof: false,\n\t\t\t\t\terstat: 0,\n\t\t\t\t\tcomponentSize: componentSize,\n\t\t\t\t\tname: name,\n\t\t\t\t\tin: readCloser{strings.NewReader(s)},\n\t\t\t\t}\n\t\t\t\tbreak ok\n\t\t\t}\n\t\t}\n\n\t\tf.ioFile = &ioFile{\n\t\t\terstat: 1,\n\t\t\tcomponentSize: componentSize,\n\t\t\tname: name,\n\t\t}\n\t\treturn\n\tdefault:\n\t\tf.ioFile = &ioFile{\n\t\t\teof: false,\n\t\t\terstat: 0,\n\t\t\tcomponentSize: componentSize,\n\t\t\tname: name,\n\t\t\tin: g, //TODO bufio\n\t\t}\n\t}\n\n\tif _, err := io.ReadFull(f.ioFile.in, f.ioFile.component[:f.ioFile.componentSize]); err != nil {\n\t\tf.ioFile.eof = true\n\t\tf.ioFile.erstat = 1\n\t\tf.ioFile.in.Close()\n\t}\n}", "title": "" }, { "docid": "88a09d6feb1733079553bd6f1d6b7fc9", "score": "0.51438123", "text": "func readInput() (src string) {\n\tflag.Parse()\n\tsrc = strings.Join(flag.Args(),\"\")\n\treturn src\n}", "title": "" }, { "docid": "cfb734e6891e37d9ccc4fc312de3d64e", "score": "0.5129166", "text": "func FileComponent (in <-chan Job, out chan<- Job) {\n handleError := func (job Job, err error) {\n job.SetResponseCode(http.StatusBadRequest)\n job.SetResult(err)\n out <- job\n }\n\n for job := range in {\n // Check if a path is provided\n path, ok := job.GetResult().(string)\n if (!ok) {\n job.SetResult(errors.New(\n \"No path provided to FileComponent.\"))\n out <- job\n continue\n }\n\n // Check if a file with the given path exists\n if _, err := os.Stat(path); os.IsNotExist(err) {\n handleError(job, err)\n continue\n }\n\n // Try to open the file\n file, err := os.Open(path)\n if (err != nil) {\n handleError(job, err)\n continue\n }\n\n job.SetResult(file)\n out <- job \n }\n close(out)\n}", "title": "" }, { "docid": "285c13ad34d576f2257440e0d6e54da5", "score": "0.5105165", "text": "func (c *gqlcCmd) parseInputFiles(fs afero.Fs, dset *token.DocSet, docs map[string]*ast.Document, filenames ...string) error {\n\tfor _, filename := range filenames {\n\t\tname := filepath.Base(filename)\n\t\tif _, exists := docs[name]; exists {\n\t\t\tcontinue\n\t\t}\n\n\t\tzap.L().Info(\"opening input\", zap.String(\"name\", filename))\n\t\tf, err := c.openFile(filename, fs)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer f.Close()\n\n\t\tdoc, err := parser.ParseDoc(dset, name, f, parser.ParseComments)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tdocs[name] = doc\n\t}\n\n\tfor _, doc := range docs {\n\t\timports := getImports(doc)\n\t\timports = filter(imports, docs, fs, c.cfg.ipaths)\n\t\tif len(imports) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\terr := c.parseInputFiles(fs, dset, docs, imports...)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0bdee0dbb206a5ed99eb79e3230e559e", "score": "0.5095114", "text": "func main() {\n\tinput, err := readInput()\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\tpart1(input)\n\tpart2_2(input)\n}", "title": "" }, { "docid": "d7472b4da2292d09515aefa6f1abde81", "score": "0.50652415", "text": "func runWithMultiplePayload(payloads string) {\n\n fmt.Println(White + \"[\" + Blue + \"~\" + White + \"] Searching for URL(s)\")\n fmt.Println(White + \"[\" + Green+ \"~\" + White + \"]\" + Red + \" Multiple Payloads\")\n fmt.Println(White + \"========================================================================================\\n\")\n\n fmt.Println(\"Status Code\\tBytes\\t\\tURL\")\n fmt.Println(\"-----------\\t-----\\t\\t---\\n\")\n\n\n \t\n // Create the 'NewScanner' object and print each line in the file\n scanner := bufio.NewScanner(os.Stdin)\n for scanner.Scan() {\n\n\tfile,err := os.Open(payloads)\n \tif err != nil {\n \tlog.Fatal(err)\n \t}\n\n\n\n \t// Parse the URL\n \tu,err := url.Parse(scanner.Text())\n \tif err != nil{\n \t\tlog.Fatal(err)\n \t}\n \t// Fetch the URL Values\n\tqs := url.Values{}\n\n\n\n\t// Generate a unique UUID for the folder\n\tuID, err := uuid.NewV4()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t\n\t// Create the Unique Folder\n\terrDir := os.Mkdir(\"output/\"+uID.String(), 0755)\n\tif errDir != nil {\n\t\tlog.Fatal(errDir)\n\t}\t\n\n\t// Create the response file\n f,err := os.Create(\"output/\"+uID.String()+\"/responses.txt\")\n if err != nil {\n \tlog.Fatal(err)\n }\n\n // Dump the response\n resp,err := http.Get(scanner.Text())\n \tif err != nil {\n \t\tlog.Fatal(err)\n \t}\n\n \tdump,err := httputil.DumpResponse(resp, true)\n \tif err != nil {\n \t\tlog.Fatal(err)\n \t}\n \tl,err := f.WriteString(string(dump))\n \tif err != nil {\n \tlog.Fatal(err)\n }\n\n\tdefer resp.Body.Close()\t\n\tdefer f.Close()\n\tpL := bufio.NewScanner(file)\n\n for pL.Scan() {\n\n\n // Get the url paraemters and set the newvalue (payload)\n for param,vv := range u.Query() {\n qs.Set(param, vv[0]+pL.Text())\n }\n\n\t\t// Url encoding the url\n \tu.RawQuery = qs.Encode()\n \t// Print the values\n \tfmt.Printf(\"%s\\t\", resp.StatusCode)\n \tfmt.Printf(\"%d Bytes\\t\", l)\n \tfmt.Println(White + \"[\" + Green + \"~\" + White + \"] \" + White + u.String())\n }\n\tdefer file.Close()\n if err := pL.Err(); err != nil {\n log.Fatal(err)\n }\n\n }\n if err := scanner.Err(); err != nil {\n log.Fatal(err)\n }\n}", "title": "" }, { "docid": "3c0e5e684c9a39522b3c535dbf73d9fb", "score": "0.50561106", "text": "func doMap(\n\tjobName string, // the name of the MapReduce job\n\tmapTaskNumber int, // which map task this is\n\tinFile string,\n\tnReduce int, // the number of reduce task that will be run (\"R\" in the paper)\n\tmapF func(file string, contents string) []KeyValue,\n) {\n\t// read input file\n\t// DISCUSSION: which reader to use?\n\tcontents, err := ioutil.ReadFile(inFile)\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\t// calls the user-defined map function (mapF) for that file's contents\n\t// DISCUSSION: bc used ioutil, have to cast contents to string here\n\tresults := mapF(inFile, string(contents))\n\n\t// create + open all intermediate output files ahead of time\n\t// init a json encoder for each open intermediate file\n\t// return map map of filename => encoder\n\tencoders := make(map[string]*json.Encoder)\n\tfor i := 0; i < nReduce; i++ {\n\t\tfileName := reduceName(jobName, mapTaskNumber, i)\n\t\tfile, err := os.OpenFile(fileName, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666) // better way to ensure append?\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tdefer file.Close()\n\n\t\tencoder := json.NewEncoder(file)\n\t\tencoders[fileName] = encoder\n\t}\n\n\t// append each result key to the correct file as json\n\tfor _, kv := range results {\n\t\treduceTaskNumber := int(reduceTask(kv.Key, nReduce))\n\t\toutputFile := reduceName(jobName, mapTaskNumber, reduceTaskNumber)\n\n\t\terr = encoders[outputFile].Encode(&kv)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6d93ad3318ec1b8b19f26616c6ed507e", "score": "0.50530267", "text": "func promptAndReadFilePaths() (string, string) {\n\n\tvar filepaths [2]string\n\n\tfor i := 0; i < 2; i++ {\n\t\tfmt.Printf(\"Filepath %d: \", i+1)\n\t\tscanner := bufio.NewReader(os.Stdin)\n\t\tfilepaths[i], _ = scanner.ReadString('\\n')\n\n\t\t// Remove line ending from filepath\n\t\tfilepaths[i] = strings.TrimSuffix(filepaths[i], \"\\n\")\n\n\t\t// Windows lines are terminated with \\r\\n, so remove \\r too\n\t\tif runtime.GOOS == \"windows\" {\n\t\t\tfilepaths[i] = strings.TrimSuffix(filepaths[i], \"\\r\")\n\t\t}\n\t}\n\n\treturn filepaths[0], filepaths[1]\n}", "title": "" }, { "docid": "91af0c88828ebe6ab7f147f6d7557e83", "score": "0.5036562", "text": "func readInput() string {\n\n\tvar input string\n\n\tf, _ := os.Open(\"input.txt\")\n\tscanner := bufio.NewScanner(f)\n\n\tfor scanner.Scan() {\n\t\tinput += scanner.Text() + \"\\n\"\n\t}\n\treturn input\n}", "title": "" }, { "docid": "5db0781e0326745767e106535ac143fc", "score": "0.5032815", "text": "func (GrootWASM *GrootWASM) getFiles(this js.Value, args []js.Value) interface{} {\n\tfmt.Printf(\"loading fastq file list...\\n\")\n\tfiles := make([]interface{}, len(args))\n\tfor i, val := range args {\n\t\tfiles[i] = val\n\t}\n\tif len(files) != 0 {\n\t\tfmt.Printf(\"\\tadding files ready for WASM\\n\")\n\t\tGrootWASM.fastqFiles = append(GrootWASM.fastqFiles, files...)\n\t} else {\n\t\tfmt.Println(\"no input files found\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "358a0ed1658bf863bee8a569ab435bb5", "score": "0.5031782", "text": "func Stdin(plugs ...plugins.Plugin) io.Reader {\n\tvar ins []io.Reader\n\n\tfor _, p := range plugs {\n\t\tif x, ok := p.(Inner); ok {\n\t\t\tins = append(ins, x.Stdin())\n\t\t}\n\t}\n\n\tif len(ins) == 0 {\n\t\treturn os.Stdin\n\t}\n\treturn io.MultiReader(ins...)\n}", "title": "" }, { "docid": "a2a8b1be39ca8744ffa2b572085a7cfb", "score": "0.5031125", "text": "func getFile() string{\n // Get the file name from the user\n var fileName string\n fmt.Println(\"Ho ho ho, where are the instructions?\")\n fmt.Scanln(&fileName)\n\n // Read the string from a file\n input, err := ioutil.ReadFile(fileName)\n\n handleError(err)\n\n // Convert the input file to a string\n inputString := string(input)\n\n return inputString\n}", "title": "" }, { "docid": "cdd587b4c01bddeb07975520e3adce70", "score": "0.50254273", "text": "func getInputFileName() string {\n\tfmt.Println(\"What is the upload filename?\")\n\tinputFilePath := \"\"\n\tfmt.Scanf(\"%s\", &inputFilePath) // get the input file from user input\n\treturn inputFilePath\n}", "title": "" }, { "docid": "1fdb1c01be59a4d87f4c830e5790b486", "score": "0.49936226", "text": "func doMap(\n\tjobName string, // the name of the MapReduce job\n\tmapTaskNumber int, // which map task this is\n\tinFile string,\n\tnReduce int, // the number of reduce task that will be run (\"R\" in the paper)\n\tmapF func(file string, contents string) []KeyValue,\n) {\n\tfile, err := os.OpenFile(inFile, os.O_RDONLY, 0666)\n\tif err != nil {\n\t\treturn\n\t}\n\tdefer file.Close()\n\tvar content string\n\tvar buf [4096]byte\n\treader := bufio.NewReader(file)\n\t//从指定文件读取内容,交给用户指定的map函数处理,生成对应的map对(从数据源提取数据)操作粒度是文件->map组\n\t//将map对根据指定的规则,分成指定的reduce任务个数\n\t//每个reduce对自己指定的任务,进行文件整合(分散的结果)(分析数据,生成结果),操作粒度是每个key\n\t//master合并所有结果\n\tfor {\n\t\tn, err := reader.Read(buf[:])\n\t\tif err == io.EOF {\n\t\t\tif n != 0 {\n\t\t\t\tcontent += string(buf[0:n])\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tcontent += string(buf[0:n])\n\t}\n\tkvs := mapF(inFile, content)\n\tfm := make(map[string]*os.File)\n\n\tfor _, kv := range kvs {\n\t\treduceNum := int(ihash(kv.Key)) % nReduce\n\t\treduceFileName := reduceName(jobName, mapTaskNumber, reduceNum)\n\t\tfile := fm[reduceFileName]\n\n\t\tif file == nil {\n\t\t\tfile, err = os.OpenFile(reduceFileName, os.O_CREATE|os.O_APPEND, 0666)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tfm[reduceFileName] = file\n\t\t\t//defer file.Close()\n\t\t}\n\t\tenc := json.NewEncoder(file)\n\t\tenc.Encode(kv)\n\n\t}\n\tfor _, rfile := range fm {\n\t\trfile.Close()\n\t}\n\n\t// TODO:\n\t// You will need to write this function.\n\t// You can find the filename for this map task's input to reduce task number\n\t// r using reduceName(jobName, mapTaskNumber, r). The ihash function (given\n\t// below doMap) should be used to decide which file a given key belongs into.\n\t//\n\t// The intermediate output of a map task is stored in the file\n\t// system as multiple files whose name indicates which map task produced\n\t// them, as well as which reduce task they are for. Coming up with a\n\t// scheme for how to store the key/value pairs on disk can be tricky,\n\t// especially when taking into account that both keys and values could\n\t// contain newlines, quotes, and any other character you can think of.\n\t//\n\t// One format often used for serializing data to a byte stream that the\n\t// other end can correctly reconstruct is JSON. You are not required to\n\t// use JSON, but as the output of the reduce tasks *must* be JSON,\n\t// familiarizing yourself with it here may prove useful. You can write\n\t// out a data structure as a JSON string to a file using the commented\n\t// code below. The corresponding decoding functions can be found in\n\t// common_reduce.go.\n\t//\n\t// enc := json.NewEncoder(file)\n\t// for _, kv := ... {\n\t// err := enc.Encode(&kv)\n\t//\n\t// Remember to close the file after you have written all the values!\n}", "title": "" }, { "docid": "f28b03f1ebf5da4f80248c8d52815729", "score": "0.49907398", "text": "func getFilePathFromInputStream(inputBytes []byte) ([]string, error) {\n\tvar fileArgs []string\n\tread, write, errCreate := os.Pipe()\n\tif errCreate != nil {\n\t\treturn nil, errCreate\n\t}\n\n\t_, errWrite := write.Write(inputBytes)\n\tif errWrite != nil {\n\t\treturn nil, errWrite\n\t}\n\twrite.Close()\n\treader := bufio.NewReader(read)\n\tfor {\n\t\tinput, _, err := reader.ReadLine()\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t} else {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tline := string(input)\n\t\tif line != \"\" {\n\t\t\tif strings.Contains(line, string(os.PathSeparator)) && fileExists(line) {\n\t\t\t\tfileArgs = append(fileArgs, line)\n\t\t\t} else {\n\t\t\t\treturn nil, newUnKnownInputStreamError(line)\n\t\t\t}\n\t\t}\n\t}\n\treturn fileArgs, nil\n}", "title": "" }, { "docid": "39f737f8805a995f5281a52640040d31", "score": "0.49851105", "text": "func StandardInput() io.Reader {\n\tstat, err := os.Stdin.Stat()\n\tif err != nil {\n\t\treturn os.Stdin\n\t}\n\n\tif stat.Size() > 0 {\n\t\tcontents, _ := ioutil.ReadFile(os.Stdin.Name())\n\t\treturn bytes.NewReader(contents)\n\t}\n\n\treturn os.Stdin\n}", "title": "" }, { "docid": "5dffb3d0f77942646ed81e0a1e380fef", "score": "0.49791095", "text": "func getInputs() ([]int, []int) {\n\tdata, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// remove trailing newline and split along the double linebreak\n\tdecks := strings.Split(strings.TrimRight(string(data), \"\\n\"), \"\\n\\n\")\n\tplayerOne := parseDeck(decks[0])\n\tplayerTwo := parseDeck(decks[1])\n\treturn playerOne, playerTwo\n}", "title": "" }, { "docid": "8d8bd6d072338de3a14df2ecc4cd9706", "score": "0.49787396", "text": "func fileReadMethod2(fileList []string, count map[string]int) {\n\n\tfmt.Printf(\"== FILE READ: METHOD 2 ==\\n\")\n\tfor _, file := range fileList {\n\t\tdata, err := ioutil.ReadFile(file)\n\t\tif err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Failed to read file: %v\\n\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tfor index, line := range strings.Split(string(data), \"\\n\") {\n\t\t\tfmt.Printf(\"Line#%d: %v\\n\", index, line)\n\t\t\tcount[line]++\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "153cf05e180e5d8e3f529404353600d3", "score": "0.49771327", "text": "func readInputs(filename string) []string {\n\tfile, err := os.Open(filename)\n\tdefer file.Close()\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to open input.txt\")\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\tscanner.Split(bufio.ScanLines)\n\n\tvar passes []string\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tif len(line) != 10 {\n\t\t\tlog.Fatalf(\"line has incorrect number of characters!\")\n\t\t}\n\t\tpasses = append(passes, line)\n\t}\n\treturn passes\n}", "title": "" }, { "docid": "a881d739aede061641802e5b7ee0224a", "score": "0.49634948", "text": "func main(){\n\tf,err:=os.Open(\"D:\\\\vivek\\\\work\\\\go\\\\goquickstart\\\\abc.txt\")\n\tf1,err1:=os.Create(\"D:\\\\vivek\\\\work\\\\go\\\\goquickstart\\\\xyz12.txt\")\n if err!=nil{\n\tfmt.Println(\"Error in file reading \",err)\n\treturn \n}\n\nif err1!=nil{\n\tfmt.Println(\"Error in file crating \",err1)\n\treturn \n}\n\ndefer f1.Close()\ndefer f.Close()\ns:=bufio.NewScanner(f)\n\nfor s.Scan(){\n\t//fmt.Println(s.Text())\n\tf1.WriteString(s.Text())\n\tf1.WriteString(\"\\n\")\n}\n\nif s.Err!=nil{\n\tfmt.Println(\"Error in file reading \",s.Err)\n}\n\n}", "title": "" }, { "docid": "ae65b59122468b5eb0c85a30c5251c87", "score": "0.4961546", "text": "func doMap(\n\tjobName string, // the name of the MapReduce job\n\tmapTaskNumber int, // which map task this is\n\tinFile string,\n\tnReduce int, // the number of reduce task that will be run (\"R\" in the paper)\n\tmapF func(file string, contents string) []KeyValue,\n) {\n\t// Read the .txt generated by makeInput() method, and check for errors.\n\tcontents, err := ioutil.ReadFile(inFile)\n\tcheckError(err)\n\n\t// Creation of nReduce number of files to reduce the data into.\n\t// Store in a slice the name of files in filesSystem\n\tvar filesSystem []*os.File\n\tfor r := 0; r < nReduce; r++ {\n\t\tfile, _ := os.Create(reduceName(jobName, mapTaskNumber, r))\n\t\tfilesSystem = append(filesSystem, file)\n\t}\n\n\t// Split the records using the ihash() method.\n\t// ihash() will produce a unique value.\n\t// Store them in one of the JSONs, as specified by the output of ihash.\n\tfor _, kv := range mapF(inFile, string(contents)) {\n\t\thashOutput := int(ihash(kv.Key))\n\t\tindex := hashOutput % nReduce\n\t\tenc := json.NewEncoder(filesSystem[index])\n\t\tenc.Encode(&kv)\n\t}\n\n\t// Close all of the files.\n\tfor i := 0; i < nReduce; i++ {\n\t\tfilesSystem[i].Close()\n\t}\n}", "title": "" }, { "docid": "55cc75855696acbf3feaedaaffedcd69", "score": "0.49436617", "text": "func scanFile(arg *os.File) []string {\n\n\tvar fileValue []string\n\n\tscanner := bufio.NewScanner(arg)\n\n\tfor scanner.Scan() {\n\n\t\tlines := scanner.Text()\n\n\t\tfileValue = append(fileValue, lines)\n\n\t}\n\n\treturn fileValue\n}", "title": "" }, { "docid": "183f9e39b3582d7410e36b16aa08faba", "score": "0.4939242", "text": "func FileMulti(title, filter string) ([]string, bool, error) {\n\tosa, err := exec.LookPath(\"osascript\")\n\tif err != nil {\n\t\treturn []string{}, false, err\n\t}\n\n\tt := \"\"\n\tif filter != \"\" {\n\t\tt = ` of type {\"` + filter + `\"}`\n\t}\n\n\to, err := exec.Command(osa, \"-e\", `choose file `+t+` with multiple selections allowed with prompt \"`+title+`\"`).Output()\n\tif err != nil {\n\t\tif exitError, ok := err.(*exec.ExitError); ok {\n\t\t\tws := exitError.Sys().(syscall.WaitStatus)\n\t\t\treturn []string{}, ws.ExitStatus() == 0, nil\n\t\t}\n\t}\n\n\tret := true\n\tout := strings.TrimSpace(string(o))\n\tif out == \"\" {\n\t\tret = false\n\t}\n\n\tpaths := make([]string, 0)\n\n\tl := strings.Split(out, \", \")\n\tfor _, p := range l {\n\t\ttmp := strings.Split(p, \":\")\n\t\tpaths = append(paths, \"/\"+path.Join(tmp[1:]...))\n\t}\n\n\treturn paths, ret, err\n}", "title": "" }, { "docid": "e73f00cee91008dd6d2c763826f2b823", "score": "0.49338275", "text": "func (t *Task) inputLoop(outM, errM io.Writer) {\n\tfmt.Fprintf(outM, taskBegin, t.Name, t.Description)\n\n\toutReader, err := t.commando.StdoutPipe()\n\tif err != nil {\n\t\tfmt.Fprintf(outM, taskError, t.Name, t.Description, t.Command, t.Parameters, err.Error())\n\t} else {\n\t\tgo t.readInput(outReader, outM)\n\t}\n\n\terrReader, err := t.commando.StderrPipe()\n\tif err != nil {\n\t\tfmt.Fprintf(errM, taskError, t.Name, t.Description, t.Command, t.Parameters, err.Error())\n\t} else {\n\t\tgo t.readInput(errReader, errM)\n\t}\n}", "title": "" }, { "docid": "84b6472d3f38ac388344d79adde6c496", "score": "0.49289972", "text": "func readFilesByArg(pathes []string, headFlag bool) ([]string, error) {\n\tsarr := make([]string, len(pathes), len(pathes))\n\twg := new(sync.WaitGroup)\n\twg.Add(len(pathes))\n\tfor i := 0; i < len(pathes); i++ {\n\t\tgo func(i0 int) {\n\t\t\tcontent, err := ioutil.ReadFile(pathes[i0])\n\t\t\tif err != nil {\n\t\t\t\tcontent = []byte(err.Error())\n\t\t\t}\n\t\t\tif headFlag {\n\t\t\t\t_, fn := path.Split(pathes[i0])\n\t\t\t\tsarr[i0] = fn + \"\\n\" + string(content)\n\t\t\t} else {\n\t\t\t\tsarr[i0] = string(content)\n\t\t\t}\n\t\t\twg.Done()\n\t\t}(i)\n\t}\n\twg.Wait()\n\treturn sarr, nil\n}", "title": "" }, { "docid": "3af84d92e546f7195b99c64b64376228", "score": "0.49277192", "text": "func getFileDescriptor(src string) (*os.File, error) {\n\tif src == \"-\" {\n\t\treturn os.Stdin, nil\n\t}\n\n\treturn os.Open(src)\n}", "title": "" }, { "docid": "2c6844c13a3660bb4f87c7eaaa3fdad1", "score": "0.49186024", "text": "func readInputFile(inputFile string) ([]string, error) {\n\tfile, err := os.Open(inputFile)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer file.Close()\n\n\tvar lines []string\n\tscanner := bufio.NewScanner(file)\n\tfor scanner.Scan() {\n\t\ttext := strings.Trim(scanner.Text(), \" \")\n\t\tif text != \"\" || !strings.HasPrefix(text, \"#\") {\n\t\t\tlines = append(lines, scanner.Text())\n\t\t}\n\t}\n\n\treturn lines, scanner.Err()\n}", "title": "" }, { "docid": "22933a32161625ecccd5d8cf852ba322", "score": "0.49180037", "text": "func main() {\n ejemplo_print()\n ejemplo_for()\n ejemplo_array()\n ejemplo_logs()\n ejemplo_files()\n argumentos(os.Args)\n fmt.Println(func_arguments([]float64{1.123, 4.333, 27.0/5}))\n concatenar()\n regex_tests()\n\n}", "title": "" }, { "docid": "c42e68bcaa70fdf0a9bb27c7e0c466d8", "score": "0.49144724", "text": "func processFile(fn string) {\n\tlog.Infof(\"Processing file %v\", fn)\n\tfr, err := input.NewFileReader(fn)\n\tif err != nil {\n\t\tlog.Warnf(\"Unable to open file %v: %v\", fn, err)\n\t\treturn\n\t}\n\n\tfor fr.Scan() {\n\t\tcountWords(fr.Text())\n\t}\n}", "title": "" }, { "docid": "2cbefdb7f8d17f25a0ab6cac5a6e6a88", "score": "0.49092206", "text": "func mergeInToOut(inf, outf string) bool {\n\tif len(inf) == 0 { // nothing to merge\n\t\treturn true\n\t}\n\n\ttempfile, err := os.Create(\"temp.txt\") // open a temp file for result\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening temp file: %s\\n\", err)\n\t}\n\tos.Remove(\"temp.txt\")\n\n\tin, err := os.Open(inf)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening file: %s\\n\", err)\n\t}\n\tdefer in.Close()\n\n\tout, err := os.OpenFile(outf, os.O_RDWR|os.O_CREATE, 0755)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening file: %s\\n\", err)\n\t}\n\n\tinScanner := bufio.NewScanner(in)\n\tinScanner.Split(bufio.ScanLines)\n\toutScanner := bufio.NewScanner(out)\n\toutScanner.Split(bufio.ScanLines)\n\n\tvar inLine, outLine string\n\tfor inScanner.Scan() {\n\t\tif inLine = inScanner.Text(); len(inLine) > 0 { // get the first non-empty line\n\t\t\tbreak\n\t\t}\n\t}\n\tif len(inLine) == 0 { // inf is empty, no need to merge\n\t\ttempfile.Close()\n\t\tos.Remove(\"temp.txt\")\n\t\t//fmt.Println(\"temp.txt removed\")\n\t\tout.Close()\n\t\treturn true\n\t}\n\tfor outScanner.Scan() {\n\t\tif outLine = outScanner.Text(); len(outLine) > 0 { // get the first non-empty line\n\t\t\tbreak\n\t\t}\n\t}\n\n\t//fmt.Printf(\"before loop, in - %s, out - %s\\n\", inLine, outLine)\n\tvar prevLine string // previous line written to temp\n\tfor len(inLine) > 0 || len(outLine) > 0 {\n\t\t//fmt.Printf(\"before switch, in - %s, out - %s\\n\", inLine, outLine)\n\t\tswitch {\n\t\tcase len(inLine) > 0 && len(outLine) > 0:\n\t\t\tif inLine <= outLine {\n\t\t\t\tif inLine < outLine { // output if not equal\n\t\t\t\t\tif inLine != prevLine { // de-dup\n\t\t\t\t\t\tif _, err := tempfile.Write([]byte(inLine + \"\\n\")); 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\t//fmt.Printf(\"%s write to tempfile\\n\", inLine)\n\t\t\t\t\t}\n\t\t\t\t\tprevLine = inLine\n\t\t\t\t} // skip output if equal\n\n\t\t\t\tinLine = \"\"\n\t\t\t\tfor inScanner.Scan() { // read next line\n\t\t\t\t\tif inLine = inScanner.Text(); len(inLine) > 0 { // get the next non-empty line\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\tif outLine != prevLine { // de-dup\n\t\t\t\t\tif _, err := tempfile.Write([]byte(outLine + \"\\n\")); err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t} else {\n\t\t\t\t\t\t//fmt.Printf(\"%s write to tempfile\\n\", outLine)\n\t\t\t\t\t\tprevLine = outLine\n\t\t\t\t\t\toutLine = \"\"\n\t\t\t\t\t\tif outScanner.Scan() { // read next line from outFile\n\t\t\t\t\t\t\toutLine = outScanner.Text()\n\t\t\t\t\t\t} // otherwise at EOF\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\tcase len(inLine) == 0 && len(outLine) > 0:\n\t\t\tif _, err := tempfile.Write([]byte(outLine + \"\\n\")); err != nil {\n\t\t\t\tlog.Fatal(err)\n\t\t\t} else { // output the rest of outFile\n\t\t\t\tfor outScanner.Scan() {\n\t\t\t\t\toutLine = outScanner.Text()\n\t\t\t\t\tif _, err := tempfile.Write([]byte(outLine + \"\\n\")); err != nil {\n\t\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\toutLine = \"\"\n\n\t\tcase len(inLine) > 0 && len(outLine) == 0:\n\t\t\tif inLine != prevLine {\n\t\t\t\tif _, err := tempfile.Write([]byte(inLine + \"\\n\")); err != nil {\n\t\t\t\t\tlog.Fatal(err)\n\t\t\t\t}\n\t\t\t\t//fmt.Printf(\"%s write to tempfile\\n\", inLine)\n\t\t\t\tprevLine = inLine\n\t\t\t}\n\t\t\tfor inScanner.Scan() { // output the rest of inFile\n\t\t\t\tinLine = inScanner.Text()\n\t\t\t\t//fmt.Printf(\"next line is %s\\n\", inLine)\n\t\t\t\tif len(inLine) > 0 { // skip empty lines\n\t\t\t\t\tif inLine != prevLine {\n\t\t\t\t\t\tif _, err := tempfile.Write([]byte(inLine + \"\\n\")); 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\t//fmt.Printf(\"%s write to tempfile\\n\", inLine)\n\t\t\t\t\t\tprevLine = inLine\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tinLine = \"\"\n\t\t}\n\t}\n\n\tout.Close()\n\ttempfile.Close()\n\n\ttempfile, err = os.Open(\"temp.txt\") // open temp file again\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening temp file: %s.\\n\", err)\n\t}\n\n\tout, err = os.OpenFile(outf, os.O_RDWR|os.O_CREATE, 0755)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed opening file: %s.\\n\", err)\n\t}\n\tdefer out.Close()\n\n\tif _, err = io.Copy(out, tempfile); err != nil {\n\t\tlog.Fatalf(\"Fail to replace the outFile\")\n\t}\n\n\t//fmt.Println(\"temp.txt removed\")\n\treturn true\n}", "title": "" }, { "docid": "fbb390a430dd6928c272b318b3b9921a", "score": "0.49009237", "text": "func get_input() ([][]string, []string, []string) {\n\tvar input_matrix_temp [][]string\n\tvar rdm_row_temp []string\n\tvar rdm_col_temp []string\n\tvar len_row_1 int\n\tflag_char := 0\n\tflag_char_count := 0\n\tflag_size := false\n\tflag_rdm_row := 0\n\tflag_rdm_col := 0\n\n\tscanner := bufio.NewScanner(os.Stdin)\n\tscanner.Split(bufio.ScanLines)\n\tfor scanner.Scan() {\n\t\tstr := strings.Fields(scanner.Text())\n\t\tif str[0] == \"#\" {\n\t\t\tcontinue\n\t\t} else if str[0] == \"Random\" && strings.Contains(str[1], \"rows:\") {\n\t\t\trdm_row_temp = get_rdm_inputs(str)\n\t\t} else if str[0] == \"Random\" && strings.Contains(str[1], \"columns:\") {\n\t\t\trdm_col_temp = get_rdm_inputs(str)\n\t\t} else {\n\t\t\tstr, flag_char = check_space_char(str)\n\t\t\tflag_char_count += flag_char\n\t\t\tif len(input_matrix_temp) == 0 {\n\t\t\t\tlen_row_1 = len(str)\n\t\t\t\tinput_matrix_temp = append(input_matrix_temp, str)\n\t\t\t} else if len_row_1 == len(str) {\n\t\t\t\tinput_matrix_temp = append(input_matrix_temp, str)\n\t\t\t} else {\n\t\t\t\tflag_size = true\n\t\t\t\tinput_matrix_temp = append(input_matrix_temp, str)\n\t\t\t}\n\t\t}\n\t}\n\tif len(rdm_row_temp) == 0 || len(rdm_col_temp) == 0 || len(input_matrix_temp) == 0 {\n\t\tfmt.Println(\"Invalid Input!!!\")\n\t\tos.Exit(0)\n\t}\n\tn1, _ := strconv.Atoi(rdm_row_temp[0])\n\tn2, _ := strconv.Atoi(rdm_row_temp[1])\n\tif n1 < 0 || n1 > len(input_matrix_temp) - 1 || n2 < 0 || n2 > len(input_matrix_temp) - 1 {\n\t\tflag_rdm_row += 1\n\t}\n\tn3, _ := strconv.Atoi(rdm_col_temp[0])\n\tn4, _ := strconv.Atoi(rdm_col_temp[1])\n\tif n3 < 0 || n3 > len_row_1 - 1 || n4 < 0 || n4 > len_row_1 - 1 {\n\t\tflag_rdm_row += 1\n\t}\n\tif flag_char_count == 0 && flag_size == false && len(rdm_col_temp) > 0 && len(rdm_row_temp) > 0 && len(rdm_row_temp) ==2 && len(rdm_col_temp) == 2 && flag_rdm_col == 0 && flag_rdm_row == 0 {\n\t\t// Printing the user inputs on the stdout\n\t\tfmt.Println(\"The input matrix is: \")\n\t\tfor _, str := range input_matrix_temp {\n\t\t\tfmt.Printf(\"%s\\n\", str)\n\t\t}\n\t\tfmt.Println()\n\t\tfmt.Println(\"The input for random rows are: \", rdm_row_temp[0], rdm_row_temp[1])\n\t\tfmt.Println(\"The input for random columns are: \", rdm_col_temp[0], rdm_col_temp[1])\n\t\tfmt.Println()\n\t} else {\n\t\tfmt.Println(\"Invalid Input!!!\")\n\t\tos.Exit(0)\n\t}\n\treturn input_matrix_temp, rdm_col_temp, rdm_row_temp\n}", "title": "" }, { "docid": "9cc1d837d1c788d646b785f4e142d55a", "score": "0.48964477", "text": "func (v MergedInputMedia) inputMedia() {}", "title": "" }, { "docid": "5ab9cf7ae7bd883a504c1137baa41522", "score": "0.48946792", "text": "func parseDataFromFiles(fileNames []string) ([]person.Person, []string) {\n\ttype simpleFile struct {\n\t\tName string\n\t\tContent io.Reader\n\t}\n\tfiles := []simpleFile{}\n\tparseErrs := []string{}\n\t{ // open all specified files\n\t\tfor _, fileName := range fileNames {\n\t\t\tfh, err := os.Open(fileName)\n\t\t\tif err != nil {\n\t\t\t\tparseErrs = append(parseErrs, fmt.Sprint(err))\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t// we cannot do a simple 'defer fh.Close()'\n\t\t\t// because the errcheck tool will say we're\n\t\t\t// forgetting to check an error. Ignoring the\n\t\t\t// error is fine in this case because we are\n\t\t\t// reading from the file as opposed to\n\t\t\t// writing. TODO: check out\n\t\t\t// https://github.com/alecthomas/gometalinter\n\t\t\t// as a way to consolidate static checks AND\n\t\t\t// it seems you can add a comment instructing\n\t\t\t// gometalinter not to run, say errcheck, on a\n\t\t\t// specific line\n\t\t\tdefer func(fh *os.File) { _ = fh.Close() }(fh)\n\t\t\tfiles = append(files, simpleFile{Name: fileName, Content: fh})\n\t\t}\n\t}\n\tif len(parseErrs) > 0 {\n\t\treturn nil, parseErrs\n\t}\n\tif len(files) == 0 {\n\t\tfiles = append(files, simpleFile{Name: \"(standard input)\", Content: os.Stdin})\n\t}\n\tfilesRecords := [][][]string{}\n\t{ // validate the syntax of the data\n\t\tconst possibleDelimiters = \"|, \"\n\t\tconst numFieldsInRecord = 5\n\t\tfor _, file := range files {\n\t\t\trecords, csvParseErrs := multicsv.ReadAll(possibleDelimiters, numFieldsInRecord, file.Content)\n\t\t\tif len(csvParseErrs) > 0 {\n\t\t\t\tparseErrs = append(parseErrs, prependFileInfo(file.Name, 0, csvParseErrs)...)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfilesRecords = append(filesRecords, records)\n\t\t}\n\t}\n\t// TODO: I don't like the repetition of this check but I'm not\n\t// sure what to do about it. Hypothetically I could stop every\n\t// time I encounter any error instead of gathering them but I\n\t// think its useful to the user if all problems of a certain\n\t// type (like grammar vs semantic) are printed out at once.\n\t// Hypothetically I could also not even bother checking\n\t// parseErrs in this function at all and have it keep\n\t// accumulating but that would mean some unecessary\n\t// computation being done for any files without any problems.\n\tif len(parseErrs) > 0 {\n\t\treturn nil, parseErrs\n\t}\n\tpersons := []person.Person{}\n\t{ // parse each file into structured data which can be sorted\n\t\tfor i, file := range files {\n\t\t\tfor j, line := range filesRecords[i] {\n\t\t\t\tp, semParseErrs := person.Parse(line)\n\t\t\t\tif len(semParseErrs) > 0 {\n\t\t\t\t\tparseErrs = append(parseErrs, prependFileInfo(file.Name, j+1, semParseErrs)...)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tpersons = append(persons, p)\n\t\t\t}\n\t\t}\n\t}\n\treturn persons, parseErrs\n}", "title": "" }, { "docid": "97aff427e23fafab7daf55be4587b08d", "score": "0.48927745", "text": "func getstdin() (stdin_data *[]byte, err error){\n\ts, _ := os.Stdin.Stat()\n\tif (s.Mode() & os.ModeCharDevice) != 0 {\n\t\t// there is no stdin, do nothing\n\t\treturn nil, errors.New(\"[-] No stdin\")\n\t}\n\n\t// there is stdin, process it\n\tnBytes, nChunks := int64(0), int64(0)\n\tr := bufio.NewReader(os.Stdin)\n\tbuf := make([]byte, 0, 10*1024) // 10MB -- CAN BE ADJUSTED IF PEOPLE ACTUALLY USE THIS\n\n\t// read from stdin\n\tfor {\n\t\tn, err := r.Read(buf[:cap(buf)])\n\t\tbuf = buf[:n]\n\t\tif n == 0 {\n\t\t\tif err == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err == io.EOF {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tnChunks++\n\t\tnBytes += int64(len(buf))\n\n\t\treturn &buf, nil\n\n\t\tif err != nil && err != io.EOF {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t}\n\n\treturn nil, errors.New(\"[-] Missed buffer? Possibly out of memory?\")\n}", "title": "" }, { "docid": "414c33fc85d9cd562713f348da832233", "score": "0.4885457", "text": "func FileReader(name string) {\n\targs := os.Args\n\t// kun filnavn\n\tif len(args) == 2 {\n\t\t//produces error if args length is 2.\n\t\tfeilmelding := \"Du mangler -f\"\n\t\tpanic(feilmelding)\n\t}\n\t//attaches the the string \"-f\" to run func printStats that take args array position 3 as in.\n\tif len(args) == 3 {\n\t\tif args[1] == \"-f\" {\n\t\t\tprintStats(args[2])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "85a8fbc9440308360cdb3d7b220ba892", "score": "0.48845613", "text": "func (t *StatFileTask) loadInput(task navvy.Task) {\n\ttypes.LoadFault(task, t)\n\ttypes.LoadPool(task, t)\n\ttypes.LoadPath(task, t)\n\ttypes.LoadStorage(task, t)\n}", "title": "" }, { "docid": "b53406aaea720f0f01c00e6dfbce6fff", "score": "0.48829436", "text": "func (tool *Tool) inputsToVM() (err error) {\n\ttool.Task.infof(\"begin load inputs to js vm\")\n\tprefix := tool.Task.Root.ID + \"/\" // need to trim this from all the input.ID's\n\ttool.InputsVM = tool.JSVM.Copy()\n\tcontext := make(map[string]interface{})\n\tvar f interface{}\n\tfor _, input := range tool.Task.Root.Inputs {\n\t\tinputID := strings.TrimPrefix(input.ID, prefix)\n\n\t\t// fixme: handle array of files\n\t\t// note: this code block is extraordinarily janky and needs to be refactored\n\t\t// error here.\n\t\tswitch {\n\t\tcase input.Provided == nil:\n\t\t\tcontext[inputID] = nil\n\t\tcase input.Types[0].Type == CWLFileType:\n\t\t\tif input.Provided.Entry != nil {\n\t\t\t\t// no valueFrom specified in inputBinding\n\t\t\t\tif input.Provided.Entry.Location != \"\" {\n\t\t\t\t\tf = fileObject(input.Provided.Entry.Location)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// valueFrom specified in inputBinding - resulting value stored in input.Provided.Raw\n\t\t\t\ttool.Task.infof(\"input: %v; input provided raw: %v\", input.ID, input.Provided.Raw)\n\t\t\t\tswitch input.Provided.Raw.(type) {\n\t\t\t\tcase string:\n\t\t\t\t\tf = fileObject(input.Provided.Raw.(string))\n\t\t\t\tcase *File, []*File:\n\t\t\t\t\tf = input.Provided.Raw\n\t\t\t\tdefault:\n\t\t\t\t\treturn tool.Task.errorf(\"unexpected datatype representing file object in input.Provided.Raw\")\n\t\t\t\t}\n\t\t\t}\n\t\t\tfileContext, err := preProcessContext(f)\n\t\t\tif err != nil {\n\t\t\t\treturn tool.Task.errorf(\"failed to preprocess file context: %v; error: %v\", f, err)\n\t\t\t}\n\t\t\tcontext[inputID] = fileContext\n\t\tdefault:\n\t\t\tcontext[inputID] = input.Provided.Raw // not sure if this will work in general - so far, so good though - need to test further\n\t\t}\n\t}\n\tif err = tool.InputsVM.Set(\"inputs\", context); err != nil {\n\t\treturn tool.Task.errorf(\"failed to set inputs context in js vm: %v\", err)\n\t}\n\ttool.Task.infof(\"end load inputs to js vm\")\n\treturn nil\n}", "title": "" }, { "docid": "f5d27147f5c58443bc18d24deac4d8d4", "score": "0.4880499", "text": "func main() {\n\tm := newmetrics() // Get a pointer to Metrics\n\tin := bufio.NewScanner(os.Stdin) // Getting input from Standard input\n\n\tfor in.Scan() { // it scans line by line\n\t\t// Get Data from Line\n\t\tdata := parse(m, in.Text()) // in.Text() lets you get the last line read\n\t\tupdate(m, data) // update metrics based on data for a domain\n\t}\n\n\tsummarise(m) // Print the Summary\n\t// in.Err() -> gives the Error in processing Standard input\n\tdumpErrs([]error{in.Err(), err(m)})\n}", "title": "" }, { "docid": "29483057969daca4bcdf0746191940b3", "score": "0.4866455", "text": "func ReadInput(inputExplain, defaultVal string, out io.Writer, in io.Reader, validate func(string) (bool, error)) string {\n\treader := bufio.NewReader(in)\n\tfor {\n\t\t_, err := fmt.Fprint(out, inputExplain)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\ti, err := reader.ReadString('\\n')\n\t\tif err != nil {\n\t\t\t_, err := fmt.Fprintf(out, \"Error: %s\\n\", err.Error())\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t} else {\n\t\t\ti = strings.TrimSpace(i)\n\t\t\tif len(i) == 0 && len(defaultVal) > 0 {\n\t\t\t\treturn defaultVal\n\t\t\t}\n\t\t\tvalid, err := validate(i)\n\t\t\tif valid {\n\t\t\t\treturn i\n\t\t\t}\n\t\t\t_, err = fmt.Fprintf(out, \"Error: %s\\n\", err.Error())\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a58733c783230716f016adf2b757b67e", "score": "0.48616183", "text": "func sumFile(filename string, boxes []patBox) error {\n\n\tvar err error\n\n\tvar file *os.File\n\n\tif filename == \"-\" || filename == \"\" {\n\t\tfile = os.Stdin\n\t} else {\n\t\tfile, err = os.Open(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer file.Close()\n\t}\n\n\tscanner := bufio.NewScanner(file)\n\n\t// count lines\n\tfor scanner.Scan() {\n\t\tline := scanner.Text()\n\t\tsumLine(line, boxes)\n\t}\n\n\treturn err\n\n}", "title": "" }, { "docid": "ef2ab3716658dc6d051749d6ccf8af1a", "score": "0.48605287", "text": "func selectInput(s string) (io.ReadCloser, error) {\n\tvar input io.ReadCloser\n\tinput = os.Stdin\n\tif s != \"\" {\n\t\tf, err := os.Open(s)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tinput = f\n\t}\n\treturn input, nil\n}", "title": "" }, { "docid": "a44ade155911abf253c0171a29167384", "score": "0.48572946", "text": "func HandleReduce(\n\tworkerID int,\n\treduceID int,\n\tfilenames []string,\n\treducef func(string, []string) string) (outputFilename string) {\n\n\tkva := make([]KeyValue, 0)\n\tfor _, filename := range filenames {\n\t\tfunc() {\n\t\t\tfile, err := os.Open(filename)\n\t\t\tif err != nil {\n\t\t\t\tlog.Fatalln(err)\n\t\t\t}\n\t\t\tdefer file.Close()\n\n\t\t\tfor {\n\t\t\t\tk := \"\"\n\t\t\t\tv := \"\"\n\t\t\t\tnRead, err := fmt.Fscanf(file, \"%s %s\", &k, &v)\n\t\t\t\tif nRead != 2 || err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tkva = append(kva, KeyValue{Key: k, Value: v})\n\t\t\t}\n\t\t}()\n\t}\n\n\tsort.Sort(ByKey(kva))\n\n\toutputFilename = fmt.Sprintf(\"mr-out-%v-%v\", reduceID, workerID)\n\tfile, err := os.Create(outputFilename)\n\tif err != nil {\n\t\tlog.Fatalln(err)\n\t}\n\tdefer file.Close()\n\n\ti := 0\n\tfor i < len(kva) {\n\t\tj := i + 1\n\t\tfor j < len(kva) && kva[j].Key == kva[i].Key {\n\t\t\tj++\n\t\t}\n\n\t\tvalues := make([]string, 0)\n\t\tfor k := i; k < j; k++ {\n\t\t\tvalues = append(values, kva[k].Value)\n\t\t}\n\t\toutput := reducef(kva[i].Key, values)\n\n\t\t// this is the correct format for each line of Reduce output.\n\t\tfmt.Fprintf(file, \"%v %v\\n\", kva[i].Key, output)\n\n\t\ti = j\n\t}\n\treturn\n}", "title": "" }, { "docid": "5f226181524355ba06262f0ab274a42e", "score": "0.4856484", "text": "func getFileHandles(pid string) (float64, float64, float64) {\n\tvar _s, _h string\n\tvar s, h float64\n\tlimitExp := regexp.MustCompile(\"[0-9]+\")\n\tfilename := `/proc/` + pid + `/limits`\n\tfdLoc := \"/proc/\" + pid + \"/fd\"\n\tnumFD := 0.0\n\n\tlimits, err := ioutil.ReadFile(filename)\n\tif err != nil {\n\t\tdracky.Check(err)\n\t}\n\n\tlines := strings.Split(string(limits), \"\\n\")\n\tfor i := range lines {\n\t\tif strings.Contains(lines[i], \"open files\") {\n\t\t\tlimits := limitExp.FindAllString(lines[i], 2)\n\t\t\t_s = limits[0]\n\t\t\t_h = limits[1]\n\n\t\t\ts, err = strconv.ParseFloat(_s, 64)\n\t\t\tif err != nil {\n\t\t\t\t// YELLOW handle error\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(2)\n\t\t\t}\n\t\t\th, err = strconv.ParseFloat(_h, 64)\n\t\t\tif err != nil {\n\t\t\t\t// YELLOW handle error\n\t\t\t\tfmt.Println(err)\n\t\t\t\tos.Exit(2)\n\t\t\t}\n\t\t}\n\t}\n\n\tfiles, _ := ioutil.ReadDir(fdLoc)\n\tfor _ = range files {\n\t\tnumFD++\n\t}\n\tif numFD == 0.0 {\n\t\tfmt.Printf(\"There are no open file descriptors for the process, did you use sudo?\\n\")\n\t\tfmt.Printf(\"If unsure of the use, consult the documentation for examples and requirements\\n\")\n\t\tos.Exit(dracky.PERMISSION_ERROR)\n\t}\n\treturn s, h, numFD\n}", "title": "" }, { "docid": "6f2bd0e13a3e4906e2531cc15d11868a", "score": "0.48545688", "text": "func appendFileFunc(w http.ResponseWriter, r *http.Request, filesys *fs.RootFileSystem) {\n\tfilesys.AppendFile(r.URL.Path, []byte(r.Form[\"data\"][0]))\n\tgetFunc(w, r, filesys)\n}", "title": "" }, { "docid": "ad220c3e1e6f32187f520512b6165714", "score": "0.4852904", "text": "func ReadInputData(dir string) ([]byte, string, error) {\n\tfor _, df := range dataset.SupportedDataFormats() {\n\t\tpath := fmt.Sprintf(\"%s/data.%s\", dir, df)\n\t\tif f, err := os.Open(path); err == nil {\n\t\t\tdata, err := ioutil.ReadAll(f)\n\t\t\treturn data, fmt.Sprintf(\"data.%s\", df), err\n\t\t}\n\t}\n\treturn nil, \"\", os.ErrNotExist\n}", "title": "" }, { "docid": "5791c0b01db2c62a9a01d898e07e3f2f", "score": "0.48501828", "text": "func parseFile(path string) ([]*types.Entry, error) {\n\treturn parseEntryJSON(os.Stdin, path)\n}", "title": "" }, { "docid": "e89bbd8f9ab9019bf66eff8de8565d93", "score": "0.48475257", "text": "func getInput() {\n}", "title": "" }, { "docid": "d8da7a757ec93b3f83e15304f2e026e9", "score": "0.48411185", "text": "func processFile(filename string, in io.Reader, out io.Writer) error {\n\tif in == nil {\n\t\tf, err := os.Open(filename)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer f.Close()\n\t\tin = f\n\t}\n\n\tsrc, err := ioutil.ReadAll(in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tr := bytes.NewBuffer(src)\n\n\tfile, errs := parser.Parse(filename, r, parser.NewScope(nil))\n\tif len(errs) > 0 {\n\t\tfor _, err := range errs {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t}\n\t\treturn fmt.Errorf(\"%d parsing errors\", len(errs))\n\t}\n\n\tmodified, errs := findModules(file)\n\tif len(errs) > 0 {\n\t\tfor _, err := range errs {\n\t\t\tfmt.Fprintln(os.Stderr, err)\n\t\t}\n\t\tfmt.Fprintln(os.Stderr, \"continuing...\")\n\t}\n\n\tif modified {\n\t\tres, err := parser.Print(file)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif *list {\n\t\t\tfmt.Fprintln(out, filename)\n\t\t}\n\t\tif *write {\n\t\t\terr = ioutil.WriteFile(filename, res, 0644)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\tif *doDiff {\n\t\t\tdata, err := diff(src, res)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"computing diff: %s\", err)\n\t\t\t}\n\t\t\tfmt.Printf(\"diff %s bpfmt/%s\\n\", filename, filename)\n\t\t\tout.Write(data)\n\t\t}\n\n\t\tif !*list && !*write && !*doDiff {\n\t\t\t_, err = out.Write(res)\n\t\t}\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "bd995c7d1b659c36ec5f06c04845507a", "score": "0.48392913", "text": "func scanFiles(cmd *cobra.Command, args []string) error {\n\tlog.Println(\"Scanfiles Called:\")\n\tlog.Printf(\"\\tPattern:%s\\n\\t\\t\\tfile-source:%s\", pattern, sourceDir)\n\tor, ow := io.Pipe()\n\n\t//This grep command only returns the files names whose contents match the pattern\n\tgrepCmd := exec.Command(\"grep\", \"-lr\", pattern, sourceDir)\n\tif output, err := grepCmd.Output(); err == nil {\n\n\t\tfileList := bytes.Split(output, []byte(\"\\n\"))\n\t\tgo processFileList(fileList, pattern, ow)\n\n\t\tif _, err := io.Copy(os.Stdout, or); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tlog.Printf(\"%#v\\n\",fileList)\n\t\tlog.Println(\"Done\")\n\t} else {\n\t\tif grepCmd.ProcessState.ExitCode() == 1 {\n\t\t\tlog.Println(\"Scan: No files Found\")\n\t\t\treturn nil\n\t\t} else {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "8a7807e70c682c6d0fc3f426601588c8", "score": "0.48321497", "text": "func parseResultsFileDirectory() []string {\n\n\tfiles := make([]string, 0)\n\n\tzipFiles, _ := filepath.Glob(\"./in/*.zip\")\n\txmlFiles, _ := filepath.Glob(\"./in/*.xml\")\n\n\tfiles = append(files, zipFiles...)\n\tfiles = append(files, xmlFiles...)\n\tif len(files) == 0 {\n\t\tlog.Fatalln(\"No results data *.zip *.xml.zip or *.xml files found in input folder /in.\")\n\t}\n\n\treturn files\n\n}", "title": "" }, { "docid": "3e71cb30f6c61696e778eea4e258c579", "score": "0.4830839", "text": "func (t *CopySingleFileTask) loadInput(task navvy.Task) {\n\ttypes.LoadFault(task, t)\n\ttypes.LoadPool(task, t)\n\ttypes.LoadDestinationPath(task, t)\n\ttypes.LoadDestinationStorage(task, t)\n\ttypes.LoadMD5Sum(task, t)\n\ttypes.LoadSize(task, t)\n\ttypes.LoadSourcePath(task, t)\n\ttypes.LoadSourceStorage(task, t)\n}", "title": "" }, { "docid": "58ed76c934397f6ed452d3e799e05969", "score": "0.48280618", "text": "func FileSum(input, output string) {\n\tin, errIn := os.Open(input)\n\tout, errOut := os.Create(output)\n\tif errIn != nil {\n\t\tlog.Fatal(errIn)\n\t}\n\tif errOut != nil {\n\t\tlog.Fatal(errOut)\n\t}\n\tdefer in.Close()\n\tdefer out.Close()\n\n\ttotal := 0\n\tr := bufio.NewScanner(in)\n\tfor r.Scan() {\n\t\tline := r.Text()\n\t\tnum, _ := strconv.Atoi(line)\n\t\ttotal += num\n\t}\n\tif err := r.Err(); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tw := bufio.NewWriter(out)\n\tw.WriteString(strconv.Itoa(total) + \"\\n\")\n\tw.Flush()\n}", "title": "" }, { "docid": "56097b4e2643245b911ce5fb76a18f9c", "score": "0.48033857", "text": "func readInputFile() {\n\tinputFile := \"input\"\n\t//inputFile = \"input_test6\"\n\n\tinputLines := ReadFile(inputFile)\n\tunits = []Unit{}\n\tlevelMap = [][]bool{}\n\n\tfor rowNum, unitId, loc := 0, 0, 0; rowNum < len(inputLines); rowNum++ {\n\t\tlevelMap = append(levelMap, []bool{})\n\t\tinputLine := []byte(inputLines[rowNum])\n\t\tfor x, v := range inputLine {\n\t\t\tif v == 'E' || v == 'G' {\n\t\t\t\tunits = append(units, Unit{unitId, initialHp, Point2d{x, rowNum}, v})\n\t\t\t\tunitId++\n\t\t\t}\n\t\t\tlevelMap[rowNum] = append(levelMap[rowNum], v != '#')\n\t\t\tloc++\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c270307ac536d988fd5280c8d7ed7d6", "score": "0.47999987", "text": "func doMap(\n\tjobName string, // the name of the MapReduce job\n\tmapTaskNumber int, // which map task this is\n\tinFile string,\n\tnReduce int, // the number of reduce tasks that will be run (\"R\" in the paper)\n\tmapF func(file string, contents string) []KeyValue,\n) {\n\tfile, err := os.Open(inFile)\n\tif err == nil {\n\t\tfmt.Printf(\"file: %s opened\\n\", inFile)\n\t} else {\n\t\tfmt.Println(err)\n\t}\n\tinf, err := file.Stat()\n\n\tcontents := make([]byte, inf.Size())\n\tfile.Read(contents)\n\tfile.Close()\n\n\tkv := mapF(inFile, string(contents))\n\tfilesenc := make([]*json.Encoder, nReduce)\n\tfiles := make([]*os.File, nReduce)\n\n\tfor i := range filesenc {\n\t\tfile, err := os.Create(reduceName(jobName, mapTaskNumber, i))\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%s Create Failed\\n\", reduceName(jobName, mapTaskNumber, i))\n\t\t} else {\n\t\t\tfilesenc[i] = json.NewEncoder(file)\n\t\t\tfiles[i] = file\n\t\t}\n\t}\n\n\tfor _, v := range kv {\n\t\terr := filesenc[ihash(v.Key) % uint32(nReduce)].Encode(&v)\n\t\tif err != nil {\n\t\t\tfmt.Printf(\"%s Encode Failed %v\\n\", v, err)\n\t\t}\n\t}\n\n\tfor _, f := range files {\n\t\tf.Close()\n\t}\n}", "title": "" }, { "docid": "a91676ebc5b403c563a859528946039e", "score": "0.4797569", "text": "func (b *ListCache) processFile(link string, resultCh chan<- string, errCh chan<- error) {\n\tvar r io.ReadCloser\n\n\tvar err error\n\n\tr, err = b.getLinkReader(link)\n\n\tif err != nil {\n\t\tlogger().Warn(\"error during file processing: \", err)\n\t\terrCh <- err\n\n\t\treturn\n\t}\n\tdefer r.Close()\n\n\tvar count int\n\n\tscanner := bufio.NewScanner(r)\n\n\tfor scanner.Scan() {\n\t\tline := strings.TrimSpace(scanner.Text())\n\t\t// skip comments\n\t\tif line := processLine(line); line != \"\" {\n\t\t\tresultCh <- line\n\n\t\t\tcount++\n\t\t}\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\t// don't propagate error here. If some lines are not parsable (e.g. too long), it is ok\n\t\tlogger().Warn(\"can't parse file: \", err)\n\t} else {\n\t\tlogger().WithFields(logrus.Fields{\n\t\t\t\"source\": link,\n\t\t\t\"count\": count,\n\t\t}).Info(\"file imported\")\n\t}\n}", "title": "" } ]
7b08289b4dba11d7b9e8bc18ef09b19c
SetPayload sets the payload to the weaviate commands get o k response
[ { "docid": "9aface8954a39dd38e95bc53e5d6479a", "score": "0.81358576", "text": "func (o *WeaviateCommandsGetOK) SetPayload(payload *models.CommandGetResponse) {\n\to.Payload = payload\n}", "title": "" } ]
[ { "docid": "ba6ae202f0c08012f9960ee8a2200d3f", "score": "0.79317546", "text": "func (o *WeaveCommandsGetOK) SetPayload(payload *models.Command) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b823a661a5deaab9ade33e5a89fa4e3e", "score": "0.7718669", "text": "func (o *GetCommandsOK) SetPayload(payload *models.Command) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "05c898a77783b384b00ab8b80ae8124f", "score": "0.73786724", "text": "func (o *GetCommandTemplateOK) SetPayload(payload []string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0563762d8060b36521ce005d2824cc06", "score": "0.73684794", "text": "func (o *GetUIOK) SetPayload(payload io.ReadCloser) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4c9b64d1880a764bb2669ebe5abc9aeb", "score": "0.7365194", "text": "func (o *GetV1DevicesDeviceCommandsCommandInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4189c9cc27ec1c630768155dd11bf431", "score": "0.7363071", "text": "func (o *GetV1DevicesDeviceCommandsCommandOK) SetPayload(payload models.CommandResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4e8d229c34e2290e81461557a6de8e1d", "score": "0.7191419", "text": "func (o *GetStateByNameOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "47ff9a7dff563c2c158005052de74692", "score": "0.7184669", "text": "func (o *GetDataSomeKeyPathOK) SetPayload(payload *models.Data) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5f2cc9b26db9be3150f89c6f8363d125", "score": "0.7151401", "text": "func (o *DeviceGetOK) SetPayload(payload *models.WireguardDevice) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "a29ec13d34c93454a0b5f3c0b1cf38d7", "score": "0.7150073", "text": "func (o *GetReposOwnerRepoKeysKeyIDOK) SetPayload(payload *models.UserKeysKeyID) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "dba07e8a9a67fdfc10039b293ff57ab6", "score": "0.7114043", "text": "func (o *GetDocumentDidOrDidDocumentOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1ff9a18245842392a89e494a548b4a83", "score": "0.7099613", "text": "func (o *GetExchangesOK) SetPayload(payload models.GetExchangesOKBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "84fdb8c45d671cbb13968458d255b4dc", "score": "0.709009", "text": "func (o *ExportTKGConfigForVsphereOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ade96d2a4d5d729f28d6c2f26b1d0b40", "score": "0.7073344", "text": "func (o *GetSettingsObjectOK) SetPayload(payload models.GetSettingsObjectResp) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "53aac3360db0b5c4af25542ef62554c7", "score": "0.70481926", "text": "func (o *GetMetaOK) SetPayload(payload *models.Meta) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "640b689621023adb39eac57f34244355", "score": "0.702984", "text": "func (o *GetV1DevicesDeviceCommandsCommandNotFound) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1867f343e1d35aa127eba0bbd96766e1", "score": "0.7020641", "text": "func (o *GetAlliancesAllianceIDCorporationsInternalServerError) SetPayload(payload *models.GetAlliancesAllianceIDCorporationsInternalServerErrorBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "58da664fab8558e35b21690bf1bf39bd", "score": "0.70036894", "text": "func (o *GetStateByNameDefault) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "19b23fab0d4d4f5a813668fc7ba4ca9a", "score": "0.6989625", "text": "func (o *GetCommandTemplateInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "234f6a1bdb97dceafe85c6cc69b21fab", "score": "0.6989046", "text": "func (o *GetV1DevicesDeviceCommandsCommandUnauthorized) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d847ef5ca08dd9ec2b5ad6f8f6dd179f", "score": "0.69564474", "text": "func (o *WeaviateCommandsInsertAccepted) SetPayload(payload *models.CommandGetResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1b0c3f4a0894292b8204b4bce8ba1e1c", "score": "0.69528127", "text": "func (o *WeaviateThingsUpdateOK) SetPayload(payload *models.ThingGetResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "bd5f8c437342436cf1c635bfaf9bf4b0", "score": "0.6943002", "text": "func (o *GetIBAMappingByGateAndMountUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5bc424d06597b6677ec42b56957e0c57", "score": "0.6935096", "text": "func (o *GetExchangesDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7fe76139aa6125d2b04323a4e4db51c5", "score": "0.69317824", "text": "func (o *GetRuleChainMetadataOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f6c1b625bb8d5b2bbfda3a14cf34dfda", "score": "0.6919924", "text": "func (o *GetNFTContractOperationsOK) SetPayload(payload []*models.OperationsRow) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "93904d8e4d18a2c74aa618c0aa9964ef", "score": "0.6913717", "text": "func (o *ObjectsGetOK) SetPayload(payload *models.Object) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "39532c44815239137514f5111e4756ba", "score": "0.69061255", "text": "func (o *GetHealthOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f762d8e315aa72d0b8b34a4523003275", "score": "0.68816084", "text": "func (o *GetServiceInstancesInstanceIDLastOperationOK) SetPayload(payload *brokermodel.LastOperation) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "1c62737d42703b9feccf6d66eb9749a4", "score": "0.6881202", "text": "func (o *GetAWSEndpointOK) SetPayload(payload *models.AWSAccountParams) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "8a67fdba650229c2fec1dbb771fea752", "score": "0.6879719", "text": "func (o *GetAttackByIDOK) SetPayload(payload *models.AttackResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "c5977401a9f56cc32a93d48644a59d46", "score": "0.6877004", "text": "func (o *GetV1DevicesDeviceCommandsCommandForbidden) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3bd6d18718b86b55366f029563d88c7e", "score": "0.68765634", "text": "func (o *GetSovereigntyStructuresOK) SetPayload(payload models.GetSovereigntyStructuresOKBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "922b84eab7076bdc823d29e3401d1774", "score": "0.6872999", "text": "func (o *GetRouteTrainIDOK) SetPayload(payload *models.RouteResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "bbdfe42fbb1fd642103d7aadd1f60a94", "score": "0.68624943", "text": "func (o *WeaviateKeysMeChildrenGetOK) SetPayload(payload *models.KeyChildrenGetResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "6807776ec430f0611d8274953ccb2e01", "score": "0.6832961", "text": "func (o *GetExecuteTaskAgentOK) SetPayload(payload *models.RequestTask) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "52bd775d466ef3634320f10a212b68f7", "score": "0.6820063", "text": "func (o *GetDataContextConnectionUUIDSwitchControlSwitchControlUUIDOK) SetPayload(payload *models.TapiConnectivitySwitchControl) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "6d98ebf6508f47afdb32a15b72a261bf", "score": "0.6816843", "text": "func (o *GetFeatureFlagsOK) SetPayload(payload map[string]string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d75a2b9b26dd4a1596f495aab3a510ef", "score": "0.68100184", "text": "func (o *GetExecutionOK) SetPayload(payload *models.ExecutionOutputDetailed) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "ffa300b84229f94629245d8e4136e054", "score": "0.6805196", "text": "func (o *GetClusterInfoOK) SetPayload(payload *models.KlusterInfo) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "25f5157120d4003691d7be8b886a7e8c", "score": "0.680007", "text": "func (o *AddCellKeypairInternalServerError) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "138bc81e3e0ba060902368b2cc29c937", "score": "0.679476", "text": "func (o *GetRuntimeAppServicesInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "8f6671475721425f47ed52ca42f5f9a5", "score": "0.67873347", "text": "func (o *GetOptionsFromQuestionGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5d45916fb93f7d07f2d3221a7debf64d", "score": "0.678345", "text": "func (o *GetAlliancesAllianceIDCorporationsOK) SetPayload(payload []*int32) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0fea50ef702813bddbc11af9c9ca7694", "score": "0.6780747", "text": "func (o *GetItemIDOK) SetPayload(payload *models.Item) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fd201385cf9b5681146d721ff4f8ee82", "score": "0.6777134", "text": "func (o *ExportTKGConfigForVsphereUnauthorized) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "091f1ebd35cdaa885b6f10abca74dad0", "score": "0.6774843", "text": "func (o *GetAPIVersionOK) SetPayload(payload *models.GetAPIVersionOKBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "bd16fb5cc57bbd80b861f4771c49cec1", "score": "0.6768976", "text": "func (o *GetPrimeEntitlementsInternalServerError) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7aaaab774dcf457c53760299128bb45a", "score": "0.67607296", "text": "func (o *GetRecipeOK) SetPayload(payload *models.Recipe) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5ded7805608a6773aa8f46799552878d", "score": "0.6760391", "text": "func (o *GetSovereigntyStructuresInternalServerError) SetPayload(payload *models.GetSovereigntyStructuresInternalServerErrorBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "da7c7bb2b7111084217a22bc11c3c1b9", "score": "0.6758714", "text": "func (o *GetOrdersByAccountDefault) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0b55580836892169466d379bdc225e6e", "score": "0.6755479", "text": "func (o *GetBakersVotingOK) SetPayload(payload *models.BakersVoting) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "175e10f5e4f17cb62e3411667de9452c", "score": "0.6748451", "text": "func (o *GetQuestionsFromTeamGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "78e47c73afb0ad20f08c440313894ca3", "score": "0.6743054", "text": "func (o *StartVMOK) SetPayload(payload *models.VM) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3162ba4c9005a31c32d3674d43c11655", "score": "0.67430115", "text": "func (o *GetIBAMappingByGateAndMountNotFound) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "6499c923d8b2d5a5cd37791a5e3054cf", "score": "0.67429787", "text": "func (o *GetOptionsFromQuestionOK) SetPayload(payload []*models.Option) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "8f78d67a90c5a6492d8c9485fb4442d8", "score": "0.67405456", "text": "func (o *GetOptionsFromQuestionForbidden) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "867154784c9a2bb834c217e538863453", "score": "0.6733792", "text": "func (o *GetJoinScriptsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "fe10f9d56e1774aaaae62a9679eb975f", "score": "0.6725171", "text": "func (o *ObjectsClassGetOK) SetPayload(payload *models.Object) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "721324e7480720dc515cfccbaa9a821a", "score": "0.6718252", "text": "func (o *GetIBAMappingByGateAndMountInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "4a79b550c91dc80f9f0f5e2762b013fb", "score": "0.6715834", "text": "func (o *GetIdentityOK) SetPayload(payload []*models.Identity) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "27cfa5f6280cd9062c784bf9f5912078", "score": "0.6714928", "text": "func (o *GetWorkflowExecutionDetailInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "67adf7014ab6eecb01d7639aa4c0277e", "score": "0.6714795", "text": "func (o *GetV1DevicesDeviceInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "d89d013c2e6f865ddb98a6d4944cd59c", "score": "0.6712076", "text": "func (o *GetV1DevicesDeviceValuedescriptorsInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "015aae321171b3fd17f18c45561b3548", "score": "0.670906", "text": "func (o *RequestVMOK) SetPayload(payload *models.VM) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "154a476aa55ddd9a7f343d4f11f569be", "score": "0.67066514", "text": "func (o *GetPrimeEntitlementsUnauthorized) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "15640c8eee568ee1323e53cf7fe26ece", "score": "0.6706066", "text": "func (o *LogsGetOK) SetPayload(payload *models.Log) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "78f1111e7ce1e59d9167dfd928d15514", "score": "0.6704366", "text": "func (o *ExportTKGConfigForVsphereInternalServerError) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f7ce3875fadf98861606b8395f1f876e", "score": "0.67011565", "text": "func (o *GetCurrentComputerOK) SetPayload(payload []*modelapi.Computer) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5383764b6a09087631ba56c2a194f16d", "score": "0.66982627", "text": "func (o *ObjectsGetForbidden) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "85ed20e03c9e0a6fcade2bb991025bf7", "score": "0.66951567", "text": "func (o *GetNodesUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "95ec8f92b553e64477ef579e40c5528c", "score": "0.66916627", "text": "func (o *GetResetPasswordConfirmationTokenInternalServerError) SetPayload(payload *models.GeneralResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e90947212402b9dfab47788c20d5d050", "score": "0.6690749", "text": "func (o *GetPreTestingOK) SetPayload(payload *models.Testing) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f0e4f35b0d0f965d7b7a239df3a4e0ca", "score": "0.6686058", "text": "func (o *GetV1DevicesDeviceOK) SetPayload(payload *models.Device) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3cad860895ec54cfb63b43afaa904de1", "score": "0.6683329", "text": "func (o *GetStorageByPathOK) SetPayload(payload *models.Storage) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "777c9dfff14b2af684daf76958b24700", "score": "0.6682737", "text": "func (o *GetCampaignOK) SetPayload(payload *models.GetCampaignResp) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e18b91e7c3d054037023ad05374d12f1", "score": "0.6680031", "text": "func (o *GetRuntimeContainerInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "7eb83c0a0c7c5709901d30455c6b7d72", "score": "0.6679779", "text": "func (o *GetDataSomeKeyPathDefault) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "3f67fbd5c30664c9969defb4aac6f83c", "score": "0.6675639", "text": "func (o *GetApplicationOK) SetPayload(payload *models.Application) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b7a921a61380a00b73d64ae882850b60", "score": "0.6663819", "text": "func (o *DeleteUserbyIDInternalServerError) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f8c5a4ffd2273321c4d8ad8b2a9d0fbc", "score": "0.6661694", "text": "func (o *GetRecipeInternalServerError) SetPayload(payload *models.ReturnCode) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "db2805fb74a4eb8dafc974dcdfe798f1", "score": "0.66608393", "text": "func (o *ObjectsGetInternalServerError) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "f02ba1b6636a90c08fef9eb91c476af5", "score": "0.6658497", "text": "func (o *GetRouteTrainIDInternalServerError) SetPayload(payload *models.StatusResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "c9c4fd310dc635a1512437d6866520f5", "score": "0.6651918", "text": "func (o *GetEditQuestionsFromTagGone) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "0635b458e7dc84e4784504975f36d916", "score": "0.6646748", "text": "func (o *CommitConfigDocsOK) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9fb724ae295337eafcbebabec70c1f0b", "score": "0.6639444", "text": "func (o *ListApisCiliumIoV2CiliumEndpointOK) SetPayload(payload interface{}) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "8115c65826817f8ba93bb778b5ff0938", "score": "0.6633217", "text": "func (o *DeleteUserbyIDOK) SetPayload(payload *models.Response) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "acd586492a0d984a3e1adcfc970f8d99", "score": "0.66293615", "text": "func (o *GetByNameOK) SetPayload(payload *models.Result) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "714c2515297ac57dde898f39684951a1", "score": "0.6622471", "text": "func (o *PutIndexDocIDOK) SetPayload(payload *models.ModifyResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "91670365e22f613dce545d1273061009", "score": "0.6622118", "text": "func (o *GetCharactersCharacterIDSearchOK) SetPayload(payload *models.GetCharactersCharacterIDSearchOKBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "e133b3990ec9dcbad60d63e1bd1272e8", "score": "0.6618308", "text": "func (o *DownloadHostLogsOK) SetPayload(payload io.ReadCloser) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "54986aed614c927d4da0ff89bfa1e547", "score": "0.66164863", "text": "func (o *GetQuestionsFromTeamOK) SetPayload(payload []*models.Question) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "2a30ca150835f088efd64fd25500063c", "score": "0.66139346", "text": "func (o *AddCellKeypairConflict) SetPayload(payload *models.APIResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "9ceeaae0b5eab86a610da06efed9371a", "score": "0.6611856", "text": "func (o *GetRuntimeJobsInternalServerError) SetPayload(payload string) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "736c84993360f929c5525136078afd7b", "score": "0.66034573", "text": "func (o *GetCommandTemplateRequestEntityTooLarge) SetPayload(payload *models.HeappeError) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "b7e7c872a24d45522a85c8be2d50dc67", "score": "0.66014636", "text": "func (o *GetTokensOK) SetPayload(payload *GetTokensOKBody) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "febc49112539d31db784f83797df9a3e", "score": "0.6600416", "text": "func (o *GetCurrentUserComputerOK) SetPayload(payload *modelapi.Computer) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "c25c95a6adc5eb796a24da8657159084", "score": "0.65979016", "text": "func (o *GetQuestionsFromTeamForbidden) SetPayload(payload *models.Error) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "026e9b3496b5d1d9f0a168744b8ad1eb", "score": "0.65971184", "text": "func (o *GetDirectoryUnauthorized) SetPayload(payload *models.ErrorResponse) {\n\to.Payload = payload\n}", "title": "" }, { "docid": "5f72b69ece83607a39a4427948bfb5c1", "score": "0.65953267", "text": "func (o *WeaveModelManifestsValidateCommandDefsOK) SetPayload(payload *models.ModelManifestsValidateCommandDefsResponse) {\n\to.Payload = payload\n}", "title": "" } ]
34c8daa625e66478cd1bfeb379525db6
The string representing the regular expression. Minimum of `1` and maximum of `512` characters.
[ { "docid": "3470e6195fc8b5de3eb5c163ac17e59b", "score": "0.48553953", "text": "func (o RuleGroupRuleStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementRegexMatchStatement) string { return v.RegexString }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "464ac56fae92b3ca2ae2a1dc42ecff96", "score": "0.59179497", "text": "func (t RegularExpression) String() string {\n\tre := regexp.Regexp(t)\n\treturn re.String()\n}", "title": "" }, { "docid": "6ad21d5b6af084c759ab642a21757307", "score": "0.5637743", "text": "func (gen *Generator) Regexp(expr string, flags byte) error {\n\tif err := gen.checkState(false, 1+fixnumMaxBytes+len(expr)+1); err != nil {\n\t\treturn err\n\t}\n\n\tgen.buf[gen.bufn] = typeRegExp\n\tgen.bufn++\n\tgen.writeString(expr)\n\tgen.buf[gen.bufn] = flags\n\tgen.bufn++\n\n\treturn gen.writeAdv()\n}", "title": "" }, { "docid": "146f9593058b225c6c7e3e32b4caf52e", "score": "0.56298846", "text": "func (o DatascanDataQualitySpecRuleRegexExpectationOutput) Regex() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatascanDataQualitySpecRuleRegexExpectation) string { return v.Regex }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e1f4a1ca82c27a3568509520db9725a8", "score": "0.55882275", "text": "func (r *Regexp) String() string {\n\tregex := r.Get()\n\tif regex == nil {\n\t\treturn \"\"\n\t}\n\treturn regex.String()\n}", "title": "" }, { "docid": "477cd93d4054bfd48769d5e6b8822114", "score": "0.55147994", "text": "func regexToString(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {\n\tvar re *regexp.Regexp\n\terr := c.Check1Arg()\n\tif err == nil {\n\t\tre, err = regexArg(c, 0)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts := rt.StringValue(fmt.Sprintf(\"regex(%q)\", re.String()))\n\treturn c.PushingNext(t.Runtime, s), nil\n}", "title": "" }, { "docid": "1f7b2070f209c6fb9aee03ca325e626b", "score": "0.55046284", "text": "func (o DatascanDataQualitySpecRuleRegexExpectationPtrOutput) Regex() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *DatascanDataQualitySpecRuleRegexExpectation) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.Regex\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "14a9b1f6ca97f603cc8e5cfd27e2ad44", "score": "0.5444663", "text": "func (o DatascanDataQualityResultRuleRuleRegexExpectationOutput) Regex() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v DatascanDataQualityResultRuleRuleRegexExpectation) *string { return v.Regex }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "338fc9f3480f9608a0a186cf70e11d74", "score": "0.5356939", "text": "func TestMatchesRegexp(t *testing.T) {\n\tgenerator := rand.New(rand.NewSource(42))\n\tzone := \"us-central1-a\"\n\tdisk := \"my-disk\"\n\n\tresult, err := randomSnapshotName(zone, disk, generator)\n\tassert.NoError(t, err, \"No error expected\")\n\n\texp := regexp.MustCompile(\"(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?)\")\n\texp.Longest()\n\tassert.Equal(t, result, exp.FindString(result), \"The whole string should match the regexp\")\n}", "title": "" }, { "docid": "4a750f0b842e3c864417eab84d7f8d38", "score": "0.51825315", "text": "func TransformRegExp(pattern string) (string, error) {\n\n\tif pattern == \"\" {\n\t\treturn \"\", nil\n\t}\n\n\t// TODO If without \\, if without (?=, (?!, then another shortcut\n\n\tparser := _RegExp_parser{\n\t\tstr: pattern,\n\t\tlength: len(pattern),\n\t\tgoRegexp: bytes.NewBuffer(make([]byte, 0, 3*len(pattern)/2)),\n\t}\n\tparser.read() // Pull in the first character\n\tparser.scan()\n\tvar err error\n\tif len(parser.errors) > 0 {\n\t\terr = parser.errors[0]\n\t}\n\tif parser.invalid {\n\t\treturn \"\", err\n\t}\n\n\t// Might not be re2 compatible, but is still a valid JavaScript RegExp\n\treturn parser.goRegexp.String(), err\n}", "title": "" }, { "docid": "e91f904b387b8c91bf87ab5b323f8c73", "score": "0.51769114", "text": "func newRegex(t *rt.Thread, c *rt.GoCont) (rt.Cont, error) {\n\tvar s string\n\terr := c.Check1Arg()\n\tif err == nil {\n\t\ts, err = c.StringArg(0)\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tre, compErr := regexp.Compile(string(s))\n\tif compErr != nil {\n\t\treturn nil, compErr\n\t}\n\tregexMeta := t.Registry(regexMetaKey)\n\treturn c.PushingNext(t.Runtime, t.NewUserDataValue(re, regexMeta.AsTable())), nil\n}", "title": "" }, { "docid": "32d5771203100456b9e87271daddd4dc", "score": "0.5161945", "text": "func (x *Xeger) generateFromRegexp(re *syntax.Regexp) string {\n\tswitch re.Op {\n\tcase syntax.OpLiteral: // matches Runes sequence\n\t\treturn string(re.Rune)\n\n\tcase syntax.OpCharClass: // matches Runes interpreted as range pair list\n\t\tsum := 0\n\t\tfor i := 0; i < len(re.Rune); i += 2 {\n\t\t\tsum += 1 + int(re.Rune[i+1]-re.Rune[i])\n\t\t}\n\n\t\tindex := rune(randInt(sum))\n\t\tfor i := 0; i < len(re.Rune); i += 2 {\n\t\t\tdelta := re.Rune[i+1] - re.Rune[i]\n\t\t\tif index <= delta {\n\t\t\t\treturn string(rune(re.Rune[i] + index))\n\t\t\t}\n\t\t\tindex -= delta + 1\n\t\t}\n\t\treturn \"\"\n\n\tcase syntax.OpAnyCharNotNL: // matches any character except newline\n\t\tc := printableNotNL[randInt(len(printableNotNL))]\n\t\treturn string([]byte{c})\n\n\tcase syntax.OpAnyChar: // matches any character\n\t\tc := printable[randInt(len(printable))]\n\t\treturn string([]byte{c})\n\n\tcase syntax.OpCapture: // capturing subexpression with index Cap, optional name Name\n\t\treturn x.generateFromSubexpression(re, 1)\n\n\tcase syntax.OpStar: // matches Sub[0] zero or more times\n\t\treturn x.generateFromSubexpression(re, randInt(limit+1))\n\n\tcase syntax.OpPlus: // matches Sub[0] one or more times\n\t\treturn x.generateFromSubexpression(re, randInt(limit)+1)\n\n\tcase syntax.OpQuest: // matches Sub[0] zero or one times\n\t\treturn x.generateFromSubexpression(re, randInt(2))\n\n\tcase syntax.OpRepeat: // matches Sub[0] at least Min times, at most Max (Max == -1 is no limit)\n\t\tmax := re.Max\n\t\tif max == -1 {\n\t\t\tmax = limit\n\t\t}\n\t\tcount := randInt(max-re.Min+1) + re.Min\n\t\treturn x.generateFromSubexpression(re, count)\n\n\tcase syntax.OpConcat: // matches concatenation of Subs\n\t\treturn x.generateFromSubexpression(re, 1)\n\n\tcase syntax.OpAlternate: // matches alternation of Subs\n\t\ti := randInt(len(re.Sub))\n\t\treturn x.generateFromRegexp(re.Sub[i])\n\n\t\t/*\n\t\t\t// The other cases return empty string.\n\t\t\tcase syntax.OpNoMatch: // matches no strings\n\t\t\tcase syntax.OpEmptyMatch: // matches empty string\n\t\t\tcase syntax.OpBeginLine: // matches empty string at beginning of line\n\t\t\tcase syntax.OpEndLine: // matches empty string at end of line\n\t\t\tcase syntax.OpBeginText: // matches empty string at beginning of text\n\t\t\tcase syntax.OpEndText: // matches empty string at end of text\n\t\t\tcase syntax.OpWordBoundary: // matches word boundary `\\b`\n\t\t\tcase syntax.OpNoWordBoundary: // matches word non-boundary `\\B`\n\t\t*/\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "d6f63982763028dba740622b838907ee", "score": "0.5124329", "text": "func (r RegexpStringSubjectMatcher) String() string {\n\treturn r.Pattern.String()\n}", "title": "" }, { "docid": "7eddcb657b6775053365bb7f32358194", "score": "0.5102058", "text": "func (o CustomDataIdentifierOutput) Regex() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *CustomDataIdentifier) pulumi.StringPtrOutput { return v.Regex }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8316b78ba27624ecb976182124484b40", "score": "0.5087397", "text": "func createProposalNameRegex() string {\n\tvar validProposalNameBuffer bytes.Buffer\n\tvalidProposalNameBuffer.WriteString(\"^[\")\n\n\tfor _, supportedChar := range www.PolicyProposalNameSupportedChars {\n\t\tif len(supportedChar) > 1 {\n\t\t\tvalidProposalNameBuffer.WriteString(supportedChar)\n\t\t} else {\n\t\t\tvalidProposalNameBuffer.WriteString(`\\` + supportedChar)\n\t\t}\n\t}\n\tminNameLength := strconv.Itoa(www.PolicyMinProposalNameLength)\n\tmaxNameLength := strconv.Itoa(www.PolicyMaxProposalNameLength)\n\tvalidProposalNameBuffer.WriteString(\"]{\")\n\tvalidProposalNameBuffer.WriteString(minNameLength + \",\")\n\tvalidProposalNameBuffer.WriteString(maxNameLength + \"}$\")\n\n\treturn validProposalNameBuffer.String()\n}", "title": "" }, { "docid": "36bfa24de9117250ccdd8b8eeb035dfd", "score": "0.5064721", "text": "func (m *Matcher) GetRegexString() string {\n\tif m.re == nil {\n\t\treturn \"\"\n\t}\n\treturn m.re.GetRegexString()\n}", "title": "" }, { "docid": "4b12a1539a43802dc232f76ecc1c7285", "score": "0.50512594", "text": "func re(s string) *regexp.Regexp {\n\treturn regexp.MustCompile(s)\n}", "title": "" }, { "docid": "4b12a1539a43802dc232f76ecc1c7285", "score": "0.50512594", "text": "func re(s string) *regexp.Regexp {\n\treturn regexp.MustCompile(s)\n}", "title": "" }, { "docid": "22a7055a971fd054c8eb561fe3eebd5a", "score": "0.5023392", "text": "func RegexpCacheMaxSizeBytes() int {\n\treturn regexpCache.SizeMaxBytes()\n}", "title": "" }, { "docid": "5ed31b5d4470e273303729ee1dd375f1", "score": "0.5017426", "text": "func toRegExp(s string) *regexp.Regexp {\n\t// Escape the input string.\n\ts = regexp.QuoteMeta(s)\n\t// Unescape special * and ? characters because they have special meanings.\n\ts = strings.Replace(s, \"\\\\*\", \".*\", -1)\n\ts = strings.Replace(s, \"\\\\?\", \".\", -1)\n\texpr := regexp.MustCompile(s)\n\treturn expr\n}", "title": "" }, { "docid": "3d2681c1b09d04a73c9d1d0b66d44127", "score": "0.5008579", "text": "func (l DefaultLocale) RegexPattern() string {\r\n\treturn `Invalid regex pattern '{{.pattern}}'`\r\n}", "title": "" }, { "docid": "a169c20639610e3eafa80c820117496e", "score": "0.49866384", "text": "func rawPattern(s string) *regexp.Regexp {\n\treturn regexp.MustCompile(regexp.QuoteMeta(s))\n}", "title": "" }, { "docid": "63998cff778c953fbefdf71a75c76866", "score": "0.49860847", "text": "func RegexpCacheSize() int {\n\treturn regexpCache.Len()\n}", "title": "" }, { "docid": "2566a754e65bd1da59a483810444ec26", "score": "0.49847758", "text": "func regex(s string) (*regexp.Regexp, error) {\n\tif rawString.MatchString(s) {\n\t\ts = fmt.Sprintf(\"^%s$\", s)\n\t}\n\treturn regexp.Compile(s)\n}", "title": "" }, { "docid": "d52f58b881c287c9e9f205f5454943f7", "score": "0.4971451", "text": "func (*Regex) Descriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_extensions_proto_rawDescGZIP(), []int{314}\n}", "title": "" }, { "docid": "f8eb0cc56a62e37ff6529186e0f55f61", "score": "0.4941052", "text": "func (r *regexpFlag) String() string {\n\tif r.reg != nil {\n\t\treturn r.reg.String()\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "bc38a577280f6360223514eb392b9c23", "score": "0.4937345", "text": "func emptyString() regexpInfo {\n\treturn regexpInfo{\n\t\tcanEmpty: true,\n\t\texact: []string{\"\"},\n\t}\n}", "title": "" }, { "docid": "aeae627b68668fafff0b6f2738fd4bec", "score": "0.49292105", "text": "func (rl *RegexpLiteral) String() string {\n\n\treturn (fmt.Sprintf(\"/%s/%s\", rl.Value, rl.Flags))\n}", "title": "" }, { "docid": "0927c8a90e9ea16253cfabe0a894d0a1", "score": "0.49272713", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementAndStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementNotStatementStatementAndStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a2209d228f379b9bce110b434cfa90aa", "score": "0.492247", "text": "func (o WebAclRuleStatementNotStatementStatementNotStatementStatementAndStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementNotStatementStatementNotStatementStatementAndStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "29e9ba6ada4dddd564ed5346e6bde56a", "score": "0.49206415", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementAndStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c6e6ada8a5bcb93dc5f08f8f027de437", "score": "0.48956117", "text": "func (e Error) RegexPattern() string {\n\treturn `Invalid regex pattern '{{.pattern}}'`\n}", "title": "" }, { "docid": "48a7a8d46191e1b482b41e9f36f6ddeb", "score": "0.4889034", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementNotStatementStatementAndStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4e611c34143a84bacd8698d3d0a3e465", "score": "0.488694", "text": "func anyChar() regexpInfo {\n\treturn regexpInfo{\n\t\tprefix: []string{\"\"},\n\t\tsuffix: []string{\"\"},\n\t}\n}", "title": "" }, { "docid": "9822fb38f57ced754341eb205b7125b0", "score": "0.48767588", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementOrStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementAndStatementStatementOrStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e9eba656aa967a9078fe0c184594b516", "score": "0.48764846", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementNotStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementNotStatementStatementAndStatementStatementNotStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c96d2a7301eaa99b907f4dac8df25160", "score": "0.48751226", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementOrStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementNotStatementStatementAndStatementStatementOrStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0a775259c847560ef453630f57230b72", "score": "0.48699412", "text": "func (o WebAclRuleStatementNotStatementStatementAndStatementStatementNotStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementNotStatementStatementAndStatementStatementNotStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "d316007c1841d6fbe912b6dcb769fc36", "score": "0.48665184", "text": "func NewPromRegex(expr string) (*PromRegex, error) {\n\tif _, err := regexp.Compile(expr); err != nil {\n\t\treturn nil, err\n\t}\n\tprefix, suffix := Simplify(expr)\n\torValues := GetOrValues(suffix)\n\tsubstrDotStar := getSubstringLiteral(suffix, \".*\")\n\tsubstrDotPlus := getSubstringLiteral(suffix, \".+\")\n\t// It is expected that Optimize returns valid regexp in suffix, so use MustCompile here.\n\t// Anchor suffix to the beginning and the end of the matching string.\n\tsuffixExpr := \"^(?:\" + suffix + \")$\"\n\treSuffix := regexp.MustCompile(suffixExpr)\n\treSuffixMatcher := bytesutil.NewFastStringMatcher(reSuffix.MatchString)\n\tpr := &PromRegex{\n\t\tprefix: prefix,\n\t\tsuffix: suffix,\n\t\tsubstrDotStar: substrDotStar,\n\t\tsubstrDotPlus: substrDotPlus,\n\t\torValues: orValues,\n\t\treSuffixMatcher: reSuffixMatcher,\n\t}\n\treturn pr, nil\n}", "title": "" }, { "docid": "5b02fac89e7db9481088bcd64805294e", "score": "0.48416245", "text": "func (r RegexpGroupStringSubjectMatcher) String() string {\n\treturn r.Pattern.String()\n}", "title": "" }, { "docid": "38b9c75a7930457dc35706660347a70a", "score": "0.48333514", "text": "func (w World) GetRegexParam() string {\n w.regexParamIndex++\n if w.regexParamIndex >= len(w.regexParams) {\n panic(\"GetRegexParam() called too many times.\")\n }\n return w.regexParams[w.regexParamIndex]\n}", "title": "" }, { "docid": "550ec042dfbf6f7faea365d201dfc70d", "score": "0.47997203", "text": "func JSObjectMakeRegExp(ctx JSContextRef, argumentCount uint, arguments []JSValueRef, exception []JSValueRef) JSObjectRef {\n\tcctx, _ := *(*C.JSContextRef)(unsafe.Pointer(&ctx)), cgoAllocsUnknown\n\tcargumentCount, _ := (C.size_t)(argumentCount), cgoAllocsUnknown\n\tcarguments, _ := (*C.JSValueRef)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&arguments)).Data)), cgoAllocsUnknown\n\tcexception, _ := (*C.JSValueRef)(unsafe.Pointer((*sliceHeader)(unsafe.Pointer(&exception)).Data)), cgoAllocsUnknown\n\t__ret := C.JSObjectMakeRegExp(cctx, cargumentCount, carguments, cexception)\n\t__v := *(*JSObjectRef)(unsafe.Pointer(&__ret))\n\treturn __v\n}", "title": "" }, { "docid": "f924b0129c90fec0ae75ac068f1599c8", "score": "0.47836503", "text": "func (o RuleGroupRuleStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "90b97c9d973b32d46cb76261b6462584", "score": "0.47538015", "text": "func (g *grammar) Regex(pattern string) Terminal {\n\tvar r regex\n\tvar ok bool\n\tif r, ok = g.regexes[pattern]; !ok {\n\t\tr = regex {\n\t\t\tregexp.MustCompile(pattern),\n\t\t}\n\t\tg.regexes[pattern] = r\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "fa0688fd67caf561f873dbae36babecf", "score": "0.47455004", "text": "func (p *Pattern) String() string {\n\treturn p.raw\n}", "title": "" }, { "docid": "44f07810d2f37e13a0fca8a9c79ae2ec", "score": "0.47408196", "text": "func RegexpCacheSizeBytes() int {\n\treturn regexpCache.SizeBytes()\n}", "title": "" }, { "docid": "6236164ef5297e1e8d039466cb482edd", "score": "0.4733013", "text": "func regexpCompile(prgrm *ast.CXProgram, inputs []ast.CXValue, outputs []ast.CXValue) error {\n\t// Extracting regular expression to work with, contained in `inp0`.\n\texp := inputs[0].Get_str(prgrm)\n\n\t// Output structure `Regexp`.\n\treg := ast.CXArgument{}\n\terr := copier.Copy(&reg, outputs[0].TypeSignature)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Extracting CX `regexp` package.\n\tregexpPkg, err := prgrm.GetPackage(\"regexp\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Extracting `regexp`'s Regexp structure.\n\tregexpType, err := regexpPkg.GetStruct(prgrm, \"Regexp\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Extracting `regexp.Regexp`'s `exp` field.\n\texpFld, err := regexpType.GetField(prgrm, \"exp\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t// Writing the regex provided by the user to `reg`.\n\t// This allows us to know what `Regexp` instance the user wants to use\n\t// in other parts of CX code.\n\t// TODO: I don't know what would happen if the user uses the same regex\n\t// in two parts of a CX program. They'll be using the same instance\n\t// internally.\n\texpFldIdx := prgrm.AddCXArgInArray(expFld)\n\taccessExp := []ast.CXArgumentIndex{expFldIdx}\n\treg.Fields = accessExp\n\ttypes.Write_str(prgrm, prgrm.Memory, ast.GetFinalOffset(prgrm, outputs[0].FramePointer, &reg, nil), exp)\n\t// Storing `Regexp` instance.\n\tregexps[exp], err = regexp.Compile(exp)\n\n\treturn err\n}", "title": "" }, { "docid": "4fc01128ace1e498a8e65e6b49e09233", "score": "0.47024676", "text": "func InitRegexCompileImageName() error {\n\tvar err error\n\tregexResImageNameChar, err = regexp.Compile(`[^a-zA-Z\\d\\s:]`)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f561bebbd0a35551d63f5f7256911cf7", "score": "0.47015557", "text": "func (r *Regexp) Type() Type {\n\treturn &RegexpType{}\n}", "title": "" }, { "docid": "c6b9db94ac397b4c221a52e5c3828c47", "score": "0.4698221", "text": "func regexify(name string) (*regexp.Regexp, error) {\n\t// Empty equates to all.\n\tif name == \"\" {\n\t\tname = \"(?i).*\"\n\t}\n\t// Anchor if required.\n\tif !strings.HasPrefix(name, \"^\") {\n\t\tname = fmt.Sprintf(\"^%s\", name)\n\t}\n\tif !strings.HasSuffix(name, \"$\") {\n\t\tname = fmt.Sprintf(\"%s$\", name)\n\t}\n\t// Case insensitivity if required.\n\tif !strings.HasPrefix(name, \"(?i)\") {\n\t\tname = fmt.Sprintf(\"(?i)%s\", name)\n\t}\n\n\treturn regexp.Compile(name)\n\n}", "title": "" }, { "docid": "8f052036a57c52464e6e2fcfe762590b", "score": "0.46954855", "text": "func (*RegexMatcher) Descriptor() ([]byte, []int) {\n\treturn file_envoy_type_matcher_v3_regex_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "39c9ef5324b8085e22fd1db54c48e01e", "score": "0.46941563", "text": "func main() {\n\n\tx := `String123`\n\tfmt.Println(x)\n}", "title": "" }, { "docid": "44f847b1a6fe74a449ab92dc9e5efde2", "score": "0.46836358", "text": "func (p Pattern) String() string {\n\treturn p.output\n}", "title": "" }, { "docid": "06cda8c2e3a1616089e4f7b7efae18d5", "score": "0.46776736", "text": "func RegEx(field Field, regexp, options string) bson.M {\n\treturn bson.M{field.String(): bson.M{\"$regex\": bson.RegEx{regexp, options}}}\n}", "title": "" }, { "docid": "ab2776a9f8f621e8b9201ce3dbb0486d", "score": "0.46490225", "text": "func (p *pathlessWildcardPattern) String() string {\n\treturn p.rawPattern\n}", "title": "" }, { "docid": "9b0d5e24a077294757afe06d1977861e", "score": "0.4645925", "text": "func encodeRegexp(buf *bytes.Buffer, name string, val Regexp) error {\n\t// type\n\tif err := buf.WriteByte(_REGEXP); err != nil {\n\t\treturn err\n\t}\n\n\t// name\n\tif err := writeCstring(buf, name); err != nil {\n\t\treturn err\n\t}\n\n\t// regex\n\tif err := writeCstring(buf, val.Pattern); err != nil {\n\t\treturn err\n\t}\n\n\t// options\n\treturn writeCstring(buf, val.Options)\n}", "title": "" }, { "docid": "49ed4552868dfbfe20ec949896eb8151", "score": "0.4636566", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "08bbedf63c2a1e57f513253b227c7b8f", "score": "0.46357712", "text": "func NewRegexp(val string) *Regexp {\n\treturn &Regexp{\n\t\tvalue: val,\n\t}\n}", "title": "" }, { "docid": "c5dd792ba35074c03be5305ddbc6e16a", "score": "0.46292606", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "38d44711c61ddd72f07c5099a2910641", "score": "0.4621842", "text": "func regexArg(c *rt.GoCont, n int) (*regexp.Regexp, error) {\n\tre, ok := valueToRegex(c.Arg(n))\n\tif ok {\n\t\treturn re, nil\n\t}\n\treturn nil, fmt.Errorf(\"#%d must be a regex\", n+1)\n}", "title": "" }, { "docid": "9626a46554cc9098d9728b951115a1e7", "score": "0.4614646", "text": "func TestPattern(t *testing.T) {\n\tassert := asserts.NewTesting(t, asserts.FailStop)\n\tgen := generators.New(generators.FixedRand())\n\tassertPattern := func(pattern, runes string) {\n\t\tset := make(map[rune]bool)\n\t\tfor _, r := range runes {\n\t\t\tset[r] = true\n\t\t}\n\t\tfor i := 0; i < 10; i++ {\n\t\t\tresult := gen.Pattern(pattern)\n\t\t\tfor _, r := range result {\n\t\t\t\tassert.True(set[r], pattern, result, runes)\n\t\t\t}\n\t\t}\n\t}\n\n\tassertPattern(\"^^\", \"^\")\n\tassertPattern(\"^0^0^0^0^0\", \"0123456789\")\n\tassertPattern(\"^1^1^1^1^1\", \"123456789\")\n\tassertPattern(\"^o^o^o^o^o\", \"01234567\")\n\tassertPattern(\"^h^h^h^h^h\", \"0123456789abcdef\")\n\tassertPattern(\"^H^H^H^H^H\", \"0123456789ABCDEF\")\n\tassertPattern(\"^a^a^a^a^a\", \"abcdefghijklmnopqrstuvwxyz\")\n\tassertPattern(\"^A^A^A^A^A\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\")\n\tassertPattern(\"^c^c^c^c^c\", \"bcdfghjklmnpqrstvwxyz\")\n\tassertPattern(\"^C^C^C^C^C\", \"BCDFGHJKLMNPQRSTVWXYZ\")\n\tassertPattern(\"^v^v^v^v^v\", \"aeiou\")\n\tassertPattern(\"^V^V^V^V^V\", \"AEIOU\")\n\tassertPattern(\"^z^z^z^z^z\", \"abcdefghijklmnopqrstuvwxyz0123456789\")\n\tassertPattern(\"^Z^Z^Z^Z^Z\", \"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\")\n\tassertPattern(\"^1^0.^0^0^0,^0^0 €\", \"0123456789 .,€\")\n}", "title": "" }, { "docid": "bd2068dbd9e45b678a65154e1813aa79", "score": "0.46072337", "text": "func getOptimizedReMatchFunc(reMatch func(b []byte) bool, expr string) (func(b []byte) bool, string, uint64) {\n\tsre, err := syntax.Parse(expr, syntax.Perl)\n\tif err != nil {\n\t\tlogger.Panicf(\"BUG: unexpected error when parsing verified expr=%q: %s\", expr, err)\n\t}\n\t// Prepare fast string matcher for reMatch.\n\tfsm := bytesutil.NewFastStringMatcher(func(s string) bool {\n\t\treturn reMatch(bytesutil.ToUnsafeBytes(s))\n\t})\n\treMatchFast := func(b []byte) bool {\n\t\treturn fsm.Match(bytesutil.ToUnsafeString(b))\n\t}\n\n\tif matchFunc, literalSuffix, reCost := getOptimizedReMatchFuncExt(reMatchFast, sre); matchFunc != nil {\n\t\t// Found optimized function for matching the expr.\n\t\tsuffixUnescaped := tagCharsReverseRegexpEscaper.Replace(literalSuffix)\n\t\treturn matchFunc, suffixUnescaped, reCost\n\t}\n\t// Fall back to reMatchFast.\n\treturn reMatchFast, \"\", reMatchCost\n}", "title": "" }, { "docid": "afe442db08bb64ce0c5046e3d236f448", "score": "0.46070597", "text": "func RegexGrep(realRec Record, arguments []otto.Value) string {\n\tcomponentName := arguments[0].String()\n\tcomponent := GetComponent(realRec, componentName)\n\n\tregexString := arguments[1].String()\n\tvar position int\n\tvar err error\n\tif len(arguments) > 2 {\n\t\tposition, err = strconv.Atoi(arguments[2].String())\n\t\tif err != nil {\n\t\t\tposition = 0\n\t\t}\n\t}\n\n\tvar value string\n\tr, rerr := regexp.Compile(regexString)\n\tif rerr != nil {\n\t\treturn \"\"\n\t}\n\tmatches := r.FindStringSubmatch(component)\n\tif len(matches) > 0 {\n\t\tif position <= len(matches) {\n\t\t\tvalue = matches[position]\n\t\t} else {\n\t\t\tvalue = matches[0]\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "c17c79b0552c93d88d5a7e0e1e7659a0", "score": "0.4592731", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementRateBasedStatementScopeDownStatementOrStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9225b2bf1e4425e820c10ff7f3303ae7", "score": "0.45863423", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementRateBasedStatementScopeDownStatementAndStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "ee4910510802d00d6a23c112a5425070", "score": "0.4585066", "text": "func (s *StringRegexValue) String() string {\n\tif s.s == nil {\n\t\treturn \"\"\n\t}\n\n\treturn *s.s\n}", "title": "" }, { "docid": "d0d80a268b371a6d91d264ae61a8ac89", "score": "0.45839757", "text": "func (dec *Decoder) decodeRegexp() *regexp.Regexp {\n\tmajor, _, err := dec.parser.parseInformation()\n\tcheckErr(err)\n\n\tif major != cborTextString {\n\t\tpanic(fmt.Errorf(\"expected string found %v\", major))\n\t}\n\tre, err := regexp.Compile(dec.decodeString())\n\tcheckErr(err)\n\treturn re\n}", "title": "" }, { "docid": "b547bfa192fa4692de9c74acd2711961", "score": "0.45767063", "text": "func BenchmarkParseCommandParametersRegexMedium(b *testing.B) {\n\ttestMessage := `{ driver: { name: \"PyMongo\", version: \"3.4.0\" }, os: { type: \"Linux\" } }`\n\tre := regexp.MustCompile(`{ driver: { name: \"(?P<driverName>.*)\", version: \"(?P<driverVersion>.*)\" }, os: { type: \"(?P<osType>.*)\" } }`)\n\n\tfor i := 0; i < b.N; i++ {\n\t\t_ = re.FindStringSubmatch(testMessage)\n\t}\n}", "title": "" }, { "docid": "28ea43cbb1be7cf262175c8704b600d8", "score": "0.45570725", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8be14bf096a5394621b19135914a3552", "score": "0.45507655", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementRateBasedStatementScopeDownStatementNotStatementStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e26c74b9c40c89eaf953dce3c9ec8bf5", "score": "0.4547757", "text": "func OptimizeRegexp(re *syntax.Regexp, flags syntax.Flags) *syntax.Regexp {\n\tr := convertCapture(re, flags)\n\treturn r.Simplify()\n}", "title": "" }, { "docid": "aeadc5b201f84af35288d0948538bf30", "score": "0.45414594", "text": "func (h *Weather) Re() string {\n\treturn `(?i)^weather: (\\d+)$`\n}", "title": "" }, { "docid": "3565483a98fec1e828935158f36a6617", "score": "0.4534038", "text": "func (p *doubleWildcardPattern) String() string {\n\treturn p.rawPattern\n}", "title": "" }, { "docid": "032c44c31b8da8516fb06f2f4af7cd95", "score": "0.45229676", "text": "func charactersInAStringLiteral(count string) string {\n\tcontent := iostream\n\tcontent += \"#include <cstring>\\n\"\n\trequiredCount, _ := strconv.Atoi(count)\n\tcontent += \"int main() {\\n\"\n\tcontent += \"const char* a=\\\"\\\\\\n\"\n\tcctr := 0\n\tfor i := 0; i < requiredCount; i++ {\n\t\tcctr += 1\n\t\tif cctr == 80 {\n\t\t\tcctr = 0\n\t\t\tcontent += \"\\\\\\n\"\n\t\t}\n\t\tcontent += string(rune(97 + rand.Intn(26)))\n\t}\n\tcontent += \"\\\";\\n\\tstd::cout << std::strlen(a) << std::endl;\\n}\\n\"\n\treturn writeTestFile(trace(), count, content)\n}", "title": "" }, { "docid": "a6e19340be8a77ee90d3aa28bed9456d", "score": "0.45226142", "text": "func RegexCount(component string, analyzeString string) int {\n\tr, err := regexp.Compile(analyzeString)\n\tif err != nil {\n\t\treturn 0\n\t}\n\tmatches := r.FindAllStringIndex(component, -1)\n\treturn len(matches)\n}", "title": "" }, { "docid": "0dea109d8346eddd674d234ac3a5c375", "score": "0.4509965", "text": "func (e *regexArrayValue) Type() string {\n\treturn \"regex\"\n}", "title": "" }, { "docid": "7b6dfe20c77d791a6b28736f0f5a5d67", "score": "0.45029405", "text": "func TestStringRemittanceFreeTextVariableLength(t *testing.T) {\n\tvar line = \"{8750}\"\n\tr := NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr := r.parseRemittanceFreeText()\n\trequire.Nil(t, err)\n\n\tline = \"{8750} NNN\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittanceFreeText()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{8750}****************************\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittanceFreeText()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{8750}*\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittanceFreeText()\n\trequire.Equal(t, err, nil)\n}", "title": "" }, { "docid": "27b631ad43093bc010fbd71e5074b37b", "score": "0.44935483", "text": "func (matcher *WildcardMatcher) Pattern() string {\n\treturn matcher.pattern\n}", "title": "" }, { "docid": "52a75eb40e0e6278663a5209802eebb1", "score": "0.4481828", "text": "func (m *Match) MatchString() string { return string(m.match) }", "title": "" }, { "docid": "ac146d3ba0f8babcc7ee64942b92a330", "score": "0.4477521", "text": "func (r *RegexLiteral) String() string {\n\tif r.Val != nil {\n\t\treturn fmt.Sprintf(\"/%s/\",\n\t\t\tstrings.Replace(r.Val.String(), `/`, `\\/`, -1))\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "1d8468ad9350d213641e8a099e24e9ff", "score": "0.4472057", "text": "func RegexMatch(regex_type, str string) bool {\n\tregexes := map[string]string{\n\t\t\"mail\": \"^[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\t\"ip\": `(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}`,\n\t\t\"mac\": `^([0-9A-Fa-f]{2}[:-])/contains{5}([0-9A-Fa-f]{2})$`,\n\t\t\"date\": `\\d{4}-\\d{2}-\\d{2}`,\n\t\t\"domain\": `^(?:https?:\\/\\/)?(?:[^@\\/\\n]+@)?(?:www\\.)?([^:\\/\\n]+)`,\n\t\t\"phone\": `^(?:(?:\\(?(?:00|\\+)([1-4]\\d\\d|[1-9]\\d?)\\)?)?[\\-\\.\\ \\\\\\/]?)?((?:\\(?\\d{1,}\\)?[\\-\\.\\ \\\\\\/]?){0,})(?:[\\-\\.\\ \\\\\\/]?(?:#|ext\\.?|extension|x)[\\-\\.\\ \\\\\\/]?(\\d+))?$`,\n\t\t\"ccn\": `^(?:4[0-9]{12}(?:[0-9]{3})?|[25][1-7][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\\d{3})\\d{11})$`,\n\t\t\"time\": `^([0-9]|0[0-9]|1[0-9]|2[0-3]):([0-9]|[0-5][0-9])$`,\n\t\t\"crypto\": `^(bc1|[13])[a-zA-HJ-NP-Z0-9]{25,39}$`,\n\t}\n\tr := regexp.MustCompile(regexes[regex_type])\n\tmatches := r.FindAllString(str, -1)\n\n\treturn len(matches) != 0\n}", "title": "" }, { "docid": "3eb246ba2aee7471b5ca276c7654aa49", "score": "0.44611764", "text": "func (n *Node) BuildRegex(ignoreCase bool, starters []rune, endingers []rune, matchStartAndEndLine bool) *regexp2.Regexp {\r\n\r\n\tgex := \"\"\r\n\r\n\tif ignoreCase {\r\n\t\tgex += \"(?i)\"\r\n\t}\r\n\r\n\t//start our regex with our starters, and matching starts and ends of line\r\n\tif len(starters) > 0 {\r\n\t\t//INstead of using positive lookbehind, we can use not matching group, and a positive lookahread at the end to not capture the final character\r\n\t\t//tempGex := \"(?<=[\"\r\n\t\ttempGex := \"(?:[\"\r\n\t\tfor _, r := range starters {\r\n\t\t\ttempGex += string(r)\r\n\t\t}\r\n\t\ttempGex += \"]\"\r\n\r\n\t\tif matchStartAndEndLine {\r\n\t\t\ttempGex += \"|^\"\r\n\t\t}\r\n\t\ttempGex += \")\"\r\n\r\n\t\tgex += tempGex\r\n\t}\r\n\r\n\t//Need to create a simplifier so we don't need it every time\r\n\t// How to do this without backtracing I am not entirely sure, maybe a set of arrays will work\r\n\t//Create the capture group begging\r\n\tgex += \"(\"\r\n\tfor _, y := range n.children{\r\n\t\tgex += y.buildRegex()\r\n\t\tgex += \"|\"\r\n\t}\r\n\tgex = gex[:len(gex)-1]\r\n\r\n\t//Capture group ending\r\n\tgex += \")\"\r\n\t// Had a thought to generate split sections\r\n\t// EX REGEX for dog, dogs, hell, hello, cat without optional starters\r\n\t// \t\"(?i)({dog}{})\"\r\n\tif len(endingers) > 0 {\r\n\t\t//For our endings, use a positive lookahead to check for our ending characters, without consuming them for the next regex\r\n\t\ttempGex := \"(?=[\"\r\n\t\tfor _, r := range endingers {\r\n\t\t\ttempGex += string(r)\r\n\t\t}\r\n\t\ttempGex += \"]\"\r\n\r\n\t\tif matchStartAndEndLine {\r\n\t\t\ttempGex += \"|$\"\r\n\t\t}\r\n\t\ttempGex += \")\"\r\n\r\n\t\tgex += tempGex\r\n\t}\r\n\t//fmt.Println(gex)\r\n\treturn regexp2.MustCompile(gex, regexp2.None)\r\n}", "title": "" }, { "docid": "4274bf16d9a8f77d42d7b7bac87a0ae8", "score": "0.44437274", "text": "func wildCardToRegexp(pattern string) string {\n\tvar result strings.Builder\n\tfor i, literal := range strings.Split(pattern, \"*\") {\n\t\t// Replace * with .*\n\t\tif i > 0 {\n\t\t\tresult.WriteString(\".*\")\n\t\t}\n\t\t// Quote any regular expression meta characters in the literal text.\n\t\tresult.WriteString(regexp.QuoteMeta(literal))\n\t}\n\treturn result.String()\n}", "title": "" }, { "docid": "fe56b0e3ebdd7da783166d9a34445267", "score": "0.4439198", "text": "func (r *Regexp) JSON() string {\n\treturn \"\\\"\" + r.value + \"\\\"\"\n}", "title": "" }, { "docid": "153374ea514078db28274fd38c4d0c5f", "score": "0.44272748", "text": "func (TestNamePattern) Size() int { return 1 }", "title": "" }, { "docid": "0407913b7a3143d956ba72d683b8fe24", "score": "0.44223198", "text": "func TestValidator_Validate_PasswordTooShort_Invalid(t *testing.T) {\n\tval := NewValidator()\n\n\t// Length = 7\n\tpass := \"ZI(9§sl\"\n\tassert.False(t, val.Validate(pass), \"The password should be invalid\")\n}", "title": "" }, { "docid": "231d139c1cc7811e8197af5e4caa2ff4", "score": "0.44216353", "text": "func NewRegexp(left sql.Expression, right sql.Expression) *Regexp {\n\tvar cached = true\n\tsql.Inspect(right, func(e sql.Expression) bool {\n\t\tif _, ok := e.(*GetField); ok {\n\t\t\tcached = false\n\t\t}\n\t\treturn true\n\t})\n\n\treturn &Regexp{\n\t\tcomparison: newComparison(left, right),\n\t\tpool: nil,\n\t\tcached: cached,\n\t\tonce: sync.Once{},\n\t}\n}", "title": "" }, { "docid": "8e2d8d702bb7ae1e96c5880f07b7d506", "score": "0.44121048", "text": "func (f *Field) RegexElement(requireParens bool) string {\n\ttermPattern := `(?:[0-9]*(?:` + f.polyRing.VarName() + `(?:\\^?[0-9]+)?)|[0-9]+)`\n\tmoreTerms := `(?:` + // Optional group of additional terms consisting of\n\t\t`\\s*(?:\\+|-)\\s*` + // a sign\n\t\ttermPattern + // and a term\n\t\t`)*`\n\n\tvar pattern string\n\n\tif requireParens {\n\t\tpattern = `(?:\\(\\s*` + termPattern + moreTerms + `\\s*\\)|` + // several\n\t\t\t// terms in parentheses\n\t\t\ttermPattern + `)` // Or single term\n\n\t} else {\n\t\tpattern = termPattern + moreTerms\n\t}\n\n\treturn pattern\n}", "title": "" }, { "docid": "64f2c5cd8ae239230b377c4f43f94f34", "score": "0.44080192", "text": "func nameRegex(name string) string {\n\treturn fmt.Sprintf(`(?P<%s>(?:[^:]|:[^/])+)`, name)\n}", "title": "" }, { "docid": "16d091d3021cd6387561af194b1a4cc2", "score": "0.44068485", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementRegexMatchStatementPtrOutput) RegexString() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementRateBasedStatementScopeDownStatementRegexMatchStatement) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn &v.RegexString\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e10ee3da04ddb8c57ddb4128bce73305", "score": "0.4406055", "text": "func TestStringRemittanceVariableLength(t *testing.T) {\n\tvar line = \"{7070}\"\n\tr := NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr := r.parseRemittance()\n\trequire.Nil(t, err)\n\n\tline = \"{7070} NNN\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittance()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{7070}************\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittance()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{7070}*\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseRemittance()\n\trequire.Equal(t, err, nil)\n}", "title": "" }, { "docid": "fbd5a40b8a0e7b4bc26ea2edc2a09d1a", "score": "0.44029126", "text": "func TestStringOriginatorVariableLength(t *testing.T) {\n\tvar line = \"{5000}B1*\"\n\tr := NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr := r.parseOriginator()\n\trequire.Nil(t, err)\n\n\tline = \"{5000}B1 NNN\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseOriginator()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{5000}B1*******\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseOriginator()\n\trequire.ErrorContains(t, err, r.parseError(NewTagMaxLengthErr(errors.New(\"\"))).Error())\n\n\tline = \"{5000}B1*\"\n\tr = NewReader(strings.NewReader(line))\n\tr.line = line\n\n\terr = r.parseOriginator()\n\trequire.Equal(t, err, nil)\n}", "title": "" }, { "docid": "6d2ed8f78ab1d3ddc46042ae6da986f2", "score": "0.4400444", "text": "func anchorValue(str string) string {\n\t//Reference: NewFastRegexMatcher in Prometheus source code\n\treturn \"^(?:\" + str + \")$\"\n}", "title": "" }, { "docid": "d586ee5600d14fc3b15ace36c2544164", "score": "0.43914333", "text": "func convertSQLToRegex(in string) string {\n\treturn `\\Q` + in + `\\E`\n}", "title": "" }, { "docid": "ee70cb2f81b1ba1da0c45e23b8f4c5b1", "score": "0.43896404", "text": "func patsize(pat Pattern) int {\n\tif len(pat) == 0 {\n\t\treturn 0\n\t}\n\n\ttag := pat[0]\n\n\tswitch tag {\n\tcase bol, eol, any:\n\t\treturn 1\n\tcase litchar:\n\t\t_, n := utf8.DecodeRuneInString(string(pat[1:]))\n\t\treturn 1 + n\n\tcase ccl, nccl:\n\t\tnc := int(pat[1]) // liczba znaków w klasie\n\t\tp := pat[2:] // początek znaków w klasie\n\t\tb := 0 // licznik bajtów\n\t\tfor i := 0; i < nc; i++ {\n\t\t\t_, n := utf8.DecodeRuneInString(string(p))\n\t\t\tb += n\n\t\t\tp = p[n:]\n\t\t}\n\t\treturn 2 + b\n\tcase closure:\n\t\treturn 1\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"patsize(): nie znany tag: %d\", tag))\n\t}\n}", "title": "" }, { "docid": "ce0dd9c3c28efcf6e7b6cac13e4f93d7", "score": "0.43861243", "text": "func Compile(expr string) (re *regexp, extended bool, err error) {\n\tp := parser{}\n\tflags := syntax.OneLine | syntax.PerlX\n\tn, subexp, err := p.parse([]byte(expr), flags)\n\tif err != nil {\n\t\treturn nil, false, err\n\t}\n\tm := make(map[string]int)\n\tfor i, n := range subexp {\n\t\tif len(n) > 0 {\n\t\t\tm[n] = i\n\t\t}\n\t}\n\treturn &regexp{\n\t\troot: n,\n\t\texpr: expr,\n\t\tsubexpNames: subexp,\n\t\tsubexpMap: m,\n\t}, n.IsExtended(), nil\n}", "title": "" }, { "docid": "211c59d4518efff59e3bad6d7a78840f", "score": "0.43843535", "text": "func StringMatcherRegex(regex string) *matcherpb.StringMatcher {\n\treturn &matcherpb.StringMatcher{\n\t\tMatchPattern: &matcherpb.StringMatcher_SafeRegex{\n\t\t\tSafeRegex: &matcherpb.RegexMatcher{\n\t\t\t\tEngineType: &matcherpb.RegexMatcher_GoogleRe2{\n\t\t\t\t\tGoogleRe2: &matcherpb.RegexMatcher_GoogleRE2{},\n\t\t\t\t},\n\t\t\t\tRegex: regex,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b229d8ce764d26f0ac3de9d1de35be91", "score": "0.43832642", "text": "func (o RuleGroupRuleStatementRateBasedStatementScopeDownStatementRegexMatchStatementOutput) RegexString() pulumi.StringOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementRateBasedStatementScopeDownStatementRegexMatchStatement) string {\n\t\treturn v.RegexString\n\t}).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e9d2e61e4d6699171afea74b02fa28b7", "score": "0.43773314", "text": "func TestOnePassCutoff(t *testing.T) {\n\tre, err := syntax.Parse(`^x{1,1000}y{1,1000}$`, syntax.Perl)\n\tif err != nil {\n\t\tt.Fatalf(\"parse: %v\", err)\n\t}\n\tp, err := syntax.Compile(re.Simplify())\n\tif err != nil {\n\t\tt.Fatalf(\"compile: %v\", err)\n\t}\n\tif compileOnePass(p) != nil {\n\t\tt.Fatalf(\"makeOnePass succeeded; wanted nil\")\n\t}\n}", "title": "" }, { "docid": "981c2336330f5fe0f2b44762b5030895", "score": "0.43701923", "text": "func EscapeJsRegex(s string) string {\n value, _ := EscapeJsRegexInstance.Escape(s)\n return value\n}", "title": "" }, { "docid": "929dd7ac79bcd3d4f3933ff269184186", "score": "0.43682474", "text": "func isRE(s string) (string, bool) {\n\tif n := len(s); n > 2 && s[0] == '/' && s[n-1] == '/' {\n\t\treturn s[1 : n-1], true\n\t}\n\treturn s, false\n}", "title": "" } ]
767db923a0295390d79105745acdf855
Unmarshal unmarshals the dentry from a byte array.
[ { "docid": "0d51e080672a1046f43c04b3a3b6a65b", "score": "0.7072066", "text": "func (dentry *Dentry) Unmarshal(raw []byte) (err error) {\n\tvar (\n\t\tkeyLen uint32\n\t\tvalLen uint32\n\t)\n\tbuff := bytes.NewBuffer(raw)\n\tif err = binary.Read(buff, binary.BigEndian, &keyLen); err != nil {\n\t\treturn\n\t}\n\tkeyBytes := make([]byte, keyLen)\n\tif _, err = buff.Read(keyBytes); err != nil {\n\t\treturn\n\t}\n\tif err = dentry.UnmarshalKey(keyBytes); err != nil {\n\t\treturn\n\t}\n\tif err = binary.Read(buff, binary.BigEndian, &valLen); err != nil {\n\t\treturn\n\t}\n\tvalBytes := make([]byte, valLen)\n\tif _, err = buff.Read(valBytes); err != nil {\n\t\treturn\n\t}\n\terr = dentry.UnmarshalValue(valBytes)\n\treturn\n}", "title": "" } ]
[ { "docid": "d00cde6ebf7a49a6c5b1850cc8660d13", "score": "0.5532392", "text": "func (r *FUSEDirents) UnmarshalBytes(src []byte) []byte {\n\tfor {\n\t\tif len(src) <= (*FUSEDirentMeta)(nil).SizeBytes() {\n\t\t\tbreak\n\t\t}\n\n\t\t// Its unclear how many dirents there are in src. Each dirent is dynamically\n\t\t// sized and so we can't make assumptions about how many dirents we can allocate.\n\t\tif r.Dirents == nil {\n\t\t\tr.Dirents = make([]*FUSEDirent, 0)\n\t\t}\n\n\t\t// We have to allocate a struct for each dirent - there must be a better way\n\t\t// to do this. Linux allocates 1 page to store all the dirents and then\n\t\t// simply reads them from the page.\n\t\tvar dirent FUSEDirent\n\t\tsrc = dirent.UnmarshalBytes(src)\n\t\tr.Dirents = append(r.Dirents, &dirent)\n\t}\n\treturn src\n}", "title": "" }, { "docid": "a69979f835767a5fdbf816098c1161d6", "score": "0.55068815", "text": "func Unmarshal(p []byte) (*structs.DiskUsage, error) {\n\treturn Deserialize(p)\n}", "title": "" }, { "docid": "2cc5509626f2c7fee2ec98af62a5f28a", "score": "0.54479337", "text": "func UnpackBeacon(raw []byte) (*seg.PathSegment, error) {\n\tvar pb cppb.PathSegment\n\tif err := proto.Unmarshal(raw, &pb); err != nil {\n\t\treturn nil, err\n\t}\n\treturn seg.BeaconFromPB(&pb)\n}", "title": "" }, { "docid": "124b1d4d76f5f7fdabb599578aa8358e", "score": "0.54427373", "text": "func (dentry *Dentry) UnmarshalValue(val []byte) (err error) {\n\tbuff := bytes.NewBuffer(val)\n\tif err = binary.Read(buff, binary.BigEndian, &dentry.Inode); err != nil {\n\t\treturn\n\t}\n\terr = binary.Read(buff, binary.BigEndian, &dentry.Type)\n\treturn\n}", "title": "" }, { "docid": "cc6539d5c3d43de7ebd933de158289b4", "score": "0.54388076", "text": "func (mp *metaPartition) loadDentry(rootDir string) (err error) {\n\tvar numDentries uint64\n\tdefer func() {\n\t\tif err == nil {\n\t\t\tlog.LogInfof(\"loadDentry: load complete: partitonID(%v) volume(%v) numDentries(%v)\",\n\t\t\t\tmp.config.PartitionId, mp.config.VolName, numDentries)\n\t\t}\n\t}()\n\tfilename := path.Join(rootDir, dentryFile)\n\tif _, err = os.Stat(filename); err != nil {\n\t\terr = nil\n\t\treturn\n\t}\n\tfp, err := os.OpenFile(filename, os.O_RDONLY, 0644)\n\tif err != nil {\n\t\tif err == os.ErrNotExist {\n\t\t\terr = nil\n\t\t\treturn\n\t\t}\n\t\terr = errors.NewErrorf(\"[loadDentry] OpenFile: %s\", err.Error())\n\t\treturn\n\t}\n\n\tdefer fp.Close()\n\treader := bufio.NewReaderSize(fp, 4*1024*1024)\n\tdentryBuf := make([]byte, 4)\n\tfor {\n\t\tdentryBuf = dentryBuf[:4]\n\t\t// First Read 4byte header length\n\t\t_, err = io.ReadFull(reader, dentryBuf)\n\t\tif err != nil {\n\t\t\tif err == io.EOF {\n\t\t\t\terr = nil\n\t\t\t\treturn\n\t\t\t}\n\t\t\terr = errors.NewErrorf(\"[loadDentry] ReadHeader: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\n\t\tlength := binary.BigEndian.Uint32(dentryBuf)\n\n\t\t// next read body\n\t\tif uint32(cap(dentryBuf)) >= length {\n\t\t\tdentryBuf = dentryBuf[:length]\n\t\t} else {\n\t\t\tdentryBuf = make([]byte, length)\n\t\t}\n\t\t_, err = io.ReadFull(reader, dentryBuf)\n\t\tif err != nil {\n\t\t\terr = errors.NewErrorf(\"[loadDentry]: ReadBody: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tdentry := &Dentry{}\n\t\tif err = dentry.Unmarshal(dentryBuf); err != nil {\n\t\t\terr = errors.NewErrorf(\"[loadDentry] Unmarshal: %s\", err.Error())\n\t\t\treturn\n\t\t}\n\t\tif status := mp.fsmCreateDentry(dentry, true); status != proto.OpOk {\n\t\t\terr = errors.NewErrorf(\"[loadDentry] createDentry dentry: %v, resp code: %d\", dentry, status)\n\t\t\treturn\n\t\t}\n\t\tnumDentries += 1\n\t}\n}", "title": "" }, { "docid": "7921b92df2b13e2009385283ee709359", "score": "0.5271782", "text": "func (r *Blob) Unmarshal(b []byte) error { r.Content = b; return nil }", "title": "" }, { "docid": "9a7a31369d841aeb502193d8d72d3087", "score": "0.5239347", "text": "func (bv *BytesView) Unmarshal(data []byte) error { *bv = data; return nil }", "title": "" }, { "docid": "cefa91d80fd09c81eb60a4173a8a5028", "score": "0.5199826", "text": "func UnmarshalDirs(b []byte) ([]plan9.Dir, error) {\n\tvar result []plan9.Dir\n\tfor {\n\t\tif len(b) <= 2 {\n\t\t\tbreak\n\t\t}\n\t\tn, _ := gbit16(b)\n\t\td, err := plan9.UnmarshalDir(b[:2+n])\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tb = b[2+n:]\n\n\t\tresult = append(result, *d)\n\t}\n\tif len(b) != 0 {\n\t\treturn nil, fmt.Errorf(\"partial directory entry\")\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "ca433cc096555b231cddd581b3fca4b1", "score": "0.5197098", "text": "func (this *Fixed64SinglePath) Unmarshal(buf []byte) (*uint64, error) {\n\tvar ret *uint64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*uint64)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 8\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "b9d9758c27d31ff1da113a5785d8ffe6", "score": "0.51154214", "text": "func Unmarshal(b []byte) *simple.DirectedGraph {\n\tg := simple.NewDirectedGraph()\n\tif err := dot.Unmarshal(b, Graph{g}); err != nil {\n\t\treturn nil\n\t}\n\treturn g\n}", "title": "" }, { "docid": "948b7550232f9a707404f4f48d851471", "score": "0.50958574", "text": "func Unmarshal(r io.Reader) (*Trie, error) {\n\tst, err := trietree.Read(r)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Trie{st: st}, nil\n}", "title": "" }, { "docid": "707f70981835bb46a1a2baaf10e367ca", "score": "0.5094921", "text": "func (x *Bytes) Unmarshal(buf []byte, rem int) ([]byte, int, error) {\n\treturn surge.UnmarshalBytes((*[]byte)(x), buf, rem)\n}", "title": "" }, { "docid": "f9553402caa4325387658872b008668e", "score": "0.5021579", "text": "func (dentry *Dentry) UnmarshalKey(k []byte) (err error) {\n\tbuff := bytes.NewBuffer(k)\n\tif err = binary.Read(buff, binary.BigEndian, &dentry.ParentId); err != nil {\n\t\treturn\n\t}\n\tdentry.Name = string(buff.Bytes())\n\treturn\n}", "title": "" }, { "docid": "a23322571b7559459074bb7117f74310", "score": "0.5017462", "text": "func (i *item) Unmarshal(bytes []byte) error {\n\tif len(bytes) < 8 {\n\t\treturn errUnmarshalInvalidChunkStampItemSize\n\t}\n\tnsLen := int(binary.LittleEndian.Uint64(bytes))\n\tif len(bytes) != 8+nsLen+postage.StampSize {\n\t\treturn errUnmarshalInvalidChunkStampItemSize\n\t}\n\n\t// Ensure that the address is set already in the item.\n\tif i.address.IsZero() {\n\t\treturn errUnmarshalInvalidChunkStampItemAddress\n\t}\n\n\tni := &item{address: i.address.Clone()}\n\tl := 8\n\tni.namespace = append(make([]byte, 0, nsLen), bytes[l:l+nsLen]...)\n\tl += nsLen\n\tstamp := new(postage.Stamp)\n\tif err := stamp.UnmarshalBinary(bytes[l : l+postage.StampSize]); err != nil {\n\t\tif errors.Is(err, postage.ErrStampInvalid) {\n\t\t\treturn errUnmarshalInvalidChunkStampItemSize\n\t\t}\n\t\treturn fmt.Errorf(\"unable to unmarshal chunkstamp.item: %w\", err)\n\t}\n\tni.stamp = stamp\n\t*i = *ni\n\treturn nil\n}", "title": "" }, { "docid": "05c02a93d9cc20eae91483f23a27bb3b", "score": "0.50109965", "text": "func (m *ShieldedTransfer) Unmarshal(rawBytes []byte) (*ShieldedTransfer, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "2c82704160086af2507e52093fc8c3b0", "score": "0.4980164", "text": "func (this *BytesSinglePath) Unmarshal(buf []byte) ([]byte, error) {\n\tvar ret []byte = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar bytesLen uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tbytesLen |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpostIndex := offset + n + int(bytesLen)\n\t\t\t\tif postIndex > endOf {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tvv := buf[offset+n : postIndex]\n\t\t\t\tret = vv\n\t\t\t\toffset = offset + n + int(bytesLen)\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "1c12cc2d08e88c5a1ec6519fcd9faf9a", "score": "0.49484262", "text": "func (this *Fixed32SinglePath) Unmarshal(buf []byte) (*uint32, error) {\n\tvar ret *uint32 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+4 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*uint32)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 4\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "d4535fb1b383f6a63dc3c593483f3ac2", "score": "0.4927679", "text": "func (this *Float64SinglePath) Unmarshal(buf []byte) (*float64, error) {\n\tvar ret *float64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*float64)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 8\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "ebe619e851e71141593f490a371ad6a8", "score": "0.49259138", "text": "func (this *Uint64SinglePath) Unmarshal(buf []byte) (*uint64, error) {\n\tvar ret *uint64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar v uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset+n >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tv |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret = &v\n\t\t\t\toffset = offset + n\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "42e8f69a8df05cad6a3974026d48bd9f", "score": "0.49218696", "text": "func (m *BootBootloader) UnmarshalJSON(raw []byte) error {\n\t// AO0\n\tvar dataAO0 struct {\n\t\tDescription string `json:\"Description,omitempty\"`\n\n\t\tName string `json:\"Name,omitempty\"`\n\n\t\tPath string `json:\"Path,omitempty\"`\n\t}\n\tif err := swag.ReadJSON(raw, &dataAO0); err != nil {\n\t\treturn err\n\t}\n\n\tm.Description = dataAO0.Description\n\n\tm.Name = dataAO0.Name\n\n\tm.Path = dataAO0.Path\n\n\treturn nil\n}", "title": "" }, { "docid": "70482acfc6c5343b612806737f28ad0a", "score": "0.49203593", "text": "func (s *PairingDHKeyCheck) Unmarshal(b []byte) error {\n\treturn binary.Read(bytes.NewBuffer(b), binary.LittleEndian, s)\n}", "title": "" }, { "docid": "cf9ffb0044f1789d79693d0d89554fdc", "score": "0.49163857", "text": "func (this *Fixed64SinglePath) UnmarshalFirst(buf []byte) (*uint64, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\treturn (*uint64)(unsafe.Pointer(&buf[offset])), nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "d7d587f83c07dac978b69035082554ca", "score": "0.49146387", "text": "func (m *Module) Unmarshal(b []byte) (uint16, error) {\n\tif len(b) < 11 {\n\t\treturn 0, fmt.Errorf(\"expected at least 11 bytes but got %d\", len(b))\n\t}\n\n\t// read size\n\tm.Size = bytes.ReadUint32(b[0:])\n\t// read checksum\n\tm.Checksum = bytes.ReadUint32(b[4:])\n\n\t// read module full path\n\tlength := bytes.ReadUint16(b[8:])\n\tbuf := b[10:]\n\toffset := length\n\tm.Name = string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:length:length])\n\n\t// read addresses\n\tlength = bytes.ReadUint16(b[10+offset:])\n\tbuf = b[12+offset:]\n\toffset += length\n\tm.BaseAddress = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:length:length]))\n\n\tlength = bytes.ReadUint16(b[12+offset:])\n\tbuf = b[14+offset:]\n\toffset += length\n\tm.DefaultBaseAddress = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:length:length]))\n\n\treturn offset + 14, nil\n}", "title": "" }, { "docid": "e15e45210f795b49d5230bc51259c1df", "score": "0.48739296", "text": "func (eb *EventBlock) Unmarshal(bs []byte) error {\n\treturn cdc.UnmarshalBinaryBare(bs, eb)\n}", "title": "" }, { "docid": "f8234eb387f5a0e19ba172560de1a2ac", "score": "0.48735294", "text": "func Unmarshal(data []byte, p *Pattern) error {\n\tbuf := bytes.NewReader(data)\n\n\theader, err := readHeader(buf)\n\tsize, err := readSize(buf)\n\tversion, err := readVersion(buf)\n\ttempo, err := readTempo(buf)\n\ttracks, err := readTracks(buf, size-32-4)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.header = header\n\tp.Version = version\n\tp.size = size\n\tp.Tempo = tempo\n\tp.Tracks = tracks\n\n\treturn nil\n\n}", "title": "" }, { "docid": "2fd201fd7d9bb1942360ea3cd88b0f84", "score": "0.48441577", "text": "func (entity *Attachment) Unmarshal(raw []byte) error {\n\treturn json.Unmarshal(raw, entity)\n}", "title": "" }, { "docid": "b3487c1c981a61f54687e8d8841b816f", "score": "0.48396203", "text": "func UnmarshalKanikoArtifact(value *yaml.Node) (mounts []v1.VolumeMount, remaining []byte, result error) {\n\tkaMap := make(map[string]interface{})\n\n\tvalue.Decode(kaMap)\n\n\tif vMap, hasVolumes := kaMap[\"volumeMounts\"]; hasVolumes {\n\t\tmounts = []v1.VolumeMount{}\n\t\tvolumesBuff, err := json.Marshal(vMap)\n\n\t\tif err != nil {\n\t\t\tresult = err\n\t\t\treturn\n\t\t}\n\n\t\tif err := json.Unmarshal(volumesBuff, &mounts); err != nil {\n\t\t\tresult = err\n\t\t\treturn\n\t\t}\n\n\t\tdelete(kaMap, \"volumeMounts\")\n\t}\n\n\t// Remarshal the remaining values\n\tremaining, result = yaml.Marshal(kaMap)\n\treturn\n}", "title": "" }, { "docid": "b1da671a509fcee7a58e98324679e4e3", "score": "0.483772", "text": "func (this *Sfixed64SinglePath) Unmarshal(buf []byte) (*int64, error) {\n\tvar ret *int64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*int64)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 8\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "730c8be22c480421e9a99b871c85d5e4", "score": "0.4832403", "text": "func (r *Ping) Unmarshal([]byte) error {\n\tr = &Ping{}\n\treturn nil\n}", "title": "" }, { "docid": "fd14f286dca1322fe74e6ac791498b46", "score": "0.48005286", "text": "func Unmarshal(path string, data []byte, value interface{}) error {\n\treturn FileMarshallers(Known).Unmarshal(path, data, value)\n}", "title": "" }, { "docid": "4d9ba1fdcef4553a51a44cba094b66b0", "score": "0.4796891", "text": "func (u8 *U8) Unmarshal(r io.Reader, m int) (int, error) {\n\treturn surge.Unmarshal(r, &u8.inner, m)\n}", "title": "" }, { "docid": "c1f11c9d06a4a1785e4a3277520196b3", "score": "0.47957358", "text": "func (tid *TenantID) unmarshal(src []byte) ([]byte, error) {\n\tif len(src) < 8 {\n\t\treturn src, fmt.Errorf(\"cannot unmarshal tenantID from %d bytes; need at least 8 bytes\", len(src))\n\t}\n\ttid.AccountID = encoding.UnmarshalUint32(src[:4])\n\ttid.ProjectID = encoding.UnmarshalUint32(src[4:])\n\treturn src[8:], nil\n}", "title": "" }, { "docid": "55d8991f2ae350b4e9322f27077164d2", "score": "0.4784054", "text": "func Unmarshal(b []byte) (interface{}, error) {\n\treturn NewDecoder(bytes.NewReader(b)).Decode()\n}", "title": "" }, { "docid": "b63dea24894e95898b6072b542630c0a", "score": "0.4747601", "text": "func (d *DiskFragment) 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 \"tags\":\n\t\t\terr = unpopulate(val, \"Tags\", &d.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\", d, err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a59b2bc2abd2558da722c9347b7510b8", "score": "0.47299424", "text": "func (entry *TreeEntry) Decode(reader io.Reader) error {\n\tr := bufio.NewReader(reader)\n\n\tif modeString, err := r.ReadString(byte(' ')); err != nil {\n\t\treturn err\n\t} else {\n\t\tmodeString = modeString[:len(modeString)-1]\n\t\tif mode, err := GitModeFromString(modeString); err != nil {\n\t\t\treturn errors.New(\"invalid tree entry mode\")\n\t\t} else {\n\t\t\tentry.Mode = mode\n\t\t}\n\t}\n\n\tif filename, err := r.ReadString(byte(0)); err != nil {\n\t\treturn err\n\t} else {\n\t\tentry.Name = filename[:len(filename)-1]\n\t}\n\n\tvar checksum Sha1\n\tif n, err := r.Read(checksum[:]); n != len(checksum) {\n\t\treturn errors.New(\"failed to read fixed bytes for checksum\")\n\t} else if err != nil {\n\t\treturn err\n\t}\n\tentry.Sha1 = checksum\n\n\treturn nil\n}", "title": "" }, { "docid": "cc752f20ffacce619138cabd1ab6b9f0", "score": "0.47194695", "text": "func (ptn *PatriciaTrieNode) UnmarshalBinary(data []byte) (err error) {\n\tdec := gob.NewDecoder(bytes.NewReader(data))\n\n\t// reportURIs\n\tif err = dec.Decode(&ptn.reportURI); err != nil {\n\t\treturn\n\t}\n\n\t// Filter\n\tvar hasFilter bool\n\tif err = dec.Decode(&hasFilter); err != nil {\n\t\treturn\n\t}\n\tif hasFilter {\n\t\terr = dec.Decode(&ptn.filterObject)\n\t} else {\n\t\tptn.filterObject = nil\n\t}\n\n\t// One\n\tvar hasOne bool\n\tif err = dec.Decode(&hasOne); err != nil {\n\t\treturn\n\t}\n\tif hasOne {\n\t\terr = dec.Decode(&ptn.one)\n\t} else {\n\t\tptn.one = nil\n\t}\n\n\t// Zero\n\tvar hasZero bool\n\tif err = dec.Decode(&hasZero); err != nil {\n\t\treturn\n\t}\n\tif hasOne {\n\t\terr = dec.Decode(&ptn.zero)\n\t} else {\n\t\tptn.zero = nil\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "eeb53ca1407733e029af54a44f448c69", "score": "0.4715627", "text": "func (h *Header) Unpack(data []byte) (int, error) {\n\n\tbarrel := barrel.NewBarrel()\n\tload := barrel.Load(h, data, false)\n\n\terr := barrel.Unpack(load)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\th.NextPkg = string(data[4 : 4+h.NextPkgLen])\n\n\treturn 3 + int(h.NextPkgLen), nil\n}", "title": "" }, { "docid": "5ee9a26348f826c25edb21a6e44488ab", "score": "0.47123748", "text": "func (info *Info) Unpack(data []byte) (n uint, err error) {\n\tvar length uint8\n\n\tn, err = util.Unpack(data, &length)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif length > 0 {\n\t\tbuf := make([]byte, length)\n\t\tn += uint(copy(buf, data[n:n+uint(length)]))\n\t\t*info = Info(buf)\n\t} else {\n\t\t*info = nil\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6fa58584498b4a7908013c403b4a59dd", "score": "0.47012952", "text": "func (this *Float32SinglePath) Unmarshal(buf []byte) (*float32, error) {\n\tvar ret *float32 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+4 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*float32)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 4\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "ce514b262ecc8a1251ea2ae81041cba0", "score": "0.46857017", "text": "func (p *HostPool) Unmarshal(data []byte) error {\n\treturn xml.Unmarshal(data, p)\n}", "title": "" }, { "docid": "81c356eaa488b1f03d80db6c0dc14cc5", "score": "0.4684746", "text": "func (t *Tree) Decode(o Object) error {\r\n\tt.Hash = o.Hash()\r\n\tif o.Size() == 0 {\r\n\t\treturn nil\r\n\t}\r\n\r\n\tt.Entries = make(map[string]TreeEntry)\r\n\r\n\tr := bufio.NewReader(o.Reader())\r\n\tfor {\r\n\t\tmode, err := r.ReadString(' ')\r\n\t\tif err != nil {\r\n\t\t\tif err == io.EOF {\r\n\t\t\t\tbreak\r\n\t\t\t}\r\n\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tfm, err := strconv.ParseInt(mode[:len(mode)-1], 8, 32)\r\n\t\tif err != nil && err != io.EOF {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tname, err := r.ReadString(0)\r\n\t\tif err != nil && err != io.EOF {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tvar hash Hash\r\n\t\t_, err = r.Read(hash[:])\r\n\t\tif err != nil && err != io.EOF {\r\n\t\t\treturn err\r\n\t\t}\r\n\r\n\t\tbaseName := name[:len(name)-1]\r\n\t\tt.Entries[baseName] = TreeEntry{\r\n\t\t\tHash: hash,\r\n\t\t\tMode: os.FileMode(fm),\r\n\t\t\tName: baseName,\r\n\t\t}\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "949f4613669438c76025b2cb530056d3", "score": "0.467151", "text": "func (this *Uint32SinglePath) Unmarshal(buf []byte) (*uint32, error) {\n\tvar ret *uint32 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar v uint32\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset+n >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tv |= (uint32(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret = &v\n\t\t\t\toffset = offset + n\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "d9dd80d94a43743f0e6f5f6d92056db4", "score": "0.46662253", "text": "func (this *Codec) deserialize(data string) *TreeNode {\n\tif data == \"\" {\n\t\treturn nil\n\t}\n\tb, err := hex.DecodeString(data)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tt := new(TreeNode)\n\tdec := gob.NewDecoder(bytes.NewBuffer(b))\n\tdec.Decode(t)\n\treturn t\n}", "title": "" }, { "docid": "43e5ca16e178c3ee8e8660aad4457244", "score": "0.4659398", "text": "func (r *FindNodeResponse) Unmarshal(buf []byte) error {\n\tr = &FindNodeResponse{}\n\n\tif len(buf) < 1 {\n\n\t\treturn io.ErrUnexpectedEOF\n\t}\n\n\tsize := buf[0]\n\tbuf = buf[1:]\n\n\tresults := make([]ID, 0, size)\n\n\tfor i := 0; i < cap(results); i++ {\n\t\tvar id ID\n\t\terr := id.Unmarshal(buf).(ID)\n\t\tif err != nil {\n\t\t\treturn io.ErrUnexpectedEOF\n\t\t}\n\n\t\tresults = append(results, id)\n\t\tbuf = buf[id.Size():]\n\t}\n\n\tr.Results = results\n\n\treturn nil\n}", "title": "" }, { "docid": "f4f54d6fc174e8f70584ee74ce8aea60", "score": "0.46541774", "text": "func (b *Beacon) Unmarshal(buff []byte) error {\n\treturn json.Unmarshal(buff, b)\n}", "title": "" }, { "docid": "ad8545fae59f7784453ded8aa26a7957", "score": "0.46522918", "text": "func (this *Sint64SinglePath) Unmarshal(buf []byte) (*int64, error) {\n\tvar ret *int64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar v uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset+n >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tv |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvv := int64((v >> 1) ^ uint64((int64(v&1)<<63)>>63))\n\t\t\t\tret = &vv\n\t\t\t\toffset = offset + n\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "44f30b0c0e61b2a5cfe090555c52f313", "score": "0.4651168", "text": "func (v *VirtualHardDisk) 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 \"uri\":\n\t\t\terr = unpopulate(val, \"URI\", &v.URI)\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": "44f30b0c0e61b2a5cfe090555c52f313", "score": "0.4651168", "text": "func (v *VirtualHardDisk) 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 \"uri\":\n\t\t\terr = unpopulate(val, \"URI\", &v.URI)\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": "efa7fc6e7d23fc74d9e71d75da273a07", "score": "0.46502867", "text": "func (t *Thing) Unmarshal(d recordjar.Decoder) {\n\tt.name = d.String(\"name\")\n\tt.description = d.String(\":data:\")\n\tt.aliases = d.KeywordList(\"aliases\")\n\tt.UID = <-uid.Next\n}", "title": "" }, { "docid": "505e53e8fadf487a219780a89c130b14", "score": "0.46502605", "text": "func (entity *SubstanceDrugVoluntary) Unmarshal(raw []byte) error {\n\terr := json.Unmarshal(raw, entity)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ttreatmentVoluntary, err := entity.PayloadTreatmentVoluntary.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.TreatmentVoluntary = treatmentVoluntary.(*Branch)\n\n\tlist, err := entity.PayloadList.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.List = list.(*Collection)\n\n\treturn err\n}", "title": "" }, { "docid": "ff8cb82921723d626322d08b1bcb8212", "score": "0.4649783", "text": "func (h *NodeMsgHead) Unpack(buf *bytes.Buffer) (err error) {\n\treturn\n}", "title": "" }, { "docid": "b694a5637ff9890e85979f7513562b10", "score": "0.46421388", "text": "func (c *Cache) Unmarshal(b []byte, value interface{}) error {\n\treturn c.codec.Unmarshal(b, value)\n}", "title": "" }, { "docid": "23fd9328b6a40ec36b59f7ae85de7ac8", "score": "0.46348232", "text": "func (this *Uint64SinglePath) UnmarshalFirst(buf []byte) (*uint64, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar v uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset+n >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tv |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn &v, nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "2bd49834b7a79117f20b003b236b0154", "score": "0.46337578", "text": "func (t *TableLayout) parseLookup(b []byte, offset uint16) (*Lookup, error) {\n\tif int(offset) >= len(b) {\n\t\treturn nil, io.ErrUnexpectedEOF\n\t}\n\tr := bytes.NewReader(b[offset:])\n\tvar lookup lookupTable\n\tif err := binary.Read(r, binary.BigEndian, &lookup.lookupTableInfo); err != nil {\n\t\treturn nil, fmt.Errorf(\"reading lookupRecord: %s\", err)\n\t}\n\t//fmt.Printf(\"lookup table (%d) has %d subtables\\n\", lookup.Type, lookup.SubRecordCount)\n\tsubs := make([]uint16, lookup.SubRecordCount, lookup.SubRecordCount)\n\tif err := binary.Read(r, binary.BigEndian, &subs); err != nil {\n\t\treturn nil, fmt.Errorf(\"reading lookupRecord: %s\", err)\n\t}\n\tlookup.subrecordOffsets = subs\n\t// reading of lookup record is complete at this spot\n\t// by converting it into a Lookup we lose information about sub-tables' location\n\n\t// TODO Read lookup.Subtable\n\t// TODO Read lookup.MarkFilteringSet\n\n\treturn &Lookup{\n\t\tType: lookup.Type,\n\t\tFlag: lookup.Flag, // TODO Parse the type Enum\n\t}, nil\n}", "title": "" }, { "docid": "29e0f2a89accd59cb1ba55dc4afe2a50", "score": "0.46308044", "text": "func (this *Int64SinglePath) Unmarshal(buf []byte) (*int64, error) {\n\tvar ret *int64 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar v int64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset+n >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tv |= (int64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tret = &v\n\t\t\t\toffset = offset + n\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "aea35ac88e6e9cc6128c3d4cc87e903e", "score": "0.462944", "text": "func (this *Sfixed64SinglePath) UnmarshalFirst(buf []byte) (*int64, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\treturn (*int64)(unsafe.Pointer(&buf[offset])), nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "9aa26656bdd600af3c07c5bf0ff0c66c", "score": "0.46280986", "text": "func (this *Sfixed32SinglePath) Unmarshal(buf []byte) (*int32, error) {\n\tvar ret *int32 = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+4 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tret = (*int32)(unsafe.Pointer(&buf[offset]))\n\t\t\t\toffset = offset + 4\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "af7e07f899dd8a5ab75d7e81a25725c9", "score": "0.46238738", "text": "func UnmarshalHandler(bytes []byte, isYml bool, fallback http.Handler) (http.HandlerFunc, error) {\n\tpathMap := make(map[string]string)\n\tvar err error\n\n\t// had to duplicate code just because type in list of maps 'm' differs for yaml & json unmarshal methods\n\tif isYml {\n\t\tvar m []map[interface{}]interface{}\n\t\terr = yaml.Unmarshal(bytes, &m)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error: %v\", err)\n\t\t}\n\t\tfor _, myMap := range m {\n\t\t\tpathMap[myMap[\"path\"].(string)] = myMap[\"url\"].(string)\n\t\t}\n\t} else {\n\t\tvar m []map[string]interface{}\n\t\terr = yaml.Unmarshal(bytes, &m)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"error: %v\", err)\n\t\t}\n\t\tfor _, myMap := range m {\n\t\t\tpathMap[myMap[\"path\"].(string)] = myMap[\"url\"].(string)\n\t\t}\n\t}\n\n\treturn MapHandler(pathMap, fallback), err\n}", "title": "" }, { "docid": "2c477018a9500aecddf8e525c45c5508", "score": "0.46233997", "text": "func UnmarshalBidTransaction(r *bytes.Buffer, f *BidTransaction) error {\n\tif err := encoding.ReadUint64LE(r, &f.BidTreeStorageIndex); err != nil {\n\t\treturn err\n\t}\n\n\treturn UnmarshalTransaction(r, f.Tx)\n}", "title": "" }, { "docid": "7073967d295583de8d28338a9ff6e801", "score": "0.46225017", "text": "func (b *NodeMsgBody) Unpack(buf *bytes.Buffer) (err error) {\n\tbuffer := buf.Next(buf.Len())\n\terr = protobuf.Unmarshal(buffer, &b.NodeMsg)\n\treturn\n}", "title": "" }, { "docid": "cec51ddb7b48dd49031640898e81416b", "score": "0.4602649", "text": "func (this *Float64SinglePath) UnmarshalFirst(buf []byte) (*float64, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+8 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\treturn (*float64)(unsafe.Pointer(&buf[offset])), nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "1eb0797f9528a393b13ba762a998a290", "score": "0.45958748", "text": "func unarchive(rd io.Reader, update *Package) error {\n\tfmap := update.getFileMap()\n\tretVal := reflect.ValueOf(update).Elem()\n\n\t// zip file requires random access so before start we read all \"rd\" contents to buffer\n\tcontent, err := ioutil.ReadAll(io.LimitReader(rd, MaxFileSize))\n\tif err != nil {\n\t\treturn chkitErrors.Wrap(ErrUnpack, err)\n\t}\n\tzipf, err := zip.NewReader(bytes.NewReader(content), int64(len(content)))\n\tif err != nil {\n\t\treturn chkitErrors.Wrap(ErrUnpack, err)\n\t}\n\n\tfor _, archFile := range zipf.File {\n\t\tif archFile.FileInfo().Mode().IsRegular() {\n\t\t\tfield, updateFile := fmap[archFile.Name]\n\t\t\tif updateFile {\n\t\t\t\trc, openErr := archFile.Open()\n\t\t\t\tif openErr != nil {\n\t\t\t\t\treturn chkitErrors.Wrap(ErrUnpack, openErr)\n\t\t\t\t}\n\n\t\t\t\tbuf := bytes.NewBuffer(make([]byte, archFile.UncompressedSize64))\n\n\t\t\t\tif _, copyErr := io.Copy(buf, rc); copyErr != nil {\n\t\t\t\t\treturn chkitErrors.Wrap(ErrUnpack, copyErr)\n\t\t\t\t}\n\n\t\t\t\tretVal.Field(field).Set(reflect.ValueOf(io.Reader(buf)))\n\n\t\t\t\trc.Close()\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0835e6bd9b514f841da5fbcfdb28215b", "score": "0.458547", "text": "func (t *Task) UnsafeUnmarshal(data []byte) {\n\tif err := json.Unmarshal(data, t); err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "5d6e16de27ddbac31cbcd51e1ec5518f", "score": "0.45828202", "text": "func (this *Fixed32SinglePath) UnmarshalFirst(buf []byte) (*uint32, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tif endOf < offset+4 {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\treturn (*uint32)(unsafe.Pointer(&buf[offset])), nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "e49b81bcefd03c1b09c26bd179891359", "score": "0.45803195", "text": "func (entity *SubstanceDrugOrdered) Unmarshal(raw []byte) error {\n\terr := json.Unmarshal(raw, entity)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tordered, err := entity.PayloadTreatmentOrdered.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.TreatmentOrdered = ordered.(*Branch)\n\n\tlist, err := entity.PayloadList.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.List = list.(*Collection)\n\n\treturn err\n}", "title": "" }, { "docid": "4dcf54eed9a65f02da6854f6cd9b9b45", "score": "0.45753208", "text": "func (r *FindNodeRequest) Unmarshal(buf []byte) error {\n\tif len(buf) != SizePublicKey {\n\t\tr = &FindNodeRequest{}\n\t\treturn fmt.Errorf(\"expected buf to be %d bytes, but got %d bytes: %w\", SizePublicKey, len(buf), io.ErrUnexpectedEOF)\n\t}\n\n\tcopy(r.Target[:], buf)\n\n\treturn nil\n}", "title": "" }, { "docid": "75d9db6bd73b4464ef3d9a317dad3053", "score": "0.45706624", "text": "func unmarshallLoad(bytes []byte, load *Load) error {\n\treturn yaml.Unmarshal(bytes, load)\n}", "title": "" }, { "docid": "50bbdc587ef3c63eced5c39934130ca1", "score": "0.45692697", "text": "func FromBytes(b []byte) (barrel Barrel, err error) {\n\terr = json.Unmarshal(b, &barrel)\n\treturn\n}", "title": "" }, { "docid": "68b4635d8374e6675a4eda15f080e597", "score": "0.45671475", "text": "func (p *Packet) Unmarshal(rawPacket []byte) error {\n\tif err := p.Header.Unmarshal(rawPacket); err != nil {\n\t\treturn err\n\t}\n\tif p.Header.Padding {\n\t\tif err := p.PaddingTrailer.Unmarshal(rawPacket); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tpayloadWithPadding := rawPacket[p.Header.MarshalSize():]\n\tp.Payload = payloadWithPadding[:len(payloadWithPadding)-p.PaddingTrailer.MarshalSize()]\n\treturn nil\n}", "title": "" }, { "docid": "0edff3e89784a6675c4a2043cb735005", "score": "0.4566444", "text": "func (sid *SpanID) Unmarshal(data []byte) error {\n\tif len(data) == 0 {\n\t\t*sid = [spanIDSize]byte{}\n\t\treturn nil\n\t}\n\n\tif len(data) != spanIDSize {\n\t\treturn errUnmarshalSpanID\n\t}\n\n\tcopy(sid[:], data)\n\treturn nil\n}", "title": "" }, { "docid": "65ce28964b58a6f437f98546c33549d7", "score": "0.4564858", "text": "func (b *BeaconMsg) unpack(msg []byte) {\n\tbuffer := bytes.NewBuffer(msg)\n\tbinary.Read(buffer, binary.BigEndian, &b.Protocol)\n\tbinary.Read(buffer, binary.BigEndian, &b.Version)\n\tuuid := make([]byte, 16)\n\tbinary.Read(buffer, binary.BigEndian, uuid)\n\tb.UUID = append(b.UUID, uuid...)\n\tbinary.Read(buffer, binary.BigEndian, &b.Port)\n}", "title": "" }, { "docid": "2e51126330f27544b204cea621cad3f2", "score": "0.45631889", "text": "func (t *Thread) Unmarshal(b []byte) (uint16, error) {\n\tif len(b) < 11 {\n\t\treturn 0, fmt.Errorf(\"expected at least 11 bytes but got %d\", len(b))\n\t}\n\n\t// read tid and pid\n\tt.Tid = bytes.ReadUint32(b[0:])\n\tt.Pid = bytes.ReadUint32(b[4:])\n\n\t// read priorities\n\tt.IOPrio = b[8]\n\tt.BasePrio = b[9]\n\tt.PagePrio = b[10]\n\n\t// read user space stack base address\n\tl := bytes.ReadUint16(b[11:])\n\tbuf := b[13:]\n\toffset := l\n\tt.UstackBase = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:l:l]))\n\n\t// read user space stack limit\n\tl = bytes.ReadUint16(b[13+offset:])\n\tbuf = b[15+offset:]\n\toffset += l\n\tt.UstackLimit = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:l:l]))\n\n\t// read kernel space stack base address\n\tl = bytes.ReadUint16(b[15+offset:])\n\tbuf = b[17+offset:]\n\toffset += l\n\tt.KstackBase = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:l:l]))\n\n\t// read kernel space stack limit\n\tl = bytes.ReadUint16(b[17+offset:])\n\tbuf = b[19+offset:]\n\toffset += l\n\tt.KstackLimit = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:l:l]))\n\n\t// read entry point address\n\tl = bytes.ReadUint16(b[19+offset:])\n\tbuf = b[21+offset:]\n\toffset += l\n\tt.Entrypoint = kparams.Hex(string((*[1<<30 - 1]byte)(unsafe.Pointer(&buf[0]))[:l:l]))\n\n\treturn offset + 21, nil\n}", "title": "" }, { "docid": "ba7d1d478f996a718e9cd24dde2afa11", "score": "0.45617273", "text": "func Unmarshal(b []byte) (map[Rule]map[string]string, error) {\n\treturn Parse(Tokenize(b))\n}", "title": "" }, { "docid": "36f18337075f19c2578be8d15492c941", "score": "0.4555954", "text": "func unarch(afile, target string) error {\n\tlog.WithFields(log.Fields{\"func\": \"unarch\"}).Debug(fmt.Sprintf(\"Unpacking %s into %s\", afile, target))\n\terr := zip.UnarchiveFile(afile, target, func(apath string) {\n\t\tlog.WithFields(log.Fields{\"func\": \"unarch\"}).Debug(fmt.Sprintf(\"%s\", apath))\n\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Can't unpack archive: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19be26e55b5ce072e32e2ebb40922b11", "score": "0.4549597", "text": "func (m *ZAddress) Unmarshal(rawBytes []byte) (*ZAddress, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "fcb857f754abd68086ecde331e1cede9", "score": "0.45470494", "text": "func (t *PatriciaTrie) Deserialize(bs []byte) error {\r\n\tt.Lock()\r\n\tdefer t.Unlock()\r\n\tvar nodes pb.Tree\r\n\tif err := proto.Unmarshal(bs, &nodes); err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tt.Tree = nodes\r\n\treturn nil\r\n}", "title": "" }, { "docid": "ee20e2329f5aad7d1407a148c18134a9", "score": "0.4546105", "text": "func unmarshalChunkFile(bytes []byte) (*ChunkFile, error) {\n\tfile := &ChunkFile{}\n\terr := json.Unmarshal(bytes, file)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn file, nil\n}", "title": "" }, { "docid": "47e3ed8077e0e8774a4e98e56777b428", "score": "0.45402437", "text": "func (a *AdditionalHeader) DecodeFromBytes(b []byte) error {\n\tif a.TypeID == nil {\n\t\ta.TypeID = &datatypes.ExpandedNodeID{}\n\t}\n\tif err := a.TypeID.DecodeFromBytes(b); err != nil {\n\t\treturn err\n\t}\n\ta.EncodingMask = b[a.TypeID.Len()]\n\n\treturn nil\n}", "title": "" }, { "docid": "a95dda4095dda9f7561c337fddf84af1", "score": "0.45294", "text": "func (m *Bytes) Unmarshal(rawBytes []byte) (*Bytes, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "901f8317f9e4ee79473caee27648ee30", "score": "0.45214292", "text": "func (this *StringSinglePath) Unmarshal(buf []byte) (*string, error) {\n\tvar ret *string = this.def\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar stringLen uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tstringLen |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpostIndex := offset + n + int(stringLen)\n\t\t\t\tif postIndex > endOf {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tvv := string(buf[offset+n : postIndex])\n\t\t\t\tret = &vv\n\t\t\t\toffset = offset + n + int(stringLen)\n\t\t\t} else {\n\t\t\t\tposition++\n\t\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, err\n\t\t\t\t}\n\t\t\t\toffset = offset + n\n\t\t\t\tif len(endOfs) == position {\n\t\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t\t} else {\n\t\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn ret, nil\n}", "title": "" }, { "docid": "36ff9a2c3f5b319d6148105d653bcd58", "score": "0.45195648", "text": "func (this *BytesSinglePath) UnmarshalFirst(buf []byte) ([]byte, error) {\n\tposition := 0\n\tfinal := len(this.path) - 1\n\toffset := 0\n\tendOfs := []int{len(buf)}\n\tendOf := endOfs[position]\n\tfor position > 0 || offset < endOfs[0] {\n\t\tkey, n, err := decodeVarint(buf, offset)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\twireType := int(key & 0x7)\n\t\tpp := this.path[position]\n\t\toffset += n\n\t\tif pp == key {\n\t\t\tif final == position {\n\t\t\t\tvar bytesLen uint64\n\t\t\t\tn := 0\n\t\t\t\tfor shift := uint(0); ; shift += 7 {\n\t\t\t\t\tif offset >= endOf {\n\t\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t\t}\n\t\t\t\t\tb := buf[offset+n]\n\t\t\t\t\tn++\n\t\t\t\t\tbytesLen |= (uint64(b) & 0x7F) << shift\n\t\t\t\t\tif b < 0x80 {\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tpostIndex := offset + n + int(bytesLen)\n\t\t\t\tif postIndex > endOf {\n\t\t\t\t\treturn nil, io.ErrUnexpectedEOF\n\t\t\t\t}\n\t\t\t\tvv := buf[offset+n : postIndex]\n\t\t\t\treturn vv, nil\n\t\t\t}\n\t\t\tposition++\n\t\t\tlength, n, err := decodeVarint(buf, offset)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\toffset = offset + n\n\t\t\tif len(endOfs) == position {\n\t\t\t\tendOfs = append(endOfs, offset+int(length))\n\t\t\t} else {\n\t\t\t\tendOfs[position] = offset + int(length)\n\t\t\t}\n\t\t} else {\n\t\t\toffset, err = skip(buf, offset, wireType)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t\tfor position > 0 && offset == endOfs[position] {\n\t\t\tposition--\n\t\t\tendOf = endOfs[position]\n\t\t}\n\t}\n\treturn this.def, nil\n}", "title": "" }, { "docid": "77e42579cd4360d80451ec6d2a0a124d", "score": "0.45174107", "text": "func (e *ExtMap) Unmarshal(raw string) error {\n\tparts := strings.SplitN(raw, \":\", 2)\n\tif len(parts) != 2 {\n\t\treturn fmt.Errorf(\"%w: %v\", errSyntaxError, raw)\n\t}\n\n\tfields := strings.Fields(parts[1])\n\tif len(fields) < 2 {\n\t\treturn fmt.Errorf(\"%w: %v\", errSyntaxError, raw)\n\t}\n\n\tvaldir := strings.Split(fields[0], \"/\")\n\tvalue, err := strconv.ParseInt(valdir[0], 10, 64)\n\tif (value < 1) || (value > 246) {\n\t\treturn fmt.Errorf(\"%w: %v -- extmap key must be in the range 1-256\", errSyntaxError, valdir[0])\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"%w: %v\", errSyntaxError, valdir[0])\n\t}\n\n\tvar direction Direction\n\tif len(valdir) == 2 {\n\t\tdirection, err = NewDirection(valdir[1])\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\turi, err := url.Parse(fields[1])\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(fields) == 3 {\n\t\ttmp := fields[2]\n\t\te.ExtAttr = &tmp\n\t}\n\n\te.Value = int(value)\n\te.Direction = direction\n\te.URI = uri\n\treturn nil\n}", "title": "" }, { "docid": "1491fb22d3279588e7b421e1281240c2", "score": "0.45154148", "text": "func (entity *SubstanceDrugUsage) Unmarshal(raw []byte) error {\n\terr := json.Unmarshal(raw, entity)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tusedDrugs, err := entity.PayloadUsedDrugs.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.UsedDrugs = usedDrugs.(*Branch)\n\n\tlist, err := entity.PayloadList.Entity()\n\tif err != nil {\n\t\treturn err\n\t}\n\tentity.List = list.(*Collection)\n\n\treturn err\n}", "title": "" }, { "docid": "15b80aa5bb101367633a616a404b229e", "score": "0.4512912", "text": "func Unmarshal(ct string, b []byte, d interface{}) (err error) {\n\tif IsJSONType(ct) {\n\t\terr = json.Unmarshal(b, d)\n\t} else if IsXMLType(ct) {\n\t\terr = xml.Unmarshal(b, d)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "94bc8255d8deef5b5fb7a509184df4c0", "score": "0.45007855", "text": "func Unmarshal(data []byte, vp interface{}, recomposer ...*alt.Recomposer) (err error) {\n\tp := Parser{}\n\tvar v interface{}\n\tif v, err = p.Parse(data); err == nil {\n\t\tif 0 < len(recomposer) {\n\t\t\t_, err = recomposer[0].Recompose(v, vp)\n\t\t} else {\n\t\t\t_, err = alt.Recompose(v, vp)\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "e30f66c233558ccaf7cbaee8ecf86fc5", "score": "0.44903833", "text": "func Unmarshal(b []byte, v interface{}) (err error) {\n\tini, err := Parse(b)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn ini.Unmarshal(v)\n}", "title": "" }, { "docid": "92748bbb44ca605286ab7b7c3e02404f", "score": "0.44846764", "text": "func (m *Note) Unmarshal(rawBytes []byte) (*Note, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "65e37612f66d07834a459d6162f19426", "score": "0.44791964", "text": "func TimeUnmarshalBinary(t *time.Time, data []byte) error", "title": "" }, { "docid": "e3ef34480a63da49fad7e2fd6009b920", "score": "0.44779977", "text": "func (f *Feed) Unmarshal(src []byte) error {\n\tg, err := parseGeneric(src)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfc := g.ToFeed()\n\t*f = fc\n\treturn nil\n}", "title": "" }, { "docid": "60897a02a8e00f3a991757883ef35509", "score": "0.44758573", "text": "func (p *Path) DecodeFromBytes(b []byte) error {\n\tif len(b) < MetadataLen {\n\t\treturn serrors.New(\"EPIC Path raw too short\", \"expected\", MetadataLen, \"actual\", len(b))\n\t}\n\tp.PktID.DecodeFromBytes(b[:PktIDLen])\n\tp.PHVF = make([]byte, HVFLen)\n\tp.LHVF = make([]byte, HVFLen)\n\tcopy(p.PHVF, b[PktIDLen:(PktIDLen+HVFLen)])\n\tcopy(p.LHVF, b[(PktIDLen+HVFLen):MetadataLen])\n\tp.ScionPath = &scion.Raw{}\n\treturn p.ScionPath.DecodeFromBytes(b[MetadataLen:])\n}", "title": "" }, { "docid": "c67b51eeb75674acee113fd24611c8f3", "score": "0.44755623", "text": "func (jz JSONGzipEncoding) Unmarshal(data []byte, value interface{}) error {\n\tjsonData, err := GzipDecode(data)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = json.Unmarshal(jsonData, value)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ae577d1fe5c47657fec52b070b3bbafe", "score": "0.44748372", "text": "func Unmarshal(data []byte, uid string, dst encoding.Builder) error {\n\tif uid == \"\" {\n\t\treturn errors.New(\"graphql: invalid UID field name\")\n\t}\n\tvar src json.RawMessage\n\terr := json.Unmarshal(data, &src)\n\tif err != nil {\n\t\treturn err\n\t}\n\tgen := generator{dst: dst, uidName: uid, nodes: make(map[string]graph.Node)}\n\treturn gen.walk(src, nil, \"\")\n}", "title": "" }, { "docid": "bfe2bde74718d1c1a99452ea98cdde6e", "score": "0.44728085", "text": "func (dec *Decoder) Unmarshal(buf []byte, rem int) ([]byte, int, error) {\n\tvar tmp int32\n\tbuf, rem, err := surge.UnmarshalI32(&tmp, buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tdec.n = int(tmp)\n\tbuf, rem, err = surge.UnmarshalI32(&tmp, buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tdec.k = int(tmp)\n\tbuf, rem, err = surge.Unmarshal(&dec.indices, buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.interpolator.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.eea.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.g0.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.interpPoly.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.f1.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = dec.r.Unmarshal(buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\tbuf, rem, err = surge.Unmarshal(&dec.errors, buf, rem)\n\tif err != nil {\n\t\treturn buf, rem, err\n\t}\n\treturn surge.Unmarshal(&dec.errorsComputed, buf, rem)\n}", "title": "" }, { "docid": "91b20c0f474ce6544d430f813c8bb169", "score": "0.44557738", "text": "func ServiceEntryFromBytes(b []byte) ServiceEntry {\n\tservice := ServiceEntry{}\n\tif b != nil {\n\t\terr := json.Unmarshal(b, &service)\n\t\tif err != nil {\n\t\t\tservice.RID = \"\"\n\t\t}\n\t}\n\treturn service\n}", "title": "" }, { "docid": "46a14b96af910f702a7b10c3725ed7f9", "score": "0.44544935", "text": "func unmarshalField(cfg *Config, rv reflect.Value, fieldAst interface{}) error {\n\tswitch av := fieldAst.(type) {\n\tcase *ast.KeyValue:\n\t\treturn setValue(cfg, rv, av.Value)\n\tcase *ast.Table:\n\t\treturn unmarshalTable(cfg, rv, av, false)\n\tcase []*ast.Table:\n\t\trv = indirect(rv)\n\t\tif handled, err := setUnmarshaler(cfg, rv, fieldAst); handled {\n\t\t\treturn err\n\t\t}\n\t\tvar slice reflect.Value\n\t\tswitch {\n\t\tcase rv.Kind() == reflect.Slice:\n\t\t\tslice = reflect.MakeSlice(rv.Type(), len(av), len(av))\n\t\tcase isEface(rv):\n\t\t\tslice = reflect.ValueOf(make([]interface{}, len(av)))\n\t\tdefault:\n\t\t\treturn &unmarshalTypeError{\"array table\", \"slice\", rv.Type()}\n\t\t}\n\t\tfor i, tbl := range av {\n\t\t\tvv := reflect.New(slice.Type().Elem()).Elem()\n\t\t\tif err := unmarshalTable(cfg, vv, tbl, false); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tslice.Index(i).Set(vv)\n\t\t}\n\t\trv.Set(slice)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"BUG: unhandled AST node type %T\", av))\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d9d2b35403ca8385e0cd244f5b0a8469", "score": "0.44539273", "text": "func Unpack(op trace.Operation, tarStream io.Reader, filter *FilterSpec, root string, _ string) error {\n\top.Debugf(\"unpacking archive to root: %s, filter: %+v\", root, filter)\n\n\t// Online datasource is sending a tar reader instead of an io reader.\n\t// Type check here to see if we actually need to create a tar reader.\n\tvar tr *tar.Reader\n\tif trCheck, ok := tarStream.(*tar.Reader); ok {\n\t\ttr = trCheck\n\t} else {\n\t\ttr = tar.NewReader(tarStream)\n\t}\n\n\tfi, err := os.Stat(root)\n\tif err != nil {\n\t\t// the target unpack path does not exist. We should not get here.\n\t\top.Errorf(\"tar unpack target does not exist: %s\", root)\n\t\treturn err\n\t}\n\n\tif !fi.IsDir() {\n\t\terr := fmt.Errorf(\"unpack root target is not a directory: %s\", root)\n\t\top.Error(err)\n\t\treturn err\n\t}\n\n\top.Debugf(\"using FilterSpec : (%#v)\", *filter)\n\t// process the tarball onto the filesystem\n\tfor {\n\t\theader, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\t// This indicates the end of the archive\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\top.Errorf(\"Error reading tar header: %s\", err)\n\t\t\treturn err\n\t\t}\n\n\t\top.Debugf(\"processing tar header: asset(%s), size(%d)\", header.Name, header.Size)\n\t\t// skip excluded elements unless explicitly included\n\t\tif filter.Excludes(op, header.Name) {\n\t\t\tcontinue\n\t\t}\n\n\t\t// fix up path\n\t\tstripped := strings.TrimPrefix(header.Name, filter.StripPath)\n\t\trebased := filepath.Join(filter.RebasePath, stripped)\n\t\tabsPath := filepath.Join(root, rebased)\n\n\t\tswitch header.Typeflag {\n\t\tcase tar.TypeDir:\n\t\t\terr = os.MkdirAll(absPath, header.FileInfo().Mode())\n\t\t\tif err != nil {\n\t\t\t\top.Errorf(\"Failed to create directory%s: %s\", absPath, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase tar.TypeSymlink:\n\t\t\terr := os.Symlink(header.Linkname, absPath)\n\t\t\tif err != nil {\n\t\t\t\top.Errorf(\"Failed to create symlink %s->%s: %s\", absPath, header.Linkname, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\tcase tar.TypeReg:\n\t\t\tf, err := os.OpenFile(absPath, fileWriteFlags, header.FileInfo().Mode())\n\t\t\tif err != nil {\n\t\t\t\top.Errorf(\"Failed to open file %s: %s\", absPath, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t_, err = io.Copy(f, tr)\n\t\t\t// TODO: add ctx.Done cancellation\n\t\t\tf.Close()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\tdefault:\n\t\t\t// TODO: add support for special file types - otherwise we will do absurd things such as read infinitely from /dev/random\n\t\t}\n\t\top.Debugf(\"Finished writing to: %s\", absPath)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f34c976c7f0d394326071dd2f6552f9", "score": "0.4452428", "text": "func (p *Path) UnmarshalJSON(b []byte) error {\n\tvar s string\n\tif err := json.Unmarshal(b, &s); err != nil {\n\t\treturn err\n\t}\n\t*p = Path(s)\n\treturn nil\n}", "title": "" }, { "docid": "47725229ea50d50daec96c75d6a0130a", "score": "0.4451147", "text": "func (m *TransactionArgument) Unmarshal(rawBytes []byte) (*TransactionArgument, error) {\n\treader := jspb.NewReader(rawBytes)\n\n\tm = m.UnmarshalFromReader(reader)\n\n\tif err := reader.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "c8b3a6e7de54db8ac98febeeaf4d2811", "score": "0.44508082", "text": "func (p *Peer) Unmarshal(data []byte) error {\n\tp.Addrs = newAddrsList()\n\tp.KnownPeers = newPeersList()\n\treturn json.Unmarshal(data, p)\n}", "title": "" }, { "docid": "d952a9f3fa2e85ba85108615bf07b8e2", "score": "0.44499984", "text": "func Unmarshal(signedHead string) (*SignedHead, error) {\n\tb, err := base64.Decode(signedHead, 184)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar m [184]byte\n\tcopy(m[:], b)\n\treturn unmarshal(m)\n}", "title": "" } ]
5b337d62d26a53a80140223278d040dc
PutLogRotate Log rotation configuration. id is for ID of the resource object is for .
[ { "docid": "bbba847ff0cb517a24d8306c01f48774", "score": "0.7431388", "text": "func (a SysApi) PutLogRotate(id string, object SysLogRotate) (*SysLogRotate, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logRotate/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogRotate)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" } ]
[ { "docid": "3f444e34836c02427fb3852c344fe3bc", "score": "0.6804657", "text": "func (a SysApi) PatchLogRotate(id string, object SysLogRotate) (*SysLogRotate, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logRotate/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogRotate)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "2a5b66bb5193f1e97f0631f6480e7759", "score": "0.62806445", "text": "func logRotate() error {\n\tvar (\n\t\tlogFilePath = config.Conf.LogPath + \"/\" + time.Now().Format(\"2006-01-02\") + \".log\"\n\t)\n\n\tif _, err := os.Stat(logFilePath); err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\tlogFile, err := os.OpenFile(logFilePath, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tlog.SetOutput(logFile)\n\t\t\tlog.Printf(\"Created log file %s\", time.Now().Format(\"2006-01-02\"))\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "32332801eece9b6361d3dd20552507f5", "score": "0.62265885", "text": "func (r *LogRotateResource) Get(id string) (*LogRotateConfig, error) {\n\tvar item LogRotateConfig\n\tif err := r.c.ReadQuery(BasePath+LogRotateEndpoint, &item); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &item, nil\n}", "title": "" }, { "docid": "10e70b263c9c2ffd817adc3fb2b91ffe", "score": "0.61869204", "text": "func (r *LogRotateResource) Edit(id string, item LogRotateConfig) error {\n\tif err := r.c.ModQuery(\"PUT\", BasePath+LogRotateEndpoint+\"/\"+id, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7c1085f0ea980af21872013041cb186", "score": "0.61167675", "text": "func (a SysApi) GetLogRotate(id string) (*SysLogRotate, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logRotate/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogRotate)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "82dee6e2b45c0d4157522b1c5a7913bd", "score": "0.592145", "text": "func (r *LogRotateResource) Delete(id string) error {\n\tif err := r.c.ModQuery(\"DELETE\", BasePath+LogRotateEndpoint+\"/\"+id, nil); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1e2477edfdf9a2fd035f3bb175c5e1ca", "score": "0.56583047", "text": "func logRotate(extension string) robot.TaskRetVal {\n\tif len(logFileName) == 0 {\n\t\treturn robot.Normal\n\t}\n\traiseThreadPriv(\"rotating log\")\n\tif len(extension) > 0 {\n\t\toldext := filepath.Ext(logFileName)\n\t\tbarename := strings.TrimSuffix(logFileName, oldext)\n\t\tif !strings.HasPrefix(extension, \".\") {\n\t\t\textension = \".\" + extension\n\t\t}\n\t\toldFileName := barename + extension\n\t\tos.Remove(oldFileName)\n\t\terr := os.Rename(logFileName, oldFileName)\n\t\tif err != nil {\n\t\t\tLog(robot.Error, \"Renaming '%s' to '%s': %v\", logFileName, oldFileName, err)\n\t\t\treturn robot.Fail\n\t\t}\n\t} else {\n\t\tif err := os.Remove(logFileName); err != nil {\n\t\t\tLog(robot.Error, \"Unlinking old log file '%s': %v\", logFileName, err)\n\t\t\treturn robot.Fail\n\t\t}\n\t}\n\tlf, err := os.Create(logFileName)\n\tif err != nil {\n\t\tLog(robot.Error, \"Creating new log file '%s': %v\", logFileName, err)\n\t\treturn robot.Fail\n\t}\n\tbotLogger.setOutputFile(lf)\n\treturn robot.Normal\n}", "title": "" }, { "docid": "579ebeedcef4542c1c9e6a7ac20c9619", "score": "0.5651463", "text": "func (l *Logger) rotate() error {\n\tif err := l.close(); err != nil {\n\t\treturn err\n\t}\n\tif err := l.openNew(); err != nil {\n\t\treturn err\n\t}\n\tl.mill()\n\treturn nil\n}", "title": "" }, { "docid": "22cb5c3a1fee563a28c519f349c73096", "score": "0.56311125", "text": "func (w *fileLogWriter) doRotate(logTime time.Time) error {\n\trotatePerm, err := strconv.ParseInt(w.RotatePerm, 8, 64)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// close fileWriter before rename\n\tw.flushTimer.Reset(flushNever)\n\tw.flushBufferWithLock()\n\tw.fileWriter.Close()\n\n\terr = os.Chmod(w.Filename, os.FileMode(rotatePerm))\n\n\tstartLoggerErr := w.startLogger()\n\tgo w.deleteOldLog()\n\n\tif startLoggerErr != nil {\n\t\treturn fmt.Errorf(\"Rotate StartLogger: %s\", startLoggerErr)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Rotate: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2b4411a0456f5e2747efc381e919948f", "score": "0.5575764", "text": "func (w *FileLogWriter) intRotate() error {\n\t// 开始更换文件,首先关闭当前记录的日志文件\n\tif w.file != nil {\n\t\tfmt.Fprint(w.file, FormatLogRecord(w.trailer, &LogRecord{Created: time.Now()}))\n\t\tw.file.Close()\n\t}\n\t/* 然后判断是否可以滚动\n\t滚动当前分为三种:日期,文件大小,行数.\n\t日期以小时为单位,比如一天则为24,一个小时为1,\n\t文件大小以M为单位.\n\t行数以k为单位.*/\n\n\t//写入的文件名,开始为设置的文件名 filename\n\ttoWriteFile := w.filename\n\n\tif w.rotatable {\n\t\t//可以滚动\n\t\t//新增小时\n\n\t\t//是否按小时滚动\n\t\tif w.rottype == ROT_TYPE_TIME_DAY || w.rottype == ROT_TYPE_TIME_HOUR {\n\t\t\t//可以天滚动\n\t\t\tnow := time.Now()\n\t\t\tif w.rotsuffix == \"\" {\n\t\t\t\tif w.rottype == ROT_TYPE_TIME_DAY {\n\t\t\t\t\tw.rotsuffix = DEFUALT_ROT_TIME_SUFFIX_DAY\n\t\t\t\t} else if w.rottype == ROT_TYPE_TIME_HOUR {\n\t\t\t\t\tw.rotsuffix = DEFUALT_ROT_TIME_SUFFIX_HOUR\n\t\t\t\t}\n\t\t\t}\n\t\t\tsuffix := w.rotsuffix\n\t\t\t//修改要写入的文件名称\n\t\t\ttoWriteFile = w.filename + fmt.Sprintf(\"%s\", now.Format(suffix))\n\t\t\t//设置下一次滚动的时间\n\t\t\tinterval := w.rotinterval\n\t\t\tif interval <= 0 {\n\t\t\t\tw.rotinterval, interval = 1, 1\n\t\t\t}\n\t\t\tvar aftTime time.Time\n\t\t\tif w.rottype == ROT_TYPE_TIME_DAY {\n\t\t\t\taftTime = time.Date(now.Year(), now.Month(), now.Day()+interval, 0, 0, 0, 0, time.Local)\n\t\t\t} else if w.rottype == ROT_TYPE_TIME_HOUR {\n\t\t\t\taftTime = time.Date(now.Year(), now.Month(), now.Day(), now.Hour()+interval, 0, 0, 0, time.Local)\n\t\t\t}\n\t\t\tw.nxtRotateTime = aftTime.Unix()\n\t\t}\n\n\t}\n\t// Open the log file\n\tfd, err := os.OpenFile(toWriteFile, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0660)\n\tif err != nil {\n\t\treturn err\n\t}\n\tw.curFileName = toWriteFile\n\tw.file = fd\n\n\tnow := time.Now()\n\tfmt.Fprint(w.file, FormatLogRecord(w.header, &LogRecord{Created: now}))\n\n\treturn nil\n}", "title": "" }, { "docid": "57b3ecf3dff2530d2ed5bd85fa536576", "score": "0.55731004", "text": "func (l *Logrotate) rotate() error {\n\tname := l.file.Name()\n\tl.close()\n\t// rotate logs\n\tfor i := l.Num; i >= 0; i-- {\n\t\tlogfile := fmt.Sprintf(\"%s.%d\", name, i)\n\t\tif _, err := os.Stat(logfile); err == nil {\n\t\t\t// delete old file\n\t\t\tif i == l.Num {\n\t\t\t\tos.Remove(logfile)\n\t\t\t} else if err := os.Rename(logfile, fmt.Sprintf(\"%s.%d\", name, i+1)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\t// create logfile.log.0\n\tif err := os.Rename(name, fmt.Sprintf(\"%s.0\", name)); err != nil {\n\t\treturn err\n\t}\n\t// create new log file\n\tf, err := os.OpenFile(name, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, 0644)\n\tif err != nil {\n\t\treturn err\n\t}\n\tl.file = f\n\tl.size = 0\n\treturn nil\n}", "title": "" }, { "docid": "b25fc77b57946792684d1e4aff63fcdd", "score": "0.55355525", "text": "func TestWorkflow_logRotate(t *testing.T) {\n\tlogInitialized = false // ensure log is created\n\twithTestWf(func(wf *Workflow) {\n\t\twf.Configure(MaxLogSize(10))\n\t\tlog.Print(\"more than 10 bytes\")\n\n\t\tassert.True(t, util.PathExists(wf.LogFile()), \"log file does not exist\")\n\n\t\tlogInitialized = false // ensure log is created\n\t\twf.initializeLogging()\n\t\tassert.True(t, util.PathExists(wf.LogFile()+\".1\"), \"log file not rotated\")\n\t})\n}", "title": "" }, { "docid": "15a50f872ce6aaa36109836e0048347f", "score": "0.55018395", "text": "func (a SysApi) PutLogConfigDestinationArcsight(id string, object SysLogConfigDestinationArcsight) (*SysLogConfigDestinationArcsight, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/arcsight/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationArcsight)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "5d5a477379d681155d11e7e8d666a651", "score": "0.54797614", "text": "func (r *LogRotateResource) Create(item LogRotateConfig) error {\n\tif err := r.c.ModQuery(\"POST\", BasePath+LogRotateEndpoint, item); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "412650e08fa7336a9765c866ecd2921f", "score": "0.54482174", "text": "func (a SysApi) PatchLogConfigDestinationArcsight(id string, object SysLogConfigDestinationArcsight) (*SysLogConfigDestinationArcsight, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/arcsight/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationArcsight)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "f006533854aefc2af8e0b157891cc780", "score": "0.54393125", "text": "func configLogrotate(req *config.Log) error {\n\tvar logRotateConfigContent string\n\t// Create a file in /etc/logrotate.d/automate\n\tos.Remove(logRotateConfigFile)\n\tfile, err := os.Create(logRotateConfigFile)\n\tif err != nil {\n\t\tlogrus.Errorf(\"cannot create a file: %v\", err)\n\t\treturn err\n\t}\n\tdefer file.Close()\n\n\tif req.GetCompressRotatedLogs().GetValue() == true {\n\t\tlogRotateConfigContent = LogRotateConf(getLogFileName(req.GetRedirectLogFilePath().GetValue()),\n\t\t\tgetConcatStringFromConfig(\"size\", req.GetMaxSizeRotateLogs().GetValue()), getConcatStringFromConfig(\"rotate\", req.GetMaxNumberRotatedLogs().GetValue()), \"missingok\", \"copytruncate\", \"compress\", \"dateext\")\n\t} else {\n\t\tlogRotateConfigContent = LogRotateConf(getLogFileName(req.GetRedirectLogFilePath().GetValue()),\n\t\t\tgetConcatStringFromConfig(\"size\", req.GetMaxSizeRotateLogs().GetValue()), getConcatStringFromConfig(\"rotate\", req.GetMaxNumberRotatedLogs().GetValue()), \"missingok\", \"copytruncate\", \"dateext\")\n\t}\n\n\t// Write the byteSlice to file\n\tnoOfBytes, err := file.WriteString(logRotateConfigContent)\n\tif err != nil {\n\t\tlogrus.Errorf(\"cannot write the byte slice to the file: %v\", err)\n\t\treturn err\n\t}\n\tlogrus.Infof(\"%v no of bytes are written to the file\", noOfBytes)\n\n\treturn nil\n}", "title": "" }, { "docid": "fbfb8482d468d9679fcf88a8791f3ba3", "score": "0.54102093", "text": "func (s *ASMStore) Rotate(id SecretId) error {\n\tfmt.Println(\"Rotate stub method\")\n\n\treturn nil\n}", "title": "" }, { "docid": "3def9b15fb1923abd384916a44d1f321", "score": "0.53450465", "text": "func (gp *BaseTable) SetLogger(id UniqueID) {\n\trootPath := gp.LoadWithDefault(\"log.file.rootPath\", DefaultRootPath)\n\tif rootPath != \"\" {\n\t\tif id < 0 {\n\t\t\tgp.Log.File.Filename = path.Join(rootPath, gp.RoleName+\".log\")\n\t\t} else {\n\t\t\tgp.Log.File.Filename = path.Join(rootPath, gp.RoleName+\"-\"+strconv.FormatInt(id, 10)+\".log\")\n\t\t}\n\t} else {\n\t\tgp.Log.File.Filename = \"\"\n\t}\n\n\tif gp.LogCfgFunc != nil {\n\t\tgp.LogCfgFunc(gp.Log)\n\t}\n}", "title": "" }, { "docid": "b0f9358571bfe9443e94330781620c65", "score": "0.5341672", "text": "func (xlw *XMLLogWriter) intRotate() {\n\t// Close any log file that may be open\n\txlw.Close()\n\n\t// If we are keeping log files, move it to the next available number\n\tif xlw.rotate {\n\t\t_, err := os.Lstat(xlw.filename)\n\t\tif err == nil { // file exists\n\t\t\t// Find the next available number\n\t\t\tnum := 1\n\t\t\tfname := \"\"\n\t\t\tfor ; err == nil && num < 999; num++ {\n\t\t\t\tfname = xlw.filename + fmt.Sprintf(\".%03d\", num)\n\t\t\t\t_, err = os.Lstat(fname)\n\t\t\t}\n\t\t\tif err != nil {\n\t\t\t\t// Rename the file to its newfound home\n\t\t\t\t//fmt.Fprintf(os.Stderr, \"XMLLogWriter.intRotate: Moving %s to %s\\n\", xlw.filename, fname)\n\t\t\t\tos.Rename(xlw.filename, fname)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(os.Stderr, \"XMLLogWriter.intRotate: Cannot find free log number to rename %s\\n\", xlw.filename)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Open the log file\n\tfd, err := os.OpenFile(xlw.filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0660)\n\tif err != nil {\n\t\treturn\n\t}\n\txlw.file = fd\n\n\t// Write the closing tag\n\txlw.file.Write([]byte(\"<log created=\\\"\" + time.LocalTime().Format(\"2006/01/02 15:04:05 MST\") + \"\\\">\\n\"))\n\n\t// Set the daily open date to the current date\n\txlw.daily_opendate = time.LocalTime().Day\n\n\t// initialize rotation values\n\txlw.maxrecords_currecords = 0\n\txlw.maxsize_cursize = 0\n}", "title": "" }, { "docid": "05717c557a763472818b3234d80cd5b9", "score": "0.52806515", "text": "func (w *FileLogWriter) Rotate() {\n\tw.rot <- true\n}", "title": "" }, { "docid": "5b842e933bc693c81344c6b66ed09cbf", "score": "0.5232846", "text": "func (w *RotateWriter) LogRotater(x time.Duration) {\n\tticker := time.NewTicker(x)\n\tfor range ticker.C {\n\t\tw.Rotate()\n\t}\n}", "title": "" }, { "docid": "6902c6cacf75d72f9cb015e7a3741e76", "score": "0.5221134", "text": "func rotate(config *Config) io.Writer {\n\treturn &lumberjack.Logger{\n\t\tFilename: fmt.Sprintf(\"%s/%s\", config.Dir, config.Name),\n\t\tMaxSize: config.MaxSize, // MB\n\t\tMaxAge: config.MaxAge, // days\n\t\tMaxBackups: config.MaxBackup,\n\t\tLocalTime: true,\n\t\tCompress: false,\n\t}\n}", "title": "" }, { "docid": "04e4512be7e4453c60cf19985d27c12d", "score": "0.5176043", "text": "func (log *Standard) RotateLogFile() error {\n\tif log.filename == \"\" {\n\t\treturn errors.New(\"No log filename specified\")\n\t}\n\treturn SetLogFileConfig(&LogFileConfig{\n\t\tPath: log.filename,\n\t\tMaxAge: 30 * 24 * time.Hour, // 30 days\n\t\tMaxSize: 128 * 1024 * 1024, // 128mb\n\t\tMaxKeepFiles: 3,\n\t})\n}", "title": "" }, { "docid": "55c0e48ad014f4f02b2d1ee00358c625", "score": "0.5152158", "text": "func InitLogRotator(logFile string) {\n\tlogDir, _ := filepath.Split(logFile)\n\terr := os.MkdirAll(logDir, 0700)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to create logger directory: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\tr, err := rotator.New(logFile, 1024*1024, false, 10)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"failed to create file rotator: %v\\n\", err)\n\t\tos.Exit(1)\n\t}\n\n\tlogRotator = r\n}", "title": "" }, { "docid": "30c26921493826041ea7ed7abf313854", "score": "0.5141774", "text": "func (a SysApi) PutLogConfigPublisher(id string, object SysLogConfigPublisher) (*SysLogConfigPublisher, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/publisher/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigPublisher)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "71c52c077a14aaa6c8654a497bb9929d", "score": "0.5120615", "text": "func (d *vtkData) approleSecretIDRotation() {\n\tapproleSecretIDLookupRetry := 60\n\tglog.Infoln(\"AppRole Secret ID rotation enabled\")\n\n\tfor {\n\t\tif err := d.approleSecretIDLookup(); err != nil {\n\t\t\tglog.Errorln(err)\n\t\t\tglog.Errorln(\"AppRole Secret ID rotation wasn't enabled due to error during getting 'creation_time' for 'secret_id'\")\n\t\t\tglog.Errorln(\"Next retry will be in '\" + strconv.Itoa(approleSecretIDLookupRetry) + \"' seconds\")\n\t\t\tauthApproleSecretID.WithLabelValues(\"rotation-status\").Set(0)\n\t\t\ttime.Sleep(time.Duration(approleSecretIDLookupRetry) * time.Second)\n\t\t\tapproleSecretIDLookupRetry = approleSecretIDLookupRetry * 2\n\t\t} else {\n\t\t\tapproleSecretIDLookupRetry = 60\n\t\t\tauthApproleSecretID.WithLabelValues(\"rotation-status\").Set(1)\n\n\t\t\t// Set correct value for AppRole SecretID interval\n\t\t\tif approleSecretIDRotationInterval == -1 {\n\t\t\t\tapproleSecretIDRotationInterval = int(float64(d.approleSecretIDTTL[\"secret_id_ttl\"]) * 0.7)\n\t\t\t\tglog.Infoln(\"'APPROLE_SECRETID_ROTATION_INTERVAL' wasn't defined, therefore it calculated and set to '\" + strconv.Itoa(approleSecretIDRotationInterval) + \"' seconds\")\n\t\t\t} else if approleSecretIDRotationInterval >= int(d.approleSecretIDTTL[\"secret_id_ttl\"]) {\n\t\t\t\tapproleSecretIDRotationInterval = int(float64(d.approleSecretIDTTL[\"secret_id_ttl\"]) * 0.7)\n\t\t\t\tglog.Infoln(\"'APPROLE_SECRETID_ROTATION_INTERVAL' has incorrect value (>= secret_id_ttl), therefore it calculated and set to '\" + strconv.Itoa(approleSecretIDRotationInterval) + \"' seconds\")\n\t\t\t}\n\n\t\t\ttimeWaitBeforeRotation := approleSecretIDRotationInterval - int(time.Now().Unix()-d.approleSecretIDTTL[\"creation_time\"])\n\t\t\tglog.V(2).Infoln(\"Secret ID will be rotated in '\" + strconv.Itoa(timeWaitBeforeRotation) + \"' seconds\")\n\t\t\tauthApproleSecretID.WithLabelValues(\"next-rotation-timestamp\").Set(float64(time.Now().Unix() + int64(timeWaitBeforeRotation)))\n\t\t\ttimer := time.NewTimer(time.Duration(timeWaitBeforeRotation) * time.Second)\n\t\t\t<-timer.C\n\t\t\tfor {\n\t\t\t\tglog.V(2).Infoln(\"Rotating Secret ID...\")\n\t\t\t\t// Params for creating new 'secret_id'\n\t\t\t\toptions := map[string]interface{}{}\n\t\t\t\tauthPath := fmt.Sprintf(\"auth/%s/role/%s/secret-id\", authMethod, d.approleName)\n\n\t\t\t\tglog.V(2).Infoln(\"Generating new Secret ID\")\n\t\t\t\tapproleSecretID, err := d.vaultClient.Logical().Write(authPath, options)\n\t\t\t\tif err != nil {\n\t\t\t\t\tglog.Errorln(err)\n\t\t\t\t\tglog.Errorln(\"Waiting 60 seconds before retry of generating new Secret ID\")\n\t\t\t\t\tauthApproleSecretID.WithLabelValues(\"last-rotation-status\").Set(0)\n\t\t\t\t\ttime.Sleep(60 * time.Second)\n\t\t\t\t} else {\n\t\t\t\t\td.approleSecretID = approleSecretID.Data[\"secret_id\"]\n\t\t\t\t\t// Revoke old 'secret_id' before replace it by new one\n\t\t\t\t\tif err := d.approleRevokeOldSecretID(); err != nil {\n\t\t\t\t\t\tglog.Errorln(err)\n\t\t\t\t\t\tauthApproleSecretID.WithLabelValues(\"error-revoke-secret-id\").Set(1)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tauthApproleSecretID.WithLabelValues(\"error-revoke-secret-id\").Set(0)\n\t\t\t\t\t}\n\t\t\t\t\t// Save 'secret_id' to k8s secret object\n\t\t\t\t\tif err := d.updateAppSystemSecret(); err != nil {\n\t\t\t\t\t\tglog.Errorln(err)\n\t\t\t\t\t\tglog.Errorln(\"Waiting 60 seconds before retry of generating new Secret ID\")\n\t\t\t\t\t\tauthApproleSecretID.WithLabelValues(\"last-rotation-status\").Set(0)\n\t\t\t\t\t\ttime.Sleep(60 * time.Second)\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tglog.V(2).Infoln(\"Secret ID successfully rotated\")\n\t\t\t\t\tauthApproleSecretID.WithLabelValues(\"last-rotation-status\").Set(1)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a9f45cdf0efc2f068651a0b78645e7e3", "score": "0.50899005", "text": "func (xlw *XMLLogWriter) Rotate() {\n\txlw.lock.Lock()\n\tdefer xlw.lock.Unlock()\n\txlw.intRotate()\n}", "title": "" }, { "docid": "fcca9548303b0d337cbc3ed479f541df", "score": "0.50527275", "text": "func (a SysApi) PutLogConfigDestinationRemoteHighSpeedLog(id string, object SysLogConfigDestinationRemoteHighSpeedLog) (*SysLogConfigDestinationRemoteHighSpeedLog, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteHighSpeedLog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationRemoteHighSpeedLog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "e75ec943df774137b0a87e6e63c9a7fe", "score": "0.5050865", "text": "func (r *rollingWriter) rotate() error {\n\n\t// Close the open file\n\terr := r.file.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Rename it\n\terr = os.Rename(r.fileName, r.fileName+\".\"+time.Now().Format(time.RFC3339))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Create a new \"live\" file\n\tr.bytesWritten = 0\n\tr.file, err = openFile(r.fileName)\n\treturn err\n}", "title": "" }, { "docid": "6df1decd3372365e86f9006a6c4747cc", "score": "0.50477874", "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": "100e92b6ac609461d22a52bf5bd3d1da", "score": "0.49925208", "text": "func (a SysApi) PatchLogConfigDestinationRemoteHighSpeedLog(id string, object SysLogConfigDestinationRemoteHighSpeedLog) (*SysLogConfigDestinationRemoteHighSpeedLog, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteHighSpeedLog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationRemoteHighSpeedLog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "6cd9090042e098942d5924603a7bfb25", "score": "0.4982564", "text": "func (cm *Manager) Rotate(certID string, pemCert []byte, pemCACerts [][]byte) (func(), func(), error) {\n\treturn cm.update(true, certID, pemCert, pemCACerts)\n}", "title": "" }, { "docid": "09533954809bd3b33e578e9075be1338", "score": "0.49546504", "text": "func InitLog(dir, module string, level Level, rotate *LogRotate) (*Log, error) {\n\tl := new(Log)\n\tdir = path.Join(dir, module)\n\tl.dir = dir\n\tLogDir = dir\n\tfi, err := os.Stat(dir)\n\tif err != nil {\n\t\tos.MkdirAll(dir, 0755)\n\t} else {\n\t\tif !fi.IsDir() {\n\t\t\treturn nil, errors.New(dir + \" is not a directory\")\n\t\t}\n\t}\n\t_ = os.Chmod(dir, 0766)\n\tif rotate == nil {\n\t\trotate = NewLogRotate()\n\t\tfs := syscall.Statfs_t{}\n\t\tif err := syscall.Statfs(dir, &fs); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"[InitLog] stats disk space: %s\",\n\t\t\t\terr.Error())\n\t\t}\n\t\tvar minRatio float64\n\t\tif float64(fs.Bavail*uint64(fs.Bsize)) < float64(fs.Blocks*uint64(fs.Bsize))*DefaultHeadRatio {\n\t\t\tminRatio = float64(fs.Bavail*uint64(fs.Bsize)) * DefaultHeadRatio / 1024 / 1024\n\t\t} else {\n\t\t\tminRatio = float64(fs.Blocks*uint64(fs.Bsize)) * DefaultHeadRatio / 1024 / 1024\n\t\t}\n\t\trotate.SetHeadRoomMb(int64(math.Min(minRatio, DefaultHeadRoom)))\n\n\t\tminRollingSize := int64(fs.Bavail * uint64(fs.Bsize) / uint64(len(levelPrefixes)))\n\t\tif minRollingSize < DefaultMinRollingSize {\n\t\t\tminRollingSize = DefaultMinRollingSize\n\t\t}\n\t\trotate.SetRollingSizeMb(int64(math.Min(float64(minRollingSize), float64(DefaultRollingSize))))\n\t}\n\tl.rotate = rotate\n\terr = l.initLog(dir, module, level)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tl.lastRolledTime = time.Now()\n\tgo l.checkLogRotation(dir, module)\n\n\tgLog = l\n\treturn l, nil\n}", "title": "" }, { "docid": "fc28b67d6a48c78702f559d48579ffeb", "score": "0.49261498", "text": "func (a SysApi) PatchLogConfigPublisher(id string, object SysLogConfigPublisher) (*SysLogConfigPublisher, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/publisher/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigPublisher)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "347d8a626f63eb6f29ad7558910ba262", "score": "0.49004066", "text": "func (m *DirectRoutingLogRow) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "54fe459b3df39544c721688cde3c6361", "score": "0.4892141", "text": "func (a LtmApi) PutAlgLogProfile(id string, object LtmAlgLogProfile) (*LtmAlgLogProfile, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/algLogProfile/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmAlgLogProfile)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "ac4102437ed21d11a9dcead960183f44", "score": "0.48668644", "text": "func (a SysApi) DeleteLogConfigDestinationArcsight(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/arcsight/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "b4f2141524740fcd3a0e74a1201ef5bb", "score": "0.48178846", "text": "func logRotator() {\n\terr := logRotate()\n\tif err != nil {\n\t\tlog.Printf(\"Error rotating %s log file: %s\", time.Now().Format(\"2006-01-02\"), err)\n\t}\n\n\tfor range time.Tick(time.Hour * 24) {\n\t\tlogFile.Close()\n\t\terr = logRotate()\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Error rotating %s log file: %s\", time.Now().Format(\"2006-01-02\"), err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "69dd39a54dd5af7190656f2a6775a88e", "score": "0.48092484", "text": "func (a SysApi) PutLogConfigFilter(id string, object SysLogConfigFilter) (*SysLogConfigFilter, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/filter/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigFilter)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "32910981617ab8fa6a4385e501f7a1f2", "score": "0.4768825", "text": "func (a SysApi) PutLogConfigDestinationAlertd(id string, object SysLogConfigDestinationAlertd) (*SysLogConfigDestinationAlertd, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/alertd/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationAlertd)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "c8261a7f304cf458917c239a4bdbf1ae", "score": "0.4751747", "text": "func setConfigForRedirectLogs(req *api.PatchAutomateConfigRequest, existingCopy *deployment.AutomateConfig) error {\n\n\t//Set the config if already not set\n\tif req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == true &&\n\t\texistingCopy.GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == false {\n\n\t\terr := createConfigFileForAutomateSysLog(req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectLogFilePath().GetValue())\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\t\terr = restartSyslogService()\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tif err = runLogrotateConfig(req); err != nil {\n\t\t\tlogrus.Errorf(\"cannot configure log rotate: %v\", err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t//Set the config if already not set\n\tif req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == true &&\n\t\texistingCopy.GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == true {\n\n\t\tres, err := UpdateByMergingStructs(req, existingCopy)\n\t\tif err != nil {\n\t\t\tlogrus.Errorf(\"cannot merge requested and existing structs through mergo.Merge: %v\", err)\n\t\t}\n\n\t\tif IfEqual(res, existingCopy) {\n\t\t\treturn nil\n\t\t}\n\n\t\tif req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectLogFilePath().GetValue() == existingCopy.GetGlobal().GetV1().GetLog().GetRedirectLogFilePath().GetValue() {\n\n\t\t\tif err = runLogrotateConfig(res); err != nil {\n\t\t\t\tlogrus.Errorf(\"cannot configure log rotate with existing file path: %v\", err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\n\t\terr = createConfigFileForAutomateSysLog(req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectLogFilePath().GetValue())\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\terr = restartSyslogService()\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tif err = runLogrotateConfig(res); err != nil {\n\t\t\tlogrus.Errorf(\"cannot configure log rotate with new file path: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t//Rollback the config if requested\n\tif req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectSysLog() != nil && req.GetConfig().GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == false &&\n\t\texistingCopy.GetGlobal().GetV1().GetLog().GetRedirectSysLog().GetValue() == true {\n\t\terr := removeConfigFileForAutomateSyslog()\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, \"Failed to remove configuration into syslog\")\n\t\t}\n\t\terr = restartSyslogService()\n\t\tif err != nil {\n\t\t\treturn status.Error(codes.Internal, err.Error())\n\t\t}\n\n\t\tif err = rollbackLogrotate(); err != nil {\n\t\t\tlogrus.Errorf(\"cannot rollback logrotate: %v\", err)\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f972f19ffb06bdfba145cbc9bbf3bb7f", "score": "0.47517136", "text": "func (a SysApi) PutLogConfigDestinationIpfix(id string, object SysLogConfigDestinationIpfix) (*SysLogConfigDestinationIpfix, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/ipfix/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationIpfix)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "cd4c63b87e3242651fc584ae038991ad", "score": "0.4722821", "text": "func (t LogWrapper) ID() string { return t.t.ID() }", "title": "" }, { "docid": "c2171d97ec9f27714895e5a72376f6a5", "score": "0.46868908", "text": "func (a SysApi) PutLogConfigDestinationLocalSyslog(id string, object SysLogConfigDestinationLocalSyslog) (*SysLogConfigDestinationLocalSyslog, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/localSyslog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationLocalSyslog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "70ec6dcb452a05f7c799cc6fe039855a", "score": "0.46816963", "text": "func (l *Logger) Rotate() error {\n\tl.mu.Lock()\n\tdefer l.mu.Unlock()\n\treturn l.rotate()\n}", "title": "" }, { "docid": "d1aed90b180f675d962fa4208c5ca26a", "score": "0.46760252", "text": "func (a LtmApi) PatchAlgLogProfile(id string, object LtmAlgLogProfile) (*LtmAlgLogProfile, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/algLogProfile/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmAlgLogProfile)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "22bbea45eb74129bad80d9a049aa9c51", "score": "0.46618375", "text": "func (a SysApi) PostLogConfigDestinationArcsight(id string, object SysLogConfigDestinationArcsight) (*SysLogConfigDestinationArcsight, error) {\n\n\tvar httpMethod = \"Post\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/arcsight/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationArcsight)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "33179f40aa731315b7b4e3d3d99371bd", "score": "0.46412635", "text": "func (e *eventHandler) OnRotate(roateEvent *replication.RotateEvent) error {\n\tpos := mysql.Position{\n\t\tName: string(roateEvent.NextLogName),\n\t\tPos: uint32(roateEvent.Position),\n\t}\n\n\te.s.syncCh <- posSaver{pos, true}\n\n\treturn e.s.Ctx.Err()\n}", "title": "" }, { "docid": "621686d059a5186631215742bfbfcf1c", "score": "0.46243495", "text": "func (a SysApi) PutLogConfigDestinationRemoteSyslog(id string, object SysLogConfigDestinationRemoteSyslog) (*SysLogConfigDestinationRemoteSyslog, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteSyslog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationRemoteSyslog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "dd05a8cba17bd54908babce5a1538fa7", "score": "0.46219763", "text": "func (a LtmApi) PutProfileRequestLog(id string, object LtmProfileRequestLog) (*LtmProfileRequestLog, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/profile/requestLog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmProfileRequestLog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "d41aadc29c3e6a72680c203af7a1cb50", "score": "0.4615827", "text": "func (a SysApi) DeleteLogConfigPublisher(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/publisher/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "5822598a206db3cdc0382939942ba59c", "score": "0.4608682", "text": "func runLogrotateConfig(req *api.PatchAutomateConfigRequest) error {\n\tif err := logrotateConfChecks(); err != nil {\n\t\tlogrus.Error(\"Logrotate isn't setup!\")\n\t}\n\n\tif err := configLogrotate(req.GetConfig().GetGlobal().GetV1().GetLog()); err != nil {\n\t\tlogrus.Errorf(\"Error while configuring logrotate: %v\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ab9e1aa189c614c6fe3d87c8a2975cff", "score": "0.45990044", "text": "func (a SysApi) PutLogConfigDestinationSplunk(id string, object SysLogConfigDestinationSplunk) (*SysLogConfigDestinationSplunk, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/splunk/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationSplunk)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "8d8235f0f4dcabeee508b6bd0a27beae", "score": "0.45975482", "text": "func (p *Provider) SetLogger(id string) {\n\tworkingDir, err := os.Getwd()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tlogPath := config.GetConfig().LogPath\n\tif logPath == \"\" {\n\t\tlogPath = path.Join(workingDir, \"logs\")\n\t}\n\n\tlogFile := path.Join(logPath, id)\n\t// Setup Logger\n\tp.LogPath = logFile\n\tp.Logger = config.GetLogger(p.Name, logFile)\n}", "title": "" }, { "docid": "abbcde51744f7b2c9da7b37d8a051f58", "score": "0.45910752", "text": "func (a SysApi) PutDaemonLogSettingsLind(id string, object SysDaemonLogSettingsLind) (*SysDaemonLogSettingsLind, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/daemonLogSettings/lind/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysDaemonLogSettingsLind)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "b10e4e94c3d77aa097b9339cd3e6a83f", "score": "0.4580134", "text": "func initConfig() {\n\tviper.SetConfigFile(cfgFile)\n\tviper.AutomaticEnv() // read in environment variables that match\n\n\tlog.Formatter = &logrus.JSONFormatter{\n\t\tTimestampFormat:\"2006-01-02 15:04:05\",\n\t}\n\tlog.Out = os.Stdout\n\t// if a config file is found, read it in.\n\terr := viper.ReadInConfig()\n\n\tif err == nil {\n\t\tlog.Infof(\"using config file %s\", viper.ConfigFileUsed())\n\t} else {\n\t\tlog.Fatalf(\"viper.ReadInConfig() failed, %s\", err)\n\t}\n\n\tlevel := viper.GetString(\"log.level\")\n\tlvl, err := logrus.ParseLevel(level)\n\tif err != nil {\n\t\tlog.Errorf(\"set log level failed, %s\", err)\n\t}\n\tlog.Infof(\"set log level %s\", level)\n\tlog.SetLevel(lvl)\n\n\tpath := viper.GetString(\"log.path\")\n\tif path == \"\" {\n\t\tpath = \"tmp/blog.log\"\n\t}\n\tos.MkdirAll(filepath.Dir(path), 0777)\n\tlog.Infof(\"set logfile path %s\", path)\n\n\t// 设置 rotatelogs\n\tlogWriter, err := rotatelogs.New(\n\t\t// 分割后的文件名称\n\t\tpath + \".%Y%m%d.log\",\n\t\t// 生成软链,指向最新日志文件\n\t\trotatelogs.WithLinkName(path),\n\t\t// 设置最大保存时间(7天)\n\t\trotatelogs.WithMaxAge(7*24*time.Hour),\n\t\t// 设置日志切割时间间隔(1天)\n\t\trotatelogs.WithRotationTime(24*time.Hour),\n\t)\n\tif err != nil {\n\t\tlog.Errorf(\"failed to set rotatelogs, %s\", err)\n\t}\n\tlog.SetOutput(logWriter)\n}", "title": "" }, { "docid": "dc1e6108eb35fe6ef1e1bbcc420e58c6", "score": "0.45533827", "text": "func (a *AccessKeyRotatorApp) Rotate(ctx context.Context, access_key_id string) error {\n\tif access_key_id == \"\" {\n\t\treturn fmt.Errorf(\"access_key_id is empty\")\n\t}\n\n\t_, err := a.KeyManager.RotateAccessKey(ctx, access_key_id)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Key rotation failed: %s\", err)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "65e55b283f8d7177e9f23e12d41d1c87", "score": "0.45388064", "text": "func (k *KeyManager) Rotate(kt kmsservice.KeyType, keyID string) (string, interface{}, error) {\n\tif k.RotateKeyErr != nil {\n\t\treturn \"\", nil, k.RotateKeyErr\n\t}\n\n\treturn k.RotateKeyID, k.RotateKeyValue, nil\n}", "title": "" }, { "docid": "0105ecd67fcfb10c74b9067257dac6f1", "score": "0.45379445", "text": "func updatelog(obj string, parent string, out string) {\n\t// open a file\n\tf, err := os.OpenFile(logrecord[parent], os.O_APPEND|os.O_CREATE|os.O_RDWR, 0666)\n\t// fmt.Println(logrecord[parent])\n\tif err != nil {\n\t\t// fmt.Printf(\"error opening file: %v\", err)\n\t}\n\n\t// don't forget to close it\n\tdefer f.Close()\n\n\t// Log as JSON instead of the default ASCII formatter.\n\tlog.SetFormatter(&log.JSONFormatter{})\n\n\t// Output to stderr instead of stdout, could also be a file.\n\tlog.SetOutput(f)\n\n\tlog.WithFields(log.Fields{\n\t\t\"Event \": out,\n\t\t\"on file\": obj,\n\t}).Info(\"executed\")\n\n}", "title": "" }, { "docid": "660655cc4e11fc61abf448f3f12899aa", "score": "0.45378166", "text": "func (a SysApi) PutLogConfigDestinationManagementPort(id string, object SysLogConfigDestinationManagementPort) (*SysLogConfigDestinationManagementPort, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/managementPort/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationManagementPort)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "6ccdf77d969bce38ded36bcd3d77fbf4", "score": "0.45292872", "text": "func DjangoAdminLogByID(ctx context.Context, db DB, id int) (*DjangoAdminLog, error) {\n\t// query\n\tconst sqlstr = `SELECT ` +\n\t\t`id, action_time, object_id, object_repr, action_flag, change_message, content_type_id, user_id ` +\n\t\t`FROM django.django_admin_log ` +\n\t\t`WHERE id = @p1`\n\t// run\n\tlogf(sqlstr, id)\n\tdal := DjangoAdminLog{\n\t\t_exists: true,\n\t}\n\tif err := db.QueryRowContext(ctx, sqlstr, id).Scan(&dal.ID, &dal.ActionTime, &dal.ObjectID, &dal.ObjectRepr, &dal.ActionFlag, &dal.ChangeMessage, &dal.ContentTypeID, &dal.UserID); err != nil {\n\t\treturn nil, logerror(err)\n\t}\n\treturn &dal, nil\n}", "title": "" }, { "docid": "b009945e4073726467001b89499fa2db", "score": "0.4523339", "text": "func (u *__TriggerLog_Updater) Id(newVal int) *__TriggerLog_Updater {\n\tu.updates[\" Id = ? \"] = newVal\n\treturn u\n}", "title": "" }, { "docid": "b349af715f580418a5decda0b9b0475f", "score": "0.45143995", "text": "func (xlw *XMLLogWriter) SetRotateSize(maxsize int) {\n\txlw.maxsize = maxsize\n}", "title": "" }, { "docid": "a14e212e072026b510c5a7070b0c0155", "score": "0.449609", "text": "func (a SysApi) PatchLogConfigDestinationAlertd(id string, object SysLogConfigDestinationAlertd) (*SysLogConfigDestinationAlertd, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/alertd/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationAlertd)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "87cee7948878c31d2746769afe016a19", "score": "0.44772664", "text": "func (c *controllerImpl) log(obj interface{}, kind eventType) error {\n\tif !c.HasSynced() {\n\t\t// should only happen before an initial listing has completed\n\t\treturn errors.New(\"resource sync has yet not completed\")\n\t}\n\tk, err := cache.DeletionHandlingMetaNamespaceKeyFunc(obj)\n\tif err != nil {\n\t\tc.env.Logger().Infof(\"could not retrieve key for object: %v\", err)\n\t\treturn nil\n\t}\n\tc.env.Logger().Infof(\"%s object with key: '%#v'\", kind, k)\n\treturn nil\n}", "title": "" }, { "docid": "cecc3a6e3b928757228c6a1038f28323", "score": "0.44716224", "text": "func createLog(id string) (io.Closer, *log.Logger) {\n\tvar f io.Closer\n\tvar w io.Writer = os.Stdout\n\tif !*flagNoLog && *flagLogMask != \"\" {\n\t\tfilename := *flagLogMask\n\t\tif strings.Contains(*flagLogMask, \"%s\") {\n\t\t\tfilename = fmt.Sprintf(*flagLogMask, idCleanRE.ReplaceAllString(id, \"\"))\n\t\t}\n\t\tl, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0644)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tf, w = l, io.MultiWriter(os.Stdout, l)\n\t}\n\treturn f, log.New(w, \"\", log.LstdFlags)\n}", "title": "" }, { "docid": "d55a6536696d65edd99d41e905b5bafc", "score": "0.4467212", "text": "func withCardLogID(id int) cardlogOption {\n\treturn func(m *CardLogMutation) {\n\t\tvar (\n\t\t\terr error\n\t\t\tonce sync.Once\n\t\t\tvalue *CardLog\n\t\t)\n\t\tm.oldValue = func(ctx context.Context) (*CardLog, error) {\n\t\t\tonce.Do(func() {\n\t\t\t\tif m.done {\n\t\t\t\t\terr = fmt.Errorf(\"querying old values post mutation is not allowed\")\n\t\t\t\t} else {\n\t\t\t\t\tvalue, err = m.Client().CardLog.Get(ctx, id)\n\t\t\t\t}\n\t\t\t})\n\t\t\treturn value, err\n\t\t}\n\t\tm.id = &id\n\t}\n}", "title": "" }, { "docid": "ab391d387116ca582ee4e81f6ebd931d", "score": "0.4458988", "text": "func (s *srv) rotate(bad bool) error {\n\tdefer func() {\n\t\ts.w.Close()\n\t\ts.f.Close()\n\t\tif bad {\n\t\t\tos.Rename(s.f.Name(), s.f.Name()+\".bad\")\n\t\t}\n\t\ts.f, s.w = nil, nil\n\t}()\n\tif err := s.w.Close(); err != nil {\n\t\treturn err\n\t}\n\tif err := s.f.Close(); err != nil {\n\t\treturn err\n\t}\n\tname := filepath.Join(s.dir, s.t.Format(\"20060102_150405\")+\".log.sz\")\n\tif bad {\n\t\tname += \".bad\"\n\t}\n\treturn os.Rename(s.f.Name(), name)\n}", "title": "" }, { "docid": "f9c6bd27c269c6f948d933a9c0800817", "score": "0.4454262", "text": "func (l *localFilesystem) Rotate(m *v1manifest.Manifest) error {\n\ttxn, err := store.New(l.rootPath, l.upstream).Begin()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := model.New(txn, l.keys).Rotate(m); err != nil {\n\t\t_ = txn.Rollback()\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "0298bdd2d535297abe376cd7b569b1ff", "score": "0.44532523", "text": "func (a SysApi) PatchLogConfigDestinationSplunk(id string, object SysLogConfigDestinationSplunk) (*SysLogConfigDestinationSplunk, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/splunk/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationSplunk)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "ada999af336b519c4dde919c507e6064", "score": "0.44506633", "text": "func (a SysApi) PatchLogConfigDestinationIpfix(id string, object SysLogConfigDestinationIpfix) (*SysLogConfigDestinationIpfix, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/ipfix/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationIpfix)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "3a5906ddff29ee18c7ca5127d71f206c", "score": "0.44478306", "text": "func (r *RollingUpgradeReconciler) logger(ruObj *upgrademgrv1alpha1.RollingUpgrade) logr.Logger {\n\treturn r.Log.WithValues(\"rollingupgrade\", ruObj.NamespacedName())\n}", "title": "" }, { "docid": "321d6b8263819973a01766c412a291ba", "score": "0.4437367", "text": "func (a SysApi) PatchLogConfigDestinationManagementPort(id string, object SysLogConfigDestinationManagementPort) (*SysLogConfigDestinationManagementPort, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/managementPort/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationManagementPort)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "9531b9a7e9eda5f05175384e782d11c1", "score": "0.4437065", "text": "func (sb *syncBuffer) rotateFile(now time.Time) error {\n\tvar err error\n\tpn := \"<none>\"\n\tfile, name, err := create(sb.sev.String(), now)\n\n\tif sb.file != nil {\n\t\t// The current log file becomes the previous log at the end of\n\t\t// this block, so save its name for use in the header of the next\n\t\t// file.\n\t\tpn = sb.file.Name()\n\t\tsb.Flush()\n\t\t// If there's an existing file, write a footer with the name of\n\t\t// the next file in the chain, followed by the constant string\n\t\t// \\nCONTINUED IN NEXT FILE\\n to make continuation detection simple.\n\t\tsb.file.Write([]byte(\"Next log: \"))\n\t\tsb.file.Write([]byte(name))\n\t\tsb.file.Write([]byte(footer))\n\t\tsb.file.Close()\n\t}\n\n\tsb.file = file\n\tsb.names = append(sb.names, name)\n\tsb.nbytes = 0\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsb.Writer = bufio.NewWriterSize(sb.file, bufferSize)\n\n\t// Write header.\n\tvar buf bytes.Buffer\n\tfmt.Fprintf(&buf, \"Log file created at: %s\\n\", now.Format(\"2006/01/02 15:04:05\"))\n\tfmt.Fprintf(&buf, \"Running on machine: %s\\n\", host)\n\tfmt.Fprintf(&buf, \"Binary: Built with %s %s for %s/%s\\n\", runtime.Compiler, runtime.Version(), runtime.GOOS, runtime.GOARCH)\n\tfmt.Fprintf(&buf, \"Previous log: %s\\n\", pn)\n\tfmt.Fprintf(&buf, \"Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg\\n\")\n\tn, err := sb.file.Write(buf.Bytes())\n\tsb.nbytes += uint64(n)\n\treturn err\n}", "title": "" }, { "docid": "5433344271758b6b41223fa4118a14b5", "score": "0.44365233", "text": "func (a SysApi) PatchLogConfigDestinationRemoteSyslog(id string, object SysLogConfigDestinationRemoteSyslog) (*SysLogConfigDestinationRemoteSyslog, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteSyslog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationRemoteSyslog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "f7aae068890985870aeb80fbb2a3d3f9", "score": "0.44302985", "text": "func (c ClientWithCtx) SetLogInfo(id string, new types.LogInfo) (updated types.LogInfo, err error) {\n\turl := c.url(\"/log\", id)\n\tro := c.ro()\n\tro.JSON = new\n\terr = c.putJSON(url, &ro, &updated)\n\treturn\n}", "title": "" }, { "docid": "2aa50814f99481bc442bdeddf83670fb", "score": "0.44265795", "text": "func (a SysApi) PatchLogConfigDestinationLocalSyslog(id string, object SysLogConfigDestinationLocalSyslog) (*SysLogConfigDestinationLocalSyslog, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/localSyslog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationLocalSyslog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "552840ffe85c9b7c19cf50e15b30fdf5", "score": "0.4426575", "text": "func FileRotate(fileName string, dest string, pidPath string, compress bool) error {\n\tt := time.Now().Format(\"2006-01-02\")\n\t//TODO\n\tif dest != \"\" {\n\t\tnewName, flag := destUtil(fileName, dest, t)\n\t\terr := os.Rename(fileName, newName)\n\t\tif err != nil {\n\t\t\tlog.Println(\"file rename err:-----------<\", err)\n\t\t\treturn err\n\t\t}\n\t\tif err := pid2Reload(pidPath); err != nil {\n\t\t\tlog.Println(\"pid reload err:-----------<\", err)\n\t\t\t// recover the file name when error occurred\n\t\t\tos.Rename(newName, fileName)\n\t\t\treturn err\n\t\t}\n\t\t// newName abs path\n\t\tif compress == true {\n\t\t\tcmpFile, err := fileCompress(newName)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif flag == true {\n\t\t\t\terr := osstransfer(cmpFile, dest)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\tif err := fileTruncate(fileName); err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// } else {\n\t// \tnewName := fileName + \"-\" + string(t)\n\t// \terr := os.Rename(fileName, newName)\n\t// \tif err == nil {\n\t// \t\tpid2Reload(pidPath)\n\t// \t\tdeleteFile(newName)\n\t// \t}\n\tlog.Printf(\"fileLogRotate-->%v, dest:%v, compress:%t \\n\", fileName, dest, compress)\n\treturn nil\n}", "title": "" }, { "docid": "387294318121080279f28807cd06f134", "score": "0.4419217", "text": "func RollingReplace(config Config, region string,\n\tlogger log.DebugLogger) error {\n\treturn rollingReplace(config, region, logger)\n}", "title": "" }, { "docid": "4c788ef74f06fcd02f7ba14c26e140d3", "score": "0.43893906", "text": "func (a LtmApi) PutLsnLogProfile(id string, object LtmLsnLogProfile) (*LtmLsnLogProfile, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/lsnLogProfile/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmLsnLogProfile)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "42cbddb1047b0e5934aaf314241b13ca", "score": "0.43792182", "text": "func InitLog(format logrus.Formatter, level logrus.Level, env, logpath, duration, url, channel string, hook, multiWriter, showFileInfo bool) {\n\td, err := time.ParseDuration(duration)\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"InitLog %v\", err))\n\t}\n\n\tlogrus.SetFormatter(format)\n\tlogrus.SetLevel(level)\n\n\tif hook {\n\t\tlogrus.AddHook(&slack.Hook{\n\t\t\tHookURL: url,\n\t\t\tAcceptedLevels: slack.LevelThreshold(level),\n\t\t\tChannel: channel,\n\t\t\tIconEmoji: \":ghost:\",\n\t\t\tUsername: \"footbot\",\n\t\t\tEnv: env,\n\t\t})\n\t}\n\n\tnow := time.Now().UTC()\n\tt := now.Truncate(d)\n\n\tfullpath := logpath + \"/\" + utils.Time2String(&t, \"_\") + \".\" + \"log\"\n\n\tif err := os.MkdirAll(filepath.Dir(fullpath), 0744); err != nil {\n\t\tError(\"error folder create : \", err)\n\t\tos.Exit(1)\n\t}\n\n\tf, err := os.OpenFile(fullpath, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)\n\tif err != nil {\n\t\tError(\"error opening file: \", err)\n\t\tos.Exit(1)\n\t}\n\n\tif multiWriter {\n\t\tlogrus.SetOutput(io.MultiWriter(f, os.Stdout))\n\t} else {\n\t\tlogrus.SetOutput(f)\n\t}\n\n\trtLogConf.showFileInfo = showFileInfo\n\trtLogConf.today = &t\n\trtLogConf.logpath = logpath\n\trtLogConf.file = f\n\n\twg.Add(1)\n\tgo func() {\n\t\tDebug(\"Logger start fetching filename with datetime\")\n\tloop:\n\t\tfor {\n\t\t\tnow := time.Now().UTC()\n\t\t\tnext := now.Truncate(d)\n\t\t\tnt := next.Unix()\n\t\t\tt := rtLogConf.today.UTC().Unix()\n\n\t\t\tif nt > t {\n\t\t\t\tpath := rtLogConf.logpath + \"/\" + utils.Time2String(&next, \"_\") + \".\" + \"log\"\n\t\t\t\tf, err := os.OpenFile(path, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)\n\t\t\t\tif err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\n\t\t\t\tif multiWriter {\n\t\t\t\t\tlogrus.SetOutput(io.MultiWriter(f, os.Stdout))\n\t\t\t\t} else {\n\t\t\t\t\tlogrus.SetOutput(f)\n\t\t\t\t}\n\n\t\t\t\tif err := rtLogConf.file.Close(); err != nil {\n\t\t\t\t\tpanic(err)\n\t\t\t\t}\n\n\t\t\t\trtLogConf.today = &next\n\t\t\t\trtLogConf.file = f\n\t\t\t}\n\n\t\t\ttime.Sleep(500 * time.Millisecond)\n\n\t\t\tselect {\n\t\t\tcase <-logExit:\n\t\t\t\tbreak loop\n\t\t\tdefault:\n\t\t\t}\n\t\t}\n\t\twg.Done()\n\t}()\n}", "title": "" }, { "docid": "ca0b15d97a58c753a02ee4e710477b23", "score": "0.4368043", "text": "func (svc attachment) log(fields ...zapcore.Field) *zap.Logger {\n\treturn logger.AddRequestID(svc.ctx, svc.logger).With(fields...)\n}", "title": "" }, { "docid": "e6cff10740b4756d4f15ffdca4bc1398", "score": "0.43655673", "text": "func (w *RotatingWriter) rotate() error {\n\tif err := w.file.Close(); err != nil {\n\t\treturn err\n\t}\n\n\t{\n\t\tdestName := w.makeDestName()\n\t\t_, err := os.Stat(destName)\n\t\tif err != nil && !os.IsNotExist(err) {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := os.Rename(w.filename, destName); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif w.compress {\n\t\t\tif err := w.compressFile(destName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\t// no error to compress the data and to rename it\n\t\t\t// to its last filename, we can now safely remove\n\t\t\t// the original uncompressed file.\n\t\t\tif err := os.Remove(destName); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\tw.startDate = time.Now().Truncate(time.Hour * 24)\n\t}\n\n\t{\n\t\tfile, err := os.OpenFile(w.filename, os.O_RDWR|os.O_CREATE, 0600)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tw.file = file\n\t\tw.currentSize = 0\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3c2546237dddf1d8ad5e0470af0a3683", "score": "0.4360589", "text": "func (svc namespace) log(ctx context.Context, fields ...zapcore.Field) *zap.Logger {\n\treturn logger.AddRequestID(ctx, svc.logger).With(fields...)\n}", "title": "" }, { "docid": "330c11429016fcc60f12d17810af1440", "score": "0.43556994", "text": "func (w *RotateWriter) Rotate() (err error) {\n\tw.Lock()\n\tdefer w.Unlock()\n\n\t// Close existing file if open\n\tif w.fp != nil {\n\t\terr = w.fp.Close()\n\t\tw.fp = nil\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\t// Rename dest file if it already exists\n\t_, err = os.Stat(w.filename)\n\tif err == nil {\n\t\terr = os.Rename(w.filename, w.filename+\".\"+time.Now().Format(time.RFC3339))\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Create a file.\n\tw.fp, err = os.Create(w.filename)\n\treturn\n}", "title": "" }, { "docid": "1bad8f08ce2bf1945bf8d0a3ef18f1fe", "score": "0.43408522", "text": "func incrementLogID(ctx context.Context, runidPrefix string) (context.Context, *logrus.Entry) {\n\tif runidPrefix == \"node\" {\n\t\trunid := fmt.Sprintf(\"%s-%d\", runidPrefix, syncNodeLogCount)\n\t\tatomic.AddInt32(&syncNodeLogCount, 1)\n\t\treturn setRunIDContext(ctx, runid)\n\t} else if runidPrefix == \"config\" {\n\t\trunid := fmt.Sprintf(\"%s-%d\", runidPrefix, syncConfigLogCount)\n\t\tatomic.AddInt32(&syncConfigLogCount, 1)\n\t\treturn setRunIDContext(ctx, runid)\n\t}\n\treturn nil, nil\n}", "title": "" }, { "docid": "9df2a9358f04ec933d4489c58b05cd10", "score": "0.43408453", "text": "func (a SysApi) GetLogConfigDestinationArcsight(id string) (*SysLogConfigDestinationArcsight, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/arcsight/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationArcsight)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "0141ce47e8bdc1be630ee66f61df88ea", "score": "0.43407968", "text": "func (m *DirectRoutingLogRow) SetCorrelationId(value *string)() {\n err := m.GetBackingStore().Set(\"correlationId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "8baaea2e8f6e6eb42856f7233defe537", "score": "0.4333855", "text": "func (a SysApi) PutDaemonLogSettingsIcrd(id string, object SysDaemonLogSettingsIcrd) (*SysDaemonLogSettingsIcrd, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/daemonLogSettings/icrd/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysDaemonLogSettingsIcrd)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "c2258f05c92e6e7e59f28a0917b1704a", "score": "0.4333478", "text": "func (a SysApi) PutLogConfigDestinationLocalDatabase(id string, object SysLogConfigDestinationLocalDatabase) (*SysLogConfigDestinationLocalDatabase, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/localDatabase/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationLocalDatabase)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "78d09acaff54e7e6d2a929953e758f48", "score": "0.43258893", "text": "func (a SysApi) PostLogConfigPublisher(id string, object SysLogConfigPublisher) (*SysLogConfigPublisher, error) {\n\n\tvar httpMethod = \"Post\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/publisher/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigPublisher)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "53f27c460191bf3e674cc7b36ef11048", "score": "0.4324146", "text": "func (crowdin *Crowdin) log(a interface{}) {\r\n\tif crowdin.debug {\r\n\t\tif crowdin.logWriter != nil {\r\n\t\t\ttimestamp := time.Now().Format(time.RFC3339)\r\n\t\t\tmsg := fmt.Sprintf(\"%v: %v\", timestamp, a)\r\n\t\t\ttoken := \"Authorization:[Bearer \" // prefix for key\r\n\t\t\tvar purged string // Build the purged string in here\r\n\t\t\tlist1 := strings.Split(msg, token)\r\n\t\t\tif len(list1) > 1 {\r\n\t\t\t\tfor k1, v1 := range list1 {\r\n\t\t\t\t\tif k1 > 0 { // The 1st v1 is empty or doesn't include a key\r\n\t\t\t\t\t\tlist2 := strings.Fields(v1) // Split strings seprated by spaces\r\n\t\t\t\t\t\tif len(list2) > 0 {\r\n\t\t\t\t\t\t\tv2 := list2[0] // Supposedly the secret key\r\n\t\t\t\t\t\t\tpurgedsubstr := v2[0:2] + strings.Repeat(\"X\", len(v2)-7) + v2[len(v2)-5:len(v2)] // Keep the 1st 2 and last 4 digits and ]\r\n\t\t\t\t\t\t\tpurged += (token + purgedsubstr)\r\n\t\t\t\t\t\t\tfor i := 1; i < len(list2); i++ { // Add the remaining of the substrings\r\n\t\t\t\t\t\t\t\tpurged += (\" \" + list2[i])\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tpurged += token\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpurged += v1\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tpurged = msg\r\n\t\t\t}\r\n\t\t\tfmt.Fprintln(crowdin.logWriter, purged)\r\n\t\t} else {\r\n\t\t\tlog.Println(a)\r\n\t\t}\r\n\t}\r\n}", "title": "" }, { "docid": "68f5f2c4496b7abce53c7731776afe24", "score": "0.43218496", "text": "func (a SysApi) PatchLogConfigFilter(id string, object SysLogConfigFilter) (*SysLogConfigFilter, error) {\n\n\tvar httpMethod = \"Patch\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/filter/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigFilter)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "ac3264d917e8572aa1cc117e971f77e5", "score": "0.43141085", "text": "func (w *AccessLoggerFile) SetRotateSize(maxsize int) *AccessLoggerFile {\n\t//fmt.Fprintf(os.Stderr, \"AccessLoggerFile.SetRotateSize: %v\\n\", maxsize)\n\tif w.file != nil {\n\t\tw.file.SetRotateSize(maxsize)\n\t}\n\treturn w\n}", "title": "" }, { "docid": "955ffe12e74cffeedd576352471a5c55", "score": "0.4295862", "text": "func (a SysApi) PostLogConfigDestinationRemoteHighSpeedLog(id string, object SysLogConfigDestinationRemoteHighSpeedLog) (*SysLogConfigDestinationRemoteHighSpeedLog, error) {\n\n\tvar httpMethod = \"Post\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteHighSpeedLog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogConfigDestinationRemoteHighSpeedLog)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "bcc63be41903f62b400346d3f9f1c3c1", "score": "0.4295315", "text": "func (a SysApi) GetLogRotateList() (*SysLogRotateList, error) {\n\n\tvar httpMethod = \"Get\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logRotate\"\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(SysLogRotateList)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "5e08fddd98d76b5d0189894c1ad6d2bd", "score": "0.42896336", "text": "func (m *MysqlCDC) OnRotate(header *replication.EventHeader, e *replication.RotateEvent) error {\n\tpos := mysql.Position{\n\t\tName: string(e.NextLogName),\n\t\tPos: uint32(e.Position),\n\t}\n\tm.cdcOffset.Update(pos)\n\treturn nil\n}", "title": "" }, { "docid": "c0d78d06dedafc379a5a496de2f1d6be", "score": "0.42808306", "text": "func (a SysApi) DeleteLogConfigDestinationRemoteHighSpeedLog(id string) error {\n\n\tvar httpMethod = \"Delete\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/sys/logConfig/destination/remoteHighSpeedLog/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\n\treturn NewAPIResponse(httpResponse, err)\n\n}", "title": "" }, { "docid": "df57b6aa74193b90186a63d1eeda48a4", "score": "0.42662963", "text": "func (a LtmApi) PutProfileDnsLogging(id string, object LtmProfileDnsLogging) (*LtmProfileDnsLogging, error) {\n\n\tvar httpMethod = \"Put\"\n\t// create path and map variables\n\tpath := a.configuration.BasePath + \"/tm/ltm/profile/dnsLogging/{id}\"\n\tpath = strings.Replace(path, \"{\"+\"id\"+\"}\", fmt.Sprintf(\"%v\", id), -1)\n\n\theaderParams := make(map[string]string)\n\tqueryParams := url.Values{}\n\tformParams := make(map[string]string)\n\tvar postBody interface{}\n\tvar fileName string\n\tvar fileBytes []byte\n\t// authentication '(token)' required\n\t// set key with prefix in header\n\theaderParams[\"X-F5-Auth-Token\"] = a.configuration.getAPIKeyWithPrefix(\"X-F5-Auth-Token\")\n\t// add default headers if any\n\tfor key := range a.configuration.DefaultHeader {\n\t\theaderParams[key] = a.configuration.DefaultHeader[key]\n\t}\n\n\t// to determine the Content-Type header\n\tlocalVarHttpContentTypes := []string{\n\t\t\"application/json\",\n\t}\n\n\t// set Content-Type header\n\tlocalVarHttpContentType := a.configuration.restClient.selectHeaderContentType(localVarHttpContentTypes)\n\tif localVarHttpContentType != \"\" {\n\t\theaderParams[\"Content-Type\"] = localVarHttpContentType\n\t}\n\t// to determine the Accept header\n\tlocalVarHttpHeaderAccepts := []string{\n\t\t\"aplication/json\",\n\t}\n\n\t// set Accept header\n\tlocalVarHttpHeaderAccept := a.configuration.restClient.SelectHeaderAccept(localVarHttpHeaderAccepts)\n\tif localVarHttpHeaderAccept != \"\" {\n\t\theaderParams[\"Accept\"] = localVarHttpHeaderAccept\n\t}\n\t// body params\n\tpostBody = &object\n\n\thttpResponse, err := a.configuration.restClient.callAPI(path, httpMethod, postBody, headerParams, queryParams, formParams, fileName, fileBytes)\n\tvar successPayload = new(LtmProfileDnsLogging)\n\tif err == nil && httpResponse.StatusCode() == 200 {\n\t\terr = json.Unmarshal(httpResponse.Body(), &successPayload)\n\t}\n\terr = NewAPIResponse(httpResponse, err)\n\tif err != nil {\n\t\treturn nil, err\n\t} else {\n\t\treturn successPayload, err\n\t}\n\n}", "title": "" }, { "docid": "7e87d2e961bec3fa39b75f85431388a2", "score": "0.42633763", "text": "func NewFileLogWriter(fname string, rotatable bool, rottype string, rotsuffix string, rotinterval int) *FileLogWriter {\n\tw := &FileLogWriter{\n\t\trec: make(chan *LogRecord, LogBufferLength),\n\t\trot: make(chan bool),\n\t\tfilename: fname,\n\t\tformat: \"[%D %T] [%L] (%S) %M\",\n\n\t\trotatable: rotatable,\n\t\trottype: rottype,\n\t\trotsuffix: rotsuffix,\n\t\trotinterval: rotinterval,\n\t}\n\n\t// open the file for the first time\n\tif err := w.intRotate(); err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"FileLogWriter(%q): %s\\n\", w.filename, err)\n\t\treturn nil\n\t}\n\n\tgo func() {\n\t\tdefer func() {\n\t\t\tif w.file != nil {\n\t\t\t\tfmt.Fprint(w.file, FormatLogRecord(w.trailer, &LogRecord{Created: time.Now()}))\n\t\t\t\tw.file.Close()\n\t\t\t}\n\t\t}()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase rec, ok := <-w.rec:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif w.canRotate() {\n\t\t\t\t\t// 更换新文件\n\t\t\t\t\tif err := w.intRotate(); err != nil {\n\t\t\t\t\t\tfmt.Fprintf(os.Stderr, \"FileLogWriter(%q): %s\\n\", w.filename, err)\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// 记录日志\n\t\t\t\t_, err := fmt.Fprint(w.file, FormatLogRecord(w.format, rec))\n\t\t\t\tif err != nil {\n\t\t\t\t\tfmt.Fprintf(os.Stderr, \"FileLogWriter(%q): %s\\n\", w.curFileName, err)\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\t// Update the counts\n\t\t\t\t//w.maxlines_curlines++\n\t\t\t\t//w.maxsize_cursize += n\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn w\n}", "title": "" } ]
5eaede8ba94c87af9f2f4bdfb19237a5
NewMockAccountRetriever creates a new mock instance
[ { "docid": "51c07bb218f5fc2d2f9b30a49fa6c653", "score": "0.6724117", "text": "func NewMockAccountRetriever(ctrl *gomock.Controller) *MockAccountRetriever {\n\tmock := &MockAccountRetriever{ctrl: ctrl}\n\tmock.recorder = &MockAccountRetrieverMockRecorder{mock}\n\treturn mock\n}", "title": "" } ]
[ { "docid": "6cde3cf80a01803e5390efdda815b13d", "score": "0.602908", "text": "func NewRetriever(t mockConstructorTestingTNewRetriever) *Retriever {\n\tmock := &Retriever{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "d326f61cde4227d4c8020a8be09b5584", "score": "0.597334", "text": "func MockAccount(ctx context.Context, dbConn *sqlx.DB, now time.Time) (*Account, error) {\n\ts := AccountStatus_Active\n\n\trepo := &Repository{\n\t\tDbConn: dbConn,\n\t}\n\n\treq := AccountCreateRequest{\n\t\tName: uuid.NewRandom().String(),\n\t\tAddress1: \"103 East Main St\",\n\t\tAddress2: \"Unit 546\",\n\t\tCity: \"Valdez\",\n\t\tRegion: \"AK\",\n\t\tCountry: \"USA\",\n\t\tZipcode: \"99686\",\n\t\tStatus: &s,\n\t}\n\treturn repo.Create(ctx, auth.Claims{}, req, now)\n}", "title": "" }, { "docid": "15c952bae45e4890819b5582e61647da", "score": "0.5961784", "text": "func NewMockClients() *MockClients {\n return &MockClients{\n SavedCreateSnapshots: make(map[string]cs.Snapshot),\n }\n}", "title": "" }, { "docid": "9450737ee6db046a04b0edd4d73f591b", "score": "0.5921955", "text": "func newMockUser(accountID string, role user_account.UserAccountRole) mockUser {\n\treq := mockUserCreateRequest()\n\tu, err := appCtx.UserRepo.Create(tests.Context(), auth.Claims{}, req, time.Now().UTC().AddDate(-1, -1, -1))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\t_, err = appCtx.UserAccountRepo.Create(tests.Context(), auth.Claims{}, user_account.UserAccountCreateRequest{\n\t\tUserID: u.ID,\n\t\tAccountID: accountID,\n\t\tRoles: []user_account.UserAccountRole{role},\n\t}, time.Now().UTC().AddDate(-1, -1, -1))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn mockUser{\n\t\tUser: u,\n\t\tpassword: req.Password,\n\t}\n}", "title": "" }, { "docid": "7d5bc319feba9343d40b3e71a023d68c", "score": "0.57451195", "text": "func newAccountService(sling *sling.Sling, uriTemplate string) *accountService {\n\taccountService := &accountService{}\n\taccountService.service = newService(ServiceAccountService, sling, uriTemplate)\n\n\treturn accountService\n}", "title": "" }, { "docid": "fd0bb090a75527b068fdfde905bd3f73", "score": "0.5682198", "text": "func newMockClient(wocClient whatsOnChainInterface, paprikaClient coinPaprikaInterface, preevClient preevInterface, providers ...Provider) *Client {\r\n\tclient := NewClient(nil, nil, providers...)\r\n\tclient.WhatsOnChain = wocClient\r\n\tclient.CoinPaprika = paprikaClient\r\n\tclient.Preev = preevClient\r\n\treturn client\r\n}", "title": "" }, { "docid": "5a2d41b2546a9c31384d9d62d90382ba", "score": "0.56654465", "text": "func newMockMandrillClient() mandrillInterface {\n\treturn &mockMandrillInterface{}\n}", "title": "" }, { "docid": "6ea064f8b849e72b1b9dd729c60868b8", "score": "0.5533354", "text": "func NewMock(timeout time.Duration) APIClient {\n\treturn &mockClient{\n\t\tentries: make(map[cipher.PubKey]Entry),\n\t\ttimeout: timeout,\n\t}\n}", "title": "" }, { "docid": "6bf7754d8a645430431b9a81d6144b32", "score": "0.5507368", "text": "func NewMock(t *testing.T) (*Mock, context.Context) {\n\tf, ctx := rpc.NewFixture(context.Background(), t)\n\n\treturn &Mock{\n\t\tt: t,\n\t\trpcFixture: f,\n\t}, ctx\n}", "title": "" }, { "docid": "641f3bd3dec277afbf9fa830ffb493bf", "score": "0.5496824", "text": "func newMockService() *genericMockRoundTripper {\n\treturn &genericMockRoundTripper{\n\t\tmockResponses: map[*mux.Route]interface{}{\n\t\t\ttransport.NewRouter().Get(\"PostRelease\"): transport.PostReleaseResponse{\n\t\t\t\tStatus: \"ok\",\n\t\t\t\tReleaseID: \"1\",\n\t\t\t},\n\t\t\ttransport.NewRouter().Get(\"GetRelease\"): jobs.Job{\n\t\t\t\tDone: true,\n\t\t\t\tID: \"1\",\n\t\t\t\tParams: jobs.ReleaseJobParams{\n\t\t\t\t\tReleaseSpec: flux.ReleaseSpec{\n\t\t\t\t\t\tKind: \"test\",\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tMethod: jobs.ReleaseJob,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "a24c79eebdc8bf8d529d9706808b22c0", "score": "0.54822874", "text": "func NewMock(t testing.TB) *Mock {\n\treturn NewMockAt(t, time.Now())\n}", "title": "" }, { "docid": "d1ea8e343e3387b82cf4d5a6867e6458", "score": "0.5433122", "text": "func newMockHttpProvider(t mockConstructorTestingTnewMockHttpProvider) *mockHttpProvider {\n\tmock := &mockHttpProvider{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "29f017894111ff9bb512c4df3064284c", "score": "0.5428741", "text": "func new(m map[string]interface{}) (*manager, error) {\n\tmgr := &manager{}\n\terr := mgr.Configure(m)\n\tif err != nil {\n\t\terr = errors.Wrap(err, \"error creating a new auth manager\")\n\t\treturn nil, err\n\t}\n\n\tmgr.db, err = accounts.New(\"unused\", nil, false, false, false)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn mgr, nil\n}", "title": "" }, { "docid": "9eeff5369d62eb2d0e4be802ffd68ed2", "score": "0.54143894", "text": "func (f *AuthFetcher) newAccount(blockNum uint64, name string, key *prototype.PublicKeyType) {\n\t// cache the key of newly created account\n\t_ = f.cache.Set([]byte(name), key.GetData(), 0)\n\t// remember the change\n\tf.changes[blockNum] = append(f.changes[blockNum], name)\n}", "title": "" }, { "docid": "30da4239e2d295baaf03002ed71fda8c", "score": "0.5413628", "text": "func newAccount() *Account {\n\taccount := &Account{}\n\taccount.NativeBalance = Balance{NativeAsset, \"0\", \"\"}\n\taccount.Signers = []Signer{\n\t\tSigner{},\n\t}\n\n\treturn account\n}", "title": "" }, { "docid": "3853269e4a41659ab776b7e3866e0c57", "score": "0.53688985", "text": "func New(enable bool) *Mocker {\n\treturn &Mocker{\n\t\tenable: enable,\n\t}\n}", "title": "" }, { "docid": "7e635023d0b88699108f01768e099c5b", "score": "0.5351062", "text": "func (c Client) New(params *stripe.AccountParams) (*stripe.Account, error) {\n\tacct := &stripe.Account{}\n\terr := c.B.Call(http.MethodPost, \"/v1/accounts\", c.Key, params, acct)\n\treturn acct, err\n}", "title": "" }, { "docid": "9cb499ed9b80b2c1080a9d72e7512837", "score": "0.5285848", "text": "func New(email string, priv *rsa.PrivateKey, scopes []string, opts ...Option) *Stubbs {\n\ts := &Stubbs{\n\t\tclientEmail: email,\n\t\tprivateKey: priv,\n\t\tscopes: scopes,\n\t\tlifetime: 3600,\n\t\tsafeRefresh: 10,\n\t}\n\n\tfor _, opt := range opts {\n\t\topt(s)\n\t}\n\n\treturn s\n}", "title": "" }, { "docid": "249a72dd2236771ce862125fcabec8a7", "score": "0.5283578", "text": "func fakeAccount() *account.Account {\n\treturn &account.Account{\n\t\tAccountId: randomdata.RandStringRunes(32),\n\t\tNationalId: fmt.Sprintf(\"%d\", randomdata.Number(2000000, 40000000)),\n\t\tEmail: randomdata.Email(),\n\t\tPhone: randomdata.PhoneNumber()[:10],\n\t\tFirstName: randomdata.FirstName(randomdata.Male),\n\t\tLastName: randomdata.LastName(),\n\t\tBirthDate: randomdata.FullDate(),\n\t\tGender: \"male\",\n\t\tNationality: randomdata.Country(randomdata.FullCountry),\n\t\tProfileUrlThumb: randomdata.MacAddress(),\n\t\tProfileUrlNormal: randomdata.MacAddress(),\n\t\tAccountState: account.AccountState_ACTIVE,\n\t\tAccountType: account.AccountType_USER_OWNER,\n\t\tTrustedDevices: []string{\n\t\t\trandomdata.MacAddress(), randomdata.MacAddress(), randomdata.MacAddress(),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "b2d4abd0541fd9df08ffab4690e75269", "score": "0.52831346", "text": "func NewMock(address string) Connection {\n\tclient := NewMockClient(errorRate)\n\n\tb := &Mock{\n\t\taddress: address,\n\t\tClient: client,\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "ceac9f4ff5be8e09a811fcfd5850e1d0", "score": "0.5275453", "text": "func newMockBackoffCalculator(t mockConstructorTestingTnewMockBackoffCalculator) *mockBackoffCalculator {\n\tmock := &mockBackoffCalculator{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4bed944eb76021bc3586631f6feaef42", "score": "0.5267889", "text": "func NewMockAccountUpdater(ctrl *gomock.Controller) *MockAccountUpdater {\n\tmock := &MockAccountUpdater{ctrl: ctrl}\n\tmock.recorder = &MockAccountUpdaterMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "87b754286cd05abc273f3e92b6ccc7ff", "score": "0.5251124", "text": "func NewMock() MockSecret {\n\treturn MockSecret{}\n}", "title": "" }, { "docid": "dc6ab22bdef6191a7ea0745f7309babe", "score": "0.52338594", "text": "func NewMock(votes service.Vote) Controller {\n\treturn Mock{votes: votes}\n}", "title": "" }, { "docid": "203118f2f6332f1d24c0d41bd2cec790", "score": "0.5201127", "text": "func NewMockStub(name string, cc shim.Chaincode) *MockStub {\n\treturn &MockStub{\n\t\tMockStub: *shimtest.NewMockStub(name, cc),\n\t\tcc: cc,\n\t\t// by default tx creator data and transient map are cleared after each cc method query/invoke\n\t\tClearCreatorAfterInvoke: true,\n\t\tInvokables: make(map[string]*MockStub),\n\t\tPrivateKeys: make(map[string]*list.List),\n\t}\n}", "title": "" }, { "docid": "7f0240c1428037e159b5c92473c7d077", "score": "0.5155347", "text": "func NewTestAccount() *recurly.Account {\n\tts := MustParseTime(\"2011-10-25T12:00:00Z\")\n\treturn &recurly.Account{\n\t\tXMLName: xml.Name{Local: \"account\"},\n\t\tCode: \"1\",\n\t\tState: \"active\",\n\t\tEmail: \"verena@example.com\",\n\t\tFirstName: \"Verena\",\n\t\tLastName: \"Example\",\n\t\tTaxExempt: recurly.NewBool(false),\n\t\tBillingInfo: NewTestBillingInfo(),\n\t\tAddress: &recurly.Address{\n\t\t\tXMLName: xml.Name{Local: \"address\"},\n\t\t\tAddress: \"123 Main St.\",\n\t\t\tCity: \"San Francisco\",\n\t\t\tState: \"CA\",\n\t\t\tZip: \"94105\",\n\t\t\tCountry: \"US\",\n\t\t},\n\t\tShippingAddresses: &[]recurly.ShippingAddress{\n\t\t\t*NewTestShippingAddress(),\n\t\t},\n\t\tCustomFields: &recurly.CustomFields{\n\t\t\t\"device_id\": \"KIWTL-WER-ZXMRD\",\n\t\t},\n\t\tHostedLoginToken: \"a92468579e9c4231a6c0031c4716c01d\",\n\t\tCreatedAt: recurly.NewTime(ts),\n\t\tHasLiveSubscription: recurly.NewBool(true),\n\t\tHasActiveSubscription: recurly.NewBool(true),\n\t\tHasFutureSubscription: recurly.NewBool(false),\n\t\tHasCanceledSubscription: recurly.NewBool(false),\n\t\tHasPastDueInvoice: recurly.NewBool(false),\n\t}\n}", "title": "" }, { "docid": "fc547ee9f2299acbe9e3e1096344d319", "score": "0.5154645", "text": "func New(customLogger *log.Logger, customLogger2 logger.CustomLogger, config *Config) Account {\n\treturn &account{\n\t\tcustomLogger,\n\t\tcustomLogger2,\n\t\tconfig,\n\t}\n}", "title": "" }, { "docid": "f48f5448597bad700c7da84a0e91798a", "score": "0.51513076", "text": "func newCreaterFunc(t mockConstructorTestingTnewCreaterFunc) *createrFunc {\n\tmock := &createrFunc{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "11d48b1a6627bbfee507c7d7d44bd18b", "score": "0.51174104", "text": "func newRemoteWallet(scheme string, server SigningServer, makeDriver func(SigningServer) driver) (*RemoteWallet, error) {\n\tremoteWallet := &RemoteWallet{\n\t\tscheme: scheme,\n\t\tsigningServer: server,\n\t\tmakeDriver: makeDriver,\n\t\tquit: make(chan chan error),\n log: server.log,\n\t}\n fmt.Printf(\"RemoteWallet %v\\n\", remoteWallet)\n\tremoteWallet.refreshWallets()\n\treturn remoteWallet, nil\n}", "title": "" }, { "docid": "3f4db6a116a04e264b4cc4fd8e9e94f2", "score": "0.51173705", "text": "func newMockJobserviceClient(t mockConstructorTestingTnewMockJobserviceClient) *mockJobserviceClient {\n\tmock := &mockJobserviceClient{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "d3c7bfb20a1aebf0e06374cbc53041e1", "score": "0.5117215", "text": "func new(\n\trunnercfg *cfg.RunnerConfig,\n\tworkerManagerClientFactory tc.WorkerManagerClientFactory,\n\tmetadataService MetadataService) (*AzureProvider, error) {\n\n\tif workerManagerClientFactory == nil {\n\t\tworkerManagerClientFactory = clientFactory\n\t}\n\n\tif metadataService == nil {\n\t\tmetadataService = &realMetadataService{}\n\t}\n\n\t// While it's tempting to check for termination here, as is done for the AWS provider, it\n\t// will cause worker startup to be delayed by several minutes because the scheduled-events\n\t// metadata API endpoint takes that long to \"start up\" on its first call.\n\treturn &AzureProvider{\n\t\trunnercfg: runnercfg,\n\t\tworkerManagerClientFactory: workerManagerClientFactory,\n\t\tmetadataService: metadataService,\n\t\tproto: nil,\n\t}, nil\n}", "title": "" }, { "docid": "d6a2a32ce251762d52a8293e68643224", "score": "0.51119184", "text": "func newMockPullLogger(t mockConstructorTestingTnewMockPullLogger) *mockPullLogger {\n\tmock := &mockPullLogger{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "c6f1a6560d459b4192f2623150778ea5", "score": "0.5099535", "text": "func NewTestingTMock() *TestingTMock { return &TestingTMock{} }", "title": "" }, { "docid": "90635246876703e715220867c672434e", "score": "0.50979334", "text": "func NewAccount(inter TurretInterface) *Account {\n\ta := &Account{inter}\n\treturn a\n}", "title": "" }, { "docid": "e9af039cbea417a3f702954e77606b0f", "score": "0.5085674", "text": "func (_Initialize *InitializeTransactor) NewAccount(opts *bind.TransactOpts, accountId *big.Int) (*types.Transaction, error) {\n\treturn _Initialize.contract.Transact(opts, \"newAccount\", accountId)\n}", "title": "" }, { "docid": "2002074ebf724cf25c5f516374954120", "score": "0.5073645", "text": "func newMockCache(t mockConstructorTestingTnewMockCache) *mockCache {\n\tmock := &mockCache{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "87ebb737133ff91e4b4b4fb1f2ed5bf4", "score": "0.50670415", "text": "func TestGetAccount(t *testing.T) {\n\t// create mock data\n\tmockDB := &dbClients.MockBoltClient{} // create mock instance of the InterfaceBoltClient\n\n\tmockDB.On(\"QueryAccount\", \"123\").Return(m.Account{ // create mock data retrieval behaviour for an existing accountID \"123\"\n\t\tID: \"123\",\n\t\tName: \"Person_123\",\n\t}, nil)\n\n\tmockDB.On(\"QueryAccount\", \"419\").Return(m.Account{ // create mock data retrieval behaviour for a non-existing accountID \"419\"\n\t}, fmt.Errorf(\"Some error\"))\n\n\t// assign the mocked DB interface \"mockRepo\" to the DBClient (previously declared in handler.go)\n\tDBClient = mockDB\n\n\t// test with the mock data\n\tConvey(\"Given a HTTP request for /accounts/123\", t, func() { // test correct account ID\n\t\treq := httptest.NewRequest(\"GET\", \"/accounts/123\", nil)\n\t\tresp := httptest.NewRecorder()\n\n\t\tConvey(\"When the request is handled by the Router\", func() {\n\t\t\tNewRouter().ServeHTTP(resp, req)\n\n\t\t\tConvey(\"Then the response should be a 200\", func() {\n\t\t\t\tSo(resp.Code, ShouldEqual, 200) // test to see that response was correct and appropriate\n\n\t\t\t\taccount := m.Account{} // start using the mock data\n\t\t\t\tjson.Unmarshal(resp.Body.Bytes(), &account)\n\t\t\t\tSo(account.ID, ShouldEqual, \"123\")\n\t\t\t\tSo(account.Name, ShouldEqual, \"Person_123\")\n\t\t\t})\n\t\t})\n\t})\n\n\tConvey(\"Given a HTTP request for /accounts/419\", t, func() { // test wrong account ID\n\t\treq := httptest.NewRequest(\"GET\", \"/accounts/419\", nil)\n\t\tresp := httptest.NewRecorder()\n\n\t\tConvey(\"When the request is handled by the Router\", func() {\n\t\t\tNewRouter().ServeHTTP(resp, req)\n\n\t\t\tConvey(\"Then the response should be a 404\", func() {\n\t\t\t\tSo(resp.Code, ShouldEqual, 404)\n\t\t\t})\n\t\t})\n\t})\n}", "title": "" }, { "docid": "ae61f2eee3119f68987cbc8d23986e4d", "score": "0.50541735", "text": "func NewAccount(config *cfg.Config) *AccountBase {\n\t// if len(config.KeyWordsFile) > 0 {\n\t// \tlog.Info(\"NewAccount from config.KeyWordsFile\", \"config.KeyWordsFile\", config.KeyWordsFile)\n\t// \tkeyswordsStr, err := ioutil.ReadFile(config.KeyWordsFile)\n\t// \tif err != nil {\n\t// \t\tpanic(err)\n\t// \t}\n\t// \tkeyswords := strings.Split(strings.TrimSpace(string(keyswordsStr)), \"\\n\")\n\n\t// \tlog.Warn(\"NewAccount\", \"keyswords\", keyswords[0])\n\n\t// \tk, err := WordsToAccount(keyswords[0])\n\t// \tif err != nil {\n\t// \t\tpanic(err)\n\t// \t}\n\t// \t// FOR test\n\n\t// \tlog.Warn(\"NewAccount success\", \"UTXO Address\", k.GetKeys().Address)\n\t// \treturn k\n\t// }\n\n\tif len(config.KeystoreFile) > 0 {\n\t\tlog.Info(\"NewAccount from config.KeystoreFile\", \"config.KeystoreFile\", config.KeystoreFile)\n\t\tkeyjson, err := ioutil.ReadFile(config.KeystoreFile)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tvar keyAddr keyStroe\n\t\tif err = json.Unmarshal(keyjson, &keyAddr); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tpwd := config.Password\n\t\tif len(config.PasswordFile) > 0 {\n\t\t\tp, err := ioutil.ReadFile(config.KeystoreFile)\n\t\t\tif err != nil {\n\t\t\t\tpanic(err)\n\t\t\t}\n\n\t\t\tpwd = string(p)\n\t\t}\n\n\t\tlog.Debug(\"NewAccount from config.WalletFile\", \"password\", pwd)\n\n\t\trk, err := KeyFromAccount(keyjson, pwd)\n\t\tif err != nil {\n\t\t\tlog.Error(\"NewAccount KeyFromAccount\", \"err\", err)\n\t\t\tpanic(err)\n\t\t}\n\t\tk, err := RecoveryKeyToAccount(rk)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tk.EthAddress = common.HexToAddress(keyAddr.Address)\n\t\tlog.Warn(\"NewAccount success\", \"UTXO Address\", k.GetKeys().Address, \"EthAddress\", k.EthAddress)\n\t\treturn k\n\t}\n\tpanic(\"not surport init account ways!!!\")\n}", "title": "" }, { "docid": "553149f2571ddb63ffa1c1b53685c850", "score": "0.5037257", "text": "func NewAccount(f *frontend) (a *account) {\n\ta = &account{frontend: f, permission: 1}\n\ta.explainAccountDisplay()\n\treturn\n}", "title": "" }, { "docid": "6f7184b801f5de394b886a267b1001a6", "score": "0.503607", "text": "func NewWalletCallback(t mockConstructorTestingTNewWalletCallback) *WalletCallback {\n\tmock := &WalletCallback{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "c1a8910fb6104748cad3b487b05ca63a", "score": "0.50337946", "text": "func (m *MockAccountRetriever) EXPECT() *MockAccountRetrieverMockRecorder {\n\treturn m.recorder\n}", "title": "" }, { "docid": "4475e506bbe4d3c9d19f503de38801e9", "score": "0.5032206", "text": "func newMockConn(address, scheme, username, password string, config *Config) mcConn {\n\tid_mod := strings.Split(strings.Split(address, \":\")[0], \"-\")\n\tid := id_mod[0]\n\tmod := 1\n\tif len(id_mod) > 1 {\n\t\tvar err error\n\t\tmod, err = strconv.Atoi(id_mod[1])\n\t\tif err != nil {\n\t\t\tmod = 1\n\t\t}\n\t}\n\n\tmockConn := &mockConn{\n\t\tserverId: id,\n\t\tsuccessMod: mod,\n\t}\n\treturn mockConn\n}", "title": "" }, { "docid": "a44c86f973f67933b7242a3067960fd6", "score": "0.5031071", "text": "func New(basePath string, opts ...Option) *Mocker {\n\tm := &Mocker{\n\t\tbasePath,\n\t\t&http.Client{},\n\t}\n\tfor _, opt := range opts {\n\t\topt(m)\n\t}\n\treturn m\n}", "title": "" }, { "docid": "7e81277668dad0575986bb725d4da691", "score": "0.5025484", "text": "func NewMock(name string) *Mock {\n\tm := &Mock{\n\t\tname: name,\n\t\talert: &AlertMock{},\n\t\tkv: &KVMock{},\n\t}\n\n\treturn m\n}", "title": "" }, { "docid": "ad1c5bea4856182926f417f7c49b3a85", "score": "0.4990827", "text": "func NewMock() *Mock {\n\treturn &Mock{}\n}", "title": "" }, { "docid": "913c0e2357a942c6fb67a4ce789a5138", "score": "0.4985634", "text": "func NewMock() UserRepo {\n\treturn &userRepoMock{\n\t\tusers: make(map[int]model.User),\n\t}\n}", "title": "" }, { "docid": "11222eb1585b17f9db9d1bb9db3f781f", "score": "0.4985039", "text": "func NewMockAccountServer(ctrl *gomock.Controller) *MockAccountServer {\n\tmock := &MockAccountServer{ctrl: ctrl}\n\tmock.recorder = &MockAccountServerMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "4a58fa764bded58be5615cf45d480d1a", "score": "0.49795687", "text": "func New() Mock {\n\treturn &mock{store: []Message{}}\n}", "title": "" }, { "docid": "e2aad67c6ba52dcb837502750b6a818b", "score": "0.49588957", "text": "func NewMockTokenCreator(t mockConstructorTestingTNewMockTokenCreator) *MockTokenCreator {\n\tmock := &MockTokenCreator{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "5f21dc1343fa487ef1bd91b8e710de89", "score": "0.49483317", "text": "func NewMock() *Mock {\n\treturn &Mock{now: time.Unix(0, 0)}\n}", "title": "" }, { "docid": "b534fc59335ea0030ffba15f1b399124", "score": "0.49474484", "text": "func NewMockObject(ctrl *gomock.Controller) *MockObject {\n\tmock := &MockObject{ctrl: ctrl}\n\tmock.recorder = &MockObjectMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "45d5cedf5413b4453fe94eba7ee27272", "score": "0.49285358", "text": "func NewMock(params ...interface{}) Mock {\n\tmatches := []MatchRule{}\n\tresponse := []ResponseBuilder{}\n\n\tfor _, param := range params {\n\t\tif m, ok := param.(MatchRule); ok {\n\t\t\tmatches = append(matches, m)\n\t\t} else if r, ok := param.(ResponseBuilder); ok {\n\t\t\tresponse = append(response, r)\n\t\t}\n\t}\n\n\treturn Mock{\n\t\tMatches: matches,\n\t\tResponse: response,\n\t}\n}", "title": "" }, { "docid": "ae85eb8a849f544b1e04f650f8fa1df3", "score": "0.49068806", "text": "func NewMock(vals map[string]string, valslice map[string][]string) Backend {\n return mockBackend{\n vals: vals,\n valslice: valslice,\n }\n}", "title": "" }, { "docid": "509188f7876d7cc08c74b2a894071295", "score": "0.49022225", "text": "func (m *MockAccountKeeper) NewAccount(arg0 types.Context, arg1 types0.AccountI) types0.AccountI {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"NewAccount\", arg0, arg1)\n\tret0, _ := ret[0].(types0.AccountI)\n\treturn ret0\n}", "title": "" }, { "docid": "a29236bafe8c135e9b826e92441a5e3f", "score": "0.48958078", "text": "func New() (*Mock, error) {\n\tstubHost := relaytest.NewStubRelayHost()\n\tch, err := tchannel.NewChannel(\"hyperbahn\", &tchannel.ChannelOptions{\n\t\tRelayHost: stubHost,\n\t\tRelayLocalHandlers: []string{\"hyperbahn\"},\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmh := &Mock{\n\t\tch: ch,\n\t\trespCh: make(chan int),\n\t\tdiscoverResults: make(map[string][]string),\n\t}\n\tif err := json.Register(ch, json.Handlers{\"ad\": mh.adHandler}, nil); err != nil {\n\t\treturn nil, err\n\t}\n\n\tthriftServer := thrift.NewServer(ch)\n\tthriftServer.Register(hthrift.NewTChanHyperbahnServer(mh))\n\n\treturn mh, ch.ListenAndServe(\"127.0.0.1:0\")\n}", "title": "" }, { "docid": "6895d85ee7d899fd0846ad388123f54a", "score": "0.48952156", "text": "func (g *Grpc) NewAccount(ctx context.Context, in *pb.ReqNewAccount) (*pb.WalletAccount, error) {\r\n\treturn g.cli.NewAccount(in)\r\n}", "title": "" }, { "docid": "c4546855054f80e0b6c957e3ba55bcdf", "score": "0.48865816", "text": "func New(params *stripe.AccountParams) (*stripe.Account, error) {\n\treturn getC().New(params)\n}", "title": "" }, { "docid": "5e4a23cb41f7630afafe1b16a048be19", "score": "0.4883238", "text": "func New(\n\tlogger lager.Logger,\n\taddress string,\n\tauthenticator Authenticator,\n\tcache Cache,\n) task.Repo {\n\treturn &client{\n\t\tlogger: logger,\n\t\taddress: address,\n\t\tauthenticator: authenticator,\n\t\ttokenCache: cache,\n\t}\n}", "title": "" }, { "docid": "70431d26d8b67ef2838a56da5e9cfc58", "score": "0.48831874", "text": "func newReconciler(mgr manager.Manager) reconcile.Reconciler {\n\treturn &ReconcileAccount{\n\t\tClient: mgr.GetClient(),\n\t\tscheme: mgr.GetScheme(),\n\t\tawsClientBuilder: awsclient.NewClient,\n\t}\n}", "title": "" }, { "docid": "857cf64d69640f846d36ea0e2b0624d3", "score": "0.4875041", "text": "func fakePrivateAccount() *account.PrivateAccount {\n\treturn &account.PrivateAccount{\n\t\tPassword: \"hakty11\",\n\t\tConfirmPassword: \"hakty11\",\n\t\tSecurityQuestion: \"What is your pets name\",\n\t\tSecurityAnswer: randomdata.SillyName(),\n\t}\n}", "title": "" }, { "docid": "4a7f9feba22297b5c5d0a15d60038346", "score": "0.4870698", "text": "func newMock_BIPSAP(t interface {\n\tmock.TestingT\n\tCleanup(func())\n}) *mock_BIPSAP {\n\tmock := &mock_BIPSAP{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "c388d3576cc48f042b8502d0c8859ef1", "score": "0.4870435", "text": "func createMockQuota() Quota {\n\tmockQuota := Quota{\n\t\tQuotaLineItems: map[string]QuotaStatusLineItem{\n\t\t\t\"vmCpu\": {Unit: \"COUNT\", Limit: 100, Usage: 0},\n\t\t\t\"vmMemory\": {Unit: \"GB\", Limit: 180, Usage: 0},\n\t\t\t\"diskCapacity\": {Unit: \"GB\", Limit: 1000, Usage: 0},\n\t\t},\n\t}\n\treturn mockQuota\n}", "title": "" }, { "docid": "94806055ef5ecf139aa8d990ee0351be", "score": "0.4870414", "text": "func initializeAccountDetails(){\n ainfo := accountInfo{\"sujan\",3000,\"Saving\",\"123456789\"}\n accountInfoMap[\"123456789\"] = ainfo;\n ainfo2 := accountInfo{\"Abhinav\",5000,\"current\",\"123451234\"}\n accountInfoMap[\"123451234\"] = ainfo2;\n isNewServerFailDurExt = false\n lifetime =1\n}", "title": "" }, { "docid": "2bb03eb37de9400c706535c9f6ef69d9", "score": "0.48661473", "text": "func newMockILogPool(t testing.TB) *mockILogPool {\n\tmock := &mockILogPool{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "083b1a10e3fdfb31e1dc258f0293d950", "score": "0.48598176", "text": "func New(baseURL, apiKey, appID, merchantID string) *Client {\n random := time.Now().Format(\"20060102150405\")\n\n c := &Client{\n BaseURL: baseURL,\n APIKey: apiKey,\n AppID: appID,\n MerchantID: merchantID,\n Random: random,\n }\n\n c.setAuthorizationKey()\n\n return c\n\n}", "title": "" }, { "docid": "9efabc8a0f1a0edd279f16b7e62a1f51", "score": "0.4859075", "text": "func (m *MockPasskeyIdentityProvider) New(userID string, attestationResponse []byte) (*identity.Passkey, error) {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"New\", userID, attestationResponse)\n\tret0, _ := ret[0].(*identity.Passkey)\n\tret1, _ := ret[1].(error)\n\treturn ret0, ret1\n}", "title": "" }, { "docid": "81e916d42c1599942fc125614cb35dff", "score": "0.48545393", "text": "func NewMockAt(t testing.TB, now time.Time) *Mock {\n\tm := &Mock{\n\t\tMock: clock.NewMock(),\n\t\tt: t,\n\t\ttimerC: make(chan time.Duration, 1),\n\t\tafterC: make(chan time.Duration, 1),\n\t\ttickerC: make(chan time.Duration, 1),\n\t\tsleepC: make(chan time.Duration, 1),\n\t}\n\n\t// TLS verification is being done using a realtime clock so we set the mock clock to\n\t// the current time, truncated to a second which is the granularity available to asn1.\n\t// This ensures that when tests create a certificate with a lifetime of 3 seconds, it\n\t// is exactly 3 seconds (relative to the mock clock).\n\t//\n\t// TODO: plumb the clock into the TLS configs. (Clock).Now should be passed to \"crypto/tls\".(Config).Time\n\t// and then this can be removed as a clock could be use with a zero value at that point.\n\tm.Set(now.Truncate(time.Second))\n\treturn m\n}", "title": "" }, { "docid": "159cb4b2dcb224cd9aaa03301a0a4ce1", "score": "0.48541862", "text": "func NewMMR(t NewMMRT) *MMR {\n\tmock := &MMR{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "c7ebebe3a7c5465b8bfcef6e00297493", "score": "0.48339257", "text": "func NEW(_repo repository.IUserRepository) *CreateAccountServices {\n\treturn &CreateAccountServices{userRepo: _repo}\n}", "title": "" }, { "docid": "62dc19c0709993ed87c35000551e7454", "score": "0.48298314", "text": "func NewTenantFetcher(t mockConstructorTestingTNewTenantFetcher) *TenantFetcher {\n\tmock := &TenantFetcher{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4ec8b1c351046a8f2b428c31f83a1570", "score": "0.48245883", "text": "func NewForTest(restConfig *rest.Config) (meta.RESTMapper, error) {\n\tclient, err := rest.HTTPClientFor(restConfig)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error from rest.HTTPClientFor: %w\", err)\n\t}\n\treturn NewControllerRESTMapper(restConfig, client)\n}", "title": "" }, { "docid": "88499e17262d2326dd902420ff8a08dd", "score": "0.48180294", "text": "func New(client *http.Client) (*Service, error) {\n\tif client == nil {\n\t\treturn nil, errors.New(\"client is nil\")\n\t}\n\ts := &Service{client: client, BasePath: basePath}\n\ts.BillingAccounts = NewBillingAccountsService(s)\n\treturn s, nil\n}", "title": "" }, { "docid": "617209693245ab3680d0e764b6877190", "score": "0.48104355", "text": "func New(namespace, serviceAccount string, conf *rest.Config) (*Driver, error) {\n\tdriver := &Driver{\n\t\tNamespace: namespace,\n\t\tServiceAccountName: serviceAccount,\n\t}\n\tdriver.setDefaults()\n\terr := driver.setClient(conf)\n\treturn driver, err\n}", "title": "" }, { "docid": "c5e2feff4be4054ec9e3a78747edb14b", "score": "0.48068705", "text": "func NewSubscription(t mockConstructorTestingTNewSubscription) *Subscription {\n\tmock := &Subscription{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "d3ba2533ff610a0cd4ee785eeca915d1", "score": "0.4805383", "text": "func (c *Customer) createStub(port int) error {\r\n\ttarget := fmt.Sprintf(\"localhost:%d\", port)\r\n\r\n\tconn, err := grpc.Dial(target, grpc.WithInsecure())\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\tclient := NewBankClient(conn)\r\n\r\n\t// save stub\r\n\tc.Stub = client\r\n\t// also save connection to close at shutdown\r\n\tc.conn = conn\r\n\treturn nil\r\n}", "title": "" }, { "docid": "9bac14c66935d2eca1aadc2f96e9a677", "score": "0.4797544", "text": "func (_m *MockRepo) Create(account entity.Bill) (*entity.Bill, error) {\n\tret := _m.Called(account)\n\n\tvar r0 *entity.Bill\n\tif rf, ok := ret.Get(0).(func(entity.Bill) *entity.Bill); ok {\n\t\tr0 = rf(account)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(*entity.Bill)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(entity.Bill) error); ok {\n\t\tr1 = rf(account)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "42f16edef9cd4232076587e98b3031f6", "score": "0.47939476", "text": "func (v *Verification) Create(username, referrer, region string) (account *Account, err error) {\n\ttype Data struct {\n\t\tCountry string `json:\"country\"`\n\t\tLanguage string `json:\"language\"`\n\t\tReferringUsername string `json:\"referringUsername\"`\n\t\tUsername string `json:\"username\"`\n\t\tVerificationID string `json:\"verificationId\"`\n\t}\n\n\ta := Account{}\n\tresp, err := a.Request(\"POST\", EndpointVerifications+v.VerificationID, Data{Country: region, VerificationID: v.VerificationID, Username: username, Language: \"en\", ReferringUsername: referrer}, false)\n\n\tif err != nil {\n\t\treturn\n\t}\n\n\terr = json.Unmarshal(resp, &account)\n\treturn\n}", "title": "" }, { "docid": "1320d1f51353f0f9941d570ae1d70fb0", "score": "0.4787309", "text": "func createMockHPOTrainingJobSpawnerProvider(spawner HPOTrainingJobSpawner) HPOTrainingJobSpawnerProvider {\n\treturn func(_ client.Client, _ logr.Logger, _ clientwrapper.SageMakerClientWrapper) HPOTrainingJobSpawner {\n\t\treturn spawner\n\t}\n}", "title": "" }, { "docid": "ba9e009a874d26fce738ca1d061649ab", "score": "0.478636", "text": "func New(baseUrl string, clientId string, clientSecret string, timeout time.Duration) *ammana {\n httpRequest := newRequest(timeout)\n return &ammana{\n ClientID: clientId,\n ClientSecret: clientSecret,\n BaseURL: baseUrl,\n client: httpRequest,\n logger: newLogger(),\n }\n}", "title": "" }, { "docid": "bc49ba19e4215206413457b7b8c95b02", "score": "0.47845155", "text": "func mockBridge(t *testing.T) *serviceTestTools {\n\tstt := new(serviceTestTools)\n\tsrv := httptest.NewServer(http.HandlerFunc(\n\t\tfunc(w http.ResponseWriter, r *http.Request) {\n\t\t\tstt.lastMethod = r.Method\n\t\t\tstt.lastBody = r.Body\n\t\t\tstt.lastPath = r.URL.Path\n\t\t\tif err := json.NewEncoder(w).Encode(stt.nextResponse); err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t},\n\t))\n\tstt.b = &Bridge{\n\t\tbridgeID: bridgeID{ID: \"bridge_id\", IP: srv.URL + \"/\"},\n\t\tusername: \"bridge_username\",\n\t}\n\tstt.srv = srv\n\treturn stt\n}", "title": "" }, { "docid": "1265ba974d978fe7e42e63b52eff75f1", "score": "0.4783638", "text": "func NewAPIClient(t testing.TB) *APIClient {\n\tmock := &APIClient{}\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "acd8cf7dd29e39387098b33272d8445f", "score": "0.47826406", "text": "func NewMockAccountKeeper(ctrl *gomock.Controller) *MockAccountKeeper {\n\tmock := &MockAccountKeeper{ctrl: ctrl}\n\tmock.recorder = &MockAccountKeeperMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "f198e3e50cd9056926ab7aa40a9392d8", "score": "0.47762415", "text": "func NewAccount(number string,\n\tholder string,\n\tbalance float64,\n\taccountType string) *Account {\n\n\tvar acc = Account{number, holder, balance, accountType}\n\treturn &acc\n\n}", "title": "" }, { "docid": "36689db1711b914d5a8d1af93bf482a0", "score": "0.4774987", "text": "func newStubClient(response *http.Response, err error) *dphttp.ClienterMock {\n\treturn &dphttp.ClienterMock{\n\t\tDoFunc: func(_ context.Context, _ *http.Request) (*http.Response, error) {\n\t\t\treturn response, err\n\t\t},\n\t\tSetPathsWithNoRetriesFunc: func(paths []string) {},\n\t\tGetPathsWithNoRetriesFunc: func() []string {\n\t\t\treturn []string{\"/healthcheck\"}\n\t\t},\n\t}\n}", "title": "" }, { "docid": "c80aa4985e21677985762fcc2435609c", "score": "0.47626576", "text": "func NewAccount(ctx context.Context) (*AccountResolver, error) {\n\tuser := ctx.Value(\"user\").(*handler.User)\n\treturn &AccountResolver{user: user}, nil\n}", "title": "" }, { "docid": "677afcd9811b8e14ec80282ac5402330", "score": "0.47597587", "text": "func (c *Chain33) NewAccount(in *types.ReqNewAccount, result *interface{}) error {\n\treply, err := c.cli.ExecWalletFunc(\"wallet\", \"NewAccount\", in)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t*result = reply\n\treturn nil\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "1c9e772a1bb87a1222007b7b59a99155", "score": "0.4759119", "text": "func NewClient(t mockConstructorTestingTNewClient) *Client {\n\tmock := &Client{}\n\tmock.Mock.Test(t)\n\n\tt.Cleanup(func() { mock.AssertExpectations(t) })\n\n\treturn mock\n}", "title": "" }, { "docid": "4aa0e7794d30d2d10901996350185734", "score": "0.47554922", "text": "func TestStuff(t *testing.T) {\n\tgo runMockServer(\":8080\", &proxyAndRecordHandler{\n\t\tHost: \"https://api.continusec.com\",\n\t\tInHeaders: []string{\"Authorization\", \"X-Previous-LeafHash\"},\n\t\tOutHeaders: []string{\"Content-Type\", \"X-Verified-TreeSize\", \"X-Verified-Proof\"},\n\t\tDir: \"testdata\",\n\t\tFailOnMissing: true,\n\t})\n\tlocalClient := DefaultClient.WithBaseUrl(\"http://localhost:8080/v1\")\n\n\tclient := &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"c9fc80d4e19ddbf01a4e6b5277a29e1bffa88fe047af9d0b9b36de536f85c2c6\")}\n\tlog := client.VerifiableLog(\"newtestlog\")\n\t_, err := log.TreeHead(Head)\n\tif err != ErrNotFound {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"wrongcred\")}\n\tlog = client.VerifiableLog(\"newtestlog\")\n\t_, err = log.TreeHead(Head)\n\tif err != ErrNotAuthorized {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"wrongaccount\", Client: localClient.WithApiKey(\"wrongcred\")}\n\tlog = client.VerifiableLog(\"newtestlog\")\n\t_, err = log.TreeHead(Head)\n\tif err != ErrNotFound {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"c9fc80d4e19ddbf01a4e6b5277a29e1bffa88fe047af9d0b9b36de536f85c2c6\")}\n\tlog = client.VerifiableLog(\"newtestlog\")\n\terr = log.Create()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = log.Create()\n\tif err != ErrObjectConflict {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = log.Add(&RawDataEntry{RawBytes: []byte(\"foo\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = log.Add(&JsonEntry{JsonBytes: []byte(\"{\\\"name\\\":\\\"adam\\\",\\\"ssn\\\":123.45}\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = log.Add(&RedactableJsonEntry{JsonBytes: []byte(\"{\\\"name\\\":\\\"adam\\\",\\\"ssn\\\":123.45}\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\taddResp, err := log.Add(&RawDataEntry{RawBytes: []byte(\"foo\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = log.BlockUntilPresent(addResp)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\thead, err := log.TreeHead(Head)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif head.TreeSize != 3 {\n\t\tt.Fatal(head.TreeSize)\n\t}\n\n\tfor i := 0; i < 100; i++ {\n\t\t_, err = log.Add(&RawDataEntry{RawBytes: []byte(fmt.Sprintf(\"foo-%d\", i))})\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\thead103, err := log.VerifiedTreeHead(head, Head)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif head103.TreeSize != 103 {\n\t\tt.Fatal(err)\n\t}\n\n\terr = log.VerifyInclusion(head103, &RawDataEntry{RawBytes: []byte(\"foo27\")})\n\tif err != ErrNotFound {\n\t\tt.Fatal(err)\n\t}\n\n\tinclProof, err := log.InclusionProof(head103.TreeSize, &RawDataEntry{RawBytes: []byte(\"foo-27\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = inclProof.Verify(head103)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = inclProof.Verify(head)\n\tif err != ErrVerificationFailed {\n\t\tt.Fatal(err)\n\t}\n\n\thead50, err := log.TreeHead(50)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcons, err := log.ConsistencyProof(head50.TreeSize, head103.TreeSize)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = cons.Verify(head50, head103)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = cons.Verify(head, head103)\n\tif err != ErrVerificationFailed {\n\t\tt.Fatal(err)\n\t}\n\n\tinclProof, err = log.InclusionProof(10, &RawDataEntry{RawBytes: []byte(\"foo\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\th10, err := log.VerifySuppliedInclusionProof(head103, inclProof)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif h10.TreeSize != 10 {\n\t\tt.Fatal(10)\n\t}\n\n\tctx := context.TODO()\n\n\tcount := 0\n\terr = log.VerifyEntries(ctx, nil, head103, RawDataEntryFactory, func(ctx context.Context, idx int64, entry VerifiableEntry) error {\n\t\t_, err := entry.Data()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount += 1\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif count != 103 {\n\t\tt.Fatal(err)\n\t}\n\n\thead1, err := log.TreeHead(1)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcount = 0\n\terr = log.VerifyEntries(ctx, head1, head103, JsonEntryFactory, func(ctx context.Context, idx int64, entry VerifiableEntry) error {\n\t\t_, err := entry.Data()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount += 1\n\t\treturn nil\n\t})\n\tif err != ErrNotAllEntriesReturned {\n\t\tt.Fatal(err)\n\t}\n\tif count != 0 {\n\t\tt.Fatal(count)\n\t}\n\n\thead3, err := log.TreeHead(3)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tcount = 0\n\terr = log.VerifyEntries(ctx, head1, head3, JsonEntryFactory, func(ctx context.Context, idx int64, entry VerifiableEntry) error {\n\t\t_, err := entry.Data()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount += 1\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif count != 2 {\n\t\tt.Fatal(count)\n\t}\n\n\tcount = 0\n\terr = log.VerifyEntries(ctx, head50, head103, RawDataEntryFactory, func(ctx context.Context, idx int64, entry VerifiableEntry) error {\n\t\t_, err := entry.Data()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tcount += 1\n\t\treturn nil\n\t})\n\tif count != 53 {\n\t\tt.Fatal(count)\n\t}\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = log.VerifyInclusion(head103, &JsonEntry{JsonBytes: []byte(\"{ \\\"ssn\\\": 123.4500 , \\\"name\\\" : \\\"adam\\\"}\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tredEnt, err := log.Entry(2, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdd, err := redEnt.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif strings.Index(string(dd), \"ssn\") >= 0 {\n\t\tt.Fatal(-1)\n\t}\n\n\tif strings.Index(string(dd), \"adam\") < 0 {\n\t\tt.Fatal(-1)\n\t}\n\n\terr = log.VerifyInclusion(head103, redEnt)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"allseeing\")}\n\tlog = client.VerifiableLog(\"newtestlog\")\n\n\tredEnt, err = log.Entry(2, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdd, err = redEnt.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif strings.Index(string(dd), \"123.45\") < 0 {\n\t\tt.Fatal(-1)\n\t}\n\n\tif strings.Index(string(dd), \"adam\") < 0 {\n\t\tt.Fatal(-1)\n\t}\n\n\terr = log.VerifyInclusion(head103, redEnt)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tvmap := client.VerifiableMap(\"nnewtestmap\")\n\t_, err = vmap.TreeHead(Head)\n\tif err != ErrNotFound {\n\t\tt.Fatal(err)\n\t}\n\n\terr = vmap.Create()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = vmap.Create()\n\tif err != ErrObjectConflict {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = vmap.Set([]byte(\"foo\"), &RawDataEntry{RawBytes: []byte(\"foo\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = vmap.Set([]byte(\"fiz\"), &JsonEntry{JsonBytes: []byte(\"{\\\"name\\\":\\\"adam\\\",\\\"ssn\\\":123.45}\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\twaitResp, err := vmap.Set([]byte(\"foz\"), &RedactableJsonEntry{JsonBytes: []byte(\"{\\\"name\\\":\\\"adam\\\",\\\"ssn\\\":123.45}\")})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tfor i := 0; i < 100; i++ {\n\t\t_, err = vmap.Set([]byte(fmt.Sprintf(\"foo%d\", i)), &RawDataEntry{RawBytes: []byte(fmt.Sprintf(\"fooval%d\", i))})\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t_, err = vmap.Delete([]byte(\"foo\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = vmap.Delete([]byte(\"foodddd\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = vmap.Delete([]byte(\"foo27\"))\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmlHead, err := vmap.MutationLog().BlockUntilPresent(waitResp)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif mlHead.TreeSize != 106 {\n\t\tt.Fatal(-2)\n\t}\n\n\tmrHead, err := vmap.BlockUntilSize(mlHead.TreeSize)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif mrHead.MutationLogTreeHead.TreeSize != 106 {\n\t\tt.Fatal(err)\n\t}\n\n\tentryResp, err := vmap.Get([]byte(\"foo\"), mrHead.MutationLogTreeHead.TreeSize, RawDataEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = entryResp.Verify(mrHead)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdd, err = entryResp.Value.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(dd) > 0 {\n\t\tt.Fatal(-10)\n\t}\n\n\tentryResp, err = vmap.Get([]byte(\"foo-29\"), mrHead.MutationLogTreeHead.TreeSize, RawDataEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = entryResp.Verify(mrHead)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdd, err = entryResp.Value.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(dd) > 0 {\n\t\tt.Fatal(-10)\n\t}\n\n\tentryResp, err = vmap.Get([]byte(\"foo29\"), mrHead.MutationLogTreeHead.TreeSize, RawDataEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = entryResp.Verify(mrHead)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdd, err = entryResp.Value.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif string(dd) != \"fooval29\" {\n\t\tt.Fatal(-10)\n\t}\n\n\tmapState106, err := vmap.VerifiedLatestMapState(nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = vmap.VerifiedMapState(mapState106, 0)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tmapState2, err := vmap.VerifiedMapState(mapState106, 2)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif mapState2.TreeSize() != 2 {\n\t\tt.Fatal(2)\n\t}\n\n\tval, err := vmap.VerifiedGet([]byte(\"foo\"), mapState2, RawDataEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tdd, err = val.Data()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif string(dd) != \"foo\" {\n\t\tt.Fatal(3)\n\t}\n\n\tlogList, err := client.ListLogs()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(logList) != 24 {\n\t\tt.Fatal(logList)\n\t}\n\n\tmapList, err := client.ListMaps()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(mapList) != 15 {\n\t\tt.Fatal(mapList)\n\t}\n\n\terr = vmap.Destroy()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = vmap.Destroy()\n\tif err != ErrObjectConflict {\n\t\tt.Fatal(err)\n\t}\n\n\terr = log.Destroy()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\terr = log.Destroy()\n\tif err != ErrObjectConflict {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"c9fc80d4e19ddbf01a4e6b5277a29e1bffa88fe047af9d0b9b36de536f85c2c6\")}\n\tvmap = client.VerifiableMap(\"mapjson\")\n\tms3, err := vmap.VerifiedLatestMapState(nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"stdjson\"), ms3, JsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"redjson\"), ms3, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"xstdjson\"), ms3, JsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"xredjson\"), ms3, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"redacted\")}\n\tvmap = client.VerifiableMap(\"mapjson\")\n\tms3, err = vmap.VerifiedLatestMapState(nil)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"stdjson\"), ms3, JsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"redjson\"), ms3, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"xstdjson\"), ms3, JsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\t_, err = vmap.VerifiedGet([]byte(\"xredjson\"), ms3, RedactedJsonEntryFactory)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tclient = &Account{Account: \"7981306761429961588\", Client: localClient.WithApiKey(\"testupdate\")}\n\tvmap = client.VerifiableMap(\"loadtestmap2\")\n\t_, err = vmap.Update([]byte(\"fooyo\"), &RawDataEntry{RawBytes: []byte(\"bar\")}, &RawDataEntry{})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "e069a8bdc98270959d6024c3520bf04e", "score": "0.4755018", "text": "func newAccounts() AWS_ACCOUNT {\n\tinput, _ := ioutil.ReadAll(os.Stdin)\n\toutStr := string(input)\n\tres := AWS_ACCOUNT{}\n\tjson.Unmarshal([]byte(outStr), &res)\n\treturn res\n}", "title": "" }, { "docid": "a38f46145237acf7699d472f0020aaf3", "score": "0.4751454", "text": "func NewMockAccountClient(ctrl *gomock.Controller) *MockAccountClient {\n\tmock := &MockAccountClient{ctrl: ctrl}\n\tmock.recorder = &MockAccountClientMockRecorder{mock}\n\treturn mock\n}", "title": "" }, { "docid": "4013e43581678d71c84c401537d867b2", "score": "0.47446057", "text": "func (_m *Eventer) AccountCreate(_a0 *account.Account) error {\n\tret := _m.Called(_a0)\n\n\tvar r0 error\n\tif rf, ok := ret.Get(0).(func(*account.Account) error); ok {\n\t\tr0 = rf(_a0)\n\t} else {\n\t\tr0 = ret.Error(0)\n\t}\n\n\treturn r0\n}", "title": "" }, { "docid": "30c91d6d40ff354f752cf8ec45393b29", "score": "0.47400215", "text": "func (s *mockServerStorer) New(context.Context) authboss.User {\n\treturn &mockUser{}\n}", "title": "" }, { "docid": "438de0bbbcaaf9eb2513a570cac9735f", "score": "0.473933", "text": "func newTestService() (*Service, func(), error) {\n\tpanic(wire.Build(dao.Provider, Provider))\n}", "title": "" }, { "docid": "f6735fb2c723456aab4ff4f930b9bfbf", "score": "0.47364664", "text": "func NewMockConfigRetriever() *MockConfigRetriever {\n\treturn &MockConfigRetriever{\n\t\tconfigs: make(map[string]proto.Message),\n\t}\n}", "title": "" } ]
d82b8fd2c43619f091f0d06a7f657ed1
Deprecated: Use ImportContext_SqlCsvImportOptions.ProtoReflect.Descriptor instead.
[ { "docid": "b6104dabf1ac83cf3b57e96a9c130304", "score": "0.7124715", "text": "func (*ImportContext_SqlCsvImportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{14, 0}\n}", "title": "" } ]
[ { "docid": "c8ea103edf79913efb7445f9d630f43e", "score": "0.70799685", "text": "func (*ImportContext_SqlCsvImportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{23, 0}\n}", "title": "" }, { "docid": "970222c1a3b62b799d6fce846785f84e", "score": "0.6401308", "text": "func (*ExportContext_SqlCsvExportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{13, 0}\n}", "title": "" }, { "docid": "1860d625e86944ccd75a2d25bb33405c", "score": "0.63699365", "text": "func (*ExportContext_SqlCsvExportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{19, 0}\n}", "title": "" }, { "docid": "46d7cf5108203668e8f90e483462b014", "score": "0.6348482", "text": "func (*StorageFormat_CsvOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dataplex_v1_metadata_proto_rawDescGZIP(), []int{14, 0}\n}", "title": "" }, { "docid": "03a83468763852b7cdac1b540d56f970", "score": "0.63402474", "text": "func (*ImportContext_SqlBakImportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{14, 1}\n}", "title": "" }, { "docid": "8bf96b6c1c49a130c178097b3223b197", "score": "0.6286145", "text": "func (*ImportContext) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "7c40a03c3a8567954af5d4db09ec99a2", "score": "0.6285768", "text": "func (*ImportContext_SqlBakImportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{23, 1}\n}", "title": "" }, { "docid": "044081e4b9a45f4c7f01db6e4e812d53", "score": "0.6282348", "text": "func (*ImportContext) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "53e819833eabbaa106f6d8323f8cc6b0", "score": "0.6130214", "text": "func (*CsvInstruction) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_datalabeling_v1beta1_instruction_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "b4bbe4f8e3e1a2e0ebc6bc5073c8acbb", "score": "0.611147", "text": "func (*ImportDataRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "0e42b2ea8fcfeb092b12a390599468b6", "score": "0.59302515", "text": "func (*InstancesImportRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "6cb6c67234bd23d5b845e07ecc1ac6c1", "score": "0.5856246", "text": "func (*ImportRequest) Descriptor() ([]byte, []int) {\n\treturn file_fabl_v1_item_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "df9f06b1dc4ca934b99af0b32c92836c", "score": "0.58174455", "text": "func ProtoFromFileDescriptor(d protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tif imp, ok := d.(protoreflect.FileImport); ok {\n\t\td = imp.FileDescriptor\n\t}\n\ttype canProto interface {\n\t\tFileDescriptorProto() *descriptorpb.FileDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FileDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FileDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFileDescriptorProto(d)\n}", "title": "" }, { "docid": "5946fd4b50ee87890b35055d0b29c350", "score": "0.5816033", "text": "func (*ExportContext_SqlExportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{13, 1}\n}", "title": "" }, { "docid": "38362e600570baaa266960931b2efc98", "score": "0.57990247", "text": "func (*ImportEntitiesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1beta1_datastore_admin_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "0988db47db08c4ecf10807d97c2f09a6", "score": "0.5765477", "text": "func (*ExportContext_SqlExportOptions) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{19, 1}\n}", "title": "" }, { "docid": "46f618517b9df3583afdefea3afea709", "score": "0.5676547", "text": "func (*DeleteCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{162}\n}", "title": "" }, { "docid": "d21db54a9f4ab13889e9684eba40591e", "score": "0.5659875", "text": "func (*Message6024) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{26}\n}", "title": "" }, { "docid": "20aa2ae7ba85f32a5067ced4d122f097", "score": "0.5659514", "text": "func (ColumnType) EnumDescriptor() ([]byte, []int) {\n\treturn file_determined_project_v1_project_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "aacda3c84a2a04e1240dfd4105f73652", "score": "0.56540126", "text": "func (StandardPTransforms_DeprecatedPrimitives) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{4, 1}\n}", "title": "" }, { "docid": "2392aa2c05cfc1dee23b5fbf7f1972b0", "score": "0.5653895", "text": "func LegacyLoadMessageDesc(t reflect.Type) protoreflect.MessageDescriptor {\n\treturn legacyLoadMessageDesc(t, \"\")\n}", "title": "" }, { "docid": "3ab7613230c6da0ee0c1f1e5794eb804", "score": "0.56391114", "text": "func (*PatchCollectorsRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{161}\n}", "title": "" }, { "docid": "be648cc680e9b948fa6cf748bbff7810", "score": "0.56318825", "text": "func (*ImportEntitiesMetadata) Descriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1beta1_datastore_admin_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "fb1ddb6443cdf81602d35cce82a0181d", "score": "0.5627833", "text": "func ProtoFromDescriptor(d protoreflect.Descriptor) proto.Message {\n\tswitch d := d.(type) {\n\tcase protoreflect.FileDescriptor:\n\t\treturn ProtoFromFileDescriptor(d)\n\tcase protoreflect.MessageDescriptor:\n\t\treturn ProtoFromMessageDescriptor(d)\n\tcase protoreflect.FieldDescriptor:\n\t\treturn ProtoFromFieldDescriptor(d)\n\tcase protoreflect.OneofDescriptor:\n\t\treturn ProtoFromOneofDescriptor(d)\n\tcase protoreflect.EnumDescriptor:\n\t\treturn ProtoFromEnumDescriptor(d)\n\tcase protoreflect.EnumValueDescriptor:\n\t\treturn ProtoFromEnumValueDescriptor(d)\n\tcase protoreflect.ServiceDescriptor:\n\t\treturn ProtoFromServiceDescriptor(d)\n\tcase protoreflect.MethodDescriptor:\n\t\treturn ProtoFromMethodDescriptor(d)\n\tdefault:\n\t\t// WTF??\n\t\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\t\treturn res.AsProto()\n\t\t}\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "7d918e705fb9b44ffdedeec75d95b86e", "score": "0.56131476", "text": "func (SqlUpdateTrack) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "04dea997fe49fa6150fb7cc07a852e25", "score": "0.56059897", "text": "func (*TraceProto) Descriptor() ([]byte, []int) {\n\treturn file_internal_tracing_extended_extended_trace_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "d872505919eda6d2b7cea192f43d8ac0", "score": "0.55960745", "text": "func (*Module) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8be15ba7fd51a3dd2ae4c344a2b3cf64", "score": "0.5586755", "text": "func (SqlUpdateTrack) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "d9f6104a49af8e328789f14fa87e147a", "score": "0.5575728", "text": "func (*From) Descriptor() ([]byte, []int) {\n\treturn file_proto_ssql_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "80042709f5500c34b24e14cd60210c57", "score": "0.5554316", "text": "func (SqlFileType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "5dbdcc4163b6704613d433f2b9ac3bd9", "score": "0.5553545", "text": "func (*DeleteJoinTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{59}\n}", "title": "" }, { "docid": "b691350fd6c18795e6d7b0eb8a75aaee", "score": "0.5541323", "text": "func (SqlFileType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "2a85b8ac862ce6c82ccd6223549565fd", "score": "0.55401236", "text": "func (SqlDatabaseVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "56fc09ea5ac47c0a9b5a53c425b70ba2", "score": "0.5537327", "text": "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "8bf4feb209b7237b03b3a6f6d719d6a0", "score": "0.55302423", "text": "func (*CancelPlanRequestProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "13ef3fd8fbc895354dbf57fa1ae8b971", "score": "0.5510165", "text": "func (SqlFlagType) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "7254e886a317c925a7c92a3e78732aac", "score": "0.550837", "text": "func (*InputDisconnect) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_video_livestream_logging_v1_logs_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "a1108b5b3c41122eefe00916f7a76b47", "score": "0.55077386", "text": "func (SqlDatabaseVersion) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "61fbe73f05aeb42fc3482d6716d31fc4", "score": "0.54976463", "text": "func (*ReportLoadRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "7c90dc445f480943954a37c1230ef1ea", "score": "0.5496241", "text": "func (*DeleteLeaderboardRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "f972fe9acfc7edf1e132fa566e4d7744", "score": "0.5494786", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_teams_v1_teams_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "b640f20e26ebcf04554c487eedb41b79", "score": "0.54821026", "text": "func (*Deprecation) Descriptor() ([]byte, []int) {\n\treturn file_external_cfgmgmt_response_nodes_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "6b2a9dda43de88a9768ae86277b839f1", "score": "0.5479656", "text": "func (ColumnType) EnumDescriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_datatransfer_v1_endpoint_common_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "fae7d3e6db90c9123f86b00006d5ef83", "score": "0.54749125", "text": "func ProtoFromFieldDescriptor(d protoreflect.FieldDescriptor) *descriptorpb.FieldDescriptorProto {\n\ttype canProto interface {\n\t\tFieldDescriptorProto() *descriptorpb.FieldDescriptorProto\n\t}\n\tif res, ok := d.(canProto); ok {\n\t\treturn res.FieldDescriptorProto()\n\t}\n\tif res, ok := d.(DescriptorProtoWrapper); ok {\n\t\tif fd, ok := res.AsProto().(*descriptorpb.FieldDescriptorProto); ok {\n\t\t\treturn fd\n\t\t}\n\t}\n\treturn protodesc.ToFieldDescriptorProto(d)\n}", "title": "" }, { "docid": "48c5b1d321f30ae723ffa7c99cd04514", "score": "0.5468191", "text": "func (*FormatMessage) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "99e014208b00b8e1ed784b29a2f57030", "score": "0.5465541", "text": "func (Breakpoint_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{5, 1}\n}", "title": "" }, { "docid": "dc0fe52a459a446b18112fd695e0f1ab", "score": "0.5459426", "text": "func (*JoinToken) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{54}\n}", "title": "" }, { "docid": "2666b88cba407abd23558c3b8a238c73", "score": "0.54488426", "text": "func (*DeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_grpc_exercicio_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "cc20560c855592dae23e86b4220ab2bc", "score": "0.5447744", "text": "func (*FetchJoinTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{57}\n}", "title": "" }, { "docid": "0fb04b9ccbcf0337393dffb34203c094", "score": "0.54473734", "text": "func (*ExportContext) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{19}\n}", "title": "" }, { "docid": "74833794abd9692301acc0835072aad2", "score": "0.544367", "text": "func (*Message5903) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "efd4cee7771629a9e4fc22ca96308f09", "score": "0.5440906", "text": "func (*ExportContext) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "41ccc2b1617a77efca5b8ecb61e4ff68", "score": "0.5435717", "text": "func (*Message6126) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "6675b55b514a86b72e684a083e37b913", "score": "0.543522", "text": "func (*InputDataset) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_dialogflow_v2_conversation_model_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "d10dc73ef8482fb49021293a4c5f62c9", "score": "0.5434817", "text": "func (StatusMessage_Reference) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_devtools_clouddebugger_v2_data_proto_rawDescGZIP(), []int{1, 0}\n}", "title": "" }, { "docid": "805a36b17698a2b3b868a7a1af5bc622", "score": "0.54302377", "text": "func legacyLoadExtensionFieldInfo(xt protoreflect.ExtensionType) *extensionFieldInfo {\n\tif xi, ok := legacyExtensionFieldInfoCache.Load(xt); ok {\n\t\treturn xi.(*extensionFieldInfo)\n\t}\n\te := makeExtensionFieldInfo(xt.TypeDescriptor())\n\tif e, ok := legacyMessageTypeCache.LoadOrStore(xt, e); ok {\n\t\treturn e.(*extensionFieldInfo)\n\t}\n\treturn e\n}", "title": "" }, { "docid": "257785a623fd4c151db6000f3f5aa8c6", "score": "0.5422618", "text": "func ToFileDescriptorProto(file protoreflect.FileDescriptor) *descriptorpb.FileDescriptorProto {\n\tp := &descriptorpb.FileDescriptorProto{\n\t\tName: proto.String(file.Path()),\n\t\tOptions: proto.Clone(file.Options()).(*descriptorpb.FileOptions),\n\t}\n\tif file.Package() != \"\" {\n\t\tp.Package = proto.String(string(file.Package()))\n\t}\n\tfor i, imports := 0, file.Imports(); i < imports.Len(); i++ {\n\t\timp := imports.Get(i)\n\t\tp.Dependency = append(p.Dependency, imp.Path())\n\t\tif imp.IsPublic {\n\t\t\tp.PublicDependency = append(p.PublicDependency, int32(i))\n\t\t}\n\t\tif imp.IsWeak {\n\t\t\tp.WeakDependency = append(p.WeakDependency, int32(i))\n\t\t}\n\t}\n\tfor i, locs := 0, file.SourceLocations(); i < locs.Len(); i++ {\n\t\tloc := locs.Get(i)\n\t\tl := &descriptorpb.SourceCodeInfo_Location{}\n\t\tl.Path = append(l.Path, loc.Path...)\n\t\tif loc.StartLine == loc.EndLine {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndColumn)}\n\t\t} else {\n\t\t\tl.Span = []int32{int32(loc.StartLine), int32(loc.StartColumn), int32(loc.EndLine), int32(loc.EndColumn)}\n\t\t}\n\t\tl.LeadingDetachedComments = append([]string(nil), loc.LeadingDetachedComments...)\n\t\tif loc.LeadingComments != \"\" {\n\t\t\tl.LeadingComments = proto.String(loc.LeadingComments)\n\t\t}\n\t\tif loc.TrailingComments != \"\" {\n\t\t\tl.TrailingComments = proto.String(loc.TrailingComments)\n\t\t}\n\t\tif p.SourceCodeInfo == nil {\n\t\t\tp.SourceCodeInfo = &descriptorpb.SourceCodeInfo{}\n\t\t}\n\t\tp.SourceCodeInfo.Location = append(p.SourceCodeInfo.Location, l)\n\n\t}\n\tfor i, messages := 0, file.Messages(); i < messages.Len(); i++ {\n\t\tp.MessageType = append(p.MessageType, ToDescriptorProto(messages.Get(i)))\n\t}\n\tfor i, enums := 0, file.Enums(); i < enums.Len(); i++ {\n\t\tp.EnumType = append(p.EnumType, ToEnumDescriptorProto(enums.Get(i)))\n\t}\n\tfor i, services := 0, file.Services(); i < services.Len(); i++ {\n\t\tp.Service = append(p.Service, ToServiceDescriptorProto(services.Get(i)))\n\t}\n\tfor i, exts := 0, file.Extensions(); i < exts.Len(); i++ {\n\t\tp.Extension = append(p.Extension, ToFieldDescriptorProto(exts.Get(i)))\n\t}\n\tif syntax := file.Syntax(); syntax != protoreflect.Proto2 {\n\t\tp.Syntax = proto.String(file.Syntax().String())\n\t}\n\treturn p\n}", "title": "" }, { "docid": "0d1ac577dde7a6c7237f66fcf6e10ea9", "score": "0.54194236", "text": "func (*DeleteJobRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_noderpc_proto_feeds_manager_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "8cf2f98a2d6d8a5b2df28f5aa82c1aa5", "score": "0.54140365", "text": "func (DateTime_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "16ce285993d8f24541a88b6bdcc8b52a", "score": "0.54135835", "text": "func (*Instance) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{28}\n}", "title": "" }, { "docid": "f4a328787fcb26b4165d5ac35af9a809", "score": "0.54117775", "text": "func (*FeaturestoreMonitoringConfig_ImportFeaturesAnalysis) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_aiplatform_v1_featurestore_monitoring_proto_rawDescGZIP(), []int{0, 1}\n}", "title": "" }, { "docid": "e11b38cd7c62e1f274bbb765a1bb820d", "score": "0.5408117", "text": "func (*Message7511) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "04b935a942c5b8e6aaff355d572b1015", "score": "0.5400789", "text": "func (*CMsgClientToGCPlayerStatsRequest) Descriptor() ([]byte, []int) {\n\treturn file_dota_gcmessages_client_proto_rawDescGZIP(), []int{143}\n}", "title": "" }, { "docid": "9570b8664c80344fc96ea3050b6f3768", "score": "0.5396651", "text": "func (*Message7928) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{18}\n}", "title": "" }, { "docid": "0a80e39430c5ff5e3c1e8e996e53aca4", "score": "0.5396544", "text": "func (*GPULabelRequest) Descriptor() ([]byte, []int) {\n\treturn file_cloudprovider_externalgrpc_protos_externalgrpc_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "ad96a2d282f815f7f12efb099b2bef9e", "score": "0.53962725", "text": "func (*Message4016) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{30}\n}", "title": "" }, { "docid": "6bfef95752effe9814e5cac5bd5a7ba1", "score": "0.53928286", "text": "func (Build_Origin) EnumDescriptor() ([]byte, []int) {\n\treturn file_go_chromium_org_luci_cv_api_bigquery_v1_attempt_proto_rawDescGZIP(), []int{2, 0}\n}", "title": "" }, { "docid": "f560c5090476a8eef17185f3a0b268f1", "score": "0.5385964", "text": "func (*UpdateDatasetRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_automl_v1_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "c4e0c99a41bc277d5d316a9ab5d31e89", "score": "0.53823876", "text": "func (*Message12796) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "da31bb68926f2db1865008005c2fb611", "score": "0.53808606", "text": "func (Instant_Precision) EnumDescriptor() ([]byte, []int) {\n\treturn file_proto_google_fhir_proto_stu3_datatypes_proto_rawDescGZIP(), []int{7, 0}\n}", "title": "" }, { "docid": "cc83fe7f0c3aa6958442852456f3d665", "score": "0.5379278", "text": "func (*BulkDeleteRequest) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_index_proto_rawDescGZIP(), []int{16}\n}", "title": "" }, { "docid": "a2ba2e1b9e3ee8cd1a5f094257c466b4", "score": "0.5375479", "text": "func (*LocalTrainParams) Descriptor() ([]byte, []int) {\n\treturn file_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "22ca1cb1e7eb814232573e35ec5d335e", "score": "0.5371516", "text": "func (*Message6129) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "c5abd309c3a4a243dfb795e453b774e6", "score": "0.5370457", "text": "func (*CancelPlanResponseProto) Descriptor() ([]byte, []int) {\n\treturn file_ClientDatanodeProtocol_proto_rawDescGZIP(), []int{23}\n}", "title": "" }, { "docid": "0051d17e49f6e965a899132dbdd51eba", "score": "0.5369705", "text": "func (*Message6127) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{24}\n}", "title": "" }, { "docid": "e94031b1686828adcb270a11f0871908", "score": "0.5368723", "text": "func (*ImportFacebookFriendsRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{44}\n}", "title": "" }, { "docid": "a1a7cc2df48b8281f9ef4283b3038d56", "score": "0.53673565", "text": "func (*DeleteModelVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_proto_clarifai_api_service_proto_rawDescGZIP(), []int{89}\n}", "title": "" }, { "docid": "6f2720f382ab7ad1a6a99a77c30f7f97", "score": "0.53650755", "text": "func (*TruncatableString) Descriptor() ([]byte, []int) {\n\treturn file_google_devtools_cloudtrace_v2_trace_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "30da976bc9f9b90a19d38ed271d127d4", "score": "0.5362569", "text": "func (LogRecord_Type) EnumDescriptor() ([]byte, []int) {\n\treturn file_logrecord_proto_rawDescGZIP(), []int{0, 0}\n}", "title": "" }, { "docid": "5f53b4d1ebd0500c722477c9532bcdfb", "score": "0.53624284", "text": "func (SqlPricingPlan) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1_cloud_sql_resources_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "8df8b26b4e6a97502ac96aeec16a1868", "score": "0.5362408", "text": "func (*Message6107) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "5c5d46be4789625e64bafe1d78542ded", "score": "0.53594995", "text": "func (*Message10319) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "c2165efc075574910d02e08f6f39d82d", "score": "0.5355282", "text": "func (*Message6108) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{31}\n}", "title": "" }, { "docid": "7e382d4bf069cef24e3f9eb2a48d456a", "score": "0.5354096", "text": "func (GrpcLogRecord_LogLevel) EnumDescriptor() ([]byte, []int) {\n\treturn file_gcp_observability_internal_logging_logging_proto_rawDescGZIP(), []int{0, 2}\n}", "title": "" }, { "docid": "55da5b366adb29c399b03040f5e45b15", "score": "0.53490853", "text": "func (MigrationStep) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_datastore_admin_v1_migration_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "49699a37282616282293f39e4455bcc9", "score": "0.5344323", "text": "func (*DeleteVersionRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_appengine_v1_appengine_proto_rawDescGZIP(), []int{14}\n}", "title": "" }, { "docid": "9e5ff7c1d95f1dd5df1700a4333fffbb", "score": "0.53438073", "text": "func (*DataDataMigrateReq) Descriptor() ([]byte, []int) {\n\treturn file_proto_DataData_DataData_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "983eb8557fa820b969fe5bd851801282", "score": "0.5343248", "text": "func (*Message12774) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "1d039fd4e58260c9fa466b3c8d0b0880", "score": "0.534181", "text": "func (*ArrowRecordBatch) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_bigquery_storage_v1_arrow_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "3f1a949e1cdf2582e9200062924758d0", "score": "0.53400666", "text": "func (*Rows) Descriptor() ([]byte, []int) {\n\treturn file_messages_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "543007a22f8c62a58f3f431eb9ece719", "score": "0.53390795", "text": "func (*Version) Descriptor() ([]byte, []int) {\n\treturn file_google_protobuf_compiler_plugin_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "efc12a107612090ba92eedc28ead9cc7", "score": "0.5338208", "text": "func (*Decl) Descriptor() ([]byte, []int) {\n\treturn file_google_api_expr_v1alpha1_checked_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "b9a925bff67d049a0551b652786c2e7f", "score": "0.53380764", "text": "func (StandardProtocols_Enum) EnumDescriptor() ([]byte, []int) {\n\treturn file_org_apache_beam_model_pipeline_v1_beam_runner_api_proto_rawDescGZIP(), []int{54, 0}\n}", "title": "" }, { "docid": "8522d50d1141f70d3704082494c9e501", "score": "0.5335598", "text": "func (SqlPricingPlan) EnumDescriptor() ([]byte, []int) {\n\treturn file_google_cloud_sql_v1beta4_cloud_sql_resources_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "0e9c3821d57c9ce9158fadb76da713a9", "score": "0.53354603", "text": "func (CRIUType) EnumDescriptor() ([]byte, []int) {\n\treturn file_incus_migration_migrate_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "d5e51a9eb36424e88b0dba4eabb02dc5", "score": "0.53353965", "text": "func (*CreateJoinTokenRequest) Descriptor() ([]byte, []int) {\n\treturn file_spire_server_datastore_datastore_proto_rawDescGZIP(), []int{55}\n}", "title": "" }, { "docid": "369d4fcc4f83b410156fc6650b2b9249", "score": "0.5334873", "text": "func (*MemberLoginLogDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{61}\n}", "title": "" }, { "docid": "d4aea3efc131e3b9491898d57fe1e54c", "score": "0.533216", "text": "func (*DeleteTournamentRecordRequest) Descriptor() ([]byte, []int) {\n\treturn file_api_proto_rawDescGZIP(), []int{33}\n}", "title": "" }, { "docid": "2cef5bf4c9b4cea486ac9ecc272d102a", "score": "0.5331892", "text": "func (*MemberLevelDeleteReq) Descriptor() ([]byte, []int) {\n\treturn file_ums_proto_rawDescGZIP(), []int{52}\n}", "title": "" }, { "docid": "a10dfbd50d4576f07d2992e80fedcb9d", "score": "0.5330723", "text": "func (*Message3850) Descriptor() ([]byte, []int) {\n\treturn file_datasets_google_message4_benchmark_message4_2_proto_rawDescGZIP(), []int{14}\n}", "title": "" } ]
38dd298d0dd09f40a1448688a49beec3
String returns a string in the form: "Subject()" from From()
[ { "docid": "716fe0a9be50c1ecffa3dcfebc7ef2d1", "score": "0.59333444", "text": "func (m *FileMessage) String() string {\n\treturn fmt.Sprintf(\"\\\"%v\\\" from %v\", m.Fsubject, m.Ffrom)\n}", "title": "" } ]
[ { "docid": "a8a532f771c31e89255ebf47761d9935", "score": "0.659907", "text": "func (s *Subject) String() string {\n\treturn fmt.Sprintf(\"%s%s\", s.Player, s.Position)\n}", "title": "" }, { "docid": "62dbcbf9e1725a4dff7cf6048589100d", "score": "0.602556", "text": "func (b BlankSubjecter) Subject(d interface{}) (string, error) { return \"\", nil }", "title": "" }, { "docid": "52249cb5066ed8d6ed4cd31e41f2e15a", "score": "0.5916411", "text": "func (msg Message) String() string {\n\treturn (msg.source + \" \" + msg.msgType + \" \" + msg.msgDat + \" \" + msg.time)\n}", "title": "" }, { "docid": "b9314d3d1be0078a7dcce6fdaa7e4457", "score": "0.5857673", "text": "func String(from interface{}) (string, error) {\n\treturn converter.String(from)\n}", "title": "" }, { "docid": "8672f2c2984776df075d60a481b10873", "score": "0.5847775", "text": "func (m *Message) Subject() string { return m.subject }", "title": "" }, { "docid": "6d59321bb44e810e36c38b1c423b15e8", "score": "0.5829959", "text": "func (id MessageID) String() string {\n\treturn SqrtedString(id[:], \":\")\n}", "title": "" }, { "docid": "aa043dce8b5e32ccdbe9d09120b217f4", "score": "0.58000654", "text": "func String(name string) Message {\n\treturn catmsg.String(name)\n}", "title": "" }, { "docid": "82e935f047defd38a4f668a89a057ab4", "score": "0.5766129", "text": "func (m *Message) String() string {\n\tpri := m.Facility*8 + m.Severity.Value()\n\n\ttimestamp := m.TimeStamp.String()\n\n\thost := m.HostName\n\tif host == \"\" {\n\t\thost = \"-\"\n\t}\n\n\tapplication := m.Application\n\tif application == \"\" {\n\t\tapplication = \"-\"\n\t}\n\n\tproc := m.Process\n\tif proc == \"\" {\n\t\tproc = \"-\"\n\t}\n\n\tmessageID := m.MessageID\n\tif messageID == \"\" {\n\t\tmessageID = \"-\"\n\t}\n\n\theader := fmt.Sprintf(\"<%d>%d %s %s %s %s %s\",\n\t\tpri, m.Version, timestamp, host,\n\t\tapplication, proc, messageID)\n\n\tsdes := []string{}\n\tif m.AuditData != nil {\n\t\tsdes = append(sdes, m.AuditData.String(m.pen))\n\t}\n\tif m.MetricData != nil {\n\t\tsdes = append(sdes, m.MetricData.String(m.pen))\n\t}\n\tif m.SourceData != nil {\n\t\tsdes = append(sdes, m.SourceData.String(m.pen))\n\t}\n\tsde := strings.Join(sdes, \" \")\n\tif sde == \"\" {\n\t\tsde = \"-\"\n\t}\n\n\tmssg := m.Message\n\n\ts := fmt.Sprintf(\"%s %s %s\", header, sde, mssg)\n\treturn s\n}", "title": "" }, { "docid": "d44312cd0a6ffa7174ffaf44f83a8ab7", "score": "0.57441896", "text": "func (m Message) String() string {\n\tswitch {\n\tcase m == nil:\n\t\treturn \"<nil>\"\n\tcase !m.ProtoReflect().IsValid():\n\t\treturn \"<invalid>\"\n\tdefault:\n\t\treturn msgfmt.Format(m)\n\t}\n}", "title": "" }, { "docid": "cf256ea3577277acd7debf4a573e376f", "score": "0.57205987", "text": "func (t *FromBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "524cf68812e53792188dc661dfaaf12a", "score": "0.57205874", "text": "func (msg *Message) String() string {\n\tvar buf bytes.Buffer\n\n\tfmt.Fprintf(&buf, \"From: %s\\r\\n\", msg.From)\n\tfmt.Fprintf(&buf, \"To: %s\\r\\n\", msg.To)\n\tfmt.Fprintf(&buf, \"Cc: %s\\r\\n\", msg.Cc)\n\tfmt.Fprintf(&buf, \"Bcc: %s\\r\\n\", msg.Bcc)\n\tif len(msg.Date) > 0 {\n\t\tfmt.Fprintf(&buf, \"Date: %s\\r\\n\", msg.Date)\n\t}\n\tif len(msg.Id) > 0 {\n\t\tfmt.Fprintf(&buf, \"Messsage-ID: %s\\r\\n\", msg.Id)\n\t}\n\tfmt.Fprintf(&buf, \"In-Reply-To: %s\\r\\n\", msg.InReplyTo)\n\tif len(msg.XList) > 0 {\n\t\tfmt.Fprintf(&buf, \"X-Mailing-List: %s\\r\\n\", msg.XList)\n\t\tfmt.Fprintf(&buf, \"List-ID: %s\\r\\n\", msg.XList)\n\t\tfmt.Fprintf(&buf, \"Sender: %s\\r\\n\", msg.XList)\n\t}\n\tif len(msg.ContentType) > 0 {\n\t\tfmt.Fprintf(&buf, \"Content-Type: %s\\r\\n\", msg.ContentType)\n\t}\n\tfmt.Fprintf(&buf, \"Subject: %s\\r\\n\", msg.Subject)\n\tfmt.Fprintf(&buf, \"\\r\\n%s\", msg.Body)\n\n\treturn buf.String()\n}", "title": "" }, { "docid": "edc31c27b3f40a17656d372b8b724b2b", "score": "0.5713958", "text": "func (ss *SenderSupplied) String() string {\n\treturn ss.Format(FormatOptions{\n\t\tVariableLengthFields: false,\n\t})\n}", "title": "" }, { "docid": "ae029865129508942bbe2dab1d538423", "score": "0.5665968", "text": "func (msg *Message) String() string {\n\treturn fmt.Sprintf(\"[%s] %s\", msg.From.String(), string(msg.Data))\n}", "title": "" }, { "docid": "774c20021a07be4c58caccf38ea7c529", "score": "0.5643323", "text": "func (sr *SenderReference) String() string {\n\treturn sr.Format(FormatOptions{\n\t\tVariableLengthFields: false,\n\t})\n}", "title": "" }, { "docid": "53812285eeaa0d175905592614f07b49", "score": "0.5636065", "text": "func (p *SpamComplaint) String() string {\n\treturn fmt.Sprintf(\"%s S %s %s %s => %s (%s)\",\n\t\tp.Timestamp, p.TransmissionID, p.Binding, p.ReportedBy, p.ReportedTo, p.Recipient)\n}", "title": "" }, { "docid": "d07e4de78ab44114974ae703e39a742e", "score": "0.56231135", "text": "func (m Msg) String() string {\n\tpanic(\"not implemented\")\n}", "title": "" }, { "docid": "15e8e8076a9ef750247b6f9661d36f23", "score": "0.5593423", "text": "func (t *FromBase64) String() string {\n\treturn fmt.Sprintf(\"FROM_BASE64(%s)\", t.Child)\n}", "title": "" }, { "docid": "6acfcaedb109686dfab7c82bc995c4eb", "score": "0.5570562", "text": "func (r Recipient) String() string {\n\tjs, _ := json.Marshal(r)\n\treturn string(js)\n}", "title": "" }, { "docid": "158bba489de24ad8be48439062d1c794", "score": "0.556078", "text": "func (m *Message) String() string {\n\tvar buf bytes.Buffer\n\tm.string(&buf)\n\treturn buf.String()\n}", "title": "" }, { "docid": "19e954998b4c657f186822803c9800d9", "score": "0.5551086", "text": "func (g String) To(first interface{}, extraStrings ...string) String {\n\tg = g.append(\".to(\")\n\n\tswitch first.(type) {\n\tcase string:\n\t\tg = g.append(first.(string))\n\tcase String:\n\t\tg = g.append(first.(String).Raw().String())\n\tcase direction.Direction:\n\t\tg = g.append(fmtStr(\"%v\", first.(direction.Direction)))\n\tdefault:\n\t\tfmt.Println(\"Type mismatch used in To()\")\n\t}\n\n\tif len(extraStrings) > 0 {\n\t\tfor _, v := range extraStrings {\n\t\t\tg = g.append(fmtStr(\",%v\", v))\n\t\t}\n\t}\n\n\tg = g.append(\")\")\n\n\treturn g\n}", "title": "" }, { "docid": "79e6a6f9c46cd7410e8826345bf8205e", "score": "0.5531603", "text": "func (m Message) String() string {\n\treturn fmt.Sprintf(\"Message - %s(%s) %v\", m.Type, m.Seat, m.Options)\n}", "title": "" }, { "docid": "d623c9cf22897837a2b1a5c21fdb4962", "score": "0.5498195", "text": "func (p rulesKey) String() string {\n\treturn fmt.Sprintf(\"%s/%s\", p.Scope, p.Subject)\n}", "title": "" }, { "docid": "8f232bbe5f3db44773f6b0366dea552e", "score": "0.5493952", "text": "func (m message) String() string {\n\treturn string(m.data)\n}", "title": "" }, { "docid": "0d35f3b93dfea51bdbca5890eb3323dc", "score": "0.54352486", "text": "func (s Subscriber) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "b2b411e0d89ae923c8b76904d1e3d53c", "score": "0.54179054", "text": "func (obj *save) From() string {\n\treturn obj.from\n}", "title": "" }, { "docid": "2c5707e5e743118f7842ba74d5ca8be7", "score": "0.5410457", "text": "func (r Recipients) String() string {\n\tjs, _ := json.Marshal(r)\n\treturn string(js)\n}", "title": "" }, { "docid": "ca72c753807980cf4547bcf577759f1a", "score": "0.53936595", "text": "func (s MailSendInitial) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "6f0713fe4138b1f849e4ac87e4864ff1", "score": "0.53824073", "text": "func (msg *Message) String() string {\n\treturn fmt.Sprintf(\"%s (%v) > %s\", msg.SenderName, msg.Info.Action,\n\t\tmsg.Info.Body)\n}", "title": "" }, { "docid": "361003604253a0b99bb525b032d8c700", "score": "0.53734314", "text": "func composeMsg(from string, to string, subject string, body string) (message string) {\n\t// Setup headers\n\theaders := make(map[string]string)\n\theaders[\"From\"] = from\n\theaders[\"To\"] = to\n\theaders[\"Subject\"] = subject\n\theaders[\"Content-Type\"] = \"text/plain; charset=UTF-8\"\n\t// Setup message\n\tfor k, v := range headers {\n\t\tmessage += fmt.Sprintf(\"%s: %s\\r\\n\", k, v)\n\t}\n\tmessage += \"\\r\\n\" + body\n\treturn\n}", "title": "" }, { "docid": "2d8c2f0548587eea6677893e52173bf4", "score": "0.535609", "text": "func (ipfixmsg *Message) String() string {\n\tretstr := fmt.Sprintf(\"version=%d, length=%d, export time=%s, sequence=%d, odid=%d\", ipfixmsg.VersionNumber, ipfixmsg.Len(), ipfixmsg.ExportTime, ipfixmsg.SequenceNumber, ipfixmsg.ObservationDomainID)\n\tif len(ipfixmsg.Sets) > 0 {\n\t\tretstr += \"\\n\"\n\t\tfor _, st := range ipfixmsg.Sets {\n\t\t\tretstr += st.String() + \"\\n\"\n\t\t}\n\t}\n\treturn retstr\n}", "title": "" }, { "docid": "0b894ba0dc58d784453bd793cc7b5b39", "score": "0.5352608", "text": "func (p PubRec) String() string {\n\treturn fmt.Sprintf(\"PUBREC (m%d)\", p.ID())\n}", "title": "" }, { "docid": "54d97808761a481945fb27367bdf5eab", "score": "0.5349003", "text": "func (from Case) String() string {\n\tswitch from {\n\tcase CaseUpper:\n\t\treturn \"Upper\"\n\tcase CaseLower:\n\t\treturn \"Lower\"\n\tcase CaseUpperCamel:\n\t\treturn \"UpperCamel\"\n\tcase CaseLowerCamel:\n\t\treturn \"UpperCamel\"\n\tcase CaseUpperUnderscore:\n\t\treturn \"UpperUnderscore\"\n\tcase CaseLowerUnderscore:\n\t\treturn \"LowerUnderscore\"\n\t}\n\treturn \"UnsupportedCase\"\n}", "title": "" }, { "docid": "c54d5f34490d30d05f978d00b2db53c8", "score": "0.53486246", "text": "func (p PubComp) String() string {\n\treturn fmt.Sprintf(\"PUBCOMP (m%d)\", p.ID())\n}", "title": "" }, { "docid": "51572c2c7c18e5e7c9bc8956bee23c14", "score": "0.53321147", "text": "func (m *Message) String() string {\n\treturn m.Network + \" \" + m.Secret\n}", "title": "" }, { "docid": "cc1e5cb61299c4d75da8262b3014b8a3", "score": "0.53253037", "text": "func (msg *SendingCompleted) String() string {\n\tjsonBytes, err := json.Marshal(*msg)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\treturn string(jsonBytes)\n}", "title": "" }, { "docid": "0027e3ffc70c5772e172a79420e1294d", "score": "0.5320677", "text": "func (ro *RemittanceOriginator) String() string {\n\treturn ro.Format(FormatOptions{\n\t\tVariableLengthFields: false,\n\t})\n}", "title": "" }, { "docid": "24a55fb82be6f9f0301db0028e32ab0d", "score": "0.5319573", "text": "func (f TopicFactory) String() string {\n\treturn string(f)\n}", "title": "" }, { "docid": "70b4317e8dac7b4651a9b6c67973e14d", "score": "0.5311051", "text": "func (m *Message) String() string {\n\treturn fmt.Sprintf(\"<Message Topic=%q QOS=%d Retain=%t Payload=%v>\",\n\t\tm.Topic, m.QOS, m.Retain, m.Payload)\n}", "title": "" }, { "docid": "923ae1ffbd0a1132f28ed2315a249287", "score": "0.5304669", "text": "func (t *ToBase64) String() string {\n\treturn fmt.Sprintf(\"%s(%s)\", t.FunctionName(), t.Child)\n}", "title": "" }, { "docid": "db67f2af60f4d3fb6d55d9db0f7c324d", "score": "0.5290829", "text": "func (a Address) String() string {\n\tvar b strings.Builder\n\tb.WriteString(a.String4d())\n\tif a.domain != \"\" {\n\t\tb.WriteString(\"@\")\n\t\tb.WriteString(string(a.domain))\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "a64d626af25a3af0a26d03952b13389c", "score": "0.5290152", "text": "func (m *Message) String() string {\n\tfields := \"\"\n\tfor _, f := range m.req.fields {\n\t\tfields += f.String() + \",\"\n\t}\n\tif len(fields) > 0 {\n\t\tfields = fields[:len(fields)-1]\n\t}\n\n\tstr := `{\"request\":[` + fields + `]`\n\n\tif m.resp != nil {\n\t\tstr += `,\"response\":` + m.resp.String()\n\t}\n\n\tif m.errs != nil && len(m.errs.Types()) > 1 {\n\t\terrs, _ := NewUnionSchema(m.errs.Types()[1:])\n\t\tstr += `,\"errors\":` + errs.String()\n\t}\n\n\tstr += \"}\"\n\treturn str\n}", "title": "" }, { "docid": "7b6fb8a107d816d5aed77c6a90a11689", "score": "0.5288983", "text": "func (s Message) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "7b6fb8a107d816d5aed77c6a90a11689", "score": "0.5288983", "text": "func (s Message) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "db25b84b87f569b93b0843f28924c1fc", "score": "0.52727", "text": "func (q qer) String() string {\n\tb := strings.Builder{}\n\tfmt.Fprintf(&b, \"\\n\")\n\tfmt.Fprintf(&b, \"qerID: %v\\n\", q.qerID)\n\tfmt.Fprintf(&b, \"fseID: %x\\n\", q.fseID)\n\tfmt.Fprintf(&b, \"qfi: %v\\n\", q.qfi)\n\tfmt.Fprintf(&b, \"fseIDIP: %v\\n\", int2ip(q.fseidIP))\n\tfmt.Fprintf(&b, \"uplinkStatus: %v\\n\", q.ulStatus)\n\tfmt.Fprintf(&b, \"downlinkStatus: %v\\n\", q.dlStatus)\n\tfmt.Fprintf(&b, \"uplinkMBR: %v\\n\", q.ulMbr)\n\tfmt.Fprintf(&b, \"downlinkMBR: %v\\n\", q.dlMbr)\n\tfmt.Fprintf(&b, \"uplinkGBR: %v\\n\", q.ulGbr)\n\tfmt.Fprintf(&b, \"downlinkGBR: %v\\n\", q.dlGbr)\n\n\treturn b.String()\n}", "title": "" }, { "docid": "26d6fa3c5590078cd1648a4f489d2d98", "score": "0.52675384", "text": "func (contact *Contact) String() string {\n\treturn fmt.Sprintf(`contact(\"%s\", \"%s\")`, contact.ID, contact.Address)\n}", "title": "" }, { "docid": "26d6fa3c5590078cd1648a4f489d2d98", "score": "0.52675384", "text": "func (contact *Contact) String() string {\n\treturn fmt.Sprintf(`contact(\"%s\", \"%s\")`, contact.ID, contact.Address)\n}", "title": "" }, { "docid": "26d6fa3c5590078cd1648a4f489d2d98", "score": "0.52675384", "text": "func (contact *Contact) String() string {\n\treturn fmt.Sprintf(`contact(\"%s\", \"%s\")`, contact.ID, contact.Address)\n}", "title": "" }, { "docid": "39db4499bcfd687f303a6d18e448b092", "score": "0.5264672", "text": "func (t *Email) String() string {\n\treturn t.Get()\n}", "title": "" }, { "docid": "03750e60c24456a519d558dc10843966", "score": "0.52611285", "text": "func formatMsgString(msg ...interface{}) string {\n\treturn fmt.Sprintf(msg[0].(string), msg[1:]...)\n}", "title": "" }, { "docid": "c05aceb4bebae4ecd5bee6c430715ddf", "score": "0.5248751", "text": "func (m MockProtoMessage) String() string {\n\tif m.StringFunc == nil {\n\t\tpanic(\"String called, but not set\")\n\t}\n\treturn m.StringFunc()\n}", "title": "" }, { "docid": "2ccc67cae94f518ed92dde5010ba70cd", "score": "0.5242474", "text": "func constructemail(message string, from string, to string, subject string, html bool) string{\n\tvar email string\n\tif html{\n\t\temail = \"From: \" + from + \"\\nTo: \" + to + \"\\nSubject: \" + subject + \"\\nMime-Version: 1.0\\nContent-Type: text/html\\n\" + message +\"\\n.\"\n\t}else{\n\t\temail = \"From: \" + from + \"\\nTo: \" + to + \"\\nSubject: \" + subject + \"\\n\" + message +\"\\n.\"\n\t}\n\treturn email\n}", "title": "" }, { "docid": "7d8d13ec3b46c485664957aa1c3511f1", "score": "0.5240718", "text": "func (e Event)toString() string {\n\treturn fmt.Sprintf(\"%s%05d - %s\", loggerNamePrefix, e.id, e.message)\n}", "title": "" }, { "docid": "ead13ea4d817c41fc972f2cda4be8e81", "score": "0.5223099", "text": "func (from Class) String(with AdjSymbol) string {\n\treturn stringOf(from, with)\n}", "title": "" }, { "docid": "20514cf5b60f7efedd4624db9fdf5504", "score": "0.5214897", "text": "func (m *FileMessage) From() string {\n\treturn m.Ffrom\n}", "title": "" }, { "docid": "7e237638c23e3e57bf61e16083cefdb7", "score": "0.52104163", "text": "func (msg *IncomingMessage) String() string {\n\treturn msg.Headers.String()\n}", "title": "" }, { "docid": "e996f5f6a1c811718b55ddb5ad5b8a30", "score": "0.52046144", "text": "func (rd *C.ksnCorePacketData) From() string {\n\treturn C.GoString(rd.from)\n}", "title": "" }, { "docid": "42303a84022047c0fb0bde6411c2c13e", "score": "0.51949906", "text": "func Subject(topic string, section Section) string {\n\treturn fmt.Sprintf(\"%s-%s\", topic, section)\n}", "title": "" }, { "docid": "568206c19a05e3ea0120462042d4557a", "score": "0.51833415", "text": "func (s Participant) String() string {\n\treturn awsutil.Prettify(s)\n}", "title": "" }, { "docid": "394d4ea2da27a714bcab0adc11ec0755", "score": "0.5181861", "text": "func (m nodeMsg) String() string {\n\treturn fmt.Sprintf(\"(MsgID: %d, From: %d, Type: %d, HTL: %d, Depth: %d, Length: %d, Body: %s)\",\n\t\tm.msgID, m.from.id, m.msgType, m.htl, m.depth, m.length, m.body)\n}", "title": "" }, { "docid": "d7524b0a30f3ef35db54f9c6b329517f", "score": "0.51707435", "text": "func (eventName internalEventName) String() string {\n\treturn eventName.s\n}", "title": "" }, { "docid": "907f4b07fdc21182a846930a2a15f53c", "score": "0.5170027", "text": "func (f *FuncTypeDecl) String() string {\n\ttmp := \"func(\"\n\tfor i, param := range f.In {\n\t\ttmp += param.String()\n\t\tif i < len(f.In)-1 {\n\t\t\ttmp += \",\"\n\t\t}\n\t}\n\ttmp += \")\"\n\n\tif len(f.Out) > 0 {\n\t\ttmp += \" \"\n\t}\n\n\tif len(f.Out) > 1 {\n\t\ttmp += \"(\"\n\t}\n\n\tfor i, param := range f.Out {\n\t\ttmp += param.String()\n\t\tif i < len(f.In)-1 {\n\t\t\ttmp += \",\"\n\t\t}\n\t}\n\n\tif len(f.Out) > 1 {\n\t\ttmp += \")\"\n\t}\n\n\treturn tmp\n}", "title": "" }, { "docid": "d3762bc15f7e22654e9acf93a9db6c30", "score": "0.5169355", "text": "func (c logClosure) String() string {\n\treturn c()\n}", "title": "" }, { "docid": "d3762bc15f7e22654e9acf93a9db6c30", "score": "0.5169355", "text": "func (c logClosure) String() string {\n\treturn c()\n}", "title": "" }, { "docid": "d3762bc15f7e22654e9acf93a9db6c30", "score": "0.5169355", "text": "func (c logClosure) String() string {\n\treturn c()\n}", "title": "" }, { "docid": "8294c73967caa48106e308faf521538a", "score": "0.51665413", "text": "func (xe XFCCElement) String() string {\n\tparts := []string{}\n\tif xe.By != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"By=%s\", maybeQuoted(xe.By)))\n\t}\n\tif xe.Hash != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"Hash=%s\", maybeQuoted(xe.Hash)))\n\t}\n\tif xe.Cert != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"Cert=%s\", maybeQuoted(xe.Cert)))\n\t}\n\tif xe.Chain != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"Chain=%s\", maybeQuoted(xe.Chain)))\n\t}\n\tif xe.Subject != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"Subject=%q\", xe.Subject))\n\t}\n\tif xe.URI != \"\" {\n\t\tparts = append(parts, fmt.Sprintf(\"URI=%s\", maybeQuoted(xe.URI)))\n\t}\n\tfor _, dnsSAN := range xe.DNS {\n\t\tparts = append(parts, fmt.Sprintf(\"DNS=%s\", maybeQuoted(dnsSAN)))\n\t}\n\n\treturn strings.Join(parts, \";\")\n}", "title": "" }, { "docid": "623d6f7c6c218b6dc05ed36eba4613d1", "score": "0.5162517", "text": "func (n *Send) String() string {\n\treturn n.Channel.String() + \" <- \" + n.Value.String()\n}", "title": "" }, { "docid": "8f57938af4f075a313afd26959ed019c", "score": "0.5160207", "text": "func (s Signature) String() string {\n\treturn s.str\n}", "title": "" }, { "docid": "29ffb49d95525392b0c55f578a7e9187", "score": "0.51527905", "text": "func (s Signature) String() string {\n\tif len(s) > 0 {\n\t\tseq := make([]string, len(s))\n\t\tfor i, t := range s {\n\t\t\tseq[i] = strconv.Quote(t.String())\n\t\t}\n\n\t\treturn strings.Join(seq, \"/\")\n\t}\n\n\treturn \"empty\"\n}", "title": "" }, { "docid": "e1a37d06fe73174b87d4888cb5878981", "score": "0.5150916", "text": "func (this *CallIdentifier) String() string {\n\tif this.host != \"\" {\n\t\treturn this.localId + core.SIPSeparatorNames_AT + this.host\n\t} else {\n\t\treturn this.localId\n\t}\n}", "title": "" }, { "docid": "bc8814b2a668bfed4d6e3e54985d2039", "score": "0.5147301", "text": "func Subject() Source {\n\tsinks := make([]Source, 0)\n\n\treturn func(p Payload) {\n\t\tswitch v := p.(type) {\n\t\tcase Greets:\n\t\t\tsink := v.Source()\n\t\t\tsinks = append(sinks, sink)\n\n\t\t\tsink(NewGreets(func(p Payload) {\n\t\t\t\tif _, ok := p.(Terminate); ok {\n\t\t\t\t\tidx := -1\n\t\t\t\t\tfor i, s := range sinks {\n\t\t\t\t\t\t// Need to compare pointers than actual value of func type\n\t\t\t\t\t\tif &s == &sink {\n\t\t\t\t\t\t\tidx = i\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif idx != -1 {\n\t\t\t\t\t\tsinks[idx] = sinks[len(sinks)-1]\n\t\t\t\t\t\tsinks[len(sinks)-1] = nil\n\t\t\t\t\t\tsinks = sinks[:len(sinks)-1]\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}))\n\t\tdefault:\n\t\t\tfor _, sink := range sinks {\n\t\t\t\tsink(v)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "6c7be909e87ca37930b0d8668a69c345", "score": "0.51467615", "text": "func (msg *OutgoingMessage) String() string {\n\treturn msg.headers.String()\n}", "title": "" }, { "docid": "dc68cfa9086710febf11181722e7e39b", "score": "0.514164", "text": "func MsgToString(m *protos.Message) string {\n\tif m == nil {\n\t\treturn \"empty message\"\n\t}\n\tswitch m.GetContent().(type) {\n\tcase *protos.Message_PrePrepare:\n\t\treturn prePrepareToString(m.GetPrePrepare())\n\tcase *protos.Message_NewView:\n\t\treturn newViewToString(m.GetNewView())\n\tcase *protos.Message_ViewData:\n\t\treturn signedViewDataToString(m.GetViewData())\n\tcase *protos.Message_HeartBeat:\n\t\treturn heartBeatToString(m.GetHeartBeat())\n\tcase *protos.Message_HeartBeatResponse:\n\t\treturn heartBeatResponseToString(m.GetHeartBeatResponse())\n\tdefault:\n\t\treturn m.String()\n\t}\n}", "title": "" }, { "docid": "61e39aec237b94cc4e1fedaa204deda0", "score": "0.514078", "text": "func (m *Message) String() string {\n\tvar name, payload, checksum string\n\tswitch m.Type {\n\tcase MsgConnect:\n\t\tname = \"Connect\"\n\tcase MsgData:\n\t\tname = \"Data\"\n\t\tchecksum = \" \" + strconv.Itoa(int(m.Checksum))\n\t\tpayload = \" \" + string(m.Payload)\n\tcase MsgAck:\n\t\tname = \"Ack\"\n\tcase MsgCAck:\n\t\tname = \"CAck\"\n\t}\n\treturn fmt.Sprintf(\"[%s %d %d%s%s]\", name, m.ConnID, m.SeqNum, checksum, payload)\n}", "title": "" }, { "docid": "ebbb20da83ae747d087963282d254725", "score": "0.5132337", "text": "func (message *ElectronicMessage) Subject() string {\n\treturn message.subject\n}", "title": "" }, { "docid": "5e1bd2b4aeec04750b6b312b3ea12c7b", "score": "0.51322794", "text": "func (o ExportRecurrencePeriodOutput) From() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ExportRecurrencePeriod) string { return v.From }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fa53e7cec48b7a9831b0ff45cb62d662", "score": "0.5131702", "text": "func (subbed *Subscribed) String() string {\r\n\treturn fmt.Sprint(*subbed)\r\n}", "title": "" }, { "docid": "2e86f97e540438e5c3594dca21f8355c", "score": "0.51281583", "text": "func (p person) toString() string {\n\treturn p.name + \" \" + p.surname\n}", "title": "" }, { "docid": "8490541582d30e4057bf3f4fd45f4d2b", "score": "0.5124284", "text": "func (m Message) String() string {\n\treturn fmt.Sprintf(\"\\nBody:\\t\\t\\t\\t%s\\nBodySize:\\t\\t\\t%d\\nVisible:\\t\\t\\t%t\\nHasAttachment:\\t\\t\\t%t\\nFinalDestination:\\t\\t%s\\nMessageType:\\t\\t\\t%s\\nDeleted:\\t\\t\\t%t\\nId:\\t\\t\\t\\t%d\\nStatusCode:\\t\\t\\t%d\\nMessageTransport:\\t\\t%d\\nDateCreated:\\t\\t\\t%s\\nRead:\\t\\t\\t\\t%t\\nFinalSource:\\t\\t\\t%s\\nDeviceId:\\t\\t\\t%d\\n\", m.Body, m.BodySize, m.Visible, m.HasAttachment, m.FinalDestination, m.MessageType, m.Deleted, m.Id, m.StatusCode, m.MessageTransport, m.DateCreated, m.Read, m.FinalSource, m.DeviceId)\n}", "title": "" }, { "docid": "baf2d23bb0523ecdb765099e1b32b5e0", "score": "0.51196223", "text": "func (pac *Packet) From() string {\n\treturn C.GoString((*C.char)(unsafe.Pointer(&pac.packet[1])))\n}", "title": "" }, { "docid": "2fe6e387c9c6d62ce98796feab80e053", "score": "0.5119398", "text": "func (q *Query) String() string {\n\ta := make([]string, len(q.Calls))\n\tfor i, call := range q.Calls {\n\t\ta[i] = call.String()\n\t}\n\treturn strings.Join(a, \"\\n\")\n}", "title": "" }, { "docid": "a0395869e2a7cb0d431be0b0a9ffc267", "score": "0.51144737", "text": "func subjectFromSession(c *gin.Context) string {\n\t// Get session ID from cookie.\n\tsessionId, err := c.Cookie(\"SESSIONID\")\n\tif err != nil {\n\t\t// Cookie not found.\n\t\treturn \"\"\n\t}\n\n\t// Get subject from session.\n\tsession := sessions.Default(c)\n\tif subject, ok := session.Get(sessionId).(string); !ok {\n\t\treturn \"\"\n\t} else {\n\t\treturn subject\n\t}\n}", "title": "" }, { "docid": "c157c0c926aa44d06702e8c9215e9fb4", "score": "0.5111133", "text": "func (m *Message) String() string {\n\treturn fmt.Sprintf(\"%s: %v\\n\", m.Channel, m.Data)\n}", "title": "" }, { "docid": "800f0669d28926951a0670e3c0b8da68", "score": "0.5110766", "text": "func (m *Message) String() string {\n\treturn fmt.Sprintf(\"%s %s (%dbytes)\", types[m.Type], m.Route, len(m.Data))\n}", "title": "" }, { "docid": "800f0669d28926951a0670e3c0b8da68", "score": "0.5110766", "text": "func (m *Message) String() string {\n\treturn fmt.Sprintf(\"%s %s (%dbytes)\", types[m.Type], m.Route, len(m.Data))\n}", "title": "" }, { "docid": "73faad8bbcaf2fd181fbb2a12d9d7bdd", "score": "0.51105267", "text": "func (v Email) String() string {\n\treturn v.value\n}", "title": "" }, { "docid": "4c5b2950e4ef82068ff9ea220c4b76ac", "score": "0.5108814", "text": "func (d *Delivery) String() string {\n\treturn fmt.Sprintf(\"%s D %s %s => %s\",\n\t\td.Timestamp, d.TransmissionID, d.Binding, d.Recipient)\n}", "title": "" }, { "docid": "382b0df68951be07202076d3c0e9c8f0", "score": "0.5106584", "text": "func (s Signature) String() string {\n\treturn Pack58(s[:])\n}", "title": "" }, { "docid": "e3bc3f0dca6c520d427788eaa4a98077", "score": "0.51035035", "text": "func (f *funcVal) String(context.Context) string {\n\treturn fmt.Sprintf(\"<func %s (%p)>\", f.name, f)\n}", "title": "" }, { "docid": "70f66ce1d8562cc3306803eee369d2d9", "score": "0.51028454", "text": "func GetSubject(m map[string]interface{}) string {\n\tsub, ok := m[\"sub\"]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\tsubStr, ok := sub.(string)\n\tif !ok {\n\t\treturn \"\"\n\t}\n\treturn subStr\n}", "title": "" }, { "docid": "8a40cc78de88d6c8f7237d9b14b6e151", "score": "0.5097076", "text": "func (m Message) String() string {\n\tif m.Tag.isSecret() {\n\t\treturn fmt.Sprintf(\"{ %s %s %v }\", m.Tag, m.DataType, secretReplaceString)\n\t}\n\treturn fmt.Sprintf(\"{ %s %s %v }\", m.Tag, m.DataType, m.Value)\n}", "title": "" }, { "docid": "475634897cea56833c8346c569e72375", "score": "0.5092047", "text": "func (w *Producer) String() string {\n\treturn w.addr\n}", "title": "" }, { "docid": "915c2400dd8da58a9fe946b730967798", "score": "0.5089973", "text": "func (id OTID) Subject() string {\n\tif id.IsDomainID() {\n\t\treturn \"\"\n\t}\n\treturn fmt.Sprintf(\"%s:%s\", id.subjectType, id.subjectID)\n}", "title": "" }, { "docid": "37a43ad1474390af1beffd649b47c8d3", "score": "0.5079928", "text": "func (m *Message) String() string {\n\treturn string(m.Bytes())\n}", "title": "" }, { "docid": "afeb74d93906c883c44d4e4ff3669063", "score": "0.50790644", "text": "func (m *Message) Subject() string {\n\treturn m.GetHeader(\"Subject\")\n}", "title": "" }, { "docid": "57263ee8c0e337cc766292e315f843e5", "score": "0.50732476", "text": "func (m *Message) String() string {\n\treturn fmt.Sprintf(\"Type: %s, ID: %d, Compressed: %t, Error: %t, Data: %v, BodyLength: %d\",\n\t\ttypes[m.Type],\n\t\tm.ID,\n\t\tm.Compressed,\n\t\tm.Err,\n\t\tm.Data,\n\t\tlen(m.Data))\n}", "title": "" }, { "docid": "55a23abb427c4914d3dcc588bede0e04", "score": "0.50496507", "text": "func (m Message) String() string {\n\tvar msg, format strings.Builder\n\tif m.Bold {\n\t\tformat.WriteString(\"1;\")\n\t}\n\tif m.Italic {\n\t\tformat.WriteString(\"3;\")\n\t}\n\tif m.UnderLined {\n\t\tformat.WriteString(\"4;\")\n\t}\n\tif m.StrikeThrough {\n\t\tformat.WriteString(\"9;\")\n\t}\n\tif m.Color != \"\" {\n\t\tformat.WriteString(colors[m.Color] + \";\")\n\t}\n\tif format.Len() > 0 {\n\t\tmsg.WriteString(\"\\033[\" + format.String()[:format.Len()-1] + \"m\")\n\t}\n\n\ttext, ok := TransCtrlSeq(m.Text, true)\n\tmsg.WriteString(text)\n\n\t// handle translate\n\tif m.Translate != \"\" {\n\t\targs := make([]any, len(m.With))\n\t\tfor i, v := range m.With {\n\t\t\targs[i] = v\n\t\t}\n\n\t\t_, _ = fmt.Fprintf(&msg, translateMap[m.Translate], args...)\n\t}\n\n\tif m.Extra != nil {\n\t\tfor i := range m.Extra {\n\t\t\tmsg.WriteString(m.Extra[i].String())\n\t\t}\n\t}\n\n\tif format.Len() > 0 || ok {\n\t\tmsg.WriteString(\"\\033[0m\")\n\t}\n\treturn msg.String()\n}", "title": "" }, { "docid": "18de85f984a5f0e8fec7f62edb62ef2d", "score": "0.5048793", "text": "func String(modifier AnchorType, key string) string {\n\tif key == \"\" {\n\t\treturn \"\"\n\t}\n\treturn string(modifier) + \"(\" + key + \")\"\n}", "title": "" }, { "docid": "3c3a73752da9e8c6a9acfdbf137c60a8", "score": "0.5047969", "text": "func (d *RelayDelivery) String() string {\n\treturn fmt.Sprintf(\"%s RD %s %s <= %s\",\n\t\td.Timestamp, d.RelayID, d.Binding, d.MessageFrom)\n}", "title": "" }, { "docid": "7c142c0af1b0702ad49681102a11b648", "score": "0.50457615", "text": "func (s Schedule) String() string {\n\tcomps := make([]string, len(s))\n\tfor i, x := range s {\n\t\tcomps[i] = x.String()\n\t}\n\treturn strings.Join(comps, \" \")\n}", "title": "" }, { "docid": "fb049264ec2bbd41a7a18add20efd1ec", "score": "0.5045079", "text": "func (s *sequence) String() string {\n\treturn fmt.Sprintf(\"sequence:{leader:%d,seq:%d}\", s.leader, s.seq)\n}", "title": "" } ]
481a1ee9de8c42e921a6f85ea6ad3d1b
Merge all dirty table/segment/block of a table into one tree
[ { "docid": "54e6336a509feeaa1f3bbcf891366fcb", "score": "0.49945334", "text": "func (r *Reader) GetDirtyByTable(\n\tdbID, id uint64,\n) (tree *model.TableTree) {\n\ttree = model.NewTableTree(dbID, id)\n\top := func(row RowT) (moveOn bool) {\n\t\tif memo := row.GetMemo(); memo.HasTableDataChanges(id) {\n\t\t\ttree.Merge(memo.GetDirtyTableByID(id))\n\t\t}\n\t\treturn true\n\t}\n\tr.table.ForeachRowInBetween(r.from, r.to, nil, op)\n\treturn\n}", "title": "" } ]
[ { "docid": "2b2273ec1fcb83504357b8bb65a2c6b9", "score": "0.54579896", "text": "func (fup *folderUpdatePrepper) prepTree(\n\tctx context.Context, lState *kbfssync.LockState, unmergedChains *crChains,\n\tnewMD *RootMetadata, chargedTo keybase1.UserOrTeamID, node *pathTreeNode,\n\tstopAt data.BlockPointer, dbm dirBlockMap, newFileBlocks fileBlockMap,\n\tdirtyBcache data.DirtyBlockCacheSimple, bps blockPutState,\n\tcopyBehavior prepFolderCopyBehavior) error {\n\t// If this has no children, then sync it, as far back as stopAt.\n\tif len(node.children) == 0 {\n\t\t// Look for the directory block or the new file block.\n\t\tentryType := data.Dir\n\t\thasDirBlock, err := dbm.hasBlock(ctx, node.ptr)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\t// non-nil exactly when entryType != Dir.\n\t\tvar block data.Block\n\t\tvar fblock *data.FileBlock\n\t\tif hasDirBlock {\n\t\t\tdirBlock, err := dbm.getBlock(ctx, node.ptr)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tblock = dirBlock\n\t\t} else {\n\t\t\t// This must be a file, so look it up in the parent\n\t\t\tif node.parent == nil {\n\t\t\t\treturn fmt.Errorf(\"No parent found for node %v while \"+\n\t\t\t\t\t\"syncing path %v\", node.ptr, node.mergedPath.Path)\n\t\t\t}\n\n\t\t\tvar err error\n\t\t\tfblock, err = newFileBlocks.GetTopBlock(\n\t\t\t\tctx, node.parent.ptr, node.mergedPath.TailName())\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tblock = fblock\n\t\t\tentryType = data.File // TODO: FIXME for Ex and Sym\n\t\t}\n\n\t\t// For an indirect file block, make sure a new\n\t\t// reference is made for every child block.\n\t\tif copyBehavior == prepFolderCopyIndirectFileBlocks &&\n\t\t\tentryType != data.Dir && fblock.IsInd {\n\t\t\tvar infos []data.BlockInfo\n\t\t\tvar err error\n\n\t\t\t// If journaling is enabled, new references aren't\n\t\t\t// supported. We have to fetch each block and ready\n\t\t\t// it. TODO: remove this when KBFS-1149 is fixed.\n\t\t\tif TLFJournalEnabled(fup.config, fup.id()) {\n\t\t\t\tinfos, err = fup.blocks.UndupChildrenInCopy(\n\t\t\t\t\tctx, lState, newMD.ReadOnly(), node.mergedPath, bps,\n\t\t\t\t\tdirtyBcache, fblock)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t// Ready any mid-level internal children.\n\t\t\t\t_, err = fup.blocks.ReadyNonLeafBlocksInCopy(\n\t\t\t\t\tctx, lState, newMD.ReadOnly(), node.mergedPath, bps,\n\t\t\t\t\tdirtyBcache, fblock)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tinfos, err = fup.blocks.\n\t\t\t\t\tGetIndirectFileBlockInfosWithTopBlock(\n\t\t\t\t\t\tctx, lState, newMD.ReadOnly(), node.mergedPath, fblock)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\n\t\t\t\tfor _, info := range infos {\n\t\t\t\t\t// The indirect blocks were already added to\n\t\t\t\t\t// childBps, so only add the dedup'd leaf blocks.\n\t\t\t\t\tif info.RefNonce != kbfsblock.ZeroRefNonce {\n\t\t\t\t\t\terr = bps.AddNewBlock(\n\t\t\t\t\t\t\tctx, info.BlockPointer, nil, data.ReadyBlockData{}, nil)\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\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, info := range infos {\n\t\t\t\tnewMD.AddRefBlock(info)\n\t\t\t}\n\t\t}\n\n\t\t// Assume the mtime/ctime are already fixed up in the blocks\n\t\t// in the dbm.\n\t\t_, _, err = fup.prepUpdateForPath(\n\t\t\tctx, lState, chargedTo, newMD, block, node.ptr,\n\t\t\t*node.mergedPath.ParentPath(), node.mergedPath.TailName(),\n\t\t\tentryType, false, false, stopAt, dbm, bps)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\t}\n\n\t// If there is more than one child, use this node as the stopAt\n\t// since it is the branch point, except for the last child.\n\tcount := 0\n\tfor _, child := range node.children {\n\t\tlocalStopAt := node.ptr\n\t\tcount++\n\t\tif count == len(node.children) {\n\t\t\tlocalStopAt = stopAt\n\t\t}\n\t\terr := fup.prepTree(\n\t\t\tctx, lState, unmergedChains, newMD, chargedTo, child, localStopAt,\n\t\t\tdbm, newFileBlocks, dirtyBcache, bps, copyBehavior)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "de596f9247d51c17b48bf55e2dd58d86", "score": "0.5377313", "text": "func (diffStore *utxoDiffStore) flushToDB(dbContext *dbaccess.TxContext) error {\n\tdiffStore.mtx.HighPriorityWriteLock()\n\tdefer diffStore.mtx.HighPriorityWriteUnlock()\n\tif len(diffStore.dirty) == 0 {\n\t\treturn nil\n\t}\n\n\t// Allocate a buffer here to avoid needless allocations/grows\n\t// while writing each entry.\n\tbuffer := &bytes.Buffer{}\n\tfor node := range diffStore.dirty {\n\t\tbuffer.Reset()\n\t\tdiffData := diffStore.loaded[node]\n\t\terr := storeDiffData(dbContext, buffer, node.hash, diffData)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "26a31066ca33fa9ca503a97825db79bb", "score": "0.53137225", "text": "func (db *merkleDB) rebuild(ctx context.Context) error {\n\tdb.root = newNode(nil, RootPath)\n\tif err := db.nodeDB.Delete(rootKey); err != nil {\n\t\treturn err\n\t}\n\tit := db.nodeDB.NewIterator()\n\tdefer it.Release()\n\n\tviewSizeLimit := math.Max(\n\t\tdb.nodeCache.maxSize/rebuildViewSizeFractionOfCacheSize,\n\t\tminRebuildViewSizePerCommit,\n\t)\n\tcurrentOps := make([]database.BatchOp, 0, viewSizeLimit)\n\n\tfor it.Next() {\n\t\tif len(currentOps) >= viewSizeLimit {\n\t\t\tview, err := db.newUntrackedView(currentOps)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := view.commitToDB(ctx); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcurrentOps = make([]database.BatchOp, 0, viewSizeLimit)\n\t\t}\n\n\t\tkey := it.Key()\n\t\tpath := path(key)\n\t\tvalue := it.Value()\n\t\tn, err := parseNode(path, value)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tcurrentOps = append(currentOps, database.BatchOp{\n\t\t\tKey: path.Serialize().Value,\n\t\t\tValue: n.value.Value(),\n\t\t\tDelete: !n.hasValue(),\n\t\t})\n\t}\n\tif err := it.Error(); err != nil {\n\t\treturn err\n\t}\n\tview, err := db.newUntrackedView(currentOps)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err := view.commitToDB(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn db.nodeDB.Compact(nil, nil)\n}", "title": "" }, { "docid": "39fcdf8824d797ee1dc5054945721187", "score": "0.528182", "text": "func (w *World) MergeTables(e *libEnvContext, root, src *lua.LTable, path ...string) {\n\tif root == nil {\n\t\tpanic(\"merge table: destination is nil\")\n\t}\n\tif src == nil {\n\t\tpanic(\"merge table: source is nil\")\n\t}\n\tdst := root\n\tfor _, index := range path {\n\t\tswitch sub := dst.RawGetString(index).(type) {\n\t\tcase *lua.LTable:\n\t\t\tdst = sub\n\t\tdefault:\n\t\t\t// Overwrite any non-table value with a table.\n\t\t\tsubtable := w.l.CreateTable(0, 4)\n\t\t\tdst.RawSetString(index, subtable)\n\t\t\tdst = subtable\n\t\t}\n\t\te.AppendPath(index)\n\t}\n\t// Some libraries set a metatable.\n\tif src.Metatable != nil {\n\t\tdst.Metatable = src.Metatable\n\t}\n\ts := w.State()\n\tsrc.ForEach(func(k, v lua.LValue) error {\n\t\tif v, ok := v.(*lua.LTable); ok {\n\t\t\tif d := dst.RawGet(k).(*lua.LTable); ok {\n\t\t\t\tw.MergeTables(e.Index(s, k), d, v)\n\t\t\t\treturn nil\n\t\t\t}\n\t\t}\n\t\tdst.RawSet(k, v)\n\t\te.EmitEvent(w, k)\n\t\treturn nil\n\t})\n}", "title": "" }, { "docid": "e990f3bbb73699a4e10cc443a04301a6", "score": "0.5198622", "text": "func (f *Forest) reHash(dirt []uint64) error {\n\tif f.height == 0 || len(dirt) == 0 { // nothing to hash\n\t\treturn nil\n\t}\n\ttops, topheights := getTopsReverse(f.numLeaves, f.height)\n\t// fmt.Printf(\"nl %d f.h %d tops %v\\n\", f.numLeaves, f.height, tops)\n\n\tdirty2d := make([][]uint64, f.height)\n\th := uint8(0)\n\tdirtyRemaining := 0\n\tfor _, pos := range dirt {\n\t\tif pos > f.numLeaves {\n\t\t\treturn fmt.Errorf(\"Dirt %d exceeds numleaves %d\", pos, f.numLeaves)\n\t\t}\n\t\tdHeight := detectHeight(pos, f.height)\n\t\t// increase height if needed\n\t\tfor h < dHeight {\n\t\t\th++\n\t\t}\n\t\tif h > f.height {\n\t\t\treturn fmt.Errorf(\"postion %d at height %d but forest only %d high\",\n\t\t\t\tpos, h, f.height)\n\t\t}\n\t\t// if bridgeVerbose {\n\t\t// fmt.Printf(\"h %d\\n\", h)\n\t\t// }\n\t\tdirty2d[h] = append(dirty2d[h], pos)\n\t\tdirtyRemaining++\n\t}\n\n\t// this is basically the same as VerifyBlockProof. Could maybe split\n\t// it to a separate function to reduce redundant code..?\n\t// nah but pretty different beacuse the dirtyMap has stuff that appears\n\t// halfway up...\n\n\tvar currentRow, nextRow []uint64\n\n\t// floor by floor\n\tfor h = uint8(0); h < f.height; h++ {\n\t\tif bridgeVerbose {\n\t\t\tfmt.Printf(\"dirty %v\\ncurrentRow %v\\n\", dirty2d[h], currentRow)\n\t\t}\n\n\t\t// merge nextRow and the dirtySlice. They're both sorted so this\n\t\t// should be quick. Seems like a CS class kindof algo but who knows.\n\t\t// Should be O(n) anyway.\n\n\t\tcurrentRow = mergeSortedSlices(currentRow, dirty2d[h])\n\t\tdirtyRemaining -= len(dirty2d[h])\n\t\tif dirtyRemaining == 0 && len(currentRow) == 0 {\n\t\t\t// done hashing early\n\t\t\tbreak\n\t\t}\n\n\t\tfor i, pos := range currentRow {\n\t\t\t// skip if next is sibling\n\t\t\tif i+1 < len(currentRow) && currentRow[i]|1 == currentRow[i+1] {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif len(tops) == 0 {\n\t\t\t\treturn fmt.Errorf(\n\t\t\t\t\t\"currentRow %v no tops remaining, this shouldn't happen\",\n\t\t\t\t\tcurrentRow)\n\t\t\t}\n\t\t\t// also skip if this is a top\n\t\t\tif pos == tops[0] {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tright := pos | 1\n\t\t\tleft := right ^ 1\n\t\t\tparpos := up1(left, f.height)\n\n\t\t\t//\t\t\t\tfmt.Printf(\"bridge hash %d %04x, %d %04x -> %d\\n\",\n\t\t\t//\t\t\t\t\tleft, leftHash[:4], right, rightHash[:4], parpos)\n\t\t\tif f.data.read(left) == empty || f.data.read(right) == empty {\n\t\t\t\tf.data.write(parpos, empty)\n\t\t\t} else {\n\t\t\t\tpar := Parent(f.data.read(left), f.data.read(right))\n\t\t\t\tf.HistoricHashes++\n\t\t\t\tf.data.write(parpos, par)\n\t\t\t}\n\t\t\tnextRow = append(nextRow, parpos)\n\t\t}\n\t\tif topheights[0] == h {\n\t\t\ttops = tops[1:]\n\t\t\ttopheights = topheights[1:]\n\t\t}\n\t\tcurrentRow = nextRow\n\t\tnextRow = []uint64{}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "394c57ee473d7a66b19c246dd99e44ca", "score": "0.5183124", "text": "func (t *Tables) FileTree() filetree.FileTree { return t }", "title": "" }, { "docid": "c3e243b2a3293ebe6f078758a5b82332", "score": "0.5165551", "text": "func (rt *RTree) condenseTree(n *node) {\n\t//CT1 [initialize]\n\tq := []entry{} // Contains orphaned entries\n\tfor rt.root != n {\n\t\t//CT2 [find parent entry]\n\t\tp := n.parent\n\t\tidx, err := n.parentEntriesIdx()\n\t\tCheckErr(err, \"Trouble condensing the tree\")\n\t\ten := p.entries[idx] // the entry containing n\n\t\t//CT3 [eliminate under-full node]\n\t\tif len(n.entries) < RTree_m {\n\t\t\tp.entries = append(p.entries[:idx], p.entries[idx+1:]...) //[8] remove n from its parent\n\t\t\tq = append(q, en.child.entries...)\n\t\t} else {\n\t\t\t//CT4 [Adjust MBR] (if n has not been eliminated)\n\t\t\ten.mbr = n.recalculateMBR()\n\t\t}\n\t\tn = p // CT5 [Move up one height in tree]\n\t}\n\t//CT6 [Re-insert orphaned entries]\n\tfor _, e := range q {\n\t\tif e.child != nil { //inserting an internal\n\t\t\terr := rt.insert(e.child.height+1, e, true) //TODO false or true?\n\t\t\tCheckErr(err, \"Unable to re-insert an orphaned entry\")\n\t\t\t_, err = e.child.parent.parentEntriesIdx()\n\t\t\tCheckErr(err, \"Cannot find parent of re-inserted orphaned internal entry\")\n\t\t} else { //inserting a leaf entry\n\t\t\terr := rt.insert(0, e, true) //TODO false or true?\n\t\t\tCheckErr(err, \"Error re-inserting orphaned entry\")\n\t\t}\n\t}\n\t//D4 [Shorten tree] (if root has only 1 child, promote that child to root)\n\tif len(rt.root.entries) == 1 {\n\t\trt.root = rt.root.entries[0].child\n\t\trt.root.parent = nil\n\t\t//fmt.Printf(\"Promoted a child to root, new height is %d\\n\", rt.root.height)\n\t}\n}", "title": "" }, { "docid": "74be93d453a0d87bc8b4fed65c4c33b0", "score": "0.5148098", "text": "func (stateObj *stateObject) updateRoot(db StateDatabase) {\n\t// If nothing changed, don't bother with hashing anything\n\tif stateObj.updateTrie(db) == nil {\n\t\treturn\n\t}\n\t// Track the amount of time wasted on hashing the storage trie\n\tif metrics.EnabledExpensive {\n\t\tdefer func(start time.Time) { stateObj.db.StorageHashes += time.Since(start) }(time.Now())\n\t}\n\tstateObj.data.Root = stateObj.trie.Hash()\n}", "title": "" }, { "docid": "1a7e3be1e166f70097d974e9f28cf50c", "score": "0.5129227", "text": "func (obj *StateObject) updateRoot(db Database) {\n\tobj.updateTrie(db)\n\tobj.data.StorageRoot = obj.trie.Hash()\n}", "title": "" }, { "docid": "e9d91eb05d186d9ac3e0b0f3b39db109", "score": "0.5114341", "text": "func (fbo *folderBranchOps) undoUnmergedMDUpdatesLocked(\n\tctx context.Context, lState *kbfssync.LockState) ([]data.BlockPointer, error) {\n\tfbo.mdWriterLock.AssertLocked(lState)\n\n\tcurrHead, unmergedRmds, err := fbo.getUnmergedMDUpdatesLocked(ctx, lState)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = fbo.undoMDUpdatesLocked(ctx, lState, unmergedRmds)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// We have arrived at the branch point. The new root is\n\t// the previous revision from the current head. Find it\n\t// and apply. TODO: somehow fake the current head into\n\t// being currHead-1, so that future calls to\n\t// applyMDUpdates will fetch this along with the rest of\n\t// the updates.\n\tfbo.setBranchIDLocked(lState, kbfsmd.NullBranchID)\n\n\trmd, err := GetSingleMD(ctx, fbo.config, fbo.id(), kbfsmd.NullBranchID,\n\t\tcurrHead, kbfsmd.Merged, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = func() error {\n\t\tfbo.headLock.Lock(lState)\n\t\tdefer fbo.headLock.Unlock(lState)\n\t\terr = fbo.setHeadPredecessorLocked(ctx, lState, rmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfbo.setLatestMergedRevisionLocked(ctx, lState, rmd.Revision(), true)\n\t\treturn nil\n\t}()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Return all new refs\n\tvar unmergedPtrs []data.BlockPointer\n\tfor _, rmd := range unmergedRmds {\n\t\tfor _, op := range rmd.data.Changes.Ops {\n\t\t\tfor _, ptr := range op.Refs() {\n\t\t\t\tif ptr != data.ZeroPtr {\n\t\t\t\t\tunflushed, err := fbo.config.BlockServer().IsUnflushed(\n\t\t\t\t\t\tctx, fbo.id(), ptr.ID)\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\tif !unflushed {\n\t\t\t\t\t\tunmergedPtrs = append(unmergedPtrs, ptr)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor _, update := range op.allUpdates() {\n\t\t\t\tif update.Ref != data.ZeroPtr {\n\t\t\t\t\tunflushed, err := fbo.config.BlockServer().IsUnflushed(\n\t\t\t\t\t\tctx, fbo.id(), update.Ref.ID)\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\tif !unflushed {\n\t\t\t\t\t\tunmergedPtrs = append(unmergedPtrs, update.Ref)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn unmergedPtrs, nil\n}", "title": "" }, { "docid": "d1f7ef5553b09983ba53e59860e978ad", "score": "0.50639635", "text": "func (self *StateObject) updateRoot(db trie.Database) {\n\tself.updateTrie(db)\n\tself.data.Root = self.trie.Hash()\n}", "title": "" }, { "docid": "b359d3789e40f70dcb43e571003d1d71", "score": "0.50364506", "text": "func writeTree(in *inode, disk []byte, root *disklayout.ExtentNode, mockExtentBlkSize uint64) []byte {\n\trootData := binary.Marshal(nil, binary.LittleEndian, root.Header)\n\tfor _, ep := range root.Entries {\n\t\trootData = binary.Marshal(rootData, binary.LittleEndian, ep.Entry)\n\t}\n\n\tcopy(in.diskInode.Data(), rootData)\n\n\tvar fileData []byte\n\tfor _, ep := range root.Entries {\n\t\tif root.Header.Height == 0 {\n\t\t\tfileData = append(fileData, writeFileDataToExtent(disk, ep.Entry.(*disklayout.Extent))...)\n\t\t} else {\n\t\t\tfileData = append(fileData, writeTreeToDisk(disk, ep)...)\n\t\t}\n\t}\n\treturn fileData\n}", "title": "" }, { "docid": "b305ad3b968915e9cc260df6b600ad60", "score": "0.50184876", "text": "func (t *LSMTree) flushMemTable() error {\n\tnewDiskTableNum := t.diskTableNum + 1\n\tnewDiskTableIndex := t.maxDiskTableIndex + 1\n\n\tif err := createDiskTable(t.memTable, t.dbDir, newDiskTableIndex, t.sparseKeyDistance); err != nil {\n\t\treturn fmt.Errorf(\"failed to create disk table %d: %w\", newDiskTableIndex, err)\n\t}\n\n\tif err := updateDiskTableMeta(t.dbDir, newDiskTableNum, newDiskTableIndex); err != nil {\n\t\treturn fmt.Errorf(\"failed to update max disk table index %d: %w\", newDiskTableIndex, err)\n\t}\n\n\tnewWAL, err := clearWAL(t.dbDir, t.wal)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to clear the WAL file: %w\", err)\n\t}\n\n\tt.wal = newWAL\n\tt.memTable.clear()\n\tt.diskTableNum = newDiskTableNum\n\tt.maxDiskTableIndex = newDiskTableIndex\n\n\treturn nil\n}", "title": "" }, { "docid": "44066d8ad1cb038bc282c1d57a8bc613", "score": "0.500301", "text": "func (bpt *BplusTree) update(opErr error) error {\n\tvar err error = nil\n\tdefer bpt.resetTracker()\n\n\tglog.V(2).Infof(\"updating with following trakcers (err: %v)\", opErr)\n\tglog.V(2).Infof(\"orig: %v\", bpt.tracker.origNodes)\n\tglog.V(2).Infof(\"updated: %v\", bpt.tracker.updatedNodes)\n\tglog.V(2).Infof(\"new: %v\", bpt.tracker.newNodes)\n\tglog.V(2).Infof(\"deleted: %v\", bpt.tracker.deletedNodes)\n\t// if the operation so far has resulted in error, then just roll back the\n\t// updates on 'updateList' with values in 'origList'.\n\tif opErr != nil {\n\t\tbpt.rollback()\n\t\treturn opErr\n\t}\n\n\tnumUpdates := len(bpt.tracker.updatedNodes.kmap) + len(bpt.tracker.newNodes.kmap) +\n\t\tlen(bpt.tracker.deletedNodes.kmap)\n\tif bpt.tracker.rootKeyUpdated {\n\t\tnumUpdates++\n\t}\n\tdbUpdates := make([]common.DBOp, numUpdates)\n\tindex := 0\n\tfor k, e := range bpt.tracker.updatedNodes.kmap {\n\t\tglog.V(2).Infof(\"Adding %v (%v) to store list\", k, e)\n\t\tdbUpdates[index] = common.DBOp{Op: common.DBOpStore, K: k, E: e}\n\t\tindex++\n\t}\n\tfor k, e := range bpt.tracker.newNodes.kmap {\n\t\tglog.V(2).Infof(\"Adding %v (%v) to store list\", k, e)\n\t\tdbUpdates[index] = common.DBOp{Op: common.DBOpStore, K: k, E: e}\n\t\tindex++\n\t}\n\tfor k := range bpt.tracker.deletedNodes.kmap {\n\t\tglog.V(2).Infof(\"Adding %v to delete list\", k)\n\t\tdbUpdates[index] = common.DBOp{Op: common.DBOpDelete, K: k, E: nil}\n\t\tindex++\n\t}\n\tif bpt.tracker.rootKeyUpdated {\n\t\tdbUpdates[index] = common.DBOp{Op: common.DBOpSetRoot, K: common.Key{},\n\t\t\tE: &Base{bpt.rootKey, bpt.context.maxDegree}}\n\t\tindex++\n\t}\n\n\tif numUpdates > 0 {\n\t\tif TestPointExecute(testPointFailDBUpdate) {\n\t\t\terr = common.ErrDBUpdateFailed\n\t\t} else {\n\t\t\terr = bpt.context.dbMgr.AtomicUpdate(dbUpdates)\n\t\t}\n\t\tif err != nil {\n\t\t\tglog.Errorf(\"falied to store keys %v to DB (err: %v)\", dbUpdates, err)\n\t\t\tbpt.rollback()\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// If we are here then update to DB is successful. We just need to now\n\t// insert all the new nodes in memory manager.\n\tfor k, e := range bpt.tracker.newNodes.kmap {\n\t\t_ = bpt.context.memMgr.Insert(k, e)\n\t}\n\t// Remove deleted nodes from mem manager.\n\tfor k := range bpt.tracker.deletedNodes.kmap {\n\t\t_ = bpt.context.memMgr.Remove(k)\n\t}\n\n\treturn opErr\n}", "title": "" }, { "docid": "41488a64c367f719baac21eb72064609", "score": "0.5002616", "text": "func (delegateObject *delegateObject) updateRoot(db Database) {\n\tdelegateObject.updateTrie(db)\n\tdelegateObject.data.Root = delegateObject.trie.Hash()\n}", "title": "" }, { "docid": "3c5ca98356607a1c3f3518ed20625a7b", "score": "0.49999198", "text": "func (t *MCTS) cleanup(oldRoot, newRoot naughty) {\n\tchildren := t.Children(oldRoot)\n\t// we aint going down other paths, those nodes can be freed\n\tfor _, kid := range children {\n\t\tif kid != newRoot {\n\t\t\tt.nodeFromNaughty(kid).Invalidate()\n\t\t\tt.freeables = append(t.freeables, kid)\n\t\t\tt.cleanChildren(kid)\n\t\t}\n\t}\n\tt.Lock()\n\tt.children[oldRoot] = t.children[oldRoot][:1]\n\tt.children[oldRoot][0] = newRoot\n\tt.Unlock()\n}", "title": "" }, { "docid": "8279a6b559796035db2a15fcba6db50a", "score": "0.4999654", "text": "func (txState *TxState) SyncToDisk(height int64) (hashRoot string, err error) {\n\tif txState.Txs.Len() == 0 {\n\t\treturn txState.Txs.HashRoot(), nil\n\t}\n\n\tsqlStr := \"replace into transaction_records(id, sender, receiver, amount, input, expired, time_stamp, nonce, ref_block_num, block_num, sign) values \"\n\tfor _, val := range txState.Txs {\n\t\tsqlStr = sqlStr + fmt.Sprintf(\" ('%s', '%s', '%s', '%s', '%s', '%d', '%d', '%s', '%d', '%d', '%s'),\",\n\t\t\tval.TxID(), val.Sender, val.Receiver, val.Value, val.Input, val.ExpiredNum, val.TimeStamp, val.Nonce, val.RefBlockNum, height, val.Sign)\n\t}\n\tsqlStr = sqlStr[0 : len(sqlStr)-1]\n\n\t_, err = txState.db.Exec(sqlStr)\n\t// merkle tree\n\thashRoot = txState.Txs.HashRoot()\n\n\t// new trans for next commit\n\ttxState.RLock()\n\ttxState.Txs = Transactions{}\n\ttxState.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "38d738d076f0cc2031170105c320c5aa", "score": "0.4998921", "text": "func Append(ctx context.Context, basen ipld.Node, db *h.DagBuilderHelper) (out ipld.Node, errOut error) {\n\tbase, ok := basen.(*dag.ProtoNode)\n\tif !ok {\n\t\treturn nil, dag.ErrNotProtobuf\n\t}\n\n\t// Convert to unixfs node for working with easily\n\n\tfsn, err := h.NewFSNFromDag(base)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// Get depth of this 'tree'\n\tdepth, repeatNumber := trickleDepthInfo(fsn, db.Maxlinks())\n\tif depth == 0 {\n\t\t// If direct blocks not filled...\n\t\tif err := db.FillNodeLayer(fsn); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif db.Done() {\n\t\t\t// TODO: If `FillNodeLayer` stop `Commit`ing this should be\n\t\t\t// the place (besides the function end) to call it.\n\t\t\treturn fsn.GetDagNode()\n\t\t}\n\n\t\t// If continuing, our depth has increased by one\n\t\tdepth++\n\t}\n\n\t// Last child in this node may not be a full tree, lets fill it up.\n\tif err := appendFillLastChild(ctx, fsn, depth-1, repeatNumber, db); err != nil {\n\t\treturn nil, err\n\t}\n\n\t// after appendFillLastChild, our depth is now increased by one\n\tif !db.Done() {\n\t\tdepth++\n\t}\n\n\t// Now, continue filling out tree like normal\n\tfor i := depth; !db.Done(); i++ {\n\t\tfor j := 0; j < depthRepeat && !db.Done(); j++ {\n\t\t\tnextChild := db.NewFSNodeOverDag(ft.TFile)\n\t\t\tchildNode, childFileSize, err := fillTrickleRec(db, nextChild, i)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\terr = fsn.AddChild(childNode, childFileSize, db)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t}\n\t}\n\t_, err = fsn.Commit()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn fsn.GetDagNode()\n}", "title": "" }, { "docid": "7855b9db1dce08e85cb4a9905c69fbab", "score": "0.4990783", "text": "func (self *TTree) Conbine(aTree *TTree) *TTree {\n\tfor method, snode := range aTree.Root {\n\t\t// 如果主树没有该方法叉则直接移植\n\t\tif _, has := self.Root[method]; !has {\n\t\t\tself.Root[method] = snode\n\t\t} else {\n\t\t\t// 采用逐个添加\n\t\t\tfor _, node := range self.Root[method].Children {\n\t\t\t\tself.conbine(node, snode)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn self\n}", "title": "" }, { "docid": "9ddab6886d1d916cc0179a804e8468a5", "score": "0.49842885", "text": "func (t *MCTS) cleanup(oldRoot, newRoot Naughty) {\n\tchildren := t.Children(oldRoot)\n\t// we aint going down other paths, those nodes can be freed\n\tfor _, kid := range children {\n\t\tif kid != newRoot {\n\t\t\tt.nodeFromNaughty(kid).Invalidate()\n\t\t\tt.freeables = append(t.freeables, kid)\n\t\t\tt.cleanChildren(kid)\n\t\t}\n\t}\n\tt.Lock()\n\tt.children[oldRoot] = t.children[oldRoot][:1]\n\tt.children[oldRoot][0] = newRoot\n\tt.Unlock()\n}", "title": "" }, { "docid": "e47c4c41becc4d6120ddc82529af85d6", "score": "0.49716777", "text": "func (head *Node) fillTable(table code.Table, c code.Code) {\n\tif head == nil {\n\t\treturn\n\t}\n\n\tif head.left == nil && head.right == nil {\n\t\ttable[head.value] = c\n\t\treturn\n\t}\n\n\tif head.left != nil {\n\t\tlc := code.Code{\n\t\t\tCode: c.Code << 1,\n\t\t\tLen: c.Len + 1,\n\t\t}\n\t\thead.left.fillTable(table, lc)\n\t}\n\n\tif head.right != nil {\n\t\trc := code.Code{\n\t\t\tCode: (c.Code << 1) | 1,\n\t\t\tLen: c.Len + 1,\n\t\t}\n\t\thead.right.fillTable(table, rc)\n\t}\n}", "title": "" }, { "docid": "b567f95f220afe8e0374e580d4cf051f", "score": "0.49567702", "text": "func (q treeQuery) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tqueries.SetUpdate(q.Query, cols)\n\n\tresult, err := q.Query.ExecContext(ctx, exec)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all for trees\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected for trees\")\n\t}\n\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "78260819bca59b6a0693fec08570f66b", "score": "0.49532333", "text": "func (bpt *BplusTree) writeLayout() {\n\tleafIdx := 0\n\tnodeIdx := 0\n\tlevelIdx := 0\n\n\tif !bpt.initialized || bpt.rootKey.IsNil() {\n\t\treturn\n\t}\n\n\trootNode, _ := bpt.fetch(bpt.rootKey)\n\tif rootNode == nil {\n\t\tglog.Errorf(\"failed to fetch root key: %v. can not print the tree.\",\n\t\t\tbpt.rootKey)\n\t\treturn\n\t}\n\tglog.Infof(\"dumping the tree layout.. numChildren: %d\\n\",\n\t\tlen(rootNode.Children))\n\tnodeList := rootNode.Children\n\tnodeLensList := make([]int, 1)\n\tnodeLensList[0] = len(rootNode.Children)\n\tnumElems := nodeLensList[0]\n\tnumNodesAtLevel := 0\n\tprintLevel := true\n\tglog.Infof(\"level -- 0 <root: %v>\\n\", rootNode)\n\tif rootNode.IsLeaf {\n\t\treturn\n\t}\n\tfor i := 0; i < numElems; i++ {\n\t\tif printLevel {\n\t\t\tglog.Infof(\"level -- %d \", levelIdx+1)\n\t\t\tprintLevel = false\n\t\t}\n\t\tnode, _ := bpt.fetch(nodeList[i].NodeKey)\n\t\tif node == nil {\n\t\t\tglog.Errorf(\"failed to fetch root key: %v\", nodeList[i].NodeKey)\n\t\t\treturn\n\t\t}\n\n\t\tif node.IsLeaf {\n\t\t\tglog.Infof(\"level:%d <tree-L-node :%d, node: %v> \", levelIdx+1, leafIdx, node)\n\t\t\tleafIdx++\n\t\t} else {\n\t\t\tglog.Infof(\"level:%d <tree-I-node :%d, node: %v> \", levelIdx+1, nodeIdx, node)\n\t\t\tnodeList = append(nodeList, node.Children...)\n\t\t\tnumElems += len(node.Children)\n\t\t\tnumNodesAtLevel += len(node.Children)\n\t\t}\n\t\tnodeIdx++\n\t\tif nodeIdx >= nodeLensList[levelIdx] {\n\t\t\tnodeLensList = append(nodeLensList, numNodesAtLevel)\n\t\t\tlevelIdx++\n\t\t\tnodeIdx = 0\n\t\t\tnumNodesAtLevel = 0\n\t\t\tglog.Infof(\"\\n\")\n\t\t\tprintLevel = true\n\t\t}\n\t}\n\tglog.Infof(\"done.. dumping the layout\\n\")\n\tglog.Infof(\"----------------------------\\n\")\n}", "title": "" }, { "docid": "6d9867db1c56946213df5fe1bf541ab0", "score": "0.49505323", "text": "func (t *Table) DeduceTableInfoFromBlocks() {\n\tfiles, _ := ioutil.ReadDir(path.Join(FLAGS.DIR, t.Name))\n\n\tvar wg sync.WaitGroup\n\tt.init_data_structures()\n\n\tsaved_table := Table{Name: t.Name}\n\tsaved_table.init_data_structures()\n\n\tthis_block := 0\n\tm := &sync.Mutex{}\n\n\ttype_counts := make(map[string]map[int]int)\n\n\tbroken_mutex := sync.Mutex{}\n\tbroken_blocks := make([]string, 0)\n\tfor f := range files {\n\n\t\tv := files[f]\n\t\tif v.IsDir() && file_looks_like_block(v) {\n\t\t\tfilename := path.Join(FLAGS.DIR, t.Name, v.Name())\n\t\t\tthis_block++\n\n\t\t\twg.Add(1)\n\t\t\tgo func() {\n\t\t\t\tdefer wg.Done()\n\n\t\t\t\tinfo := t.ReadBlockInfoFromDir(filename)\n\t\t\t\tif info == nil {\n\t\t\t\t\tbroken_mutex.Lock()\n\t\t\t\t\tbroken_blocks = append(broken_blocks, filename)\n\t\t\t\t\tbroken_mutex.Unlock()\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tm.Lock()\n\t\t\t\tfor col := range info.IntInfoMap {\n\t\t\t\t\t_, ok := type_counts[col]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\ttype_counts[col] = make(map[int]int)\n\t\t\t\t\t}\n\t\t\t\t\ttype_counts[col][INT_VAL]++\n\t\t\t\t}\n\t\t\t\tfor col := range info.StrInfoMap {\n\t\t\t\t\t_, ok := type_counts[col]\n\t\t\t\t\tif !ok {\n\t\t\t\t\t\ttype_counts[col] = make(map[int]int)\n\t\t\t\t\t}\n\t\t\t\t\ttype_counts[col][STR_VAL]++\n\t\t\t\t}\n\t\t\t\tm.Unlock()\n\n\t\t\t}()\n\t\t}\n\t}\n\n\twg.Wait()\n\n\t// TODO: verify that the KEY TABLE and KEY TYPES\n\tDebug(\"TYPE COUNTS\", this_block, type_counts)\n\tDebug(\"KEY TABLE\", t.KeyTable)\n\tDebug(\"KEY TYPES\", t.KeyTypes)\n\n}", "title": "" }, { "docid": "1b64d65ce4044fddc1104c79178c65a5", "score": "0.49286515", "text": "func (d *dataUsageCache) flatten(root dataUsageEntry) dataUsageEntry {\n\tfor id := range root.Children {\n\t\te := d.Cache[id]\n\t\tif len(e.Children) > 0 {\n\t\t\te = d.flatten(e)\n\t\t}\n\t\troot.merge(e)\n\t}\n\troot.Children = nil\n\treturn root\n}", "title": "" }, { "docid": "1db6917db282e369a1d33695e85ac41e", "score": "0.49130026", "text": "func updateLeafBlocks(block Block) {\n\tmutex.Lock()\n\tleafBlocks[block.Hash] = block\n\tmutex.Unlock()\n\tfor leafBlockHash := range leafBlocks {\n\t\tmutex.Lock()\n\t\tleafBlock := leafBlocks[leafBlockHash]\n\t\tmutex.Unlock()\n\t\t// Remove blocks with lesser depth\n\t\tif leafBlock.Depth < block.Depth {\n\t\t\tmutex.Lock()\n\t\t\tdelete(leafBlocks, leafBlockHash)\n\t\t\tmutex.Unlock()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "a542e7f8cf5ff73c5d29c0ba39b2e274", "score": "0.48923093", "text": "func (s *levelsController) compactBuildTables(\n\tlev int, cd compactDef) ([]*table.Table, func() error, error) {\n\ttopTables := cd.top\n\tbotTables := cd.bot\n\n\tvar hasOverlap bool\n\t{\n\t\tkr := getKeyRange(cd.top)\n\t\tfor i, lh := range s.levels {\n\t\t\tif i <= lev { // Skip upper levels.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tlh.RLock()\n\t\t\tleft, right := lh.overlappingTables(levelHandlerRLocked{}, kr)\n\t\t\tlh.RUnlock()\n\t\t\tif right-left > 0 {\n\t\t\t\thasOverlap = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n\n\t// Try to collect stats so that we can inform value log about GC. That would help us find which\n\t// value log file should be GCed.\n\tdiscardStats := make(map[uint32]int64)\n\tupdateStats := func(vs y.ValueStruct) {\n\t\tif vs.Meta&bitValuePointer > 0 {\n\t\t\tvar vp valuePointer\n\t\t\tvp.Decode(vs.Value)\n\t\t\tdiscardStats[vp.Fid] += int64(vp.Len)\n\t\t}\n\t}\n\n\t// Create iterators across all the tables involved first.\n\tvar iters []y.Iterator\n\tif lev == 0 {\n\t\titers = appendIteratorsReversed(iters, topTables, false)\n\t} else if len(topTables) > 0 {\n\t\ty.AssertTrue(len(topTables) == 1)\n\t\titers = []y.Iterator{topTables[0].NewIterator(false)}\n\t}\n\n\t// Next level has level>=1 and we can use ConcatIterator as key ranges do not overlap.\n\tvar valid []*table.Table\n\tfor _, table := range botTables {\n\t\tif len(cd.dropPrefix) > 0 &&\n\t\t\tbytes.HasPrefix(table.Smallest(), cd.dropPrefix) &&\n\t\t\tbytes.HasPrefix(table.Biggest(), cd.dropPrefix) {\n\t\t\t// All the keys in this table have the dropPrefix. So, this table does not need to be\n\t\t\t// in the iterator and can be dropped immediately.\n\t\t\tcontinue\n\t\t}\n\t\tvalid = append(valid, table)\n\t}\n\titers = append(iters, table.NewConcatIterator(valid, false))\n\tit := y.NewMergeIterator(iters, false)\n\tdefer it.Close() // Important to close the iterator to do ref counting.\n\n\tit.Rewind()\n\n\t// Pick a discard ts, so we can discard versions below this ts. We should\n\t// never discard any versions starting from above this timestamp, because\n\t// that would affect the snapshot view guarantee provided by transactions.\n\tdiscardTs := s.kv.orc.discardAtOrBelow()\n\n\t// Start generating new tables.\n\ttype newTableResult struct {\n\t\ttable *table.Table\n\t\terr error\n\t}\n\tresultCh := make(chan newTableResult)\n\tvar numBuilds, numVersions int\n\tvar lastKey, skipKey []byte\n\tfor it.Valid() {\n\t\ttimeStart := time.Now()\n\t\tbuilder := table.NewTableBuilder()\n\t\tvar numKeys, numSkips uint64\n\t\tfor ; it.Valid(); it.Next() {\n\t\t\t// See if we need to skip the prefix.\n\t\t\tif len(cd.dropPrefix) > 0 && bytes.HasPrefix(it.Key(), cd.dropPrefix) {\n\t\t\t\tnumSkips++\n\t\t\t\tupdateStats(it.Value())\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// See if we need to skip this key.\n\t\t\tif len(skipKey) > 0 {\n\t\t\t\tif y.SameKey(it.Key(), skipKey) {\n\t\t\t\t\tnumSkips++\n\t\t\t\t\tupdateStats(it.Value())\n\t\t\t\t\tcontinue\n\t\t\t\t} else {\n\t\t\t\t\tskipKey = skipKey[:0]\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif !y.SameKey(it.Key(), lastKey) {\n\t\t\t\tif builder.ReachedCapacity(s.kv.opt.MaxTableSize) {\n\t\t\t\t\t// Only break if we are on a different key, and have reached capacity. We want\n\t\t\t\t\t// to ensure that all versions of the key are stored in the same sstable, and\n\t\t\t\t\t// not divided across multiple tables at the same level.\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t\tlastKey = y.SafeCopy(lastKey, it.Key())\n\t\t\t\tnumVersions = 0\n\t\t\t}\n\n\t\t\tvs := it.Value()\n\t\t\tversion := y.ParseTs(it.Key())\n\t\t\t// Do not discard entries inserted by merge operator. These entries will be\n\t\t\t// discarded once they're merged\n\t\t\tif version <= discardTs && vs.Meta&bitMergeEntry == 0 {\n\t\t\t\t// Keep track of the number of versions encountered for this key. Only consider the\n\t\t\t\t// versions which are below the minReadTs, otherwise, we might end up discarding the\n\t\t\t\t// only valid version for a running transaction.\n\t\t\t\tnumVersions++\n\t\t\t\tlastValidVersion := vs.Meta&bitDiscardEarlierVersions > 0\n\t\t\t\tif isDeletedOrExpired(vs.Meta, vs.ExpiresAt) ||\n\t\t\t\t\tnumVersions > s.kv.opt.NumVersionsToKeep ||\n\t\t\t\t\tlastValidVersion {\n\t\t\t\t\t// If this version of the key is deleted or expired, skip all the rest of the\n\t\t\t\t\t// versions. Ensure that we're only removing versions below readTs.\n\t\t\t\t\tskipKey = y.SafeCopy(skipKey, it.Key())\n\n\t\t\t\t\tif lastValidVersion {\n\t\t\t\t\t\t// Add this key. We have set skipKey, so the following key versions\n\t\t\t\t\t\t// would be skipped.\n\t\t\t\t\t} else if hasOverlap {\n\t\t\t\t\t\t// If this key range has overlap with lower levels, then keep the deletion\n\t\t\t\t\t\t// marker with the latest version, discarding the rest. We have set skipKey,\n\t\t\t\t\t\t// so the following key versions would be skipped.\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// If no overlap, we can skip all the versions, by continuing here.\n\t\t\t\t\t\tnumSkips++\n\t\t\t\t\t\tupdateStats(vs)\n\t\t\t\t\t\tcontinue // Skip adding this key.\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tnumKeys++\n\t\t\ty.Check(builder.Add(it.Key(), it.Value()))\n\t\t}\n\t\t// It was true that it.Valid() at least once in the loop above, which means we\n\t\t// called Add() at least once, and builder is not Empty().\n\t\ts.kv.opt.Debugf(\"LOG Compact. Added %d keys. Skipped %d keys. Iteration took: %v\",\n\t\t\tnumKeys, numSkips, time.Since(timeStart))\n\t\tif !builder.Empty() {\n\t\t\tnumBuilds++\n\t\t\tfileID := s.reserveFileID()\n\t\t\tgo func(builder *table.Builder) {\n\t\t\t\tdefer builder.Close()\n\n\t\t\t\tfd, err := y.CreateSyncedFile(table.NewFilename(fileID, s.kv.opt.Dir), true)\n\t\t\t\tif err != nil {\n\t\t\t\t\tresultCh <- newTableResult{nil, errors.Wrapf(err, \"While opening new table: %d\", fileID)}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\tif _, err := fd.Write(builder.Finish()); err != nil {\n\t\t\t\t\tresultCh <- newTableResult{nil, errors.Wrapf(err, \"Unable to write to file: %d\", fileID)}\n\t\t\t\t\treturn\n\t\t\t\t}\n\n\t\t\t\ttbl, err := table.OpenTable(fd, s.kv.opt.TableLoadingMode, nil)\n\t\t\t\t// decrRef is added below.\n\t\t\t\tresultCh <- newTableResult{tbl, errors.Wrapf(err, \"Unable to open table: %q\", fd.Name())}\n\t\t\t}(builder)\n\t\t}\n\t}\n\n\tnewTables := make([]*table.Table, 0, 20)\n\t// Wait for all table builders to finish.\n\tvar firstErr error\n\tfor x := 0; x < numBuilds; x++ {\n\t\tres := <-resultCh\n\t\tnewTables = append(newTables, res.table)\n\t\tif firstErr == nil {\n\t\t\tfirstErr = res.err\n\t\t}\n\t}\n\n\tif firstErr == nil {\n\t\t// Ensure created files' directory entries are visible. We don't mind the extra latency\n\t\t// from not doing this ASAP after all file creation has finished because this is a\n\t\t// background operation.\n\t\tfirstErr = syncDir(s.kv.opt.Dir)\n\t}\n\n\tif firstErr != nil {\n\t\t// An error happened. Delete all the newly created table files (by calling DecrRef\n\t\t// -- we're the only holders of a ref).\n\t\tfor j := 0; j < numBuilds; j++ {\n\t\t\tif newTables[j] != nil {\n\t\t\t\t_ = newTables[j].DecrRef()\n\t\t\t}\n\t\t}\n\t\terrorReturn := errors.Wrapf(firstErr, \"While running compaction for: %+v\", cd)\n\t\treturn nil, nil, errorReturn\n\t}\n\n\tsort.Slice(newTables, func(i, j int) bool {\n\t\treturn y.CompareKeys(newTables[i].Biggest(), newTables[j].Biggest()) < 0\n\t})\n\tif err := s.kv.vlog.updateDiscardStats(discardStats); err != nil {\n\t\treturn nil, nil, errors.Wrap(err, \"failed to update discard stats\")\n\t}\n\ts.kv.opt.Debugf(\"Discard stats: %v\", discardStats)\n\treturn newTables, func() error { return decrRefs(newTables) }, nil\n}", "title": "" }, { "docid": "cd32d31fc801ab16a26cca62840745e9", "score": "0.4872915", "text": "func doFlatten(ctx context.Context, buf *ChangeBuffer) {\n\t// we browse the buffer multiple times to optimise transmitted events by type.\n\n\t// first := true\n\n\t// Handle delete events\n\tfor c := range buf.Range() {\n\n\t\t// if first {\n\t\t// \tfmt.Println(\"Starting flatten for node \" + getOp(c).GetNodeId())\n\t\t// \tfirst = false\n\t\t// }\n\n\t\tif getOp(c).OpType().Delete() {\n\n\t\t\t// First check if delete is the last event of the buffer\n\t\t\t// if not, we only log an error for the time being\n\t\t\tif c.Next() != nil {\n\t\t\t\tlog.Logger(ctx).Error(\"got a delete event followed by other events, cleaning the sequence\", zap.String(common.KEY_NODE_UUID, c.Value.(*operation).GetNodeId()))\n\t\t\t\t// TODO implement removal of remaining events\n\t\t\t}\n\n\t\t\tif c.Prev() == nil {\n\t\t\t\treturn // Delete is the first element: we are done\n\t\t\t}\n\n\t\t\t// If first event is a create => we empty the buffer\n\t\t\tif getOp(buf.Front()).OpType().Create() {\n\t\t\t\tbuf.emptyBuffer()\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// Otherwise, we retrieve src Path from the front element\n\t\t\t// to be used as src Path for the delete event\n\t\t\tsrcPath := getOp(buf.Front()).GetSource()\n\t\t\tgetOp(c).SyncChange.Source = srcPath\n\n\t\t\t// We then remove all previous events that are now useless\n\t\t\tbuf.truncateBefore(*c)\n\n\t\t\t// And we are done\n\t\t\treturn\n\t\t}\n\t}\n\n\t// Handle multiple moves, multiple updates and create\n\t// We browse backward\n\tcurr := buf.Back()\n\tvar lastMove *list.Element\n\tvar lastUpdate *list.Element\n\tvar lastMoveSeqId uint64\n\tvar lastUpdateSeqId uint64\n\n\tfor curr != nil {\n\t\tif getOp(curr).OpType().Move() {\n\t\t\tif lastMove == nil {\n\t\t\t\tlastMove = curr\n\t\t\t\tlastMoveSeqId = getOp(curr).GetSeq()\n\t\t\t} else {\n\t\t\t\t// update source path from lastMove with source path from curr\n\t\t\t\tsrcPath := getOp(curr).GetSource()\n\t\t\t\tgetOp(lastMove).SyncChange.Source = srcPath\n\n\t\t\t\t// Also update source and target path of potential last update event\n\t\t\t\t// if it is between the 2 move events to remain consistent\n\t\t\t\tif lastUpdateSeqId > 0 && lastUpdateSeqId < lastMoveSeqId {\n\t\t\t\t\tgetOp(lastUpdate).SyncChange.Source = srcPath\n\t\t\t\t\tgetOp(lastUpdate).SyncChange.Target = srcPath\n\t\t\t\t}\n\n\t\t\t\t// remove curr\n\t\t\t\ttmp := curr\n\t\t\t\tcurr = curr.Prev()\n\t\t\t\tbuf.Remove(tmp)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if getOp(curr).OpType().Update() {\n\t\t\tif lastUpdate == nil {\n\t\t\t\tlastUpdate = curr\n\t\t\t\tlastUpdateSeqId = getOp(curr).GetSeq()\n\t\t\t} else {\n\t\t\t\t// simply remove curr\n\t\t\t\ttmp := curr\n\t\t\t\tcurr = curr.Prev()\n\t\t\t\tbuf.Remove(tmp)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t} else if getOp(curr).OpType().Create() {\n\t\t\t// First double check if we have previous events, this should never happen\n\t\t\tif curr.Prev() != nil {\n\t\t\t\tlog.Logger(ctx).Error(\"got a create event preceded by other events, this should not happen\", zap.String(common.KEY_NODE_UUID, getOp(curr).GetNodeId()))\n\t\t\t}\n\n\t\t\tif lastMove == nil && lastUpdate == nil {\n\t\t\t\t// we only have a create, nothing to merge\n\t\t\t\treturn\n\t\t\t} else if lastMoveSeqId > lastUpdateSeqId {\n\t\t\t\t// We replace the last move by a create\n\t\t\t\tgetOp(lastMove).SyncChange.Source = \"NULL\"\n\t\t\t\tgetOp(lastMove).SyncChange.Type = tree.SyncChange_create\n\t\t\t\t// and discard former create and update\n\t\t\t\tif lastUpdate != nil {\n\t\t\t\t\tbuf.Remove(lastUpdate)\n\t\t\t\t\tlastUpdate = nil\n\t\t\t\t}\n\t\t\t\tbuf.Remove(curr)\n\t\t\t\tcurr = nil\n\t\t\t} else { // last update happened after last move\n\t\t\t\t// We replace the last update by a create\n\t\t\t\tgetOp(lastUpdate).SyncChange.Source = \"NULL\"\n\t\t\t\tgetOp(lastUpdate).SyncChange.Type = tree.SyncChange_create\n\t\t\t\t// and discard former create and move\n\t\t\t\tif lastMove != nil {\n\t\t\t\t\tbuf.Remove(lastMove)\n\t\t\t\t\tlastMove = nil\n\t\t\t\t}\n\t\t\t\tbuf.Remove(curr)\n\t\t\t\tcurr = nil\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\t\tcurr = curr.Prev()\n\t}\n\n\t// Also remove last move if we made a round trip\n\tif lastMove != nil && getOp(lastMove).GetSource() == getOp(lastMove).GetTarget() {\n\t\tbuf.Remove(lastMove)\n\t}\n}", "title": "" }, { "docid": "48646d02f4b12fa636617d0218158938", "score": "0.4853309", "text": "func flushBlocks(w *os.File, data []*batch.Batch, meta *metadata.Segment) error {\n\tvar metaBuf bytes.Buffer\n\theader := make([]byte, 32)\n\tcopy(header, encoding.EncodeUint64(Version))\n\terr := binary.Write(&metaBuf, binary.BigEndian, header)\n\tif err != nil {\n\t\treturn err\n\t}\n\treserved := make([]byte, 64)\n\terr = binary.Write(&metaBuf, binary.BigEndian, reserved)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = binary.Write(&metaBuf, binary.BigEndian, uint8(compress.Lz4))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = binary.Write(&metaBuf, binary.BigEndian, uint32(len(data)))\n\tif err != nil {\n\t\treturn err\n\t}\n\tcolDefs := meta.Table.Schema.ColDefs\n\tcolCnt := len(colDefs)\n\tif err = binary.Write(&metaBuf, binary.BigEndian, uint32(colCnt)); err != nil {\n\t\treturn err\n\t}\n\tfor _, blk := range meta.BlockSet {\n\t\tif err = binary.Write(&metaBuf, binary.BigEndian, blk.Count); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\trangeBuf, _ := meta.CommitInfo.LogRange.Marshal()\n\t\tif err = binary.Write(&metaBuf, binary.BigEndian, rangeBuf); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar preIdx []byte\n\t\tif blk.CommitInfo.PrevIndex != nil {\n\t\t\tpreIdx, err = blk.CommitInfo.PrevIndex.Marshal()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tpreIdx = make([]byte, blkIdxSize)\n\t\t}\n\t\tif err = binary.Write(&metaBuf, binary.BigEndian, preIdx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tvar idx []byte\n\t\tif blk.CommitInfo.LogIndex != nil {\n\t\t\tidx, err = blk.CommitInfo.LogIndex.Marshal()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else {\n\t\t\tidx = make([]byte, blkIdxSize)\n\t\t}\n\t\tif err = binary.Write(&metaBuf, binary.BigEndian, idx); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar dataBuf bytes.Buffer\n\tcolSizes := make([]int, colCnt)\n\tfor i := 0; i < colCnt; i++ {\n\t\tcolSz := 0\n\t\tfor _, bat := range data {\n\t\t\tcolBuf, err := bat.Vecs[i].Show()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcolSize := len(colBuf)\n\t\t\tcbuf := make([]byte, lz4.CompressBlockBound(colSize))\n\t\t\tif cbuf, err = compress.Compress(colBuf, cbuf, compress.Lz4); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = binary.Write(&metaBuf, binary.BigEndian, uint64(len(cbuf))); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = binary.Write(&metaBuf, binary.BigEndian, uint64(colSize)); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err = binary.Write(&dataBuf, binary.BigEndian, cbuf); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tcolSz += len(cbuf)\n\t\t}\n\t\tcolSizes[i] = colSz\n\t}\n\n\tmetaSize := headerSize +\n\t\treservedSize +\n\t\talgoSize +\n\t\tblkCntSize +\n\t\tcolCntSize +\n\t\tstartPosSize +\n\t\tendPosSize +\n\t\tlen(data)*(blkCountSize+2*blkIdxSize+blkRangeSize) +\n\t\tlen(data)*colCnt*(colSizeSize*2) +\n\t\tcolCnt*colPosSize\n\n\tstartPos := int64(metaSize)\n\tcurPos := startPos\n\tcolPoses := make([]int64, colCnt)\n\tfor i, colSz := range colSizes {\n\t\tcolPoses[i] = curPos\n\t\tcurPos += int64(colSz)\n\t}\n\tendPos := curPos\n\tif err = binary.Write(&metaBuf, binary.BigEndian, startPos); err != nil {\n\t\treturn err\n\t}\n\tif err = binary.Write(&metaBuf, binary.BigEndian, endPos); err != nil {\n\t\treturn err\n\t}\n\tfor _, colPos := range colPoses {\n\t\tif err = binary.Write(&metaBuf, binary.BigEndian, colPos); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif _, err = w.Write(metaBuf.Bytes()); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err = w.Write(dataBuf.Bytes()); err != nil {\n\t\treturn err\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "40c574c1954c27e9947950d45d004164", "score": "0.48185322", "text": "func (h *HamtFunctional) persist(oldTable, newTable tableI, path tableStack) {\n\t// Removed the case where path.len() == 0 on the first call to nh.perist(),\n\t// because that case is handled in Put & Del now. It is handled in Put & Del\n\t// because otherwise we were allocating an extraneous fixedTable for the\n\t// old h.root.\n\t_ = assertOn && assert(path.len() != 0,\n\t\t\"path.len()==0; This case should be handled directly in Put & Del.\")\n\n\tvar depth = uint(path.len()) //guaranteed depth > 0\n\tvar parentDepth = depth - 1\n\n\tvar parentIdx = oldTable.Hash().Index(parentDepth)\n\n\tvar oldParent = path.pop()\n\n\tvar newParent tableI\n\tif path.len() == 0 {\n\t\t// This condition and the last if path.len() > 0; shaves off one call\n\t\t// to persist and one fixed table allocation (via oldParent.copy()).\n\t\th.root = *oldParent.(*fixedTable)\n\t\tnewParent = &h.root\n\t} else {\n\t\tnewParent = oldParent.copy()\n\t}\n\n\tif newTable == nil {\n\t\tnewParent.remove(parentIdx)\n\t} else {\n\t\tnewParent.replace(parentIdx, newTable)\n\t}\n\n\tif path.len() > 0 {\n\t\th.persist(oldParent, newParent, path)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "510c74fcdf5e976bb1638f7222f6b27c", "score": "0.4812491", "text": "func (txrSt *TxRepState) SyncToDisk(height int64) (hashRoot string, err error) {\n\tif txrSt.Txreps.Len() == 0 {\n\t\treturn txrSt.Txreps.HashRoot(), nil\n\t}\n\t// id | status | fee | block_num | tx_hash | log\n\n\tsqlStr := \"replace into transaction_receipts (id, status, fee, block_num, tx_hash, log) values \"\n\tfor _, val := range txrSt.Txreps {\n\t\tsqlStr = sqlStr + fmt.Sprintf(\" ('%s', '%d', '%s', '%d', '%s', '%s'),\",\n\t\t\tstring(val.ID()), val.Status, val.Fee.String(), height, val.TxHash, val.Log)\n\t}\n\tsqlStr = sqlStr[0 : len(sqlStr)-1]\n\n\t_, err = txrSt.db.Exec(sqlStr)\n\t// merkle tree\n\thashRoot = txrSt.Txreps.HashRoot()\n\n\t// new trans for next commit\n\ttxrSt.RLock()\n\ttxrSt.Txreps = TransactionReceipts{}\n\ttxrSt.RUnlock()\n\treturn\n}", "title": "" }, { "docid": "d29aa0979f4433045e6128de004feae6", "score": "0.48119456", "text": "func (o TreeSlice) UpdateAll(ctx context.Context, exec boil.ContextExecutor, cols M) (int64, error) {\n\tln := int64(len(o))\n\tif ln == 0 {\n\t\treturn 0, nil\n\t}\n\n\tif len(cols) == 0 {\n\t\treturn 0, errors.New(\"models: update all requires at least one column argument\")\n\t}\n\n\tcolNames := make([]string, len(cols))\n\targs := make([]interface{}, len(cols))\n\n\ti := 0\n\tfor name, value := range cols {\n\t\tcolNames[i] = name\n\t\targs[i] = value\n\t\ti++\n\t}\n\n\t// Append all of the primary key values for each column\n\tfor _, obj := range o {\n\t\tpkeyArgs := queries.ValuesFromMapping(reflect.Indirect(reflect.ValueOf(obj)), treePrimaryKeyMapping)\n\t\targs = append(args, pkeyArgs...)\n\t}\n\n\tsql := fmt.Sprintf(\"UPDATE \\\"trees\\\" SET %s WHERE %s\",\n\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, colNames),\n\t\tstrmangle.WhereClauseRepeated(string(dialect.LQ), string(dialect.RQ), len(colNames)+1, treePrimaryKeyColumns, len(o)))\n\n\tif boil.IsDebug(ctx) {\n\t\twriter := boil.DebugWriterFrom(ctx)\n\t\tfmt.Fprintln(writer, sql)\n\t\tfmt.Fprintln(writer, args...)\n\t}\n\tresult, err := exec.ExecContext(ctx, sql, args...)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to update all in tree slice\")\n\t}\n\n\trowsAff, err := result.RowsAffected()\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: unable to retrieve rows affected all in update all tree\")\n\t}\n\treturn rowsAff, nil\n}", "title": "" }, { "docid": "6b9d7a1b4cfeb9613a0e416c1e029704", "score": "0.48079753", "text": "func writeTreeToDisk(disk []byte, curNode disklayout.ExtentEntryPair) []byte {\n\tnodeData := binary.Marshal(nil, binary.LittleEndian, curNode.Node.Header)\n\tfor _, ep := range curNode.Node.Entries {\n\t\tnodeData = binary.Marshal(nodeData, binary.LittleEndian, ep.Entry)\n\t}\n\n\tcopy(disk[curNode.Entry.PhysicalBlock()*mockExtentBlkSize:], nodeData)\n\n\tvar fileData []byte\n\tfor _, ep := range curNode.Node.Entries {\n\t\tif curNode.Node.Header.Height == 0 {\n\t\t\tfileData = append(fileData, writeFileDataToExtent(disk, ep.Entry.(*disklayout.Extent))...)\n\t\t} else {\n\t\t\tfileData = append(fileData, writeTreeToDisk(disk, ep)...)\n\t\t}\n\t}\n\treturn fileData\n}", "title": "" }, { "docid": "a3f71272d7a1d2135c895b9e1ce1c5cc", "score": "0.47824997", "text": "func (n *node) merge(idx int) {\n\tfmt.Printf(\"merge %d\\n\", idx)\n\tleftChild := n.children[idx]\n\trightChild := n.children[idx+1]\n\n\t// copy right child to left child\n\tif leftChild.isLeaf {\n\t\tfor i := 0; i < rightChild.count; i++ {\n\t\t\tleftChild.keys[i+leftChild.count] = rightChild.keys[i]\n\t\t}\n\t} else {\n\t\t// removedKey underflow into leftChild\n\t\tleftChild.keys[leftChild.count] = n.keys[idx]\n\n\t\tfor i := 0; i < rightChild.count; i++ {\n\t\t\tleftChild.keys[i+leftChild.count+1] = rightChild.keys[i]\n\t\t}\n\t}\n\n\t// copy right child pointers to left child\n\tif !leftChild.isLeaf {\n\t\tfor i := 0; i <= rightChild.count; i++ {\n\t\t\tleftChild.children[i+leftChild.count+1] = rightChild.children[i]\n\t\t}\n\t}\n\n\t// since removedKey underflow, so fill the gap by moving forward keys\n\tfor i := idx + 1; i < n.count; i++ {\n\t\tn.keys[i-1] = n.keys[i]\n\t}\n\t// fill child pointer gap\n\tfor i := idx + 2; i <= n.count; i++ {\n\t\tn.children[i-1] = n.children[i]\n\t}\n\n\t// update count\n\tif leftChild.isLeaf {\n\t\tleftChild.count += rightChild.count\n\t} else {\n\t\tleftChild.count += rightChild.count + 1\n\t}\n\n\t// update next pointer\n\tif leftChild.isLeaf {\n\t\tleftChild.next = rightChild.next\n\t}\n\n\tn.count--\n\trightChild = nil\n}", "title": "" }, { "docid": "3f60601830a896df9a107cee1eedcbaf", "score": "0.47794485", "text": "func (inT *INTree) buildTree(bnds []Bounds) {\n\n\tinT.idxs = make([]int, len(bnds))\n\tinT.lmts = make([]float64, 3*len(bnds))\n\n\tfor i, v := range bnds {\n\n\t\tinT.idxs[i] = i\n\t\tl, u := v.Limits()\n\n\t\tinT.lmts[3*i] = l\n\t\tinT.lmts[3*i+1] = u\n\t\tinT.lmts[3*i+2] = 0\n\n\t}\n\n\tsort(inT.lmts, inT.idxs)\n\taugment(inT.lmts, inT.idxs)\n\n}", "title": "" }, { "docid": "5f7f504a7a6daf2493c29c901349fc02", "score": "0.47764868", "text": "func resetHardTables(ctx context.Context, dbData env.DbData, cSpecStr string, roots doltdb.Roots) (*doltdb.Commit, doltdb.Roots, error) {\n\tddb := dbData.Ddb\n\trsr := dbData.Rsr\n\n\tvar newHead *doltdb.Commit\n\tif cSpecStr != \"\" {\n\t\tcs, err := doltdb.NewCommitSpec(cSpecStr)\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\n\t\theadRef, err := rsr.CWBHeadRef()\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\t\tnewHead, err = ddb.Resolve(ctx, cs, headRef)\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\n\t\troots.Head, err = newHead.GetRootValue(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\t}\n\n\t// mirroring Git behavior, untracked tables are ignored on 'reset --hard',\n\t// save the state of these tables and apply them to |newHead|'s root.\n\t//\n\t// as a special case, if an untracked table has a tag collision with any\n\t// tables in |newHead| we silently drop it from the new working set.\n\t// these tag collision is typically cause by table renames (bug #751).\n\n\tuntracked, err := roots.Working.GetAllSchemas(ctx)\n\tif err != nil {\n\t\treturn nil, doltdb.Roots{}, err\n\t}\n\t// untracked tables exist in |working| but not in |staged|\n\tstaged, err := roots.Staged.GetTableNames(ctx)\n\tif err != nil {\n\t\treturn nil, doltdb.Roots{}, err\n\t}\n\tfor _, name := range staged {\n\t\tdelete(untracked, name)\n\t}\n\n\tnewWkRoot := roots.Head\n\n\tws, err := newWkRoot.GetAllSchemas(ctx)\n\tif err != nil {\n\t\treturn nil, doltdb.Roots{}, err\n\t}\n\ttags := mapColumnTags(ws)\n\n\tfor name, sch := range untracked {\n\t\tfor _, pk := range sch.GetAllCols().GetColumns() {\n\t\t\tif _, ok := tags[pk.Tag]; ok {\n\t\t\t\t// |pk.Tag| collides with a schema in |newWkRoot|\n\t\t\t\tdelete(untracked, name)\n\t\t\t}\n\t\t}\n\t}\n\n\tfor name := range untracked {\n\t\ttbl, _, err := roots.Working.GetTable(ctx, name)\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\t\tnewWkRoot, err = newWkRoot.PutTable(ctx, name, tbl)\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, fmt.Errorf(\"failed to write table back to database: %s\", err)\n\t\t}\n\t}\n\n\t// need to save the state of files that aren't tracked\n\tuntrackedTables := make(map[string]*doltdb.Table)\n\twTblNames, err := roots.Working.GetTableNames(ctx)\n\n\tif err != nil {\n\t\treturn nil, doltdb.Roots{}, err\n\t}\n\n\tfor _, tblName := range wTblNames {\n\t\tuntrackedTables[tblName], _, err = roots.Working.GetTable(ctx, tblName)\n\n\t\tif err != nil {\n\t\t\treturn nil, doltdb.Roots{}, err\n\t\t}\n\t}\n\n\theadTblNames, err := roots.Staged.GetTableNames(ctx)\n\n\tif err != nil {\n\t\treturn nil, doltdb.Roots{}, err\n\t}\n\n\tfor _, tblName := range headTblNames {\n\t\tdelete(untrackedTables, tblName)\n\t}\n\n\troots.Working = newWkRoot\n\troots.Staged = roots.Head\n\n\treturn newHead, roots, nil\n}", "title": "" }, { "docid": "957ea0556ec1597dd1972ca7484ec953", "score": "0.47653508", "text": "func (db *merkleDB) moveChildViewsToDB(trieToCommit *trieView) {\n\ttrieToCommit.validityTrackingLock.Lock()\n\tdefer trieToCommit.validityTrackingLock.Unlock()\n\n\tfor _, childView := range trieToCommit.childViews {\n\t\tchildView.updateParent(db)\n\t\tdb.childViews = append(db.childViews, childView)\n\t}\n\ttrieToCommit.childViews = make([]*trieView, 0, defaultPreallocationSize)\n}", "title": "" }, { "docid": "b855c892dcbf1062d5001736bf620ee9", "score": "0.47479606", "text": "func (t *smallFlatTable) Marshal(ctx MarshalContext, enc *marshal.Encoder) {\n\tt.initSubTables(ctx.ctx)\n\tenc.PutRawBytes(smallFlatMagic[:])\n\tenc.PutHash(t.hash)\n\tenc.PutGOB(&t.ast)\n\tenc.PutVarint(int64(len(t.subTables)))\n\tsubBufs := make([]marshal.Encoder, len(t.subTables))\n\tfor i := range t.subTables {\n\t\tt.subTables[i].Marshal(ctx, &subBufs[i])\n\t}\n\tfor i := range t.subTables {\n\t\tenc.PutRawBytes(subBufs[i].Bytes())\n\t}\n}", "title": "" }, { "docid": "993cf0cb9c1a1eab5640fa8f47a59e54", "score": "0.47335422", "text": "func (l *Ledger) Dump() ([][]string, error) {\n\tl.mutex.RLock()\n\tdefer l.mutex.RUnlock()\n\tit := l.baseDB.NewIteratorWithPrefix([]byte(pb.BlocksTablePrefix))\n\tdefer it.Release()\n\tblocks := make([][]string, l.meta.TrunkHeight+1)\n\tfor it.Next() {\n\t\tblock := &pb.InternalBlock{}\n\t\tparserErr := proto.Unmarshal(it.Value(), block)\n\t\tif parserErr != nil {\n\t\t\treturn nil, parserErr\n\t\t}\n\t\theight := block.Height\n\t\tblockid := fmt.Sprintf(\"{ID:%x,TxCount:%d,InTrunk:%v, Tm:%d, Miner:%s}\", block.Blockid, block.TxCount, block.InTrunk, block.Timestamp/1000000000, block.Proposer)\n\t\tblocks[height] = append(blocks[height], blockid)\n\t}\n\treturn blocks, nil\n}", "title": "" }, { "docid": "1dfcae65a2e9f4ce7e7e33ebf085e22f", "score": "0.4731664", "text": "func (s *SGTree) build(treeindex, l, r int) {\n\tif l == r {\n\t\ts.tree[treeindex] = s.data[l]\n\t\treturn\n\t}\n\tleftTreeIndex := s.leftChild(treeindex)\n\trightTreeIndex := s.rightChild(treeindex)\n\t//mid = (l + r )/ 2 notice: it's easy to core dump while hug int l and r so we do s:\n\tmid := l + (r-l)/2\n\t//recursive\n\ts.build(leftTreeIndex, l, mid)\n\ts.build(rightTreeIndex, mid+1, r)\n\ts.tree[treeindex] = s.merger(s.tree[leftTreeIndex], s.tree[rightTreeIndex])\n}", "title": "" }, { "docid": "58168a9fc7487842d342664768b71bc7", "score": "0.47211552", "text": "func mergeProllyTableData(ctx *sql.Context, tm *TableMerger, finalSch schema.Schema, mergeTbl *doltdb.Table, valueMerger *valueMerger) (*doltdb.Table, *MergeStats, error) {\n\titer, err := threeWayDiffer(ctx, tm, valueMerger)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tlr, err := tm.leftTbl.GetRowData(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tleftEditor := durable.ProllyMapFromIndex(lr).Rewriter(finalSch.GetKeyDescriptor(), finalSch.GetValueDescriptor())\n\n\tai, err := mergeTbl.GetArtifacts(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tartEditor := durable.ProllyMapFromArtifactIndex(ai).Editor()\n\n\tkeyless := schema.IsKeyless(tm.leftSch)\n\n\tpri, err := newPrimaryMerger(leftEditor, tm, valueMerger, finalSch)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tsec, err := newSecondaryMerger(ctx, tm, valueMerger, finalSch)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tconflicts, err := newConflictMerger(ctx, tm, artEditor)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tcheckValidator, err := newCheckValidator(ctx, tm, valueMerger, finalSch, artEditor)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\t// validator shares an artifact editor with conflict merge\n\tuniq, err := newUniqValidator(ctx, finalSch, tm, valueMerger, artEditor)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tnullChk, err := newNullValidator(ctx, finalSch, tm, valueMerger, artEditor, leftEditor, sec.leftMut)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\ts := &MergeStats{\n\t\tOperation: TableModified,\n\t}\n\tfor {\n\t\tdiff, err := iter.Next(ctx)\n\t\tif errors.Is(err, io.EOF) {\n\t\t\tbreak\n\t\t} else if err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\tcnt, err := uniq.validateDiff(ctx, diff)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ts.ConstraintViolations += cnt\n\n\t\tcnt, err = nullChk.validateDiff(ctx, diff)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ts.ConstraintViolations += cnt\n\t\tif cnt > 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\tcnt, err = checkValidator.validateDiff(ctx, diff)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\ts.ConstraintViolations += cnt\n\n\t\tswitch diff.Op {\n\t\tcase tree.DiffOpDivergentModifyConflict, tree.DiffOpDivergentDeleteConflict:\n\t\t\t// In this case, a modification or delete was made to one side, and a conflicting delete or modification\n\t\t\t// was made to the other side, so these cannot be automatically resolved.\n\t\t\ts.DataConflicts++\n\t\t\terr = conflicts.merge(ctx, diff, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tcase tree.DiffOpRightAdd:\n\t\t\ts.Adds++\n\t\t\terr = pri.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\terr = sec.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tcase tree.DiffOpRightModify:\n\t\t\ts.Modifications++\n\t\t\terr = pri.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\terr = sec.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tcase tree.DiffOpRightDelete:\n\t\t\ts.Deletes++\n\t\t\terr = pri.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\terr = sec.merge(ctx, diff, tm.rightSch)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tcase tree.DiffOpDivergentModifyResolved:\n\t\t\t// In this case, both sides of the merge have made different changes to a row, but we were able to\n\t\t\t// resolve them automatically.\n\t\t\ts.Modifications++\n\t\t\terr = pri.merge(ctx, diff, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\terr = sec.merge(ctx, diff, nil)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\tcase tree.DiffOpConvergentAdd, tree.DiffOpConvergentModify, tree.DiffOpConvergentDelete:\n\t\t\t// In this case, both sides of the merge have made the same change, so no additional changes are needed.\n\t\t\tif keyless {\n\t\t\t\ts.DataConflicts++\n\t\t\t\terr = conflicts.merge(ctx, diff, nil)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, err\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\t// Currently, all changes are applied to the left-side of the merge, so for any left-side diff ops,\n\t\t\t// we can simply ignore them since that data is already in the destination (the left-side).\n\t\t}\n\t}\n\n\tfinalRows, err := pri.finalize(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tleftIdxs, rightIdxs, err := sec.finalize(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfinalIdxs, err := mergeProllySecondaryIndexes(ctx, tm, leftIdxs, rightIdxs, finalSch, finalRows, conflicts.ae)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfinalArtifacts, err := conflicts.finalize(ctx)\n\n\t// collect merged data in |finalTbl|\n\tfinalTbl, err := mergeTbl.UpdateRows(ctx, finalRows)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfinalTbl, err = finalTbl.SetIndexSet(ctx, finalIdxs)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tfinalTbl, err = finalTbl.SetArtifacts(ctx, finalArtifacts)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\treturn finalTbl, s, nil\n}", "title": "" }, { "docid": "de0438dd6ed597565c73347f1b8ac2c6", "score": "0.47210798", "text": "func moveModifiedTables(ctx context.Context, oldRoot, newRoot, changedRoot *doltdb.RootValue, conflicts *set.StrSet, force bool) (map[string]hash.Hash, error) {\n\tresultMap := make(map[string]hash.Hash)\n\ttblNames, err := newRoot.GetTableNames(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, tblName := range tblNames {\n\t\toldHash, _, err := oldRoot.GetTableHash(ctx, tblName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tnewHash, _, err := newRoot.GetTableHash(ctx, tblName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tchangedHash, _, err := changedRoot.GetTableHash(ctx, tblName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tif oldHash == changedHash {\n\t\t\tresultMap[tblName] = newHash\n\t\t} else if oldHash == newHash {\n\t\t\tresultMap[tblName] = changedHash\n\t\t} else if force {\n\t\t\tresultMap[tblName] = newHash\n\t\t} else {\n\t\t\tconflicts.Add(tblName)\n\t\t}\n\t}\n\n\ttblNames, err = changedRoot.GetTableNames(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tfor _, tblName := range tblNames {\n\t\tif _, exists := resultMap[tblName]; !exists {\n\t\t\toldHash, _, err := oldRoot.GetTableHash(ctx, tblName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tchangedHash, _, err := changedRoot.GetTableHash(ctx, tblName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tif oldHash == emptyHash {\n\t\t\t\tresultMap[tblName] = changedHash\n\t\t\t} else if force {\n\t\t\t\tresultMap[tblName] = oldHash\n\t\t\t} else if oldHash != changedHash {\n\t\t\t\tconflicts.Add(tblName)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn resultMap, nil\n}", "title": "" }, { "docid": "2db6661845d6a1d1bd6f068b15d8a565", "score": "0.4720206", "text": "func (a *AST) Merge(overwrite AST) {\r\n\tblocks := map[string][]*Block{}\r\n\tfor i, block := range a.Blocks {\r\n\t\tlist, ok := blocks[block.Name]\r\n\t\tif !ok {\r\n\t\t\tlist = []*Block{}\r\n\t\t}\r\n\t\tlist = append(list, &a.Blocks[i])\r\n\t\tblocks[block.Name] = list\r\n\t}\r\n\tblockIndices := map[string]int{}\r\n\tfor _, block := range overwrite.Blocks {\r\n\t\tidx, ok := blockIndices[block.Name]\r\n\t\tif !ok {\r\n\t\t\tidx = 0\r\n\t\t}\r\n\t\tlist, ok := blocks[block.Name]\r\n\t\tif ok && idx < len(list) {\r\n\t\t\tlist[idx].Merge(block)\r\n\t\t} else {\r\n\t\t\ta.Blocks = append(a.Blocks, block)\r\n\t\t}\r\n\t\tblockIndices[block.Name] = idx + 1\r\n\t}\r\n\tparams := map[string][]*Parameter{}\r\n\tfor i, param := range a.Parameters {\r\n\t\tlist, ok := params[param.Name]\r\n\t\tif !ok {\r\n\t\t\tlist = []*Parameter{}\r\n\t\t}\r\n\t\tlist = append(list, &a.Parameters[i])\r\n\t\tparams[param.Name] = list\r\n\t}\r\n\tparamIndices := map[string]int{}\r\n\tfor _, param := range overwrite.Parameters {\r\n\t\tidx, ok := paramIndices[param.Name]\r\n\t\tif !ok {\r\n\t\t\tidx = 0\r\n\t\t}\r\n\t\tlist, ok := params[param.Name]\r\n\t\tif ok && idx < len(list) {\r\n\t\t\tlist[idx].Merge(param)\r\n\t\t} else {\r\n\t\t\ta.Parameters = append(a.Parameters, param)\r\n\t\t}\r\n\t\tparamIndices[param.Name] = idx + 1\r\n\t}\r\n}", "title": "" }, { "docid": "7444f643332d6c8b6df9673697815188", "score": "0.47196725", "text": "func (f *Forest) Undo(ub UndoBlock) error {\n\tprevAdds := uint64(ub.numAdds)\n\tprevDels := uint64(len(ub.hashes))\n\t// how many leaves were there at the last block?\n\tprevNumLeaves := f.numLeaves + prevDels - prevAdds\n\t// run the transform to figure out where things came from\n\tleafMoves := floorTransform(ub.positions, prevNumLeaves, f.rows)\n\treverseArrowSlice(leafMoves)\n\t// first undo the leaves added in the last block\n\tf.numLeaves -= prevAdds\n\n\t// remove everything between prevNumLeaves and numLeaves from positionMap\n\tfor p := f.numLeaves; p < f.numLeaves+prevAdds; p++ {\n\t\tdelete(f.positionMap, f.data.read(p).Mini())\n\t}\n\n\t// also add everything past numleaves and prevnumleaves to dirt\n\t// which might already be there, inefficient!\n\t// TODO fix this dirt thing\n\tdirt := make([]uint64, len(leafMoves)*2)\n\n\t// place hashes starting at old post-remove numLeaves. they're off the\n\t// forest bounds to the right; they will be shuffled in to the left.\n\tfor i, h := range ub.hashes {\n\t\tif h == empty {\n\t\t\treturn fmt.Errorf(\"hash %d in undoblock is empty\", i)\n\t\t}\n\t\tf.data.write(f.numLeaves+uint64(i), h)\n\t\tdirt = append(dirt, f.numLeaves+uint64(i))\n\t}\n\n\t// go through swaps in reverse order\n\tfor i, a := range leafMoves {\n\t\tf.data.swapHash(a.from, a.to)\n\t\tdirt[2*i] = a.to // this is wrong, it way over hashes\n\t\tdirt[(2*i)+1] = a.from // also should be parents\n\t}\n\n\t// update positionMap. The stuff we do want has been moved in to the forest,\n\t// the stuff we don't want has been moved to the right past the edge\n\tfor p := f.numLeaves; p < prevNumLeaves; p++ {\n\t\tf.positionMap[f.data.read(p).Mini()] = p\n\t}\n\tfor _, p := range ub.positions {\n\t\tf.positionMap[f.data.read(p).Mini()] = p\n\t}\n\tfor _, d := range dirt {\n\t\t// everything that moved needs to have its position updated in the map\n\t\t// TODO does it..?\n\t\tm := f.data.read(d).Mini()\n\t\toldpos := f.positionMap[m]\n\t\tif oldpos != d {\n\t\t\tdelete(f.positionMap, m)\n\t\t\tf.positionMap[m] = d\n\t\t}\n\t}\n\n\t// rehash above all tos/froms\n\tf.numLeaves = prevNumLeaves // change numLeaves before rehashing\n\tsortUint64s(dirt)\n\terr := f.reHash(dirt)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6a0474ac22846eeebe639c709bbd65a7", "score": "0.47091192", "text": "func (T *SparseMerkleTree) Insert(index string, data string, epochNumber uint64) (bool) {\n\treadChannel := make(chan []*CoPathPair)\n\treadDB, err := GetReadAngelaDB()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer readDB.Close()\n\twriteDB, err := GetWriteAngelaDB()\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdefer writeDB.Close()\n\n\tfor currID := index; currID != \"\"; currID = getParent(currID) {\n\t\tplaceHolder := T.getEmpty(T.depth)\n\t\tT.cache[currID] = &placeHolder\n\t}\n\tplaceHolder := T.getEmpty(T.depth)\n\tT.cache[\"\"] = &placeHolder\n\n\tgo T.preloadCopaths(BatchedTransaction{&Transaction{ID: index, Data: data}}, readChannel, readDB)\n\n\tcopathPairs := <-readChannel\n\tfor j := 0; j < len(copathPairs); j++ {\n\t\tT.cache[copathPairs[j].ID[len(T.prefix):]] = &copathPairs[j].Digest\n\t}\n\n\tch := make(chan []*CoPathPair)\n\tquit := make(chan bool)\n\n\tgo auroraWritebackBatch(ch, quit, writeDB, T.prefix, epochNumber, 1, 1)\n\n\tdig, _ := base64.StdEncoding.DecodeString(data)\n\thash := hashDigest(dig)\n\tT.cache[index] = &hash\n\n\t//FIXME: Actual copy?\n\tvar currID string\n\tchangeList := make([]*CoPathPair, 0)\n\tchangeList = append(changeList, &CoPathPair{ID: index, Digest: hashDigest(dig)})\n\n\tfor currID = index; len(currID) > 0; {\n\t\t// Get both the parent and sibling IDs\n\t\tsiblingID, isLeft := getSibling(currID)\n\t\tparentID := getParent(currID)\n\n\t\t// Get the digest of the current node and sibling\n\t\tcurrDigestPointer := T.cache[currID] // currID will always be in cache\n\t\tsiblingDigestPointer, ok := T.cache[siblingID]\n\t\tvar siblingDigest digest\n\t\tif !ok {\n\t\t\tsiblingDigest = T.getEmpty(T.depth - len(siblingID))\n\t\t} else {\n\t\t\tsiblingDigest = *siblingDigestPointer\n\t\t}\n\t\tcurrDigest := *currDigestPointer\n\n\t\t// Hash the digests of the left and right children\n\t\tvar parentDigest digest\n\t\tif isLeft {\n\t\t\tparentDigest = hashDigest(append(siblingDigest, currDigest...))\n\t\t} else {\n\t\t\tparentDigest = hashDigest(append(currDigest, siblingDigest...))\n\t\t}\n\t\tT.cache[parentID] = &parentDigest\n\t\tchangeList = append(changeList, &CoPathPair{ID: parentID, Digest: parentDigest})\n\n\t\t// Traverse up the tree by making the current node the parent node\n\t\tcurrID = parentID\n\t}\n\tch <- changeList\n\tquit <- true\n\trootDigestPointer := T.cache[currID]\n\tT.rootDigest = *rootDigestPointer\n\treturn true\n}", "title": "" }, { "docid": "cacc4ab9173ead61280a2ead0b4c1232", "score": "0.46980482", "text": "func (t *Tree)trimTree(a,b int){\n\tt.root = trimTree(t.root,a,b)\n}", "title": "" }, { "docid": "7b0cdceb9691c0045fbe6563f65f5a94", "score": "0.4688198", "text": "func (t *largeFlatTable) Marshal(ctx MarshalContext, enc *marshal.Encoder) {\n\tt.init(ctx.ctx)\n\tenc.PutRawBytes(largeFlatMagic[:])\n\tenc.PutHash(t.hash)\n\tenc.PutGOB(&t.ast)\n\tenc.PutVarint(int64(len(t.srcTables)))\n\tfor i := range t.srcTables {\n\t\tt.srcTables[i].Marshal(ctx, enc)\n\t}\n}", "title": "" }, { "docid": "644549445bddc4a3d616e9ca51f3fbca", "score": "0.4670681", "text": "func mergeProllyTable(ctx context.Context, tm *TableMerger, mergedSch schema.Schema) (*doltdb.Table, *MergeStats, error) {\n\tmergeTbl, err := mergeTableArtifacts(ctx, tm, tm.leftTbl)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\ttm.leftTbl = mergeTbl\n\n\t// Before we merge the table data we need to fix up the primary index on the left-side of the merge for\n\t// any ordinal mapping changes (i.e. moving/dropping/adding columns).\n\t// NOTE: This won't ALWAYS be the left side... eventually we will need to optimize which side we pick\n\t// (i.e. the side that needs the least work to modify) and make this logic work for either side.\n\tlr, err := tm.leftTbl.GetRowData(ctx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tleftRows := durable.ProllyMapFromIndex(lr)\n\tvalueMerger := newValueMerger(mergedSch, tm.leftSch, tm.rightSch, tm.ancSch, leftRows.Pool())\n\tleftMapping := valueMerger.leftMapping\n\n\t// We need a sql.Context to apply column default values in merges; if we don't have one already,\n\t// create one, since this code also gets called from the CLI merge code path.\n\tsqlCtx, ok := ctx.(*sql.Context)\n\tif !ok {\n\t\tsqlCtx = sql.NewContext(ctx)\n\t}\n\n\t// Migrate primary index data to rewrite the values on the left side of the merge if necessary\n\tschemasDifferentSize := len(tm.leftSch.GetAllCols().GetColumns()) != len(mergedSch.GetAllCols().GetColumns())\n\tif schemasDifferentSize || leftMapping.IsIdentityMapping() == false {\n\t\tif err := migrateDataToMergedSchema(sqlCtx, tm, valueMerger, mergedSch); err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\t// After we migrate the data on the left-side to the new, merged schema, we reset\n\t\t// the left mapping to an identity mapping, since it's a direct mapping now.\n\t\tvalueMerger.leftMapping = val.NewIdentityOrdinalMapping(len(valueMerger.leftMapping))\n\t}\n\n\t// After we've migrated the existing data to the new schema, it's safe for us to update the schema on the table\n\tmergeTbl, err = tm.leftTbl.UpdateSchema(sqlCtx, mergedSch)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tvar stats *MergeStats\n\tmergeTbl, stats, err = mergeProllyTableData(sqlCtx, tm, mergedSch, mergeTbl, valueMerger)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\n\tn, err := mergeTbl.NumRowsInConflict(sqlCtx)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tstats.DataConflicts = int(n)\n\n\tmergeTbl, err = mergeAutoIncrementValues(sqlCtx, tm.leftTbl, tm.rightTbl, mergeTbl)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn mergeTbl, stats, nil\n}", "title": "" }, { "docid": "f8294831e5f63ea93dcda7d7601de037", "score": "0.46606022", "text": "func (r *Reader) GetDirty() (tree *model.Tree, count int) {\n\ttree = model.NewTree()\n\top := func(row RowT) (moveOn bool) {\n\t\tif memo := row.GetMemo(); memo.HasAnyTableDataChanges() {\n\t\t\ttree.Merge(memo.GetDirty())\n\t\t}\n\t\tcount++\n\t\treturn true\n\t}\n\tr.table.ForeachRowInBetween(r.from, r.to, nil, op)\n\treturn\n}", "title": "" }, { "docid": "455de951551105026086d5aebcc814eb", "score": "0.4652525", "text": "func (bpt *BplusTree) merge(parent *treeNode, curr *treeNode, currNodeIdx int,\n\tsibling *treeNode, siblIndex int, direction SearchDirection) error {\n\n\t// If merging with right sibling then append right sibling's chilren\n\t// to current node, otherwise append current nodes' children to left\n\t// sibling.\n\tvar cIndex int\n\n\t// save all nodes before modifying.\n\tbpt.tracker.origNodes.AddIfNotPresent(curr.NodeKey, curr)\n\tif sibling != nil {\n\t\tbpt.tracker.origNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t}\n\tbpt.tracker.origNodes.AddIfNotPresent(parent.NodeKey, parent)\n\tswitch {\n\tcase direction == Right:\n\t\tglog.V(2).Infof(\"merging %v and right sibling %v\\n\", curr, sibling)\n\t\tcurr.Children = append(curr.Children, sibling.Children...)\n\t\tcurr.NextKey = sibling.NextKey\n\t\t// current is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tif !sibling.NextKey.IsNil() {\n\t\t\tsibnext, err := bpt.fetch(sibling.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tsibling.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t\tsibnext.PrevKey = curr.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibnext.NodeKey, sibnext)\n\t\t}\n\t\t// sibling is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\t// drop the entry of the right node from parent's children.\n\t\tparent.Children = append(parent.Children[:siblIndex],\n\t\t\tparent.Children[siblIndex+1:]...)\n\t\tcIndex = currNodeIdx\n\tcase direction == Left:\n\t\tglog.V(2).Infof(\"merging left sibling %v and %v\\n\", sibling, curr)\n\t\tsibling.Children = append(sibling.Children, curr.Children...)\n\t\tsibling.NextKey = curr.NextKey\n\t\t// sibling is modified, add that to updatedNodes tracker.\n\t\tbpt.tracker.updatedNodes.AddIfNotPresent(sibling.NodeKey, sibling)\n\t\tif !curr.NextKey.IsNil() {\n\t\t\tcurrnext, err := bpt.fetch(curr.NextKey)\n\t\t\tif err != nil {\n\t\t\t\tglog.Errorf(\"failed to fetch %v during merge (err: %v)\",\n\t\t\t\t\tcurr.NextKey, err)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbpt.tracker.origNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t\tcurrnext.PrevKey = sibling.NodeKey\n\t\t\tbpt.tracker.updatedNodes.AddIfNotPresent(currnext.NodeKey, currnext)\n\t\t}\n\t\t// current node is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\t// drop the entry of the current node from parent's children.\n\t\t// Note that if current node is rightmost node, then we need to handle\n\t\t// that specially.\n\t\tif siblIndex == (len(parent.Children) - 2) {\n\t\t\tparent.Children = parent.Children[:siblIndex+1]\n\t\t} else {\n\t\t\tparent.Children = append(parent.Children[:siblIndex+1],\n\t\t\t\tparent.Children[siblIndex+2:]...)\n\t\t}\n\t\tcIndex = siblIndex\n\tdefault: // Merging with parent.\n\t\tglog.V(2).Infof(\"merging Parent %v and %v\\n\", parent, curr)\n\t\t// curr is being dropped, add that to deletedNodes tracker.\n\t\tbpt.tracker.deletedNodes.AddIfNotPresent(curr.NodeKey, curr)\n\t\tparent.Children = curr.Children\n\t\tparent.IsLeaf = curr.IsLeaf\n\t}\n\n\t// Parent's children has been modified. update tracker and dataKey\n\tbpt.tracker.updatedNodes.AddIfNotPresent(parent.NodeKey, parent)\n\t_, err := parent.updateDataKey(bpt, cIndex, nil)\n\treturn err\n}", "title": "" }, { "docid": "0d87f06eccaa1bc87a960d392a02a44e", "score": "0.4644605", "text": "func (self *TTree) Conbine(from *TTree) *TTree {\n\t// NOTE 避免合并不同分隔符的路由树 不应该发生\n\tif len(self.root) > 0 && len(from.root) > 0 { // 非空的Tree\n\t\tif self.__DelimitChar != from.__DelimitChar { // 分隔符对比\n\t\t\tlog.Panicf(\"could not conbine 2 different kinds (RPC/HTTP) of routes tree!\")\n\t\t\treturn self\n\t\t}\n\t}\n\n\tself.Lock()\n\tdefer self.Unlock()\n\tfor method, new_node := range from.root {\n\t\tif main_nodes, has := self.root[method]; !has {\n\t\t\tself.root[method] = new_node\n\t\t} else {\n\t\t\tfor _, node := range new_node.Children {\n\t\t\t\tself.conbine(main_nodes, node)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn self\n}", "title": "" }, { "docid": "061a172aec34a6eb85afb49a0ffedb22", "score": "0.4640968", "text": "func (t *Tree) Dump() (res []interface{}) {\n\tif t == nil {\n\t\treturn\n\t}\n\n\tt.lock.RLock()\n\tdefer t.lock.RUnlock()\n\treturn t.root.dump()\n}", "title": "" }, { "docid": "4230430098171b24c328180b4e4c5be6", "score": "0.46276549", "text": "func d8insertRectRec(branch *d8branchT, node *d8nodeT, newNode **d8nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d8nodeT\n\t\t//var newBranch d8branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d8pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d8insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d8combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d8nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d8branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d8nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d8addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d8addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "99677083053c8af37f4b0edf18122ab2", "score": "0.46194157", "text": "func mergeTable(table1 *Table, table2 Table) {\n\tfor _, column := range table2.columns {\n\t\tif containsString(convertColumnsToColumnNames(table1.columns), column.name) {\n\t\t\ttable1.columns = append(table1.columns, column)\n\t\t}\n\t}\n\n\tfor _, index := range table2.indexes {\n\t\tif containsString(convertIndexesToIndexNames(table1.indexes), index.name) {\n\t\t\ttable1.indexes = append(table1.indexes, index)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "cafac552befa5594b07db5743b5b4f21", "score": "0.4612378", "text": "func (t *Indexed) merge(l, r *Node) (root *Node) {\n\tif l == nil {\n\t\treturn r\n\t}\n\tif r == nil {\n\t\treturn l\n\t}\n\tif l.key > r.key {\n\t\tl, r = r, l\n\t}\n\tif l.p > r.p {\n\t\tsubR := t.merge(l.right, r)\n\t\tsubR.SetParent(l)\n\t\tl.right = subR\n\t\treturn l\n\t}\n\tsubL := t.merge(l, r.left)\n\tsubL.SetParent(r)\n\tr.left = subL\n\treturn r\n}", "title": "" }, { "docid": "8d134f0a6e4d6d2d284fb4673f4f8615", "score": "0.46053427", "text": "func (rbTree *RBTree)delete(curr *treeNode) *MapData {\n\tvar value = curr.Value\n\t// Both left child & right child is not nil\n\t// move right's most-left child(successor) to curr\n\t// and change curr to mright to make problem easy\n\tif curr.left != nil && curr.right != nil {\n\t\tvar mright = mostLeftChild(curr.right)\n\t\tcurr.Value = mright.Value\n\t\tcurr.Key = mright.Key\n\t\tcurr = mright\n\t}\n\t// get node's father and left, right child\n\tvar father, left, right = curr.father, curr.left, curr.right\n\t// replace node\n\tvar replace *treeNode = nil\n\tif left != nil {\n\t\t// curr's left child is nil\n\t\t// so we can just use curr's right child to fill the empty of curr's father\n\t\treplace = left\n\t\treplace.father = father\n\t\t// update rbtree\n\t\t// curr cannot be mLeft because curr's left child is not nil\n\t\tif curr == rbTree.mRight {\n\t\t\trbTree.mRight = mostRightChild(left)\n\t\t}\n\t} else if right != nil {\n\t\t// curr's right child is nil\n\t\t// so we can just use curr's left child to fill the empty of curr's father\n\t\treplace = right\n\t\treplace.father = father\n\t\t// update rbtree\n\t\t// curr cannot be mRight because curr's right child is not nil\n\t\tif curr == rbTree.mLeft {\n\t\t\trbTree.mLeft = mostLeftChild(right)\n\t\t}\n\t} else {\n\t\t// curr is a leaf curr\n\t\t// update rbtree\n\t\tif curr == rbTree.root {\n\t\t\trbTree.mLeft = nil\n\t\t\trbTree.mRight = nil\n\t\t} else if curr == father.left && curr == rbTree.mLeft {\n\t\t\trbTree.mLeft = father\n\t\t} else if curr == father.right && curr == rbTree.mRight {\n\t\t\trbTree.mRight = father\n\t\t}\n\t}\n\t// change father's attribute\n\tswitch curr {\n\tcase rbTree.root:\trbTree.root = replace\n\tcase father.left: \tfather.left = replace\n\tcase father.right: \tfather.right = replace\n\t}\n\trbTree.Size --\n\t// reshape\n\tif curr.color == BLACK {\n\t\tif replace != nil {\n\t\t\trbTree.deleteReshape(replace)\n\t\t} else {\n\t\t\trbTree.deleteReshape(curr)\n\t\t}\n\t}\n\treturn value\n}", "title": "" }, { "docid": "41eb851f3547a03b57db3b5f24754091", "score": "0.46017087", "text": "func d6insertRectRec(branch *d6branchT, node *d6nodeT, newNode **d6nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d6nodeT\n\t\t//var newBranch d6branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d6pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d6insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d6combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d6nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d6branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d6nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d6addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d6addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "138213c99d4a8ef392b8858a8485dea2", "score": "0.4596742", "text": "func (b *BaseImpl) Flatten() {\n\n\tnbytes := make([]byte, b.LenBuf())\n\n\tcopy(nbytes, b.bytes)\n\tfor i := range b.Diffs {\n\t\tcopy(nbytes[b.Diffs[i].Offset:], b.Diffs[i].bytes)\n\t}\n\tb.bytes = nbytes\n\tb.Diffs = []Diff{}\n\n}", "title": "" }, { "docid": "60b71dbc6ae2ac928b8de13c5bb5ae31", "score": "0.45962465", "text": "func d4insertRectRec(branch *d4branchT, node *d4nodeT, newNode **d4nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d4nodeT\n\t\t//var newBranch d4branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d4pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d4insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d4combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d4nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d4branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d4nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d4addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d4addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "6ffdbfe0caf3d31c68ae7938a9a9bed1", "score": "0.4591436", "text": "func Marshal(srcInterface []interface{}, schemaHandler *schema.SchemaHandler) (tb *map[string]*layout.Table, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tswitch x := r.(type) {\n\t\t\tcase string:\n\t\t\t\terr = errors.New(x)\n\t\t\tcase error:\n\t\t\t\terr = x\n\t\t\tdefault:\n\t\t\t\terr = errors.New(\"unkown error\")\n\t\t\t}\n\t\t}\n\t}()\n\n\tsrc := reflect.ValueOf(srcInterface)\n\tres := setupTableMap(schemaHandler, len(srcInterface))\n\tpathMap := schemaHandler.PathMap\n\tnodeBuf := NewNodeBuf(1)\n\n\tfor i := 0; i < len(schemaHandler.SchemaElements); i++ {\n\t\tschema := schemaHandler.SchemaElements[i]\n\t\tpathStr := schemaHandler.IndexMap[int32(i)]\n\t\tnumChildren := schema.GetNumChildren()\n\t\tif numChildren == 0 {\n\t\t\ttable := layout.NewEmptyTable()\n\t\t\ttable.Path = common.StrToPath(pathStr)\n\t\t\ttable.MaxDefinitionLevel, _ = schemaHandler.MaxDefinitionLevel(table.Path)\n\t\t\ttable.MaxRepetitionLevel, _ = schemaHandler.MaxRepetitionLevel(table.Path)\n\t\t\ttable.RepetitionType = schema.GetRepetitionType()\n\t\t\ttable.Schema = schemaHandler.SchemaElements[schemaHandler.MapIndex[pathStr]]\n\t\t\ttable.Info = schemaHandler.Infos[i]\n\t\t\t// Pre-size tables under the assumption that they'll be filled.\n\t\t\ttable.Values = make([]interface{}, 0, len(srcInterface))\n\t\t\ttable.DefinitionLevels = make([]int32, 0, len(srcInterface))\n\t\t\ttable.RepetitionLevels = make([]int32, 0, len(srcInterface))\n\t\t\tres[pathStr] = table\n\t\t}\n\t}\n\n\tstack := make([]*Node, 0, 100)\n\tfor i := 0; i < len(srcInterface); i++ {\n\t\tstack = stack[:0]\n\t\tnodeBuf.Reset()\n\n\t\tnode := nodeBuf.GetNode()\n\t\tnode.Val = src.Index(i)\n\t\tif src.Index(i).Type().Kind() == reflect.Interface {\n\t\t\tnode.Val = src.Index(i).Elem()\n\t\t}\n\t\tnode.PathMap = pathMap\n\t\tstack = append(stack, node)\n\n\t\tfor len(stack) > 0 {\n\t\t\tln := len(stack)\n\t\t\tnode := stack[ln-1]\n\t\t\tstack = stack[:ln-1]\n\n\t\t\ttk := reflect.Interface\n\t\t\tif node.Val.IsValid() {\n\t\t\t\ttk = node.Val.Type().Kind()\n\t\t\t}\n\t\t\tvar m Marshaler\n\n\t\t\tif tk == reflect.Ptr {\n\t\t\t\tm = &ParquetPtr{}\n\t\t\t} else if tk == reflect.Struct {\n\t\t\t\tm = &ParquetStruct{}\n\t\t\t} else if tk == reflect.Slice {\n\t\t\t\tm = &ParquetSlice{schemaHandler: schemaHandler}\n\t\t\t} else if tk == reflect.Map {\n\t\t\t\tschemaIndex := schemaHandler.MapIndex[node.PathMap.Path]\n\t\t\t\tsele := schemaHandler.SchemaElements[schemaIndex]\n\t\t\t\tif !sele.IsSetConvertedType() {\n\t\t\t\t\tm = &ParquetMapStruct{schemaHandler: schemaHandler}\n\t\t\t\t} else {\n\t\t\t\t\tm = &ParquetMap{schemaHandler: schemaHandler}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ttable := res[node.PathMap.Path]\n\t\t\t\tschemaIndex := schemaHandler.MapIndex[node.PathMap.Path]\n\t\t\t\tschema := schemaHandler.SchemaElements[schemaIndex]\n\t\t\t\tvar v interface{}\n\t\t\t\tif node.Val.IsValid() {\n\t\t\t\t\tv = node.Val.Interface()\n\t\t\t\t}\n\t\t\t\ttable.Values = append(table.Values, types.InterfaceToParquetType(v, schema.Type))\n\t\t\t\ttable.DefinitionLevels = append(table.DefinitionLevels, node.DL)\n\t\t\t\ttable.RepetitionLevels = append(table.RepetitionLevels, node.RL)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\toldLen := len(stack)\n\t\t\tstack = m.Marshal(node, nodeBuf, stack)\n\t\t\tif len(stack) == oldLen {\n\t\t\t\tpath := node.PathMap.Path\n\t\t\t\tindex := schemaHandler.MapIndex[path]\n\t\t\t\tnumChildren := schemaHandler.SchemaElements[index].GetNumChildren()\n\t\t\t\tif numChildren > int32(0) {\n\t\t\t\t\tfor key, table := range res {\n\t\t\t\t\t\tif common.IsChildPath(path, key) {\n\t\t\t\t\t\t\ttable.Values = append(table.Values, nil)\n\t\t\t\t\t\t\ttable.DefinitionLevels = append(table.DefinitionLevels, node.DL)\n\t\t\t\t\t\t\ttable.RepetitionLevels = append(table.RepetitionLevels, node.RL)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\ttable := res[path]\n\t\t\t\t\ttable.Values = append(table.Values, nil)\n\t\t\t\t\ttable.DefinitionLevels = append(table.DefinitionLevels, node.DL)\n\t\t\t\t\ttable.RepetitionLevels = append(table.RepetitionLevels, node.RL)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &res, nil\n}", "title": "" }, { "docid": "e2f685955fc02b18c532117dd9bd5daf", "score": "0.45910203", "text": "func (f *fragment) mergeBlock(id int, data []pairSet) (sets, clears []pairSet, err error) {\n\t// Ensure that all pair sets are of equal length.\n\tfor i := range data {\n\t\tif len(data[i].rowIDs) != len(data[i].columnIDs) {\n\t\t\treturn nil, nil, fmt.Errorf(\"pair set mismatch(idx=%d): %d != %d\", i, len(data[i].rowIDs), len(data[i].columnIDs))\n\t\t}\n\t}\n\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\n\t// Track sets and clears for all blocks (including local).\n\tsets = make([]pairSet, len(data)+1)\n\tclears = make([]pairSet, len(data)+1)\n\n\t// Limit upper row/column pair.\n\tmaxRowID := uint64(id+1) * HashBlockSize\n\tmaxColumnID := uint64(ShardWidth)\n\n\t// Create buffered iterator for local block.\n\titrs := make([]*bufIterator, 1, len(data)+1)\n\titrs[0] = newBufIterator(\n\t\tnewLimitIterator(\n\t\t\tnewRoaringIterator(f.storage.Iterator()), maxRowID, maxColumnID,\n\t\t),\n\t)\n\n\t// Append buffered iterators for each incoming block.\n\tfor i := range data {\n\t\tvar itr iterator = newSliceIterator(data[i].rowIDs, data[i].columnIDs)\n\t\titr = newLimitIterator(itr, maxRowID, maxColumnID)\n\t\titrs = append(itrs, newBufIterator(itr))\n\t}\n\n\t// Seek to initial pair.\n\tfor _, itr := range itrs {\n\t\titr.Seek(uint64(id)*HashBlockSize, 0)\n\t}\n\n\t// Determine the number of blocks needed to meet consensus.\n\t// If there is an even split then a set is used.\n\tmajorityN := (len(itrs) + 1) / 2\n\n\t// Iterate over all values in all iterators to determine differences.\n\tvalues := make([]bool, len(itrs))\n\tfor {\n\t\tvar min struct {\n\t\t\trowID uint64\n\t\t\tcolumnID uint64\n\t\t}\n\n\t\t// Find the lowest pair.\n\t\tvar hasData bool\n\t\tfor _, itr := range itrs {\n\t\t\tbid, pid, eof := itr.Peek()\n\t\t\tif eof { // no more data\n\t\t\t\tcontinue\n\t\t\t} else if !hasData { // first pair\n\t\t\t\tmin.rowID, min.columnID, hasData = bid, pid, true\n\t\t\t} else if bid < min.rowID || (bid == min.rowID && pid < min.columnID) { // lower pair\n\t\t\t\tmin.rowID, min.columnID = bid, pid\n\t\t\t}\n\t\t}\n\n\t\t// If all iterators are EOF then exit.\n\t\tif !hasData {\n\t\t\tbreak\n\t\t}\n\n\t\t// Determine consensus of point.\n\t\tvar setN int\n\t\tfor i, itr := range itrs {\n\t\t\tbid, pid, eof := itr.Next()\n\n\t\t\tvalues[i] = !eof && bid == min.rowID && pid == min.columnID\n\t\t\tif values[i] {\n\t\t\t\tsetN++ // set\n\t\t\t} else {\n\t\t\t\titr.Unread() // clear\n\t\t\t}\n\t\t}\n\n\t\t// Determine consensus value.\n\t\tnewValue := setN >= majorityN\n\n\t\t// Add a diff for any node with a different value.\n\t\tfor i := range itrs {\n\t\t\t// Value matches, ignore.\n\t\t\tif values[i] == newValue {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\t// Append to either the set or clear diff.\n\t\t\tif newValue {\n\t\t\t\tsets[i].rowIDs = append(sets[i].rowIDs, min.rowID)\n\t\t\t\tsets[i].columnIDs = append(sets[i].columnIDs, min.columnID)\n\t\t\t} else {\n\t\t\t\tclears[i].rowIDs = append(sets[i].rowIDs, min.rowID)\n\t\t\t\tclears[i].columnIDs = append(sets[i].columnIDs, min.columnID)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Set local bits.\n\tfor i := range sets[0].columnIDs {\n\t\tif _, err := f.unprotectedSetBit(sets[0].rowIDs[i], (f.shard*ShardWidth)+sets[0].columnIDs[i]); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"setting\")\n\t\t}\n\t}\n\n\t// Clear local bits.\n\tfor i := range clears[0].columnIDs {\n\t\tif _, err := f.unprotectedClearBit(clears[0].rowIDs[i], (f.shard*ShardWidth)+clears[0].columnIDs[i]); err != nil {\n\t\t\treturn nil, nil, errors.Wrap(err, \"clearing\")\n\t\t}\n\t}\n\n\treturn sets[1:], clears[1:], nil\n}", "title": "" }, { "docid": "e64f17f5e641f765da30fff10e633359", "score": "0.45881233", "text": "func d8insertRect(branch *d8branchT, root **d8nodeT, level int) bool {\n\tvar newNode *d8nodeT\n\n\tif d8insertRectRec(branch, *root, &newNode, level) { // Root split\n\n\t\t// Grow tree taller and new root\n\t\tnewRoot := &d8nodeT{}\n\t\tnewRoot.level = (*root).level + 1\n\n\t\tvar newBranch d8branchT\n\n\t\t// add old root node as a child of the new root\n\t\tnewBranch.rect = d8nodeCover(*root)\n\t\tnewBranch.child = *root\n\t\td8addBranch(&newBranch, newRoot, nil)\n\n\t\t// add the split node as a child of the new root\n\t\tnewBranch.rect = d8nodeCover(newNode)\n\t\tnewBranch.child = newNode\n\t\td8addBranch(&newBranch, newRoot, nil)\n\n\t\t// set the new root as the root node\n\t\t*root = newRoot\n\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "e57ec8d519e990aa0254dd9ccbceacaf", "score": "0.45860836", "text": "func (o *Tree) Update(ctx context.Context, exec boil.ContextExecutor, columns boil.Columns) (int64, error) {\n\tvar err error\n\tif err = o.doBeforeUpdateHooks(ctx, exec); err != nil {\n\t\treturn 0, err\n\t}\n\tkey := makeCacheKey(columns, nil)\n\ttreeUpdateCacheMut.RLock()\n\tcache, cached := treeUpdateCache[key]\n\ttreeUpdateCacheMut.RUnlock()\n\n\tif !cached {\n\t\twl := columns.UpdateColumnSet(\n\t\t\ttreeAllColumns,\n\t\t\ttreePrimaryKeyColumns,\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 trees, could not build whitelist\")\n\t\t}\n\n\t\tcache.query = fmt.Sprintf(\"UPDATE \\\"trees\\\" SET %s WHERE %s\",\n\t\t\tstrmangle.SetParamNames(\"\\\"\", \"\\\"\", 1, wl),\n\t\t\tstrmangle.WhereClause(\"\\\"\", \"\\\"\", len(wl)+1, treePrimaryKeyColumns),\n\t\t)\n\t\tcache.valueMapping, err = queries.BindMapping(treeType, treeMapping, append(wl, treePrimaryKeyColumns...))\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 trees 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 trees\")\n\t}\n\n\tif !cached {\n\t\ttreeUpdateCacheMut.Lock()\n\t\ttreeUpdateCache[key] = cache\n\t\ttreeUpdateCacheMut.Unlock()\n\t}\n\n\treturn rowsAff, o.doAfterUpdateHooks(ctx, exec)\n}", "title": "" }, { "docid": "7cd7fc5ae7e1c118d907e02cec21dc12", "score": "0.45844927", "text": "func (bpt *BplusTree) writeTree(printLayout bool) {\n\tdefer glog.Flush()\n\tnode, _ := bpt.fetch(bpt.rootKey)\n\tif node == nil {\n\t\tglog.Errorf(\"failed to fetch root key: %v\", bpt.rootKey)\n\t\treturn\n\t}\n\t// Print tree layout.\n\tif printLayout == true {\n\t\tbpt.writeLayout()\n\t}\n\n\t// Go to the left most leaf node and start printing in order.\n\tfor node != nil {\n\t\tif node.IsLeaf {\n\t\t\tbreak\n\t\t}\n\t\tnode, _ = bpt.fetch(node.Children[0].NodeKey)\n\t\tif node == nil {\n\t\t\tglog.Errorf(\"failed to fetch key: %v\", node.Children[0].NodeKey)\n\t\t\treturn\n\t\t}\n\t}\n\n\tif node == nil {\n\t\tglog.Infof(\"tree is empty\")\n\t\treturn\n\t}\n\n\tindex := 0\n\tfor {\n\t\tglog.Infof(\"leaf node: %d (DK: %v, NK: %v, XK: %v, PK: %v)\\n\",\n\t\t\tindex, node.DataKey, node.NodeKey, node.NextKey, node.PrevKey)\n\t\tfor _, child := range node.Children {\n\t\t\tglog.Infof(\"\\t%v\\n\", child)\n\t\t}\n\n\t\tif node.NextKey.IsNil() {\n\t\t\tbreak\n\t\t}\n\n\t\tif !node.NextKey.IsNil() {\n\t\t\tnextKey := node.NextKey\n\t\t\tnode, _ = bpt.fetch(nextKey)\n\t\t\tif node == nil {\n\t\t\t\tglog.Errorf(\"failed to fetch key: %v\", nextKey)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tindex++\n\t}\n}", "title": "" }, { "docid": "241425c0bdf4d6758842199daea7f32e", "score": "0.4579146", "text": "func table(ds *docState) nodes.Node {\n\tvar rows [][]*nodes.GridCell\n\tfor _, tr := range findChildAtoms(ds.cur, atom.Tr) {\n\t\tds.push(tr)\n\t\tr := tableRow(ds)\n\t\tds.pop()\n\t\trows = append(rows, r)\n\t}\n\tif len(rows) == 0 {\n\t\treturn nil\n\t}\n\treturn nodes.NewGridNode(rows...)\n}", "title": "" }, { "docid": "871b8dc1d3012b153020693f5f955644", "score": "0.45732808", "text": "func (rt *RTree) insert(height int, newEntry entry, first bool) error { //first is needed in case of overflowTreatment, it should normaly be true\n\t//[I1]\tChooseSubtree with height as a parameter to find the node N\n\tn := rt.chooseSubtree(newEntry.mbr, height)\n\t//If an internal entry is re-inserted, the node's parent pointer must be updated\n\tif height >= 1 {\n\t\tnewEntry.child.parent = n\n\t}\n\t//[I2]\tAppend newEntry to n if room, else call OverflowTreatment [for reinsertion or split]\n\tn.entries = append(n.entries, newEntry)\n\tif len(n.entries) >= RTree_M+1 { // n is full -> call overflowTreatment\n\t\tdidSplit, nn := rt.overflowTreatment(n, first) //OT finds the appropriate height from n.height\n\t\tif didSplit {\n\t\t\t//[I3]\tif OverflowTreatment was called and a split was performed: propagate OT upwards\n\t\t\tif nn.height == rt.root.height { // if root was split: create a new root\n\t\t\t\tnewRoot := node{\n\t\t\t\t\tparent: nil,\n\t\t\t\t\tentries: make([]entry, 0, RTree_M+1),\n\t\t\t\t\theight: rt.root.height + 1,\n\t\t\t\t}\n\t\t\t\tnEntry := entry{mbr: n.recalculateMBR(), child: n}\n\t\t\t\tnnEntry := entry{mbr: nn.recalculateMBR(), child: nn}\n\t\t\t\tnewRoot.entries = append(newRoot.entries, nEntry)\n\t\t\t\tnewRoot.entries = append(newRoot.entries, nnEntry)\n\t\t\t\tn.parent = &newRoot\n\t\t\t\tnn.parent = &newRoot\n\t\t\t\trt.root = &newRoot\n\t\t\t\t//fmt.Printf(\"Root was split...^ new height is %d\\n\", newRoot.height)\n\t\t\t\treturn nil //The root has no MBR, so there is no need to adjust any MBRs\n\t\t\t}\n\t\t\t// n was split into n & nn -> insert nn into the tree at the same height\n\t\t\terr := rt.insert(nn.height+1, entry{mbr: nn.recalculateMBR(), child: nn}, true)\n\t\t\tCheckErr(err, \"failed to insert nn\")\n\t\t}\n\t}\n\t//[I4]\tAdjust all MBR in the insertion path\n\tfor n.height < rt.root.height {\n\t\tpIdx, err := n.parentEntriesIdx()\n\t\tCheckErr(err, \"insert had some trouble adjusting the MBR...\")\n\t\tn.parent.entries[pIdx].mbr = n.recalculateMBR()\n\t\tn = n.parent\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "771c165e3238aed7ef563f67c447663c", "score": "0.45433637", "text": "func d1insertRectRec(branch *d1branchT, node *d1nodeT, newNode **d1nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d1nodeT\n\t\t//var newBranch d1branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d1pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d1insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d1combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d1nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d1branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d1nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d1addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d1addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "3abc5f15973bc3e32031660c31b40393", "score": "0.45390207", "text": "func rollbackTree(baseDirectory string, actions []LogEntry, dump io.Writer) {\n\tlast := len(actions) - 1\n\tfor index, _ := range actions {\n\t\tactions[last-index].Action.Rollback(actions[last-index].BaseDirectory, dump)\n\t}\n}", "title": "" }, { "docid": "cf0e65715c859d6618dae920a1179db2", "score": "0.45361072", "text": "func (d *Directory) Flush() error {\n\tcountByStartBlock := make(map[uint32]uint32)\n\tfor _, de := range d.dirEntries {\n\t\tcountByStartBlock[de.startBlock]++\n\t}\n\n\tdirBufStartBlock := d.w.dirBuf.Len() / metadataBlockSize\n\tdirBufOffset := d.w.dirBuf.Len()\n\n\tcurrentBlock := int64(-1)\n\tcurrentInodeOffset := int64(-1)\n\tvar subdirs int\n\tfor _, de := range d.dirEntries {\n\t\tif de.entryType == dirType {\n\t\t\tsubdirs++\n\t\t}\n\t\tif int64(de.startBlock) != currentBlock {\n\t\t\tdh := dirHeader{\n\t\t\t\tCount: countByStartBlock[de.startBlock] - 1,\n\t\t\t\tStartBlock: de.startBlock * (metadataBlockSize + 2),\n\t\t\t\tInodeOffset: de.inodeNumber,\n\t\t\t}\n\t\t\tif err := binary.Write(&d.w.dirBuf, binary.LittleEndian, &dh); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tcurrentBlock = int64(de.startBlock)\n\t\t\tcurrentInodeOffset = int64(de.inodeNumber)\n\t\t}\n\t\tif err := binary.Write(&d.w.dirBuf, binary.LittleEndian, &dirEntry{\n\t\t\tOffset: de.offset,\n\t\t\tInodeNumber: int16(de.inodeNumber - uint32(currentInodeOffset)),\n\t\t\tEntryType: de.entryType,\n\t\t\tSize: uint16(len(de.name) - 1),\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif _, err := d.w.dirBuf.Write([]byte(de.name)); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tstartBlock := d.w.inodeBuf.Len() / metadataBlockSize\n\toffset := d.w.inodeBuf.Len() - startBlock*metadataBlockSize\n\tinodeBufOffset := d.w.inodeBuf.Len()\n\n\t// parentInodeOffset is the offset (in bytes) of the ParentInode field\n\t// within a dirInodeHeader or ldirInodeHeader\n\tvar parentInodeOffset int64\n\n\tif len(d.dirEntries) > 256 ||\n\t\td.w.dirBuf.Len()-dirBufOffset > metadataBlockSize {\n\t\tparentInodeOffset = (2 + 2 + 2 + 2 + 4 + 4) + 4 + 4 + 4\n\t\tif err := binary.Write(&d.w.inodeBuf, binary.LittleEndian, ldirInodeHeader{\n\t\t\tinodeHeader: inodeHeader{\n\t\t\t\tInodeType: ldirType,\n\t\t\t\tMode: unix.S_IRUSR | unix.S_IWUSR | unix.S_IXUSR |\n\t\t\t\t\tunix.S_IRGRP | unix.S_IXGRP |\n\t\t\t\t\tunix.S_IROTH | unix.S_IXOTH,\n\t\t\t\tUid: 0,\n\t\t\t\tGid: 0,\n\t\t\t\tMtime: int32(d.modTime.Unix()),\n\t\t\t\tInodeNumber: d.w.sb.Inodes + 1,\n\t\t\t},\n\n\t\t\tNlink: uint32(subdirs + 2 - 1), // + 2 for . and ..\n\t\t\tFileSize: uint32(d.w.dirBuf.Len()-dirBufOffset) + 3,\n\t\t\tStartBlock: uint32(dirBufStartBlock * (metadataBlockSize + 2)),\n\t\t\tParentInode: d.w.sb.Inodes + 2, // invalid\n\t\t\tIcount: 0, // no directory index\n\t\t\tOffset: uint16(dirBufOffset - dirBufStartBlock*metadataBlockSize),\n\t\t\tXattr: invalidXattr,\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tparentInodeOffset = (2 + 2 + 2 + 2 + 4 + 4) + 4 + 4 + 2 + 2\n\t\tif err := binary.Write(&d.w.inodeBuf, binary.LittleEndian, dirInodeHeader{\n\t\t\tinodeHeader: inodeHeader{\n\t\t\t\tInodeType: dirType,\n\t\t\t\tMode: unix.S_IRUSR | unix.S_IWUSR | unix.S_IXUSR |\n\t\t\t\t\tunix.S_IRGRP | unix.S_IXGRP |\n\t\t\t\t\tunix.S_IROTH | unix.S_IXOTH,\n\t\t\t\tUid: 0,\n\t\t\t\tGid: 0,\n\t\t\t\tMtime: int32(d.modTime.Unix()),\n\t\t\t\tInodeNumber: d.w.sb.Inodes + 1,\n\t\t\t},\n\t\t\tStartBlock: uint32(dirBufStartBlock * (metadataBlockSize + 2)),\n\t\t\tNlink: uint32(subdirs + 2 - 1), // + 2 for . and ..\n\t\t\tFileSize: uint16(d.w.dirBuf.Len()-dirBufOffset) + 3,\n\t\t\tOffset: uint16(dirBufOffset - dirBufStartBlock*metadataBlockSize),\n\t\t\tParentInode: d.w.sb.Inodes + 2, // invalid\n\t\t}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tpath := d.path()\n\tfor _, offset := range d.w.writeInodeNumTo[path] {\n\t\t// Directly manipulating unread data in bytes.Buffer via Bytes(), as per\n\t\t// https://groups.google.com/d/msg/golang-nuts/1ON9XVQ1jXE/8j9RaeSYxuEJ\n\t\tb := d.w.inodeBuf.Bytes()\n\t\tbinary.LittleEndian.PutUint32(b[offset:offset+4], d.w.sb.Inodes+1)\n\t}\n\n\tif d.parent != nil {\n\t\tparentPath := filepath.Dir(d.path())\n\t\tif parentPath == \".\" {\n\t\t\tparentPath = \"\"\n\t\t}\n\t\td.w.writeInodeNumTo[parentPath] = append(d.w.writeInodeNumTo[parentPath], int64(inodeBufOffset)+parentInodeOffset)\n\t\td.parent.dirEntries = append(d.parent.dirEntries, fullDirEntry{\n\t\t\tstartBlock: uint32(startBlock),\n\t\t\toffset: uint16(offset),\n\t\t\tinodeNumber: d.w.sb.Inodes + 1,\n\t\t\tentryType: dirType,\n\t\t\tname: d.name,\n\t\t})\n\t} else { // root\n\t\td.w.sb.RootInode = Inode((startBlock*(metadataBlockSize+2))<<16 | offset)\n\t}\n\n\td.w.sb.Inodes++\n\n\treturn nil\n}", "title": "" }, { "docid": "e7c79adc66d20131f6f84e549838d8b1", "score": "0.45302182", "text": "func (d *dataUsageCache) merge(other dataUsageCache) {\n\texistingRoot := d.root()\n\totherRoot := other.root()\n\tif existingRoot == nil && otherRoot == nil {\n\t\treturn\n\t}\n\tif otherRoot == nil {\n\t\treturn\n\t}\n\tif existingRoot == nil {\n\t\t*d = other.clone()\n\t\treturn\n\t}\n\tif other.Info.LastUpdate.After(d.Info.LastUpdate) {\n\t\td.Info.LastUpdate = other.Info.LastUpdate\n\t}\n\texistingRoot.merge(*otherRoot)\n\teHash := d.rootHash()\n\tfor key := range otherRoot.Children {\n\t\tentry := other.Cache[key]\n\t\tflat := other.flatten(entry)\n\t\texisting := d.Cache[key]\n\t\t// If not found, merging simply adds.\n\t\texisting.merge(flat)\n\t\td.replaceHashed(dataUsageHash(key), &eHash, existing)\n\t}\n}", "title": "" }, { "docid": "2c0b760de68ef6e9f9018374ad436353", "score": "0.4519591", "text": "func d4insertRect(branch *d4branchT, root **d4nodeT, level int) bool {\n\tvar newNode *d4nodeT\n\n\tif d4insertRectRec(branch, *root, &newNode, level) { // Root split\n\n\t\t// Grow tree taller and new root\n\t\tnewRoot := &d4nodeT{}\n\t\tnewRoot.level = (*root).level + 1\n\n\t\tvar newBranch d4branchT\n\n\t\t// add old root node as a child of the new root\n\t\tnewBranch.rect = d4nodeCover(*root)\n\t\tnewBranch.child = *root\n\t\td4addBranch(&newBranch, newRoot, nil)\n\n\t\t// add the split node as a child of the new root\n\t\tnewBranch.rect = d4nodeCover(newNode)\n\t\tnewBranch.child = newNode\n\t\td4addBranch(&newBranch, newRoot, nil)\n\n\t\t// set the new root as the root node\n\t\t*root = newRoot\n\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "048bdb8e8bb7ef65e1cab6554ba9983c", "score": "0.45134532", "text": "func (f *Forest) dump(t *testing.T) {\n\tt.Logf(\"---------------- TRIE BEGIN ------------------\")\n\tchildNodes := make(map[string]*Node, len(f.nodes))\n\tfor _, n := range f.nodes {\n\t\tfor _, childHash := range n.branches {\n\t\t\tif len(childHash) != 0 {\n\t\t\t\tchildNodes[childHash.KeyForMap()] = f.nodes[childHash.KeyForMap()]\n\t\t\t}\n\t\t}\n\t}\n\n\tfor nodeHash := range f.nodes {\n\t\tif _, isChild := childNodes[nodeHash]; !isChild {\n\t\t\tf.nodes[nodeHash].printNode(\" Ω\", 0, f, t)\n\t\t}\n\t}\n\tt.Logf(\"---------------- TRIE END --------------------\")\n}", "title": "" }, { "docid": "10a4f735d31e633e606c540cbf87452d", "score": "0.45117068", "text": "func (s *Trie) StageUpdates(txn DbTx) {\n\ts.lock.Lock()\n\tdefer s.lock.Unlock()\n\t// Commit the new nodes to database, clear updatedNodes and store the Root in pastTries for reverts.\n\tif !s.atomicUpdate {\n\t\t// if previously AtomicUpdate was called, then past tries is already updated\n\t\ts.updatePastTries()\n\t}\n\ts.db.commit(&txn)\n\n\ts.db.updatedNodes = make(map[Hash][][]byte)\n\ts.prevRoot = s.Root\n}", "title": "" }, { "docid": "3a3c5e243a1335a04f06e48d8780c645", "score": "0.4509152", "text": "func (tr *d8RTree) RemoveAll() {\n\t// Delete all existing nodes\n\ttr.root = &d8nodeT{}\n}", "title": "" }, { "docid": "0d4bd792fa12b87daee070fa00747972", "score": "0.4502818", "text": "func (tb *Table) UpdateMetrics(m *TableMetrics) {\n\tm.ActiveInmemoryMerges += atomic.LoadUint64(&tb.activeInmemoryMerges)\n\tm.ActiveFileMerges += atomic.LoadUint64(&tb.activeFileMerges)\n\n\tm.InmemoryMergesCount += atomic.LoadUint64(&tb.inmemoryMergesCount)\n\tm.FileMergesCount += atomic.LoadUint64(&tb.fileMergesCount)\n\n\tm.InmemoryItemsMerged += atomic.LoadUint64(&tb.inmemoryItemsMerged)\n\tm.FileItemsMerged += atomic.LoadUint64(&tb.fileItemsMerged)\n\n\tm.InmemoryAssistedMerges += atomic.LoadUint64(&tb.inmemoryAssistedMerges)\n\tm.FileAssistedMerges += atomic.LoadUint64(&tb.fileAssistedMerges)\n\n\tm.ItemsAdded += atomic.LoadUint64(&tb.itemsAdded)\n\tm.ItemsAddedSizeBytes += atomic.LoadUint64(&tb.itemsAddedSizeBytes)\n\n\tm.PendingItems += uint64(tb.rawItems.Len())\n\n\ttb.partsLock.Lock()\n\n\tm.InmemoryPartsCount += uint64(len(tb.inmemoryParts))\n\tfor _, pw := range tb.inmemoryParts {\n\t\tp := pw.p\n\t\tm.InmemoryBlocksCount += p.ph.blocksCount\n\t\tm.InmemoryItemsCount += p.ph.itemsCount\n\t\tm.InmemorySizeBytes += p.size\n\t\tm.PartsRefCount += uint64(atomic.LoadUint32(&pw.refCount))\n\t}\n\n\tm.FilePartsCount += uint64(len(tb.fileParts))\n\tfor _, pw := range tb.fileParts {\n\t\tp := pw.p\n\t\tm.FileBlocksCount += p.ph.blocksCount\n\t\tm.FileItemsCount += p.ph.itemsCount\n\t\tm.FileSizeBytes += p.size\n\t\tm.PartsRefCount += uint64(atomic.LoadUint32(&pw.refCount))\n\t}\n\ttb.partsLock.Unlock()\n\n\tm.DataBlocksCacheSize = uint64(ibCache.Len())\n\tm.DataBlocksCacheSizeBytes = uint64(ibCache.SizeBytes())\n\tm.DataBlocksCacheSizeMaxBytes = uint64(ibCache.SizeMaxBytes())\n\tm.DataBlocksCacheRequests = ibCache.Requests()\n\tm.DataBlocksCacheMisses = ibCache.Misses()\n\n\tm.IndexBlocksCacheSize = uint64(idxbCache.Len())\n\tm.IndexBlocksCacheSizeBytes = uint64(idxbCache.SizeBytes())\n\tm.IndexBlocksCacheSizeMaxBytes = uint64(idxbCache.SizeMaxBytes())\n\tm.IndexBlocksCacheRequests = idxbCache.Requests()\n\tm.IndexBlocksCacheMisses = idxbCache.Misses()\n}", "title": "" }, { "docid": "b304e824b760d91c856e1a918c01cf93", "score": "0.45027298", "text": "func mergeTrees617(t1 *TNode, t2 *TNode) *TNode {\n\tif t1 == nil {\n\t\treturn t2\n\t}\n\n\tif t2 == nil {\n\t\treturn t1\n\t}\n\n\treturn &TNode{\n\t\tVal: t1.Val + t2.Val,\n\t\tLeft: mergeTrees617(t1.Left, t2.Left),\n\t\tRight: mergeTrees617(t1.Right, t2.Right),\n\t}\n}", "title": "" }, { "docid": "29ddb930f412921a36bf025cff275d1f", "score": "0.45006424", "text": "func d5insertRectRec(branch *d5branchT, node *d5nodeT, newNode **d5nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d5nodeT\n\t\t//var newBranch d5branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d5pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d5insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d5combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d5nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d5branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d5nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d5addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d5addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "05dc07d15ad6e4d0e0b07c7fc4a66bba", "score": "0.4495449", "text": "func SplitAndInsertLeafNode(cursor *Cursor, key uint32, value *Row) {\n\t// Create a new node and move half the cells over.\n\t// Insert the new value in one of the two nodes.\n\t// Update parent or create a new parent.\n\tvar oldPage *Page = GetPage(cursor.TablePtr.Pager, cursor.PageNum)\n\tvar oldMaxKey uint32 = GetNodeMaxKeys(oldPage.Mem[:])\n\tvar newPageNum uint32 = GetUnallocatedPageNum(cursor.TablePtr.Pager)\n\tvar newPage *Page = GetPage(cursor.TablePtr.Pager, newPageNum)\n\n\tInitializeLeafNode(newPage.Mem[:])\n\t*ParentNode(newPage.Mem[:]) = *ParentNode(oldPage.Mem[:])\n\n\t// insertion of leaf node's single-linked list\n\t*LeafNodeNextLeaf(newPage.Mem[:]) = *LeafNodeNextLeaf(oldPage.Mem[:])\n\t*LeafNodeNextLeaf(oldPage.Mem[:]) = newPageNum\n\n\t// All existing keys and new key should be divided\n\t// evenly between old (left) and new (right) nodes to rebalance\n\t// Starting from the right, move each key to correct position.\n\tfor i := int32(LeafNodeMaxCells); i >= 0; i-- {\n\t\tvar destinationPage *Page = nil\n\t\tif i >= LeafNodeLeftSplitCount {\n\t\t\tdestinationPage = newPage\n\t\t} else {\n\t\t\tdestinationPage = oldPage\n\t\t}\n\n\t\tvar indexWithinNode uint32 = uint32(i) % LeafNodeLeftSplitCount\n\t\tvar destinationCell []byte = LeafNodeCell(destinationPage.Mem[:], indexWithinNode)\n\t\tif uint32(i) == cursor.CellNum {\n\t\t\tSerializeRow(value, LeafNodeValue(destinationPage.Mem[:], indexWithinNode))\n\t\t\t*LeafNodeKey(destinationPage.Mem[:], indexWithinNode) = key\n\t\t} else if uint32(i) > cursor.CellNum {\n\t\t\tcopy(destinationCell, LeafNodeCell(oldPage.Mem[:], uint32(i)-1))\n\t\t} else {\n\t\t\tcopy(destinationCell, LeafNodeCell(oldPage.Mem[:], uint32(i)))\n\t\t}\n\t}\n\n\t// update leaf and right nodes num cells\n\t*LeafNodeNumCells(oldPage.Mem[:]) = LeafNodeLeftSplitCount\n\t*LeafNodeNumCells(newPage.Mem[:]) = LeafNodeRightSplitCount\n\n\tif IsRootNode(oldPage.Mem[:]) {\n\t\tCreateNewRootNode(cursor.TablePtr, newPageNum)\n\t} else {\n\t\tvar parentPageNum uint32 = *ParentNode(oldPage.Mem[:])\n\t\tvar newMaxKey uint32 = GetNodeMaxKeys(oldPage.Mem[:])\n\t\tvar parentPage *Page = GetPage(cursor.TablePtr.Pager, parentPageNum)\n\n\t\t// Update Parent Internal node\n\t\tupdateInternalNodeKey(parentPage.Mem[:], oldMaxKey, newMaxKey)\n\t\tInsertInternalNode(cursor.TablePtr, parentPageNum, newPageNum)\n\t}\n\n}", "title": "" }, { "docid": "4d11f7fc66b044f36f4fa51fdde988db", "score": "0.4491056", "text": "func (tree *Tree) persistTree(root *caching.Node) {\n\tupdateOps := make(chan *caching.Node)\n\n\tvar wg sync.WaitGroup\n\tfor w := 1; w <= tree.UpdateRoutines; w++ {\n\t\twg.Add(1)\n\t\tgo tree.persistNode(updateOps, &wg)\n\t}\n\n\ttree.persist(root, nil, updateOps)\n\tclose(updateOps)\n\twg.Wait()\n}", "title": "" }, { "docid": "e6d7a2ca4a57eab28312186bbaa4624a", "score": "0.4490682", "text": "func (db *merkleDB) commitChanges(ctx context.Context, trieToCommit *trieView) error {\n\tdb.lock.Lock()\n\tdefer db.lock.Unlock()\n\n\tswitch {\n\tcase db.closed:\n\t\treturn database.ErrClosed\n\tcase trieToCommit == nil:\n\t\treturn nil\n\tcase trieToCommit.isInvalid():\n\t\treturn ErrInvalid\n\tcase trieToCommit.committed:\n\t\treturn ErrCommitted\n\tcase trieToCommit.db != trieToCommit.getParentTrie():\n\t\treturn ErrParentNotDatabase\n\t}\n\n\tchanges := trieToCommit.changes\n\t_, span := db.tracer.Start(ctx, \"MerkleDB.commitChanges\", oteltrace.WithAttributes(\n\t\tattribute.Int(\"nodesChanged\", len(changes.nodes)),\n\t\tattribute.Int(\"valuesChanged\", len(changes.values)),\n\t))\n\tdefer span.End()\n\n\t// invalidate all child views except for the view being committed\n\tdb.invalidateChildrenExcept(trieToCommit)\n\n\t// move any child views of the committed trie onto the db\n\tdb.moveChildViewsToDB(trieToCommit)\n\n\tif len(changes.nodes) == 0 {\n\t\treturn nil\n\t}\n\n\trootChange, ok := changes.nodes[RootPath]\n\tif !ok {\n\t\treturn errNoNewRoot\n\t}\n\n\tbatch := db.nodeDB.NewBatch()\n\n\t_, nodesSpan := db.tracer.Start(ctx, \"MerkleDB.commitChanges.writeNodes\")\n\tfor key, nodeChange := range changes.nodes {\n\t\tif nodeChange.after == nil {\n\t\t\tdb.metrics.IOKeyWrite()\n\t\t\tif err := batch.Delete(key.Bytes()); err != nil {\n\t\t\t\tnodesSpan.End()\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if nodeChange.after.hasValue() || (nodeChange.before != nil && nodeChange.before.hasValue()) {\n\t\t\t// Note: If [nodeChange.after] is an intermediary node we only\n\t\t\t// persist [nodeChange] if [nodeChange.before] was a leaf.\n\t\t\t// This guarantees that the key/value pairs are correctly persisted\n\t\t\t// on disk, without being polluted by the previous value.\n\t\t\t// Otherwise, intermediary nodes are persisted on cache eviction or\n\t\t\t// shutdown.\n\t\t\tdb.metrics.IOKeyWrite()\n\t\t\tif err := writeNodeToBatch(batch, nodeChange.after); err != nil {\n\t\t\t\tnodesSpan.End()\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\tnodesSpan.End()\n\n\t_, commitSpan := db.tracer.Start(ctx, \"MerkleDB.commitChanges.dbCommit\")\n\terr := batch.Write()\n\tcommitSpan.End()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Only modify in-memory state after the commit succeeds\n\t// so that we don't need to clean up on error.\n\tdb.root = rootChange.after\n\n\tfor key, nodeChange := range changes.nodes {\n\t\tif err := db.nodeCache.Put(key, nodeChange.after); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tdb.history.record(changes)\n\treturn nil\n}", "title": "" }, { "docid": "8fd376d3c4dc23faafe71015186bb78b", "score": "0.44902232", "text": "func (bpt *BplusTree) rollback() {\n\tglog.V(2).Infof(\"Rolling back\")\n\tfor k, e := range bpt.tracker.origNodes.kmap {\n\t\t_ = bpt.context.memMgr.Insert(k, e)\n\t}\n\t// if root key is updated, then revert.\n\tif bpt.tracker.rootKeyUpdated {\n\t\tbpt.rootKey = bpt.tracker.origRootKey\n\t}\n}", "title": "" }, { "docid": "15f8faceb07f29ef077156a3ca7afa66", "score": "0.44861427", "text": "func (r *treeRecord) initialize(g *Graph, oid git.OID, tree *git.Tree) error {\n\tr.lock.Lock()\n\tdefer r.lock.Unlock()\n\n\tr.objectSize = tree.Size()\n\tr.pending = 0\n\n\titer := tree.Iter()\n\tfor {\n\t\tentry, ok, err := iter.NextEntry()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !ok {\n\t\t\tbreak\n\t\t}\n\t\tname := entry.Name\n\n\t\tswitch {\n\t\tcase entry.Filemode&0o170000 == 0o40000:\n\t\t\t// Tree\n\t\t\tlistener := func(size TreeSize) {\n\t\t\t\t// This listener is called when the tree pointed to by\n\t\t\t\t// `entry` has been fully processed.\n\t\t\t\tr.lock.Lock()\n\t\t\t\tdefer r.lock.Unlock()\n\n\t\t\t\tg.pathResolver.RecordTreeEntry(oid, name, entry.OID)\n\n\t\t\t\tr.size.addDescendent(name, size)\n\t\t\t\tr.pending--\n\t\t\t\t// This might inform *our* listeners that we are now\n\t\t\t\t// fully processed:\n\t\t\t\tr.maybeFinalize(g)\n\t\t\t}\n\t\t\ttreeSize, ok := g.RequireTreeSize(entry.OID, listener)\n\t\t\tif ok {\n\t\t\t\tr.size.addDescendent(name, treeSize)\n\t\t\t} else {\n\t\t\t\tr.pending++\n\t\t\t}\n\t\t\tr.entryCount.Increment(1)\n\n\t\tcase entry.Filemode&0o170000 == 0o160000:\n\t\t\t// Commit (i.e., submodule)\n\t\t\tr.size.addSubmodule(name)\n\t\t\tr.entryCount.Increment(1)\n\n\t\tcase entry.Filemode&0o170000 == 0o120000:\n\t\t\t// Symlink\n\t\t\tg.pathResolver.RecordTreeEntry(oid, name, entry.OID)\n\n\t\t\tr.size.addLink(name)\n\t\t\tr.entryCount.Increment(1)\n\n\t\tdefault:\n\t\t\t// Blob\n\t\t\tg.pathResolver.RecordTreeEntry(oid, name, entry.OID)\n\n\t\t\tblobSize := g.GetBlobSize(entry.OID)\n\t\t\tr.size.addBlob(name, blobSize)\n\t\t\tr.entryCount.Increment(1)\n\t\t}\n\t}\n\n\tr.maybeFinalize(g)\n\n\treturn nil\n}", "title": "" }, { "docid": "075cc3ea9ea7abf78e1e74b16da06364", "score": "0.448217", "text": "func (fs *FileSystem) RemoveAll(name string) error {\n\n\tdir, filename := fs.cleanPath(name)\n\tparent, child := fs.loadParentChild(dir, filename)\n\t_, _ = parent, child\n\tvar inos []uint64\n\n\tvar rootid uint64\n\tif dir == \"/\" {\n\t\trootid = parent.Ino\n\t}\n\n\terr := fs.Walk(filepath.Join(dir, filename), func(path string, info os.FileInfo, err error) error {\n\t\tnode, ok := info.Sys().(*iNode)\n\t\tif !ok {\n\t\t\treturn errors.New(\"unable to cast os.FileInfo to *iNode\")\n\t\t}\n\t\tinos = append(inos, node.Ino)\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor i, j := 0, len(inos)-1; i < len(inos)/2; i, j = i+1, j-1 {\n\t\tinos[i], inos[j] = inos[j], inos[i]\n\t}\n\n\terr = fs.db.Update(func(tx *bolt.Tx) error {\n\t\tnodeB := tx.Bucket([]byte(\"inodes\"))\n\t\tdataB := tx.Bucket([]byte(\"data\"))\n\n\t\tfor _, ino := range inos {\n\t\t\tif rootid != 0 && ino == rootid {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tkey := i2b(ino)\n\t\t\terr := nodeB.Delete(key)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\terr = dataB.Delete(key)\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\tif err != nil {\n\t\treturn err\n\t}\n\n\tif child == nil {\n\t\tparent.Children = parent.Children[:0]\n\t\tfs.saveInode(parent)\n\t} else {\n\t\tchild.Children = child.Children[:0]\n\t\tfs.saveInode(child)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "9b1a5cb2ef3f54dad85226b79ea9ed11", "score": "0.44805756", "text": "func (rt *RTree) reInsert(n *node) {\n\t//[RI1] for all M+1 entries: compute distance between their center and the center of the mbr of n\n\t//\tFinding the center of the MBR of n\n\ti, err := n.parentEntriesIdx()\n\tCheckErr(err, \"reInsert had some trouble locating the entry in the parent node\")\n\tcenterOfMBR := n.parent.entries[i].mbr.Center()\n\t//\tComputing the distance for all entries in n\n\tfor _, ent := range n.entries {\n\t\tent.dist = ent.mbr.Center().DistanceTo(centerOfMBR)\n\t}\n\t//[RI2] sort the entries by distance in decreasing order\n\tsort.Sort(sort.Reverse(byDist(n.entries)))\n\t//[RI3]\tremove the first p entries from n, and adjust mbr of n\n\tp := int(RTree_M * 0.3) //30% of M performs best according to [9]\n\ttmp := make([]entry, p)\n\tcopy(tmp, n.entries[:p])\n\tn.entries = n.entries[p:] //TODO now the cap of n.entries is only 8...\n\tnewMBR := n.recalculateMBR()\n\tn.parent.entries[i].mbr = newMBR\n\t//[RI4]\tstarting with min distance: invoke insert to reinsert the entries\n\tfor k := len(tmp) - 1; k >= 0; k-- {\n\t\terr := rt.insert(n.height, tmp[k], false) // \"first\" is set to false because the entry has previously been inserted\n\t\tCheckErr(err, \"reInsert failed to insert one of the entries\")\n\t}\n}", "title": "" }, { "docid": "405b41bbefe5107a806affa09680c41f", "score": "0.44752485", "text": "func CalTree(data [][]byte) {\r\n\tvar Root Node\r\n\tRoot.GenerateRoot(data, true)\r\n}", "title": "" }, { "docid": "d3475b1119400b53bb6ceca4b328e809", "score": "0.44733498", "text": "func (t *BTree) BTreeInsertNonFull(x *BTreeNode, k int) {\n\ti := x.n\n\tif x.leaf {\n\t\tfor x.n > 0 && i >= 1 && (x.keys[i-1] == -1 || k < x.keys[i-1]) {\n\t\t\ti--\n\t\t}\n\n\t\t// scooch the keys of x that are greater than k up 1 index to make room for k\n\t\tfor j := 2*t.t - 3; j >= i; j-- {\n\t\t\tx.keys[j+1] = x.keys[j]\n\t\t}\n\t\tx.keys[i] = k // assign new key k to proper index of x.keys\n\t\tx.n++ // having added the key to the node, increment the key count\n\t\t// write updates to node x to disk\n\t} else {\n\t\t// find index of child node that serves as root of the subtree we need to dig into\n\t\tfor i >= 0 && (x.keys[i] == -1 || k < x.keys[i]) {\n\t\t\ti--\n\t\t}\n\t\ti++\n\t\t// *Here is where we'd read x.children[i] from disk\n\t\t// child node of x is full; split it\n\t\tif x.children[i].n == 2*t.t-1 {\n\t\t\tt.BTreeSplitChild(x, i)\n\t\t\t// if key should go in the new node, increment the key index\n\t\t\tif k > x.keys[i] {\n\t\t\t\ti = i + 1\n\t\t\t}\n\t\t}\n\t\t// keep traversing down the tree\n\t\tt.BTreeInsertNonFull(x.children[i], k)\n\t}\n}", "title": "" }, { "docid": "e90126641e7d2894594dfa7fc23ec994", "score": "0.44710273", "text": "func (g *Graph) UpdateRoot(root Transaction) {\n\tptr := &root\n\n\tg.Lock()\n\n\tg.depthIndex[root.Depth] = append(g.depthIndex[root.Depth], ptr)\n\tg.eligibleIndex.ReplaceOrInsert((*sortByDepthTX)(ptr))\n\n\tg.transactions[root.ID] = ptr\n\n\tif g.indexer != nil {\n\t\tg.indexer.Index(hex.EncodeToString(root.ID[:]))\n\t}\n\n\tg.height = root.Depth + 1\n\n\tg.Unlock()\n\n\tg.UpdateRootDepth(root.Depth)\n}", "title": "" }, { "docid": "e29376580e85514204068744fd179c23", "score": "0.44687802", "text": "func d7insertRectRec(branch *d7branchT, node *d7nodeT, newNode **d7nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d7nodeT\n\t\t//var newBranch d7branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d7pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d7insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d7combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d7nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d7branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d7nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d7addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d7addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "c4fcfd6a2f3e69bcebc9cfcca2f723e9", "score": "0.44675642", "text": "func d2insertRectRec(branch *d2branchT, node *d2nodeT, newNode **d2nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d2nodeT\n\t\t//var newBranch d2branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d2pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d2insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d2combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d2nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d2branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d2nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d2addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d2addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "331b24c61cabba3338249743b3974cbe", "score": "0.44631976", "text": "func (mt *MerkleTree) Merge(lt, rt *MerkleTree) *MerkleTree {\n\tif lt == nil || rt == nil {\n\t\treturn mt\n\t}\n\n\tmt.leftTree = lt\n\tmt.rightTree = rt\n\tmt.updateHashCode()\n\n\treturn mt\n}", "title": "" }, { "docid": "3fe44929d3e2baa566218d0c5a52968d", "score": "0.44621652", "text": "func (db *Database) Flush(ctx context.Context) error {\n\tfor name, table := range db.tables {\n\t\tif err := table.flushBatchedEdits(ctx); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdelete(db.tables, name)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6babb9002d48354b73516a0f76c19f2d", "score": "0.44612226", "text": "func d1insertRect(branch *d1branchT, root **d1nodeT, level int) bool {\n\tvar newNode *d1nodeT\n\n\tif d1insertRectRec(branch, *root, &newNode, level) { // Root split\n\n\t\t// Grow tree taller and new root\n\t\tnewRoot := &d1nodeT{}\n\t\tnewRoot.level = (*root).level + 1\n\n\t\tvar newBranch d1branchT\n\n\t\t// add old root node as a child of the new root\n\t\tnewBranch.rect = d1nodeCover(*root)\n\t\tnewBranch.child = *root\n\t\td1addBranch(&newBranch, newRoot, nil)\n\n\t\t// add the split node as a child of the new root\n\t\tnewBranch.rect = d1nodeCover(newNode)\n\t\tnewBranch.child = newNode\n\t\td1addBranch(&newBranch, newRoot, nil)\n\n\t\t// set the new root as the root node\n\t\t*root = newRoot\n\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "140c815a7d1ceaf2193d83a79673ba43", "score": "0.44530344", "text": "func (r *treeRenderer) frame(locked, done bool) {\n\tif !locked {\n\t\tr.m.Lock()\n\t\tdefer r.m.Unlock()\n\t}\n\n\tif !done && !r.dirty {\n\t\treturn\n\t}\n\tr.dirty = false\n\n\ttermWidth, termHeight, err := r.term.Size()\n\tcontract.IgnoreError(err)\n\n\ttreeTableRows := r.treeTableRows\n\tsystemMessages := r.systemMessages\n\tstatusMessage := r.statusMessage\n\n\tvar treeTableHeight int\n\tvar treeTableHeader string\n\tif len(r.treeTableRows) > 0 {\n\t\ttreeTableHeader, treeTableRows = treeTableRows[0], treeTableRows[1:]\n\t\ttreeTableHeight = 1 + len(treeTableRows)\n\t}\n\n\tsystemMessagesHeight := len(systemMessages)\n\tif len(systemMessages) > 0 {\n\t\tsystemMessagesHeight += 3 // Account for padding + title\n\t}\n\n\tstatusMessageHeight := 0\n\tif !done && r.statusMessage != \"\" {\n\t\tstatusMessageHeight = 1\n\t}\n\n\t// Enable autoscrolling if the display is scrolled to its maximum offset.\n\tautoscroll := r.treeTableOffset == r.maxTreeTableOffset\n\n\t// Layout the display. The extra '1' accounts for the fact that we terminate each line with a newline.\n\ttotalHeight := treeTableHeight + systemMessagesHeight + statusMessageHeight + 1\n\tr.maxTreeTableOffset = 0\n\n\t// If this is not the final frame and the terminal is not large enough to show the entire display:\n\t// - If there are no system messages, devote the entire display to the tree table\n\t// - If there are system messages, devote the first two thirds of the display to the tree table and the\n\t// last third to the system messages\n\tvar treeTableFooter string\n\tif !done && totalHeight >= termHeight {\n\t\tif systemMessagesHeight > 0 {\n\t\t\tsystemMessagesHeight = termHeight / 3\n\t\t\tif systemMessagesHeight <= 3 {\n\t\t\t\tsystemMessagesHeight = 0\n\t\t\t} else {\n\t\t\t\tsystemMessagesContentHeight := systemMessagesHeight - 3\n\t\t\t\tif len(systemMessages) > systemMessagesContentHeight {\n\t\t\t\t\tsystemMessages = systemMessages[len(systemMessages)-systemMessagesContentHeight:]\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// If there are no system messages and we have a status message to display, fold the status message into the\n\t\t// last line of the tree table (where the scroll indicator is displayed).\n\t\tmergeLastLine := systemMessagesHeight == 0 && statusMessageHeight != 0\n\n\t\ttreeTableHeight = termHeight - systemMessagesHeight - statusMessageHeight - 1\n\t\tr.maxTreeTableOffset = len(treeTableRows) - treeTableHeight + 1\n\t\tscrollable := r.maxTreeTableOffset != 0\n\n\t\tif autoscroll {\n\t\t\tr.treeTableOffset = r.maxTreeTableOffset\n\t\t}\n\n\t\tif treeTableHeight <= 0 {\n\t\t\t// Ensure that the treeTableHeight is at least 1 to avoid going out of bounds.\n\t\t\ttreeTableHeight = 1\n\t\t}\n\t\ttreeTableRows = treeTableRows[r.treeTableOffset : r.treeTableOffset+treeTableHeight-1]\n\n\t\ttotalHeight = treeTableHeight + systemMessagesHeight + statusMessageHeight + 1\n\n\t\tfooter := \"\"\n\t\tif scrollable {\n\t\t\tupArrow := \" \"\n\t\t\tif r.treeTableOffset != 0 {\n\t\t\t\tupArrow = \"⬆ \"\n\t\t\t}\n\t\t\tdownArrow := \" \"\n\t\t\tif r.treeTableOffset != r.maxTreeTableOffset {\n\t\t\t\tdownArrow = \"⬇ \"\n\t\t\t}\n\t\t\tfooter = colors.BrightBlue + fmt.Sprintf(\"%smore%s\", upArrow, downArrow) + colors.Reset\n\t\t}\n\t\tpadding := termWidth - colors.MeasureColorizedString(footer)\n\n\t\t// Combine any last-line content.\n\t\tprefix := \"\"\n\t\tif mergeLastLine {\n\t\t\tprefix = r.clampLine(statusMessage, padding-1) + \" \"\n\t\t\tpadding -= colors.MeasureColorizedString(prefix)\n\t\t\tstatusMessageHeight, statusMessage = 0, \"\"\n\t\t}\n\n\t\tif padding < 0 {\n\t\t\t// Padding can potentially go negative on very small terminals.\n\t\t\t// This will cause a panic. To avoid this, we clamp the padding to 0.\n\t\t\t// The user won't be able to see anything anyway.\n\t\t\tpadding = 0\n\t\t}\n\t\ttreeTableFooter = r.opts.Color.Colorize(prefix + strings.Repeat(\" \", padding) + footer)\n\n\t\tif systemMessagesHeight > 0 {\n\t\t\ttreeTableFooter += \"\\n\"\n\t\t}\n\t}\n\n\t// Re-home the cursor.\n\tr.print(\"\\r\")\n\tfor ; r.rewind > 0; r.rewind-- {\n\t\t// If there is content that we won't overwrite, clear it.\n\t\tif r.rewind > totalHeight-1 {\n\t\t\tr.term.ClearEnd()\n\t\t}\n\t\tr.term.CursorUp(1)\n\t}\n\tr.rewind = totalHeight - 1\n\n\t// Render the tree table.\n\tr.overln(r.clampLine(treeTableHeader, termWidth))\n\tfor _, row := range treeTableRows {\n\t\tr.overln(r.clampLine(row, termWidth))\n\t}\n\tif treeTableFooter != \"\" {\n\t\tr.over(treeTableFooter)\n\t}\n\n\t// Render the system messages.\n\tif systemMessagesHeight > 0 {\n\t\tr.overln(\"\")\n\t\tr.overln(colors.Yellow + \"System Messages\" + colors.Reset)\n\n\t\tfor _, line := range systemMessages {\n\t\t\tr.overln(\" \" + line)\n\t\t}\n\t}\n\n\t// Render the status message, if any.\n\tif statusMessageHeight != 0 {\n\t\tpadding := termWidth - colors.MeasureColorizedString(statusMessage)\n\n\t\tr.overln(\"\")\n\t\tr.over(statusMessage + strings.Repeat(\" \", padding))\n\t}\n\n\tif done && totalHeight > 0 {\n\t\tr.overln(\"\")\n\t}\n\n\t// Handle the status message timer. We do this at the end to ensure that any message is displayed for at least one\n\t// frame.\n\tif !r.statusMessageDeadline.IsZero() && r.statusMessageDeadline.Before(time.Now()) {\n\t\tr.statusMessage, r.statusMessageDeadline = \"\", time.Time{}\n\t}\n}", "title": "" }, { "docid": "b952073e2ac0577427ee08ca29ef45d6", "score": "0.44530246", "text": "func fillSumTree (input, binTree []int, nodeIndex, inputIndex int) {\n\t// return when at end of input\n\tif( inputIndex == len(input)){ return }\n\n\tbinTree[2*nodeIndex+1] = binTree[nodeIndex]+input[inputIndex] // left node = current node + current input\n\tbinTree[2*nodeIndex+2] = binTree[nodeIndex] // right node = current node\n\n\t// inputIndex+1 for each call to maintain uniform depth on descend\n\tfillSumTree(input,binTree,2*nodeIndex+1,inputIndex+1) // descend left \n\tfillSumTree(input,binTree,2*nodeIndex+2,inputIndex+1) // descend right\n}", "title": "" }, { "docid": "095f8368b710be48ffc4d5b0c140b4e0", "score": "0.44487402", "text": "func (rbTree *RBTree)insertReshape(X *treeNode) {\n\tX.color = RED\n\t// X not root && X is red and his father is red too\n\tfor X != rbTree.root && X.father.color == RED {\n\t\tif X.father == X.father.father.left {\n\t\t\t// FF FF\n\t\t\t// / \\ / \\\n\t\t\t// F Y or F Y\n\t\t\t// / \\\n\t\t\t// X X\n\t\t\t// Y is FF's right child\n\t\t\tvar Y = X.father.father.right\n\t\t\t// Y is not nil and red\n\t\t\tif Y != nil && Y.color == RED {\n\t\t\t\tX.father.color = BLACK\n\t\t\t\tY.color = BLACK\n\t\t\t\tX.father.father.color = RED\n\t\t\t\tX = X.father.father\n\t\t\t} else {\n\t\t\t\t// FF\n\t\t\t\t// / \\\n\t\t\t\t// F Y\n\t\t\t\t// \\\n\t\t\t\t// X\n\t\t\t\t// X is F's right child\n\t\t\t\tif X == X.father.right {\n\t\t\t\t\t// rotate left with pivot X's father\n\t\t\t\t\tX = X.father\n\t\t\t\t\trbTree.rotateLeft(X)\n\t\t\t\t}\n\t\t\t\t// FF\n\t\t\t\t// / \\\n\t\t\t\t// F Y\n\t\t\t\t// /\n\t\t\t\t// X\n\t\t\t\t// X is F's right child\n\t\t\t\t// change color\n\t\t\t\tX.father.color = BLACK\n\t\t\t\tX.father.father.color = RED\n\t\t\t\t// rotate right with pivot X's grandfather\n\t\t\t\trbTree.rotateRight(X.father.father)\n\t\t\t}\n\t\t} else {\n\t\t\t// FF FF\n\t\t\t// / \\ / \\\n\t\t\t// Y F or Y F\n\t\t\t// / \\\n\t\t\t// X X\n\t\t\t// Y is FF's left child\n\t\t\tvar Y = X.father.father.left\n\t\t\t// Y is not nil and red\n\t\t\tif Y != nil && Y.color == RED {\n\t\t\t\tX.father.color = BLACK\n\t\t\t\tY.color = BLACK\n\t\t\t\tX.father.father.color = RED\n\t\t\t\tX = X.father.father\n\t\t\t} else {\n\t\t\t\t// FF\n\t\t\t\t// / \\\n\t\t\t\t// Y F\n\t\t\t\t// /\n\t\t\t\t// X\n\t\t\t\t// X is F's left child\n\t\t\t\tif X == X.father.left {\n\t\t\t\t\t// rotate right with pivot X's father\n\t\t\t\t\tX = X.father\n\t\t\t\t\trbTree.rotateRight(X)\n\t\t\t\t}\n\t\t\t\t// FF\n\t\t\t\t// / \\\n\t\t\t\t// Y F\n\t\t\t\t// \\\n\t\t\t\t// X\n\t\t\t\t// X is F's right child\n\t\t\t\t// change color\n\t\t\t\tX.father.color = BLACK\n\t\t\t\tX.father.father.color = RED\n\t\t\t\t// rotate left with pivot X's grandfather\n\t\t\t\trbTree.rotateLeft(X.father.father)\n\t\t\t}\n\t\t}\n\t}\n\t// root is black\n\trbTree.root.color = BLACK\n}", "title": "" }, { "docid": "d906c9101de638fc2201da467bd6b2b2", "score": "0.44482037", "text": "func d16insertRectRec(branch *d16branchT, node *d16nodeT, newNode **d16nodeT, level int) bool {\n\t// recurse until we reach the correct level for the new record. data records\n\t// will always be called with a_level == 0 (leaf)\n\tif node.level > level {\n\t\t// Still above level for insertion, go down tree recursively\n\t\tvar otherNode *d16nodeT\n\t\t//var newBranch d16branchT\n\n\t\t// find the optimal branch for this record\n\t\tindex := d16pickBranch(&branch.rect, node)\n\n\t\t// recursively insert this record into the picked branch\n\t\tchildWasSplit := d16insertRectRec(branch, node.branch[index].child, &otherNode, level)\n\n\t\tif !childWasSplit {\n\t\t\t// Child was not split. Merge the bounding box of the new record with the\n\t\t\t// existing bounding box\n\t\t\tnode.branch[index].rect = d16combineRect(&branch.rect, &(node.branch[index].rect))\n\t\t\treturn false\n\t\t} else {\n\t\t\t// Child was split. The old branches are now re-partitioned to two nodes\n\t\t\t// so we have to re-calculate the bounding boxes of each node\n\t\t\tnode.branch[index].rect = d16nodeCover(node.branch[index].child)\n\t\t\tvar newBranch d16branchT\n\t\t\tnewBranch.child = otherNode\n\t\t\tnewBranch.rect = d16nodeCover(otherNode)\n\n\t\t\t// The old node is already a child of a_node. Now add the newly-created\n\t\t\t// node to a_node as well. a_node might be split because of that.\n\t\t\treturn d16addBranch(&newBranch, node, newNode)\n\t\t}\n\t} else if node.level == level {\n\t\t// We have reached level for insertion. Add rect, split if necessary\n\t\treturn d16addBranch(branch, node, newNode)\n\t} else {\n\t\t// Should never occur\n\t\treturn false\n\t}\n}", "title": "" }, { "docid": "8e5ca8cf52bd371e2ae7071c078c7878", "score": "0.44461763", "text": "func (e *EditTree) Render() *ast.Term {\n\tif e.value == nil {\n\t\treturn nil\n\t}\n\n\tswitch x := e.value.Value.(type) {\n\tcase ast.Object:\n\t\t// Early exit if no modifications.\n\t\tif len(e.childKeys) == 0 {\n\t\t\treturn e.value\n\t\t}\n\t\t// Build a new Object with modified/deleted keys.\n\t\t// We do this by adding the modified/deleted keys first, then\n\t\t// skipping those keys later when iterating over the original base\n\t\t// term in e.value.\n\t\tskipKeysList := make([]*ast.Term, 0, len(e.childKeys))\n\t\tout := make([][2]*ast.Term, 0, len(e.childKeys)+x.Len())\n\t\tfor hash, term := range e.childScalarValues {\n\t\t\tskipKeysList = append(skipKeysList, e.childKeys[hash])\n\t\t\tif term == nil {\n\t\t\t\tcontinue // Delete case.\n\t\t\t}\n\t\t\t// Normal value case.\n\t\t\tout = append(out, [2]*ast.Term{e.childKeys[hash], term})\n\t\t}\n\t\tfor hash, child := range e.childCompositeValues {\n\t\t\tskipKeysList = append(skipKeysList, e.childKeys[hash])\n\t\t\tif child == nil {\n\t\t\t\tcontinue // Delete case.\n\t\t\t}\n\t\t\t// Normal value case.\n\t\t\tsubtreeResult := child.Render()\n\t\t\tout = append(out, [2]*ast.Term{e.childKeys[hash], subtreeResult})\n\t\t}\n\t\tskipKeys := ast.NewSet(skipKeysList...)\n\t\t// Copy over all keys that weren't deleted/modified.\n\t\tx.Foreach(func(k, v *ast.Term) {\n\t\t\tif skipKeys.Contains(k) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tout = append(out, [2]*ast.Term{k, v})\n\t\t})\n\t\treturn ast.ObjectTerm(out...)\n\tcase ast.Set:\n\t\t// Early exit if no modifications.\n\t\tif len(e.childKeys) == 0 {\n\t\t\treturn e.value\n\t\t}\n\t\t// Build a new Set.\n\t\t// Sets only can have deletions/new insertions, because the value\n\t\t// *is* its own key.\n\t\tskipKeysList := make([]*ast.Term, 0, len(e.childKeys))\n\t\tout := make([]*ast.Term, 0, x.Len()+len(e.childKeys))\n\t\tfor hash, term := range e.childScalarValues {\n\t\t\tskipKeysList = append(skipKeysList, e.childKeys[hash])\n\t\t\tif term == nil {\n\t\t\t\tcontinue // Delete case.\n\t\t\t}\n\t\t\t// Normal value case.\n\t\t\tout = append(out, e.childScalarValues[hash])\n\t\t}\n\t\t// Only happens when this set hasn't been collapsed yet.\n\t\tfor hash, child := range e.childCompositeValues {\n\t\t\tskipKeysList = append(skipKeysList, e.childKeys[hash])\n\t\t\tif child == nil {\n\t\t\t\tcontinue // Delete case.\n\t\t\t}\n\t\t\t// Normal value case.\n\t\t\tsubtreeResult := child.Render()\n\t\t\tout = append(out, subtreeResult)\n\t\t}\n\t\tskipKeys := ast.NewSet(skipKeysList...)\n\t\t// Copy over all keys that weren't deleted/modified.\n\t\tx.Foreach(func(key *ast.Term) {\n\t\t\tif skipKeys.Contains(key) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tout = append(out, key)\n\t\t})\n\t\treturn ast.SetTerm(out...)\n\tcase *ast.Array:\n\t\t// No early exit here, because we might have just deletes on the\n\t\t// original array. We build a new Array with modified/deleted keys.\n\t\tout := make([]*ast.Term, 0, e.insertions.Length())\n\t\teIdx := 0\n\t\tfor i := 0; i < e.insertions.Length(); i++ {\n\t\t\t// If the index == 0, that indicates we should look up the next\n\t\t\t// surviving original element.\n\t\t\t// If the index == 1, that indicates we should look up that\n\t\t\t// index in the child maps.\n\t\t\tif e.insertions.Element(i) == 0 {\n\t\t\t\t// Scan through the e.eliminated bit-vec, pick the\n\t\t\t\t// first non-zero index. The then use that index to\n\t\t\t\t// look up the element we should append from e.value.\n\t\t\t\tfoundIdx := false\n\t\t\t\tfor j := eIdx; j < e.eliminated.Length(); j++ {\n\t\t\t\t\tif e.eliminated.Element(j) == 0 {\n\t\t\t\t\t\tfoundIdx = true\n\t\t\t\t\t\teIdx = j\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif !foundIdx {\n\t\t\t\t\tpanic(fmt.Errorf(\"too many eliminated indexes in array, expected to find uneliminated index %d\", i))\n\t\t\t\t}\n\t\t\t\t// Append element from original term.\n\t\t\t\tout = append(out, x.Elem(eIdx))\n\t\t\t\teIdx++ // Bump the counter, so that we monotonically advance through the array.\n\t\t\t} else {\n\t\t\t\t// Append value from rendered child index.\n\t\t\t\t// Since deletions are not possible as children for an Array,\n\t\t\t\t// we don't need to check for nils here.\n\t\t\t\tif t, ok := e.childScalarValues[i]; ok {\n\t\t\t\t\tout = append(out, t)\n\t\t\t\t} else if child, ok := e.childCompositeValues[i]; ok {\n\t\t\t\t\tt := child.Render()\n\t\t\t\t\tout = append(out, t)\n\t\t\t\t} else {\n\t\t\t\t\tpanic(fmt.Errorf(\"invalid index %d does not exist in array\", i))\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn ast.ArrayTerm(out...)\n\tdefault:\n\t\treturn e.value\n\t}\n}", "title": "" }, { "docid": "e58c3f4cfb40010b9be7aa5db0cd4791", "score": "0.44417048", "text": "func (rfs *RootFileSystem) Format(bc int, bs int) {\n\trfs.BlockHandler.Format(bc, bs)\n\t// Write Raw Directory node\n\trdn := DirectoryNode{Folders: make(map[string]BlockNode), Files: make(map[string]BlockNode), Continuation: NilBlock}\n\trdn.Stats.setNow()\n\tblockNode := rfs.BlockHandler.GetFreeBlockNode(DIRECTORY)\n\trdn.Node = blockNode\n\tsearchNode := rfs.BlockHandler.GetFreeBlockNode(SEARCHINDEX)\n\tsearchIndex := SearchIndex{Node: searchNode, Terms: make(map[string]BlockNode)}\n\n\trfs.BlockHandler.SaveRawBlock(searchNode, rawBlock(searchIndex))\n\n\tRoot := rfs.BlockHandler.SaveRawBlock(blockNode, rawBlock(rdn))\n\tsb := SuperBlockNode{SuperBlock, bc, bs, Root, searchNode}\n\n\trfs.BlockHandler.SaveRawBlock(SuperBlock, rawBlock(sb))\n\trfs.SuperBlock = sb\n}", "title": "" }, { "docid": "2e7cc3af87654bb9c0558f12005c9e77", "score": "0.44392937", "text": "func (root *Node) detach() {\n\tsize := root.size\n\tcurr := root\n\tfor curr.parent != nil {\n\t\tcurr.parent.size -= size\n\t\tcurr = curr.parent\n\t}\n\tif root.parent != nil {\n\t\tdelete(root.parent.children, filepath.Base(root.fullPath))\n\t}\n\troot.parent = nil\n}", "title": "" }, { "docid": "c44b9872ee78b720796e71cef9a7a9b4", "score": "0.44389084", "text": "func (dt *dumpTable) prepareDumpFiles() {\n\n\tif dt.dataLength < dt.d.cfg.FileTargetSize {\n\t\tdf, _ := NewDumpFileSummary(dt, 0, 0) // small table\n\t\tdt.d.dumpFileQueue = append(dt.d.dumpFileQueue, df)\n\t} else {\n\t\tfor i := dt.min; i < dt.max; i += dt.rowsPerFile {\n\t\t\tstart := i\n\t\t\tend := i + dt.rowsPerFile - 1\n\n\t\t\tif i == dt.min {\n\t\t\t\tstart = 0\n\t\t\t}\n\n\t\t\tif end > dt.max {\n\t\t\t\tend = 0\n\t\t\t}\n\n\t\t\tdf, _ := NewDumpFileSummary(dt, start, end)\n\t\t\tdt.d.dumpFileQueue = append(dt.d.dumpFileQueue, df)\n\t\t}\n\t}\n}", "title": "" } ]
e080ae9b3cf2879f5134c17b0126985a
/ GetQuery Retrieve Query Returns information about a query.
[ { "docid": "a67783e731bc692fec13c12e03b73427", "score": "0.66247284", "text": "func (a *QueriesApiService) GetQuery(ctx context.Context, queryId string) ApiGetQueryRequest {\n\treturn ApiGetQueryRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tqueryId: queryId,\n\t}\n}", "title": "" } ]
[ { "docid": "25e73e6c83093f2e9204bf2e2df4f814", "score": "0.75372845", "text": "func (r *ThanosQueryInstantRequest) GetQuery() string { return r.Query }", "title": "" }, { "docid": "77388977e0f3d8cfb786097549e7155a", "score": "0.7308813", "text": "func (g *GetStoryViewersRequest) GetQuery() (value string) {\n\tif g == nil {\n\t\treturn\n\t}\n\treturn g.Query\n}", "title": "" }, { "docid": "fa40324af6d0b35c3f90f70dae849c15", "score": "0.7273974", "text": "func (o *SyntheticsTestRequest) GetQuery() interface{} {\n\tif o == nil || o.Query == nil {\n\t\tvar ret interface{}\n\t\treturn ret\n\t}\n\treturn o.Query\n}", "title": "" }, { "docid": "1364ecd76d60bc80254fbeaeb77849bc", "score": "0.71940154", "text": "func (c *Client) GetQuery(qp *queryParameters) (*GetQueryResponse, error) {\n\t// https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson&starttime=2014-01-01&endtime=2014-01-02\n\t// https://earthquake.usgs.gov/fdsnws/event/1/query?format=xml&starttime=2014-01-01&endtime=2014-01-02&minmagnitude=5\n\tresp, err := c.c.Get(\"/query?\" + qp.Encode())\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\tvar v GetQueryResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&v); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &v, nil\n}", "title": "" }, { "docid": "428743244e05f6b5e77903dd750e3654", "score": "0.714333", "text": "func (a *Alert) GetQuery() string {\n\tif a == nil || a.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *a.Query\n}", "title": "" }, { "docid": "7beeab189f023e1e77a6fc91ecee8b56", "score": "0.71243495", "text": "func (m *Monitor) GetQuery() string {\n\tif m == nil || m.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *m.Query\n}", "title": "" }, { "docid": "20494d3ae8f40b2404790c02972d7385", "score": "0.7109171", "text": "func (_ *QueryContract) GetQuery(ctx context.TransactionContextInterface, queryId string) (*dataStructs.Query, error) {\n\n\tqueryString := fmt.Sprintf(\"{\\\"selector\\\":{\\\"type\\\":\\\"Query\\\",\\\"queryId\\\":\\\"%s\\\"}}\", queryId)\n\tresultsIterator, err := ctx.GetStub().GetQueryResult(queryString)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresults, err := utils.GetIteratorValues(resultsIterator, new(dataStructs.Query))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(results) == 0 {\n\t\treturn nil, fmt.Errorf(\"Query doesn't exists\")\n\t}\n\n\treturn results[0].(*dataStructs.Query), nil\n}", "title": "" }, { "docid": "f3f56c09a312ff8a32c98610e10e3fea", "score": "0.70078486", "text": "func (g *GraphEvent) GetQuery() string {\n\tif g == nil || g.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.Query\n}", "title": "" }, { "docid": "c63996f3a6798d0cceda22af12412197", "score": "0.69899786", "text": "func (g *GraphDefinitionRequest) GetQuery() string {\n\tif g == nil || g.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *g.Query\n}", "title": "" }, { "docid": "f01317c836613ec9a17da3bc11960829", "score": "0.69776946", "text": "func (o *SearchAllFood200Response) GetQuery() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\n\treturn o.Query\n}", "title": "" }, { "docid": "74b5bb9f7dbc11dc477a5a5a3de29476", "score": "0.6969786", "text": "func (o *FormulaAndFunctionMetricQueryDefinition) GetQuery() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn o.Query\n}", "title": "" }, { "docid": "b0032172624a201e8e3bbb2ff0f1fbd7", "score": "0.69563234", "text": "func (r *RecordList) GetQuery() string {\n\treturn r.Query\n}", "title": "" }, { "docid": "f6683a1e3a3c11a01ce123b8b2e4c207", "score": "0.6944745", "text": "func (r *ThanosQueryRangeRequest) GetQuery() string { return r.Query }", "title": "" }, { "docid": "ead23873214480d082bb205b7a757fc2", "score": "0.6935326", "text": "func (t *TileDefRequest) GetQuery() string {\n\tif t == nil || t.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Query\n}", "title": "" }, { "docid": "5035a171ce45ee32ba48639c89ac427d", "score": "0.68670565", "text": "func (v *CountWorkflowExecutionsRequest) GetQuery() (o string) {\n\tif v != nil && v.Query != nil {\n\t\treturn *v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "0078471106fc516eccd2759b5337e081", "score": "0.68617934", "text": "func (o *TemplateSummaryDiffTaskFields) GetQuery() string {\n\tif o == nil || o.Query == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Query\n}", "title": "" }, { "docid": "474c37d4798b099bcf290e8c73158b03", "score": "0.6832218", "text": "func (v *QueryWorkflowRequest) GetQuery() (o *WorkflowQuery) {\n\tif v != nil && v.Query != nil {\n\t\treturn v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "6137197b3e15e367878784b45c162e9e", "score": "0.68206", "text": "func (i *InputMediaDocument) GetQuery() (value string, ok bool) {\n\tif !i.Flags.Has(1) {\n\t\treturn value, false\n\t}\n\treturn i.Query, true\n}", "title": "" }, { "docid": "8d81a02af92eae0bb644de731e4ac4b9", "score": "0.67679524", "text": "func (v *ListArchivedWorkflowExecutionsRequest) GetQuery() (o string) {\n\tif v != nil && v.Query != nil {\n\t\treturn *v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "e55e7245dd095af0d40d81ae5679eef2", "score": "0.67472064", "text": "func (r *ThanosSeriesRequest) GetQuery() string { return \"\" }", "title": "" }, { "docid": "facf261d31fb054f48ed32a6b5f4ed72", "score": "0.67258286", "text": "func (t *TileDefEvent) GetQuery() string {\n\tif t == nil || t.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Query\n}", "title": "" }, { "docid": "0142da6feb3c82c8403566c3888ccb90", "score": "0.67189455", "text": "func (v *ListWorkflowExecutionsRequest) GetQuery() (o string) {\n\tif v != nil && v.Query != nil {\n\t\treturn *v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "412984caffb12c487024c8dfaf71cac5", "score": "0.6711089", "text": "func (w *Widget) GetQuery() string {\n\tif w == nil || w.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *w.Query\n}", "title": "" }, { "docid": "da4754d32202557bebef194d19a9c5f2", "score": "0.6677687", "text": "func (c *Context) GetQuery(key string) (string, bool) {\n\tif querys, ok := c.GetQueryArray(key); ok {\n\t\treturn querys[0], true\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "a5bdb1b56e99c178ea088714010cc19f", "score": "0.6676842", "text": "func (u *UpdateNewInlineQuery) GetQuery() (value string) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Query\n}", "title": "" }, { "docid": "d954a928d724b0fec5000fc804b671ea", "score": "0.6660833", "text": "func (u *UpdateNewChosenInlineResult) GetQuery() (value string) {\n\tif u == nil {\n\t\treturn\n\t}\n\treturn u.Query\n}", "title": "" }, { "docid": "cb07654b491c3882cc59c20c0a1d4641", "score": "0.6467432", "text": "func (client *ClientImpl) GetQuery(ctx context.Context, args GetQueryArgs) (*QueryHierarchyItem, error) {\n\trouteValues := make(map[string]string)\n\tif args.Project == nil || *args.Project == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.Project\"}\n\t}\n\trouteValues[\"project\"] = *args.Project\n\tif args.Query == nil || *args.Query == \"\" {\n\t\treturn nil, &azuredevops.ArgumentNilOrEmptyError{ArgumentName: \"args.Query\"}\n\t}\n\trouteValues[\"query\"] = *args.Query\n\n\tqueryParams := url.Values{}\n\tif args.Expand != nil {\n\t\tqueryParams.Add(\"$expand\", string(*args.Expand))\n\t}\n\tif args.Depth != nil {\n\t\tqueryParams.Add(\"$depth\", strconv.Itoa(*args.Depth))\n\t}\n\tif args.IncludeDeleted != nil {\n\t\tqueryParams.Add(\"$includeDeleted\", strconv.FormatBool(*args.IncludeDeleted))\n\t}\n\tif args.UseIsoDateFormat != nil {\n\t\tqueryParams.Add(\"$useIsoDateFormat\", strconv.FormatBool(*args.UseIsoDateFormat))\n\t}\n\tlocationId, _ := uuid.Parse(\"a67d190c-c41f-424b-814d-0e906f659301\")\n\tresp, err := client.Client.Send(ctx, http.MethodGet, locationId, \"7.1-preview.2\", routeValues, queryParams, nil, \"\", \"application/json\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar responseValue QueryHierarchyItem\n\terr = client.Client.UnmarshalBody(resp, &responseValue)\n\treturn &responseValue, err\n}", "title": "" }, { "docid": "23d4c23973bdc9fecc54d1f779a6aaa3", "score": "0.64637196", "text": "func (r *Request) GetQuery(key string) (string, bool) {\n\tif values, ok := r.GetQueryArray(key); ok {\n\t\treturn values[0], ok\n\t}\n\treturn \"\", false\n}", "title": "" }, { "docid": "bbbdeab6d676eed77a0e4243f58e9b36", "score": "0.64616776", "text": "func (v *PollForDecisionTaskResponse) GetQuery() (o *WorkflowQuery) {\n\tif v != nil && v.Query != nil {\n\t\treturn v.Query\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "5289bc27c7936fbe58f80f840bf02ce6", "score": "0.64264786", "text": "func (c *Client) Query(q string) *Query {\n\treturn &Query{\n\t\tclient: c,\n\t\tQueryConfig: QueryConfig{Q: q},\n\t}\n}", "title": "" }, { "docid": "8abdf4570ce2b5a82e8bd1dacc675532", "score": "0.6424376", "text": "func (o *UserSessionQueryTileAllOf) GetQuery() string {\n\tif o == nil || o.Query == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Query\n}", "title": "" }, { "docid": "d63d5f149c07ea6c060851d559fc7d01", "score": "0.6417761", "text": "func (config *Config) GetQuery() func(w http.ResponseWriter, r *http.Request) {\n\treturn func(w http.ResponseWriter, r *http.Request) {\n\t\t// Read request body and close it\n\t\tbody, err := ioutil.ReadAll(io.LimitReader(r.Body, 1048576))\n\t\tHandleError(err)\n\t\tdefer r.Body.Close()\n\n\t\t//Retrieve query result\n\t\tresult, err := config.PerformQuery(string(body))\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\tif err != nil {\n\t\t\tHandleError(err)\n\t\t\tw.WriteHeader(500)\n\t\t\terrorJSON := ErrorJSON{Status: \"Query Failed\", Error: \"Query probably not correctly formatted.\"}\n\t\t\tmarshalled, marshallErr := json.Marshal(errorJSON)\n\t\t\tHandleError(marshallErr)\n\t\t\tfmt.Fprintf(w, string(marshalled))\n\t\t} else {\n\t\t\tfmt.Fprintf(w, *result)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "af38ddbdb6ec4c5f8c01a938d378052a", "score": "0.64012367", "text": "func (t *Team) ReadQuery() string {\n\treturn teamQueries[\"read\"]\n}", "title": "" }, { "docid": "8b08015e1ee7762f81f0c43fb277590e", "score": "0.63978183", "text": "func (client *AppSyncClient) Query(method, variables, query string) (str string, err error) {\n\treturn str, err\n}", "title": "" }, { "docid": "7245c0438e143b48e5631b48bc083f21", "score": "0.63223743", "text": "func (o *BigQueryDatasetConfig) GetQuery() string {\n\tif o == nil || o.Query == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Query\n}", "title": "" }, { "docid": "f79fcd2d6df10e205307042ed007cd40", "score": "0.63137347", "text": "func (ws *WebSoc) Query() string {\n\treturn ws.query\n}", "title": "" }, { "docid": "301c536852d55bc42f409a109a832bd4", "score": "0.63047", "text": "func NewQuery() *Query {\n\treturn &Query{}\n}", "title": "" }, { "docid": "4d4b6c92897264a717f067d959b493e5", "score": "0.6292268", "text": "func (r Repo) Query(query string) (*sparql.Results, error) {\n\treturn r.query(http.MethodGet, query)\n}", "title": "" }, { "docid": "b31648d8bf90b05030b3c64f648ef4c7", "score": "0.62768185", "text": "func (c *Client) Query() *Query {\n\treturn &Query{c}\n}", "title": "" }, { "docid": "0828e6da2fcf24fdec2abd8a028b323f", "score": "0.62635887", "text": "func (c *Context) Query(key string) string {\n\tquery, _ := c.GetQuery(key)\n\treturn query\n}", "title": "" }, { "docid": "559affce60fe63bd6c3b50445d4699c7", "score": "0.6227114", "text": "func (tv *View) Query() string {\n\treturn tv.QueryText\n}", "title": "" }, { "docid": "31e90b1fc9b0d4ae818f23b02b469a43", "score": "0.6221941", "text": "func NewQuery() *Query {\n\treturn &Query{queries: make(map[string]string)}\n}", "title": "" }, { "docid": "265ca4871af8a600beabcef179a19d3b", "score": "0.6216052", "text": "func (app *BftApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {\n\tif reqQuery.Prove {\n\t\tvalue, proof, err := app.state.GetWithProof(reqQuery.Data)\n\t\t// if this wasn't a dummy app, we'd do something smarter\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t\tresQuery.Index = -1 // TODO make Proof return index\n\t\tresQuery.Key = reqQuery.Data\n\t\tresQuery.Value = value\n\t\tresQuery.Proof = wire.BinaryBytes(proof)\n\t\tif value != nil {\n\t\t\tresQuery.Log = \"exists\"\n\t\t} else {\n\t\t\tresQuery.Log = \"does not exist\"\n\t\t}\n\t\treturn\n\t} else {\n\t\tindex, value := app.state.Get(reqQuery.Data)\n\t\tresQuery.Index = int64(index)\n\t\tresQuery.Value = value\n\t\tif value != nil {\n\t\t\tresQuery.Log = \"exists\"\n\t\t} else {\n\t\t\tresQuery.Log = \"does not exist\"\n\t\t}\n\t\treturn\n\t}\n}", "title": "" }, { "docid": "04b97c702d9798d01d449d8358dd285c", "score": "0.62156993", "text": "func (app *MentaApp) Query(query abci.RequestQuery) abci.ResponseQuery {\n\tres := abci.ResponseQuery{}\n\tif query.Data == nil || len(query.Data) == 0 {\n\t\tres.Code = sdk.BadQuery\n\t\tres.Log = \"Error: query requires a key\"\n\t\treturn res\n\t}\n\tqueryKey := query.Data\n\tserviceName := query.Path\n\n\t// Note: query\n\tservice, ok := app.router[serviceName]\n\tif !ok {\n\t\tres.Code = sdk.BadQuery\n\t\tres.Log = \"no query handler found\"\n\t\treturn res\n\t}\n\n\tresult := service.Query(queryKey, app.store.Snapshot())\n\n\tres.Code = result.Code\n\tres.Value = result.Data\n\tres.Log = result.Log\n\treturn res\n}", "title": "" }, { "docid": "74f83a2690b5adc477810aeae9a1485d", "score": "0.62149614", "text": "func (obj *TGQueryImpl) GetQueryConnection() tgdb.TGConnection {\n\treturn obj.qryConnection\n}", "title": "" }, { "docid": "5a19c29df2804e1f56c8f6bb683073ab", "score": "0.62138754", "text": "func (ctx *Context) GetQuery(name string, null string) string {\n\tvalue, ok := ctx.Request.Form[name]\n\tif !ok {\n\t\treturn null\n\t}\n\treturn value[0]\n}", "title": "" }, { "docid": "2d70c8cade82b9909d8bcf734c2ace0f", "score": "0.6205671", "text": "func GetQueryType(tsdbReq *datasource.DatasourceRequest) (string, error) {\n\tqueryType := \"query\"\n\tif len(tsdbReq.Queries) > 0 {\n\t\tfirstQuery := tsdbReq.Queries[0]\n\t\tqueryJSON, err := simplejson.NewJson([]byte(firstQuery.ModelJson))\n\t\tif err != nil {\n\t\t\treturn \"\", err\n\t\t}\n\t\tqueryType = queryJSON.Get(\"queryType\").MustString(\"query\")\n\t}\n\treturn queryType, nil\n}", "title": "" }, { "docid": "d02fcfd181c932edb63e3baf774e55c1", "score": "0.6200529", "text": "func (c *RentClient) Query() *RentQuery {\n\treturn &RentQuery{config: c.config}\n}", "title": "" }, { "docid": "8e0dff9a9e0401247ac501571f13ab25", "score": "0.6195966", "text": "func (c *Client) Query(q interface{}, vars map[string]interface{}) error {\n\terr := c.client.Query(context.TODO(), q, vars)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "2b156a03e1a917630c4767cb6dc6a442", "score": "0.61945266", "text": "func (c *WorkerTypeClient) Query() *WorkerTypeQuery {\n\treturn &WorkerTypeQuery{config: c.config}\n}", "title": "" }, { "docid": "c063674a9e0034bec16434898d016c82", "score": "0.61865634", "text": "func (r *Request) Query(key string) string {\n\tvalue, _ := r.GetQuery(key)\n\treturn value\n}", "title": "" }, { "docid": "c11a34c1b4d22390452b4646925f1b58", "score": "0.61817497", "text": "func (p *BeeswaxServiceClient) Query(ctx context.Context, query *Query) (r *QueryHandle, err error) {\n var _args3 BeeswaxServiceQueryArgs\n _args3.Query = query\n var _result4 BeeswaxServiceQueryResult\n if err = p.Client_().Call(ctx, \"query\", &_args3, &_result4); err != nil {\n return\n }\n switch {\n case _result4.Error!= nil:\n return r, _result4.Error\n }\n\n return _result4.GetSuccess(), nil\n}", "title": "" }, { "docid": "d90be20422fdc3f676b532f11bbe126a", "score": "0.616117", "text": "func (b *Builder) Query() string {\n\treturn b.query\n}", "title": "" }, { "docid": "5eee2b203467ed24cfcaeb824934cdd0", "score": "0.6156378", "text": "func (p *Context) Query(n string) string {\n\treturn p.Request.URL.Query().Get(n)\n}", "title": "" }, { "docid": "c78766ed820c8b2f2f8b94cb99b13f62", "score": "0.6148527", "text": "func (obj *TGQueryImpl) GetQueryConnection() types.TGConnection {\n\treturn obj.qryConnection\n}", "title": "" }, { "docid": "fa4f5a61c3032868a519740e0ceb581b", "score": "0.61160296", "text": "func (c *SurveyClient) Query() *SurveyQuery {\n\treturn &SurveyQuery{config: c.config}\n}", "title": "" }, { "docid": "221c6b196e97dc3426e8e93c8142d248", "score": "0.6115673", "text": "func (r *requestContext) Query() *Query {\n\treturn r.query\n}", "title": "" }, { "docid": "3a64cf36dc7c34aaaf29c736b1f1a2f9", "score": "0.61105305", "text": "func (c *ClientPg) Query(query string) (*Result, error) {\n\tres, err := dbQuery(c.db, query)\n\n\t// Save history records only if query did not fail\n\tif err == nil {\n\t\tc.AddToHistory(query)\n\t}\n\n\treturn res, err\n}", "title": "" }, { "docid": "63292d712b06726aa2e30c37cdd9f3bc", "score": "0.60974133", "text": "func NewQuery() *ContactQuery {\n\treturn &ContactQuery{\n\t\tMaxResults: 100,\n\t\tStartIndex: 1,\n\t}\n}", "title": "" }, { "docid": "b2684f8fafadf7a978730ac78a45b1a4", "score": "0.6093774", "text": "func (c *ResearchtypeClient) Query() *ResearchtypeQuery {\n\treturn &ResearchtypeQuery{config: c.config}\n}", "title": "" }, { "docid": "d3fa514128ab361bebc91778992df8cd", "score": "0.6090558", "text": "func NewQuery() *Queries {\n\treturn &Queries{}\n}", "title": "" }, { "docid": "3dc88c9e5fd5d5ab0d4c711df243f3e3", "score": "0.6090414", "text": "func (c *RuleTypeClient) Query() *RuleTypeQuery {\n\treturn &RuleTypeQuery{config: c.config}\n}", "title": "" }, { "docid": "c163bba21717b47b6b157e00d6c3ee29", "score": "0.60823476", "text": "func (r *ThanosLabelsRequest) GetQuery() string { return \"\" }", "title": "" }, { "docid": "4e5c5bec65c8487ac188af3fefc9981e", "score": "0.60809773", "text": "func (c *TechClient) Query() *TechQuery {\n\treturn &TechQuery{config: c.config}\n}", "title": "" }, { "docid": "5d00c90fbba6df71722bd836531bf227", "score": "0.6080637", "text": "func (c *ProjectTypeClient) Query() *ProjectTypeQuery {\n\treturn &ProjectTypeQuery{config: c.config}\n}", "title": "" }, { "docid": "aa69a87910d20418a2c1e893c6ca3aae", "score": "0.607659", "text": "func GetCheckQuery(c *structs.ServiceCheck) *Query {\n\tvar protocol = c.Protocol // ensure appropriate default\n\tif c.Type == \"http\" && protocol == \"\" {\n\t\tprotocol = \"http\"\n\t}\n\treturn &Query{\n\t\tMode: structs.GetCheckMode(c),\n\t\tType: c.Type,\n\t\tTimeout: c.Timeout,\n\t\tAddressMode: c.AddressMode,\n\t\tPortLabel: c.PortLabel,\n\t\tProtocol: protocol,\n\t\tPath: c.Path,\n\t\tMethod: c.Method,\n\t\tHeaders: maps.Clone(c.Header),\n\t\tBody: c.Body,\n\t}\n}", "title": "" }, { "docid": "ef141f03e0a063bfd82250b484946af2", "score": "0.6073064", "text": "func (c *DeptClient) Query() *DeptQuery {\n\treturn &DeptQuery{\n\t\tconfig: c.config,\n\t}\n}", "title": "" }, { "docid": "590bcd72fde8052c6e95d457ec3c01b2", "score": "0.60709345", "text": "func (c *PatientClient) Query() *PatientQuery {\n\treturn &PatientQuery{config: c.config}\n}", "title": "" }, { "docid": "590bcd72fde8052c6e95d457ec3c01b2", "score": "0.60709345", "text": "func (c *PatientClient) Query() *PatientQuery {\n\treturn &PatientQuery{config: c.config}\n}", "title": "" }, { "docid": "1361b8d684989bf23719fc75ffc69a18", "score": "0.60678864", "text": "func NewQuery(queryParams map[string]string) *Query {\n\treturn &Query{queryParams}\n}", "title": "" }, { "docid": "2d81f4423f712cb5dd96d895203b45dc", "score": "0.60637635", "text": "func (c *FormClient) Query() *FormQuery {\n\treturn &FormQuery{config: c.config}\n}", "title": "" }, { "docid": "2d7fd97d19eda80dee58c47761300224", "score": "0.60628974", "text": "func (r *Resolver) Query() gateway.QueryResolver { return &queryResolver{r} }", "title": "" }, { "docid": "c790adcfb2c9168d20ba6e258a3397b8", "score": "0.60612863", "text": "func (c *WithoutFieldsClient) Query() *WithoutFieldsQuery {\n\treturn &WithoutFieldsQuery{\n\t\tconfig: c.config,\n\t}\n}", "title": "" }, { "docid": "abafb43bcc30a925d1a487dbd095062d", "score": "0.60605305", "text": "func Query() *query.Query {\n\tp := New()\n\treturn query.New(p.TableName, p.KeyName)\n}", "title": "" }, { "docid": "abafb43bcc30a925d1a487dbd095062d", "score": "0.60605305", "text": "func Query() *query.Query {\n\tp := New()\n\treturn query.New(p.TableName, p.KeyName)\n}", "title": "" }, { "docid": "cb9e865808ab7d9fd9709ed10203ebfa", "score": "0.6059173", "text": "func (v *WorkflowQuery) GetQueryType() (o string) {\n\tif v != nil && v.QueryType != nil {\n\t\treturn *v.QueryType\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "8b623366da89a4e5d49b44e21bf439fa", "score": "0.6058128", "text": "func (c *ReportFilterClient) Query() *ReportFilterQuery {\n\treturn &ReportFilterQuery{config: c.config}\n}", "title": "" }, { "docid": "5f15ad8196bf16bd11e91261116f349a", "score": "0.6057851", "text": "func (qs *QueryStore) Query(q url.Values) (interface{}, error) {\n\tiq, err := qs.iq(qs, q)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tresult, err := iq.FetchCollection(qs.st.DB)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "75e3149fd319cf647185652f33f443a6", "score": "0.605538", "text": "func GetQueryContext(ctx context.Context) (*Query, error) {\n\tquery := ctx.Value(qdbKey)\n\tif nil == query {\n\t\treturn nil, errors.New(\"query db instance not found in context, make sure to call NewQueryContext before calling GetQueryContext\")\n\t}\n\treturn query.(*Query), nil\n}", "title": "" }, { "docid": "b15acad961d1a073565d8dd222547f13", "score": "0.60542613", "text": "func (c *MmedicineClient) Query() *MmedicineQuery {\n\treturn &MmedicineQuery{config: c.config}\n}", "title": "" }, { "docid": "88daba3b4c04433c313d0d92b5a5a2b6", "score": "0.60510194", "text": "func (srv *Server) Query(ctx context.Context, req *databroker.QueryRequest) (*databroker.QueryResponse, error) {\n\t_, span := trace.StartSpan(ctx, \"databroker.grpc.Query\")\n\tdefer span.End()\n\tsrv.log.Info().\n\t\tStr(\"peer\", grpcutil.GetPeerAddr(ctx)).\n\t\tStr(\"type\", req.GetType()).\n\t\tStr(\"query\", req.GetQuery()).\n\t\tInt64(\"offset\", req.GetOffset()).\n\t\tInt64(\"limit\", req.GetLimit()).\n\t\tMsg(\"query\")\n\n\tquery := strings.ToLower(req.GetQuery())\n\n\tdb, _, err := srv.getBackend()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tall, _, err := db.GetAll(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar filtered []*databroker.Record\n\tfor _, record := range all {\n\t\tif record.GetType() != req.GetType() {\n\t\t\tcontinue\n\t\t}\n\t\tif query != \"\" && !storage.MatchAny(record.GetData(), query) {\n\t\t\tcontinue\n\t\t}\n\t\tfiltered = append(filtered, record)\n\t}\n\n\trecords, totalCount := databroker.ApplyOffsetAndLimit(filtered, int(req.GetOffset()), int(req.GetLimit()))\n\treturn &databroker.QueryResponse{\n\t\tRecords: records,\n\t\tTotalCount: int64(totalCount),\n\t}, nil\n}", "title": "" }, { "docid": "921cf9062596b45e30a81d2670756c75", "score": "0.60470456", "text": "func (c *Ctx) Query(k string) (value string) {\n\treturn getString(c.QueryArgs().Peek(k))\n}", "title": "" }, { "docid": "44a16f46b57ee88b870e72c94f70da8c", "score": "0.60406613", "text": "func (c *DomainClient) Query() *DomainQuery {\n\treturn &DomainQuery{config: c.config}\n}", "title": "" }, { "docid": "516cd2bdf6ca98138ad7541d5589ed38", "score": "0.6033147", "text": "func (c *TransactionClient) Query() *TransactionQuery {\n\treturn &TransactionQuery{config: c.config}\n}", "title": "" }, { "docid": "cae03a93b8f512e7fa65775d782bcf0a", "score": "0.6031159", "text": "func (c *KqiClient) Query() *KqiQuery {\n\treturn &KqiQuery{config: c.config}\n}", "title": "" }, { "docid": "95bfdf615fc97b9e55bdbcbb29915151", "score": "0.6028003", "text": "func (c *CourseclassClient) Query() *CourseclassQuery {\n\treturn &CourseclassQuery{config: c.config}\n}", "title": "" }, { "docid": "5ed4b48044f7c3c00dc8779537f127fe", "score": "0.602079", "text": "func (m Metric) Query() string {\n\treturn m.Querystring\n}", "title": "" }, { "docid": "4a3d9d27b02a6982446d5f6945064012", "score": "0.6019915", "text": "func (c *FlowClient) Query() *FlowQuery {\n\treturn &FlowQuery{config: c.config}\n}", "title": "" }, { "docid": "240605056e6037125656b3484d72ad8d", "score": "0.60194236", "text": "func (c *EntryPointClient) Query() *EntryPointQuery {\n\treturn &EntryPointQuery{config: c.config}\n}", "title": "" }, { "docid": "090cb48579bc360685aeaf39a330ce26", "score": "0.60166335", "text": "func (c *NametitleClient) Query() *NametitleQuery {\n\treturn &NametitleQuery{config: c.config}\n}", "title": "" }, { "docid": "59ba9d9d9f14566bbc3e864e11eb7a23", "score": "0.60143036", "text": "func (c *ProjectClient) Query() *ProjectQuery {\n\treturn &ProjectQuery{config: c.config}\n}", "title": "" }, { "docid": "888712116bd5c001827352f6a03c3815", "score": "0.6003573", "text": "func (t *TileDefRequest) GetQueryType() string {\n\tif t == nil || t.QueryType == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.QueryType\n}", "title": "" }, { "docid": "a8997cca198b336b35938ec9b507e02b", "score": "0.5998144", "text": "func (c *ResolutionClient) Query() *ResolutionQuery {\n\treturn &ResolutionQuery{config: c.config}\n}", "title": "" }, { "docid": "53453a6e19ab1bffc895bc734ac40f3f", "score": "0.5994365", "text": "func (c *PrescriptionClient) Query() *PrescriptionQuery {\n\treturn &PrescriptionQuery{config: c.config}\n}", "title": "" }, { "docid": "dbca628eed23c352fae3c9721d3b67b8", "score": "0.59932333", "text": "func (c *RoominfoClient) Query() *RoominfoQuery {\n\treturn &RoominfoQuery{config: c.config}\n}", "title": "" }, { "docid": "d3960cf3c464e0b9c59f2d1503c14902", "score": "0.5992769", "text": "func (p *Pipeline) GetQuery(id string, args interface{}) (Query, error) {\n\tparams, ok := args.(map[string]interface{})\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"`%s` is not of correct type\", id)\n\t}\n\tctor, ok := p.queries[id]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"unrecognized query type `%v`\", id)\n\t}\n\tquery, err := ctor()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = query.Parse(params)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn query, nil\n}", "title": "" }, { "docid": "a73760b2037dce66a42f12d80a0adc1c", "score": "0.59884864", "text": "func (c *UserPropertyInDeptClient) Query() *UserPropertyInDeptQuery {\n\treturn &UserPropertyInDeptQuery{\n\t\tconfig: c.config,\n\t}\n}", "title": "" }, { "docid": "3b0bedec0d97b64d7ade0078e46d007b", "score": "0.598734", "text": "func (c *MinerClient) Query() *MinerQuery {\n\treturn &MinerQuery{config: c.config}\n}", "title": "" }, { "docid": "4dd1b3db7363b6b127fb397f2db90c51", "score": "0.5986721", "text": "func (c *ResearchClient) Query() *ResearchQuery {\n\treturn &ResearchQuery{config: c.config}\n}", "title": "" }, { "docid": "13109274f01208cc53ab67260008670c", "score": "0.59783685", "text": "func (c *BasicLinkClient) Query() *BasicLinkQuery {\n\treturn &BasicLinkQuery{\n\t\tconfig: c.config,\n\t}\n}", "title": "" } ]
39c2d52a6096a31beefe8632a2fc1c09
GroupOfAgeNameLT applies the LT predicate on the "group_of_age_name" field.
[ { "docid": "6b7ef6eae764856548d141c101e1b5bc", "score": "0.8618552", "text": "func GroupOfAgeNameLT(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" } ]
[ { "docid": "c2905add8866dd088a8d47c64e8f050e", "score": "0.80396384", "text": "func GroupOfAgeAgeLT(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "1f366ad2aabbc2f126b0247dd4a5eddd", "score": "0.7848395", "text": "func GroupOfAgeNameLTE(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "9222c22cf96e3f411bfd24859d76e524", "score": "0.68625563", "text": "func GroupOfAgeNameGT(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "8c7bafb3afc782b1d99c9250b1330c64", "score": "0.68567616", "text": "func GroupOfAgeAgeLTE(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "a7437bdf8ef6e1a352ed5bd634ce1acb", "score": "0.6563294", "text": "func GroupOfAgeName(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "540427ead19652133c1e478c1ded05be", "score": "0.64286894", "text": "func AgeLT(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "989c05169677f0ee1b954ab46f085a45", "score": "0.64079046", "text": "func GroupOfAgeNameGTE(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "44df745aa25a98180049377b2c692fd3", "score": "0.6394203", "text": "func NameLT(v string) predicate.SubItem {\n\treturn predicate.SubItem(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b2778d5b337b76685c218d3d2581d78f", "score": "0.6296768", "text": "func UrgencyNameLT(v string) predicate.UrgencyLevel {\n\treturn predicate.UrgencyLevel(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUrgencyName), v))\n\t})\n}", "title": "" }, { "docid": "6ce8b33f733c7993ffcad2f8800eaf30", "score": "0.62332535", "text": "func GroupOfAgeAge(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "b6e27c58a484d5d32195eeb28d427774", "score": "0.6192206", "text": "func NameLT(v string) predicate.Fileinsert {\n\treturn predicate.Fileinsert(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "4faa18413ddea661401d3760d12a2c72", "score": "0.6186805", "text": "func NameLT(v string) predicate.Bag {\n\treturn predicate.Bag(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "8b3784d6a3745d8ac794b582a5709dd5", "score": "0.618677", "text": "func UseCaseNameLT(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUseCaseName), v))\n\t})\n}", "title": "" }, { "docid": "7c2db80455af1fe7ea0656f3ffc8a0f3", "score": "0.6186534", "text": "func NameLT(v string) predicate.SFModel {\n\treturn predicate.SFModel(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "139963571587934f91ea3586fe30e54e", "score": "0.615907", "text": "func NameLT(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "1ad11afb276eaef5feba74122294b1a2", "score": "0.6153122", "text": "func NameLT(v string) predicate.Collection {\n\treturn predicate.Collection(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "ec46ac9df123552327b3ae20a8197492", "score": "0.6148114", "text": "func GroupOfAgeAgeGT(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.GT(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "45dbc793548ed44f7c9db63e2884fbec", "score": "0.612815", "text": "func IDLT(id int) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldID), id))\n\t})\n}", "title": "" }, { "docid": "98690a86ddee12269143a57f8ded358d", "score": "0.6091902", "text": "func GroupOfAgeNameContainsFold(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "db2c5543fb9085343e30c6d076539df2", "score": "0.60775894", "text": "func NameLT(v string) predicate.CoinInfo {\n\treturn predicate.CoinInfo(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "eff45f8f7d228ec3ef294fa16bf1dacc", "score": "0.60542154", "text": "func NameLT(v string) predicate.MetaColumn {\n\treturn predicate.MetaColumn(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t},\n\t)\n}", "title": "" }, { "docid": "bb750f9dd5601b9d9f433858c755edaa", "score": "0.6046655", "text": "func FamilyNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldFamilyName), v))\n\t})\n}", "title": "" }, { "docid": "271855c2aef197dd391828cee4407d30", "score": "0.60281336", "text": "func NameLT(v string) predicate.Browser {\n\treturn predicate.Browser(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "70311b58b8efe53cbde94f437f70328f", "score": "0.6018987", "text": "func AgentNameLastnameLT(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAgentNameLastname), v))\n\t})\n}", "title": "" }, { "docid": "260da7a7405d4acaad893eb7084cb505", "score": "0.6002757", "text": "func DoctorNameLT(v string) predicate.Doctor {\n\treturn predicate.Doctor(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDoctorName), v))\n\t})\n}", "title": "" }, { "docid": "1e2f1f309be56b0056696c740d728c3d", "score": "0.59728646", "text": "func LastNameLT(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "1d87030f920c600ca19e51c8f5f10f15", "score": "0.5965687", "text": "func GroupOfAgeNameContains(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "a62b535612c48767016a5383447f1fb2", "score": "0.58926165", "text": "func NameLT(v string) predicate.Server {\n\treturn predicate.Server(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "0d99c083b91a988d77fb5d686cc63360", "score": "0.5879333", "text": "func HolderNameLT(v string) predicate.Card {\n\treturn predicate.Card(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldHolderName), v))\n\t})\n}", "title": "" }, { "docid": "a38c8fb9419eb6115884fbb9f07f4721", "score": "0.57974815", "text": "func SubjectNameLT(v string) predicate.Subject {\n\treturn predicate.Subject(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSubjectName), v))\n\t})\n}", "title": "" }, { "docid": "fca4d22dc3061007cf9906cd8e3d155b", "score": "0.57505375", "text": "func GroupOfAgeAgeGTE(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.GTE(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "e1ce508aff7e5d94f9bc6ff85eeb30e9", "score": "0.5732013", "text": "func TransactionNameLT(v string) predicate.Pointtransaction {\n\treturn predicate.Pointtransaction(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTransactionName), v))\n\t})\n}", "title": "" }, { "docid": "f443253bea497997cfb59ce2bd0b0931", "score": "0.5717048", "text": "func GivenNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGivenName), v))\n\t})\n}", "title": "" }, { "docid": "c180275f9b744e4d569bd19f3ccbf332", "score": "0.57165676", "text": "func GenderLT(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldGender), v))\n\t})\n}", "title": "" }, { "docid": "8b160087e9caeab80919094049b61b73", "score": "0.57147807", "text": "func LinkNameLT(v string) predicate.BasicLink {\n\treturn predicate.BasicLink(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLinkName), v))\n\t})\n}", "title": "" }, { "docid": "a0320c53ec038f919011fbc4ed072194", "score": "0.57068086", "text": "func NameLt(name string) PredFunc {\n\treturn func(pb *comparison.Predicates) {\n\t\tpb.Add(&comparison.Predicate{\n\t\t\tCol: \"name\",\n\t\t\tOp: comparison.Lt,\n\t\t\tArg: name,\n\t\t})\n\t}\n}", "title": "" }, { "docid": "500c6b1805e437281a25e66d25b3b0a8", "score": "0.5699108", "text": "func DAMAGEDPOINTNAMELT(v string) predicate.Bookreturn {\n\treturn predicate.Bookreturn(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDAMAGEDPOINTNAME), v))\n\t})\n}", "title": "" }, { "docid": "7374b1457ced53c270f3f4341e64aa39", "score": "0.5690195", "text": "func OutcomeGroupTitleLT(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOutcomeGroupTitle), v))\n\t})\n}", "title": "" }, { "docid": "af5493a2d69ee15819f1f466687a57e9", "score": "0.56532925", "text": "func LT(fieldName Column, value interface{}) *WherePart {\n\treturn newWherePart(\n\t\tWhereTypeLessThan,\n\t\tstring(fieldName),\n\t\t[]interface{}{value},\n\t)\n}", "title": "" }, { "docid": "4fc385759f712e6efd226e54cec0f969", "score": "0.5620362", "text": "func AccountNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAccountName), v))\n\t})\n}", "title": "" }, { "docid": "6519cb885b819cb4c71eb2988f3fd1a2", "score": "0.5613102", "text": "func LastNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "6519cb885b819cb4c71eb2988f3fd1a2", "score": "0.5613102", "text": "func LastNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLastName), v))\n\t})\n}", "title": "" }, { "docid": "5d45c6ba93c7cda71a2d2abb300e169c", "score": "0.5608444", "text": "func OutcomeGroupIDLT(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOutcomeGroupID), v))\n\t})\n}", "title": "" }, { "docid": "c673501027785ad3d0e3e8afd9a9a96b", "score": "0.5571778", "text": "func LastnameLT(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldLastname), v))\n\t})\n}", "title": "" }, { "docid": "9bc76a2ca6304feafb9c5cfd6d3c6a59", "score": "0.5564434", "text": "func GroupOfAgeNameEqualFold(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.EqualFold(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "81079d4a6e924c32426f2af682ba86a5", "score": "0.5563779", "text": "func DisplayNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDisplayName), v))\n\t})\n}", "title": "" }, { "docid": "be68f1829c54b9ce9b26f1f6e0921214", "score": "0.55364025", "text": "func (cc ColumnComparator) Lt() ColumnComparator {\n\tcc.cmpType = qb.Lt(cc.Name)\n\treturn cc\n}", "title": "" }, { "docid": "4b9872187f770f4acd32c5e4afb0f0ad", "score": "0.5534322", "text": "func GroupOfAgeNameHasPrefix(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "83ddff8d66ff8d755ed1e5dabbb61b87", "score": "0.5532335", "text": "func GroupOfAgeAgeHasPrefix(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.HasPrefix(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "929ccb0893cd4d5d04d9be2fb0132603", "score": "0.5529537", "text": "func VaccineNameLT(v string) predicate.Vaccine {\n\treturn predicate.Vaccine(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldVaccineName), v))\n\t})\n}", "title": "" }, { "docid": "51bc23c509e7bf4ca09ccddbe393a02c", "score": "0.5526044", "text": "func GroupOfAgeNameEQ(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "dcd65ac301d64be8afa713b1e041db92", "score": "0.55107087", "text": "func GroupOfAgeAgeContainsFold(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.ContainsFold(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "284ab3277eeaa19a08099807724e9d37", "score": "0.55054605", "text": "func GroupOfAgeNameIn(vs ...string) predicate.GroupOfAge {\n\tv := make([]interface{}, len(vs))\n\tfor i := range v {\n\t\tv[i] = vs[i]\n\t}\n\treturn predicate.GroupOfAge(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(FieldGroupOfAgeName), v...))\n\t})\n}", "title": "" }, { "docid": "abb5e1352ecd21053be0bcbc62b2f0c2", "score": "0.55022216", "text": "func AlertNameLT(v string) predicate.AlertHistory {\n\treturn predicate.AlertHistory(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAlertName), v))\n\t})\n}", "title": "" }, { "docid": "7cd138205b9140760a85e4fe9d0e594b", "score": "0.54731977", "text": "func FirstNameLT(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "f44b14867cd04e8ccb0b6aaee1b55022", "score": "0.54312706", "text": "func BirthDateLT(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldBirthDate), v))\n\t})\n}", "title": "" }, { "docid": "7c533659c46d776f275f03fac92cdd8c", "score": "0.5405488", "text": "func GroupOfAgeAgeContains(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.Contains(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "fa175ff447e06049f95965e32baa7030", "score": "0.5400937", "text": "func Lt(a, b Expr) Expr {\n\treturn newCmpOp(a, b, scanner.LT)\n}", "title": "" }, { "docid": "152bbeb61d2e8552cc6a3e1f5965fcca", "score": "0.5398762", "text": "func OfficerNameLT(v string) predicate.Officer {\n\treturn predicate.Officer(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOfficerName), v))\n\t})\n}", "title": "" }, { "docid": "500a1ef9b40e4848833af550f0b26877", "score": "0.53793466", "text": "func IDLT(id int) predicate.GroupTag {\n\treturn predicate.GroupTag(sql.FieldLT(FieldID, id))\n}", "title": "" }, { "docid": "623543a0434b444aa6b0b77e88eb7218", "score": "0.53584975", "text": "func MiddleNameLT(v string) predicate.Employee {\n\treturn predicate.Employee(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldMiddleName), v))\n\t})\n}", "title": "" }, { "docid": "3cefd52953c2cfe9098d4ff195433160", "score": "0.5339107", "text": "func FirstnameLT(v string) predicate.Userprofile {\n\treturn predicate.Userprofile(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldFirstname), v))\n\t})\n}", "title": "" }, { "docid": "8ac7f03cc0fc53984cd6f4f08170e1f2", "score": "0.5324003", "text": "func NameLTE(v string) predicate.SubItem {\n\treturn predicate.SubItem(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "ce0550bd15703b2eb7f4405d16fc2dda", "score": "0.53117967", "text": "func OutcomeGroupDescriptionLT(v string) predicate.OutcomeGroup {\n\treturn predicate.OutcomeGroup(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOutcomeGroupDescription), v))\n\t})\n}", "title": "" }, { "docid": "e8f5dd494a26d5295ce8ec56bd5a9322", "score": "0.5306476", "text": "func (t TokenBuilder) LtNamed(names ...string) Cmp {\n\treturn t.cmp(lt, names)\n}", "title": "" }, { "docid": "b869924e51fe3b61f40cd69b3bafeb0e", "score": "0.5296558", "text": "func DepositornameLT(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDepositorname), v))\n\t})\n}", "title": "" }, { "docid": "3b2c692cbdc4dd409db40d0b39972feb", "score": "0.5245295", "text": "func AgeLTE(v int) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldAge), v))\n\t})\n}", "title": "" }, { "docid": "512a99d61a8eb55fce1dac10d7e71bb9", "score": "0.5241761", "text": "func DrugTypeNameLT(v string) predicate.DrugType {\n\treturn predicate.DrugType(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDrugTypeName), v))\n\t})\n}", "title": "" }, { "docid": "b64a4413f129bf4e76cf65f734a002a0", "score": "0.5227223", "text": "func Lt(key string, value interface{}) *HasExpression {\n\tsValue, _ := structpb.NewValue(value)\n\treturn &HasExpression{\n\t\tExpression: &HasExpression_Condition{\n\t\t\tCondition: &HasCondition{\n\t\t\t\tKey: key,\n\t\t\t\tValue: sValue,\n\t\t\t\tCondition: Condition_LT,\n\t\t\t},\n\t\t},\n\t}\n}", "title": "" }, { "docid": "339a1808565bb822f44201fb98bb4f76", "score": "0.5225737", "text": "func (c *Criterion) Lt(value interface{}) *Query {\n\treturn c.createcriterion(Lt, value)\n}", "title": "" }, { "docid": "9d74fbc2815ff8836fe23f49abbea2e5", "score": "0.5225182", "text": "func DomainLT(v string) predicate.Grant {\n\treturn predicate.Grant(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDomain), v))\n\t})\n}", "title": "" }, { "docid": "3d2464d55dd5aec51ce85fc6eae8f400", "score": "0.5206988", "text": "func OxygenLT(v string) predicate.Historytaking {\n\treturn predicate.Historytaking(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOxygen), v))\n\t})\n}", "title": "" }, { "docid": "7015aea84b6c8896004740cf97335bda", "score": "0.52047265", "text": "func EmailLT(v string) predicate.Doctor {\n\treturn predicate.Doctor(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldEmail), v))\n\t})\n}", "title": "" }, { "docid": "bd7094a920bced99d1f0d1086d3e53f7", "score": "0.5197938", "text": "func OutcomeAnalysisGroupIDLT(v string) predicate.OutcomeAnalysisGroupID {\n\treturn predicate.OutcomeAnalysisGroupID(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldOutcomeAnalysisGroupID), v))\n\t})\n}", "title": "" }, { "docid": "7cf561413dda80b3c688da14cdf644eb", "score": "0.5186772", "text": "func FirstNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "7cf561413dda80b3c688da14cdf644eb", "score": "0.5186772", "text": "func FirstNameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldFirstName), v))\n\t})\n}", "title": "" }, { "docid": "4f2eac8dbda49f3a962588956ec2322e", "score": "0.5173614", "text": "func NicknameLT(v string) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldNickname), v))\n\t})\n}", "title": "" }, { "docid": "25078da8e636fc23fc7680e5da61a2f9", "score": "0.5172911", "text": "func (f TimeField) Lt(field TimeField) Predicate {\n\treturn BinaryPredicate{\n\t\tOperator: PredicateLt,\n\t\tLeftField: f,\n\t\tRightField: field,\n\t}\n}", "title": "" }, { "docid": "8424585c36194fd101f7546586538d4b", "score": "0.5159301", "text": "func UrgencyNameLTE(v string) predicate.UrgencyLevel {\n\treturn predicate.UrgencyLevel(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUrgencyName), v))\n\t})\n}", "title": "" }, { "docid": "a5b67c39f51929eb674706f74e5df492", "score": "0.5148442", "text": "func (f ScalarField) Lt(value interface{}) qb.Clause {\n\treturn f.Column.Lt(value)\n}", "title": "" }, { "docid": "f4f28475b5b21256c0c94865d4821730", "score": "0.51445866", "text": "func UsernameLT(v string) predicate.Machine {\n\treturn predicate.Machine(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUsername), v))\n\t})\n}", "title": "" }, { "docid": "48c62bba625e0f64f8cfd668de6e97ca", "score": "0.51412195", "text": "func LT(v1, v2 Expr, vN ...Expr) Expr {\n\treturn &exprLT{\n\t\toperator: operator{\n\t\t\tkind: \"lt\",\n\t\t\toperands: append([]Expr{v1, v2}, vN...),\n\t\t},\n\t}\n}", "title": "" }, { "docid": "97d2ca8a4c1f2a0e20d2cca5619403da", "score": "0.51401466", "text": "func TemplateLT(v string) predicate.Server {\n\treturn predicate.Server(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldTemplate), v))\n\t})\n}", "title": "" }, { "docid": "74ab60c480c341a35014380e9bf142a0", "score": "0.5128055", "text": "func UseCaseNameLTE(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldUseCaseName), v))\n\t})\n}", "title": "" }, { "docid": "1323a277683588dfbdd109949e0d7eeb", "score": "0.5126481", "text": "func PromotionNameLT(v string) predicate.Promotion {\n\treturn predicate.Promotion(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldPromotionName), v))\n\t})\n}", "title": "" }, { "docid": "f0ef7fd19af59451d95a8230450038d5", "score": "0.51238126", "text": "func TextLT(v string) predicate.Message {\n\treturn predicate.Message(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldText), v))\n\t})\n}", "title": "" }, { "docid": "13b1175b968a774665bda4778e1e24ae", "score": "0.511143", "text": "func DoctorEmailLT(v string) predicate.Doctor {\n\treturn predicate.Doctor(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDoctorEmail), v))\n\t})\n}", "title": "" }, { "docid": "9b065c95e2bb226e201be46945525916", "score": "0.510159", "text": "func DepositortellLT(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldDepositortell), v))\n\t})\n}", "title": "" }, { "docid": "7a53d81ceb9c655cd0b7ea5a5b9f959d", "score": "0.5099336", "text": "func GroupOfAgeAgeEQ(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldGroupOfAgeAge), v))\n\t})\n}", "title": "" }, { "docid": "3080794ff733400a42bf2d2f64f87972", "score": "0.50986606", "text": "func UseCaseDescriptionLT(v string) predicate.UseCase {\n\treturn predicate.UseCase(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldUseCaseDescription), v))\n\t})\n}", "title": "" }, { "docid": "cd7cced1831d8f4a8db217875ff1e31c", "score": "0.508266", "text": "func AgentIDLT(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldAgentID), v))\n\t})\n}", "title": "" }, { "docid": "0d0f8795124f9791c3df8ab254743494", "score": "0.50769544", "text": "func BirthdayLT(v time.Time) predicate.User {\n\treturn predicate.User(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldBirthday), v))\n\t})\n}", "title": "" }, { "docid": "827ff336de13555bc105344baf3dabf6", "score": "0.5076832", "text": "func InfoLT(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldInfo), v))\n\t})\n}", "title": "" }, { "docid": "95671989142b8b6ec186920111d44c88", "score": "0.5075149", "text": "func GroupOfAgeNameHasSuffix(v string) predicate.GroupOfAge {\n\treturn predicate.GroupOfAge(func(s *sql.Selector) {\n\t\ts.Where(sql.HasSuffix(s.C(FieldGroupOfAgeName), v))\n\t})\n}", "title": "" }, { "docid": "c85ee99b7b4aefbbc66f06547857a323", "score": "0.50731", "text": "func NameLTE(v string) predicate.Collection {\n\treturn predicate.Collection(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "5723a22200d2a3e94892adc648d7e3a6", "score": "0.50730205", "text": "func SymptomLT(v string) predicate.Historytaking {\n\treturn predicate.Historytaking(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldSymptom), v))\n\t})\n}", "title": "" }, { "docid": "9db1b0e3f399e48088be4c5bc423744f", "score": "0.5064567", "text": "func NameLTE(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "b0f9e36a85cdbef92515ddb01ed2cac3", "score": "0.50611347", "text": "func RecipienttellLT(v string) predicate.Deposit {\n\treturn predicate.Deposit(func(s *sql.Selector) {\n\t\ts.Where(sql.LT(s.C(FieldRecipienttell), v))\n\t})\n}", "title": "" }, { "docid": "9c7a1bbf8deba5204cb0a2d68150fd07", "score": "0.5045072", "text": "func NameLTE(v string) predicate.Fileinsert {\n\treturn predicate.Fileinsert(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldName), v))\n\t})\n}", "title": "" }, { "docid": "42969db1fabfee546ca15aec1d9c724a", "score": "0.5039635", "text": "func AgentNameLastnameLTE(v string) predicate.Pendingkyc {\n\treturn predicate.Pendingkyc(func(s *sql.Selector) {\n\t\ts.Where(sql.LTE(s.C(FieldAgentNameLastname), v))\n\t})\n}", "title": "" } ]
61ad40ea618fc284b92045a4992f10c4
NewArgf creates an instance of Argf for treating command line arguments.
[ { "docid": "a678554d32ecc1b555dd1114388929e3", "score": "0.8492155", "text": "func NewArgf(arguments []string, opts *ReadOptions, runtimeOpts *RuntimeOptions) *Argf {\n\tentries := []*Arg{}\n\tfor index, arg := range arguments {\n\t\tentries = append(entries, NewArgWithIndex(NewOrderWithIndex(index), arg))\n\t}\n\treturn &Argf{Arguments: entries, Options: opts, RuntimeOpts: runtimeOpts}\n}", "title": "" } ]
[ { "docid": "d05852069bb45dc062ea3ebb17c2ceb4", "score": "0.640389", "text": "func NewArgs() *Args {\n\targs := &Args{}\n\targs.Parse()\n\treturn args\n}", "title": "" }, { "docid": "5bb329f6b9fb9b0319b50f2bfa4f6594", "score": "0.63658625", "text": "func NewArgFunc() SanitizeArgs {\n\treturn ArgsSanitizer\n}", "title": "" }, { "docid": "3052b5df6c3b65ddd968cea53cc07d8c", "score": "0.63063186", "text": "func NewArgs(args map[string]interface{}) *Args {\n\treturn &Args{args}\n}", "title": "" }, { "docid": "1a4de04f70dbb0c1b14c7a7e0aa051d9", "score": "0.6304373", "text": "func NewArg(name string) *Arg {\n\treturn NewArgWithIndex(NewOrder(), name)\n}", "title": "" }, { "docid": "81b559e4643ade25677edf115910eee7", "score": "0.6020459", "text": "func (ac *ArgConf) NewArg(cli string, env string, initial string, description string) {\n value := initial\n ac.config[cli] = value\n ac.envs[env] = cli\n ac.desc[cli] = description\n}", "title": "" }, { "docid": "693649bca7c5303641bd6dcdd1c561e2", "score": "0.6004127", "text": "func NewArg(argWord string, argID string, argRequired bool, argValue interface{}, argHelp string) *Argument {\n\tif len(argID) == 0 {\n\t\treturn nil\n\t}\n\targWord = strings.TrimSpace(argWord)\n\treturn &Argument{id: argID, word: argWord, Required: argRequired, Value: argValue, Help: argHelp}\n}", "title": "" }, { "docid": "694da6a7cef4c7dde9ac81a03728649e", "score": "0.59707606", "text": "func New(args []string) *Argv {\n\tif args == nil {\n\t\targs = []string{}\n\t}\n\treturn &Argv{args, []string{}, [][2]string{}}\n}", "title": "" }, { "docid": "db5db26ad224254e580852944e2683ea", "score": "0.5895689", "text": "func (b *Builder) Argf(format string, a any) *Builder {\n\tswitch a := a.(type) {\n\tcase nil:\n\t\tb.WriteString(\"NULL\")\n\t\treturn b\n\tcase *raw:\n\t\tb.WriteString(a.s)\n\t\treturn b\n\tcase Querier:\n\t\tb.Join(a)\n\t\treturn b\n\t}\n\tb.total++\n\tb.args = append(b.args, a)\n\tb.WriteString(format)\n\treturn b\n}", "title": "" }, { "docid": "1cde3183d062f993f85804d946b03faa", "score": "0.589399", "text": "func New(args []string) (Argumentative, error) {\n\tif len(args) < 2 {\n\t\treturn nil, errors.New(\"usase: go run main.go routes.csv\")\n\t}\n\treturn &arguments{values: args}, nil\n}", "title": "" }, { "docid": "c1453e520b09406d55456bf4910ff1b6", "score": "0.5816677", "text": "func NewArguments() Arguments {\n\treturn Arguments{\n\t\tos: osFS{},\n\t}\n}", "title": "" }, { "docid": "d431bac18c93490a00bd462b4d554bcf", "score": "0.58112735", "text": "func NewOVFExportArgs(args []string) (*OVFExportArgs, error) {\n\tcurrentExecutablePath := filepath.Dir(os.Args[0])\n\tovfExportArgs := &OVFExportArgs{\n\t\tWorkflowDir: toWorkingDir(currentExecutablePath, mainWorkflowDir),\n\t\tStarted: time.Now(),\n\t\tDiskExportFormat: \"vmdk\",\n\t\tReleaseTrack: GA,\n\t}\n\terr := ovfExportArgs.registerFlags(args)\n\treturn ovfExportArgs, err\n}", "title": "" }, { "docid": "dbac805cceb97e981c5bba8698b1de0b", "score": "0.5761778", "text": "func NewCliArgs(sa SanitizeArgs) ArgsData {\n\tad := sa(os.Args[1:])\n\treturn ad\n}", "title": "" }, { "docid": "e465fdced7f168206efa47555890ab82", "score": "0.55991685", "text": "func NewCmdArgs() (args *CmdArgs) {\n\n\targs = &CmdArgs{\n\t\tSettings: config.NewSettings(),\n\t}\n\n\tflag.BoolVar(&args.Help, \"?\", false, \"shows help and usage\")\n\tflag.BoolVar(&args.Help, \"help\", false, \"shows help and usage\")\n\tflag.BoolVar(&args.Verbose, \"v\", args.Verbose, \"verbose output\")\n\tflag.StringVar(&args.DbType, \"t\", args.DbType, fmt.Sprintf(\"type of database to use, currently supported: %v\", args.SupportedDbTypes()))\n\tflag.StringVar(&args.User, \"u\", args.User, \"user to connect to the database\")\n\tflag.StringVar(&args.Pswd, \"p\", args.Pswd, \"password of user\")\n\tflag.StringVar(&args.DbName, \"d\", args.DbName, \"database name\")\n\tflag.StringVar(&args.Schema, \"s\", args.Schema, \"schema name\")\n\tflag.StringVar(&args.Host, \"h\", args.Host, \"host of database\")\n\tflag.StringVar(&args.Port, \"port\", args.Port, \"port of database host, if not specified, it will be the default ports for the supported databases\")\n\n\tflag.StringVar(&args.OutputFilePath, \"of\", args.OutputFilePath, \"output file path, default is current working directory\")\n\tflag.StringVar(&args.OutputFormat, \"format\", args.OutputFormat, \"camelCase (c) or original (o)\")\n\tflag.StringVar(&args.Prefix, \"pre\", args.Prefix, \"prefix for file- and struct names\")\n\tflag.StringVar(&args.Suffix, \"suf\", args.Suffix, \"suffix for file- and struct names\")\n\tflag.StringVar(&args.PackageName, \"pn\", args.PackageName, \"package name\")\n\n\tflag.BoolVar(&args.TagsNoDb, \"tags-no-db\", args.TagsNoDb, \"do not create db-tags\")\n\n\tflag.BoolVar(&args.TagsMastermindStructable, \"tags-structable\", args.TagsMastermindStructable, \"generate struct with tags for use in Masterminds/structable (https://github.com/Masterminds/structable)\")\n\tflag.BoolVar(&args.TagsMastermindStructableOnly, \"tags-structable-only\", args.TagsMastermindStructableOnly, \"generate struct with tags ONLY for use in Masterminds/structable (https://github.com/Masterminds/structable)\")\n\tflag.BoolVar(&args.IsMastermindStructableRecorder, \"structable-recorder\", args.IsMastermindStructableRecorder, \"generate a structable.Recorder field\")\n\n\tflag.BoolVar(&args.TagsSQL, \"experimental-tags-sql\", args.TagsSQL, \"generate struct with sql-tags\")\n\tflag.BoolVar(&args.TagsSQLOnly, \"experimental-tags-sql-only\", args.TagsSQLOnly, \"generate struct with ONLY sql-tags\")\n\n\tflag.Parse()\n\n\treturn args\n}", "title": "" }, { "docid": "ec6ba6e96ed711b3627a118a16e98f64", "score": "0.5576144", "text": "func New(vals ...V) A {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tpanic(\"cannot set flag for interface{}\")\n\t}\n\n\treturn a.getA()\n}", "title": "" }, { "docid": "ac09e5777b85abfebc23ed6371554957", "score": "0.55670744", "text": "func NewArgumentList() *ArgumentList {\n\treturn &ArgumentList{\n\t\tAstID: unique.NewID(),\n\t\tArguments: make([]*Expression, 0),\n\t}\n}", "title": "" }, { "docid": "9d924e7a6bccb17775189f4ae65ce306", "score": "0.55592054", "text": "func NewArgConf(usage string, description string) ArgConf {\n cmd := cobra.Command{\n Use: usage,\n Short: description,\n Run: func (cmd *cobra.Command, args []string) {\n // No operation, but necessary for Cobra to recognize a command\n },\n }\n return ArgConf{\n config: map[string]string{},\n envs: map[string]string{},\n desc: map[string]string{},\n command: cmd,\n }\n}", "title": "" }, { "docid": "9918d526ffe5e346a718f235c2ee7853", "score": "0.5519574", "text": "func (s Zjob) NewArgs(n int32) (capnp.TextList, error) {\n\tl, err := capnp.NewTextList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.TextList{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "9918d526ffe5e346a718f235c2ee7853", "score": "0.5519574", "text": "func (s Zjob) NewArgs(n int32) (capnp.TextList, error) {\n\tl, err := capnp.NewTextList(s.Struct.Segment(), n)\n\tif err != nil {\n\t\treturn capnp.TextList{}, err\n\t}\n\terr = s.Struct.SetPtr(1, l.List.ToPtr())\n\treturn l, err\n}", "title": "" }, { "docid": "6d6fbda0304b690ea0230bf261504aa9", "score": "0.54733837", "text": "func New() *Parg {\n\tvar parg Parg\n\tparg.AllowedCommands = []Command{}\n\tparg.GlobalFlags = []Flag{}\n\tstaticParg = &parg\n\treturn &parg\n}", "title": "" }, { "docid": "81c47811be74e246d882febba7b62087", "score": "0.5464172", "text": "func New(name string, f func()) *Cmd {\n\treturn &Cmd{\n\t\tFlags: newFlags(),\n\t\tname: name,\n\t\tf: f,\n\t}\n}", "title": "" }, { "docid": "19241e0c752b4a639ac175fe0e3ba44d", "score": "0.54122245", "text": "func NewArgs(initialArgs ...KeyValuePair) Args {\n\targs := Args{fields: map[string]map[string]bool{}}\n\tfor _, arg := range initialArgs {\n\t\targs.Add(arg.Key, arg.Value)\n\t}\n\treturn args\n}", "title": "" }, { "docid": "5f27b7405955b5a225b4f58097b34ab6", "score": "0.5393851", "text": "func NewCmdFoo(f cmdutil.Factory, ioStreams genericclioptions.IOStreams) *cobra.Command {\n\to := &FooOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"foo [--count=COUNT] --filename=FILENAME\",\n\t\tDisableFlagsInUseLine: true,\n\t\tShort: i18n.T(\"Foo short description\"),\n\t\tLong: fooLong,\n\t\tExample: fooExample,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tcmdutil.CheckErr(o.Complete(args))\n\t\t\tcmdutil.CheckErr(o.Validate())\n\t\t\tcmdutil.CheckErr(o.RunFoo())\n\t\t},\n\t}\n\n\tcmd.Flags().IntVarP(&o.Count, \"count\", \"c\", o.Count, \"Usage for count flag.\")\n\tcmd.Flags().StringVarP(&o.Filename, \"filename\", \"f\", o.Filename, i18n.T(\"Usage for filename flag.\"))\n\n\treturn cmd\n}", "title": "" }, { "docid": "7fcc82c3c7686896d5ec70a104e7fe83", "score": "0.53801924", "text": "func NewGenArgs(args *GeneratorArgs, opts *GeneratorOptions) *GenArgs {\n\treturn &GenArgs{\n\t\targs: args,\n\t\topts: opts,\n\t}\n}", "title": "" }, { "docid": "b1d5b691dceac2c8840390f15f37ddd6", "score": "0.53666127", "text": "func New() (*ArgLoader, error) {\n\tec, err := Base()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"could not load default arg funcs: %v\", err)\n\t}\n\tfor _, l := range DefaultLoaders {\n\t\terr = ec.RegisterArgParser(l.LoaderFunc, l.GqlType)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn ec, nil\n}", "title": "" }, { "docid": "4723447ee192c4853504bb764fecb93a", "score": "0.53436106", "text": "func FileNewForCommandlineArg(arg string) *File {\n\tc_arg := C.CString(arg)\n\tdefer C.free(unsafe.Pointer(c_arg))\n\n\tretC := C.g_file_new_for_commandline_arg(c_arg)\n\tretGo := FileNewFromC(unsafe.Pointer(retC))\n\n\treturn retGo\n}", "title": "" }, { "docid": "a86e9f9d0caedb9d5a6a363e9583bc55", "score": "0.53352857", "text": "func New(dict arguments_map, in_args []string) *ArgumentsHandler {\n\n\t// Parse the command line arguments\n\targs, error_message := parse(dict, in_args)\n\n\treturn &ArgumentsHandler{args: args, args_error: error_message, args_map: dict}\n}", "title": "" }, { "docid": "57503b9000095436ae3eda84c7e5d9d8", "score": "0.53136647", "text": "func NewBuildArgs(argsFromOptions map[string]*string) *BuildArgs {\n\treturn &BuildArgs{\n\t\tallowedBuildArgs: make(map[string]*string),\n\t\tallowedMetaArgs: make(map[string]*string),\n\t\treferencedArgs: make(map[string]struct{}),\n\t\targsFromOptions: argsFromOptions,\n\t}\n}", "title": "" }, { "docid": "560777eb4544cde49766d08b67f3ff00", "score": "0.53130865", "text": "func (e *Exec) NewArgument(name string, description string) *Argument {\n\tvar arg = &Argument{\n\t\tName: name,\n\t\tDescription: description,\n\t}\n\treturn arg\n}", "title": "" }, { "docid": "957e0559aa5b116657c16529236b0578", "score": "0.5295749", "text": "func NewArguments() *Arguments {\n\tshellParams := []string{}\n\tincludePath := []string{}\n\n\treturn &Arguments{false, false, \"\", \"\", shellParams, includePath}\n}", "title": "" }, { "docid": "eff6a84242694195cfc638280df7ab20", "score": "0.5271656", "text": "func Newf(format string, args ...interface{}) error { return errutil.NewWithDepthf(1, format, args...) }", "title": "" }, { "docid": "bc4945fb27a6232533d7b4ca6e1cea6d", "score": "0.5257276", "text": "func Newf(format string, args ...interface{}) error {\n\treturn fmt.Errorf(format, args...)\n}", "title": "" }, { "docid": "a36e9a90a6ff173a0dd8250d704f5889", "score": "0.52269846", "text": "func NewArgument(m message.Argument) Argument {\n\tr := Argument{\n\t\tType: m.Type,\n\t\tName: m.Name,\n\t\tValue: m.Value,\n\t}\n\treturn r\n}", "title": "" }, { "docid": "bdc61e677dbc0cefb048df34addb4dcc", "score": "0.5194578", "text": "func Newf(code int, format string, args ...any) error {\n\treturn New(code, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "01bcbbdf97914a9078ed0b938907652d", "score": "0.517597", "text": "func (a *Args) FromArgv() *Args {\n\targv := os.Args[1:]\n\treturn a.From(&argv)\n}", "title": "" }, { "docid": "d98f7d748df5f2ab07160efee09dc246", "score": "0.5158558", "text": "func newFuncOption(f func(*appStackOption)) *funcOption {\n\treturn &funcOption{\n\t\tf: f,\n\t}\n}", "title": "" }, { "docid": "432e20eb38cd3f94bb7835176dc3e3c0", "score": "0.51391053", "text": "func NewCommandArgs(ad ArgsData) []string {\n\tcmdArgs := []string{\"a\"}\n\tcmdArgs = append(cmdArgs, ad.Filters...)\n\treturn cmdArgs\n}", "title": "" }, { "docid": "91d08ecd921e6089785929d4659f0cc0", "score": "0.5109084", "text": "func NewFaucet() *cobra.Command {\n\tc := &cobra.Command{\n\t\tUse: \"faucet [address] [coin<,...>]\",\n\t\tShort: \"Send coins to an account\",\n\t\tArgs: cobra.ExactArgs(2),\n\t\tRunE: faucetHandler,\n\t}\n\tc.Flags().AddFlagSet(flagSetHomes())\n\tc.Flags().StringVarP(&appPath, \"path\", \"p\", \"\", \"path of the app\")\n\tc.Flags().BoolP(\"verbose\", \"v\", false, \"Verbose output\")\n\treturn c\n}", "title": "" }, { "docid": "02d42bc764fac38538121ef43c8c2bb6", "score": "0.5092945", "text": "func NewCommandArgs() CommandArgs {\n\targs := os.Args[1:]\n\tswitch len(args) {\n\tcase 1:\n\t\tif args[0] == noDb {\n\t\t\treturn CommandArgs{Port: defaultPort, UsePersistence: false, ActorNumber: actorNumber}\n\t\t}\n\t\t_, e := strconv.Atoi(args[0])\n\t\tif e == nil {\n\t\t\treturn CommandArgs{Port: args[0], UsePersistence: true, ActorNumber: actorNumber}\n\t\t}\n\t\treturn CommandArgs{Port: defaultPort, UsePersistence: true, ActorNumber: actorNumber}\n\tcase 2:\n\t\t_, e := strconv.Atoi(args[0])\n\t\tif e == nil && args[1] == noDb {\n\t\t\treturn CommandArgs{Port: args[0], UsePersistence: false, ActorNumber: actorNumber}\n\t\t}\n\t\treturn CommandArgs{Port: defaultPort, UsePersistence: true, ActorNumber: actorNumber}\n\tcase 3:\n\t\t_, e := strconv.Atoi(args[0])\n\t\tn, e2 := strconv.Atoi(args[2])\n\t\tif e == nil && e2 == nil && args[1] == noDb {\n\t\t\treturn CommandArgs{Port: args[0], UsePersistence: false, ActorNumber: n}\n\t\t}\n\t\treturn CommandArgs{Port: defaultPort, UsePersistence: true, ActorNumber: actorNumber}\n\t\tcase 4:\n\t\t_, e := strconv.Atoi(args[0])\n\t\tn, e2 := strconv.Atoi(args[2])\n\t\tif e == nil && e2 == nil && args[1] == noDb && args[3] == \"remote\" {\n\t\t\treturn CommandArgs{Port: args[0], UsePersistence: false, ActorNumber: n, IsRemote: true}\n\t\t}\n\t\treturn CommandArgs{Port: defaultPort, UsePersistence: true, ActorNumber: actorNumber}\n\tdefault:\n\t\treturn CommandArgs{Port: defaultPort, UsePersistence: true, ActorNumber: actorNumber}\n\t}\n}", "title": "" }, { "docid": "9be47d1225fafc1c79c9d8791bfbd941", "score": "0.50878733", "text": "func NewArgWithIndex(index *Order, name string) *Arg {\n\treturn &Arg{index: index, name: name}\n}", "title": "" }, { "docid": "7d95cb460067dd1877c749ca4f42f169", "score": "0.5087823", "text": "func NewResourceArgs(r *http.Request, url string, esi Config) *ResourceArgs {\n\treturn &ResourceArgs{\n\t\tExternalReq: r,\n\t\tURL: url,\n\t\tTag: esi,\n\t\trepl: MakeReplacer(r, \"\"),\n\t}\n}", "title": "" }, { "docid": "12a58c5f65eb1c6c80a04e98460946dc", "score": "0.50766695", "text": "func newArgMap() *argMap {\n\treturn &argMap{m: map[string][]*keyVal{}}\n}", "title": "" }, { "docid": "be0ab5d7a31085a7d21e9f731118fcf1", "score": "0.50680524", "text": "func NewFloat64(vals ...V) Float64A {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.Float64(f.name, f.defv.(float64), f.usage)\n\t}\n\n\taf := a.getA()\n\treturn func(f float64) V {\n\t\treturn af(f)\n\t}\n}", "title": "" }, { "docid": "b303b82a18d294fc6a3a50d534c43113", "score": "0.50409395", "text": "func New(flags *pflag.FlagSet) *Factory {\n\tf := NewFactory(nil)\n\tf.BindFlags(flags)\n\n\treturn f\n}", "title": "" }, { "docid": "b303b82a18d294fc6a3a50d534c43113", "score": "0.50409395", "text": "func New(flags *pflag.FlagSet) *Factory {\n\tf := NewFactory(nil)\n\tf.BindFlags(flags)\n\n\treturn f\n}", "title": "" }, { "docid": "da1ebfa92e4e6adec19cba79eeafee8a", "score": "0.5032572", "text": "func Newf(format string, args ...interface{}) Error {\n\tstack, context := StackTrace()\n\treturn &baseError{\n\t\tmessage: fmt.Sprintf(format, args...),\n\t\tstack: stack,\n\t\tcontext: context,\n\t\tcode: DefaultCode,\n\t}\n}", "title": "" }, { "docid": "e88a089ba0fe29b3628a6e94c7c9442b", "score": "0.50031626", "text": "func New() Main {\n\tflags := &cmdFlags{}\n\tflags.init()\n\n\treturn Main{\n\t\tflags: flags,\n\t}\n}", "title": "" }, { "docid": "593caaa81aae533174c7f99c93633669", "score": "0.50018877", "text": "func NewApplication(ctx context.Context, fs *flag.FlagSet) (application.Application, error) {\n\n\tapp := &CommandLineApplication{\n\t\tflagset: fs,\n\t}\n\n\treturn app, nil\n}", "title": "" }, { "docid": "457873a492f9ed478ab9c524efde85fd", "score": "0.49951816", "text": "func newConfigParser(conf *litAfConfig, options flags.Options) *flags.Parser {\n\tparser := flags.NewParser(conf, options)\n\treturn parser\n}", "title": "" }, { "docid": "e979d857893113fcf3c0d58b4f0293b5", "score": "0.49546462", "text": "func NewCli() *Cli {\n\treturn &Cli{\n\t\tr: bufio.NewReader(os.Stdin),\n\t}\n}", "title": "" }, { "docid": "e5d9f7539ad72587f43a9473b749ef82", "score": "0.49338585", "text": "func New(name string, run RunFunc) *Cmd {\n\tc := &Cmd{\n\t\tName: name,\n\t\tFlags: flag.NewFlagSet(name, flag.ExitOnError),\n\t\tRun: run,\n\t}\n\tc.Flags.Usage = newUsage(c)\n\tc.AddCmd(newHelpCmd(c))\n\treturn c\n}", "title": "" }, { "docid": "61fe4ba6c7883b4d9876a7b20b1e73e0", "score": "0.4918593", "text": "func newConfigParser(conf *frredConfig, options flags.Options) *flags.Parser {\n\tparser := flags.NewParser(conf, options)\n\treturn parser\n}", "title": "" }, { "docid": "dc76e391e528e9fe7de5ac6fc7cd5e12", "score": "0.48884088", "text": "func NewGlobalVarArgMacro(function string, expander MacroExpander) Macro {\n\treturn &macro{\n\t\tfunction: function,\n\t\texpander: expander,\n\t\tvarArgStyle: true}\n}", "title": "" }, { "docid": "022486908a390e566d5d5167a0c213f3", "score": "0.48624828", "text": "func NewArguments() *Arguments {\n return &Arguments{\n Headers: http.Header{},\n }\n}", "title": "" }, { "docid": "177a7c6b4c957d00a541ec4bcca8a2bb", "score": "0.48384455", "text": "func NewPositionalArgument(value *Thunk, expanded bool) PositionalArgument {\n\treturn PositionalArgument{\n\t\tvalue: value,\n\t\texpanded: expanded,\n\t}\n}", "title": "" }, { "docid": "fa32f9961f14e8e1caefe232a297c693", "score": "0.48277897", "text": "func NewFlags(fs afero.Fs, envLookup func(key string) (string, bool), logger *logrus.Logger) *Flags {\n\treturn &Flags{\n\t\tfs: fs,\n\t\tloginFlags: login.NewFlags(fs, envLookup, logger),\n\t}\n}", "title": "" }, { "docid": "64c45c2e94531473db702f6d8aeb1ed6", "score": "0.48145446", "text": "func NewCmdlineFlags(name string, validExperiments []string, legacy bool) *CmdlineFlags {\n\tflags := CmdlineFlags{name: name, validExperiments: validExperiments}\n\tflag.StringVar(&flags.json, \"json\", \"\",\n\t\t\"path to the FIDL intermediate representation.\")\n\tflag.StringVar(&flags.root, \"root\", \"\",\n\t\t\"where to generate the bindings.\")\n\tflag.StringVar(&flags.clangFormatPath, \"clang-format-path\", \"\",\n\t\t\"path to the clang-format tool.\")\n\tif len(validExperiments) > 0 {\n\t\tflag.Var(&flags.experiments, \"experiment\",\n\t\t\t\"turn on an experiment, one of: \"+strings.Join(validExperiments, \", \"))\n\t}\n\n\tif legacy {\n\t\tflags.legacy = &legacyCmdlineFlags{}\n\t\tflag.StringVar(&flags.legacy.Header, \"header\", \"\",\n\t\t\t\"DEPRECATED: the output path for the generated header. \"+\n\t\t\t\t\"It cannot be supplied together with --output-base.\")\n\t\tflag.StringVar(&flags.legacy.Source, \"source\", \"\",\n\t\t\t\"DEPRECATED: the output path for the generated C++ implementation. \"+\n\t\t\t\t\"It cannot be supplied together with --output-base.\")\n\t\tflag.StringVar(&flags.legacy.TestBase, \"test-base\", \"\",\n\t\t\t\"DEPRECATED: the output path for the generated test base header. \"+\n\t\t\t\t\"It cannot be supplied together with --output-base.\")\n\t\tflag.StringVar(&flags.legacy.IncludeBase, \"include-base\", \"\",\n\t\t\t\"DEPRECATED: the directory to which C and C++ includes should be relative.\")\n\t\tflag.StringVar(&flags.legacy.IncludeStem, \"include-stem\", \"\",\n\t\t\t\"DEPRECATED: [optional] the suffix after library path when referencing includes. \"+\n\t\t\t\t\"Includes will be of the form <my/library/{include-stem}.h>. \")\n\t\tflag.StringVar(&flags.legacy.OutputBase, \"output-base\", \"\",\n\t\t\t\"DEPRECATED: the base file name for files generated by this generator. \"+\n\t\t\t\t\"It cannot be supplied together with header/source/test-base.\")\n\t\tflag.StringVar(&flags.legacy.Generators, \"generators\", \"\", \"unused\")\n\t}\n\n\treturn &flags\n}", "title": "" }, { "docid": "eeb4a08df103a6b58ab480504e55e28f", "score": "0.48002017", "text": "func New(s string) FracArg {\n\tvar w, n, d int\n\tvar err error\n\n\tneg := s[0] == byte('-')\n\tif neg {\n\t\ts = s[1:]\n\t}\n\n\t// parse out the whole part if one exists\n\tparts := strings.Split(s, \"_\")\n\tif len(parts) > 1 {\n\t\tw, err = strconv.Atoi(parts[0])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"illegal argument given for whole %s\", s)\n\t\t}\n\t}\n\n\tparts = strings.Split(parts[len(parts)-1], \"/\")\n\n\t// no split happened, whole number only\n\tif len(parts) == 1 {\n\t\tw, err = strconv.Atoi(parts[0])\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"illegal argument given for whole %s\", s)\n\t\t}\n\t\tif neg {\n\t\t\tw *= -1 // preserve sign\n\t\t}\n\t\treturn FracArg{Num: w, Den: 1} // rep whole number as improper fraction\n\t}\n\n\t// numerator\n\tn, err = strconv.Atoi(parts[0])\n\tif err != nil {\n\t\tlog.Fatalf(\"illegal argument given for numerator %s\", s)\n\t}\n\n\t// denominator\n\td, err = strconv.Atoi(parts[1])\n\tif err != nil || d == 0 { // zero denominator protection\n\t\tlog.Fatalf(\"illegal argument given for denominator %s\", s)\n\t}\n\n\t// chuck the whole part onto the numerator\n\tn += w * d\n\tif neg {\n\t\tn *= -1 // preserve sign\n\t}\n\treturn FracArg{Num: n, Den: d}\n}", "title": "" }, { "docid": "9da878b348ea1f3420b2b0d24403d3f1", "score": "0.47879183", "text": "func New(name, version, desc string) *Cli {\n\tthis := &Cli{\n\t\tName: name,\n\t\tVersion: version,\n\t\tDescription: desc,\n\t\tCommands: make(map[string]*Command),\n\t\tHeralds: make([]HeraldCallback, 0),\n\t\tRegistry: NewRegistry(),\n\t\tDefaultOptions: make([]*Option, 0),\n\t\tDefaultCommand: \"list\",\n\t}\n\n\t// add default helper commands.\n\tthis.Add(NewHelpCommand(), NewListCommand())\n\n\t// setup output & input\n\tout := NewColorOutput(os.Stdout)\n\tthis.Register(this).\n\t\tSetOutput(out).\n\t\tSetInput(NewDefaultInput(os.Stdin, out))\n\treturn this\n}", "title": "" }, { "docid": "cc07b394199e992bfba98fb69312d7d8", "score": "0.47746032", "text": "func New() (*FT232H, error) {\n\treturn OpenFlag(os.Args[1:], true)\n}", "title": "" }, { "docid": "9308e181c00cdcc156077535b04561a8", "score": "0.4771089", "text": "func NewOption(opts ...OptFunc) Authorizer {\n\treturn New(opts...)\n}", "title": "" }, { "docid": "b409ce09772ac70a763c5c321e6e182b", "score": "0.47587365", "text": "func NewInt(vals ...V) IntA {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.Int(f.name, f.defv.(int), f.usage)\n\t}\n\n\tai := a.getA()\n\treturn func(i int) V {\n\t\treturn ai(i)\n\t}\n}", "title": "" }, { "docid": "3315d82a0fb58b5ec767571696a7033d", "score": "0.47584537", "text": "func NewString(vals ...V) StringA {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.String(f.name, f.defv.(string), f.usage)\n\t}\n\n\tas := a.getA()\n\treturn func(s string) V {\n\t\treturn as(s)\n\t}\n}", "title": "" }, { "docid": "8ce64df3e869f1f3dbe8bc2e0379c0f3", "score": "0.47397265", "text": "func NewArgsErr(err error) error {\n\treturn errors.Wrap(err, ErrMsgInvalidArgs)\n}", "title": "" }, { "docid": "1383d8e8e946b5d431c30323146b9aca", "score": "0.47331735", "text": "func New(config Config, logger *log.Logger) (*Cli, error) {\n\n\tif err := validateConfig(&config); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &Cli{\n\t\tconfig: config,\n\t\tlogger: logger,\n\t}, nil\n}", "title": "" }, { "docid": "a7a66a9904ba1b27889aed93d10e951b", "score": "0.47190893", "text": "func NewCommand(fs afero.Fs, p *config.Params) *cobra.Command {\n\tcmd := &cobra.Command{\n\t\tUse: \"config\",\n\t\tShort: \"View or modify Redpanda configuration through the admin listener\",\n\t\tArgs: cobra.ExactArgs(0),\n\t}\n\tcmd.AddCommand(\n\t\tnewPrintCommand(fs, p),\n\t\tnewLogLevelCommand(fs, p),\n\t)\n\treturn cmd\n}", "title": "" }, { "docid": "1fdddd6a0b0270d7a965aedb23d0dfd5", "score": "0.47078437", "text": "func Newf(c ErrorCode, err error, format string, args ...interface{}) *Error {\n\treturn New(c, err, 2, fmt.Sprintf(format, args...))\n}", "title": "" }, { "docid": "52f2b5c3e7a29eebf7630073447bbbea", "score": "0.469302", "text": "func New(args []string) pakelib.Command {\n\treturn &uninstall{\n\t\targs: args,\n\t}\n}", "title": "" }, { "docid": "dd61ef603a2c56a103b95d004c9fe9b9", "score": "0.46898237", "text": "func New(args ...string) *exec.Cmd {\n\tgitPath, err := exec.LookPath(\"git\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tcmd := exec.Command(gitPath, args...)\n\tcmd.Stdin = os.Stdin\n\tcmd.Stdout = os.Stdout\n\tcmd.Stderr = os.Stderr\n\treturn cmd\n}", "title": "" }, { "docid": "2e5fbbbe225a73c6dcee2b716e16d449", "score": "0.46813306", "text": "func (a *ArgumentMatcherFactory) NewMatcher(key string) Matcher {\n\treturn NewArgumentConditionMatcher(key)\n}", "title": "" }, { "docid": "28729f1daba04d23199ffd8a3bad13b8", "score": "0.46781346", "text": "func NewCommand(args ...string) Command {\n\tcommand := exec.Command(\"adb\", args...)\n\treturn Command{cmd: command, args: args}\n}", "title": "" }, { "docid": "a946620706cab1709989490025c6ca74", "score": "0.4667324", "text": "func NewCli() *Cli {\n\treturn &Cli{}\n}", "title": "" }, { "docid": "211dce0402d7f973d1ec0aee86a0da9b", "score": "0.46663272", "text": "func NewArguments() server.Arguments {\n\treturn &Arguments{}\n}", "title": "" }, { "docid": "32716d177c069f9ee74bfabb4d97ab53", "score": "0.46631858", "text": "func New(name, usage, version string) *cli.App {\n\tapp := cli.NewApp()\n\tapp.Name = name\n\tapp.Usage = usage\n\tapp.Version = version\n\tapp.Commands = getCommands()\n\treturn app\n}", "title": "" }, { "docid": "dbb82e7ad2f3d64fbaa55d64c0f8fac1", "score": "0.46530938", "text": "func NewWithDepthf(depth int, format string, args ...interface{}) error {\n\treturn errutil.NewWithDepthf(depth+1, format, args...)\n}", "title": "" }, { "docid": "34b03315b1db6a9b550c43a4e910c3d2", "score": "0.46530673", "text": "func NewCliFlags() []cli.Flag {\n\treturn []cli.Flag{\n\t\tcli.StringFlag{\n\t\t\tName: appNameURLFlag,\n\t\t\tUsage: \"url to query for app name\",\n\t\t\tEnvVar: \"APP_NAME_URL\",\n\t\t},\n\t}\n}", "title": "" }, { "docid": "184c3608a5badfdca96d0c62e11b58c6", "score": "0.4650531", "text": "func NewBool(vals ...V) BoolA {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.Bool(f.name, f.defv.(bool), f.usage)\n\t}\n\n\tab := a.getA()\n\treturn func(b bool) V {\n\t\treturn ab(b)\n\t}\n}", "title": "" }, { "docid": "2f858a3561b25b7c483211dcf50f8eef", "score": "0.46478742", "text": "func NewOpt(nameAndShorts, desc string, defVal any, setFns ...CliOptFn) *CliOpt {\n\treturn newOpt(nameAndShorts, desc, defVal, \"\").WithOptFns(setFns...)\n}", "title": "" }, { "docid": "85e72b3056241b111a1f05157b68de7c", "score": "0.46477008", "text": "func Newf(code int, format string, args ...interface{}) error {\n\treturn httpErr{code: code, msg: fmt.Sprintf(format, args...)}\n}", "title": "" }, { "docid": "4b1e5529e89e2e1d6fc659ea93c735e7", "score": "0.46473187", "text": "func new_holochain_Arg() C.int32_t {\n\treturn C.int32_t(_seq.ToRefNum(new(holochain.Arg)))\n}", "title": "" }, { "docid": "9cc0d3375d4e51af38dc6fc79350b561", "score": "0.46452662", "text": "func NewFlags(cmdName, title, description, usageOptions, helpFlagName string, printAllDefaults bool) *Flags {\n\tcmdName = path.Base(cmdName)\n\tflags := &Flags{\n\t\tflag.NewFlagSet(cmdName, flag.ExitOnError),\n\t\ttitle, description, usageOptions, nil, printAllDefaults,\n\t\thelpFlagName, cmdName,\n\t}\n\tflags.Bool(flags.helpFlagName, false, \"Help screen.\")\n\n\tflags.Usage = func() {\n\t\tPrintErr(\"See '%s -%s'\\n\", cmdName, helpFlagName)\n\t}\n\treturn flags\n}", "title": "" }, { "docid": "aacb508f9cd2bc66622b29c7e18edd0c", "score": "0.46404523", "text": "func Newf(code int, format string, a ...interface{}) *Error {\n\treturn New(code, fmt.Sprintf(format, a...))\n}", "title": "" }, { "docid": "872439e1ccfd23e972e0deeae711e560", "score": "0.46351713", "text": "func WithArgs(args ...string) Option {\n\treturn func(b *GitCLI) {\n\t\tb.args = append(b.args, args...)\n\t}\n}", "title": "" }, { "docid": "3283ee1139a24eb47aad65de3f08c749", "score": "0.46277806", "text": "func NewLabelTTFAllArgs(text string, fontName string, fontSize int) LabelTTF {\n\treturn &labelTTF{sprite{node{pcc.Get(\"LabelTTF\").New(text, fontName, fontSize)}}}\n}", "title": "" }, { "docid": "c7aeac01681ac9b704386f821c37af3c", "score": "0.46261936", "text": "func (f *UserInterfaceFactory) GetArgs() *UserInterfaceArgs {\n\targs := &UserInterfaceArgs{\n\t\tTitle: f.Title,\n\t\tLogoURL: f.LogoURL,\n\t\tLogoDescription: f.LogoDescription,\n\t\tPublicLinks: f.PublicLinks,\n\t\tPrivateLinks: f.PrivateLinks,\n\t\tRealms: f.Realms,\n\t\tActionEndpoint: f.ActionEndpoint,\n\t\tData: make(map[string]interface{}),\n\t\tRegistrationEnabled: f.RegistrationEnabled,\n\t\tPasswordRecoveryEnabled: f.PasswordRecoveryEnabled,\n\t\tMfaEnabled: f.MfaEnabled,\n\t}\n\tuiOptions := make(map[string]interface{})\n\tif f.CustomCSSPath != \"\" {\n\t\targs.CustomCSSEnabled = true\n\t\tuiOptions[\"custom_css_required\"] = \"yes\"\n\t} else {\n\t\tuiOptions[\"custom_css_required\"] = \"no\"\n\t}\n\n\tif f.CustomJsPath != \"\" {\n\t\targs.CustomJsEnabled = true\n\t\tuiOptions[\"custom_js_required\"] = \"yes\"\n\t} else {\n\t\tuiOptions[\"custom_js_required\"] = \"no\"\n\t}\n\targs.Data[\"ui_options\"] = uiOptions\n\treturn args\n}", "title": "" }, { "docid": "c1c1e888de4842ee344a66772beef671", "score": "0.46171102", "text": "func GetArgs() Args {\n\targs := Args{}\n\n\tpreview := flag.NewFlagSet(\"preview\", flag.ExitOnError)\n\tpreview.Usage = func() {\n\t\texitWithPreviewHelp(preview)\n\t}\n\n\tpush := flag.NewFlagSet(\"push\", flag.ExitOnError)\n\tpush.StringVar(&args.githubBranch, \"branch\", \"contribution\", \"Git branch to push to.\")\n\tpush.IntVar(&args.weeksAgo, \"w\", 0, \"Weeks ago of all activity. A value of 2 will move activity two pixels to the left.\")\n\tpush.StringVar(&args.githubProject, \"project\", \"\", \"GitHub username/project to push to. (required)\")\n\tpush.Usage = func() {\n\t\texitWithPushHelp(push)\n\t}\n\n\tfor _, flagset := range []*flag.FlagSet{preview, push} {\n\t\tflagset.StringVar(&args.imageFile, \"img\", \"\", \"Path to a valid PNG image. (required)\")\n\t}\n\n\tsubcmd := \"\"\n\tif len(os.Args) >= 2 {\n\t\tsubcmd = os.Args[1]\n\t}\n\n\tswitch subcmd {\n\tcase preview.Name():\n\t\tpreview.Parse(os.Args[2:])\n\t\targs.verb = preview.Name()\n\tcase push.Name():\n\t\tpush.Parse(os.Args[2:])\n\t\targs.verb = push.Name()\n\t\tif args.githubProject == \"\" {\n\t\t\texitWithPushHelp(push)\n\t\t}\n\tdefault:\n\t\texitWithHelp(preview, push)\n\t}\n\n\treturn args\n}", "title": "" }, { "docid": "77359246d523f265d4a728f9f70e69bd", "score": "0.46043673", "text": "func Newf(format string, a ...interface{}) Error {\n\treturn Error{\n\t\tmsg: fmt.Sprintf(format, a...),\n\t}\n}", "title": "" }, { "docid": "bd89cbcdbef65a2f6ba2f4fe448e635b", "score": "0.4603889", "text": "func New() *cobra.Command {\n\tconst (\n\t\tlong = `The APPS commands focus on managing your Fly applications.\nStart with the CREATE command to register your application.\nThe LIST command will list all currently registered applications.\n`\n\t\tshort = \"Manage apps\"\n\t)\n\n\t// TODO: list should also accept the --org param\n\n\tapps := command.New(\"apps\", short, long, nil)\n\n\tapps.AddCommand(\n\t\tnewList(),\n\t\tnewCreate(),\n\t\tnewDestroy(),\n\t\tnewMove(),\n\t\tnewResume(),\n\t\tnewSuspend(),\n\t\tnewRestart(),\n\t\tNewOpen(),\n\t\tNewReleases(),\n\t)\n\n\treturn apps\n}", "title": "" }, { "docid": "af48b232931fa63a3ce62d08117d7d54", "score": "0.46008137", "text": "func NewCmdAdd(f Factory, in terminal.FileReader, out terminal.FileWriter, errOut io.Writer) *cobra.Command {\n\toptions := &AddOptions{\n\t\tCommonOptions: CommonOptions{\n\t\t\tFactory: f,\n\t\t\tIn: in,\n\t\t\tOut: out,\n\t\t\tErr: errOut,\n\t\t},\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse: \"add\",\n\t\tShort: \"Adds a new resource\",\n\t\tLong: add_long,\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\toptions.Cmd = cmd\n\t\t\toptions.Args = args\n\t\t\terr := options.Run()\n\t\t\tCheckErr(err)\n\t\t},\n\t}\n\tcmd.AddCommand(NewCmdAddApp(f, in, out, errOut))\n\treturn cmd\n}", "title": "" }, { "docid": "e9e1c6509946694c8fb28bee7a230c88", "score": "0.46004552", "text": "func NewDuration(vals ...V) DurationA {\n\ta := &arg{}\n\n\td := Default.Get(vals)\n\ta.defv = d\n\n\tf := A(flagA).Get(vals)\n\tif f != nil {\n\t\tf := f.(flagT)\n\t\ta.defv = flag.Duration(f.name, f.defv.(time.Duration), f.usage)\n\t}\n\n\tad := a.getA()\n\treturn func(d time.Duration) V {\n\t\treturn ad(d)\n\t}\n}", "title": "" }, { "docid": "05d008f40f19ad1ca6bea889347f6aca", "score": "0.45926124", "text": "func NewDoFn(fn any, options ...func(*config)) (*DoFn, error) {\n\tret, err := NewFn(fn)\n\tif err != nil {\n\t\treturn nil, errors.WithContext(errors.Wrapf(err, \"invalid DoFn\"), \"constructing DoFn\")\n\t}\n\tcfg := defaultConfig()\n\tfor _, opt := range options {\n\t\topt(cfg)\n\t}\n\treturn AsDoFn(ret, cfg.numMainIn)\n}", "title": "" }, { "docid": "c9dd9295fed765e47b73c43ab9dbccb3", "score": "0.4581619", "text": "func NewFunc(name string, args ...any) *Func {\n\treturn &Func{Name: name, Args: args}\n}", "title": "" }, { "docid": "03257e11f17a5f2de8dab8fab2231b1d", "score": "0.45733905", "text": "func newRestoreCmd(args *launchArgs) (*restoreCmd, error) {\n\tif len(args.Values) < 2 {\n\t\treturn nil, errors.New(\"no backup name specified\")\n\t}\n\tif len(args.Values) < 3 {\n\t\treturn nil, errors.New(\"no target date specified\")\n\t}\n\n\treturn &restoreCmd{\n\t\tName: args.Values[1],\n\t\tTargetTime: args.Values[2],\n\t\tPluginArgs: args.Values[3:],\n\t}, nil\n}", "title": "" }, { "docid": "832d06ec9eb6bc4dcb14cc0721a88650", "score": "0.456936", "text": "func New(opts ...OptFunc) Authorizer {\n\topt := new(option)\n\topt.setDefaults()\n\topt.With(opts...)\n\treturn opt\n}", "title": "" }, { "docid": "11ce10bd525f68edefac52be7314e863", "score": "0.45658934", "text": "func Newf(format string, v ...interface{}) *Error {\n\treturn New(fmt.Sprintf(format, v...))\n}", "title": "" }, { "docid": "8244e4051c1416fd49c259b1f335f22d", "score": "0.45625427", "text": "func New(logger *zap.Logger, rootCmd *cobra.Command) (Factory, *Config) {\n\tconfig := NewConfig(logger)\n\treturn &factoryImpl{\n\t\tlogger: logger,\n\t\trootCmd: rootCmd,\n\t\tconfig: config,\n\t}, config\n}", "title": "" }, { "docid": "2d00d99e1d2c2167cec32eaf44e02fcc", "score": "0.4555695", "text": "func New(cmd ...string) *Command {\n\targs := strings.Fields(strings.Join(cmd, \" \"))\n\tif len(args) == 0 {\n\t\treturn &Command{exec.Command(cmd[0])}\n\t} else if len(args) > 1 {\n\t\treturn &Command{exec.Command(args[0], args[1:]...)}\n\t}\n\treturn &Command{exec.Command(args[0])}\n}", "title": "" }, { "docid": "11cce52c279a36543d40e85bfe7f3d3e", "score": "0.45544055", "text": "func FromArgs(args []string) (tool.Instance, error) {\n\tti := tool.Instance{}\n\n\tconfig, err := Parse(args)\n\tif err != nil {\n\t\treturn ti, err\n\t}\n\n\treturn tool.NewInstance(config)\n}", "title": "" }, { "docid": "8a8b1d2cb5185607ac597aec72cafb36", "score": "0.45447412", "text": "func New(o Options) (*FlagSet, error) {\n\t// Check the options\n\tif o.Flags == nil {\n\t\treturn nil, fmt.Errorf(\"flags are required\")\n\t} else if !strings.HasPrefix(fmt.Sprintf(\"%T\", o.Flags), \"*struct\") {\n\t\tif o.Flags == nil || reflect.ValueOf(o.Flags).Kind() != reflect.Ptr || reflect.Indirect(reflect.ValueOf(o.Flags)).Kind() != reflect.Struct {\n\t\t\treturn nil, fmt.Errorf(\"flags must be a struct pointer\")\n\t\t}\n\t}\n\tif o.Args == nil {\n\t\to.Args = os.Args // default\n\t}\n\n\t// Init vars\n\tflagSet := FlagSet{\n\t\tflagsRaw: o.Flags,\n\t\targsRaw: make([]string, len(o.Args)),\n\t}\n\tcopy(flagSet.argsRaw, o.Args) // make a copy\n\n\t// Parse flags\n\tif flagSet.flagsRaw != nil {\n\t\tvar errs []error\n\t\tflagSet.flags, errs = structToFlags(flagSet.flagsRaw)\n\t\tif errs != nil {\n\t\t\treturn nil, errs[0] // return the first error\n\t\t}\n\t}\n\tflagSet.parseCommands()\n\tflagSet.parseArgs()\n\tflagSet.parseSettings()\n\n\t// Iterate over the flags and apply values to the fields\n\tfor _, flag := range flagSet.flags {\n\t\t// Only argument fields can have values\n\t\tif flag.kind != \"arg\" {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Check global\n\t\tif flag.kind == \"arg\" && flag.global && flag.parentID > -1 {\n\t\t\tflag.err = fmt.Errorf(\"argument %s can't be global\", flag.FormattedArg())\n\t\t\tcontinue\n\t\t}\n\n\t\t// Handle slices\n\t\tif strings.HasPrefix(flag.valueType, \"[]\") {\n\t\t\tflagSet.unsetFlag(flag.id)\n\t\t}\n\n\t\t// Iterate over the args (last argument wins)\n\t\tfor _, arg := range flag.args {\n\t\t\t// Only arguments (skip commands and argument values)\n\t\t\tif arg.kind != \"arg\" {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tflag.valueBy = \"arg\" // prevent default and env values to override it\n\n\t\t\t// Handle truthy bool arguments (i.e. `-b --bool`. But not `-b=`)\n\t\t\tif (flag.valueType == \"bool\" || flag.valueType == \"[]bool\") && arg.value == \"\" && !arg.unset {\n\t\t\t\targ.value = \"true\"\n\t\t\t}\n\n\t\t\t// Handle empty values\n\t\t\tif arg.value == \"\" {\n\t\t\t\tif ((flag.valueType == \"bool\" || flag.valueType == \"[]bool\") && arg.unset) || ((flag.valueType == \"string\" || flag.valueType == \"[]string\") && !arg.unset) {\n\t\t\t\t\t// For example: `--bool=`, `--string`\n\t\t\t\t\targ.err = fmt.Errorf(\"argument %s%s needs a value\", arg.dash, arg.name)\n\t\t\t\t} else if flag.valueType != \"bool\" && flag.valueType != \"[]bool\" && flag.valueType != \"string\" && flag.valueType != \"[]string\" {\n\t\t\t\t\t// For example: `--int`\n\t\t\t\t\targ.err = fmt.Errorf(\"argument %s%s needs a value\", arg.dash, arg.name)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif arg.err != nil {\n\t\t\t\tcontinue // do not continue if the argument has an error\n\t\t\t}\n\n\t\t\t// Update the flag value\n\t\t\tif flag.delimiter != \"\" && strings.HasPrefix(flag.valueType, \"[]\") {\n\t\t\t\tvalues := strings.Split(arg.value, flag.delimiter)\n\t\t\t\tfor _, v := range values {\n\t\t\t\t\t// Ignore empty ones\n\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\tif v == \"\" {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif err := flagSet.setFlag(flag.id, v); err != nil {\n\t\t\t\t\t\targ.err = err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := flagSet.setFlag(flag.id, arg.value); err != nil {\n\t\t\t\t\targ.err = err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Iterate over the flags and update their values\n\tfor _, flag := range flagSet.flags {\n\t\tif flag.kind != \"arg\" {\n\t\t\tcontinue // only arguments\n\t\t}\n\n\t\t// Check the flag error\n\t\tif flag.err != nil {\n\t\t\tflagSet.unsetFlag(flag.id)\n\t\t\tcontinue\n\t\t}\n\n\t\tif flag.valueBy == \"arg\" {\n\t\t\t// Check the argument errors\n\t\t\tfor _, arg := range flag.args {\n\t\t\t\t// If there is an argument error then\n\t\t\t\tif arg.err != nil {\n\t\t\t\t\tflagSet.unsetFlag(flag.id)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue // skip the rest since argument overrides env and default values\n\t\t}\n\n\t\tif flag.env != \"\" {\n\t\t\tif ev, ok := os.LookupEnv(flag.env); ok {\n\t\t\t\tflag.valueBy = \"env\"\n\t\t\t\tif flag.delimiter != \"\" && strings.HasPrefix(flag.valueType, \"[]\") {\n\t\t\t\t\tvalues := strings.Split(ev, flag.delimiter)\n\t\t\t\t\tfor _, v := range values {\n\t\t\t\t\t\t// Ignore empty ones\n\t\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\t\tif v == \"\" {\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif err := flagSet.setFlag(flag.id, v); err != nil {\n\t\t\t\t\t\t\tflag.err = err\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif err := flagSet.setFlag(flag.id, ev); err != nil {\n\t\t\t\t\t\tflag.err = err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\n\t\tif flag.valueDefault != \"\" {\n\t\t\tflag.valueBy = \"default\"\n\t\t\tif flag.delimiter != \"\" && strings.HasPrefix(flag.valueType, \"[]\") {\n\t\t\t\tvalues := strings.Split(flag.valueDefault, flag.delimiter)\n\t\t\t\tfor _, v := range values {\n\t\t\t\t\t// Ignore empty ones\n\t\t\t\t\tv = strings.TrimSpace(v)\n\t\t\t\t\tif v == \"\" {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tif err := flagSet.setFlag(flag.id, v); err != nil {\n\t\t\t\t\t\tflag.err = err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err := flagSet.setFlag(flag.id, flag.valueDefault); err != nil {\n\t\t\t\t\tflag.err = err\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tif flag.value == nil {\n\t\t\t// Flag's value field is interface and it should not be nil\n\t\t\tflagSet.unsetFlag(flag.id)\n\t\t}\n\t}\n\n\t// Iterate over the flags and check the required and nonempty arguments\n\tfor _, flag := range flagSet.flags {\n\t\t// If it's not required and not a nonempty flag then\n\t\tif !flag.required && !flag.nonempty {\n\t\t\tcontinue // skip\n\t\t}\n\n\t\tif flag.kind == \"command\" {\n\t\t\tif flag.required && flag.args == nil { // command is not present\n\t\t\t\tflag.err = fmt.Errorf(\"command %s is required\", flag.command)\n\t\t\t} else if flag.nonempty && len(flag.args) == 1 { // command is present\n\t\t\t\tif len(flagSet.argsByCommandID(flag.commandID)) == 0 { // command itself has no any argument\n\t\t\t\t\tflag.err = fmt.Errorf(\"command %s needs an argument\", flag.command)\n\t\t\t\t}\n\t\t\t}\n\t\t\tcontinue\n\t\t} else if flag.kind == \"arg\" {\n\t\t\t// Check the parent flag\n\t\t\tcommand := \"\"\n\t\t\tif flag.parentIndex != nil {\n\t\t\t\tparentFlag := flagSet.flagByIndex(flag.parentIndex)\n\t\t\t\tif parentFlag != nil {\n\t\t\t\t\t// If the parent flag (command) has no argument then\n\t\t\t\t\tif parentFlag.args == nil {\n\t\t\t\t\t\tcontinue // skip it since it's not in the argument list / present\n\t\t\t\t\t}\n\t\t\t\t\tcommand = parentFlag.command\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check nonempty when the flag is present\n\t\t\tif flag.nonempty && flag.args != nil {\n\t\t\t\tfound := false\n\t\t\t\tfor _, arg := range flag.args {\n\t\t\t\t\tif arg.value == \"\" {\n\t\t\t\t\t\tfound = true\n\t\t\t\t\t\tbreak\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif found {\n\t\t\t\t\tflag.err = fmt.Errorf(\"argument %s needs a value\", flag.FormattedArg())\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Check requirement when the flag is not present\n\t\t\tif flag.required && flag.args == nil {\n\t\t\t\t// Skip error when the value is set by default value or env variables\n\t\t\t\tif flag.valueBy == \"default\" || flag.valueBy == \"env\" {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\t// Otherwise it's an error\n\t\t\t\te := fmt.Sprintf(\"argument %s is required\", flag.FormattedArg())\n\t\t\t\tif command != \"\" {\n\t\t\t\t\te = fmt.Sprintf(\"%s for %s command\", e, command)\n\t\t\t\t}\n\t\t\t\tflag.err = errors.New(e)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t}\n\n\t// Iterate over the arguments and find the unknown arguments\n\tfor k, arg := range flagSet.args {\n\t\tif k > 0 && arg.kind == \"arg\" && arg.flagID == -1 {\n\t\t\tif s := flagSet.settingByID(arg.settingsID); s == nil || !s.allowUnknownArg {\n\t\t\t\targ.err = fmt.Errorf(\"unknown argument: %s%s\", arg.dash, arg.name)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn &flagSet, nil\n}", "title": "" }, { "docid": "5a71e7ee27d428096da637cdd4d09a00", "score": "0.45388737", "text": "func NewHandler() *CliHandler {\n\thandler := &CliHandler{\n\t\ttopLevelFlags: flag.CommandLine,\n\t}\n\n\thandler.topLevelFlags.Usage = func() { handler.explain() }\n\n\treturn handler\n}", "title": "" }, { "docid": "1197e424d1a4022ff82cde6c68dc8a2a", "score": "0.45299023", "text": "func (cli *GitCLI) New(opts ...Option) *GitCLI {\n\tc := &GitCLI{\n\t\tgit: cli.git,\n\t\tdir: cli.dir,\n\t\tworkTree: cli.workTree,\n\t\tgitDir: cli.gitDir,\n\t\targs: append([]string{}, cli.args...),\n\t\tstreams: cli.streams,\n\t\tsshAuthSock: cli.sshAuthSock,\n\t\tsshKnownHosts: cli.sshKnownHosts,\n\t}\n\tfor _, opt := range opts {\n\t\topt(c)\n\t}\n\treturn c\n}", "title": "" } ]
112d23fb9239d5c320d2eb8f01b5d1e4
Permutation sets a specific permutation for this token
[ { "docid": "646168b8d48d1280207414b47bb6e5d2", "score": "0.7301793", "text": "func (v *VariableReference) Permutation(i uint) error {\n\t// do nothing\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "7550236f657685c0ad02b23f561c816c", "score": "0.73224163", "text": "func (v *VariableItem) Permutation(i uint) error {\n\t// do nothing\n\n\treturn nil\n}", "title": "" }, { "docid": "cdd72d211b2ce0bcf50c69f2129854fb", "score": "0.72744614", "text": "func (v *VariableValue) Permutation(i uint) error {\n\t// do nothing\n\n\treturn nil\n}", "title": "" }, { "docid": "390db07c39d78af4c62f271869565798", "score": "0.71354413", "text": "func (v *Variable) Permutation(i uint) error {\n\tpermutations := v.Permutations()\n\n\tif i >= permutations {\n\t\treturn &token.PermutationError{\n\t\t\tType: token.PermutationErrorIndexOutOfBound,\n\t\t}\n\t}\n\t// do nothing\n\n\treturn nil\n}", "title": "" }, { "docid": "ac147baf8cd045b532e0ed822342cb08", "score": "0.6863503", "text": "func Permutation(given string, boxes, k int) {\n\titems := make([]bool, len(given))\n\thelperPermu(1, boxes, 0, 2, &items, \"\", given)\n\n}", "title": "" }, { "docid": "dca689aec80b4e0cb77de89ef48b2057", "score": "0.6620994", "text": "func (v *Variable) Permutations() uint {\n\treturn 1\n}", "title": "" }, { "docid": "c5e5dd8a885475c50e1e9b5cfbe2f9f4", "score": "0.6601054", "text": "func (p *permutations) permutation() []string {\n\tp.perm.Permutation(p.idx)\n\tfor i, j := range p.idx {\n\t\tp.dst[j] = p.src[i]\n\t}\n\treturn p.dst\n}", "title": "" }, { "docid": "f2b3bfa6cb736f00fff30cac95ac22f2", "score": "0.6558561", "text": "func (a *Len) Permutation(i uint) error {\n\tpermutations := a.Permutations()\n\n\tif i >= permutations {\n\t\treturn &token.PermutationError{\n\t\t\tType: token.PermutationErrorIndexOutOfBound,\n\t\t}\n\t}\n\n\t// do nothing\n\n\treturn nil\n}", "title": "" }, { "docid": "35f6859a2a4295d680555f2e8dcac736", "score": "0.6431571", "text": "func (v *VariableItem) Permutations() uint {\n\treturn 1\n}", "title": "" }, { "docid": "060266c55294e80f4e5eeee7686b4a23", "score": "0.6413863", "text": "func (v *VariableReference) Permutations() uint {\n\treturn 1\n}", "title": "" }, { "docid": "93f8b6be56aead64888c7064bd4448e4", "score": "0.6356492", "text": "func (f *FuncFilter) Permutation(i uint) error {\n\tpermutations := f.Permutations()\n\n\tif i >= permutations {\n\t\treturn &token.PermutationError{\n\t\t\tType: token.PermutationErrorIndexOutOfBound,\n\t\t}\n\t}\n\n\tf.state = f.permutationFunc(f.state, f.token, i)\n\n\treturn nil\n}", "title": "" }, { "docid": "f490b8dba6df55ee2b96529aca6607f9", "score": "0.6299257", "text": "func (v *VariableValue) Permutations() uint {\n\treturn 1\n}", "title": "" }, { "docid": "3f2341abe4c719f31f1fce3ec8f651ca", "score": "0.62922114", "text": "func nextPermutation(nums []int) {\n \n}", "title": "" }, { "docid": "9b831538cc157e3453ae0c259154b103", "score": "0.62562627", "text": "func (my *Node) SetPerm(perm NodeMode) {\n\tMode := my.Mode &^ ModePerm // clear previous\n\tmy.Mode = Mode | perm\n}", "title": "" }, { "docid": "d297de3254a3f63528c0a67a7aa96848", "score": "0.6223883", "text": "func (eval *evaluator) permute(ct0 *Ciphertext, generator uint64, switchKey *SwitchingKey, ctOut *Ciphertext) {\n\n\teval.switchKeysInPlace(ct0.value[1], switchKey, eval.poolQKS[1], eval.poolQKS[2])\n\n\teval.ringQ.Add(eval.poolQKS[1], ct0.value[0], eval.poolQKS[1])\n\n\teval.ringQ.Permute(eval.poolQKS[1], generator, ctOut.value[0])\n\teval.ringQ.Permute(eval.poolQKS[2], generator, ctOut.value[1])\n}", "title": "" }, { "docid": "9b91a60b7637c5201e43a642da000dca", "score": "0.62214667", "text": "func (eval *evaluator) permute(ct0 *Ciphertext, generator uint64, switchKey *rlwe.SwitchingKey, ctOut *Ciphertext) {\n\n\teval.switchKeysInPlace(ct0.value[1], switchKey, eval.poolQKS[1], eval.poolQKS[2])\n\n\teval.ringQ.Add(eval.poolQKS[1], ct0.value[0], eval.poolQKS[1])\n\n\teval.ringQ.Permute(eval.poolQKS[1], generator, ctOut.value[0])\n\teval.ringQ.Permute(eval.poolQKS[2], generator, ctOut.value[1])\n}", "title": "" }, { "docid": "290595ffece21dc80166fc583bd0eabd", "score": "0.61728173", "text": "func (v *View) Permute() {\n\tc := v.Config\n\tl := len(v.Peer)\n\tfor i := l - 1; i > 0; i-- {\n\t\tj := c.rint(i)\n\t\tv.Peer[i], v.Peer[j] = v.Peer[j], v.Peer[i]\n\t}\n}", "title": "" }, { "docid": "f48218d1cf712dda951c1aa4737e7e46", "score": "0.6112602", "text": "func (d *state) permute() {\n\tswitch d.state {\n\tcase spongeAbsorbing:\n\t\t// If we're absorbing, we need to xor the input into the state\n\t\t// before applying the permutation.\n\t\txorIn(d, d.buf)\n\t\td.buf = d.storage.asBytes()[:0]\n\t\tkeccakF1600(&d.a)\n\tcase spongeSqueezing:\n\t\t// If we're squeezing, we need to apply the permutatin before\n\t\t// copying more output.\n\t\tkeccakF1600(&d.a)\n\t\td.buf = d.storage.asBytes()[:d.rate]\n\t\tcopyOut(d, d.buf)\n\t}\n}", "title": "" }, { "docid": "6fb2a58f8fec94e18c9dc913ee693bce", "score": "0.60544777", "text": "func Permutation(n, k int) int {\n\tprod := 1\n\tfor i := n; i > n-k; i-- {\n\t\tprod *= int(i)\n\t}\n\tif k > n {\n\t\tpanic(\"k cannot be greater than n\")\n\t}\n\treturn prod\n}", "title": "" }, { "docid": "da2739b843c2f1318771f94bd801e675", "score": "0.60164386", "text": "func (v *Variable) PermutationsAll() uint {\n\treturn v.token.PermutationsAll()\n}", "title": "" }, { "docid": "c8cf59e0fe12f7f38d5be7ea0cdbdb60", "score": "0.5995299", "text": "func Permute(numElements uint32, index uint32, keys []uint32) uint32 {\n\tu := encode(numElements, index, keys)\n\tfor u >= numElements {\n\t\tu = encode(numElements, u, keys)\n\t}\n\n\treturn u\n}", "title": "" }, { "docid": "37858afd3e093eb37094f0b657270935", "score": "0.5952288", "text": "func permutePosition(i int) int {\n\treturn permutation[i]\n}", "title": "" }, { "docid": "9eaa1ec08e617d7e69980a28bb2103da", "score": "0.5945479", "text": "func permutation(n int, k int) int {\n\treturn factorial(n) / factorial(n-k)\n}", "title": "" }, { "docid": "e1e463ec67ec8787d31cd9eb0d328611", "score": "0.5865417", "text": "func ExampleNextPermutation() {\n\ts := []string{\"a\", \"b\", \"c\"}\n\tfor ok := true; ok; ok = NextPermutation(begin(s), end(s)) {\n\t\tfmt.Println(s)\n\t}\n\t// Output:\n\t// [a b c]\n\t// [a c b]\n\t// [b a c]\n\t// [b c a]\n\t// [c a b]\n\t// [c b a]\n}", "title": "" }, { "docid": "1f91b2b21c43c21f3869535eff1657d7", "score": "0.5854437", "text": "func (w Word) Permute(out chan<- string) {\n if len(w) <= 1 {\n out <- string(w)\n return\n }\n\n // Write first result manually.\n out <- string(w)\n\n // Find and print all remaining permutations.\n for w.next() {\n out <- string(w)\n }\n}", "title": "" }, { "docid": "0a9dd1f465a6be40112c8750d39c5cfd", "score": "0.58510864", "text": "func (a *Len) Permutations() uint {\n\treturn 1\n}", "title": "" }, { "docid": "c799f32ea527523408232e44d3f807c1", "score": "0.5834444", "text": "func recursivePermute(word []rune, permutationResult []string) []string {\n if len(word) == 0 {\n return permutationResult\n } else {\n result := make([]string, 0)\n for _, e := range permutationResult {\n result = append(result, join([]rune(e), word[0])...)\n }\n return recursivePermute(word[1:], result)\n }\n}", "title": "" }, { "docid": "84fb06fa3974337f76f01354dd436ebd", "score": "0.5824517", "text": "func ProblemPermute() {\n\n\t//test1 := []int{1, 2, 3}\n\t//fmt.Println(permute(test1))\n\n\ttest2 := []int{5, 4, 6, 2}\n\tfmt.Println(permute(test2))\n\n}", "title": "" }, { "docid": "1e6a7ad0e5f5d2a3c9b4fc2be6e32140", "score": "0.57962084", "text": "func generatePermutation(s []int, n int) {\n\tif n == 1 {\n\t\tnews := make([]int, len(s))\n\t\tcopy(news, s)\n\t\tseatingCombinations = append(seatingCombinations, news)\n\t}\n\tfor i := 0; i < n; i++ {\n\t\ts[i], s[n-1] = s[n-1], s[i]\n\t\tgeneratePermutation(s, n-1)\n\t\ts[i], s[n-1] = s[n-1], s[i]\n\t}\n}", "title": "" }, { "docid": "ff4e1fb38f8d215e656c2e2e27f8ef17", "score": "0.57953", "text": "func (s *StateX2) Permute() {\n\tif IsEnabledX2() {\n\t\tpermuteSIMDx2(s.a[s.offset:])\n\t} else {\n\t\tpermuteScalarX2(s.a[s.offset:]) // A slower generic implementation.\n\t}\n}", "title": "" }, { "docid": "f3e9ef8a8dfa1138f3d9c9704d060a3d", "score": "0.57762164", "text": "func (f *FuncFilter) Permutations() uint {\n\treturn f.permutationsFunc(f.state, f.token)\n}", "title": "" }, { "docid": "97649da9c7432f8a9b635b5eb693a4b2", "score": "0.57721114", "text": "func Permute( max int, length int, ch chan []int){\n go fillPermChan( length, max, ch)\n}", "title": "" }, { "docid": "5e58f57e4281e3ae7050735160178d5a", "score": "0.57531", "text": "func Permute(buf *[64]byte) {\n\tvar x [16]uint32\n\tfor i := 0; i < len(x); i++ {\n\t\tx[i] = binary.LittleEndian.Uint32(buf[4*i:])\n\t}\n\tdoRounds(&x)\n\t// for (i = 0;i < 16;++i) x[i] = PLUS(x[i],input[i]); // XXX: Bad idea if we later xor the input to the state?\n\tfor i := 0; i < len(x); i++ {\n\t\tbinary.LittleEndian.PutUint32(buf[4*i:], x[i])\n\t}\n}", "title": "" }, { "docid": "95006102544e9e4bc2f87916d2a726c8", "score": "0.5738905", "text": "func Permutation(in1, in2 string) bool {\n\tin1m := make(map[rune]int)\n\tin2m := make(map[rune]int)\n\tfor _, r := range in1 {\n\t\tin1m[r]++\n\t}\n\tfor _, r := range in2 {\n\t\tin2m[r]++\n\t}\n\tres := reflect.DeepEqual(in1m, in2m)\n\tif res {\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "d1f3ec394aa8354095c2444ec6944a30", "score": "0.5708803", "text": "func PermutateSlice(n []interface{}) PermutationType {\n\treturn &Permutable{Elements: n}\n}", "title": "" }, { "docid": "539c12a904a181a2ea06034dc81e761e", "score": "0.57047826", "text": "func PermutateNum(n int) PermutationType {\n\tt := make([]interface{}, n)\n\tfor i := 0; i < n; i++ {\n\t\tt[i] = i\n\t}\n\treturn &Permutable{Elements: t}\n}", "title": "" }, { "docid": "d779cabf2d783bda6ac20638ad714e5e", "score": "0.5700601", "text": "func (v *VariableItem) PermutationsAll() uint {\n\treturn 1\n}", "title": "" }, { "docid": "227ba5ac817fb3c5e048b3a68b9819d6", "score": "0.5687524", "text": "func nextPermutation(nums []int) {\n\tnumslength := len(nums)\n\n\tfor index := 0; index < numslength; index++ {\n\n\t\tif nums[index] < nums[index+1] {\n\t\t\tnums[index], nums[index+1] = nums[index+1], nums[index]\n\t\t\treturn\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "b84e285c76e92ba17b14fc5219d5ee04", "score": "0.5668211", "text": "func getPermutation(n int, k int) string {\n\tstr := \"\"\n\tk--\n\tdict := fac(n)\n\tused := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tpos := k / dict[n-1-i] // 第i位放剩余数字集合中的第pos个数字\n\t\tk = k % dict[n-1-i] // 下一次第k个排列\n\t\tstr += getNext(pos, &used)\n\t}\n\treturn str\n}", "title": "" }, { "docid": "4aa6a9beedc5ea5e70f2b87a2a935844", "score": "0.5632595", "text": "func (s *StateX4) Permute() {\n\tif IsEnabledX4() {\n\t\tpermuteSIMDx4(s.a[s.offset:])\n\t} else {\n\t\tpermuteScalarX4(s.a[s.offset:]) // A slower generic implementation.\n\t}\n}", "title": "" }, { "docid": "e2eeb0187172e16c6ca4516d0efe5bfd", "score": "0.5626505", "text": "func nextPermutation(nums []int) {\n\tstack := make([]int, 0, len(nums))\n\tfor i := len(nums) - 1; i >= 0; i-- {\n\t\tif len(stack) > 0 && nums[i] < nums[stack[len(stack)-1]] {\n\t\t\tindex := i\n\t\t\tfor len(stack) > 0 && nums[i] < nums[stack[len(stack)-1]]{\n\t\t\t\tindex = stack[len(stack)-1]\n\t\t\t\tstack = stack[:len(stack)-1]\n\t\t\t}\n\t\t\tnums[i], nums[index] = nums[index], nums[i]\n\t\t\treturn\n\t\t} else {\n\t\t\tstack = append(stack, i)\n\t\t}\n\t}\n\tfor i := 0; i < len(nums)/2; i++ {\n\t\tnums[i], nums[len(nums)-1-i] = nums[len(nums)-1-i], nums[i]\n\t}\n}", "title": "" }, { "docid": "8e5fca6a28a159a7db531ebd6f5cfa19", "score": "0.561299", "text": "func (r Rand) Perm(k, n int) []int {\n\tl := make([]int, n)\n\tfor i := range l {\n\t\tl[i] = i\n\t}\n\n\tr1 := r\n\tfor i := 0; i < k; i++ {\n\t\tb := []byte(fmt.Sprintf(\"%d\", i))\n\t\tr1 = r1.Derive(b)\n\t\tj := r1.Mod(n-i) + i\n\t\tl[i], l[j] = l[j], l[i]\n\t}\n\n\treturn l[:k]\n}", "title": "" }, { "docid": "a80aee65f1f7b8d1be0f329aaa56fb0f", "score": "0.55920726", "text": "func permute(nums []int) [][]int {\n\tused := make([]bool, len(nums))\n\tres := [][]int{}\n\tdfsPermutations(nums, used, []int{}, &res)\n\treturn res\n}", "title": "" }, { "docid": "0c32610b7a0cbcb1f19bfb8356d39b87", "score": "0.5590751", "text": "func Permutations(tuple []int, f func([]int)) {\n\n\ttupleCopy := make([]int, len(tuple))\n\tcopy(tupleCopy, tuple)\n\n\theapsAlgorithm(tupleCopy, len(tuple), f)\n}", "title": "" }, { "docid": "0a81a23689355c02dfeed42e16430dc3", "score": "0.5580048", "text": "func NextPermutation[T iter.Ordered](s []T) bool {\n\treturn algo.NextPermutation[T](Begin(s), End(s))\n}", "title": "" }, { "docid": "8c3ea8b9b1962413c842a48b3e083c3c", "score": "0.55709946", "text": "func getPermutation(n int, k int) string {\n\tarr := make([]byte, n)\n\tfor i := 0; i < n; i++ {\n\t\tarr[i] = '0' + byte(i+1)\n\t}\n\treturn string(_getPermutation(arr, k))\n}", "title": "" }, { "docid": "a4689948e0dd032549a16b5c50106e47", "score": "0.55691767", "text": "func Perm(a []rune, f func([]rune)) {\n\tperm(a, f, 0)\n}", "title": "" }, { "docid": "9fedcd9c9c741440d077c93e17a6234c", "score": "0.5567151", "text": "func (pkt *Packet) SetPitToken(token []byte) {\n\ttokenC := &C.Packet_GetLpL3Hdr(pkt.ptr()).pitToken\n\ttokenC.length = C.uint8_t(copy(cptr.AsByteSlice(tokenC.value[:]), token))\n}", "title": "" }, { "docid": "01b4a2e0cb024f6b5e80b82501333fbc", "score": "0.55293083", "text": "func (v *VariableValue) PermutationsAll() uint {\n\treturn 1\n}", "title": "" }, { "docid": "2ee7659a8801aff6f48186f76f37b0af", "score": "0.5526273", "text": "func perm(a []rune, f func([]rune), i int) {\n\tif i > len(a) {\n\t\tf(a)\n\t\treturn\n\t}\n\tperm(a, f, i+1)\n\tfor j := i + 1; j < len(a); j++ {\n\t\ta[i], a[j] = a[j], a[i]\n\t\tperm(a, f, i+1)\n\t\ta[i], a[j] = a[j], a[i]\n\t}\n}", "title": "" }, { "docid": "bb9ddb101c72eaa769d3a31f9f2f4668", "score": "0.55236244", "text": "func (v *VariableReference) PermutationsAll() uint {\n\treturn 1\n}", "title": "" }, { "docid": "defff0492e1e636f42674f03922fc072", "score": "0.5522314", "text": "func Perm(a []int, f func([]int)) {\n\tperm(a, f, 0)\n}", "title": "" }, { "docid": "defff0492e1e636f42674f03922fc072", "score": "0.5522314", "text": "func Perm(a []int, f func([]int)) {\n\tperm(a, f, 0)\n}", "title": "" }, { "docid": "2d178e5ecd0804b57d1d6ba3120d8248", "score": "0.5507019", "text": "func permutations(arr []int, ch chan []int) {\n\tvar helper func([]int, int)\n\thelper = func(arr []int, n int) {\n\t\tif n == 1 {\n\t\t\ttmp := make([]int, len(arr))\n\t\t\tcopy(tmp, arr)\n\t\t\tch <- tmp\n\t\t} else {\n\t\t\tfor i := 0; i < n; i++ {\n\t\t\t\thelper(arr, n-1)\n\t\t\t\tif n%2 == 1 {\n\t\t\t\t\ttmp := arr[i]\n\t\t\t\t\tarr[i] = arr[n-1]\n\t\t\t\t\tarr[n-1] = tmp\n\t\t\t\t} else {\n\t\t\t\t\ttmp := arr[0]\n\t\t\t\t\tarr[0] = arr[n-1]\n\t\t\t\t\tarr[n-1] = tmp\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\thelper(arr, len(arr))\n}", "title": "" }, { "docid": "a75ffe93dd5f550a6ad4f6f2cea0a50e", "score": "0.5486105", "text": "func Perm(n int) []int { return globalRand.Perm(n) }", "title": "" }, { "docid": "a6d14f7dc3330665ae03d1f0beeab785", "score": "0.5482911", "text": "func (g *LCGRandom) Perm(n int) []int {\n\tm := make([]int, n)\n\t// In the following loop, the iteration when i=0 always swaps m[0] with m[0].\n\t// A change to remove this useless iteration is to assign 1 to i in the init\n\t// statement.\n\tfor i := 0; i < n; i++ {\n\t\tj := g.Intn(i + 1)\n\t\tm[i] = m[j]\n\t\tm[j] = i\n\t}\n\treturn m\n}", "title": "" }, { "docid": "20729d6aff142e72f7d44434da817b41", "score": "0.54696923", "text": "func perm(a []string, f func([]string)) {\n\tpermHelper(a, f, 0)\n}", "title": "" }, { "docid": "5012ee561eb90380357cba6794a2ffda", "score": "0.5463721", "text": "func HeapPermutation(a []int, size int) {\n\tif size == 1 {\n\t\tfmt.Println(a)\n\t}\n\n\tfor i := 0; i < size; i++ {\n\t\tHeapPermutation(a, size-1)\n\n\t\tif size%2 == 1 {\n\t\t\ta[0], a[size-1] = a[size-1], a[0]\n\t\t} else {\n\t\t\ta[i], a[size-1] = a[size-1], a[i]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "205c9d92de2bac20c1db2e29ab89464f", "score": "0.54598826", "text": "func Perm(str string) string {\n\t// The implemention is based on Fisher-Yates shuffle algorithm.\n\tvar (\n\t\trs = []rune(str)\n\t\tn = len(rs)\n\t)\n\n\tfor i := n - 1; i >= 0; i-- {\n\t\tj := int(rand.Int63()) % (i + 1)\n\t\trs[i], rs[j] = rs[j], rs[i]\n\t}\n\n\treturn string(rs)\n}", "title": "" }, { "docid": "242d46a334e5fce34a4ea8782c9c6914", "score": "0.54410183", "text": "func (sr *Shuffler) permutation(n int) []int {\n\tarr := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tarr[i] = i\n\t}\n\n\tfor i := n - 1; i >= 0; i-- {\n\t\tj := sr.randInt(i + 1)\n\t\tarr[i], arr[j] = arr[j], arr[i]\n\t}\n\n\treturn arr\n}", "title": "" }, { "docid": "2b03c7442f2c4f9326b7743cf0221e42", "score": "0.54220873", "text": "func Perm(a []string, f func([]string)) {\n\tperm(a, f, 0)\n}", "title": "" }, { "docid": "230bb782d8069f020abf7416c2a0eb35", "score": "0.54176897", "text": "func (sbl *sboxLayer) permuteBy(perm matrix.Matrix, forwards bool) {\n\ttemp := encoding.ConcatenatedBlock{}\n\tfor row := 0; row < 16; row++ {\n\t\tcol := perm[8*row].Height() / 8\n\n\t\tif forwards {\n\t\t\ttemp[row] = (*sbl)[col]\n\t\t} else {\n\t\t\ttemp[col] = (*sbl)[row]\n\t\t}\n\t}\n\n\t*sbl = sboxLayer(temp)\n}", "title": "" }, { "docid": "9fe5b2ab512ada302a8525d84cd3242c", "score": "0.54011595", "text": "func fillPermChan( length, max int, ch chan []int ){\n used := make( []bool, max )\n perm := initialPerm( length, max, used )\n\n p := make( []int, length )\n copy(p, perm)\n ch <- p\n\n for incrementElement( 0, length, max, used, perm ){\n p := make( []int, length )\n copy(p, perm)\n ch <- p\n }\n close(ch )\n}", "title": "" }, { "docid": "3089ab40b3f8e3c5cfc8b77b3d8ed0ea", "score": "0.5388992", "text": "func (r RNG) Perm(n int) []int {\n\ta := make([]int, n)\n\tfor i := range a {\n\t\tj := r.Intn(i + 1)\n\t\ta[i] = a[j]\n\t\ta[j] = i\n\t}\n\treturn a\n}", "title": "" }, { "docid": "02ffdea39d94fe489fb0af5e0c45c23f", "score": "0.53882194", "text": "func TestPermutations(t *testing.T) {\n\tperms := Permutations(\"abc\")\n\texpectedPerms := []string{\n\t\t\"abc\",\n\t\t\"bac\",\n\t\t\"bca\",\n\t\t\"acb\",\n\t\t\"cab\",\n\t\t\"cba\",\n\t}\n\n\tif len(perms) != len(expectedPerms) {\n\t\tt.Error(perms)\n\t} else {\n\t\tfor i := range perms {\n\t\t\tif perms[i] != expectedPerms[i] {\n\t\t\t\tt.Error(perms)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "bb8af41e21e0f2c8774116fae402ff3e", "score": "0.53616387", "text": "func perm(a []int, f func([]int), i int) {\n\tif i > len(a) {\n\t\tf(a)\n\t\treturn\n\t}\n\tperm(a, f, i+1)\n\tfor j := i + 1; j < len(a); j++ {\n\t\ta[i], a[j] = a[j], a[i]\n\t\tperm(a, f, i+1)\n\t\ta[i], a[j] = a[j], a[i]\n\t}\n}", "title": "" }, { "docid": "bb8af41e21e0f2c8774116fae402ff3e", "score": "0.53616387", "text": "func perm(a []int, f func([]int), i int) {\n\tif i > len(a) {\n\t\tf(a)\n\t\treturn\n\t}\n\tperm(a, f, i+1)\n\tfor j := i + 1; j < len(a); j++ {\n\t\ta[i], a[j] = a[j], a[i]\n\t\tperm(a, f, i+1)\n\t\ta[i], a[j] = a[j], a[i]\n\t}\n}", "title": "" }, { "docid": "36c043a1bed9dc6a18153616bc14aa3d", "score": "0.53585124", "text": "func (o TopicOutput) Perm() pulumi.IntOutput {\n\treturn o.ApplyT(func(v *Topic) pulumi.IntOutput { return v.Perm }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "23b035c48c451cc202f699ed3debb8ec", "score": "0.5341993", "text": "func getPermutation(n int, k int) string {\n\tfactorial := make([]int, n)\n\tfactorial[0] = 1\n\tfor i := 1; i < n; i++ {\n\t\tfactorial[i] = factorial[i-1] * i\n\t}\n\n\tsb := strings.Builder{}\n\tsb.Grow(n)\n\tvisited := make([]bool, n)\n\tvar num int\n\tfor i := 0; i < n && k > 0; i++ {\n\t\t// index代表第i高位的数字,是第几种可能(从小到大排序)\n\t\tindex := (k-1)/factorial[n-1-i] + 1\n\t\tvar step int\n\t\tfor j := 0; j < n; j++ {\n\t\t\tif visited[j] {\n\t\t\t\t// 如果已经使用了,就跳过\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tstep++\n\t\t\tif step == index {\n\t\t\t\t// 从前往后遍历,如果走到该index的步骤,即为正确的解\n\t\t\t\tnum = j + 1\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tvisited[num-1] = true\n\n\t\tsb.WriteString(fmt.Sprintf(\"%d\", num))\n\t\tk = k - (index-1)*factorial[n-i-1]\n\t}\n\n\treturn sb.String()\n}", "title": "" }, { "docid": "e64aaf4e10f43b0b4a74f873d11e3ade", "score": "0.5327814", "text": "func perm(a []string, f func([]string), i int) {\n\tif i > len(a) {\n\t\tf(a)\n\t\treturn\n\t}\n\tperm(a, f, i+1)\n\tfor j := i + 1; j < len(a); j++ {\n\t\ta[i], a[j] = a[j], a[i]\n\t\tperm(a, f, i+1)\n\t\ta[i], a[j] = a[j], a[i]\n\t}\n}", "title": "" }, { "docid": "b4f5cb565b93431da8f21f04269d3d6f", "score": "0.5312751", "text": "func CheckPermutation(str1, str2 string) bool {\n\t// if the len of 2 strings is different, then it's not a permutation\n\tif len(str1) != len(str2) {\n\t\treturn false\n\t}\n\n\tvar set [128]int\n\tfor _,r := range str1 {\n\t\tset[r]++\n\t}\n\n\tfor _,r := range str2 {\n\t\tif set[r] == 0 {\n\t\t\treturn false\n\t\t}\n\t\tset[r]--\n\t}\n\treturn true\n}", "title": "" }, { "docid": "abb217da5531eca0455ddfcf2461ce19", "score": "0.5298638", "text": "func IsPermutation[T iter.Ordered](s1, s2 []T) bool {\n\treturn algo.IsPermutation[T](Begin(s1), End(s1), Begin(s2), __end_ref(s2))\n}", "title": "" }, { "docid": "2bc3f7e763d60d9c241143ce308c0d32", "score": "0.5297133", "text": "func Perm(n int) []int {}", "title": "" }, { "docid": "5d27333b9668becc195482b7bc8509bd", "score": "0.5296402", "text": "func nextPermutation(nums []int) {\n\tsize := len(nums)\n\tif size < 2 {\n\t\treturn\n\t}\n\tvar rec []int\n\trecI := size - 2\n\tfor ; recI >= 0; recI-- {\n\t\tif nums[recI] < nums[recI+1] {\n\t\t\trec = nums[recI:]\n\t\t\tbreak\n\t\t}\n\t}\n\tif rec == nil {\n\t\ttmpSize := size - 1\n\t\tfor i := 0; i < (size >> 1); i++ {\n\t\t\tnums[i], nums[tmpSize-i] = nums[tmpSize-i], nums[i]\n\t\t}\n\t\treturn\n\t}\n\ttmpSize := len(rec) - 1\n\ttmpNums := rec[1:]\n\tfor i := 0; i < (tmpSize >> 1); i++ {\n\t\ttmpNums[i], tmpNums[tmpSize-1-i] = tmpNums[tmpSize-1-i], tmpNums[i]\n\t}\n\tfor i := 0; i < tmpSize; i++ {\n\t\tif nums[recI] < tmpNums[i] {\n\t\t\tnums[recI], tmpNums[i] = tmpNums[i], nums[recI]\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1e4ce19c818d160f86189f9c459879f6", "score": "0.52821296", "text": "func Perm(a []int, f func([]int)) {\n perm(a, f, 0)\n}", "title": "" }, { "docid": "a50d9070b1fedbe1b88926f483fa4af7", "score": "0.5276594", "text": "func getPermutations(password string) []string {\n\tsubstitutions := relevantL33tSubtable(password)\n\tpermutations := getAllPermutationsOfLeetSubstitutions(password, substitutions)\n\treturn permutations\n}", "title": "" }, { "docid": "118efe4df05ccf54b919b703c7f3b504", "score": "0.5275356", "text": "func perm(n int) (out []int) {\n\tfor _, v := range rand.Perm(n) {\n\t\tout = append(out, v)\n\t}\n\treturn\n}", "title": "" }, { "docid": "387e3fcff9ae0d66459a8a400022cdaa", "score": "0.5274908", "text": "func IsPermutation(s1 string, s2 string) bool {\n\tcount := make(map[byte]int)\n\tlength := len(s1)\n\tif len(s2) != length {\n\t\tfmt.Println(s1, \"&\", s2, \"are not permutation\")\n\t\treturn false\n\t}\n\n\tfor i := 0; i < length; i++ {\n\t\tch := s1[i]\n\t\tcount[ch]++\n\t\tch = s2[i]\n\t\tcount[ch]--\n\t}\n\tfor i := 0; i < length; i++ {\n\t\tch := s1[i]\n\t\tif count[ch] != 0 {\n\t\t\tfmt.Println(s1, \"&\", s2, \"are not permutation\")\n\t\t\treturn false\n\t\t}\n\t}\n\tfmt.Println(s1, \"&\", s2, \"are permutation\")\n\treturn true\n}", "title": "" }, { "docid": "905360e04e082112624c3dbfb302e7b3", "score": "0.5271575", "text": "func SetPerm(k Id, p KeyPerm) error {\n\treturn keyctl_SetPerm(keyId(k.Id()), uint32(p))\n}", "title": "" }, { "docid": "c1301a9a4846e0926884e24a98a195ba", "score": "0.5266764", "text": "func Permatation(strarray []rune, i int) {\n\tif i == len(strarray) {\n\t\tfmt.Println(string(strarray))\n\t} else {\n\t\tfor j := i; j < len(strarray); j++ {\n\t\t\tstrarray[i], strarray[j] = strarray[j], strarray[i]\n\t\t\tPermatation(strarray, i+1)\n\t\t\tstrarray[i], strarray[j] = strarray[j], strarray[i]\n\t\t}\n\t}\n}", "title": "" }, { "docid": "e262179f54f6aa1cb01eb0331b57647f", "score": "0.5260449", "text": "func (r *Rand) Perm(n int) []int {}", "title": "" }, { "docid": "f97314940da3747256ccaec1f2757f98", "score": "0.52480954", "text": "func Permutations(ms []int) ([][]int, error) {\n\tif len(ms) < 2 {\n\t\treturn [][]int{ms}, nil\n\t}\n\tres := [][]int{}\n\tseen := map[int]bool{}\n\tfor _, i := range ms {\n\t\tif _, used := seen[i]; !used {\n\t\t\tres = append(res, []int{i})\n\t\t\tseen[i] = true\n\t\t}\n\t}\n\tcnt := util.Count(ms)\n\treturn *backtrack(1, &ms, &res, cnt), nil\n}", "title": "" }, { "docid": "929953f7f6dd5830a846c65d90582a42", "score": "0.5238619", "text": "func Permutations(input []int) (output [][]int) {\n\tvar helper func([]int, int)\n\thelper = func(input []int, n int) {\n\t\tif n == 1 {\n\t\t\ttmp := make([]int, len(input))\n\t\t\tcopy(tmp, input)\n\t\t\toutput = append(output, tmp)\n\t\t\treturn\n\t\t}\n\t\tfor i := 0; i < n; i++ {\n\t\t\thelper(input, n-1)\n\t\t\tif n%2 == 1 {\n\t\t\t\ttmp := input[i]\n\t\t\t\tinput[i] = input[n-1]\n\t\t\t\tinput[n-1] = tmp\n\t\t\t} else {\n\t\t\t\ttmp := input[0]\n\t\t\t\tinput[0] = input[n-1]\n\t\t\t\tinput[n-1] = tmp\n\t\t\t}\n\t\t}\n\t}\n\thelper(input, len(input))\n\treturn\n}", "title": "" }, { "docid": "f59f075ddb49acfe7400cf764c52c594", "score": "0.5233042", "text": "func Perm(n int) []int {\n\tm := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tj := Intn(i + 1)\n\t\tm[i] = m[j]\n\t\tm[j] = i\n\t}\n\treturn m\n}", "title": "" }, { "docid": "a72446eb3971b60abfab8536f97e216e", "score": "0.52249247", "text": "func Perm(n int) []int {\n\trng.Lock()\n\tdefer rng.Unlock()\n\treturn rng.rand.Perm(n)\n}", "title": "" }, { "docid": "680eda4a138589b4e5c9d4c8bf069ab0", "score": "0.520477", "text": "func (p *Permission) SetPerm(o Owner, s string, b bool) {\n\tif o != nil {\n\t\tif b {\n\t\t\tif p.Perm == nil {\n\t\t\t\tp.Perm = make(map[string][]Owner)\n\t\t\t}\n\t\t\tfor _, v := range p.Perm[s] {\n\t\t\t\tif v.Equal(o) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tp.Perm[s] = append(p.Perm[s], o)\n\t\t} else {\n\t\t\tmi := -1\n\t\t\tfor i, v := range p.Perm[s] {\n\t\t\t\tif v.Equal(o) {\n\t\t\t\t\tmi = i\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif mi > -1 {\n\t\t\t\tp.Perm[s] = append(p.Perm[s][:mi], p.Perm[s][mi+1:]...)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "fd089c78ee465e1f2ef2687b4263eadf", "score": "0.5203641", "text": "func NextPermutation(str string) string {\n if len(str) == 0 || len(str) == 1 {\n return str\n }\n head, tail := splitHeadAndTail(str)\n if head == \"\" {\n return str\n }\n headChars := []rune(head)\n tailChars := []rune(tail)\n currentIndex := len(tail) - 1\n for currentIndex >= 0 {\n if tail[currentIndex:currentIndex+1] > head[len(head)-1:len(head)] {\n temp := tailChars[currentIndex]\n tailChars[currentIndex] = headChars[len(head)-1]\n headChars[len(head)-1] = temp\n break\n }\n currentIndex--\n }\n return string(headChars) + Reverse(string(tailChars))\n}", "title": "" }, { "docid": "3bef2a4dedfeb024b1dfbd1981e05c07", "score": "0.5201921", "text": "func perm(n int) (out []Item) {\n\tfor _, v := range rand.Perm(n) {\n\t\tout = append(out, Int(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "3bef2a4dedfeb024b1dfbd1981e05c07", "score": "0.5201921", "text": "func perm(n int) (out []Item) {\n\tfor _, v := range rand.Perm(n) {\n\t\tout = append(out, Int(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "0a2c96ee81e9ecffc8e91b0b2309941f", "score": "0.5188488", "text": "func CalcPermutationPatterns(elems []rune, k int) [][]rune {\n\tnewResi := make([]rune, len(elems))\n\tcopy(newResi, elems)\n\n\treturn permRec([]rune{}, newResi, k)\n}", "title": "" }, { "docid": "40b45cb729fde88235678ed9b1a09f34", "score": "0.51830757", "text": "func TestPerm(t *testing.T) {\n\tchars := \"abcde\" // string to be permuted\n\tcreatePerm := func() string {\n\t\ts := make([]byte, len(chars))\n\t\tfor i, j := range Perm(len(chars)) {\n\t\t\ts[i] = chars[j]\n\t\t}\n\t\treturn string(s)\n\t}\n\n\t// create (factorial(len(chars)) * 100) permutations\n\tpermCount := make(map[string]int)\n\tfor i := 0; i < 12000; i++ {\n\t\tpermCount[createPerm()]++\n\t}\n\n\t// we should have seen each permutation approx. 100 times\n\tfor p, n := range permCount {\n\t\tif n < 50 || n > 150 {\n\t\t\tt.Errorf(\"saw permutation %v times: %v\", n, p)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b2b97d5180c845101fa26c0cc2f0556", "score": "0.51762706", "text": "func permutationNext(data sort.Interface) bool {\n\tvar k, l int\n\tfor k = data.Len() - 2; ; k-- { // 1.\n\t\tif k < 0 {\n\t\t\treturn false\n\t\t}\n\n\t\tif data.Less(k, k+1) {\n\t\t\tbreak\n\t\t}\n\t}\n\tfor l = data.Len() - 1; !data.Less(k, l); l-- { // 2.\n\t}\n\tdata.Swap(k, l) // 3.\n\tfor i, j := k+1, data.Len()-1; i < j; i++ { // 4.\n\t\tdata.Swap(i, j)\n\t\tj--\n\t}\n\treturn true\n}", "title": "" }, { "docid": "9f905601740c8b7751ed73d4c0db434f", "score": "0.5173864", "text": "func Permutations(xs []int, r int) [][]int {\n\t// Translated from the Python itertools module, see C source below for comments.\n\t// https://github.com/python/cpython/blob/master/Modules/itertoolsmodule.c#L3127\n\tpool := append([]int{}, xs...)\n\tn := len(pool)\n\n\tswitch {\n\tcase n == 0:\n\t\tpanic(\"Permutations: passed zero-length slice\")\n\tcase r < 1 || r > n:\n\t\tpanic(\"Permutations: passed bad r value\")\n\t}\n\n\tindices := make([]int, n)\n\tcycles := make([]int, r)\n\n\tfor i := 0; i < n; i++ {\n\t\tindices[i] = i\n\t}\n\tfor i := 0; i < r; i++ {\n\t\tcycles[i] = n - i\n\t}\n\n\tvar res [][]int\n\tres = append(res, pool[:r])\n\n\tfor {\n\t\tvar i int // Represents the leftmost element to change per iteration.\n\t\tfor i = r - 1; i >= 0; i-- {\n\t\t\tcycles[i]--\n\t\t\tif cycles[i] == 0 {\n\t\t\t\tindex := indices[i]\n\t\t\t\tfor j := i; j < n-1; j++ {\n\t\t\t\t\tindices[j] = indices[j+1]\n\t\t\t\t}\n\t\t\t\tindices[n-1] = index\n\t\t\t\tcycles[i] = n - i\n\t\t\t} else {\n\t\t\t\tj := cycles[i]\n\t\t\t\tindices[i], indices[n-j] = indices[n-j], indices[i]\n\t\t\t\tperm := make([]int, r)\n\t\t\t\tfor i, index := range indices[:r] {\n\t\t\t\t\tperm[i] = pool[index]\n\t\t\t\t}\n\t\t\t\tres = append(res, perm)\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif i < 0 {\n\t\t\treturn res\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c6290f3fed2615164f4a7caa8def8186", "score": "0.51718533", "text": "func perm(n int) (out []bItem) {\n\tfor _, v := range rand.Perm(n) {\n\t\tout = append(out, Int(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "6a1fd19218eda3f66fc3ea93d9206a2b", "score": "0.51717764", "text": "func NewPermutation(max int64, seed uint32, src Sequence) (*Permutation, error) {\n\tif max < 1 {\n\t\treturn nil, errors.New(\"period must be positive\")\n\t}\n\t// number of rounds to get \"good\" results is roughly 6 log N.\n\tbits := 64 - bits.LeadingZeros64(uint64(max))\n\tp := Permutation{max: max, rounds: 6 * bits, counter: 0}\n\n\tp.src = src\n\tp.k = make([]uint64, p.rounds)\n\tp.permSeed = seed\n\toffset := OffsetFor(SequencePermutationK, p.permSeed, 0, 0)\n\tfor i := uint64(0); i < uint64(p.rounds); i++ {\n\t\toffset.Lo = i\n\t\tp.k[i] = p.src.BitsAt(offset).Lo % uint64(p.max)\n\t}\n\treturn &p, nil\n}", "title": "" }, { "docid": "6e578c293efd068d7aa067c04e64d119", "score": "0.5154823", "text": "func permute(nums []int) [][]int {\n\tif len(nums) == 0 {\n\t\treturn [][]int{}\n\t}\n\tres, path := make([][]int, 0), make([]int, 0)\n\tdfs(&res, nums, path)\n\treturn res\n}", "title": "" }, { "docid": "5a4829d5cd407b9eda69e3a9ba0b2fe2", "score": "0.5146776", "text": "func (o *UserToken) SetTokenP(exec boil.Executor, insert bool, related *Token) {\n\tif err := o.SetToken(exec, insert, related); err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n}", "title": "" }, { "docid": "749e1d2cd08dc65a14d7107ebc333782", "score": "0.51381034", "text": "func generatePermutations(k int, a []int) [][]int {\n\tif k == 1 {\n\t\treturn [][]int{a}\n\t}\n\n\tc := generatePermutations(k-1, a)\n\n\taa := make([]int, len(a))\n\tcopy(aa, a)\n\tfor i := 0; i < k-1; i++ {\n\t\ttmp := aa[i]\n\t\taa[i] = aa[k-1]\n\t\taa[k-1] = tmp\n\n\t\taaa := make([]int, len(aa))\n\t\tcopy(aaa, aa)\n\t\tc = append(c, generatePermutations(k-1, aaa)...)\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "d5b10a9d812aea90f9470e036c4e9bef", "score": "0.5135791", "text": "func perm(n int) (out []Item) {\n\tfor _, v := range rand.Perm(n) {\n\t\tout = append(out, IntItem(v))\n\t}\n\treturn\n}", "title": "" }, { "docid": "cf05076d7d06ddd9c3f7dc4c93f71968", "score": "0.51339597", "text": "func IndexPermutations(n int) [][]int {\n\tdata := make([]int, n)\n\tfor i := 0; i < n; i++ {\n\t\tdata[i] = i\n\t}\n\tperms := make([][]int, 0, Factorial(n))\n\tperms = append(perms, append([]int(nil), data...))\n\tstack := make([]int, n)\n\tfor s := 0; s < n; {\n\t\tif stack[s] < s {\n\t\t\tif s%2 == 0 {\n\t\t\t\tdata[0], data[s] = data[s], data[0]\n\t\t\t} else {\n\t\t\t\tdata[stack[s]], data[s] = data[s], data[stack[s]]\n\t\t\t}\n\t\t\tperms = append(perms, append([]int(nil), data...))\n\t\t\tstack[s] += 1\n\t\t\ts = 0\n\t\t} else {\n\t\t\tstack[s] = 0\n\t\t\ts += 1\n\t\t}\n\t}\n\treturn perms\n}", "title": "" }, { "docid": "2e8a4bfeef4fb830cc7c40bf1d94ce3a", "score": "0.513131", "text": "func Permutations(xs []int) (res [][]int) {\n\tvar rc func([]int, int)\n\trc = func(a []int, k int) {\n\t\tif k == len(a) {\n\t\t\tres = append(res, append([]int{}, a...))\n\t\t} else {\n\t\t\tfor i := k; i < len(xs); i++ {\n\t\t\t\ta[k], a[i] = a[i], a[k]\n\t\t\t\trc(a, k+1)\n\t\t\t\ta[k], a[i] = a[i], a[k]\n\t\t\t}\n\t\t}\n\t}\n\trc(xs, 0)\n\n\treturn res\n}", "title": "" } ]
61a3c095f58d56b35dd9d2ecc90c90d7
StreamAnalyticsJobs returns a StreamAnalyticsJobInformer.
[ { "docid": "c5b68ffe30bb584714619aadf3e2bda2", "score": "0.73070246", "text": "func (v *version) StreamAnalyticsJobs() StreamAnalyticsJobInformer {\n\treturn &streamAnalyticsJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" } ]
[ { "docid": "783d70245093b00d723d1c2bf0b54400", "score": "0.61234677", "text": "func (s *streamAnalyticsJobLister) StreamAnalyticsJobs(namespace string) StreamAnalyticsJobNamespaceLister {\n\treturn streamAnalyticsJobNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "3b1e97f4bbccab330b5b8d0fcea5a4d2", "score": "0.57644045", "text": "func (s *streamAnalyticsJobLister) List(selector labels.Selector) (ret []*v1alpha1.StreamAnalyticsJob, err error) {\n\terr = cache.ListAll(s.indexer, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.StreamAnalyticsJob))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "88c99e2524363f7faae05809f649ae8b", "score": "0.5666857", "text": "func (v *version) StreamAnalyticsOutputServicebusQueues() StreamAnalyticsOutputServicebusQueueInformer {\n\treturn &streamAnalyticsOutputServicebusQueueInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "9ab645f923c12beea78133623ebca15c", "score": "0.559603", "text": "func (v *version) StreamAnalyticsOutputMssqls() StreamAnalyticsOutputMssqlInformer {\n\treturn &streamAnalyticsOutputMssqlInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "c3c64e96d7f92ed36ce3de42d8371571", "score": "0.5538351", "text": "func NewStreamAnalyticsJobLister(indexer cache.Indexer) StreamAnalyticsJobLister {\n\treturn &streamAnalyticsJobLister{indexer: indexer}\n}", "title": "" }, { "docid": "45f89fca0879bb42896af22ad6ca863e", "score": "0.5288334", "text": "func (v *version) StreamAnalyticsStreamInputIothubs() StreamAnalyticsStreamInputIothubInformer {\n\treturn &streamAnalyticsStreamInputIothubInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "0d9cba82f2c30904006d69b5a9c7e71d", "score": "0.51821816", "text": "func (v *version) StreamAnalyticsStreamInputEventhubs() StreamAnalyticsStreamInputEventhubInformer {\n\treturn &streamAnalyticsStreamInputEventhubInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "fd0748ad0a2eb4c6b7f751eb52338070", "score": "0.5151059", "text": "func (v *version) StreamAnalyticsStreamInputBlobs() StreamAnalyticsStreamInputBlobInformer {\n\treturn &streamAnalyticsStreamInputBlobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "4dc348fa7290ad40695569fcf6781475", "score": "0.51122206", "text": "func (v *version) StreamAnalyticsOutputEventhubs() StreamAnalyticsOutputEventhubInformer {\n\treturn &streamAnalyticsOutputEventhubInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "0ed7a81292facc7fd5d66cd7c6772667", "score": "0.5063991", "text": "func (s streamAnalyticsJobNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.StreamAnalyticsJob, err error) {\n\terr = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {\n\t\tret = append(ret, m.(*v1alpha1.StreamAnalyticsJob))\n\t})\n\treturn ret, err\n}", "title": "" }, { "docid": "63047dab6adf37d0a747b8420d96c5d7", "score": "0.5062121", "text": "func (m *Module) Stream(sink bar.Sink) {\n\tclient, _ := m.config.Client()\n\tif wrapForTest != nil {\n\t\twrapForTest(client)\n\t}\n\toutf := m.outputFunc.Get().(func(Notifications) bar.Output)\n\tnextOutputFunc, done := m.outputFunc.Subscribe()\n\tdefer done()\n\tinfo, err := m.getNotifications(client)\n\tfor {\n\t\tif err != errCached {\n\t\t\tif sink.Error(err) {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsink.Output(outf(info))\n\t\t}\n\t\terr = nil\n\t\tselect {\n\t\tcase <-nextOutputFunc:\n\t\t\toutf = m.outputFunc.Get().(func(Notifications) bar.Output)\n\t\tcase <-m.scheduler.C:\n\t\t\ti, e := m.getNotifications(client)\n\t\t\terr = e\n\t\t\tif e != errCached {\n\t\t\t\tinfo = i\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f12f92ef743c286b46503bcca53a271", "score": "0.5041555", "text": "func (v *version) StreamAnalyticsOutputBlobs() StreamAnalyticsOutputBlobInformer {\n\treturn &streamAnalyticsOutputBlobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "aaab997909131ad821031f6e7de7918c", "score": "0.47943258", "text": "func (s streamAnalyticsJobNamespaceLister) Get(name string) (*v1alpha1.StreamAnalyticsJob, error) {\n\tobj, exists, err := s.indexer.GetByKey(s.namespace + \"/\" + name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif !exists {\n\t\treturn nil, errors.NewNotFound(v1alpha1.Resource(\"streamanalyticsjob\"), name)\n\t}\n\treturn obj.(*v1alpha1.StreamAnalyticsJob), nil\n}", "title": "" }, { "docid": "c979ef14603fd0c41ae7fd5942878bdc", "score": "0.452613", "text": "func (api *API) Job() batchv1informers.JobInformer {\n\tif api.job == nil {\n\t\tpanic(\"Job informer not configured\")\n\t}\n\treturn api.job\n}", "title": "" }, { "docid": "9eb189a50cc996f7884675022378f831", "score": "0.44972596", "text": "func StreamActivities() <-chan Activity {\n\tchannel := make(chan Activity, nano.ChannelBufferSize)\n\twg := sync.WaitGroup{}\n\twg.Add(2)\n\n\tgo func() {\n\t\tfor obj := range DB.All(\"ActivityCreate\") {\n\t\t\tchannel <- obj.(Activity)\n\t\t}\n\n\t\twg.Done()\n\t}()\n\n\tgo func() {\n\t\tfor obj := range DB.All(\"ActivityConsumeAnime\") {\n\t\t\tchannel <- obj.(Activity)\n\t\t}\n\n\t\twg.Done()\n\t}()\n\n\tgo func() {\n\t\twg.Wait()\n\t\tclose(channel)\n\t}()\n\n\treturn channel\n}", "title": "" }, { "docid": "cb1968778cd5b6507240cd2a187e6113", "score": "0.43680644", "text": "func (m *PrinterBase) GetJobs()([]PrintJobable) {\n val, err := m.GetBackingStore().Get(\"jobs\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]PrintJobable)\n }\n return nil\n}", "title": "" }, { "docid": "dffbafcd2aa74572d96aa63c3eb02486", "score": "0.4330685", "text": "func (v *version) StreamAnalyticsFunctionJavascriptUdves() StreamAnalyticsFunctionJavascriptUdfInformer {\n\treturn &streamAnalyticsFunctionJavascriptUdfInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "dab1d56bd00f99fb7cdf709c068f7608", "score": "0.43106255", "text": "func (q *Queue) Show() []Job {\n\treturn q.jobs\n}", "title": "" }, { "docid": "96765ecf0cbb32c5aca573b3a436146f", "score": "0.42817816", "text": "func (m *Incident) GetAlerts()([]Alertable) {\n val, err := m.GetBackingStore().Get(\"alerts\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]Alertable)\n }\n return nil\n}", "title": "" }, { "docid": "77e26f888595458444b6aab5ca6ffb90", "score": "0.42679274", "text": "func (v *version) MarsJobs() MarsJobInformer {\n\treturn &marsJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "1ade96f9a5123c8b54350cbdcbee9c6b", "score": "0.42344669", "text": "func NewSink(c *SinkConfig) Sink {\n\tsinks := metrics.FanoutSink{}\n\n\t// Always create an in-memory sink\n\tinterval := 1 * time.Second\n\tretention := 1 * time.Hour\n\tinmemSink := metrics.NewInmemSink(interval, retention)\n\tsinks = append(sinks, inmemSink)\n\n\t// Allow the in-memory sink to be signaled, printing stats to the log\n\tinmemSignal := metrics.NewInmemSignal(inmemSink, metrics.DefaultSignal, c.Logger)\n\n\t// Although New returns an error type, there is no codepath for non-nil error.\n\tconfig := metrics.DefaultConfig(c.ServiceName)\n\tm, _ := metrics.New(config, sinks)\n\n\tt := &sink{\n\t\tm: m,\n\t\tstopChan: c.StopChan,\n\t\tinmemCloser: inmemSignal.Stop,\n\t}\n\n\tgo t.cleanup()\n\treturn t\n}", "title": "" }, { "docid": "327f43b748fbacb68666b834bd6aad6b", "score": "0.42209527", "text": "func ExampleFunctionsClient_NewListByStreamingJobPager() {\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 := armstreamanalytics.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpager := clientFactory.NewFunctionsClient().NewListByStreamingJobPager(\"sjrg1637\", \"sj8653\", &armstreamanalytics.FunctionsClientListByStreamingJobOptions{Select: 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.FunctionListResult = armstreamanalytics.FunctionListResult{\n\t\t// \tValue: []*armstreamanalytics.Function{\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"function588\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.StreamAnalytics/streamingjobs/functions\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/56b5e0a9-b645-407d-99b0-c64f86013e3d/resourceGroups/sjrg1637/providers/Microsoft.StreamAnalytics/streamingjobs/sj8653/functions/function588\"),\n\t\t// \t\t\tProperties: &armstreamanalytics.ScalarFunctionProperties{\n\t\t// \t\t\t\tType: to.Ptr(\"Scalar\"),\n\t\t// \t\t\t\tEtag: to.Ptr(\"281cbf11-cd50-4a44-b833-cf170ce74748\"),\n\t\t// \t\t\t\tProperties: &armstreamanalytics.FunctionConfiguration{\n\t\t// \t\t\t\t\tBinding: &armstreamanalytics.AzureMachineLearningWebServiceFunctionBinding{\n\t\t// \t\t\t\t\t\tType: to.Ptr(\"Microsoft.MachineLearning/WebService\"),\n\t\t// \t\t\t\t\t\tProperties: &armstreamanalytics.AzureMachineLearningWebServiceFunctionBindingProperties{\n\t\t// \t\t\t\t\t\t\tBatchSize: to.Ptr[int32](5000),\n\t\t// \t\t\t\t\t\t\tEndpoint: to.Ptr(\"someAzureMLEndpointURL\"),\n\t\t// \t\t\t\t\t\t\tInputs: &armstreamanalytics.AzureMachineLearningWebServiceInputs{\n\t\t// \t\t\t\t\t\t\t\tName: to.Ptr(\"input1\"),\n\t\t// \t\t\t\t\t\t\t\tColumnNames: []*armstreamanalytics.AzureMachineLearningWebServiceInputColumn{\n\t\t// \t\t\t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\t\t\tName: to.Ptr(\"tweet\"),\n\t\t// \t\t\t\t\t\t\t\t\t\tDataType: to.Ptr(\"string\"),\n\t\t// \t\t\t\t\t\t\t\t\t\tMapTo: to.Ptr[int32](0),\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\tOutputs: []*armstreamanalytics.AzureMachineLearningWebServiceOutputColumn{\n\t\t// \t\t\t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\t\t\tName: to.Ptr(\"Sentiment\"),\n\t\t// \t\t\t\t\t\t\t\t\tDataType: to.Ptr(\"string\"),\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\tInputs: []*armstreamanalytics.FunctionInput{\n\t\t// \t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\tDataType: to.Ptr(\"nvarchar(max)\"),\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t\tOutput: &armstreamanalytics.FunctionOutput{\n\t\t// \t\t\t\t\t\tDataType: to.Ptr(\"nvarchar(max)\"),\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t},\n\t\t// \t\t\t},\n\t\t// \t\t},\n\t\t// \t\t{\n\t\t// \t\t\tName: to.Ptr(\"function8197\"),\n\t\t// \t\t\tType: to.Ptr(\"Microsoft.StreamAnalytics/streamingjobs/functions\"),\n\t\t// \t\t\tID: to.Ptr(\"/subscriptions/56b5e0a9-b645-407d-99b0-c64f86013e3d/resourceGroups/sjrg1637/providers/Microsoft.StreamAnalytics/streamingjobs/sj8653/functions/function8197\"),\n\t\t// \t\t\tProperties: &armstreamanalytics.ScalarFunctionProperties{\n\t\t// \t\t\t\tType: to.Ptr(\"Scalar\"),\n\t\t// \t\t\t\tEtag: to.Ptr(\"94a512d5-2f59-4e39-b9c8-bca4abd74b7e\"),\n\t\t// \t\t\t\tProperties: &armstreamanalytics.FunctionConfiguration{\n\t\t// \t\t\t\t\tBinding: &armstreamanalytics.JavaScriptFunctionBinding{\n\t\t// \t\t\t\t\t\tType: to.Ptr(\"Microsoft.StreamAnalytics/JavascriptUdf\"),\n\t\t// \t\t\t\t\t\tProperties: &armstreamanalytics.JavaScriptFunctionBindingProperties{\n\t\t// \t\t\t\t\t\t\tScript: to.Ptr(\"function (a, b) { return a * b; }\"),\n\t\t// \t\t\t\t\t\t},\n\t\t// \t\t\t\t\t},\n\t\t// \t\t\t\t\tInputs: []*armstreamanalytics.FunctionInput{\n\t\t// \t\t\t\t\t\t{\n\t\t// \t\t\t\t\t\t\tDataType: to.Ptr(\"Any\"),\n\t\t// \t\t\t\t\t}},\n\t\t// \t\t\t\t\tOutput: &armstreamanalytics.FunctionOutput{\n\t\t// \t\t\t\t\t\tDataType: to.Ptr(\"Any\"),\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}},\n\t\t// }\n\t}\n}", "title": "" }, { "docid": "7fd3f4e137b2be356547ebc99469b73b", "score": "0.4210495", "text": "func (o ReferenceInputBlobOutput) StreamAnalyticsJobName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ReferenceInputBlob) pulumi.StringOutput { return v.StreamAnalyticsJobName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fe335e5d77b5d9922bdfe19b634e1f1c", "score": "0.41650897", "text": "func (v *version) SensuHandlers() SensuHandlerInformer {\n\treturn &sensuHandlerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "e48dc94684c97b94b7922b09ed1047a5", "score": "0.4164928", "text": "func streamLog(c *client.Client, jobID string) error {\n\tctx, cancel := context.WithCancel(context.Background())\n\tdefer cancel()\n\n\treceiver, err := c.GetLogReceiver(ctx, &proto.Job{Id: jobID})\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tin, err := receiver.Read()\n\t\tif err == io.EOF {\n\t\t\treturn nil\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tvar data map[string]string\n\t\tif err := json.Unmarshal([]byte(in.Entry), &data); err != nil {\n\t\t\tlogrus.Warn(\"Fail to decode json format\")\n\t\t} else {\n\t\t\tfmt.Printf(\"%s: %s\\n\", data[\"source\"], data[\"msg\"])\n\t\t}\n\t}\n}", "title": "" }, { "docid": "86ec03b09b6cbeedeef54717460ea7cb", "score": "0.41598228", "text": "func (f *genericInformer) Informer() cache.SharedIndexInformer {\n\treturn f.informer\n}", "title": "" }, { "docid": "56d684f362cc4711c8302dfc193e5998", "score": "0.41586265", "text": "func GetJobPayload(options ...map[string]interface{}) map[string]interface{} {\n\topts := map[string]interface{}{}\n\tif len(options) == 1 {\n\t\topts = options[0]\n\t}\n\n\tfilters := getOpt(opts, \"filters\", map[string]interface{}{\"locale\": strings.Split(uuid.NewV4().String(), \"-\")[0]}).(map[string]interface{})\n\tcontext := getOpt(opts, \"context\", map[string]interface{}{\"value\": uuid.NewV4().String()}).(map[string]interface{})\n\tmetadata := getOpt(opts, \"filters\", map[string]interface{}{\"meta\": uuid.NewV4().String()}).(map[string]interface{})\n\n\tcontrolGroup := getOpt(opts, \"controlGroup\", 0.0).(float64)\n\tcontrolGroupCsvPath := getOpt(opts, \"controlGroupCsvPath\", \"\").(string)\n\tservice := getOpt(opts, \"service\", \"apns\").(string)\n\tcsvURL := getOpt(opts, \"csvPath\", \"\").(string)\n\texpiresAt := getOpt(opts, \"expiresAt\", time.Now().Add(time.Hour).UnixNano()).(int64)\n\tstartsAt := getOpt(opts, \"startsAt\", time.Now().Add(time.Hour).UnixNano()).(int64)\n\tid := getOpt(opts, \"id\", uuid.NewV4()).(uuid.UUID)\n\n\tjob := map[string]interface{}{\n\t\t\"filters\": filters,\n\t\t\"context\": context,\n\t\t\"metadata\": metadata,\n\t\t\"service\": service,\n\t\t\"csvPath\": csvURL,\n\t\t\"controlGroupCsvPath\": controlGroupCsvPath,\n\t\t\"controlGroup\": controlGroup,\n\t\t\"expiresAt\": expiresAt,\n\t\t\"startsAt\": startsAt,\n\t\t\"id\": id,\n\t}\n\treturn job\n}", "title": "" }, { "docid": "068bdd6ae8873166d02e9b32ced6ce11", "score": "0.4156973", "text": "func (f *metadataSharedInformerFactory) Start(stopCh <-chan struct{}) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tfor informerType, informer := range f.informers {\n\t\tif !f.startedInformers[informerType] {\n\t\t\tgo informer.Informer().Run(stopCh)\n\t\t\tf.startedInformers[informerType] = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "84c5b111777e8ca57e529c7a9ef498c4", "score": "0.41537538", "text": "func (l *defaultLog) Stream(stop chan bool) <-chan Record {\n\t// get stream channel from ring buffer\n\tstream := l.Buffer.Stream(stop)\n\t// make a buffered channel\n\trecords := make(chan Record, 128)\n\t// get last 10 records\n\tlast10 := l.Buffer.Get(10)\n\n\t// stream the log records\n\tgo func() {\n\t\t// first send last 10 records\n\t\tfor _, entry := range last10 {\n\t\t\trecords <- Record{\n\t\t\t\tTimestamp: entry.Timestamp,\n\t\t\t\tValue: entry.Value,\n\t\t\t\tMetadata: make(map[string]string),\n\t\t\t}\n\t\t}\n\t\t// now stream continuously\n\t\tfor entry := range stream {\n\t\t\trecords <- Record{\n\t\t\t\tTimestamp: entry.Timestamp,\n\t\t\t\tValue: entry.Value,\n\t\t\t\tMetadata: make(map[string]string),\n\t\t\t}\n\t\t}\n\t}()\n\n\treturn records\n}", "title": "" }, { "docid": "0e1942807843287171820b31e00c159c", "score": "0.4150939", "text": "func (v *version) MPIJobs() MPIJobInformer {\n\treturn &mPIJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "5519119848acdc9720ac6c558ee3d2be", "score": "0.41506314", "text": "func (v *version) SchedulerJobs() SchedulerJobInformer {\n\treturn &schedulerJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "472102a7b4bcedc3f734868ea1f1b527", "score": "0.41476712", "text": "func ReadJobs() Jobs {\n\tjobs := Jobs{\n\t\t{\n\t\t\tID: \"ghpm\",\n\t\t\tOwner: \"themue\",\n\t\t\tRepo: \"ghpm\",\n\t\t\tGitHubOptions: []github.Option{},\n\t\t\tInterval: 10 * time.Second,\n\t\t\tEventsAnalyzers: []analyze.EventsAnalyzer{\n\t\t\t\tanalyze.TypeCounter,\n\t\t\t},\n\t\t\tAccumulate: analyze.AccumulateKeys,\n\t\t}, {\n\t\t\tID: \"tideland-go\",\n\t\t\tOwner: \"tideland\",\n\t\t\tRepo: \"go\",\n\t\t\tGitHubOptions: []github.Option{},\n\t\t\tInterval: 10 * time.Second,\n\t\t\tEventsAnalyzers: []analyze.EventsAnalyzer{\n\t\t\t\tanalyze.CreateActorFilter(\"themue\"),\n\t\t\t\tanalyze.TypeCounter,\n\t\t\t},\n\t\t\tAccumulate: analyze.AccumulateKeys,\n\t\t}, {\n\t\t\tID: \"kubernetes\",\n\t\t\tOwner: \"kubernetes\",\n\t\t\tRepo: \"kubernetes\",\n\t\t\tGitHubOptions: []github.Option{},\n\t\t\tInterval: 10 * time.Second,\n\t\t\tEventsAnalyzers: []analyze.EventsAnalyzer{\n\t\t\t\tanalyze.TypeCounter,\n\t\t\t\tanalyze.PayloadsCollector,\n\t\t\t},\n\t\t\tAccumulate: analyze.AccumulateKeys,\n\t\t}, {\n\t\t\tID: \"kubeone\",\n\t\t\tOwner: \"kubermatic\",\n\t\t\tRepo: \"kubeone\",\n\t\t\tGitHubOptions: []github.Option{},\n\t\t\tInterval: 10 * time.Second,\n\t\t\tEventsAnalyzers: []analyze.EventsAnalyzer{\n\t\t\t\tanalyze.TypeCounter,\n\t\t\t\tanalyze.ActorCounter,\n\t\t\t\tanalyze.PayloadsCollector,\n\t\t\t},\n\t\t\tAccumulate: analyze.AccumulateKeys,\n\t\t},\n\t}\n\treturn jobs\n}", "title": "" }, { "docid": "d6beca2e110d02c42700508b81c4b66b", "score": "0.41404948", "text": "func GetInformer(c *gin.Context) {\n\tvar informers entity.Informer\n\tid := c.Param(\"id\")\n\tif err := entity.DB().Raw(\"SELECT * FROM informers WHERE id = ?\", id).Find(&informers).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": informers})\n}", "title": "" }, { "docid": "9bbe08955b136533c410817e8bbe3c49", "score": "0.41397238", "text": "func (v *version) SensuBackups() SensuBackupInformer {\n\treturn &sensuBackupInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "c5c876e0353aab0721ce375acb6c032b", "score": "0.41343626", "text": "func (m *CallRecord) GetSessions()([]Sessionable) {\n return m.sessions\n}", "title": "" }, { "docid": "a0fd8719a8027441a08313377e7fd7f1", "score": "0.41237766", "text": "func (v *version) SensuAssets() SensuAssetInformer {\n\treturn &sensuAssetInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "a5e0b61ab97c6974ee6253f886fdb09a", "score": "0.41030392", "text": "func (w *ForResource) GetInformers() []InformLister {\n\treturn w.informers\n}", "title": "" }, { "docid": "a944c5d0ef39a598a423310a1f3da73a", "score": "0.4102536", "text": "func (_JobsManager *JobsManagerCallerSession) Jobs(arg0 *big.Int) (struct {\n\tJobId *big.Int\n\tStreamId string\n\tTranscodingOptions string\n\tMaxPricePerSegment *big.Int\n\tBroadcasterAddress common.Address\n\tTranscoderAddress common.Address\n\tCreationRound *big.Int\n\tCreationBlock *big.Int\n\tEndBlock *big.Int\n\tEscrow *big.Int\n}, error) {\n\treturn _JobsManager.Contract.Jobs(&_JobsManager.CallOpts, arg0)\n}", "title": "" }, { "docid": "ccec92b0cd08940746c0d575cfb622f8", "score": "0.4092839", "text": "func (u Understanding) GetJobs(logger *zap.Logger) []jobs.Job {\n\tif len(u.Jobs) == 0 {\n\t\tsugar := logger.Sugar()\n\t\tsugar.Info(\"Jobs have not previously been found, finding jobs.\")\n\t\tu.findJobs(logger)\n\t}\n\treturn u.Jobs\n}", "title": "" }, { "docid": "c4ffff7ffc44711165f21ea609bca102", "score": "0.40876493", "text": "func (v *version) MetricAlertrules() MetricAlertruleInformer {\n\treturn &metricAlertruleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "df0c1119d4d5721c1d0947d291542f78", "score": "0.4081587", "text": "func (_JobsManager *JobsManagerSession) Jobs(arg0 *big.Int) (struct {\n\tJobId *big.Int\n\tStreamId string\n\tTranscodingOptions string\n\tMaxPricePerSegment *big.Int\n\tBroadcasterAddress common.Address\n\tTranscoderAddress common.Address\n\tCreationRound *big.Int\n\tCreationBlock *big.Int\n\tEndBlock *big.Int\n\tEscrow *big.Int\n}, error) {\n\treturn _JobsManager.Contract.Jobs(&_JobsManager.CallOpts, arg0)\n}", "title": "" }, { "docid": "c2d5085518c2536243e7f62eedd8731a", "score": "0.40637496", "text": "func Sink(in <-chan MediatorM) (result []string, err error) {\n\tfor in := range in {\n\t\tif in.Error != nil {\n\t\t\terr = in.Error\n\t\t\tcontinue // It's a mistake to stop here. The input channel must be fully exhausted!\n\t\t}\n\n\t\tresult = append(result, in.Data)\n\t}\n\treturn\n}", "title": "" }, { "docid": "9bf77854b370a194eefdb603de8f1eb2", "score": "0.4033618", "text": "func (p KinesisFirehosePlugin) FetchMetrics() (map[string]interface{}, error) {\n\tstats := make(map[string]interface{})\n\n\tfor _, met := range [...]metrics{\n\t\t{CloudWatchName: \"DeliveryToElasticsearch.Bytes\", MackerelName: \"DeliveryToElasticsearchBytes\"},\n\t\t{CloudWatchName: \"DeliveryToElasticsearch.Records\", MackerelName: \"DeliveryToElasticsearchRecords\"},\n\t\t{CloudWatchName: \"DeliveryToElasticsearch.Success\", MackerelName: \"DeliveryToElasticsearchSuccess\"},\n\t\t{CloudWatchName: \"DeliveryToRedshift.Bytes\", MackerelName: \"DeliveryToRedshiftBytes\"},\n\t\t{CloudWatchName: \"DeliveryToRedshift.Records\", MackerelName: \"DeliveryToRedshiftRecords\"},\n\t\t{CloudWatchName: \"DeliveryToRedshift.Success\", MackerelName: \"DeliveryToRedshiftSuccess\"},\n\t\t{CloudWatchName: \"DeliveryToS3.Bytes\", MackerelName: \"DeliveryToS3Bytes\"},\n\t\t{CloudWatchName: \"DeliveryToS3.DataFreshness\", MackerelName: \"DeliveryToS3DataFreshness\"},\n\t\t{CloudWatchName: \"DeliveryToS3.Records\", MackerelName: \"DeliveryToS3Records\"},\n\t\t{CloudWatchName: \"DeliveryToS3.Success\", MackerelName: \"DeliveryToS3Success\"},\n\t\t{CloudWatchName: \"IncomingBytes\", MackerelName: \"IncomingBytes\"},\n\t\t{CloudWatchName: \"IncomingRecords\", MackerelName: \"IncomingRecords\"},\n\t\t{CloudWatchName: \"DescribeDeliveryStream.Latency\", MackerelName: \"DescribeDeliveryStreamLatency\"},\n\t\t{CloudWatchName: \"DescribeDeliveryStream.Requests\", MackerelName: \"DescribeDeliveryStreamRequests\"},\n\t\t{CloudWatchName: \"PutRecord.Bytes\", MackerelName: \"PutRecordBytes\"},\n\t\t{CloudWatchName: \"PutRecord.Latency\", MackerelName: \"PutRecordLatency\"},\n\t\t{CloudWatchName: \"PutRecord.Requests\", MackerelName: \"PutRecordRequests\"},\n\t\t{CloudWatchName: \"PutRecordBatch.Bytes\", MackerelName: \"PutRecordBatchBytes\"},\n\t\t{CloudWatchName: \"PutRecordBatch.Latency\", MackerelName: \"PutRecordBatchLatency\"},\n\t\t{CloudWatchName: \"PutRecordBatch.Records\", MackerelName: \"PutRecordBatchRecords\"},\n\t\t{CloudWatchName: \"PutRecordBatch.Requests\", MackerelName: \"PutRecordBatchRequests\"},\n\t\t{CloudWatchName: \"UpdateDeliveryStream.Latency\", MackerelName: \"UpdateDeliveryStreamLatency\"},\n\t\t{CloudWatchName: \"UpdateDeliveryStream.Requests\", MackerelName: \"UpdateDeliveryStreamRequests\"},\n\t} {\n\t\tv, err := getLastPointFromCloudWatch(p.CloudWatch, p.Name, met)\n\t\tif err == nil {\n\t\t\tstats = mergeStatsFromDatapoint(stats, v, met)\n\t\t} else {\n\t\t\tlog.Printf(\"%s: %s\", met, err)\n\t\t}\n\t}\n\n\treturn stats, nil\n}", "title": "" }, { "docid": "9e90ac22cda3dc1b978b0c8bce777d28", "score": "0.40274274", "text": "func NewFakeLoggerEventStreamingClient() FakeLoggerEventStreamingClient {\n\treturn FakeLoggerEventStreamingClient{make(map[argsKey]result)}\n}", "title": "" }, { "docid": "723f3ab6e5bf4f4dbd5b6333a3e181f7", "score": "0.4026725", "text": "func (c *Client) Ingest(tts []prompb.TimeSeries, req *prompb.WriteRequest) (uint64, error) {\n\treturn c.ingestor.Ingest(tts, req)\n}", "title": "" }, { "docid": "729011507838836b017c5a3d18265a3d", "score": "0.40178028", "text": "func (m *UserExperienceAnalyticsBaseline) GetWorkFromAnywhereMetrics()(UserExperienceAnalyticsCategoryable) {\n val, err := m.GetBackingStore().Get(\"workFromAnywhereMetrics\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(UserExperienceAnalyticsCategoryable)\n }\n return nil\n}", "title": "" }, { "docid": "74dede59ce94f95908b48d354ec8685a", "score": "0.40164956", "text": "func StreamAlert() {\n\tfor {\n\t\trecord := <-alertEventQueue\n\t\tif record.Event == nil {\n\t\t\tcontinue\n\t\t}\n\t\thandle(record.Event)\n\t}\n}", "title": "" }, { "docid": "c2e09c28674d242a3646a6b8c5afb88c", "score": "0.40130207", "text": "func (v *version) TFJobs() TFJobInformer {\n\treturn &tFJobInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "e9b61fe22572370f1578c66b864ca530", "score": "0.40080312", "text": "func getGeneratorJobs(session *sessions.Session) map[string]*GeneratorJob {\n\treturn session.Values[consts.SessionGeneratorJob].(map[string]*GeneratorJob)\n}", "title": "" }, { "docid": "c9ceb6d409619d771495624973bdab11", "score": "0.39934346", "text": "func (c *RLPGatewayClient) Stream(ctx context.Context, req *loggregator_v2.EgressBatchRequest) EnvelopeStream {\n\tes := make(chan *loggregator_v2.Envelope, 100)\n\tgo func() {\n\t\tdefer close(es)\n\t\tfor ctx.Err() == nil {\n\t\t\tc.connect(ctx, es, req)\n\t\t}\n\t}()\n\n\treturn func() []*loggregator_v2.Envelope {\n\t\tvar batch []*loggregator_v2.Envelope\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\treturn nil\n\t\t\tcase e, ok := <-es:\n\t\t\t\tif !ok {\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tbatch = append(batch, e)\n\t\t\tdefault:\n\t\t\t\tif len(batch) > 0 {\n\t\t\t\t\treturn batch\n\t\t\t\t}\n\n\t\t\t\ttime.Sleep(50 * time.Millisecond)\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9a0370edaca8b23b2ab72a664659a5c3", "score": "0.39869577", "text": "func GetJob(ctx *pulumi.Context,\n\tname string, id pulumi.IDInput, state *JobState, opts ...pulumi.ResourceOption) (*Job, error) {\n\tvar resource Job\n\terr := ctx.ReadResource(\"azure:streamanalytics/job:Job\", name, id, state, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "54ec826cec7b41d65feac102b79d7a35", "score": "0.3985708", "text": "func (m *UserExperienceAnalyticsOverview) GetInsights()([]UserExperienceAnalyticsInsightable) {\n val, err := m.GetBackingStore().Get(\"insights\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]UserExperienceAnalyticsInsightable)\n }\n return nil\n}", "title": "" }, { "docid": "53ada3762b3ad3efceab03b42d619b61", "score": "0.3984426", "text": "func (v *version) Applications() ApplicationInformer {\n\treturn &applicationInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "b7d452a449b055be5668cdb27356bdf8", "score": "0.39793462", "text": "func (j *Job) JobInfos() []drmaa2interface.JobInfo {\n\tjis := make([]drmaa2interface.JobInfo, 0, len(j.tasklist))\n\tfor _, task := range j.tasklist {\n\t\tif task.job != nil {\n\t\t\tji, err := task.job.GetJobInfo()\n\t\t\tif err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tjis = append(jis, ji)\n\t\t}\n\t}\n\treturn jis\n}", "title": "" }, { "docid": "3d557ce7c5e05f03decbf111e4888c5a", "score": "0.39785066", "text": "func GetStreamerMetrics(tags map[string]string) *Streamer {\n\tc := GetGlobal()\n\treturn &Streamer{\n\t\tEvents: getEventsMetrics(\"streamer\", tags),\n\t\tTimeInBuffer: TimerInit(c.factory, \"time_in_buffer\", tags),\n\t}\n}", "title": "" }, { "docid": "e6358adbaa035a80ec71d2224e72d761", "score": "0.39777413", "text": "func (v *version) MetricsBackends() MetricsBackendInformer {\n\treturn &metricsBackendInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "ddeadee591a253e67ef46cdbce6b02cb", "score": "0.39767483", "text": "func StreamKitsuAnime() <-chan *kitsu.Anime {\n\tchannel := make(chan *kitsu.Anime, nano.ChannelBufferSize)\n\n\tgo func() {\n\t\tfor obj := range Kitsu.All(\"Anime\") {\n\t\t\tchannel <- obj.(*kitsu.Anime)\n\t\t}\n\n\t\tclose(channel)\n\t}()\n\n\treturn channel\n}", "title": "" }, { "docid": "6af54816ebda5fdcac7afbabc3559558", "score": "0.3975232", "text": "func (v *version) ApplicationInsightses() ApplicationInsightsInformer {\n\treturn &applicationInsightsInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "a902af583994a4a8149ac644bc99b205", "score": "0.39730984", "text": "func NewInformer(\n\tlw cache.ListerWatcher,\n\tobjType k8sRuntime.Object,\n\tresyncPeriod time.Duration,\n\th cache.ResourceEventHandler,\n\ttransformer cache.TransformFunc,\n) (cache.Store, cache.Controller) {\n\t// This will hold the client state, as we know it.\n\tclientState := cache.NewStore(cache.DeletionHandlingMetaNamespaceKeyFunc)\n\n\treturn clientState, NewInformerWithStore(lw, objType, resyncPeriod, h, transformer, clientState)\n}", "title": "" }, { "docid": "db7d60cb1479cfa8e2542ca065cbbc02", "score": "0.3968677", "text": "func (si *SharedInformers) StartAdditionalInformers(shutdown <-chan struct{}) {\n // Start specific Kubernetes API informers here. Note, it is only necessary\n // to start 1 informer for each Kind. (e.g. only 1 Deployment informer)\n\n // Uncomment this to start listening for Deployment Create / Update / Deletes\n // go si.KubernetesFactory.Apps().V1beta1().Deployments().Informer().Run(shutdown)\n}", "title": "" }, { "docid": "a4ec43fc7d36b877203145f73e2717f7", "score": "0.39612526", "text": "func (m *DeviceManagement) GetReports()(DeviceManagementReportsable) {\n return m.reports\n}", "title": "" }, { "docid": "65563a10dcb6f99d17956c65b1c01198", "score": "0.39515626", "text": "func NewJobComsumer(offsets map[int32]int64, jobs chan models.Job) error {\n\tbrokers := viper.GetStringSlice(\"kafka.brokers\")\n\n\tconfig := kafka.NewConfig()\n\tconfig.ClientID = \"metronome-scheduler\"\n\n\tclient, err := sarama.NewClient(brokers, config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconsumer, err := sarama.NewConsumerFromClient(client)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tparts, err := client.Partitions(kafka.TopicJobs())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thwm := make(map[int32]int64)\n\tfor p := range parts {\n\t\ti, err := client.GetOffset(kafka.TopicJobs(), int32(p), sarama.OffsetNewest)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\thwm[int32(p)] = i\n\t}\n\n\tgo func() {\n\t\tfor part, offset := range offsets {\n\t\t\tif (offset + 1) >= hwm[part] {\n\t\t\t\t// already to the end\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tpc, err := consumer.ConsumePartition(kafka.TopicJobs(), part, offset)\n\t\t\tif err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\tconsume:\n\t\t\tfor {\n\t\t\t\tselect {\n\t\t\t\tcase msg := <-pc.Messages():\n\t\t\t\t\tvar j models.Job\n\t\t\t\t\tif err := j.FromKafka(msg); err != nil {\n\t\t\t\t\t\tlog.WithError(err).Warn(\"Could not retrieve the job from kafka message\")\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tbody, err := j.ToJSON()\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tlog.WithError(err).Warn(\"Could not deserialize the job\")\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tlog.Debugf(\"Job received: %s\", string(body))\n\t\t\t\t\tjobs <- j\n\n\t\t\t\t\tif (msg.Offset + 1) >= hwm[part] {\n\t\t\t\t\t\tbreak consume\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif err := pc.Close(); err != nil {\n\t\t\t\tlog.Error(err)\n\t\t\t}\n\t\t}\n\n\t\tclose(jobs)\n\t}()\n\n\treturn nil\n}", "title": "" }, { "docid": "86e20c8c451fd7904192970b1e88cf23", "score": "0.3947221", "text": "func (z *Slack) Instrument() (interface{}, error) {\n\n\tvar (\n\t\text Extrusion\n\t\terr error\n\t)\n\n\tz.Debug(\"Instrumenting\")\n\ta := action.Action{Target: z.Target}\n\n\t// Set session Cookies\n\tc := &cookie.Cookie{Action: a}\n\tif err = c.SetSessionCookies(); err != nil {\n\t\tlog.Error(\"Error setting session cookies: %v\", err)\n\t\treturn nil, err\n\t}\n\n\tvar html string\n\td := &dom.DOM{\n\t\tAction: a,\n\t\tURL: z.URL,\n\t\tSelector: `#messages_container > div.p-history_container.message_pane_scroller > div > div:nth-child(2) > div > div.c-virtual_list.c-virtual_list--scrollbar.c-message_list.c-scrollbar.c-scrollbar--fade`,\n\t}\n\tif err = d.DumpSelector(&html); err != nil {\n\t\tlog.Error(\"Error retrieving DOM elements: %v\", err)\n\t\treturn nil, err\n\t}\n\n\text.Messages = base64.StdEncoding.EncodeToString([]byte(html))\n\tlog.Info(\"Messages page: \\n%s\", html)\n\n\treturn ext, nil\n}", "title": "" }, { "docid": "61ec2e4626c805893b6f705526d3909c", "score": "0.39464414", "text": "func (j *jivaStor) Informer() (volume.Informer, bool) {\n\treturn j, true\n}", "title": "" }, { "docid": "772501c9650249567e59412e5ee11e5d", "score": "0.39448974", "text": "func (f *JobFirehose) Publish(update *nomad.Job) {\n\tb, err := json.Marshal(update)\n\tif err != nil {\n\t\tlog.Error(err)\n\t}\n\n\tf.sink.Put(b)\n}", "title": "" }, { "docid": "ce3cf42ac293b582a3a084b091fff29c", "score": "0.39390147", "text": "func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tfor informerType, informer := range f.informers {\n\t\tif !f.startedInformers[informerType] {\n\t\t\tgo informer.Informer().Run(stopCh)\n\t\t\tf.startedInformers[informerType] = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "ea7f96feb97e8048392d18587135c8d7", "score": "0.39315617", "text": "func NewIcecreamInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {\n\treturn NewFilteredIcecreamInformer(client, namespace, resyncPeriod, indexers, nil)\n}", "title": "" }, { "docid": "4477fa220d7c4877c34aead139c99065", "score": "0.39235994", "text": "func (cs *ConfigMapSyncer) getInformer() cache.SharedIndexInformer {\n\treturn cs.Informer\n}", "title": "" }, { "docid": "e9a85baae5f781b52fd6c2af7d12a4e1", "score": "0.39206734", "text": "func NewInformer(\n\tlw ListerWatcher,\n\tobjType runtime.Object,\n\tresyncPeriod time.Duration,\n\th ResourceEventHandler,\n) (Store, Controller) {\n\t// This will hold the client state, as we know it.\n\tclientState := NewStore(DeletionHandlingMetaNamespaceKeyFunc)\n\n\t// This will hold incoming changes. Note how we pass clientState in as a\n\t// KeyLister, that way resync operations will result in the correct set\n\t// of update/delete deltas.\n\tfifo := NewDeltaFIFO(MetaNamespaceKeyFunc, nil, clientState)\n\n\tcfg := &Config{\n\t\tQueue: fifo,\n\t\tListerWatcher: lw,\n\t\tObjectType: objType,\n\t\tFullResyncPeriod: resyncPeriod,\n\t\tRetryOnError: false,\n\n\t\tProcess: func(obj interface{}) error {\n\t\t\t// from oldest to newest\n\t\t\tfor _, d := range obj.(Deltas) {\n\t\t\t\tswitch d.Type {\n\t\t\t\tcase Sync, Added, Updated:\n\t\t\t\t\tif old, exists, err := clientState.Get(d.Object); err == nil && exists {\n\t\t\t\t\t\tif err := clientState.Update(d.Object); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\th.OnUpdate(old, d.Object)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif err := clientState.Add(d.Object); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\th.OnAdd(d.Object)\n\t\t\t\t\t}\n\t\t\t\tcase Deleted:\n\t\t\t\t\tif err := clientState.Delete(d.Object); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\th.OnDelete(d.Object)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\treturn clientState, New(cfg)\n}", "title": "" }, { "docid": "3470ebae3b6de2da6975f646d36fab06", "score": "0.39205927", "text": "func (c *consul) Informer() chan struct{} {\n\treturn c.informer\n}", "title": "" }, { "docid": "1555896ec5cac4d65f0ed9ff9935285c", "score": "0.39193904", "text": "func (v *version) NotificationHubNamespace_s() NotificationHubNamespace_Informer {\n\treturn &notificationHubNamespace_Informer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "ba0076a6f717ac884b079ad09a88e766", "score": "0.39191663", "text": "func (adapter *Adapter) Stream(logstream chan *router.Message) {\n for m := range logstream {\n if m.Data == \"\" {\n continue\n }\n\n attributes := Attributes{\n Container: ContainerInfo{\n Name: strings.Trim(m.Container.Name, \"/\"),\n ID: m.Container.ID,\n Config: ContainerConfig{\n Image: m.Container.Config.Image,\n Hostname: m.Container.Config.Hostname,\n Labels: m.Container.Config.Labels,\n },\n },\n Source: m.Source,\n Hostname: adapter.getHost(m.Container.Config.Hostname),\n }\n\n adapter.Queue <- Line{\n Message: m.Data,\n Timestamp: time.Now().Unix(),\n Attributes: attributes,\n }\n }\n}", "title": "" }, { "docid": "7545e47fec2ae18afad010b7ce32a57f", "score": "0.3916059", "text": "func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {\n\tf.lock.Lock()\n\tdefer f.lock.Unlock()\n\n\tfor informerType, informer := range f.informers {\n\t\tif !f.startedInformers[informerType] {\n\t\t\tgo informer.Run(stopCh)\n\t\t\tf.startedInformers[informerType] = true\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9f7848c6ada6c867c9d7f698c8149486", "score": "0.39125612", "text": "func New(jobsession string) *JobTracker {\n\tps, _ := NewPubSub()\n\ttracker := JobTracker{\n\t\tjobsession: jobsession,\n\t\tjs: NewJobStore(),\n\t\tshutdown: false,\n\t\tps: ps,\n\t}\n\ttracker.ps.StartBookKeeper()\n\treturn &tracker\n}", "title": "" }, { "docid": "09955f66bceb666e97dc158a8e218ae8", "score": "0.3911325", "text": "func (b *Base) GetStream() (Events, error) {\n\tif b == nil {\n\t\treturn nil, fmt.Errorf(\"%w Base\", gctcommon.ErrNilPointer)\n\t}\n\tb.m.Lock()\n\tdefer b.m.Unlock()\n\tstream := make([]Event, len(b.stream))\n\tcopy(stream, b.stream)\n\n\treturn stream, nil\n}", "title": "" }, { "docid": "b2d85c6c09a2d2a150efe99ffdefa456", "score": "0.39052624", "text": "func NewInformer(client cluster.Client, optionList ...Option) *MemoryStoreInformer {\n\topts := currentOptions(optionList...)\n\n\tmaxWorkers := runtime.GOMAXPROCS(0)\n\n\ti := MemoryStoreInformer{\n\t\tclient: client,\n\t\tsynced: map[schema.GroupVersionResource]bool{},\n\t\tapiWatches: map[schema.GroupVersionResource]cluster.Watch{},\n\t\twatchDescriptors: map[schema.GroupVersionResource]watchDescriptor{},\n\t\tstore: opts.store,\n\t\tlogger: opts.logger.WithValues(\"component\", \"MemoryStoreInformer\"),\n\t\tsem: semaphore.NewWeighted(int64(maxWorkers)),\n\t}\n\n\tif i.store == nil {\n\t\ti.store = NewMemoryStore(WithLogger(opts.logger))\n\t}\n\n\treturn &i\n}", "title": "" }, { "docid": "a114d3560e1981104968a3fcb1dd4801", "score": "0.38987744", "text": "func (v *version) MonitorMetricAlertrules() MonitorMetricAlertruleInformer {\n\treturn &monitorMetricAlertruleInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "6d1625f37b0a8e94c0085b0c71192653", "score": "0.389872", "text": "func (t *Twitch) GetGameAnalytics(\n\tgameID string,\n\tstartDate *helix.Time,\n\tendedDate *helix.Time,\n\tlimit int,\n\tbookmark string,\n) (\n\tdata helix.ManyGameAnalytics,\n\tcursor string,\n\terr error,\n) {\n\tpayload := &helix.GameAnalyticsParams{\n\t\tGameID: t.ClientId,\n\t\tFirst: limit,\n\t\tType: \"overview_v2\",\n\t}\n\n\tif bookmark != \"\" {\n\t\tpayload.After = bookmark\n\t}\n\n\tif startDate != nil && endedDate != nil {\n\t\tpayload.StartedAt = *startDate\n\t\tpayload.EndedAt = *endedDate\n\t}\n\n\tresp, err := t.helix.GetGameAnalytics(payload)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tif resp.Error != \"\" {\n\t\terr = fmt.Errorf(\n\t\t\t\"err:%s msg:%s status:%d\",\n\t\t\tresp.Error,\n\t\t\tresp.ErrorMessage,\n\t\t\tresp.StatusCode,\n\t\t)\n\t\treturn\n\t}\n\n\tcursor = resp.Data.Pagination.Cursor\n\tdata = resp.Data\n\n\treturn\n}", "title": "" }, { "docid": "cd214b3613abcf0b91c18c971ec527ec", "score": "0.3887237", "text": "func NewInformerWithStore(\n\tlw cache.ListerWatcher,\n\tobjType k8sRuntime.Object,\n\tresyncPeriod time.Duration,\n\th cache.ResourceEventHandler,\n\ttransformer cache.TransformFunc,\n\tclientState cache.Store,\n) cache.Controller {\n\n\t// This will hold incoming changes. Note how we pass clientState in as a\n\t// KeyLister, that way resync operations will result in the correct set\n\t// of update/delete deltas.\n\topts := cache.DeltaFIFOOptions{KeyFunction: cache.MetaNamespaceKeyFunc, KnownObjects: clientState}\n\tfifo := cache.NewDeltaFIFOWithOptions(opts)\n\n\tcacheMutationDetector := cache.NewCacheMutationDetector(fmt.Sprintf(\"%T\", objType))\n\n\tcfg := &cache.Config{\n\t\tQueue: fifo,\n\t\tListerWatcher: lw,\n\t\tObjectType: objType,\n\t\tFullResyncPeriod: resyncPeriod,\n\t\tRetryOnError: false,\n\n\t\tProcess: func(obj interface{}, isInInitialList bool) error {\n\t\t\t// from oldest to newest\n\t\t\tfor _, d := range obj.(cache.Deltas) {\n\n\t\t\t\tvar obj interface{}\n\t\t\t\tif transformer != nil {\n\t\t\t\t\tvar err error\n\t\t\t\t\tif obj, err = transformer(d.Object); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tobj = d.Object\n\t\t\t\t}\n\n\t\t\t\t// In CI we detect if the objects were modified and panic\n\t\t\t\t// this is a no-op in production environments.\n\t\t\t\tcacheMutationDetector.AddObject(obj)\n\n\t\t\t\tswitch d.Type {\n\t\t\t\tcase cache.Sync, cache.Added, cache.Updated:\n\t\t\t\t\tif old, exists, err := clientState.Get(obj); err == nil && exists {\n\t\t\t\t\t\tif err := clientState.Update(obj); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\th.OnUpdate(old, obj)\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif err := clientState.Add(obj); err != nil {\n\t\t\t\t\t\t\treturn err\n\t\t\t\t\t\t}\n\t\t\t\t\t\th.OnAdd(obj, isInInitialList)\n\t\t\t\t\t}\n\t\t\t\tcase cache.Deleted:\n\t\t\t\t\tif err := clientState.Delete(obj); err != nil {\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t\th.OnDelete(obj)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn nil\n\t\t},\n\t}\n\treturn cache.New(cfg)\n}", "title": "" }, { "docid": "ffbc3bde6594034df5f567c77cd95542", "score": "0.38838103", "text": "func (manager *jobManager) GetJobs() []*Job {\n\treturn nil\n}", "title": "" }, { "docid": "b51ae3775e300c4c23a00d2f80ae2c2c", "score": "0.3883679", "text": "func jobWatcher() {\n\tmethod := \"jobWatcher\"\n\n\tlabelsStr := fmt.Sprintf(\"system/jobType=%s\", \"devflows\")\n\n\tlabelsSel, err := labels.Parse(labelsStr)\n\tif err != nil {\n\t\tglog.Errorf(\"%s label parse failed==>:%v\\n\", method, err)\n\t\treturn\n\t}\n\n\tlistOptions := metav1.ListOptions{\n\t\tLabelSelector: labelsSel.String(),\n\t\tWatch: true,\n\t}\n\n\twatchInterface, err := models.NewImageBuilder().Client.BatchV1Client.Jobs(\"\").Watch(listOptions)\n\tif err != nil {\n\t\tglog.Errorf(\"%s,err: %v\\n\", method, err)\n\t\treturn\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase event, isOpen := <-watchInterface.ResultChan():\n\t\t\tif isOpen == false {\n\t\t\t\tglog.Errorf(\"%s the watch job chain is close\\n\", method)\n\t\t\t\tjobWatcher()\n\t\t\t}\n\t\t\tdm, parseIsOk := event.Object.(*v1beta1.Job)\n\t\t\tif false == parseIsOk {\n\t\t\t\tglog.Errorf(\"%s job %s\\n\", method, \">>>>>>断言失败<<<<<<\")\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tglog.Infof(\"%s job event.Type=%s, namespace=%s ,jobName=%s\\n\", method, event.Type, dm.GetNamespace(),\n\t\t\t\tdm.GetName())\n\t\t\tglog.Infof(\"%s job event.Status=%#v\\n\", method, dm.Status)\n\t\t\tif event.Type == watch.Added {\n\t\t\t\t//收到deleted事件,job可能被第三方删除\n\t\t\t\tglog.Infof(\"%s %s,status:%v\\n\", method, \"收到ADD事件,开始起job进行构建\", dm.Status)\n\t\t\t\tGetEnnFlow(dm, common.STATUS_BUILDING)\n\t\t\t\tcontinue\n\t\t\t} else if event.Type == watch.Deleted {\n\t\t\t\t//收到deleted事件,job可能被第三方删除\n\t\t\t\tglog.Errorf(\"%s %s status:%v\\n\", method, \" 收到deleted事件,job可能被第三方删除\", dm.Status)\n\t\t\t\tcontinue\n\t\t\t\t//成功时并且已经完成时\n\t\t\t} else if dm.Status.Succeeded >= 1 &&\n\t\t\t\tdm.Status.CompletionTime != nil && len(dm.Status.Conditions) != 0 {\n\t\t\t\tglog.Infof(\"%s %s,status:%v\\n\", method, \"构建成功\", dm.Status)\n\t\t\t\tGetEnnFlow(dm, common.STATUS_SUCCESS)\n\t\t\t\tcontinue\n\t\t\t\t//} else if dm.Status.Failed >=1 && dm.Spec.Completions == Int32Toint32Point(1) &&\n\t\t\t\t//\tdm.Status.CompletionTime == nil && dm.Status.Succeeded==0{\n\t\t\t} else if dm.Status.Failed >= 1 {\n\t\t\t\tglog.Infof(\"%s %s,status:%v\\n\", method, \"构建失败\", dm.GetName())\n\t\t\t\tGetEnnFlow(dm, common.STATUS_FAILED)\n\t\t\t\tcontinue\n\t\t\t\t//手动停止job\n\t\t\t} else if dm.Spec.Parallelism == Int32Toint32Point(0) {\n\t\t\t\t//有依赖服务,停止job时 不是手动停止 1 表示手动停止\n\t\t\t\tif dm.ObjectMeta.Labels[\"enncloud-builder-succeed\"] != \"1\" && dm.ObjectMeta.Labels[common.MANUAL_STOP_LABEL] == \"true\" {\n\t\t\t\t\tglog.Infof(\"%s %s,status:%v\\n\", method, \"用户停止了构建任务\", dm)\n\t\t\t\t\tGetEnnFlow(dm, common.STATUS_FAILED)\n\t\t\t\t\tcontinue\n\t\t\t\t\t//没有依赖服务时\n\t\t\t\t} else {\n\t\t\t\t\tGetEnnFlow(dm, common.STATUS_FAILED)\n\t\t\t\t\tglog.Infof(\"%s %s,status:%v\\n\", method, \"job执行失败程序发送了停止构建任务的命令\", dm)\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t}\n\n}", "title": "" }, { "docid": "3b0c0d5ece1fef198ad737073df8a6e1", "score": "0.38821915", "text": "func (accessor *JobReportAccessor) GetByJobID(id uint) ([]*JobReport, error) {\n\tvar reports []*JobReport\n\terr := accessor.DB.Where(\"job_id = ?\", id).Find(&reports).Error\n\treturn reports, err\n}", "title": "" }, { "docid": "7b5fbe95b9e6a6603a35096d2445fd95", "score": "0.38796908", "text": "func (h *inMemoryCappedContainer) Stream() <-chan interface{} {\n\tstream := make(chan interface{})\n\tgo func() {\n\t\th.lock.RLock()\n\t\tdefer h.lock.RUnlock()\n\t\tfor e := h.list.Front(); e != nil; e = e.Next() {\n\t\t\tstream <- e.Value\n\t\t}\n\t\tclose(stream)\n\t}()\n\treturn stream\n}", "title": "" }, { "docid": "aa56dcc96177b14806c1ff4b792329e9", "score": "0.3874154", "text": "func NewStream(client *redis.Client) (ev EventStream) {\n\tev.Client = client\n\tev.Requests = make(chan string)\n\tev.subscribers = make(map[string][]chan Event)\n\treturn\n}", "title": "" }, { "docid": "906e22e688f470ebf634ed12efd8c476", "score": "0.38717866", "text": "func (v *version) EventhubNamespace_s() EventhubNamespace_Informer {\n\treturn &eventhubNamespace_Informer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "f09dea53a2cf927eed85fce3b8bf7b84", "score": "0.3864406", "text": "func (o JobOutput) StreamAnalyticsClusterId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *Job) pulumi.StringPtrOutput { return v.StreamAnalyticsClusterId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "0dc7a0cf25dd04ca7bd05fa0804e733b", "score": "0.38530976", "text": "func (c *client) JobsWatch(ns string) (watch.Interface, error) {\n\treturn c.cli.BatchV1().Jobs(ns).Watch(metav1.ListOptions{\n\t\tTimeoutSeconds: &c.opt.TimeoutSeconds,\n\t})\n}", "title": "" }, { "docid": "2223ea5a0da69a14823b0c5527878c5e", "score": "0.38504675", "text": "func (inf *MemoryStoreInformer) Stop() error {\n\tinf.mu.Lock()\n\tdefer inf.mu.Unlock()\n\n\tinf.logger.Info(\"stopping\")\n\n\tfor k := range inf.synced {\n\t\tdelete(inf.synced, k)\n\t}\n\n\tfor k, w := range inf.apiWatches {\n\t\tw.Stop()\n\t\tdelete(inf.synced, k)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "fdb7842f342efe6d2a19ea4fb99d0fa3", "score": "0.38433477", "text": "func ListInformer(c *gin.Context) {\n\tvar informers []entity.Informer\n\tif err := entity.DB().Raw(\"SELECT * FROM informers\").Scan(&informers).Error; err != nil {\n\t\tc.JSON(http.StatusBadRequest, gin.H{\"error\": err.Error()})\n\t\treturn\n\t}\n\n\tc.JSON(http.StatusOK, gin.H{\"data\": informers})\n}", "title": "" }, { "docid": "7e69ae7e0ccecec5749448696f2d7dfd", "score": "0.38303116", "text": "func (a TwitterApi) GetActivityWebhooks(v url.Values) (u []WebHookResp, err error) {\n\tv = cleanValues(v)\n\tresponseCh := make(chan response)\n\ta.queryQueue <- query{a.activityUrl + \"webhooks.json\", v, &u, _GET, responseCh}\n\treturn u, (<-responseCh).err\n}", "title": "" }, { "docid": "be88b511d2d4edabb4e12b1b6f38d805", "score": "0.38268766", "text": "func (ri *ResourceInformer) Informer() SharedIndexInformer {\n\treturn ri.informerWrapper\n}", "title": "" }, { "docid": "4d27a97c8ce5751ec3fdf91f85269c26", "score": "0.38262156", "text": "func (adapter *FluentdAdapter) Stream(logstream chan *router.Message) {\n\tfor message := range logstream {\n\t\ttimestamp := getTimestampMicroecond()\n\t\ttag := getInfraTag(message)\n\t\tif len(tag) == 0 {\n\t\t\tcontinue\n\t\t}\n\n\t\trecord := Record{}\n\t\trecord.Message = message.Data\n\t\trecord.Host, _ = os.Hostname()\n\t\trecord.ContainerID = message.Container.ID\n\t\trecord.ContainerName = message.Container.Name\n\n\t\tdata := []interface{}{tag, timestamp, record}\n\n\t\tjson, err := json.Marshal(data)\n\t\tif err != nil {\n\t\t\tlog.Println(\"fluentd-adapter: \", err)\n\t\t\tcontinue\n\t\t}\n\n\t\t_, err = adapter.conn.Write(json)\n\t\tif err != nil {\n\t\t\terr = adapter.retry(json, err)\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(\"fluentd-adapter: \", err)\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t}\n}", "title": "" }, { "docid": "b8d0a8db15eb01dd28101de9d62aef62", "score": "0.38262057", "text": "func (s *streamAnalyticsReferenceInputBlobLister) StreamAnalyticsReferenceInputBlobs(namespace string) StreamAnalyticsReferenceInputBlobNamespaceLister {\n\treturn streamAnalyticsReferenceInputBlobNamespaceLister{indexer: s.indexer, namespace: namespace}\n}", "title": "" }, { "docid": "e515b521c70e17b30c1f8458dcd5a877", "score": "0.38205957", "text": "func (o *V0037DiagStatistics) GetJobsStarted() int32 {\n\tif o == nil || o.JobsStarted == nil {\n\t\tvar ret int32\n\t\treturn ret\n\t}\n\treturn *o.JobsStarted\n}", "title": "" }, { "docid": "cde7b1108cbf4880ee8831ce37adf9a4", "score": "0.38171545", "text": "func (w *ForResource) Start(stopCh <-chan struct{}) {\n\tfor _, i := range w.informers {\n\t\tgo i.Informer().Run(stopCh)\n\t}\n}", "title": "" }, { "docid": "91d3f1d4db5aa18b9b6e69c2f51216b0", "score": "0.3814165", "text": "func (v *version) Eventhubs() EventhubInformer {\n\treturn &eventhubInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}\n}", "title": "" }, { "docid": "ba74faf844d8c8b25bf5580a24147d70", "score": "0.3808942", "text": "func (f *Client) GetEventInfo(ctx context.Context, ids []string) ([]json.RawMessage, error) {\n\tlogger := log.FromContext(ctx)\n\n\tconst fields = `attending_count,can_guests_invite,can_viewer_post,category,cover,declined_count,description,end_time,guest_list_enabled,interested_count,is_canceled,is_draft,is_page_owned,is_viewer_admin,id,maybe_count,name,noreply_count,owner,parent_group,place,start_time,ticket_uri,timezone,type,updated_time`\n\n\treqs := make([]map[string]string, len(ids))\n\tfor i, id := range ids {\n\t\treqs[i] = map[string]string{\n\t\t\t\"method\": \"GET\",\n\t\t\t\"relative_url\": fmt.Sprintf(\"%s/%s?fields=%s\", apiVersion, id, fields),\n\t\t}\n\t}\n\treq := map[string]interface{}{\"batch\": reqs}\n\n\tbatchBody := bytes.NewBuffer(nil)\n\tif err := json.NewEncoder(batchBody).Encode(req); err != nil {\n\t\treturn nil, err\n\t}\n\n\tresp, err := f.HTTP.Post(\"https://graph.facebook.com\", \"application/json\", batchBody)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer resp.Body.Close()\n\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, parseError(resp.Body)\n\t}\n\n\tvar responses []BatchResponse\n\tif err := json.NewDecoder(resp.Body).Decode(&responses); err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar events []json.RawMessage\n\tfor i, r := range responses {\n\t\tif r.Code != http.StatusOK {\n\t\t\tfbErr := parseError(strings.NewReader(r.Body))\n\n\t\t\t// TODO(maxhawkins): ignore deleted event response\n\t\t\tlogger.Error(\"bad event fetch response\",\n\t\t\t\tzap.String(\"eventID\", ids[i]),\n\t\t\t\tzap.Int(\"code\", fbErr.Code),\n\t\t\t\tzap.Int(\"subcode\", fbErr.Subcode),\n\t\t\t\tzap.String(\"error\", fbErr.Message),\n\t\t\t\tzap.String(\"errorType\", fbErr.Type))\n\n\t\t\treturn events, fbErr\n\t\t}\n\t\tevents = append(events, json.RawMessage(r.Body))\n\t}\n\n\treturn events, nil\n}", "title": "" }, { "docid": "9af289a42c03fdb25d99e4997ec86c64", "score": "0.38070765", "text": "func (_JobsManager *JobsManagerSession) GetJob(_jobId *big.Int) (struct {\n\tStreamId string\n\tTranscodingOptions string\n\tMaxPricePerSegment *big.Int\n\tBroadcasterAddress common.Address\n\tTranscoderAddress common.Address\n\tCreationRound *big.Int\n\tCreationBlock *big.Int\n\tEndBlock *big.Int\n\tEscrow *big.Int\n\tTotalClaims *big.Int\n}, error) {\n\treturn _JobsManager.Contract.GetJob(&_JobsManager.CallOpts, _jobId)\n}", "title": "" }, { "docid": "3cff491b9adcfbaf8bcfb42205fc9f97", "score": "0.38069317", "text": "func (h *Handler) InformerFactory() dynamicinformer.DynamicSharedInformerFactory {\n\treturn h.informerFactory\n}", "title": "" }, { "docid": "5b2ff39af8a0ade64bc160271430f995", "score": "0.3805817", "text": "func (c *ApiService) StreamBrandRegistrations(params *ListBrandRegistrationsParams) (chan MessagingV1BrandRegistrations, chan error) {\n\tif params == nil {\n\t\tparams = &ListBrandRegistrationsParams{}\n\t}\n\tparams.SetPageSize(client.ReadLimits(params.PageSize, params.Limit))\n\n\trecordChannel := make(chan MessagingV1BrandRegistrations, 1)\n\terrorChannel := make(chan error, 1)\n\n\tresponse, err := c.PageBrandRegistrations(params, \"\", \"\")\n\tif err != nil {\n\t\terrorChannel <- err\n\t\tclose(recordChannel)\n\t\tclose(errorChannel)\n\t} else {\n\t\tgo c.streamBrandRegistrations(response, params, recordChannel, errorChannel)\n\t}\n\n\treturn recordChannel, errorChannel\n}", "title": "" } ]
43c61684c1b06a6e16dfe03d006636e5
SetConvertDotsInJsonKeysToUnderscores sets the ConvertDotsInJsonKeysToUnderscores field's value.
[ { "docid": "0c01d87395c1c68d69b666201310fe8d", "score": "0.83156556", "text": "func (s *OpenXJsonSerDe) SetConvertDotsInJsonKeysToUnderscores(v bool) *OpenXJsonSerDe {\n\ts.ConvertDotsInJsonKeysToUnderscores = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "195c9b13a4185c74b2420c029b501fa6", "score": "0.52970475", "text": "func normalizeKey(key string) string {\n\tkey = strings.ReplaceAll(key, \" \", \"\")\n\tkey = strings.ReplaceAll(key, \"-\", \"\")\n\tkey = strings.ReplaceAll(key, \"_\", \"\")\n\tkey = strings.ToLower(key)\n\n\treturn key\n}", "title": "" }, { "docid": "3268ac12f4cbcffbac6b482780c510d9", "score": "0.5206307", "text": "func hyphensToUnderscores(s string) string {\n\treturn strings.Replace(s, \"-\", \"_\", -1)\n}", "title": "" }, { "docid": "02e7d41feaf72c87deea694a8ade6d52", "score": "0.5037813", "text": "func Underscore(s string) string {\n\tr := regexp.MustCompile(\"[A-Z]\")\n\tmatches := r.FindAllString(s, -1)\n\tfor idx, w := range matches {\n\t\tif idx == 0 {\n\t\t\ts = strings.Replace(s, w, strings.ToLower(w), 1)\n\t\t\tcontinue\n\t\t}\n\t\ts = strings.Replace(s, w, \"_\"+strings.ToLower(w), 1)\n\t}\n\ts = strings.Replace(s, \"::\", \"/\", -1)\n\ts = strings.Replace(s, \"/_\", \"/\", -1)\n\treturn s\n}", "title": "" }, { "docid": "3d9646210ada97f01cbec77a42516041", "score": "0.4907778", "text": "func normalizeFieldName(s string) string {\n\t// remove all spaces\n\tr := strings.ReplaceAll(s, \" \", \"\")\n\t// replace -\n\treturn strings.ReplaceAll(r, \"-\", \"_\")\n}", "title": "" }, { "docid": "76257ff6d8b272c93aea9b81a22919c6", "score": "0.48459473", "text": "func JSONCamelCase(s string) string {\n\tvar b []byte\n\tvar wasUnderscore bool\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif c != '_' {\n\t\t\tif wasUnderscore && isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\t\t}\n\t\twasUnderscore = c == '_'\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "76257ff6d8b272c93aea9b81a22919c6", "score": "0.48459473", "text": "func JSONCamelCase(s string) string {\n\tvar b []byte\n\tvar wasUnderscore bool\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif c != '_' {\n\t\t\tif wasUnderscore && isASCIILower(c) {\n\t\t\t\tc -= 'a' - 'A' // convert to uppercase\n\t\t\t}\n\t\t\tb = append(b, c)\n\t\t}\n\t\twasUnderscore = c == '_'\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "2c70c657cb4356f443055e6d673ae95c", "score": "0.48414508", "text": "func substitute_proxy_names(records [][]string) [][]string {\n\tfor k1, v1 := range records {\n\t\tfor k2, v2 := range v1 {\n\t\t\trecords[k1][k2] = strings.Replace(v2, \".\", \"_\", -1)\n\t\t}\n\t}\n\treturn records\n}", "title": "" }, { "docid": "c276c154cf5e2b4f4a18071581b02acb", "score": "0.48223713", "text": "func ReplaceDotsToDollarsInAttributes(attributes *map[string]string) {\n\tfor k, v := range *attributes { \n\t\tnewK := strings.Replace(k, \".\", \"$\", -1)\n\t\t(*attributes)[newK] = v\n\t\tdelete(*attributes, k)\n\t}\n}", "title": "" }, { "docid": "de5a997da7bd91e5d411c50b9a6cdc72", "score": "0.47789866", "text": "func CamelCaseToUnderscore(str string) string {\r\n\tvar result string\r\n\tfor idx, ch := range str {\r\n\t\t// first letter will just be lowered\r\n\t\tif idx == 0 {\r\n\t\t\tresult = string(unicode.ToLower(ch))\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\t// anywhere else\r\n\t\tif unicode.IsUpper(ch) {\r\n\t\t\tresult = result + \"_\" + string(unicode.ToLower(ch))\r\n\t\t\tcontinue\r\n\t\t}\r\n\r\n\t\t// nothing to see here, just accept it\r\n\t\tresult += string(ch)\r\n\t}\r\n\r\n\treturn result\r\n}", "title": "" }, { "docid": "0fc05d613e8e01e2f3e3abc7d6df881b", "score": "0.4771128", "text": "func JSONSnakeCase(s string) string {\n\tvar b []byte\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif isASCIIUpper(c) {\n\t\t\tb = append(b, '_')\n\t\t\tc += 'a' - 'A' // convert to lowercase\n\t\t}\n\t\tb = append(b, c)\n\t}\n\treturn string(b)\n}", "title": "" }, { "docid": "46bc41a07e5d726e1c665a02cb8deeb3", "score": "0.47645", "text": "func AppendDotFlatMapKeyFormatter(path, newPart string) string {\n\tif path == \"\" {\n\t\treturn newPart\n\t}\n\n\treturn path + \".\" + newPart\n}", "title": "" }, { "docid": "dfc96366c397d402fdbf1c345f8856cd", "score": "0.47556946", "text": "func substituteDots(s string) string {\n\treturn strings.Replace(s, \".\", \"_\", -1)\n}", "title": "" }, { "docid": "ede8195393871de9ec16e38eca9e317c", "score": "0.4720767", "text": "func JSONFieldName(s string) string {\n\ts = SnakeCase(s)\n\ts = jsonFieldNameRE.ReplaceAllString(s, \"\")\n\ts = strings.Replace(s, \"__\", \"_\", -1)\n\n\t// Strip excess\n\treturn s\n}", "title": "" }, { "docid": "7ceee267cb08e0af3cbb980ea6d49d50", "score": "0.46688157", "text": "func goKeyFormat(key string) string {\n\tvar st string\n\tstrList := strings.Split(key, \"_\")\n\tfor _, str := range strList {\n\t\tst += strings.Title(str)\n\t}\n\tif len(st) == 0 {\n\t\tst = key\n\t}\n\treturn st\n}", "title": "" }, { "docid": "2180d1b793f367347f11eaec322bbfea", "score": "0.46621102", "text": "func Underscored(value string) string {\r\n\tcamelCasedString := ToCamelCase(value)\r\n\tre := regexp.MustCompile(`([A-Z][a-z]*)|([a-z]*)`)\r\n\twords := re.FindAllString(camelCasedString, -1)\r\n\tfor i := range words {\r\n\t\twords[i] = strings.ToLower(words[i])\r\n\t}\r\n\tresult := strings.Join(words, \"_\")\r\n\treturn result\r\n}", "title": "" }, { "docid": "1e89d6853d852fa19137990ce06046e0", "score": "0.4654027", "text": "func SetRealKeys(vars interface{}) interface{} {\n\tswitch vars.(type) {\n\tcase map[string]interface{}:\n\t\tfor key, value := range vars.(map[string]interface{}) {\n\t\t\tswitch key[len(key)-1] {\n\t\t\tcase '+':\n\t\t\t\tswitch value.(type) {\n\t\t\t\tcase map[string]interface{}:\n\t\t\t\t\tabc := value.(map[string]interface{})\n\t\t\t\t\tfor k, v := range value.(map[string]interface{}) {\n\t\t\t\t\t\tif k[len(k)-1] != '+' {\n\t\t\t\t\t\t\tabc[k+\"~\"] = v\n\t\t\t\t\t\t\tdelete(abc, k)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tvars.(map[string]interface{})[key] = abc\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor key, value := range vars.(map[string]interface{}) {\n\t\t\tswitch value.(type) {\n\t\t\tcase map[string]interface{}:\n\t\t\t\tvars.(map[string]interface{})[key] = SetRealKeys(vars.(map[string]interface{})[key])\n\t\t\t}\n\t\t}\n\t\treturn vars\n\tdefault:\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "76f85dac53ab8aae3011e771f2fbefc4", "score": "0.46521607", "text": "func normalize(s string) string {\n\treturn strings.Replace(s, \"_\", \"-\", -1)\n}", "title": "" }, { "docid": "62208866323dcf540ee0afbfb9478ef6", "score": "0.46474925", "text": "func ReplaceDollarsToDotsInAttributes(attributes *map[string]string) {\n\tfor k, v := range *attributes { \n\t\tnewK := strings.Replace(k, \"$\", \".\", -1)\n\t\t(*attributes)[newK] = v\n\t\tdelete(*attributes, k)\n\t}\n}", "title": "" }, { "docid": "6e745226a5fbe855b6706f24dd7b8ec9", "score": "0.46388194", "text": "func (e *Ethtool) normalizeKey(key string) string {\n\t// must trim whitespace or this will have a leading _\n\tif inStringSlice(e.NormalizeKeys, \"snakecase\") {\n\t\tkey = camelCase2SnakeCase(strings.TrimSpace(key))\n\t}\n\t// must occur before underscore, otherwise nothing to trim\n\tif inStringSlice(e.NormalizeKeys, \"trim\") {\n\t\tkey = strings.TrimSpace(key)\n\t}\n\tif inStringSlice(e.NormalizeKeys, \"lower\") {\n\t\tkey = strings.ToLower(key)\n\t}\n\tif inStringSlice(e.NormalizeKeys, \"underscore\") {\n\t\tkey = strings.ReplaceAll(key, \" \", \"_\")\n\t}\n\t// aws has a conflicting name that needs to be renamed\n\tif key == \"interface_up\" {\n\t\tkey = \"interface_up_counter\"\n\t}\n\n\treturn key\n}", "title": "" }, { "docid": "8aaef6413b110cf4d9370e5c4fbb0516", "score": "0.46110824", "text": "func badToUnderscore(r rune) rune {\n\tif unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' {\n\t\treturn r\n\t}\n\treturn '_'\n}", "title": "" }, { "docid": "f237d30c820cf4b15cac496418de399b", "score": "0.45579588", "text": "func fixFieldName(field *gogo.FieldDescriptorProto) {\n\tif gogoproto.IsCustomName(field) {\n\t\treturn // Skip if a custom name is specified.\n\t}\n\n\tif field.Options == nil {\n\t\tfield.Options = new(gogo.FieldOptions)\n\t}\n\n\tname := field.GetName()\n\tname = snaker.SnakeToCamel(name)\n\tname = lintName(name)\n\n\t// Use gogoproto.customname\n\tproto.SetExtension(field.Options, gogoproto.E_Customname, &name)\n}", "title": "" }, { "docid": "91458024ff23597cef3309cc8a7355c8", "score": "0.45510557", "text": "func JSONName(protoName string) string {\n\tif len(protoName) == 0 {\n\t\treturn protoName\n\t}\n\n\tsp := strings.Split(protoName, \"_\")\n\n\tfor i, word := range sp {\n\t\tif i == 0 {\n\t\t\tsp[i] = strings.ToLower(word)\n\t\t} else {\n\t\t\tsp[i] = strings.Title(strings.ToLower(word))\n\t\t}\n\t}\n\treturn strings.Join(sp, \"\")\n}", "title": "" }, { "docid": "6bdea08bc8064f509492bdfa3d5ea81e", "score": "0.45416135", "text": "func ToUnderScore(name string) string {\n\tl := len(name)\n\tss := strings.Split(name, \"\")\n\n\t// we just care about the key of idx map,\n\t// the value of map is meaningless\n\tidx := make(map[int]int, 1)\n\n\tvar rs []rune\n\tfor _, s := range name {\n\t\trs = append(rs, []rune(string(s))...)\n\t}\n\n\tfor i := l - 1; i >= 0; {\n\t\tif unicode.IsUpper(rs[i]) {\n\t\t\tvar start, end int\n\t\t\tend = i\n\t\t\tj := i - 1\n\t\t\tfor ; j >= 0; j-- {\n\t\t\t\tif unicode.IsLower(rs[j]) {\n\t\t\t\t\tstart = j + 1\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\t// handle the case: \"BBC\" or \"AaBBB\" case\n\t\t\tif end == l-1 {\n\t\t\t\tidx[start] = 1\n\t\t\t} else {\n\t\t\t\tif start == end {\n\t\t\t\t\t// value=1 is meaningless\n\t\t\t\t\tidx[start] = 1\n\t\t\t\t} else {\n\t\t\t\t\tidx[start] = 1\n\t\t\t\t\tidx[end] = 1\n\t\t\t\t}\n\t\t\t}\n\t\t\ti = j - 1\n\t\t} else {\n\t\t\ti--\n\t\t}\n\t}\n\n\tfor i := l - 1; i >= 0; i-- {\n\t\tss[i] = strings.ToLower(ss[i])\n\t\tif _, ok := idx[i]; ok && i != 0 {\n\t\t\tss = append(ss[0:i], append([]string{\"_\"}, ss[i:]...)...)\n\t\t}\n\t}\n\n\treturn strings.Join(ss, \"\")\n}", "title": "" }, { "docid": "b783015f21b748dbcfba3b3a7403e658", "score": "0.45409897", "text": "func (s *Zookeeper) normalize(key string) string {\n\tkey = store.Normalize(key)\n\treturn strings.TrimSuffix(key, \"/\")\n}", "title": "" }, { "docid": "3262a93fc8381e32928babce3a74681c", "score": "0.45308515", "text": "func ToSnakeCase(value string) string {\r\n\treturn ToDecamelize(value, \"_\")\r\n}", "title": "" }, { "docid": "2ed60af20b927a7b572e511be4ae85f0", "score": "0.4500549", "text": "func snakeToCamel(s string) string {\n\tvar sb strings.Builder\n\tup := true\n\tfor _, r := range s {\n\t\tif r == '_' {\n\t\t\tup = true\n\t\t} else if up {\n\t\t\tsb.WriteRune(unicode.ToUpper(r))\n\t\t\tup = false\n\t\t} else {\n\t\t\tsb.WriteRune(unicode.ToLower(r))\n\t\t}\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "97f81310acdee68db24376b7ee9fdb06", "score": "0.44893903", "text": "func toUnderScoreCase(s string) string {\n\trunes := []rune(s)\n\tlength := len(runes)\n\tout := []rune{}\n\tfor i := 0; i < length; i++ {\n\t\tif i > 0 && unicode.IsUpper(runes[i]) && ((i+1 < length && unicode.IsLower(runes[i+1])) || unicode.IsLower(runes[i-1])) {\n\t\t\tout = append(out, '_')\n\t\t}\n\t\tout = append(out, unicode.ToLower(runes[i]))\n\t}\n\treturn string(out)\n}", "title": "" }, { "docid": "965dda0df32e62fd1253631db761714b", "score": "0.44651848", "text": "func (s *StatsiteSink) flattenKey(parts []string) string {\n\tjoined := strings.Join(parts, \".\")\n\treturn strings.Map(func(r rune) rune {\n\t\tswitch r {\n\t\tcase ':':\n\t\t\tfallthrough\n\t\tcase ' ':\n\t\t\treturn '_'\n\t\tdefault:\n\t\t\treturn r\n\t\t}\n\t}, joined)\n}", "title": "" }, { "docid": "5f0b23d99bda3d5fe2dcc07655e193d2", "score": "0.44629428", "text": "func normalise(key string) string {\n\t// Uppercase characters are normalised to lower case.\n\tkey = strings.ToLower(key)\n\n\t// Keys beginning with 'grpc-' are disallowed.\n\tkey = strings.TrimPrefix(key, \"grpc-\")\n\n\tvar res string\n\tfor _, ch := range key {\n\t\t// Remove illegal characters from the key.\n\t\tif !allowedCharsMap[ch] {\n\t\t\tcontinue\n\t\t}\n\n\t\tres += string(ch)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "42309c2eb6da402a22e6596a31a023e1", "score": "0.44609848", "text": "func underscoreTest() func(string, ...interface{}) Value {\n\tsetTester := func() {\n\t\ttester = newTester()\n\t\ttester.underscore() // Load underscore and testing shim, etc.\n\t}\n\tonce.Do(setTester)\n\n\treturn tester.test\n}", "title": "" }, { "docid": "6fbbaea66ab5bff14390b89eaacc0c89", "score": "0.443639", "text": "func GenerateKey(key string) string {\n\tif strings.Contains(key, \".\") {\n\t\tkeys := strings.SplitN(key, \".\", 2)\n\t\tkey = keys[0] + \".properties.\" + GenerateKey(keys[1])\n\t}\n\treturn key\n}", "title": "" }, { "docid": "6248371b91faf8114a3fe1a509770771", "score": "0.4401677", "text": "func (nb *nameBuilder) MakeJSONName(s pref.Name) string {\n\tnb.grow(len(s))\n\tvar n int\n\tvar wasUnderscore bool\n\tfor i := 0; i < len(s); i++ { // proto identifiers are always ASCII\n\t\tc := s[i]\n\t\tif c != '_' {\n\t\t\tisLower := 'a' <= c && c <= 'z'\n\t\t\tif wasUnderscore && isLower {\n\t\t\t\tc -= 'a' - 'A'\n\t\t\t}\n\t\t\tnb.sb.WriteByte(c)\n\t\t\tn++\n\t\t}\n\t\twasUnderscore = c == '_'\n\t}\n\treturn nb.last(n)\n}", "title": "" }, { "docid": "c6d60748025dcb53dc7be36d26e38eea", "score": "0.43795007", "text": "func SnakeToCamelCase(name string) string {\n\treturn snakeToCamelCase(name, true)\n}", "title": "" }, { "docid": "551fcf5b854c6b69777dc7d6e788e4b5", "score": "0.43343234", "text": "func SnakeToCamelCase(snake string) (camel string) {\n\tisToUpper := false\n\n\tfor k, v := range snake {\n\t\tif k == 0 {\n\t\t\tcamel = strings.ToUpper(string(v))\n\t\t} else {\n\t\t\tif isToUpper {\n\t\t\t\tcamel += strings.ToUpper(string(v))\n\t\t\t\tisToUpper = false\n\t\t\t} else {\n\t\t\t\tif v == '_' {\n\t\t\t\t\tisToUpper = true\n\t\t\t\t} else if v == '.' { // support for lookup paths\n\t\t\t\t\tisToUpper = true\n\t\t\t\t\tcamel += string(v)\n\t\t\t\t} else {\n\t\t\t\t\tcamel += string(v)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn\n}", "title": "" }, { "docid": "56cd98c95acd132992e16c9e8918d052", "score": "0.4325547", "text": "func (m *MessageImpl) SetKeys(keys []string) {\n\tif m.properties == nil {\n\t\tm.properties = make(map[string]string)\n\t}\n\tm.properties[constant.PROPERTY_KEYS] = strings.Join(keys, \" \")\n}", "title": "" }, { "docid": "f36f105b133f005dd7badca2f5d279a3", "score": "0.42922986", "text": "func escapeKey(str string) string {\n\treturn strings.Replace(str, \"/\", \"~1\", -1)\n}", "title": "" }, { "docid": "4fcdb83954a440d98e9cd1bf71260e51", "score": "0.4290497", "text": "func fmtFieldName(name string) string {\n\tname = strings.Replace(name, \".\", \"_\", -1)\n\treturn utils.SnakeCasedName(utils.TrimQuotes(utils.Trim(name)))\n}", "title": "" }, { "docid": "f0b11d92ec644861567e912042d06c81", "score": "0.4274531", "text": "func bucketToCollectionName(s string) string {\n\tif len(s) == 0 {\n\t\treturn \"\"\n\t}\n\t// replace all \".\" with _\n\ts = strings.ReplaceAll(s, \".\", \"_\")\n\n\t// if starts with number or '.' then add a special prefix\n\tif (s[0] >= '0' && s[0] <= '9') || (s[0] == '.' || s[0] == '_' || s[0] == '-') {\n\t\ts = \"xN--\" + s\n\t}\n\treturn s\n}", "title": "" }, { "docid": "123b93db8d4f8e6ed172554c2113359e", "score": "0.42676744", "text": "func (v *DocumentFormattingOptions) NKeys() int { return 1 }", "title": "" }, { "docid": "3b740a26bed42f75aa090f96b2447ae7", "score": "0.42590985", "text": "func toColorizedJsonKey(key string, indentCnt, basicWidth int, dark bool) string {\n\thasColon := strings.HasSuffix(key, \":\")\n\t// remove colon and double quotations although they might not exist actually\n\tkey = strings.TrimRight(key, \":\")\n\tdoubleQuoteTrimmed := strings.TrimRight(strings.TrimLeft(key, `\"`), `\"`)\n\n\tformat := `\"%s\"`\n\tif hasColon {\n\t\tformat += \":\"\n\t}\n\n\treturn fmt.Sprintf(format, color.Apply(doubleQuoteTrimmed, getColorByKeyIndent(indentCnt, basicWidth, dark)))\n}", "title": "" }, { "docid": "54f3e5f882b1fecfd8fe9340ee8302ee", "score": "0.4239383", "text": "func normalizePkgName(name string) string {\n\treturn strings.Replace(name, \"-\", \"_\", -1)\n}", "title": "" }, { "docid": "b17bb0d09be6dae8e276611c745a80ae", "score": "0.42364618", "text": "func (v *DocumentOnTypeFormattingOptions) NKeys() int { return 2 }", "title": "" }, { "docid": "0298aca7d681f306b230e43d412b1cd6", "score": "0.42295644", "text": "func fixAnnotationKey(key string) string {\n\tif reInvalidAnnotationCharacters.MatchString(key) {\n\t\t// only allocate for ReplaceAllString if we need to\n\t\tkey = reInvalidAnnotationCharacters.ReplaceAllString(key, \"_\")\n\t}\n\n\treturn key\n}", "title": "" }, { "docid": "ed7666bc516b0e655f9ca47b19642676", "score": "0.42229262", "text": "func formKeyName(objType, name string) string {\n\treturn objType + Speration + name\n}", "title": "" }, { "docid": "035e397207678a1734ff9b0f7fc8dbd3", "score": "0.42177463", "text": "func (c *core) camelCaseToSnake(src string) {\n\t/*\n\t\tvar u_type int\n\t\tvar before_u_type int\n\t\tvar runes [][]rune\n\t*/\n\n}", "title": "" }, { "docid": "49aba1ae288d4278b89f76d89f148629", "score": "0.4205997", "text": "func normalize(key string) string {\n\tif key == \"\" {\n\t\treturn \"\"\n\t}\n\tpath := strings.Split(strings.Trim(key, \"/\"), \"/\")\n\treturn \"/\" + strings.Join(path, \"/\")\n}", "title": "" }, { "docid": "a6cd7c556c14d99802c7a20620daa906", "score": "0.42022365", "text": "func canonicalName(name string) string {\n\treturn strings.ReplaceAll(name, \".\", \"_\")\n}", "title": "" }, { "docid": "b8c99722cfdbe7bd4063f7a33ce49c23", "score": "0.4200641", "text": "func (gp *GetPrinter) toColorizedJsonKey(key string, indentCnt, basicWidth int) string {\n\thasColon := strings.HasSuffix(key, \":\")\n\t// remove comma and double quotations although they might not exist actually\n\tkey = strings.TrimRight(key, \":\")\n\tdoubleQuoteTrimmed := strings.TrimRight(strings.TrimLeft(key, `\"`), `\"`)\n\n\tformat := `\"%s\"`\n\tif hasColon {\n\t\tformat += \":\"\n\t}\n\n\treturn fmt.Sprintf(format, color.Apply(doubleQuoteTrimmed, getColorByKeyIndent(indentCnt, basicWidth, gp.DarkBackground)))\n}", "title": "" }, { "docid": "a6985c370b9ecc9fa3b4a0ed77adef2d", "score": "0.41972122", "text": "func SnakeToCamel(s string) string {\n\tif s == \"\" {\n\t\treturn \"\"\n\t}\n\tvar result string\n\n\twords := strings.Split(s, \"_\")\n\n\tfor _, word := range words {\n\t\tw := []rune(word)\n\t\tw[0] = unicode.ToUpper(w[0])\n\t\tresult += string(w)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "1772d100730ec02eaac7dd587a7cbd44", "score": "0.41750798", "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": "a00970fe52e166d15bf4c2d2d7b1d8b8", "score": "0.41729355", "text": "func setTypeNameToCamelCase(xdlJob *XDLJob, typ v1.ReplicaType) {\n\tfor t := range xdlJob.Spec.XDLReplicaSpecs {\n\t\tif strings.EqualFold(string(t), string(typ)) && t != typ {\n\t\t\tspec := xdlJob.Spec.XDLReplicaSpecs[t]\n\t\t\tdelete(xdlJob.Spec.XDLReplicaSpecs, t)\n\t\t\txdlJob.Spec.XDLReplicaSpecs[typ] = spec\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1f907bc7d7d41bcac993e07197ae05ef", "score": "0.41624686", "text": "func FileConv(o string) (n string) {\r\n\tn = strings.Replace(o, \" \", \"_\", -1)\r\n\tn = strings.Replace(n, \":\", \"_\", -1)\r\n\tn = strings.Replace(n, \"-\", \"_\", -1)\r\n\treturn\r\n}", "title": "" }, { "docid": "fdc5e3e975ef9de64efc244fbcdedd4f", "score": "0.41370693", "text": "func SnakeToCamel(s string) string {\n\tvar r string\n\n\tif len(s) == 0 {\n\t\treturn s\n\t}\n\n\t//ME: hack snake just for those of having \"_\"\n\tif strings.Index(s, \"_\") < 0 {\n\t\treturn strings.ToUpper(s[:1]) + s[1:]\n\t}\n\n\tfor _, w := range strings.Split(s, \"_\") {\n\t\tif w == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tr += strings.ToUpper(w[:1]) + strings.ToLower(w[1:])\n\t\t/*u := strings.ToUpper(w)\n\t\tif ok := commonInitialisms[u]; ok {//me not need we use: Id and Html\n\t\t\tr += u\n\t\t} else {\n\t\t\tr += strings.ToUpper(w[:1]) + strings.ToLower(w[1:])\n\t\t}*/\n\t}\n\n\treturn r\n}", "title": "" }, { "docid": "b83d8f39ee58998b272e40ccbc91f762", "score": "0.4135886", "text": "func Normalize(input string) (output string, err error) {\n\toutput, err = p.ToUnicode(input)\n\tif err != nil {\n\t\treturn\n\t}\n\t// If the name started with a period then ToUnicode() removes it, but we want to keep it\n\tif strings.HasPrefix(input, \".\") && !strings.HasPrefix(output, \".\") {\n\t\toutput = \".\" + output\n\t}\n\treturn\n}", "title": "" }, { "docid": "88010295d98f4545afb507050daa35e9", "score": "0.412517", "text": "func Camelize(s string) string {\n\tvar str string\n\tws := strings.Split(s, \"_\")\n\tfor _, w := range ws {\n\t\tstr = str + strings.Title(w)\n\t}\n\n\tstr = strings.Replace(str, \"/\", \"::\", -1)\n\treturn str\n}", "title": "" }, { "docid": "2f4846fe7211931127e139b1fb9ddf50", "score": "0.41086957", "text": "func LowerCamelCaseStringFormat(value, separator string) string {\n\tresult := \"\"\n\n\tparts := strings.Split(value, separator)\n\tfor _, part := range parts {\n\t\tresult = LowerCamelCaseFlatMapKeyFormatter(result, part)\n\t}\n\n\treturn result\n}", "title": "" }, { "docid": "3a2d9751a96483fcf40435884238f231", "score": "0.40740043", "text": "func SetMapField(obj map[string]interface{}, k string, v interface{}) bool {\n\tcomponents := strings.Split(k, \".\")\n\tfor n, component := range components {\n\t\tif n == len(components)-1 {\n\t\t\tobj[component] = v\n\t\t} else {\n\t\t\tm, ok := obj[component]\n\t\t\tif !ok {\n\t\t\t\tm := make(map[string]interface{})\n\t\t\t\tobj[component] = m\n\t\t\t\tobj = m\n\t\t\t} else if obj, ok = m.(map[string]interface{}); !ok {\n\t\t\t\treturn false\n\t\t\t}\n\t\t}\n\t}\n\treturn true\n}", "title": "" }, { "docid": "84ac716f9c90437e5f59088cff315be7", "score": "0.40720114", "text": "func checkNumericUnderscores(a []byte) bool {\n\tprevUnderscore := false\n\tfor _, c := range a {\n\t\tcurrUnderscore := c == '_'\n\t\tif prevUnderscore && currUnderscore {\n\t\t\treturn false\n\t\t}\n\t\tprevUnderscore = currUnderscore\n\t}\n\treturn !prevUnderscore\n}", "title": "" }, { "docid": "2335fcec5791aef52c09d037aab01fc8", "score": "0.40715387", "text": "func DotRenamer(name string) string {\n\treturn strings.Replace(name, \"dot.\", \".\", 1)\n}", "title": "" }, { "docid": "4590a7c4bae15f78e2d7e9731d4fdd23", "score": "0.4063908", "text": "func ProtoName(jsonName string) string {\n\tsp := split(jsonName, false)\n\tfor i, word := range sp {\n\t\tsp[i] = strings.ToLower(word)\n\t}\n\n\treturn strings.Join(sp, \"_\")\n}", "title": "" }, { "docid": "8ea9b9b2e636be44c7f361bfff2c8c0b", "score": "0.40584812", "text": "func fixReservedProtoBuf(w string) string {\n\tif _, ok := reservedProtoBuf[codegen.CamelCase(w, false, false)]; ok {\n\t\tw += \"_\"\n\t}\n\treturn w\n}", "title": "" }, { "docid": "b62caa13d5adb80dbeb3e83bebecfce2", "score": "0.40584138", "text": "func sanitizeKey(s string) string {\n\tif len(s) == 0 {\n\t\treturn s\n\t}\n\ts = strings.Map(sanitizeRune, s)\n\tif unicode.IsDigit(rune(s[0])) {\n\t\ts = \"key_\" + s\n\t}\n\treturn s\n}", "title": "" }, { "docid": "22730116e137944b0ff23a7eab00d0bd", "score": "0.40568268", "text": "func reduceKey(field zap.Field) zap.Field {\n\tkeyTokens := strings.Split(field.Key, \".\")\n\tfield.Key = keyTokens[len(keyTokens)-1]\n\treturn field\n}", "title": "" }, { "docid": "17991dcd83026ee52ab2f84169edab1e", "score": "0.4054577", "text": "func (u UnqualifiedStar) NormalizeVarName() (VarName, error) { return u, nil }", "title": "" }, { "docid": "663a7a207b90a65d49c5e71e240dae4e", "score": "0.4052451", "text": "func normalizeTestName(name string) string {\n\ttrimmedName := strings.TrimLeft(name, \"/\")\n\treturn strings.ReplaceAll(trimmedName, \"/\", \"_\")\n}", "title": "" }, { "docid": "155e7c921cd57a53ce44dd9da1d26e49", "score": "0.40398014", "text": "func snakeCase(str string) string {\n\treturn toDelimitedString(str, \"_\")\n}", "title": "" }, { "docid": "9e9f7fc3868c597de659b1aa65dd46d4", "score": "0.40358454", "text": "func CamelToSnakeCase(name string) string {\n\tb := bytes.NewBufferString(``)\n\tleadIn := true\n\tmlUpper := false\n\tvar p rune = -1\n\tfor _, c := range name {\n\t\tif leadIn && c == '_' {\n\t\t\tb.WriteByte('_')\n\t\t\tcontinue\n\t\t}\n\t\tr := c\n\t\tif unicode.IsUpper(r) {\n\t\t\tmlUpper = unicode.IsUpper(p)\n\t\t\tif !(leadIn || p == '_' || mlUpper) {\n\t\t\t\tb.WriteByte('_')\n\t\t\t}\n\t\t\tr = unicode.ToLower(r)\n\t\t} else if mlUpper {\n\t\t\tmlUpper = false\n\t\t\tif !(leadIn || r == '_') {\n\t\t\t\tb.WriteByte('_')\n\t\t\t}\n\t\t}\n\t\tb.WriteRune(r)\n\t\tp = c\n\t\tleadIn = false\n\t}\n\treturn b.String()\n}", "title": "" }, { "docid": "e20189b8a8c2d6464b595bc070a6b0d8", "score": "0.40196815", "text": "func (m *Metadata) SetFieldAndNormalize(k string, v interface{}) bool {\n\treturn SetMapField(*m, k, NormalizeValue(v))\n}", "title": "" }, { "docid": "8bef2511c2bba7b894de0b695b4a4fa9", "score": "0.4007603", "text": "func (d *Jsondata) JsondataNormalize(regexps []*regexp.Regexp) {\n\td.NormalizedMessage = d.Message\n\tfor _, i := range regexps {\n\t\td.NormalizedMessage = i.ReplaceAllString(d.NormalizedMessage, \"\")\n\t}\n}", "title": "" }, { "docid": "990bb1e331f1d550a339ae7c4f200081", "score": "0.40003946", "text": "func SnakeCase(s string) string {\n\treturn strings.Map(\n\t\tfunc(r rune) rune {\n\t\t\tif isSeparator(r) {\n\t\t\t\treturn '_'\n\t\t\t}\n\t\t\treturn unicode.ToLower(r)\n\t\t},\n\t\ts)\n}", "title": "" }, { "docid": "db5da5afeca94cac5d9fc44dc383423c", "score": "0.39949748", "text": "func convert(key Key, spec map[string]interface{}, target proto.Message) error {\n\tjsonData, err := json.Marshal(warnDeprecationAndFix(key, spec))\n\tif err != nil {\n\t\treturn err\n\t}\n\tif err = jsonpb.Unmarshal(bytes.NewReader(jsonData), target); err != nil {\n\t\tlog.Warnf(\"%s unable to unmarshal: %s, %s\", key, err.Error(), string(jsonData))\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "fe6cc17e8a62bc8c2a652447d73bc995", "score": "0.3993431", "text": "func toSnakeCase(identifier string) string {\n\tvar buff bytes.Buffer\n\tfor i, char := range identifier {\n\t\tif i > 0 && unicode.IsUpper(char) {\n\t\t\tbuff.WriteRune('_')\n\t\t}\n\t\tbuff.WriteRune(unicode.ToLower(char))\n\t}\n\treturn buff.String()\n}", "title": "" }, { "docid": "7e1758e9eb67712a719b964cf5f5cb9d", "score": "0.3993191", "text": "func (v *TextDocumentClientCapabilitiesFormatting) NKeys() int { return 1 }", "title": "" }, { "docid": "684ab1db6b52a78cf6272a2c73f078a3", "score": "0.3992668", "text": "func normalizedTitle(name string) string {\n\tif strings.HasPrefix(name, \"-\") {\n\t\tname = strings.TrimPrefix(name, \"-\")\n\t}\n\n name = strings.Replace(name, \".\", \"_\", -1)\n\n\treturn strings.Title(name)\n}", "title": "" }, { "docid": "8da4155e8c1975dfee9567ac990acd03", "score": "0.39898837", "text": "func ToLowerCamel(name string) string {\n\tname = strings.ReplaceAll(name, \".\", \"\")\n\treturn strcase.ToLowerCamel(name)\n}", "title": "" }, { "docid": "eda1efd491f89aab28b5eee85a67943d", "score": "0.39823127", "text": "func keySuffix(private bool) string {\n\tif private {\n\t\treturn \"_rsa_key.pgp\"\n\t}\n\treturn \"_rsa_pub.pgp\"\n}", "title": "" }, { "docid": "8c93526eaf55f3d850731c10280606d7", "score": "0.39812523", "text": "func (v *DocumentRangeFormattingOptions) NKeys() int { return 1 }", "title": "" }, { "docid": "9c808ba530a27bb227c8d227f987f100", "score": "0.3978301", "text": "func LabelKeyToEnvVarName(labelKey string) string {\n\treturn strings.ToUpper(strings.Replace(labelKey, \".\", \"_\", 1))\n}", "title": "" }, { "docid": "a545cb24e5e779f59ecbbcc85b456993", "score": "0.39760697", "text": "func SnakeToUpCamel(name string) string {\n\tvar (\n\t\tbuf = bytes.NewBuffer(nil)\n\t\tbig = true\n\t)\n\tfor _, s := range name {\n\t\tif s == '_' {\n\t\t\tbig = true\n\t\t\tcontinue\n\t\t}\n\t\tif big && s >= 'a' && s <= 'z' {\n\t\t\tbuf.WriteRune(s - 32)\n\t\t} else {\n\t\t\tbuf.WriteRune(s)\n\t\t}\n\t\tbig = false\n\t}\n\treturn buf.String()\n}", "title": "" }, { "docid": "844d8edabfde3fa8af731abbde6c5ea9", "score": "0.39731324", "text": "func (v *TextDocumentClientCapabilitiesOnTypeFormatting) NKeys() int { return 1 }", "title": "" }, { "docid": "3f1496172527593eb6afd0d4b3150be6", "score": "0.39668098", "text": "func ToSnake(name string) string {\n\tname = strings.ReplaceAll(name, \".\", \"\")\n\treturn strcase.ToSnake(name)\n}", "title": "" }, { "docid": "ddfafecfb5fa9f4006a278caa75c7964", "score": "0.39637178", "text": "func prepareKey(k string) string {\n\treturn \"/\" + k\n}", "title": "" }, { "docid": "af93926aa68ae85724fad90af95a1d8a", "score": "0.3955296", "text": "func (o *PKIXName) SetBSON(raw bson.Raw) error {\n\n\tif o == nil {\n\t\treturn nil\n\t}\n\n\ts := &mongoAttributesPKIXName{}\n\tif err := raw.Unmarshal(s); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d4a0abab617db2c5cbc090cc550b9565", "score": "0.39542484", "text": "func (v *TextDocumentClientCapabilitiesRename) NKeys() int { return 2 }", "title": "" }, { "docid": "cf0c3792f63f7d983bf802190c11088f", "score": "0.39525372", "text": "func replacePkgName(\n\tsubject string,\n\tapiPkgName string,\n\treplacePkgAlias string,\n\tkeepPointer bool,\n) string {\n\tmemberType := subject\n\tsliceDepth := 0 // Depth of the slice type\n\tisSliceType := strings.HasPrefix(memberType, \"[]\")\n\tif isSliceType {\n\t\tsliceDepth = strings.LastIndex(subject, \"[]\")/2 + 1\n\t\tmemberType = memberType[sliceDepth*2:]\n\t}\n\tmapDepth := 0 // Depth of the map type\n\t// Assuming the map keys are always of type string.\n\tisMapType := strings.HasPrefix(memberType, \"map[string]\")\n\tif isMapType {\n\t\tmapDepth = strings.LastIndex(subject, \"map[string]\")/11 + 1\n\t\tmemberType = memberType[mapDepth*11:]\n\t}\n\tisPointerType := strings.HasPrefix(memberType, \"*\")\n\tif isPointerType {\n\t\tmemberType = memberType[1:]\n\t}\n\t// We need to convert any package name that the aws-sdk-private\n\t// model uses \"such as 'ecr.' to just 'svcapitypes' since we always\n\t// alias the Kubernetes API types for the service API with that\n\tif strings.Contains(memberType, \".\") {\n\t\tpkgName := strings.Split(memberType, \".\")[0]\n\t\ttypeName := strings.Split(memberType, \".\")[1]\n\t\tif pkgName == apiPkgName {\n\t\t\tmemberType = replacePkgAlias + \".\" + typeName\n\t\t} else {\n\t\t\tmemberType = pkgName + \".\" + typeName\n\t\t}\n\t}\n\tif isPointerType && keepPointer {\n\t\tmemberType = \"*\" + memberType\n\t}\n\tif isMapType {\n\t\tmemberType = strings.Repeat(\"map[string]\", mapDepth) + memberType\n\t}\n\tif isSliceType {\n\t\tmemberType = strings.Repeat(\"[]\", sliceDepth) + memberType\n\t}\n\treturn memberType\n}", "title": "" }, { "docid": "1f8b52f3cf936e54502345821db49090", "score": "0.39498073", "text": "func ConvertKeysToString(i interface{}) interface{} {\n\tswitch x := i.(type) {\n\tcase map[interface{}]interface{}:\n\t\tm2 := map[string]interface{}{}\n\t\tfor k, v := range x {\n\t\t\tm2[k.(string)] = ConvertKeysToString(v)\n\t\t}\n\t\treturn m2\n\tcase []interface{}:\n\t\tfor i, v := range x {\n\t\t\tx[i] = ConvertKeysToString(v)\n\t\t}\n\t}\n\treturn i\n}", "title": "" }, { "docid": "44d2e222790ec9f0e103da1817d7420d", "score": "0.39442077", "text": "func multiProtoToKey(keys []*pb.Key) []*Key {\n\tret := make([]*Key, len(keys))\n\tfor i, k := range keys {\n\t\tret[i] = protoToKey(k)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "08ce8edab4c0c575bf88cdd78f8056dc", "score": "0.39314327", "text": "func getFieldName(k string) (f string) {\n\tf = strcase.ToCamel(k)\n\treturn\n}", "title": "" }, { "docid": "c64ca3de7a21f05c1fb4df77576db08a", "score": "0.39298978", "text": "func camelize(s string) string {\n\treturn strings.ReplaceAll(strings.Title(strings.ReplaceAll(strings.ToLower(s), \"_\", \" \")), \" \", \"\")\n}", "title": "" }, { "docid": "ef604508b024087c47f9990ff16406e3", "score": "0.39245558", "text": "func makeKeygroupKeyName(kgname string) []byte {\n\treturn []byte(kgname + sep)\n}", "title": "" }, { "docid": "e1b4374800449bc4baa4e7d2109ad83c", "score": "0.39079177", "text": "func SetJSONKeyPathValuesFromStringsOnBytes(jsonPathDescriptors []string, bytes []byte) ([]byte, error) {\n\tvar err error // declare err to avoid shadowing effects in the loop\n\tfor _, exp := range jsonPathDescriptors {\n\t\tbytes, err = SetJSONKeyPathValuesFromStringOnBytes(exp, bytes)\n\t\tPrettyPrintJSONBytes(bytes)\n\t\tif err != nil {\n\t\t\treturn bytes, err\n\t\t}\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "ab5dbb3dbe3ff6a5ac93e948e617a101", "score": "0.39060032", "text": "func multiKeyToProto(keys []*Key) []*pb.Key {\n\tret := make([]*pb.Key, len(keys))\n\tfor i, k := range keys {\n\t\tret[i] = keyToProto(k)\n\t}\n\treturn ret\n}", "title": "" }, { "docid": "9135646d6c99152b9e9fc7223505e97e", "score": "0.3905452", "text": "func UnpackKeyWithPrefix(key string, parts ...*string) {\n\tkey = strings.ReplaceAll(key, fieldSeparator, keysSeparator)\n\tfor idx, s := range strings.Split(key, keysSeparator) {\n\t\tif idx >= len(parts) {\n\t\t\tbreak\n\t\t}\n\t\tif parts[idx] != nil {\n\t\t\t*parts[idx] = s\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c4c11f38ae49140daa4a510b4d7f7676", "score": "0.39021125", "text": "func (a *AllColumnsSelector) NormalizeVarName() (VarName, error) { return a, nil }", "title": "" }, { "docid": "2835f6c06fdb57094943a1571e7fa34a", "score": "0.3902084", "text": "func makeK8sNamePrefix(s string) string {\n\tvar sb strings.Builder\n\tnewToken := false\n\tfor _, c := range s {\n\t\tif !(unicode.IsLetter(c) || unicode.IsNumber(c)) {\n\t\t\tnewToken = true\n\t\t\tcontinue\n\t\t}\n\t\tif sb.Len() > 0 && (newToken || unicode.IsUpper(c)) {\n\t\t\tsb.WriteRune('-')\n\t\t}\n\t\tsb.WriteRune(unicode.ToLower(c))\n\t\tnewToken = false\n\t}\n\treturn sb.String()\n}", "title": "" }, { "docid": "dd728b4ba5e965bed70c7132b0ca01d4", "score": "0.3882482", "text": "func (n Name) LowerSnakeCase() Name { return n.Transform(strings.ToLower, strings.ToLower, \"_\") }", "title": "" }, { "docid": "30410f3b7dd7970b58d5d81091aeccee", "score": "0.3880123", "text": "func Humanize(input string) string {\r\n\tresult := UpperFirst(Underscored(input))\r\n\treturn strings.ReplaceAll(result, \"_\", \" \")\r\n}", "title": "" }, { "docid": "da6088d64289f556492cddf3f8c036f3", "score": "0.3879391", "text": "func renamingKey(m map[string]interface{}, add string) map[string]interface{} {\n\tnewMap := map[string]interface{}{}\n\tfor k, v := range m {\n\t\tnewKey := fmt.Sprint(k, add)\n\t\tnewMap[newKey] = v\n\t}\n\treturn newMap\n}", "title": "" }, { "docid": "d6f40a9acf4ce6cff2ce0c1f52934d57", "score": "0.3876269", "text": "func convertToValidName(s string) string {\n\ts = strings.TrimSpace(s)\n\tr := strings.NewReplacer(\"/\", \"_\", \".\", \"_\")\n\treturn r.Replace(s)\n}", "title": "" }, { "docid": "75e55f661329ff7450fcf26b6beda539", "score": "0.38647556", "text": "func (c *Conf) SetKeys(label ...string) {\n\tif v, ok := c.Get(\"keys\", label...); ok {\n\t\tc.TunName = v\n\t\tc.SaveFile = true\n\t} else {\n\t\tc.TunName = \"forwarder\"\n\t\tc.SaveFile = false\n\t}\n}", "title": "" } ]
88059d7dfe22057d49abba2dff7169d7
SetTimeout adds the timeout to the device templates get merged params
[ { "docid": "679c52364682c6a4aa01af7b447ba280", "score": "0.79697645", "text": "func (o *DeviceTemplatesGetMergedParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
[ { "docid": "ac9546aaa149582d25d277c2c132a65c", "score": "0.71214026", "text": "func (o *CreateWidgetTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "15523fdcc239a6c86aa8740716082c4a", "score": "0.7004874", "text": "func (o *PostCvdTemplatesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "0528439c8a3767f6cba69147f47a0c5c", "score": "0.69921196", "text": "func (o *DevicesGetModuleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "44474b7661ea3d8a212dae50dc37858d", "score": "0.69054383", "text": "func (o *TemplateInspectParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "12cdaba983641d0fe92bd5f4ba886982", "score": "0.6857599", "text": "func (o *GetWorkflowTemplateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9fd0917745983dab8303f5f3c7b8ad2", "score": "0.678732", "text": "func (o *CreateActionTemplateLogoSpacesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3d79850c29f3c139f5c9991b89af17de", "score": "0.67470384", "text": "func (o *GetClusterTemplateInstanceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "07a51874d6cc7e376317d0d373b90771", "score": "0.6719354", "text": "func (o *CreateDeviceUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "83657a813ea0124edc27adbac751caa5", "score": "0.66680336", "text": "func (o *ExtrasExportTemplatesListParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ecea49d0c05dcbb1b1ae354f8317a8b9", "score": "0.66590744", "text": "func (o *GenerateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "15491e52dcf7a0ce512e42d69af6f8b3", "score": "0.66525567", "text": "func (o *CreateUsingTempTokenPaymentSourceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e62bd2d1a7241be6c2933aca1fb6eea9", "score": "0.66374075", "text": "func (o *UpdateProjectDeviceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5fda030ff4f7bc131f39734762a8ecbf", "score": "0.66075534", "text": "func (o *GetDevicesIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "635d289012c900c1c2b7bab8db231cd1", "score": "0.65943986", "text": "func (o *PostDeviceOsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d9efe21148e955523c3a2c8948c06328", "score": "0.65649533", "text": "func (o *DeviceTemplatesGetMergedParams) WithTimeout(timeout time.Duration) *DeviceTemplatesGetMergedParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "5fea993aa46a9c0e500482b1acb777a9", "score": "0.6564199", "text": "func (o *GetDeviceUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9ff4f5b00a7d513439f02ce3ca7c85cf", "score": "0.6559246", "text": "func (o *GetCustomIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8f8c12849921d52248f69acd0a6b8a2c", "score": "0.653742", "text": "func (o *GetTemperaturesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d1cb3b04fa055c20f97f0a369df4d7e1", "score": "0.6519788", "text": "func (o *CreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b58af4d08f40ebfed8aa1aca9e552c9f", "score": "0.65086097", "text": "func (o *GetGatewayBundleUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c0809f4dbd3cf97648cef6b797e1ba03", "score": "0.6508129", "text": "func (o *WeaviateThingsPropertiesCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9410edfe189bd3d48bb622366becf16f", "score": "0.6485828", "text": "func (o *PcloudSystempoolsGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c83bee3afadc6a4bd6302670761df71c", "score": "0.64795625", "text": "func (o *GetLatestParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c016ab62785fefb12d688f168c72e65a", "score": "0.647488", "text": "func (o *DoBootImageParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3b720bcd8d336bfa72eb478342d657d5", "score": "0.64584494", "text": "func (o *StackCreateParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "07677ee643f2b45be1fe5120cad42db7", "score": "0.6457172", "text": "func (o *GetComponentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5355610d1b608b09802fbf9d59236331", "score": "0.6443349", "text": "func (o *PatchAppTagsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "9b027a985e75b40c5e46066db63e571e", "score": "0.6418065", "text": "func (o *PatchTagParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7d40f5eee367275a8ccf1ff8dec2e5c8", "score": "0.6405132", "text": "func (o *DcimDevicesNapalmParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f9c1d3b6cf87639212b89b9464a3db3c", "score": "0.63939387", "text": "func (o *GetDeviceURLParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bdefd126dc4b05f80523dbc10e3b889f", "score": "0.639258", "text": "func (o *GetFirmwareDriverDistributablesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d57835ecf7616a50150bb4a9d1eea4d6", "score": "0.6392056", "text": "func (o *PatchDeviceDatasourceInstanceByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "59d156941fad8b4f702835ae31ff9d58", "score": "0.6385991", "text": "func (o *GetInterpretersParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "11988c86333de000b930a581df74bf93", "score": "0.63718206", "text": "func (o *DeviceIndexParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "24eb14d749a06470d2f0e261ce79ca6f", "score": "0.63552994", "text": "func (o *SystemidGET2Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "90feeb99df13d4f6b0e76c1c5c4461d7", "score": "0.63547724", "text": "func (o *GetCustomCapabilityPresentationParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "328b49aaa2961f1dd3854256aa49e579", "score": "0.63455933", "text": "func (o *GetListOfCustomerConfigParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c506fb2a6f30898bd1718d9337d9a928", "score": "0.6343455", "text": "func (o *GetDeviceProfileTranslationsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "76e80362ce04ed50d1a0d2c482435074", "score": "0.6338542", "text": "func (o *GetRegionsByEnvParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7ee4454611f38e9e683401f961d585a5", "score": "0.63356036", "text": "func (o *GetSdxByEnvCrnParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "82d7e7e45d4e326e1dc9de6ac021b07c", "score": "0.63343775", "text": "func (o *GetSoftwareDetailsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "605b4316166759165e92d222945b517e", "score": "0.6323147", "text": "func (o *ParseRecipeByURLGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e4caca3bfb0798c799045834ca5f9505", "score": "0.6321675", "text": "func (o *CreateanewNcosPatternParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "8417667a04ea31b2c036e305465aa1f9", "score": "0.63211685", "text": "func (o *CreateSnippetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2fef56d4b103924d724979224908ac54", "score": "0.6319033", "text": "func (o *GetGroupByProviderIdentifierUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "747e897d71d8a15d3ff475aa9388100a", "score": "0.6315269", "text": "func (o *GetInputAPIInputRetrieveJSONParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ba6f53f4bf355c48fbcb5522a829cbd8", "score": "0.63136905", "text": "func (o *GetTestsE2eEnodebdTestPkParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "08078719b044523a9d7a32a93f42a880", "score": "0.63001275", "text": "func (o *GetTagsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "50365ff2123086f3b5d359c931c1db8a", "score": "0.6292893", "text": "func (o *GetPropertyGroupUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "a76cb344df383ffa58cbccfadd577951", "score": "0.6292362", "text": "func (o *CrossProductMonitervRAWithvROPSUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f0c7b7f1a935c6a824a35ad77602334f", "score": "0.62885433", "text": "func (o *CreateInstanceParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ebfba2d5777fbe92d2067113439f79ec", "score": "0.6286234", "text": "func (o *GetOpenstackMetadataParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "96fa97dfa4dacd45003c5161cbe00b06", "score": "0.62819177", "text": "func (o *AddExternalSystemCallsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "936f5c6722db97d10cd66992cc688687", "score": "0.6280522", "text": "func (o *StorageServiceHostIDGetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "875a33b90137a85257bd92c710a7a80a", "score": "0.62747794", "text": "func (o *CreateSwitchingProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "c5bde0adaf2e74bba85f6ab9a9fd2733", "score": "0.62681323", "text": "func (o *PostStorageFlexFlashPhysicalDrivesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "791f3ef2340dfafab304243251ec36de", "score": "0.6267025", "text": "func (o *ShowBundleParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "d0b966f56c1c4b1366e629f96435f7b2", "score": "0.62667125", "text": "func (o *GetHclDriverImagesMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "53448b9b7961ff9d36f3b1b8426b02d2", "score": "0.6263221", "text": "func (o *GetPopsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "51f958c4031ed9dece6b2fb63109f8d1", "score": "0.6261346", "text": "func (o *PostFegLTEParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "4b9c789565e3e9391b6a5eec20c479b5", "score": "0.6258085", "text": "func (o *CreateMTOShipmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5d3bec836dcfbaffb0ecb973584e65fa", "score": "0.62579894", "text": "func (o *GetVariableSetByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "7b56b59b414b78cb63efb62b3854e85e", "score": "0.62458515", "text": "func (o *GetDeploymentsV3UsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "539c0a4beaa020a3190d9dee1ec7908e", "score": "0.6245672", "text": "func (o *MountParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "6f035a269a0dd7b4217a3e5f23c93998", "score": "0.62383634", "text": "func (o *GetNdmpContextsBreByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5197344741dc1fd208174d9abbff792d", "score": "0.6229347", "text": "func (o *BuilImportConfigsUsingPOSTParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ee1ff5d7644fd2e9255efa232676386a", "score": "0.6229194", "text": "func (o *GetVolumeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "dfac1a65c4c3c3f82fc62b1612cc76a0", "score": "0.62246984", "text": "func (o *GetPatcherV1ProductsByProductIDTagsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3ccca7828deaa9cb02554bc80f6a23b7", "score": "0.6218029", "text": "func (o *GetSpecialPropertiesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "edd77814e13a29739a307ab0ac377aee", "score": "0.6214701", "text": "func (o *PostTestcryptTokenApisParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "b9c07880169a8d1a957c6b1360c1eb7b", "score": "0.620373", "text": "func (o *UpdateCustomPropertyForGatewayParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "82caffb2f825b12f05fb6e276f2850b2", "score": "0.6203614", "text": "func (o *UpdateFirmwareParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "e3eca8a18e87df12d0d89bf336719871", "score": "0.61951226", "text": "func (o *DeleteDeviceOsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1d8a6b1f60c5fd61632b9c3b1b61f1e8", "score": "0.61889917", "text": "func (o *GetCodeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "72a505731f1d7fbe487faf6bc508f058", "score": "0.61837393", "text": "func (o *GetNcosPatternitemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "da82f17514181d4198222c1a377dcd7a", "score": "0.61833465", "text": "func (o *UpdateAntivirusSettingsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "69192f837ebe6502b35b4e6c5c7dc885", "score": "0.6182589", "text": "func (o *CreateScanParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "349447e07d2c84289d569754b45053bb", "score": "0.61776364", "text": "func (o *CreateOIDCIDPParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "2dac26fce90361721c4f17c491f84a71", "score": "0.6175637", "text": "func (o *PostLTENetworkIDEnodebsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "bb88ccc341b5a9c874d4c5c1d6757bb0", "score": "0.61755085", "text": "func (o *WeaviateActionsPatchParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "237fa10c5c0164912efe74f0fb92bb66", "score": "0.6174962", "text": "func (o *GetFabricImagesParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "39a6fdb97b9691a51e33024f62d2b174", "score": "0.6170372", "text": "func (o *GetModeParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "47d9ca837582499cf744a88d6890b2d5", "score": "0.6169866", "text": "func (o *GetReleaseEnvironmentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "cde857ce2cd2eae7537b0e7c8c8293a4", "score": "0.6167984", "text": "func (o *PatchMicrostructureSensorParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "59f306b6abd4562f4cab7fe7a277d13e", "score": "0.61640257", "text": "func (o *DcimDevicesListParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "52fc4e2aa6a5e671f3779353a7c3a596", "score": "0.61561126", "text": "func (o *DeleteHyperflexHxdpVersionsMoidParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "da306424052ee01cf44dae369a7d983e", "score": "0.6153875", "text": "func (o *GetDialogueRandomByCharacterParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "3a8a7043f369e802e9e48777c768a9da", "score": "0.6153272", "text": "func (o *GetAllTagsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "1609d40f1324b721693e25e9983d29b3", "score": "0.6142793", "text": "func (o *Destiny2GetProfileParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "88ee14696859bcac16a367c59dc47cb7", "score": "0.61407846", "text": "func (o *GetTmcCliBinariesUsingGETParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f84f2d23a2ee02409abd5fe0855509d4", "score": "0.61340505", "text": "func (o *GetDeviceGroupDatasourceByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "82395a5d9387973dbb847ec79be9d5f2", "score": "0.6133936", "text": "func (o *UpdateDhcpOptionsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "38737003cb2f92d0fd44e4f73dd9a96c", "score": "0.61331594", "text": "func (c *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsWaitCall) Timeout(timeout string) *ProjectsLocationsTensorboardsExperimentsRunsTimeSeriesOperationsWaitCall {\n\tc.urlParams_.Set(\"timeout\", timeout)\n\treturn c\n}", "title": "" }, { "docid": "2b62853bf494b4c577586b4208490459", "score": "0.6132451", "text": "func (o *PatchCustomObjectDefinitionsByIDAttributeDefinitionsByIDParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "386231f6a31fa511f0bc63db68641af6", "score": "0.6125423", "text": "func (o *GetPeeringServeritemsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "ef6af65f158dd11a228ecaf9d4b7a007", "score": "0.6124965", "text": "func (o *CreateDeploymentParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "f847afc2585b92ba98dca02c17c4e230", "score": "0.6122539", "text": "func (o *GetCatalogItemsUsingGET4Params) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5e175dc87dc8273315a9f62a724485fd", "score": "0.6118282", "text": "func (o *GetImageTarParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "695122281fda03a9089eeabc460b3f90", "score": "0.6117742", "text": "func (o *GetDebugAttachmentsParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" }, { "docid": "5f1d5277e374eb49f1697c5c0befeb31", "score": "0.61127067", "text": "func (o *GotoPtzPresetParams) SetTimeout(timeout time.Duration) {\n\to.timeout = timeout\n}", "title": "" } ]
1a27b9e1a46b2f9d3e04d04d809459a9
SetDescription sets the Description field's value.
[ { "docid": "301c9d34a2fa9f96028b64ea8bfee178", "score": "0.0", "text": "func (s *AllowListStatus) SetDescription(v string) *AllowListStatus {\n\ts.Description = &v\n\treturn s\n}", "title": "" } ]
[ { "docid": "4f4505e8739082b854e1e4f5090ec7a9", "score": "0.85698056", "text": "func (a *Alert) SetDescription(d string) error {\n\tif d != \"\" {\n\t\ta.Description = d\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"description could not be empty\")\n}", "title": "" }, { "docid": "ddff87d2321146d8c8ad1805efd52e6e", "score": "0.8539378", "text": "func (m *Milk) SetDescription(desc string) {\n\tm.description = desc\n}", "title": "" }, { "docid": "f10007ad3fa3fd92a7d2fa27912f9976", "score": "0.8520554", "text": "func (o *GetCrmProspectParams) SetDescription(description *string) {\n\to.Description = description\n}", "title": "" }, { "docid": "81f1704ad3c9587dfd73aa2ff1f29d1c", "score": "0.8505376", "text": "func (n *Node) SetDescription(desc string) {\n\tn.description = desc\n}", "title": "" }, { "docid": "81f1704ad3c9587dfd73aa2ff1f29d1c", "score": "0.8505376", "text": "func (n *Node) SetDescription(desc string) {\n\tn.description = desc\n}", "title": "" }, { "docid": "997acbf39e764b17fdaae6b0b85016c3", "score": "0.85026354", "text": "func (cr *CommandRegistry) SetDescription(desc string) *CommandRegistry {\n\n\tcr.Desc = trimWhitespaces(desc) // trim whitespaces\n\n\treturn cr\n}", "title": "" }, { "docid": "43d5acc6e169e139834b893c3805af51", "score": "0.8496658", "text": "func (i *Info) SetDescription(description string) {\n\ti.description = description\n}", "title": "" }, { "docid": "b8bc90f770c1f35474cd673860dfd320", "score": "0.84796214", "text": "func (n *nodeTest) SetDescription(desc string) {\n\tn.description = desc\n}", "title": "" }, { "docid": "8d0f7972ab3f7217997a49e77eaadd69", "score": "0.8456247", "text": "func (m *gitWebhook) SetDescription(val *string) {\n\tm.descriptionField = val\n}", "title": "" }, { "docid": "dd4301f02c9dbbaf1edd12eee0f3b383", "score": "0.8453965", "text": "func (o *VPCRouterCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "fe5d8e444c29823f9bbffbc57db0cacb", "score": "0.8443718", "text": "func (c *Command) SetDescription(desc string) *Command {\n\tc.Desc = trimWhitespaces(desc) // trim whitespaces\n\n\treturn c\n}", "title": "" }, { "docid": "a542dfc1cf908c0879ede66d50e96d55", "score": "0.84411514", "text": "func (this *Cli) SetDescription(v string) *Cli {\n\tthis.Description = v\n\treturn this\n}", "title": "" }, { "docid": "66d7e44186f647a3dcd3b7a2e5dfe032", "score": "0.8440889", "text": "func (b *BasicRule) SetDescription(desc string) {\n\tb.description = desc\n}", "title": "" }, { "docid": "a25a3ec07f61f9d820e6514d8853e45b", "score": "0.8415981", "text": "func (m *gitWebhookSpec) SetDescription(val *string) {\n\tm.descriptionField = val\n}", "title": "" }, { "docid": "9c928767027a2a888c02c9d317898cde", "score": "0.84093624", "text": "func (e *BaseEvent) SetDescription(d string) {\n\te.description = d\n}", "title": "" }, { "docid": "daaa3e5b7a8767d60a31784b46e03f67", "score": "0.8409214", "text": "func (o *LoadBalancerCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "12578fea4ab8d27d39f188670452d121", "score": "0.84089625", "text": "func (o *UpdateApiAccessRuleRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "180e8dea2ca66354a107615b85ee2b0a", "score": "0.84088194", "text": "func (m *TemplateMutation) SetDescription(s string) {\n\tm.description = &s\n}", "title": "" }, { "docid": "94cf40487b4e59d467ef11c698a5cd71", "score": "0.84027565", "text": "func (o *PatchClientRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "194e83592dfdf5b60d1f6e36cd1b72c7", "score": "0.8401375", "text": "func (o *SwitchCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "d5bc889d227f3766dad67226393f0c74", "score": "0.8401086", "text": "func (u *Usage) SetDescription(description string) {\n\tu.description = description\n}", "title": "" }, { "docid": "d96beec2f016af01a92af4a681676ea4", "score": "0.8399519", "text": "func (o *Switch) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "0fa85ce977dd419dc4f5bdbf71a04ed5", "score": "0.8397265", "text": "func (cu *ConfigurationUpdate) SetDescription(s string) *ConfigurationUpdate {\n\tcu.mutation.SetDescription(s)\n\treturn cu\n}", "title": "" }, { "docid": "36bb9671dd7292d64e3184b421e719b7", "score": "0.8380969", "text": "func (o *AutomationTemplate) SetDescription(description string) {\n\n\to.Description = description\n}", "title": "" }, { "docid": "5210ca4e770d887a585e0ee02ebd4037", "score": "0.8378038", "text": "func (o *VPCRouterUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "051fcbbb2329610b41047726406db3f1", "score": "0.83724844", "text": "func (o *UpdateRoleRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "e25d7c7353281dcb3cc15f56bc5dddf0", "score": "0.83703625", "text": "func (o *CreateIntegrationRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "4380af8107e323539c28c7aa54db7e74", "score": "0.8367327", "text": "func (o *GSLB) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "192d44506a68cdf36bfad8d24ce9a51d", "score": "0.8364429", "text": "func (o *SparseHookPolicy) SetDescription(description string) {\n\n\to.Description = &description\n}", "title": "" }, { "docid": "0dcd99cfd5845e6ed165a737a095a02f", "score": "0.836318", "text": "func (ru *ResourceUpdate) SetDescription(s string) *ResourceUpdate {\n\tru.mutation.SetDescription(s)\n\treturn ru\n}", "title": "" }, { "docid": "a67976b927cfdc3ae6b463d7c3474b25", "score": "0.8362259", "text": "func (o *AddMealParams) SetDescription(description string) {\n\to.Description = description\n}", "title": "" }, { "docid": "837dce370ff1d129ca256f3547ecfd22", "score": "0.83544284", "text": "func (o *CreateVmGroupRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "f4ed385d6436010293cd5ac0e4536eb8", "score": "0.8351299", "text": "func (c *CheckObject) SetDescription(d string) {\n c.Description = d\n}", "title": "" }, { "docid": "1f972cf67d6cf1fb835c0c9e90d9347d", "score": "0.83479106", "text": "func (o *CDROM) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "cedaf29240553b8327a1dcfed581ab04", "score": "0.83458716", "text": "func (o *GSLBUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "57aa35d02dc9a1b99e74417769b4534f", "score": "0.83425415", "text": "func (o *CreateCronjobParams) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "02eb5e71f47d5350c79ee2699dc2cbe7", "score": "0.834115", "text": "func (o *SIMCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "92c2ea1c5a7d433d1e94a31597c26367", "score": "0.8341", "text": "func (idu *ItemDescriptionUpdate) SetDescription(s string) *ItemDescriptionUpdate {\n\tidu.mutation.SetDescription(s)\n\treturn idu\n}", "title": "" }, { "docid": "3a492b920c113c00b26542e7d9012d91", "score": "0.8335974", "text": "func (o *CustomfieldCustomField) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "fe0a45b78abb0e8f99ce0a9d29fa0dd6", "score": "0.8335344", "text": "func (o *UpdateVmTemplateRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "abfbe66c7ec9a0098b6da41303305a82", "score": "0.83350235", "text": "func (o *PacketFilter) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "0ee50fc435ac5ae2215c36bb33a0e347", "score": "0.83344847", "text": "func (o *GSLBCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "908eb2812b8b2cbc901707d8c5da17ed", "score": "0.83239484", "text": "func (o *GroupCreateRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "039c08bea05b125f14f94f2f4d7c54f6", "score": "0.8322085", "text": "func (g *graph) SetDescription(description string) {\n\tg.description = description\n}", "title": "" }, { "docid": "a1c1127cd02e2be082017c843e3e85a4", "score": "0.83216506", "text": "func (o *VPCRouter) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "b370df8dfb9800dae39ded4cdae6c401", "score": "0.8320948", "text": "func (pu *ProductUpdate) SetDescription(s string) *ProductUpdate {\n\tpu.mutation.SetDescription(s)\n\treturn pu\n}", "title": "" }, { "docid": "ca37d3ab9511dde60664e37ee4fb35b7", "score": "0.8317439", "text": "func (o *DiskCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "a3f0f05f7ea781d9fd5eb253cdbb2e0d", "score": "0.8315375", "text": "func (o *SIM) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "80c35c24bbafee9d3795d50b741d8402", "score": "0.83113974", "text": "func (o *SparseAutomationTemplate) SetDescription(description string) {\n\n\to.Description = &description\n}", "title": "" }, { "docid": "addd88c4fe7e3b0ee17201327ad697c9", "score": "0.8310488", "text": "func (m *GroupMutation) SetDescription(s string) {\n\tm.description = &s\n}", "title": "" }, { "docid": "36e0248274af582e7089a32a59423859", "score": "0.8306114", "text": "func (o *HookPolicy) SetDescription(description string) {\n\n\to.Description = description\n}", "title": "" }, { "docid": "3cc37e8284bb081cc0cc7ce24d080a5a", "score": "0.83044195", "text": "func (o *TransferAuthorizationDecisionRationale) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "f2a93533b2f57d456e29d7ad7ffaf011", "score": "0.8303354", "text": "func (o *GroupUpdateRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "50a762d58135e972de504aa73787a9e1", "score": "0.8303111", "text": "func (o *LoadBalancerUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "14932cf7e6dcf2acd86fca2466259f8c", "score": "0.8302337", "text": "func (wu *WorkflowUpdate) SetDescription(s string) *WorkflowUpdate {\n\twu.mutation.SetDescription(s)\n\treturn wu\n}", "title": "" }, { "docid": "a4b0c98b6f46e055f6fe0df42efd95f9", "score": "0.8298706", "text": "func (o *StackPatchRequest) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "b1ca0a4bb970d56aad90873169eff23f", "score": "0.8296152", "text": "func (o *DAG) SetDescription(v string) {\n\to.Description.Set(&v)\n}", "title": "" }, { "docid": "d8fb1b33101132ddfe17a487a83fdd2b", "score": "0.82934904", "text": "func (o *SwitchUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "7eaa4fb6f903d36df0741955adedc879", "score": "0.829266", "text": "func (o *PublicFormViewFieldOptions) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "c54ba74fd378c6abb135c0a11eb0ad83", "score": "0.8288269", "text": "func (iduo *ItemDescriptionUpdateOne) SetDescription(s string) *ItemDescriptionUpdateOne {\n\tiduo.mutation.SetDescription(s)\n\treturn iduo\n}", "title": "" }, { "docid": "68981bf4aa7ecb22256cb1a94fd42240", "score": "0.8284845", "text": "func (o *PacketFilterCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "f80e0298af1e6a5b745680aef4fa7b10", "score": "0.8283147", "text": "func (o *ServerCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "55ca31ddd58ec0dc58acff2ed88f9295", "score": "0.8279439", "text": "func (cuo *ConfigurationUpdateOne) SetDescription(s string) *ConfigurationUpdateOne {\n\tcuo.mutation.SetDescription(s)\n\treturn cuo\n}", "title": "" }, { "docid": "4aec7ec73b32e4304f8a81d24ec55225", "score": "0.8276828", "text": "func (o *Ga4ghFusionDetection) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "4a69b84349970732b34325404761a9e0", "score": "0.8274184", "text": "func (o *ClientProvidedTransaction) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "f1d08208ec0fd7ba6fa1751ed37fe647", "score": "0.8269319", "text": "func (s *GetSensitivityInspectionTemplateOutput) SetDescription(v string) *GetSensitivityInspectionTemplateOutput {\n\ts.Description = &v\n\treturn s\n}", "title": "" }, { "docid": "31c703cf153b6ecfe840babc04733a10", "score": "0.826541", "text": "func (b *Bext) SetDescription(value string) {\n\tb.description = [256]byte{}\n\tcopy(b.description[:], terminate(value, len(b.description)))\n}", "title": "" }, { "docid": "5360d693ac29d47b97745bce5b57d953", "score": "0.8264865", "text": "func (o *TravelExpensePaymentTypeSearchParams) SetDescription(description *string) {\n\to.Description = description\n}", "title": "" }, { "docid": "1735c14e7df68c24575cb296d37fbcbb", "score": "0.825783", "text": "func (o *PacketFilterUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "3170dfe533b7adc300a80aec0a73820d", "score": "0.8254251", "text": "func (o *TimerTimer) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "bf2a1b013a3a76727e9b807a2db1573b", "score": "0.8250701", "text": "func (o *PostServices2Params) SetDescription(description *string) {\n\to.Description = description\n}", "title": "" }, { "docid": "44ac9cb87c0f673b0b0c3f6a5e5d6764", "score": "0.8249829", "text": "func (a *account) SetDescription(description string) {\n\ta.Description = description\n}", "title": "" }, { "docid": "b41724237297623c899f3559b540fa4e", "score": "0.82457024", "text": "func (fetu *FlowExecutionTemplateUpdate) SetDescription(s string) *FlowExecutionTemplateUpdate {\n\tfetu.mutation.SetDescription(s)\n\treturn fetu\n}", "title": "" }, { "docid": "6ad59a8beea4e0e95f3162dfd1b761be", "score": "0.8245418", "text": "func (s *GetMobileDeviceAccessOverrideOutput) SetDescription(v string) *GetMobileDeviceAccessOverrideOutput {\n\ts.Description = &v\n\treturn s\n}", "title": "" }, { "docid": "c71edaee165c11d3cd58906c8a742923", "score": "0.8245101", "text": "func (o *InternetCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "11f4b79255dcfbc25ffee6c2f5b3ea24", "score": "0.82433605", "text": "func (o *CDROMCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "8bc268c231d8f169742562af0e2370bd", "score": "0.8243127", "text": "func (o *ArchiveCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "0d941155c835c51e85f0a6b431721844", "score": "0.8242696", "text": "func (tduo *TCPDetectorUpdateOne) SetDescription(s string) *TCPDetectorUpdateOne {\n\ttduo.mutation.SetDescription(s)\n\treturn tduo\n}", "title": "" }, { "docid": "7d1beb6ed4ec6258ac179be813198bd1", "score": "0.8242589", "text": "func (m *ServerMutation) SetDescription(s string) {\n\tm.description = &s\n}", "title": "" }, { "docid": "9a7d7d93d884b97d1fb2327d8e4e6ff7", "score": "0.82404375", "text": "func (o *BridgeCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "cae9e4e633443785874f75ec123fc579", "score": "0.823828", "text": "func (o *NFSCreateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "595de32bf723cc4ec9b8060c011fd0e0", "score": "0.8238225", "text": "func (o *Disk) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "89294446248bb6ef6788597e7cac2b94", "score": "0.8238177", "text": "func (puo *ProductUpdateOne) SetDescription(s string) *ProductUpdateOne {\n\tpuo.mutation.SetDescription(s)\n\treturn puo\n}", "title": "" }, { "docid": "e6752eaa3094cc1bc494ef9045d4b2b8", "score": "0.8236187", "text": "func (wuo *WorkflowUpdateOne) SetDescription(s string) *WorkflowUpdateOne {\n\twuo.mutation.SetDescription(s)\n\treturn wuo\n}", "title": "" }, { "docid": "7a705877a8da61db5dc5754df99f3d99", "score": "0.82359385", "text": "func (pdu *PingDetectorUpdate) SetDescription(s string) *PingDetectorUpdate {\n\tpdu.mutation.SetDescription(s)\n\treturn pdu\n}", "title": "" }, { "docid": "389a2b6ef91e54ad3ac27be6c450b63c", "score": "0.8235049", "text": "func (o *ConnectorType) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "13b8b14956aeb05a992b5e3ab0a16387", "score": "0.82341623", "text": "func (o *CampaignTemplateParams) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "33cd2f697bc8ea6e79744710610232f2", "score": "0.8232819", "text": "func (tdu *TCPDetectorUpdate) SetDescription(s string) *TCPDetectorUpdate {\n\ttdu.mutation.SetDescription(s)\n\treturn tdu\n}", "title": "" }, { "docid": "28bc21d2c05fc96e8d71ddf9f5b0e065", "score": "0.8232599", "text": "func (o *Route) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "11950fcc118772b96586d0bfbbd385c6", "score": "0.8229514", "text": "func (o *Pipeline) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "34075e4a7aa69f1d343a238a0b22d7e4", "score": "0.82288206", "text": "func (o *DiskUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "fe26441e84b55e90d66217ff054236d0", "score": "0.82264143", "text": "func (o *SIMUpdateRequest) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "85c74f4a8179d62918109b4a865a32ed", "score": "0.8225983", "text": "func (o *InlineResponse20017Expenses) SetDescription(v string) {\n\to.Description = &v\n}", "title": "" }, { "docid": "9f1b486dc2a8284657839206206cc1dc", "score": "0.8221301", "text": "func (suo *SexUpdateOne) SetDescription(s string) *SexUpdateOne {\n\tsuo.mutation.SetDescription(s)\n\treturn suo\n}", "title": "" }, { "docid": "5e9b3d95d5710b3c229a4ef55cd9da24", "score": "0.8221075", "text": "func (t *Town) SetDescription(who *User, newDescription string) error {\n\tif !t.mod(who).active() {\n\t\treturn ErrTownNotMod\n\t}\n\tif len(newDescription) > townDescriptionMax {\n\t\treturn ErrTownDescriptionMax\n\t}\n\n\tt.Description = newDescription\n\treturn nil\n\n}", "title": "" }, { "docid": "bd5d39c1b3c6bddd145e7aee8b8f1ddf", "score": "0.82209736", "text": "func (m *gitEvent) SetDescription(val *string) {\n\tm.descriptionField = val\n}", "title": "" }, { "docid": "4bd784733dc7ec537633a04cea7680d3", "score": "0.82193863", "text": "func (o *VPCRouterFirewallRule) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "43f51de35366a07ebd1bec0083a9dbae", "score": "0.8216173", "text": "func (s *CreateRouteCalculatorInput) SetDescription(v string) *CreateRouteCalculatorInput {\n\ts.Description = &v\n\treturn s\n}", "title": "" }, { "docid": "a4f8284400f1821e603ef82ca4515349", "score": "0.8215941", "text": "func (m *ItemDescriptionMutation) SetDescription(s string) {\n\tm.description = &s\n}", "title": "" }, { "docid": "2c4e47d619baa2dc5ddf9a261a0eb7fd", "score": "0.8215706", "text": "func (o *Server) SetDescription(v string) {\n\to.Description = v\n}", "title": "" }, { "docid": "c7b285061b65f4ea6d5ba5b3370dd59a", "score": "0.8214836", "text": "func (s *UpdateGeofenceCollectionInput) SetDescription(v string) *UpdateGeofenceCollectionInput {\n\ts.Description = &v\n\treturn s\n}", "title": "" } ]
5f4c75a1cd9d1f43b20b2bada46f2ad1
RestoreNodeIDs restores node IDs and their associated IP addresses from the BPF map and into the node handler inmemory copy.
[ { "docid": "cf0d7578d83de6f90372a7d790323a91", "score": "0.859063", "text": "func (n *linuxNodeHandler) RestoreNodeIDs() {\n\t// Retrieve node IDs from the BPF map to be able to restore them.\n\tnodeIDs := make(map[string]uint16)\n\tparse := func(key *nodemap.NodeKey, val *nodemap.NodeValue) {\n\t\taddress := key.IP.String()\n\t\tif key.Family == bpf.EndpointKeyIPv4 {\n\t\t\taddress = net.IP(key.IP[:net.IPv4len]).String()\n\t\t}\n\t\tnodeIDs[address] = val.NodeID\n\t}\n\tif err := n.nodeMap.IterateWithCallback(parse); err != nil {\n\t\tlog.WithError(err).Error(\"Failed to dump content of node map\")\n\t\treturn\n\t}\n\n\tn.registerNodeIDAllocations(nodeIDs)\n\tlog.Infof(\"Restored %d node IDs from the BPF map\", len(nodeIDs))\n}", "title": "" } ]
[ { "docid": "9c68399f5c364a23a226ab6650a71673", "score": "0.57743037", "text": "func (n *linuxNodeHandler) DumpNodeIDs() []*models.NodeID {\n\tn.mutex.Lock()\n\tdefer n.mutex.Unlock()\n\n\tnodeIDs := map[uint16]*models.NodeID{}\n\tfor ip, id := range n.nodeIDsByIPs {\n\t\tif nodeID, exists := nodeIDs[id]; exists {\n\t\t\tnodeID.Ips = append(nodeID.Ips, ip)\n\t\t\tnodeIDs[id] = nodeID\n\t\t} else {\n\t\t\ti := int64(id)\n\t\t\tnodeIDs[id] = &models.NodeID{\n\t\t\t\tID: &i,\n\t\t\t\tIps: []string{ip},\n\t\t\t}\n\t\t}\n\t}\n\n\tdump := make([]*models.NodeID, 0, len(nodeIDs))\n\tfor _, nodeID := range nodeIDs {\n\t\tdump = append(dump, nodeID)\n\t}\n\treturn dump\n}", "title": "" }, { "docid": "d9b3df6c56b4a5327dd4ba75e81d453e", "score": "0.5483883", "text": "func (n *linuxNodeHandler) diffAndUnmapNodeIPs(oldIPs, newIPs []nodeTypes.Address) {\nnextOldIP:\n\tfor _, oldAddr := range oldIPs {\n\t\tfor _, newAddr := range newIPs {\n\t\t\tif newAddr.IP.Equal(oldAddr.IP) {\n\t\t\t\tcontinue nextOldIP\n\t\t\t}\n\t\t}\n\t\tif err := n.unmapNodeID(oldAddr.IP.String()); err != nil {\n\t\t\tlog.WithError(err).WithFields(logrus.Fields{\n\t\t\t\tlogfields.IPAddr: oldAddr,\n\t\t\t}).Warn(\"Failed to remove a node IP to node ID mapping\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "7236b2d21283c8d0e6bba46f2f9a6953", "score": "0.5287739", "text": "func (n *linuxNodeHandler) unmapNodeID(ip string) error {\n\t// Check error cases first, to avoid having to cancel anything.\n\tif _, exists := n.nodeIDsByIPs[ip]; !exists {\n\t\treturn fmt.Errorf(\"cannot remove IP %s from node ID map as it doesn't exist\", ip)\n\t}\n\tnodeIP := net.ParseIP(ip)\n\tif nodeIP == nil {\n\t\treturn fmt.Errorf(\"invalid node IP %s\", ip)\n\t}\n\n\tif err := n.nodeMap.Delete(nodeIP); err != nil {\n\t\treturn err\n\t}\n\tif id, exists := n.nodeIDsByIPs[ip]; exists {\n\t\tdelete(n.nodeIDsByIPs, ip)\n\t\tdelete(n.nodeIPsByIDs, id)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad5ad5d8d84dcc051fe703116b54f551", "score": "0.51869905", "text": "func (self *RoutingDatabase) setIds(nodeIds map[string]int) {\n\tself.ids = nodeIds\n\tself.size = len(nodeIds)\n\tfor k, v := range self.ids {\n\t\tself.labels[v] = k\n\t}\n}", "title": "" }, { "docid": "b574b5de4339f27583b5a702db61bf3f", "score": "0.50424534", "text": "func restoreIpAddresses(s string) []string {\n\tif len(s) < 4 {\n\t\treturn nil\n\t}\n\tcur, res := make([]string, 0), make([]string, 0)\n\tdfs(s, 0, cur, &res)\n\treturn res\n}", "title": "" }, { "docid": "6e68626ce8d08d127b073d90aa89e5bd", "score": "0.49170917", "text": "func (n *linuxNodeHandler) mapNodeID(ip string, id uint16) error {\n\tif _, exists := n.nodeIDsByIPs[ip]; exists {\n\t\treturn fmt.Errorf(\"a mapping for node IP %s already exists\", ip)\n\t}\n\n\tnodeIP := net.ParseIP(ip)\n\tif nodeIP == nil {\n\t\treturn fmt.Errorf(\"invalid node IP %s\", ip)\n\t}\n\n\tif err := n.nodeMap.Update(nodeIP, id); err != nil {\n\t\treturn err\n\t}\n\n\t// We only add the IP <> ID mapping in memory once we are sure it was\n\t// successfully added to the BPF map.\n\tn.nodeIDsByIPs[ip] = id\n\tn.nodeIPsByIDs[id] = ip\n\n\treturn nil\n}", "title": "" }, { "docid": "205a00c1564463f031419ca336dd0d7d", "score": "0.49063414", "text": "func RestoreNodeCache(path string) ([]*peer.AddrInfo, error) {\n nodedata, err := ioutil.ReadFile(path)\n if err != nil {\n log.WithField(\"err\", err).Warning(\"Node caching is enabled, but we couldn't read from the cache file. \" +\n \t\"Maybe this is the first run? Continuing without node cache this time.\")\n return nil, err\n }\n var result []peer.AddrInfo\n err = json.Unmarshal(nodedata, &result)\n if err != nil {\n log.WithField(\"err\", err).Error(\"Error unmarshalling from cacheFile.\")\n return nil, err\n }\n var out []*peer.AddrInfo\n // switch to pointers to fullfil requirements of main.go... because this is stupid\n for it := range result{\n out = append(out, &result[it])\n }\n return out, nil\n}", "title": "" }, { "docid": "70b8ff3bd1f16427696f2d5297d67193", "score": "0.48060384", "text": "func (n *NeptuneDB) CloneNodesFromIDs(ctx context.Context, attempt int, instanceID, codeListID, dimensionName string, ids map[string]string, hasData bool) (err error) {\n\tlogData := log.Data{\"fn\": \"CloneNodesFromIDs\",\n\t\t\"instance_id\": instanceID,\n\t\t\"dimension_name\": dimensionName,\n\t\t\"code_list_id\": codeListID,\n\t\t\"has_data\": hasData,\n\t\t\"num_nodes\": len(ids),\n\t\t\"max_workers\": n.maxWorkers,\n\t\t\"batch_size\": n.batchSizeWriter,\n\t}\n\tlog.Info(ctx, \"cloning necessary nodes from the generic hierarchy\", logData)\n\n\tprocessBatch := func(chunkIDs map[string]string) (ret map[string]string, err error) {\n\t\tidsStr := `'` + strings.Join(createArray(chunkIDs), `','`) + `'`\n\t\tgremStmt := fmt.Sprintf(\n\t\t\tquery.CloneHierarchyNodesFromIDs,\n\t\t\tidsStr,\n\t\t\tinstanceID,\n\t\t\tdimensionName,\n\t\t\thasData,\n\t\t\tcodeListID,\n\t\t)\n\n\t\tif _, err = n.exec(gremStmt); err != nil {\n\t\t\tlog.Error(ctx, \"cannot get vertices during cloning\", err, logData)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, nil\n\t}\n\n\t_, _, errs := processInConcurrentBatches(ids, processBatch, n.batchSizeWriter, n.maxWorkers)\n\tif len(errs) > 0 {\n\t\treturn errs[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7099d0d762abbb0f9d8ce9aa286ae081", "score": "0.47992513", "text": "func restoreRouterHostIPs(n *nodeTypes.Node) {\n\tif !option.Config.EnableHostIPRestore {\n\t\treturn\n\t}\n\n\trouter4 := n.GetCiliumInternalIP(false)\n\trouter6 := n.GetCiliumInternalIP(true)\n\tif router4 != nil {\n\t\tnode.SetInternalIPv4Router(router4)\n\t}\n\tif router6 != nil {\n\t\tnode.SetIPv6Router(router6)\n\t}\n\tif router4 != nil || router6 != nil {\n\t\tlog.WithFields(logrus.Fields{\n\t\t\tlogfields.IPv4: router4,\n\t\t\tlogfields.IPv6: router6,\n\t\t}).Info(\"Restored router IPs from node information\")\n\t}\n}", "title": "" }, { "docid": "877529e93b4ff6e9bc15c1157d8fd953", "score": "0.47353628", "text": "func (p *NodePool) Reseed() {\n\tp.rw.Lock()\n\tdefer p.rw.Unlock()\n\n\tfor _, addr := range p.reseedNodes {\n\t\tp.nodes[addr] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "d4de23a1da8619c6dc5807a268240540", "score": "0.46681604", "text": "func (m *GroupMutation) RemoveNodeIDs(ids ...int) {\n\tif m.removednodes == nil {\n\t\tm.removednodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removednodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "152b80467bd85c6e6092fefc9c96c32d", "score": "0.4605959", "text": "func (m *UserMutation) RemoveNodeIDs(ids ...int) {\n\tif m.removednodes == nil {\n\t\tm.removednodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removednodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "32b78b3dae149deaec8a74727b4f1471", "score": "0.46046668", "text": "func (c *Client) cleanUpAllAssignedIdentitiesOnNode(node string, nodeTrackList trackUserAssignedMSIIds, wg *sync.WaitGroup) {\n\tdefer wg.Done()\n\tklog.Infof(\"deleting all assigned identites for %s as node not found\", node)\n\tfor _, deleteID := range nodeTrackList.assignedIDsToDelete {\n\t\tdeleteID := deleteID // avoid implicit memory aliasing in for loop\n\t\tbinding := deleteID.Spec.AzureBindingRef\n\n\t\terr := c.removeAssignedIdentity(&deleteID)\n\t\tif err != nil {\n\t\t\tmessage := fmt.Sprintf(\"failed to remove AzureIdentityBinding %s/%s from node %s for pod %s/%s, error: %v\", binding.Namespace, binding.Name, deleteID.Spec.NodeName, deleteID.Spec.PodNamespace, deleteID.Spec.Pod, err)\n\t\t\tc.EventRecorder.Event(binding, corev1.EventTypeWarning, \"binding remove error\", message)\n\t\t\tklog.Error(message)\n\t\t\tcontinue\n\t\t}\n\t\tc.EventRecorder.Event(binding, corev1.EventTypeNormal, \"binding removed\",\n\t\t\tfmt.Sprintf(\"Binding %s removed from node %s for pod %s\", binding.Name, deleteID.Spec.NodeName, deleteID.Spec.Pod))\n\t}\n}", "title": "" }, { "docid": "ea8b8c975f5754c1a85183f289876ac2", "score": "0.45573655", "text": "func (m *PermissionMutation) RemoveNodeIDs(ids ...int) {\n\tif m.removednodes == nil {\n\t\tm.removednodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.removednodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "821566449b79de2b2b49ad113232ba12", "score": "0.4556052", "text": "func (s *CacheParameterGroupStatus) SetCacheNodeIdsToReboot(v []*string) *CacheParameterGroupStatus {\n\ts.CacheNodeIdsToReboot = v\n\treturn s\n}", "title": "" }, { "docid": "817907c309a7c228b1714ea52fad17a3", "score": "0.45480657", "text": "func (pt *PortTable) RestoreRules(allNPLPorts []rules.PodNodePort, synced chan<- struct{}) error {\n\tpt.tableLock.Lock()\n\tdefer pt.tableLock.Unlock()\n\tfor _, nplPort := range allNPLPorts {\n\t\tprotocols, err := openSocketsForPort(pt.LocalPortOpener, nplPort.NodePort)\n\t\tif err != nil {\n\t\t\t// This will be handled gracefully by the NPL controller: if there is an\n\t\t\t// annotation using this port, it will be removed and replaced with a new\n\t\t\t// one with a valid port mapping.\n\t\t\tklog.ErrorS(err, \"Cannot bind to local port, skipping it\", \"port\", nplPort.NodePort)\n\t\t\tcloseSocketsOrRetry(protocols)\n\t\t\tcontinue\n\t\t}\n\n\t\tnpData := &NodePortData{\n\t\t\tNodePort: nplPort.NodePort,\n\t\t\tPodPort: nplPort.PodPort,\n\t\t\tPodIP: nplPort.PodIP,\n\t\t\tProtocols: protocols,\n\t\t}\n\t\tfor _, protocol := range nplPort.Protocols {\n\t\t\tprotocolSocketData := npData.FindProtocol(protocol)\n\t\t\tif protocolSocketData == nil {\n\t\t\t\treturn fmt.Errorf(\"unknown protocol %s\", protocol)\n\t\t\t}\n\t\t\tprotocolSocketData.State = stateInUse\n\t\t}\n\t\tpt.NodePortTable[strconv.Itoa(nplPort.NodePort)] = npData\n\t\tpt.PodEndpointTable[podIPPortFormat(nplPort.PodIP, nplPort.PodPort)] = pt.NodePortTable[strconv.Itoa(nplPort.NodePort)]\n\t}\n\t// retry mechanism as iptables-restore can fail if other components (in Antrea or other\n\t// software) are accessing iptables.\n\tgo func() {\n\t\tdefer close(synced)\n\t\tvar backoffTime = 2 * time.Second\n\t\tfor {\n\t\t\tif err := pt.syncRules(); err != nil {\n\t\t\t\tklog.ErrorS(err, \"Failed to restore iptables rules\", \"backoff\", backoffTime)\n\t\t\t\ttime.Sleep(backoffTime)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "83002e5d3fb29da83efdce83bd327cd1", "score": "0.45480153", "text": "func GetNodeNetworkIDsAnnotationNetworkIDs(node *kapi.Node) (map[string]int, error) {\n\tnetworkIDsStrMap, err := parseNetworkIDsAnnotation(node.Annotations, ovnNetworkIDs)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tnetworkIDsMap := map[string]int{}\n\tfor netName, v := range networkIDsStrMap {\n\t\tid, e := strconv.Atoi(v)\n\t\tif e == nil {\n\t\t\tnetworkIDsMap[netName] = id\n\t\t}\n\t}\n\n\treturn networkIDsMap, nil\n}", "title": "" }, { "docid": "ee46cf45713984569814e3d6c45083f0", "score": "0.45193103", "text": "func (pt *PortTable) RestoreRules(allNPLPorts []rules.PodNodePort, synced chan<- struct{}) error {\n\tpt.tableLock.Lock()\n\tdefer pt.tableLock.Unlock()\n\tfor _, nplPort := range allNPLPorts {\n\t\tprotocols, err := openSocketsForPort(pt.LocalPortOpener, nplPort.NodePort)\n\t\tif err != nil {\n\t\t\t// This will be handled gracefully by the NPL controller: if there is an\n\t\t\t// annotation using this port, it will be removed and replaced with a new\n\t\t\t// one with a valid port mapping.\n\t\t\tklog.ErrorS(err, \"Cannot bind to local port, skipping it\", \"port\", nplPort.NodePort)\n\t\t\tcloseSocketsOrRetry(protocols)\n\t\t\tcontinue\n\t\t}\n\n\t\tnpData := &NodePortData{\n\t\t\tNodePort: nplPort.NodePort,\n\t\t\tPodPort: nplPort.PodPort,\n\t\t\tPodIP: nplPort.PodIP,\n\t\t\tProtocols: protocols,\n\t\t}\n\t\tfor _, protocol := range nplPort.Protocols {\n\t\t\tprotocolSocketData := npData.FindProtocol(protocol)\n\t\t\tif protocolSocketData == nil {\n\t\t\t\treturn fmt.Errorf(\"unknown protocol %s\", protocol)\n\t\t\t}\n\t\t\tprotocolSocketData.State = stateInUse\n\t\t}\n\t\tpt.NodePortTable[nplPort.NodePort] = npData\n\t\tpt.PodEndpointTable[podIPPortFormat(nplPort.PodIP, nplPort.PodPort)] = pt.NodePortTable[nplPort.NodePort]\n\t}\n\t// retry mechanism as iptables-restore can fail if other components (in Antrea or other\n\t// software) are accessing iptables.\n\tgo func() {\n\t\tdefer close(synced)\n\t\tvar backoffTime = 2 * time.Second\n\t\tfor {\n\t\t\tif err := pt.syncRules(); err != nil {\n\t\t\t\tklog.ErrorS(err, \"Failed to restore iptables rules\", \"backoff\", backoffTime)\n\t\t\t\ttime.Sleep(backoffTime)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}()\n\treturn nil\n}", "title": "" }, { "docid": "08d2886bd0a95a150ec845df5e143834", "score": "0.45169318", "text": "func NodeIDs(sel interface{}, ids *[]cdp.NodeID, opts ...QueryOption) QueryAction {\n\tif ids == nil {\n\t\tpanic(\"nodes cannot be nil\")\n\t}\n\n\treturn QueryAfter(sel, func(ctx context.Context, execCtx runtime.ExecutionContextID, nodes ...*cdp.Node) error {\n\t\tnodeIDs := make([]cdp.NodeID, len(nodes))\n\t\tfor i, n := range nodes {\n\t\t\tnodeIDs[i] = n.NodeID\n\t\t}\n\n\t\t*ids = nodeIDs\n\n\t\treturn nil\n\t}, opts...)\n}", "title": "" }, { "docid": "b007445c5e44f0b7402b232b43ba8515", "score": "0.44518134", "text": "func (k RecordKeeper) ReverseMap(ctx sdk.Context, associatedKey sdk.StoreKey, associatedID uint64, fn func(uint64)) {\n\tprefix := fmt.Sprintf(\"%s:id:%d:\", associatedKey.Name(), associatedID)\n\tprefixBytes := []byte(prefix)\n\n\titer := sdk.KVStoreReversePrefixIterator(k.store(ctx), prefixBytes)\n\tdefer iter.Close()\n\tfor ; iter.Valid(); iter.Next() {\n\t\tvar id uint64\n\t\tk.codec.MustUnmarshalBinaryBare(iter.Value(), &id)\n\t\tfn(id)\n\t}\n}", "title": "" }, { "docid": "51b83ed5face09b1ff0991c2d10ebc16", "score": "0.44250652", "text": "func LoadNodeJobRunIDByNodeRunID(db gorp.SqlExecutor, runNodeID int64) ([]int64, error) {\n\tquery := `SELECT workflow_node_run_job.id FROM workflow_node_run_job WHERE workflow_node_run_id = $1`\n\trows, err := db.Query(query, runNodeID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer rows.Close()\n\tvar ids []int64\n\tfor rows.Next() {\n\t\tvar id int64\n\t\tif err := rows.Scan(&id); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tids = append(ids, id)\n\t}\n\treturn ids, nil\n}", "title": "" }, { "docid": "32934d73a8c43a7dc3722e8257f5654b", "score": "0.4385685", "text": "func (a *AccessList) flattenNodes(ctx context.Context, aclList []*idm.ACL) (map[string]Bitmask, map[string]map[string]Bitmask) {\n\n\tflattenedNodes := make(map[string]Bitmask)\n\tflattenedWorkspaces := make(map[string]map[string]Bitmask)\n\n\tdetectedWorkspaces := make(map[string]map[string]string)\n\troles := make(map[string]map[string]Bitmask)\n\n\t// Create Bitmasks for each node, for each role\n\tfor _, acl := range aclList {\n\t\tif acl.NodeID == \"\" {\n\t\t\tcontinue\n\t\t}\n\t\tvar roleNodes map[string]Bitmask\n\t\tif test, ok := roles[acl.RoleID]; ok {\n\t\t\troleNodes = test\n\t\t} else {\n\t\t\troleNodes = make(map[string]Bitmask)\n\t\t}\n\n\t\tvar nodeAcls Bitmask\n\t\tif test, ok := roleNodes[acl.NodeID]; ok {\n\t\t\tnodeAcls = test\n\t\t} else {\n\t\t\tnodeAcls = Bitmask{}\n\t\t}\n\t\tif flag, ok := NamesToFlags[acl.Action.Name]; ok {\n\t\t\tif flag == FLAG_POLICY {\n\t\t\t\tnodeAcls.AddPolicyFlag(acl.Action.Value)\n\t\t\t} else if flag == FLAG_QUOTA {\n\t\t\t\tnodeAcls.AddValueFlag(flag, acl.Action.Value)\n\t\t\t} else {\n\t\t\t\tnodeAcls.AddFlag(flag)\n\t\t\t}\n\t\t}\n\n\t\troleNodes[acl.NodeID] = nodeAcls\n\t\troles[acl.RoleID] = roleNodes\n\n\t\tif acl.WorkspaceID != \"\" {\n\t\t\tif _, ok := detectedWorkspaces[acl.WorkspaceID]; !ok {\n\t\t\t\tdetectedWorkspaces[acl.WorkspaceID] = make(map[string]string)\n\t\t\t}\n\t\t\tdetectedWorkspaces[acl.WorkspaceID][acl.NodeID] = acl.NodeID\n\t\t}\n\t}\n\n\t// Now flatten on roles : last role wins on each node\n\tfor _, role := range a.OrderedRoles {\n\t\tif roleNodes, ok := roles[role.Uuid]; ok {\n\t\t\tfor nodeId, bitmask := range roleNodes {\n\t\t\t\tflattenedNodes[nodeId] = bitmask\n\t\t\t}\n\t\t}\n\t}\n\tfor workspaceId, workspaceRootNodes := range detectedWorkspaces {\n\t\twsRoots := make(map[string]Bitmask)\n\t\tfor nodeId, _ := range workspaceRootNodes {\n\t\t\tmask := flattenedNodes[nodeId]\n\t\t\tif !mask.HasFlag(ctx, FLAG_DENY) {\n\t\t\t\twsRoots[nodeId] = mask\n\t\t\t}\n\t\t}\n\t\tif len(wsRoots) > 0 {\n\t\t\tflattenedWorkspaces[workspaceId] = wsRoots\n\t\t}\n\t}\n\n\treturn flattenedNodes, flattenedWorkspaces\n}", "title": "" }, { "docid": "29ee74e9b2d25f74fa3e807820b587d2", "score": "0.43844926", "text": "func (s *DaprHostMemberState) restoreHashingTables() {\n\tif s.data.hashingTableMap == nil {\n\t\ts.data.hashingTableMap = map[string]*hashing.Consistent{}\n\t}\n\n\tfor _, m := range s.data.Members {\n\t\ts.updateHashingTables(m)\n\t}\n}", "title": "" }, { "docid": "3dc3ac8ee80a7a944506d599b11c25eb", "score": "0.43756968", "text": "func (vind *Hash) ReverseMap(_ VCursor, ksids [][]byte) ([]sqltypes.Value, error) {\n\treverseIds := make([]sqltypes.Value, 0, len(ksids))\n\tfor _, keyspaceID := range ksids {\n\t\tval, err := vunhash(keyspaceID)\n\t\tif err != nil {\n\t\t\treturn reverseIds, err\n\t\t}\n\t\treverseIds = append(reverseIds, sqltypes.NewUint64(val))\n\t}\n\treturn reverseIds, nil\n}", "title": "" }, { "docid": "56781fca497d55df4874b4b4da2f7f40", "score": "0.43270513", "text": "func (m *UserMutation) AddNodeIDs(ids ...int) {\n\tif m.nodes == nil {\n\t\tm.nodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.nodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "8bd7b792ad9aaeb71a5f5ed41dca0321", "score": "0.43267214", "text": "func (tab *Table) copyBondedNodes() {\n\ttab.mutex.Lock()\n\tdefer tab.mutex.Unlock()\n\n\tfor _, b := range tab.buckets {\n\t\tfor _, n := range b.entries {\n\t\t\ttab.db.updateNode(n)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "c31a156b9e6f77978ab9379fc9519673", "score": "0.4313501", "text": "func (m *PermissionMutation) AddNodeIDs(ids ...int) {\n\tif m.nodes == nil {\n\t\tm.nodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.nodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "e41f3e899f498d707eee87a707dbb66f", "score": "0.4293248", "text": "func (m *GroupMutation) AddNodeIDs(ids ...int) {\n\tif m.nodes == nil {\n\t\tm.nodes = make(map[int]struct{})\n\t}\n\tfor i := range ids {\n\t\tm.nodes[ids[i]] = struct{}{}\n\t}\n}", "title": "" }, { "docid": "fe800ead9f0bc8c146d8abe927801032", "score": "0.42885146", "text": "func (wn WayNodes) NodeIDs() []NodeID {\n\tids := make([]NodeID, len(wn))\n\tfor i, n := range wn {\n\t\tids[i] = n.ID\n\t}\n\n\treturn ids\n}", "title": "" }, { "docid": "58890b3e2ca941e0c5e54fcbaef40ffe", "score": "0.42828912", "text": "func (s *RebootCacheClusterInput) SetCacheNodeIdsToReboot(v []*string) *RebootCacheClusterInput {\n\ts.CacheNodeIdsToReboot = v\n\treturn s\n}", "title": "" }, { "docid": "5b5baf210965cb4945bdb0c53f865fd1", "score": "0.42475516", "text": "func RestoreID(l3n4Addr loadbalancer.L3n4Addr, id uint32) (*loadbalancer.L3n4AddrID, error) {\n\tlog.WithField(logfields.L3n4Addr, logfields.Repr(l3n4Addr)).Debug(\"Restoring service\")\n\n\treturn serviceIDAlloc.acquireLocalID(l3n4Addr, id)\n}", "title": "" }, { "docid": "cb292cb7ff180c9b1ae785cef8856ff3", "score": "0.42442885", "text": "func (r *HashRing) GetNodeExcludedNodeIDs(key string, NodeIDs []string) (uint32, string) {\n\n\tif len(NodeIDs) <= 0 {\n\t\treturn r.GetNode(key)\n\t}\n\n\tif uint32(len(NodeIDs)) >= r.NodeCount || r.NodeCount <= 0 {\n\t\treturn 0, \"\"\n\t}\n\n\tfor _, id := range NodeIDs {\n\t\tr.SetOffline(id)\n\t}\n\n\tindex, id := r.GetNode(key)\n\treturn index, id\n\n\t//tmpRing := New(r.NumberOfVirtual)\n\t//r.Nodes.Range(func(key, value interface{}) bool {\n\t//\tnode := value.(*Node)\n\t//\tif !utils.StrInSlices(NodeIDs, node.ID) {\n\t//\t\ttmpRing.AddNode(&Node{\n\t//\t\t\tID: node.ID,\n\t//\t\t\tHost: node.Host,\n\t//\t\t})\n\t//\t}\n\t//\treturn true\n\t//})\n\t//\n\t//if tmpRing.NodeCount > 0 {\n\t//\treturn tmpRing.GetNode(key)\n\t//}\n\n}", "title": "" }, { "docid": "20d30df51ff0c315dc715ae0105be957", "score": "0.4237186", "text": "func (n *linuxNodeHandler) allocateIDForNode(node *nodeTypes.Node) (uint16, error) {\n\tvar errs error\n\n\t// Did we already allocate a node ID for any IP of that node?\n\tnodeID := n.getNodeIDForNode(node)\n\n\tif nodeID == 0 {\n\t\tnodeID = uint16(n.nodeIDs.AllocateID())\n\t\tif nodeID == uint16(idpool.NoID) {\n\t\t\tlog.WithField(logfields.NodeName, node.Name).Error(\"No more IDs available for nodes\")\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"no available node ID %q\", node.Name))\n\t\t} else {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\tlogfields.NodeID: nodeID,\n\t\t\t\tlogfields.NodeName: node.Name,\n\t\t\t}).Debug(\"Allocated new node ID for node\")\n\t\t}\n\t}\n\n\tfor _, addr := range node.IPAddresses {\n\t\tip := addr.IP.String()\n\t\tif _, exists := n.nodeIDsByIPs[ip]; exists {\n\t\t\tcontinue\n\t\t}\n\t\tif err := n.mapNodeID(ip, nodeID); err != nil {\n\t\t\tlog.WithError(err).WithFields(logrus.Fields{\n\t\t\t\tlogfields.NodeID: nodeID,\n\t\t\t\tlogfields.IPAddr: ip,\n\t\t\t}).Error(\"Failed to map node IP address to allocated ID\")\n\t\t\terrs = errors.Join(errs,\n\t\t\t\tfmt.Errorf(\"failed to map IP %q with node ID %q: %w\", nodeID, nodeID, err))\n\t\t}\n\t}\n\treturn nodeID, errs\n}", "title": "" }, { "docid": "4e889a272b89698689a1114e0cda1ee3", "score": "0.42302504", "text": "func RestoreIrqBalanceConfig(irqBalanceConfigFile, irqBannedCPUConfigFile, irqSmpAffinityProcFile string) error {\n\tcontent, err := os.ReadFile(irqSmpAffinityProcFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcurrent := strings.TrimSpace(string(content))\n\t// remove \",\"; now each element is \"0-9,a-f\"\n\ts := strings.ReplaceAll(current, \",\", \"\")\n\tcurrentMaskArray, err := mapHexCharToByte(s)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif !isAllBitSet(currentMaskArray) {\n\t\t// not system reboot scenario, just return it.\n\t\treturn nil\n\t}\n\n\tbannedCPUMasks, err := retrieveIrqBannedCPUMasks(irqBalanceConfigFile)\n\tif err != nil {\n\t\t// Ignore returning err as given irqBalanceConfigFile may not exist.\n\t\treturn nil\n\t}\n\tif !fileExists(irqBannedCPUConfigFile) {\n\t\tirqBannedCPUsConfig, err := os.Create(irqBannedCPUConfigFile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdefer irqBannedCPUsConfig.Close()\n\t\t_, err = irqBannedCPUsConfig.WriteString(bannedCPUMasks)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tcontent, err = os.ReadFile(irqBannedCPUConfigFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\torigBannedCPUMasks := strings.TrimSpace(string(content))\n\n\tif bannedCPUMasks == origBannedCPUMasks {\n\t\treturn nil\n\t}\n\tif err := updateIrqBalanceConfigFile(irqBalanceConfigFile, origBannedCPUMasks); err != nil {\n\t\treturn err\n\t}\n\tif isServiceEnabled(irqBalancedName) {\n\t\tif err := restartIrqBalanceService(); err != nil {\n\t\t\tlogrus.Warnf(\"Irqbalance service restart failed: %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a96a597d89e6c3ad5a58205ef0a484ac", "score": "0.4189604", "text": "func (m *Manager) RestoreSnapshot() {\n\t//TODO: we should use process_vm_writev here (ProcessVMWritev)\n\t//log.Printf(\"Restoring snapshot for PID %d\", m.Pid)\n\tfor _, s := range m.writableSections {\n\n\t\t//data := []byte{0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1}\n\t\t//log.Printf(\"Restoring 0x%x-0x%x [%d bytes | backing %p] - %s - %s\", s.From, s.To, len(s.Content), &s.Content[0], s.Perms, s.Module)\n\n\t\tlocalIovec := unix.Iovec{Base: &s.Content[0], Len: uint64(len(s.Content))}\n\t\tremoteIovec := unix.RemoteIovec{Base: uintptr(s.From), Len: len(s.Content)}\n\n\t\tvar localIovecs []unix.Iovec\n\t\tvar remoteIovecs []unix.RemoteIovec\n\t\tlocalIovecs = append(localIovecs, localIovec)\n\t\tremoteIovecs = append(remoteIovecs, remoteIovec)\n\n\t\t//log.Printf(\"Almost ready to restore process %d\", m.Pid)\n\t\t//bufio.NewReader(os.Stdin).ReadBytes('\\n')\n\n\t\twritten, err := unix.ProcessVMWritev(m.Pid, localIovecs, remoteIovecs, 0)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\t//log.Printf(\"Restoring 0x%x-0x%x [%d bytes] - %s - %s\", s.From, s.To, s.Size, s.Perms, s.Module)\n\t\t//written := ptrace.Write(m.Pid, uintptr(s.From), s.Content)\n\t\tif uint64(written) != s.Size {\n\t\t\tlog.Panicf(\"Failed to write all %d bytes to Target process, wrote %d only!\", s.Size, written)\n\t\t}\n\t}\n\tptrace.RestoreRegisters(m.Pid, &m.registers)\n\t//log.Printf(\"Registers restored! EIP: 0x%x\", m.registers.PC())\n}", "title": "" }, { "docid": "95b3ea9762e54a971adad65679bfafa8", "score": "0.4186258", "text": "func (tab *Table) setFallbackNodes(nodes []*Node) error {\n\tfor _, n := range nodes {\n\t\tif err := n.validateComplete(); err != nil {\n\t\t\treturn fmt.Errorf(\"bad bootstrap/fallback node %q (%v)\", n, err)\n\t\t}\n\t}\n\ttab.nursery = make([]*Node, 0, len(nodes))\n\tfor _, n := range nodes {\n\t\tcpy := *n\n\t\t// Recompute cpy.sha because the node might not have been\n\t\t// created by NewNode or ParseNode.\n\t\tcpy.sha = crypto.Keccak256Hash(n.ID[:])\n\t\ttab.nursery = append(tab.nursery, &cpy)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "742e57930eb59a01f48ac2ec7e2faa0e", "score": "0.41806227", "text": "func (n *NeptuneDB) GetHierarchyNodeIDs(ctx context.Context, attempt int, instanceID, dimensionName string) (ids map[string]string, err error) {\n\tstmt := fmt.Sprintf(\n\t\tquery.GetHierarchyNodeIDs,\n\t\tinstanceID,\n\t\tdimensionName,\n\t)\n\tlogData := log.Data{\n\t\t\"fn\": \"GetHierarchyNodeIDs\",\n\t\t\"instance_id\": instanceID,\n\t\t\"dimension_name\": dimensionName,\n\t\t\"gremlin\": stmt,\n\t}\n\tlog.Info(ctx, \"getting ids of cloned hierarchy nodes\", logData)\n\n\tidList, err := n.getStringList(stmt)\n\tif err != nil {\n\t\treturn nil, errors.Wrapf(err, \"Gremlin query failed: %q\", stmt)\n\t}\n\treturn createStringMapFromArrays(idList), nil\n}", "title": "" }, { "docid": "9ff79409827464bbc9e25e18bcdc3fdd", "score": "0.41786373", "text": "func getTaxid2LineageTaxids(fileNodes string) (\n\tmap[uint32][]uint32, // taxid2lineageTaxids\n\tmap[uint32]string, // taxid2rank\n) {\n\tvar tree map[uint32]uint32\n\tvar ranks map[uint32]string\n\n\ttree, ranks = getNodes(fileNodes, true)\n\n\ttaxid2lineageTaxids := make(map[uint32][]uint32, mapInitialSize)\n\n\tvar ok bool\n\tvar i, j int\n\tvar child, parent uint32\n\tfor taxid := range tree {\n\t\tlineageTaxids := make([]uint32, 0, 8)\n\t\tchild = taxid\n\t\tfor true {\n\t\t\tparent, ok = tree[child]\n\t\t\tif !ok {\n\t\t\t\tbreak\n\t\t\t}\n\n\t\t\tlineageTaxids = append(lineageTaxids, child)\n\n\t\t\tif parent == 1 {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tchild = parent\n\t\t}\n\n\t\t// reverse lineageTaxids in place\n\t\tfor i = len(lineageTaxids)/2 - 1; i >= 0; i-- {\n\t\t\tj = len(lineageTaxids) - 1 - i\n\t\t\tlineageTaxids[i], lineageTaxids[j] = lineageTaxids[j], lineageTaxids[i]\n\t\t}\n\t\ttaxid2lineageTaxids[taxid] = lineageTaxids\n\t}\n\treturn taxid2lineageTaxids, ranks\n}", "title": "" }, { "docid": "abe9947d7ccc42b62878e47c9b4b67a1", "score": "0.41639143", "text": "func (n *NeptuneDB) RemoveCloneEdgesFromSourceIDs(ctx context.Context, attempt int, ids map[string]string) (err error) {\n\tlogData := log.Data{\n\t\t\"fn\": \"RemoveCloneEdges\",\n\t\t\"num_ids\": len(ids),\n\t\t\"max_workers\": n.maxWorkers,\n\t\t\"batch_size\": n.batchSizeWriter,\n\t}\n\tlog.Info(ctx, \"removing edges to generic hierarchy\", logData)\n\n\tprocessBatch := func(chunkIDs map[string]string) (ret map[string]string, err error) {\n\t\tidsStr := `'` + strings.Join(createArray(chunkIDs), `','`) + `'`\n\t\tgremStmt := fmt.Sprintf(\n\t\t\tquery.RemoveCloneMarkersFromSourceIDs,\n\t\t\tidsStr,\n\t\t)\n\n\t\tif _, err = n.exec(gremStmt); err != nil {\n\t\t\tlog.Error(ctx, \"exec failed while removing edges during removal of unwanted cloned edges\", err, logData)\n\t\t\treturn\n\t\t}\n\t\treturn\n\t}\n\n\t_, _, errs := processInConcurrentBatches(ids, processBatch, n.batchSizeWriter, n.maxWorkers)\n\tif len(errs) > 0 {\n\t\treturn errs[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "567c8e524da74319f83d58fbe95b6144", "score": "0.41572735", "text": "func (f *fsm) Restore(rc io.ReadCloser) error {\n\tvar str string\n\tif err := json.NewDecoder(rc).Decode(&str); err != nil {\n\t\treturn err\n\t}\n\tf.leaderAddr = str\n\n\treturn nil\n}", "title": "" }, { "docid": "4ddd7a6152a708d46e7c5a0fd16b02c9", "score": "0.41567028", "text": "func (this *ContractCreateFlow) SetNodeAccountIDs(nodeID []AccountID) *ContractCreateFlow {\n\tthis._RequireNotFrozen()\n\tthis.nodeAccountIDs = nodeID\n\treturn this\n}", "title": "" }, { "docid": "278d622bd25c6a5aa1c79fe871e2841c", "score": "0.41382006", "text": "func RunServerActionRestore(c *CmdConfig) error {\n\tfn := func(das bl.ServerActionsService) (*bl.Action, error) {\n\t\terr := ensureOneArg(c)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tid, err := strconv.Atoi(c.Args[0])\n\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\timage, err := c.Doit.GetInt(c.NS, blcli.ArgImageID)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\ta, err := das.Restore(id, image)\n\t\treturn a, err\n\t}\n\n\treturn performAction(c, fn)\n}", "title": "" }, { "docid": "02e3310c8706e9c94fa3d72538ec68e2", "score": "0.41101828", "text": "func EnsureOrigClusterState(t *testing.T) {\n\tif len(restoreNodes) == 0 {\n\t\treturn\n\t}\n\tvar (\n\t\tproxyURL = RandomProxyURL()\n\t\tsmap = GetClusterMap(t, proxyURL)\n\t\tbaseParam = BaseAPIParams(proxyURL)\n\t\tafterProxyCnt = smap.CountActivePs()\n\t\tafterTargetCnt = smap.CountActiveTs()\n\t\ttgtCnt int\n\t\tproxyCnt int\n\t\tupdated bool\n\t\tretried bool\n\t)\nretry:\n\tfor _, cmd := range restoreNodes {\n\t\tnode := smap.GetNode(cmd.Node.ID())\n\t\tif node == nil && !retried {\n\t\t\ttlog.Logf(\"Warning: %s %s not found in %s - retrying...\", cmd.Node.Type(), cmd.Node.ID(), smap.StringEx())\n\t\t\ttime.Sleep(4 * time.Second)\n\t\t\tsmap = GetClusterMap(t, proxyURL)\n\t\t\t// alternatively, could simply compare versions\n\t\t\tretried = true\n\t\t\tgoto retry\n\t\t}\n\t}\n\t// restore\n\tfor _, cmd := range restoreNodes {\n\t\tif cmd.Node.IsProxy() {\n\t\t\tproxyCnt++\n\t\t} else {\n\t\t\ttgtCnt++\n\t\t}\n\t\tnode := smap.GetNode(cmd.Node.ID())\n\t\tif node != nil {\n\t\t\ttassert.Errorf(t, node.Equals(cmd.Node),\n\t\t\t\t\"%s %s changed, before %+v, after %+v\", cmd.Node.Type(), node.ID(), cmd.Node, node)\n\t\t} else {\n\t\t\ttassert.Errorf(t, false, \"%s %s not found in %s\", cmd.Node.Type(), cmd.Node.ID(), smap.StringEx())\n\t\t}\n\t\tif docker.IsRunning() {\n\t\t\tif node == nil {\n\t\t\t\terr := RestoreNode(cmd, false, cmd.Node.Type())\n\t\t\t\ttassert.CheckError(t, err)\n\t\t\t\tupdated = true\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\t_, err := getPID(cmd.Node.PubNet.Port)\n\t\tif err != nil {\n\t\t\ttassert.CheckError(t, err)\n\t\t\tif err = RestoreNode(cmd, false, cmd.Node.Type()); err == nil {\n\t\t\t\t_, err := WaitNodeAdded(baseParam, cmd.Node.ID())\n\t\t\t\ttassert.CheckError(t, err)\n\t\t\t}\n\t\t\ttassert.CheckError(t, err)\n\t\t\tupdated = true\n\t\t}\n\t}\n\n\ttassert.Errorf(t, afterProxyCnt == proxyCnt, \"Some proxies crashed(?): expected %d, have %d\", proxyCnt, afterProxyCnt)\n\ttassert.Errorf(t, tgtCnt == afterTargetCnt, \"Some targets crashed(?): expected %d, have %d\", tgtCnt, afterTargetCnt)\n\n\tif !updated {\n\t\treturn\n\t}\n\n\t_, err := WaitForClusterState(proxyURL, \"cluster to stabilize\", smap.Version, proxyCnt, tgtCnt)\n\ttassert.CheckFatal(t, err)\n\n\tif tgtCnt != afterTargetCnt {\n\t\tWaitForRebalAndResil(t, BaseAPIParams(proxyURL))\n\t}\n}", "title": "" }, { "docid": "35defd2e208b3a33401713b3024edaa3", "score": "0.41031998", "text": "func (n *linuxNodeHandler) deallocateIDForNode(oldNode *nodeTypes.Node) error {\n\tvar errs error\n\tnodeIPs := make(map[string]bool)\n\tnodeID := n.getNodeIDForNode(oldNode)\n\n\t// Check that all node IDs of the node had the same node ID.\n\tfor _, addr := range oldNode.IPAddresses {\n\t\tnodeIPs[addr.IP.String()] = true\n\t\tid := n.nodeIDsByIPs[addr.IP.String()]\n\t\tif nodeID != id {\n\t\t\tlog.WithFields(logrus.Fields{\n\t\t\t\tlogfields.NodeName: oldNode.Name,\n\t\t\t\tlogfields.IPAddr: addr.IP,\n\t\t\t}).Errorf(\"Found two node IDs (%d and %d) for the same node\", id, nodeID)\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"found two node IDs (%d and %d) for the same node\", id, nodeID))\n\t\t}\n\t}\n\n\terrs = errors.Join(n.deallocateNodeIDLocked(nodeID, nodeIPs, oldNode.Name))\n\treturn errs\n}", "title": "" }, { "docid": "524ed5b7a0b8d897459bb3565d294540", "score": "0.41008842", "text": "func (n *NodeLabelMap) ResetLabels(nodeName string) {\n\tfor label := range n.m[nodeName] {\n\t\tn.m[nodeName][label] = false\n\t}\n}", "title": "" }, { "docid": "a123b5b6ca8f3d7a7d5c4028a57a7afa", "score": "0.40935916", "text": "func (_SystemUsersInfo *SystemUsersInfoCallerSession) MapFromAddrToIDRC(arg0 common.Address) (*big.Int, error) {\n\treturn _SystemUsersInfo.Contract.MapFromAddrToIDRC(&_SystemUsersInfo.CallOpts, arg0)\n}", "title": "" }, { "docid": "0f112881b3eebb03f5cd93345ec23497", "score": "0.40921074", "text": "func (_SystemUsersInfo *SystemUsersInfoSession) MapFromAddrToIDRC(arg0 common.Address) (*big.Int, error) {\n\treturn _SystemUsersInfo.Contract.MapFromAddrToIDRC(&_SystemUsersInfo.CallOpts, arg0)\n}", "title": "" }, { "docid": "8db5e2a416a425aa59d4310ea5db1dfa", "score": "0.40905356", "text": "func crashAndFastRestore(t *testing.T) {\n\tvar err error\n\tproxyURL := tools.RandomProxyURL(t)\n\tsmap := tools.GetClusterMap(t, proxyURL)\n\ttlog.Logf(\"targets: %d, proxies: %d\\n\", smap.CountActiveTs(), smap.CountActivePs())\n\n\t// Make sure proxyURL is not primary URL.\n\t_, proxyURL, err = chooseNextProxy(smap)\n\ttassert.CheckFatal(t, err)\n\toldPrimaryID := smap.Primary.ID()\n\ttlog.Logf(\"The current primary %s, Smap version %d\\n\", oldPrimaryID, smap.Version)\n\n\tcmd, err := tools.KillNode(smap.Primary)\n\ttassert.CheckFatal(t, err)\n\n\t// quick crash and recover\n\ttime.Sleep(2 * time.Second)\n\terr = tools.RestoreNode(cmd, true, \"proxy (primary)\")\n\ttassert.CheckFatal(t, err)\n\n\ttlog.Logf(\"The %s is currently restarting\\n\", oldPrimaryID)\n\n\t// NOTE: using (version - 1) because the primary will restart with its old version,\n\t// there will be no version change for this restore, so force beginning version to 1 less\n\t// than the original version in order to use WaitForClusterState.\n\tsmap, err = tools.WaitForClusterState(proxyURL, \"restore\", smap.Version-1, 0, 0)\n\ttassert.CheckFatal(t, err)\n\n\tif smap.Primary.ID() != oldPrimaryID {\n\t\tt.Fatalf(\"Wrong primary proxy: %s, expecting: %s\", smap.Primary.ID(), oldPrimaryID)\n\t}\n}", "title": "" }, { "docid": "58a8c1f82004e7a7ae0b3a45489fffb5", "score": "0.40796167", "text": "func (a *Client) RestoreNodes(params *RestoreNodesParams) (*RestoreNodesOK, error) {\n\t// TODO: Validate the params before sending\n\tif params == nil {\n\t\tparams = NewRestoreNodesParams()\n\t}\n\n\tresult, err := a.transport.Submit(&runtime.ClientOperation{\n\t\tID: \"RestoreNodes\",\n\t\tMethod: \"POST\",\n\t\tPathPattern: \"/tree/restore\",\n\t\tProducesMediaTypes: []string{\"application/json\"},\n\t\tConsumesMediaTypes: []string{\"application/json\"},\n\t\tSchemes: []string{\"http\", \"https\", \"wss\"},\n\t\tParams: params,\n\t\tReader: &RestoreNodesReader{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.(*RestoreNodesOK), nil\n\n}", "title": "" }, { "docid": "f6d0996dae7fb6161de77a1a0a3d1397", "score": "0.40724707", "text": "func (c *Client) unassignIPsFromEni(eniID string, addrs []string) error {\n\treq := &ec2.UnassignPrivateIpAddressesInput{}\n\treq.SetNetworkInterfaceId(eniID)\n\treq.SetPrivateIpAddresses(aws.StringSlice(addrs))\n\n\tblog.V(2).Infof(\"aws UnassignPrivateIpAddresses request %s\", req.String())\n\n\tresp, err := c.ec2client.UnassignPrivateIpAddresses(req)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unassign private ip addresses failed, err %s\", err.Error())\n\t}\n\n\tblog.V(2).Infof(\"aws UnassignPrivateIpAddresses response %s\", resp.String())\n\treturn nil\n}", "title": "" }, { "docid": "9b96ac6bb4e273db25047a380049e2d0", "score": "0.40696612", "text": "func (_SystemUsersInfo *SystemUsersInfoCaller) MapFromAddrToIDRC(opts *bind.CallOpts, arg0 common.Address) (*big.Int, error) {\n\tvar (\n\t\tret0 = new(*big.Int)\n\t)\n\tout := ret0\n\terr := _SystemUsersInfo.contract.Call(opts, out, \"mapFromAddrToID_RC\", arg0)\n\treturn *ret0, err\n}", "title": "" }, { "docid": "bee227151b43cb06bb900a6440bb1d22", "score": "0.4061657", "text": "func (callbacks *TestProcessorCallbacks) ResetUnneededNodes() {\n\treturn\n}", "title": "" }, { "docid": "fd748ac0d69d5559d2c14d8f2c11182a", "score": "0.40547755", "text": "func InitializeNodeValidatorFiles(config *cfg.Config) (nodeID string, valPubKey crypto.PubKey, err error) {\n\tnodeKey, err := p2p.LoadOrGenNodeKey(config.NodeKeyFile())\n\tif err != nil {\n\t\treturn\n\t}\n\tnodeID = string(nodeKey.ID())\n\tvalPubKey = ReadOrCreatePrivValidator(config.PrivValidatorFile())\n\treturn\n}", "title": "" }, { "docid": "aa1bdd2fbe982fdc8ea0845d0fecb160", "score": "0.40537584", "text": "func saveAllIdmap(datdir string, txmap util.Set2D) {\n\tns := \"ftp://ftp.uniprot.org/pub/databases/uniprot/current_release/knowledgebase/reference_proteomes/Eukaryota/\"\n\tfor txid := range txmap {\n\t\tmask := fmt.Sprintf(\"_%s%s\", txid, \".idmapping.gz\")\n\t\tsubdir := \"idmapping/\"\n\t\tddir := datdir + subdir\n\t\tif err := Rwget(ns, mask, ddir); err != nil {\n\t\t\tlog.Println(\"Warning: Failed to download data for:\", txid, err)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "802822d761da351c59ff73429d5eb3a6", "score": "0.40473297", "text": "func (nibd NodeIdentitiesByID) IdentityToID(identity []byte) (uint64, bool) {\n\tsID := &msp.SerializedIdentity{}\n\tif err := proto.Unmarshal(identity, sID); err != nil {\n\t\treturn 0, false\n\t}\n\tfor id, currIdentity := range nibd {\n\t\tcurrentID := &msp.SerializedIdentity{}\n\t\tif err := proto.Unmarshal(currIdentity, currentID); err != nil {\n\t\t\treturn 0, false\n\t\t}\n\t\tif proto.Equal(currentID, sID) {\n\t\t\treturn id, true\n\t\t}\n\t}\n\treturn 0, false\n}", "title": "" }, { "docid": "239f6690ef85686d71a93609d1cb6288", "score": "0.40418506", "text": "func killRestoreIC(t *testing.T, smap *meta.Smap, stopCh *cos.StopCh, wg *sync.WaitGroup) {\n\tvar (\n\t\tcmd tools.RestoreCmd\n\t\tproxyURL = smap.Primary.URL(cmn.NetPublic)\n\t)\n\tdefer wg.Done()\n\n\tfor {\n\t\tcmd, smap = killRandNonPrimaryIC(t, smap)\n\t\terr := tools.RestoreNode(cmd, false, \"proxy\")\n\t\ttassert.CheckFatal(t, err)\n\n\t\tsmap, err = tools.WaitForClusterState(proxyURL, \"restore\", smap.Version, 0, 0)\n\t\ttassert.CheckFatal(t, err)\n\t\ttime.Sleep(2 * time.Second)\n\n\t\tselect {\n\t\tcase <-stopCh.Listen():\n\t\t\treturn\n\t\tdefault:\n\t\t\tbreak\n\t\t}\n\t}\n}", "title": "" }, { "docid": "800e71e8bf361e88197152a201771db4", "score": "0.40416923", "text": "func (n *NeptuneDB) CloneOrderFromIDs(ctx context.Context, codeListID string, ids map[string]string) (err error) {\n\tlogData := log.Data{\"fn\": \"CloneOrderFromIDs\",\n\t\t\"code_list_id\": codeListID,\n\t\t\"num_nodes\": len(ids),\n\t\t\"max_workers\": n.maxWorkers,\n\t\t\"batch_size\": n.batchSizeWriter,\n\t}\n\tlog.Info(ctx, \"cloning order property corresponding to the code of the generic hierarchy nodes\", logData)\n\n\tprocessBatch := func(chunkIDs map[string]string) (ret map[string]string, err error) {\n\t\tidsStr := `'` + strings.Join(createArray(chunkIDs), `','`) + `'`\n\t\tgremStmt := fmt.Sprintf(\n\t\t\tquery.CloneOrderFromIDs,\n\t\t\tidsStr,\n\t\t\tcodeListID,\n\t\t)\n\n\t\tif _, err = n.exec(gremStmt); err != nil {\n\t\t\tlog.Error(ctx, \"cannot get vertices during cloning\", err, logData)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, nil\n\t}\n\n\t_, _, errs := processInConcurrentBatches(ids, processBatch, n.batchSizeWriter, n.maxWorkers)\n\tif len(errs) > 0 {\n\t\treturn errs[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4db3364e108fde416bfeb8c95524dd55", "score": "0.40362376", "text": "func (s *remoteCNIserver) handleNodeEvents(ctx context.Context, resyncChan chan datasync.ResyncEvent, changeChan chan datasync.ChangeEvent) {\n\tfor {\n\t\tselect {\n\t\tcase resyncEv := <-resyncChan:\n\n\t\t\terr := s.nodeResync(resyncEv)\n\t\t\tresyncEv.Done(err)\n\t\tcase changeEv := <-changeChan:\n\t\t\terr := s.nodeChangePropageteEvent(changeEv)\n\t\t\tchangeEv.Done(err)\n\t\tcase <-ctx.Done():\n\t\t\treturn\n\t\t}\n\t}\n}", "title": "" }, { "docid": "1b364de6352fe845a9a83d8e64a6228d", "score": "0.4035422", "text": "func (regInputs *RegisteredInputs) SetNodeID(nodeHWID string, newNodeID string) {\n\tinputList := regInputs.GetInputsByNodeHWID(nodeHWID)\n\tfor _, input := range inputList {\n\t\tnewAddress := MakeInputDiscoveryAddress(\n\t\t\tregInputs.domain, regInputs.publisherID, newNodeID, input.InputType, input.Instance)\n\t\tinput.Address = newAddress\n\t\t// input.NodeID = newNodeID\n\t\tregInputs.updateMutex.Lock()\n\t\tregInputs.updateInput(input, nil)\n\t\tregInputs.updateMutex.Unlock()\n\t}\n}", "title": "" }, { "docid": "6db925554ada2c7f68b734d996193dc3", "score": "0.4035316", "text": "func (qg *QGraph) GetNodeIDs() ([]string, error) {\n\tvar ids []string\n\tfor k := range qg.Nodes {\n\t\tids = append(ids, k)\n\t}\n\tsort.Strings(ids)\n\treturn ids, nil\n}", "title": "" }, { "docid": "a787e4777679c098ee4c64ebd15ba7e3", "score": "0.4026451", "text": "func Pinned(node *core.IpfsNode, cids []string) ([]icid.Cid, error) {\n\tvar decoded []icid.Cid\n\tfor _, id := range cids {\n\t\tdec, err := icid.Decode(id)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tdecoded = append(decoded, dec)\n\t}\n\tlist, err := node.Pinning.CheckIfPinned(decoded...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar pinned []icid.Cid\n\tfor _, p := range list {\n\t\tif p.Mode != pin.NotPinned {\n\t\t\tpinned = append(pinned, p.Key)\n\t\t}\n\t}\n\n\treturn pinned, nil\n}", "title": "" }, { "docid": "335f15f70625ea5dca704f2a252730c6", "score": "0.4017948", "text": "func loadRolesIDs(ctx context.Context, opaqueUserID string, rs settings.RoleService) ([]string, error) {\n\treq := &settings.ListRoleAssignmentsRequest{AccountUuid: opaqueUserID}\n\tassignmentResponse, err := rs.ListRoleAssignments(ctx, req)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\troleIDs := make([]string, 0)\n\n\tfor _, assignment := range assignmentResponse.Assignments {\n\t\troleIDs = append(roleIDs, assignment.RoleId)\n\t}\n\n\treturn roleIDs, nil\n}", "title": "" }, { "docid": "b30c8dc1fb2e2de949fa7232362c08c8", "score": "0.40117222", "text": "func RecoverNodeID(hash, sig []byte) (id NodeID, err error) {\n\tpubKey, err := secp256k1.RecoverPubkey(hash, sig)\n\tif err != nil {\n\t\treturn id, err\n\t}\n\tif len(pubKey)-1 != len(id) {\n\t\treturn id, fmt.Errorf(\"recovered pubkey has %d bits, want %d bits\", len(pubKey)*8, (len(id)+1)*8)\n\t}\n\tfor i := range id {\n\t\tid[i] = pubKey[i+1]\n\t}\n\treturn id, nil\n}", "title": "" }, { "docid": "ba864cbfdf63ecfa4076dc1fb77a82ca", "score": "0.40089118", "text": "func NodeIDCaller(handler interface{}, params ...interface{}) {\n\thandler.(func(identity.ID))(params[0].(identity.ID))\n}", "title": "" }, { "docid": "84d0244eb43135aa8dfab2ed466778d3", "score": "0.3998858", "text": "func HandleSlaveIPs(m *structs.Master) http.HandlerFunc {\n\treturn func(w http.ResponseWriter, req *http.Request) {\n\t\terr := req.ParseForm()\n\t\tif err != nil {\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tfilename := req.Form[\"file\"][0]\n\t\thash := req.Form[\"hash\"][0]\n\n\t\tm.Namespace.SetHash(filename, hash)\n\t\tm.GCCount.NewFile(filename)\n\n\t\tipArr := m.Slaves.GetFree()\n\t\tif len(ipArr) == 0 {\n\t\t\tw.WriteHeader(http.StatusNotFound)\n\t\t\treturn\n\t\t}\n\n\t\tdata, err := json.Marshal(ipArr)\n\t\tif err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tw.Write(data)\n\t}\n}", "title": "" }, { "docid": "4ca1b779808c12263f9118201ff408f8", "score": "0.3998083", "text": "func (kmu *K8sMetricUpdate) SetK8sNodeId(u uint) *K8sMetricUpdate {\n\tkmu.mutation.ResetK8sNodeId()\n\tkmu.mutation.SetK8sNodeId(u)\n\treturn kmu\n}", "title": "" }, { "docid": "b09982effd1f76ac43a3144677de103e", "score": "0.3986959", "text": "func (nm *nodeManager) setClusterNodes(nodeIds []string) error {\n\treturn nm.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"cluster\"))\n\n\t\tbuf, err := json.Marshal(nodeIds)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn b.Put([]byte(\"clusterNodes\"), buf)\n\t})\n}", "title": "" }, { "docid": "a4b1ee0161367d5f5018a82ab75925ca", "score": "0.39816764", "text": "func (o *NodeBalancerConfig) SetNodebalancerId(v int32) {\n\to.NodebalancerId = &v\n}", "title": "" }, { "docid": "c054eeec890a32710ed618abc8fffdf5", "score": "0.39800024", "text": "func (m *NetInterfaceMutation) OnIPAddressIDs() (ids []int) {\n\tif id := m.on_ip_address; id != nil {\n\t\tids = append(ids, *id)\n\t}\n\treturn\n}", "title": "" }, { "docid": "6bf406beab275a3c2ec3a79771f36dab", "score": "0.39716682", "text": "func (s *TasksListService) NodeId(nodeId ...string) *TasksListService {\n\ts.nodeId = append(s.nodeId, nodeId...)\n\treturn s\n}", "title": "" }, { "docid": "d83514bbbc4ce516fac5549dfb14680f", "score": "0.397102", "text": "func (keu *K8sEventUpdate) SetNodeId(u uint) *K8sEventUpdate {\n\tkeu.mutation.ResetNodeId()\n\tkeu.mutation.SetNodeId(u)\n\treturn keu\n}", "title": "" }, { "docid": "db716b380712fa6895a2a91efd7ac0aa", "score": "0.39533627", "text": "func (t *nativeThread) RestoreRegisters(savedRegs proc.Registers) error {\n\treturn t.restoreRegisters(savedRegs)\n}", "title": "" }, { "docid": "638cf9bd9a5fae24178117073055553e", "score": "0.39524838", "text": "func (server *Server) ReplicationAddressesHandler(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {\n\tbody, err := ioutil.ReadAll(r.Body)\n\tif errors.IsError(err) {\n\t\tlog.Println(logPrefix, r.RemoteAddr, err)\n\t\tw.WriteHeader(http.StatusInternalServerError)\n\t\tw.Write([]byte(\"Internal Server Error\"))\n\t\treturn\n\t}\n\n\t// Get available node for replication\n\tchosenDataNode, err := server.getReplicationNode(string(body))\n\t// There's no available nodes\n\tif errors.IsError(err) {\n\t\tlog.Println(logPrefix, r.RemoteAddr, err)\n\t\tw.WriteHeader(http.StatusServiceUnavailable)\n\t\tw.Write([]byte(\"Service Unavailable\"))\n\t\treturn\n\t}\n\n\tchosenNodeURL := server.getDataNodeUploadURL(chosenDataNode.IP, chosenDataNode.Port)\n\tlog.Println(logPrefix, r.RemoteAddr, fmt.Sprintf(\"routed replication to node %s with endpoint %s\", chosenDataNode.ID, chosenNodeURL))\n\tw.Write([]byte(chosenNodeURL))\n}", "title": "" }, { "docid": "43d3b98932d387a546fb9398a5230693", "score": "0.3943385", "text": "func (tab *Table) nodeToRevalidate() (n *Node, bi int) {\n\ttab.mutex.Lock()\n\tdefer tab.mutex.Unlock()\n\n\tfor _, bi = range tab.rand.Perm(len(tab.buckets)) {\n\t\tb := tab.buckets[bi]\n\t\tif len(b.entries) > 0 {\n\t\t\tlast := b.entries[len(b.entries)-1]\n\t\t\treturn last, bi\n\t\t}\n\t}\n\treturn nil, 0\n}", "title": "" }, { "docid": "8c7d96bd3e5ffa745fc680d423fc0058", "score": "0.39413306", "text": "func (nm *nodeManager) setEmptyNodes(nodeIds []string) error {\n\treturn nm.db.Update(func(tx *bolt.Tx) error {\n\t\tb := tx.Bucket([]byte(\"cluster\"))\n\n\t\tbuf, err := json.Marshal(nodeIds)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn b.Put([]byte(\"emptyNodes\"), buf)\n\t})\n}", "title": "" }, { "docid": "3f4688c61e2f8daaa9615334ee084f22", "score": "0.39407519", "text": "func (n *NeptuneDB) CloneRelationshipsFromIDs(ctx context.Context, attempt int, instanceID, dimensionName string, ids map[string]string) error {\n\tlogData := log.Data{\n\t\t\"fn\": \"CloneRelationshipsFromIDs\",\n\t\t\"instance_id\": instanceID,\n\t\t\"dimension_name\": dimensionName,\n\t\t\"num_ids\": len(ids),\n\t\t\"max_workers\": n.maxWorkers,\n\t\t\"batch_size\": n.batchSizeWriter,\n\t}\n\tlog.Info(ctx, \"cloning relationships from the generic hierarchy\", logData)\n\n\tprocessBatch := func(chunkIDs map[string]string) (ret map[string]string, err error) {\n\t\tidsStr := `'` + strings.Join(createArray(chunkIDs), `','`) + `'`\n\t\tgremStmt := fmt.Sprintf(\n\t\t\tquery.CloneHierarchyRelationshipsFromIDs,\n\t\t\tidsStr,\n\t\t\tinstanceID,\n\t\t\tdimensionName,\n\t\t\tinstanceID,\n\t\t\tdimensionName,\n\t\t)\n\n\t\tif _, err := n.getEdges(gremStmt); err != nil {\n\t\t\tlog.Error(ctx, \"cannot find edges while cloning relationships\", err, logData)\n\t\t\treturn nil, err\n\t\t}\n\t\treturn nil, nil\n\t}\n\n\t_, _, errs := processInConcurrentBatches(ids, processBatch, n.batchSizeWriter, n.maxWorkers)\n\tif len(errs) > 0 {\n\t\treturn errs[0]\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "84c6ac21aeada05e9b9d08a4eba88cef", "score": "0.39407292", "text": "func updateNodeLabels(nodes []db.Minion, nodesClient clientv1.NodeInterface) {\n\tnodeToLabels := map[string]map[string]string{}\n\tfor _, node := range nodes {\n\t\tnodeToLabels[node.PrivateIP] = map[string]string{\n\t\t\tproviderKey: node.Provider,\n\t\t\tregionKey: node.Region,\n\t\t\tsizeKey: node.Size,\n\t\t\tfloatingIPKey: node.FloatingIP,\n\t\t}\n\t}\n\n\tnodesList, err := nodesClient.List(metav1.ListOptions{})\n\tif err != nil {\n\t\tlog.WithError(err).Error(\"Failed to get current nodes\")\n\t\treturn\n\t}\n\n\tfor _, node := range nodesList.Items {\n\t\tprivateIP, err := getPrivateIP(node)\n\t\tif err != nil {\n\t\t\tlog.WithError(err).WithField(\"node\", node.Name).Error(\n\t\t\t\t\"Failed to get private IP\")\n\t\t\tcontinue\n\t\t}\n\n\t\tlabels, ok := nodeToLabels[privateIP]\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\n\t\tvar needsUpdate bool\n\t\tfor key, exp := range labels {\n\t\t\tactual, ok := node.Labels[key]\n\t\t\tif !ok || exp != actual {\n\t\t\t\tnode.Labels[key] = exp\n\t\t\t\tneedsUpdate = true\n\t\t\t}\n\t\t}\n\n\t\tif !needsUpdate {\n\t\t\tcontinue\n\t\t}\n\n\t\tc.Inc(\"Update node labels\")\n\t\tlog.WithField(\"node\", node.Name).WithField(\"labels\", labels).\n\t\t\tInfo(\"Updating node labels\")\n\t\t// Retry updating the labels if the apiserver reports that there's\n\t\t// a conflict. Conflicts are benign -- for example, there might be\n\t\t// a conflict if Kubernetes updated the node to change its\n\t\t// connection status.\n\t\terr = retry.RetryOnConflict(retry.DefaultBackoff, func() error {\n\t\t\t_, err := nodesClient.Update(&node)\n\t\t\treturn err\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.WithError(err).Error(\"Failed to update node labels\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "89f727c8551bede58874a0dfba27ae05", "score": "0.39372247", "text": "func HandleReexec() {\n\tif os.Getenv(\"NSFIX_NS_PID\") == \"\" {\n\t\treturn\n\t}\n\n\trestoreGlogLevel()\n\thandlerName := os.Getenv(\"NSFIX_HANDLER\")\n\tif handlerName == \"\" {\n\t\tglog.Fatal(\"NSFIX_HANDLER not set\")\n\t}\n\tentry, found := reexecMap[handlerName]\n\tif !found {\n\t\tglog.Fatalf(\"Bad NSFIX_HANDLER %q\", handlerName)\n\t}\n\n\tvar arg interface{}\n\tif entry.argType != nil {\n\t\targ = reflect.New(entry.argType).Interface()\n\t\targStr := os.Getenv(\"NSFIX_ARG\")\n\t\tif argStr != \"\" {\n\t\t\tif err := json.Unmarshal([]byte(argStr), arg); err != nil {\n\t\t\t\tglog.Fatalf(\"Can't unmarshal NSFIX_ARG (NSFIX_HANDLER %q):\\n%s\\n\", handlerName, argStr)\n\t\t\t}\n\t\t}\n\t}\n\n\tspawned := os.Getenv(\"NSFIX_SPAWN\") != \"\"\n\tswitch ret, err := entry.handler(arg); {\n\tcase err != nil && !spawned:\n\t\tglog.Fatalf(\"Error invoking NSFIX_HANDLER %q: %v\", handlerName, err)\n\tcase err == nil && !spawned:\n\t\tos.Exit(0)\n\tdefault:\n\t\toutBytes, err := marshalResult(ret, err)\n\t\tif err != nil {\n\t\t\tglog.Fatalf(\"Error marshalling the result from NSFIX_HANDLER %q: %v\", handlerName, err)\n\t\t}\n\t\tos.Stdout.Write(outBytes)\n\t\tos.Exit(0)\n\t}\n}", "title": "" }, { "docid": "6c0208dc5761479549a6ee53fb74c161", "score": "0.39355242", "text": "func (ps *BaseService) QueryNodeHandlerMap(ctx context.Context, targetNode map[uint64]bool) (map[uint64]*basepb.Node, map[uint64]*NodeHandler, error) {\n\tnodeMap := make(map[uint64]*basepb.Node)\n\tnodeHandlerMap := make(map[uint64]*NodeHandler)\n\tnodes, err := ps.QueryOnlineNodes(ctx)\n\tendNodeNum := hack.PInt64(int64(len(nodes)))\n\tif err != nil {\n\t\tlog.Error(\"query all nodes err:[%s]\", err)\n\t\treturn nil, nil, err\n\t}\n\n\tlock := sync.Mutex{}\n\tfor _, node := range nodes {\n\t\tif targetNode != nil && !targetNode[node.Id] {\n\t\t\tcontinue\n\t\t}\n\t\tnodeMap[node.Id] = node\n\t\tgo func(n *basepb.Node) {\n\t\t\tdefer func() {\n\t\t\t\tif r := recover(); r != nil {\n\t\t\t\t\tlog.Error(\"get nodeInfo [%d]:[%s] err:[%v]\", n.Id, NodeServerAddr(n), r)\n\t\t\t\t}\n\t\t\t\tatomic.AddInt64(endNodeNum, -1)\n\t\t\t}()\n\t\t\tif nodeInfo, err := ps.NodeInfo(ctx, n); err != nil {\n\t\t\t\tlog.Error(\"get nodeInfo [%d]:[%s] err:[%s]\", n.Id, NodeServerAddr(n), err.Error())\n\t\t\t} else {\n\t\t\t\tnh := &NodeHandler{\n\t\t\t\t\tNode: n,\n\t\t\t\t\tStats: nodeInfo.Stats,\n\t\t\t\t\tRangeHanders: make(map[uint64]*RangeHandler),\n\t\t\t\t}\n\t\t\t\tlock.Lock()\n\t\t\t\tnodeHandlerMap[n.Id] = nh\n\t\t\t\tlock.Unlock()\n\n\t\t\t\tfor _, ri := range nodeInfo.RangeInfos {\n\t\t\t\t\trh := &RangeHandler{\n\t\t\t\t\t\tRange: ri.Range,\n\t\t\t\t\t\tIsLeader: ri.Range.Leader == nh.Id,\n\t\t\t\t\t\tPeersStatus: ri.PeersStatus,\n\t\t\t\t\t\tStatus: ri.Stats,\n\t\t\t\t\t\tTerm: ri.Term,\n\t\t\t\t\t}\n\n\t\t\t\t\tif rh.IsLeader {\n\t\t\t\t\t\tnh.LeaderNum++\n\t\t\t\t\t}\n\n\t\t\t\t\tfor _, peer := range ri.Range.Peers {\n\t\t\t\t\t\tif peer.NodeId == nh.Id {\n\t\t\t\t\t\t\trh.Peer = peer\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif rh.Peer == nil {\n\t\t\t\t\t\tlog.Error(\"impossibility range:[%d] peer not in range Term:[%d]\", rh.Id, ri.Term)\n\t\t\t\t\t\trh.Peer = &basepb.Peer{Id: 0, NodeId: nh.Id, Type: basepb.PeerType_PeerType_Invalid}\n\t\t\t\t\t}\n\n\t\t\t\t\tnh.RangeHanders[ri.Range.Id] = rh\n\t\t\t\t}\n\t\t\t\tnh.RangeNum = len(nh.RangeHanders)\n\n\t\t\t}\n\t\t}(node)\n\t}\n\n\tfor atomic.LoadInt64(endNodeNum) > 0 {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn nil, nil, fmt.Errorf(\"context is time out\")\n\t\tdefault:\n\t\t\ttime.Sleep(time.Millisecond * 100)\n\t\t}\n\t}\n\n\tfor _, nh := range nodeHandlerMap {\n\t\tfor _, rh := range nh.RangeHanders {\n\t\t\tif !rh.IsLeader {\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tfor _, rs := range rh.PeersStatus {\n\t\t\t\tif rs.Snapshotting {\n\t\t\t\t\tnh.OutSnapshot++\n\t\t\t\t}\n\n\t\t\t\tif toNh := nodeHandlerMap[rs.Peer.NodeId]; toNh != nil {\n\t\t\t\t\ttoNh.InSnapshot++\n\t\t\t\t} else {\n\t\t\t\t\tlog.Error(\"range:[%d] has snapshot but inSnapshot node:[%d] not found\", rh.Id, rs.Peer.NodeId)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nodeMap, nodeHandlerMap, nil\n}", "title": "" }, { "docid": "883f3f8d2f4fe4fee0bde1d7f9775f38", "score": "0.3934713", "text": "func loadCPUMap() int {\n\tnodeMap := make(map[uint]int)\n\tmaxLcoreID := 0\n\tfor n := 0; ; n++ {\n\t\tpath := fmt.Sprintf(\"/sys/devices/system/node/node%d/cpumap\", n)\n\t\tf, err := os.Open(path)\n\t\tif err != nil {\n\t\t\tif e, ok := err.(*os.PathError); !ok || e.Err != syscall.ENOENT {\n\t\t\t\tpanic(e)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t\tdefer f.Close()\n\n\t\tcores, err := readCPUHexMap(f)\n\t\tif err != nil {\n\t\t\tpanic(err)\n\t\t}\n\n\t\tfor _, c := range cores {\n\t\t\tif nodeMap[uint(c)] = n; c > maxLcoreID {\n\t\t\t\tmaxLcoreID = c\n\t\t\t}\n\t\t}\n\t}\n\n\tlcore2node = make([]int, maxLcoreID+1)\n\tfor lcore, node := range nodeMap {\n\t\tlcore2node[lcore] = node\n\t}\n\n\treturn len(lcore2node)\n}", "title": "" }, { "docid": "ef7c6af0bd916a4248c0e65fbb27e5ac", "score": "0.3934545", "text": "func (lb *LoadBalancer) GetNodesInstanceIDs() []string {\n\t//if len(lb.Nodes) == 0 {\n\t//\treturn nil\n\t//}\n\tresult := make([]string, 0)\n\t//for _, node := range lb.Nodes {\n\t//\tresult = append(result, instance.NodeNameToInstanceID(node.Name, lb.nodeLister))\n\t//}\n\treturn result\n}", "title": "" }, { "docid": "b51837e9f9a91a6be3b4f3a957cefea4", "score": "0.39315236", "text": "func (f NodeFilter) WithNodeIDs(ids []string) NodeFilter {\n\ta := make(bson.A, len(ids))\n\tfor i := range ids {\n\t\ta[i] = ids[i]\n\t}\n\treturn append(f, bson.E{Key: \"node_id\", Value: bson.M{\"$in\": a}})\n}", "title": "" }, { "docid": "43e64e45c68f7f6a5c44f5ef8ccf03da", "score": "0.3929224", "text": "func CollectAllFromNodeListFile(nodeListFile string) (allNodes map[int]server.NetworkServer, err error) {\n\tif readable, _ := utils.CheckIfFileIsReadable(nodeListFile); !readable {\n\t\treturn nil, errors.New(\"The given file is not readable.\")\n\t}\n\tnodeListFileObject, _ := os.Open(nodeListFile)\n\tdefer nodeListFileObject.Close()\n\tallNodes = make(map[int]server.NetworkServer, 10)\n\tscanner := bufio.NewScanner(nodeListFileObject)\n\tfor scanner.Scan() {\n\t\tvar scanId int\n\t\tvar scanServerObject server.NetworkServer\n\t\tline := scanner.Text()\n\t\tif line == \"\" {\n\t\t\t//log.Printf(\"Leere Zeile gelesen.\\n\")\n\t\t\tcontinue\n\t\t}\n\t\tif strings.HasPrefix(line, \"#\") {\n\t\t\t//log.Printf(\"Kommentar gelesen: \\\"%s\\\"\\n\", line)\n\t\t\tcontinue\n\t\t}\n\t\tidAndIpPortArray := strings.Split(line, \" \")\n\t\tif len(idAndIpPortArray) == 0 {\n\t\t\tlog.Printf(\"Could not split the line with a space: \\\"%s\\\".\\n%s\\n\", line, utils.ERROR_FOOTER)\n\t\t\tcontinue\n\t\t}\n\t\tscanId, err := strconv.Atoi(idAndIpPortArray[0])\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Could not parse the first part of the line to a number : \\\"%s\\\".\\n%s\\n\", idAndIpPortArray[0], utils.ERROR_FOOTER)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tscanServerObject.SetClientName(idAndIpPortArray[0])\n\t\t}\n\t\tipAndPortArray := strings.Split(idAndIpPortArray[1], \":\")\n\t\tif len(ipAndPortArray) == 0 {\n\t\t\tlog.Printf(\"Could not split the ip address and port with a colon: \\\"%s\\\".\\n%s\\n\", idAndIpPortArray[1], utils.ERROR_FOOTER)\n\t\t\tcontinue\n\t\t}\n\t\t//Check if the given part is a ip address or a host.\n\t\tif splitIpArray, err := net.LookupIP(ipAndPortArray[0]); err != nil {\n\t\t\tlog.Printf(\"Could not lookup this ip/host: \\\"%s\\\".\\n%s\\n\", ipAndPortArray[0], utils.ERROR_FOOTER)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tif len(splitIpArray) == 0 {\n\t\t\t\tlog.Printf(\"No ip found: \\\"%s\\\".\\n%s\\n\", ipAndPortArray[0], utils.ERROR_FOOTER)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\t//If we have some ip addresses, lets check if they are from version 4.\n\t\t\tipv4Found := false\n\t\t\tfor _, value := range splitIpArray {\n\t\t\t\tif value.To4() != nil {\n\t\t\t\t\tipv4Found = true\n\t\t\t\t\tscanServerObject.SetIpAddress(value)\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\t\tif !ipv4Found {\n\t\t\t\tlog.Printf(\"No ipv4 found: \\\"%s\\\".\\n%s\\n\", ipAndPortArray[0], utils.ERROR_FOOTER)\n\t\t\t\tcontinue\n\t\t\t}\n\t\t}\n\t\tif splitPort, err := strconv.Atoi(ipAndPortArray[1]); err != nil {\n\t\t\tlog.Printf(\"Could not parse the port: \\\"%s\\\".\\n%s\\n\", ipAndPortArray[1], utils.ERROR_FOOTER)\n\t\t\tcontinue\n\t\t} else {\n\t\t\tscanServerObject.SetPort(splitPort)\n\t\t}\n\t\t//TODO: Maybe the usedProtocol should be set in a other way.\n\t\tscanServerObject.SetUsedProtocol(\"tcp\")\n\t\tallNodes[scanId] = scanServerObject\n\t}\n\tif err := scanner.Err(); err != nil {\n\t\treturn nil, err\n\t}\n\tif len(allNodes) == 0 {\n\t\treturn nil, errors.New(\"No nodes present... ABORT\")\n\t}\n\treturn allNodes, nil\n}", "title": "" }, { "docid": "3ad3d565f7e9966d8dd4d00e06e55065", "score": "0.39235368", "text": "func parseNodeIDs(path string, maxNodes int) []nodeID {\n\tlog.Printf(\"Parsing up to %d nodes from folder %q\", maxNodes, path)\n\tfiles, err := ioutil.ReadDir(path)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to read dir: %q. err: %+v\", path, err)\n\t}\n\n\tfilesToParse := []string{}\n\n\tfor _, f := range files {\n\t\tif strings.HasSuffix(f.Name(), \".json\") {\n\t\t\tfilesToParse = append(filesToParse, f.Name())\n\t\t}\n\t}\n\tfilesToParse = filesToParse[:maxNodes]\n\n\tres := []nodeID{}\n\tfor _, f := range filesToParse {\n\t\tnid := parseNodeID(filepath.Join(path, f))\n\t\tres = append(res, nid)\n\t}\n\n\treturn res\n}", "title": "" }, { "docid": "2bfa45a84c280586212d8f11d74183b8", "score": "0.3914901", "text": "func (d *DefinitionGroup) IDs32ToIDs() map[ID]ID {\n\td.mutex.RLock()\n\tdefer d.mutex.RUnlock()\n\n\tidS32ToIDs := make(map[ID]ID, len(d.definitions))\n\n\tfor id, def := range d.definitions {\n\t\tid32Bit := def.GetID32Bit()\n\n\t\tif id32Bit != Sys32Undefined {\n\t\t\tidS32ToIDs[id32Bit] = id\n\t\t}\n\t}\n\n\treturn idS32ToIDs\n}", "title": "" }, { "docid": "e9e32d784a49700f1efd982809757041", "score": "0.391419", "text": "func UnpinNode(node *core.IpfsNode, nd ipld.Node, recursive bool) error {\n\treturn UnpinCid(node, nd.Cid(), recursive)\n}", "title": "" }, { "docid": "0c4ccad07bce28e1e4f9767463f43e88", "score": "0.39115742", "text": "func (wn *WayNodes) UnmarshalJSON(data []byte) error {\n\tvar a []int64\n\terr := unmarshalJSON(data, &a)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tnodes := make(WayNodes, len(a))\n\tfor i, id := range a {\n\t\tnodes[i].ID = NodeID(id)\n\t}\n\n\t*wn = nodes\n\treturn nil\n}", "title": "" }, { "docid": "53fd0ff5c739d3c28eaea56f4fdf5249", "score": "0.39006954", "text": "func (h *HSM) Restore(image *KeyImage) error {\n\th.cacheMu.Lock()\n\tdefer h.cacheMu.Unlock()\n\n\tfor _, xKey := range image.XKeys {\n\t\tdata, err := hex.DecodeString(xKey.XPub)\n\t\tif err != nil {\n\t\t\treturn ErrXPubFormat\n\t\t}\n\n\t\tvar xPub chainkd.XPub\n\t\tcopy(xPub[:], data)\n\t\tif h.cache.hasKey(xPub) {\n\t\t\tlog.WithFields(log.Fields{\n\t\t\t\t\"module\": logModule,\n\t\t\t\t\"alias\": xKey.Alias,\n\t\t\t\t\"id\": xKey.ID,\n\t\t\t\t\"xPub\": xKey.XPub,\n\t\t\t}).Warning(\"skip restore key due to already existed\")\n\t\t\tcontinue\n\t\t}\n\n\t\tif ok := h.cache.hasAlias(xKey.Alias); ok {\n\t\t\treturn ErrDuplicateKeyAlias\n\t\t}\n\n\t\trawKey, err := json.Marshal(xKey)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, fileName := filepath.Split(xKey.ID)\n\t\tfile := h.keyStore.JoinPath(keyFileName(fileName))\n\t\tif err := writeKeyFile(file, rawKey); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\th.cache.reload()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "558260d687cc5427ce935af02cbd854b", "score": "0.38884744", "text": "func (this *ContractCreateFlow) GetNodeAccountIDs() []AccountID {\n\treturn this.nodeAccountIDs\n}", "title": "" }, { "docid": "957034c558fd3622de09329a9b7b7a3e", "score": "0.38878638", "text": "func UpdateNodeSwitchExcludeIPs(nbClient libovsdbclient.Client, nodeName string, subnet *net.IPNet) error {\n\tif utilnet.IsIPv6CIDR(subnet) {\n\t\t// We don't exclude any IPs in IPv6\n\t\treturn nil\n\t}\n\n\tupdateNodeSwitchLock.Lock()\n\tdefer updateNodeSwitchLock.Unlock()\n\n\t// Only query the cache for mp0 and HO LSPs\n\thaveManagementPort := true\n\tmanagmentPort := &nbdb.LogicalSwitchPort{Name: types.K8sPrefix + nodeName}\n\t_, err := libovsdbops.GetLogicalSwitchPort(nbClient, managmentPort)\n\tif err == libovsdbclient.ErrNotFound {\n\t\tklog.V(5).Infof(\"Management port does not exist for node %s\", nodeName)\n\t\thaveManagementPort = false\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"failed to get management port for node %s error: %v\", nodeName, err)\n\t}\n\n\thaveHybridOverlayPort := true\n\tHOPort := &nbdb.LogicalSwitchPort{Name: types.HybridOverlayPrefix + nodeName}\n\t_, err = libovsdbops.GetLogicalSwitchPort(nbClient, HOPort)\n\tif err == libovsdbclient.ErrNotFound {\n\t\tklog.V(5).Infof(\"Hybridoverlay port does not exist for node %s\", nodeName)\n\t\thaveHybridOverlayPort = false\n\t} else if err != nil {\n\t\treturn fmt.Errorf(\"failed to get hybrid overlay port for node %s error: %v\", nodeName, err)\n\t}\n\n\tmgmtIfAddr := GetNodeManagementIfAddr(subnet)\n\thybridOverlayIfAddr := GetNodeHybridOverlayIfAddr(subnet)\n\n\tklog.V(5).Infof(\"haveMP %v haveHO %v ManagementPortAddress %v HybridOverlayAddressOA %v\", haveManagementPort, haveHybridOverlayPort, mgmtIfAddr, hybridOverlayIfAddr)\n\tvar excludeIPs string\n\tif config.HybridOverlay.Enabled {\n\t\tif haveHybridOverlayPort && haveManagementPort {\n\t\t\t// no excluded IPs required\n\t\t} else if !haveHybridOverlayPort && !haveManagementPort {\n\t\t\t// exclude both\n\t\t\texcludeIPs = mgmtIfAddr.IP.String() + \"..\" + hybridOverlayIfAddr.IP.String()\n\t\t} else if haveHybridOverlayPort {\n\t\t\t// exclude management port IP\n\t\t\texcludeIPs = mgmtIfAddr.IP.String()\n\t\t} else if haveManagementPort {\n\t\t\t// exclude hybrid overlay port IP\n\t\t\texcludeIPs = hybridOverlayIfAddr.IP.String()\n\t\t}\n\t} else if !haveManagementPort {\n\t\t// exclude management port IP\n\t\texcludeIPs = mgmtIfAddr.IP.String()\n\t}\n\n\tsw := nbdb.LogicalSwitch{\n\t\tName: nodeName,\n\t\tOtherConfig: map[string]string{\"exclude_ips\": excludeIPs},\n\t}\n\terr = libovsdbops.UpdateLogicalSwitchSetOtherConfig(nbClient, &sw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to update exclude_ips %+v: %v\", sw, err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a748bd88ef83f551f80ebf0fc20c3a95", "score": "0.38865662", "text": "func (w *Workflow) ResetIDs() {\n\tfor _, n := range w.WorkflowData.Array() {\n\t\tn.ID = 0\n\t}\n\tfor i := range w.Integrations {\n\t\tw.Integrations[i].ID = 0\n\t}\n}", "title": "" }, { "docid": "e9103f475c81e0e5b1a87b5a62e11107", "score": "0.388488", "text": "func namespaceIPAddresses(processID int) ([]*net.IPNet, error) {\n\t// Ignore if this process is running in the root namespace\n\tnetnsRoot, err := netns.GetFromPid(1)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to open root namespace: %s\", err)\n\t}\n\tdefer netnsRoot.Close()\n\tnetnsContainer, err := netns.GetFromPid(processID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer netnsContainer.Close()\n\tif netnsRoot.Equal(netnsContainer) {\n\t\treturn nil, nil\n\t}\n\n\tvar cidrs []*net.IPNet\n\terr = withNetNS(netnsContainer, func() error {\n\t\tcidrs, err = allNonLocalAddresses()\n\t\treturn err\n\t})\n\n\treturn cidrs, err\n}", "title": "" }, { "docid": "3261a7455d6e84b62b13bf7fa6d28f50", "score": "0.3879747", "text": "func (mn *masterNode) ReReplicaRoutine(dfch chan uint32) {\n\tfor {\n\t\tselect {\n\n\t\tcase nip := <-dfch:\n\t\t\tfmt.Printf(\"data node %s failed, re-replica start\\n\", utils.StringIP(nip))\n\t\t\tfor file, infos := range meta {\n\t\t\t\tfilename := hashtextToFilenameMap[file]\n\t\t\t\tfor _, info := range infos {\n\t\t\t\t\tdataNodes := info.DataNodes\n\t\t\t\t\trrr := utils.ReReplicaRequest{\n\t\t\t\t\t\tMsgType: utils.ReReplicaRequestMsg,\n\t\t\t\t\t\tFilenameHash: utils.HashFilename(filename),\n\t\t\t\t\t\tTimestamp: info.Timestamp,\n\t\t\t\t\t\tTimeToLive: 4,\n\t\t\t\t\t}\n\n\t\t\t\t\tids := make([]utils.NodeID, 0)\n\t\t\t\t\tfor _, id := range dataNodes {\n\t\t\t\t\t\t_, err := mn.MemberList.Retrieve(id.Timestamp, id.IP)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\tutils.PrintError(err)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\t}\n\t\t\t\t\t\tids = append(ids, id)\n\t\t\t\t\t}\n\n\t\t\t\t\tif len(ids) < utils.NumReplica && mn.MemberList.Size() >= utils.NumReplica {\n\t\t\t\t\t\tpicksID := mn.pickReceivers(ids, utils.NumReplica-len(ids))\n\t\t\t\t\t\tfor i := 0; i < utils.NumReplica; i++ {\n\t\t\t\t\t\t\tif i < len(ids) {\n\t\t\t\t\t\t\t\trrr.DataNodeList[i] = ids[i]\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\trrr.DataNodeList[i] = picksID[i-len(ids)]\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tcontinue\n\t\t\t\t\t}\n\t\t\t\t\tfmt.Println(rrr.DataNodeList)\n\n\t\t\t\t\tmn.ReReplicaRequest(rrr, utils.StringIP(ids[0].IP)+\":\"+utils.StringPort(mn.DNPort))\n\t\t\t\t\tmeta.UpdateFileInfo(utils.Hash2Text(rrr.FilenameHash[:]), rrr.DataNodeList[:])\n\t\t\t\t}\n\t\t\t}\n\n\t\tdefault:\n\t\t}\n\t}\n}", "title": "" }, { "docid": "2addca327333730d0d36127abf233ab7", "score": "0.38769883", "text": "func RestoreClusterState() {\n\tl.Lock()\n\tdefer l.Unlock()\n\n\tpersistedPath := path.Join(global.Env().GetWorkingDir(), \"_cluster\")\n\n\tif !util.FileExists(persistedPath) {\n\t\treturn\n\t}\n\n\tn, err := ioutil.ReadFile(persistedPath)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tbuf := bytes.NewReader(n)\n\terr = gob.NewDecoder(buf).Decode(&getRaft().localNode)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "690e4a5da7e2243bb69c8e32a685f289", "score": "0.38749516", "text": "func (cl *List) AllIDs() []int64 {\n\tcl.cond.L.Lock()\n\tdefer cl.cond.L.Unlock()\n\tres := make([]int64, 0, len(cl.taskIDMap))\n\tfor element := cl.nodes.Front(); element != nil; element = element.Next() {\n\t\tres = append(res, element.Value.(*Config).TaskID)\n\t}\n\treturn res\n}", "title": "" }, { "docid": "f8f3ef85059a16d6cbcdd55b0ec8bf72", "score": "0.3871374", "text": "func (h *Handler) loadPrefixedIPs() error {\n\tpips, err := h.store.PrefixedIPs()\n\tif err != nil {\n\t\treturn err\n\t}\n\tfor _, pip := range pips {\n\t\th.ips.Add(pip)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81006e6936877b7b7aa896f039e2c373", "score": "0.38707405", "text": "func (d *Daemon) restoreOldEndpoints(dir string, clean bool) (*endpointRestoreState, error) {\n\tstate := &endpointRestoreState{\n\t\trestored: []*endpoint.Endpoint{},\n\t\ttoClean: []*endpoint.Endpoint{},\n\t}\n\n\tif !option.Config.RestoreState {\n\t\tklog.Info(\"Endpoint restore is disabled, skipping restore step\")\n\t\treturn state, nil\n\t}\n\n\tklog.Info(\"Restoring endpoints...\")\n\n\texistingEndpoints, err := lxcmap.DumpToMap()\n\tif err != nil {\n\t\tlog.WithError(err).Warning(\"Unable to open endpoint map while restoring. Skipping cleanup of endpoint map on startup\")\n\t}\n\n\tdirFiles, err := ioutil.ReadDir(dir)\n\tif err != nil {\n\t\treturn state, err\n\t}\n\tendpointsID := endpoint.FilterEPDir(dirFiles)\n\tpossibleEPs := endpoint.ReadEPsFromDirNames(d.ctx, d, dir, endpointsID)\n\tif len(possibleEPs) == 0 {\n\t\tlog.Info(\"No old endpoints found.\")\n\t\treturn state, nil\n\t}\n\n\tfor _, ep := range possibleEPs {\n\n\t\t// We have to set the allocator for identities here during the Endpoint\n\t\t// lifecycle, because the identity allocator has be initialized *after*\n\t\t// endpoints are restored from disk. This is because we have to reserve\n\t\t// IPs for the endpoints that are restored via IPAM. Reserving of IPs\n\t\t// affects the allocation of IPs w.r.t. node addressing, which we need\n\t\t// to know before the identity allocator is initialized. We need to\n\t\t// know the node addressing because when adding a reference to the\n\t\t// kvstore because the local node's IP is used as a suffix for the key\n\t\t// in the key-value store.\n\t\tep.SetAllocator(d.identityAllocator)\n\n\t\trestore, err := d.validateEndpoint(ep)\n\t\tif err != nil {\n\t\t\t// Disconnected EPs are not failures, clean them silently below\n\t\t\tif !ep.IsDisconnecting() {\n\t\t\t\tscopedLog.WithError(err).Warningf(\"Unable to restore endpoint, ignoring\")\n\t\t\t\tfailed++\n\t\t\t}\n\t\t}\n\t\tif !restore {\n\t\t\tif clean {\n\t\t\t\tstate.toClean = append(state.toClean, ep)\n\t\t\t}\n\t\t\tcontinue\n\t\t}\n\n\t\tep.SetDefaultConfiguration(true)\n\t\tep.SetProxy(d.l7Proxy)\n\t\tep.SkipStateClean()\n\n\t\tstate.restored = append(state.restored, ep)\n\n\t\tif existingEndpoints != nil {\n\t\t\tdelete(existingEndpoints, ep.IPv4.String())\n\t\t\tdelete(existingEndpoints, ep.IPv6.String())\n\t\t}\n\t}\n\n\t// delete non-exist endpoint from lxc BPF maps\n\tif existingEndpoints != nil {\n\t\tfor hostIP, info := range existingEndpoints {\n\t\t\tif ip := net.ParseIP(hostIP); !info.IsHost() && ip != nil {\n\t\t\t\tif err := lxcmap.DeleteEntry(ip); err != nil {\n\t\t\t\t\tlog.WithError(err).Warn(\"Unable to delete obsolete endpoint from BPF map\")\n\t\t\t\t} else {\n\t\t\t\t\tlog.Debugf(\"Removed outdated endpoint %d from endpoint map\", info.LxcID)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn state, nil\n}", "title": "" }, { "docid": "b4fb8f2ec9245ba6c00513a6695966b8", "score": "0.38660154", "text": "func (query *AccountBalanceQuery) SetNodeAccountIDs(accountID []AccountID) *AccountBalanceQuery {\n\tquery.Query.SetNodeAccountIDs(accountID)\n\treturn query\n}", "title": "" }, { "docid": "4597302bdeeeb47797d6b452559aa982", "score": "0.38597274", "text": "func loadNodeId() error {\r\n if (len(os.Args) != 2) {\r\n return errors.New(\"command line arguments error\")\r\n }\r\n if n, err := fmt.Sscanf(os.Args[1], \"n%d\", &nodeId); n != 1 || err != nil {\r\n return errors.New(\"command line arguments error\")\r\n }\r\n if !(0 < nodeId && nodeId <= len(ip)) {\r\n return errors.New(\"node id range error\")\r\n }\r\n return nil\r\n}", "title": "" }, { "docid": "10fb22235b106ce4a38ae0332a1aea92", "score": "0.3858894", "text": "func SetLocalNodeID(nodeid uint32) {\n\tlocalNodeIdentity.Lock()\n\tdefer localNodeIdentity.Unlock()\n\tlocalNodeIdentity.identity = NumericIdentity(nodeid)\n}", "title": "" } ]
9ff05fa700cf9cbff3dba5cb268367ec
GetHost is a wrapper around the C function soup_client_context_get_host.
[ { "docid": "c4ef26941910a7a0eef43eb19d23606f", "score": "0.7758977", "text": "func (recv *ClientContext) GetHost() string {\n\tretC := C.soup_client_context_get_host((*C.SoupClientContext)(recv.native))\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" } ]
[ { "docid": "ec3b194ae90b34cb78a886a79d19c0da", "score": "0.6985185", "text": "func (cl *DefaultClient) GetHost() string {\n\treturn cl.Host\n}", "title": "" }, { "docid": "afa3b7dd24d400a9519b83a3c128603c", "score": "0.69806564", "text": "func GetHost(ctx context.Context) string {\n\tv, ok := ctx.Value(requestHostKey{}).(string)\n\tif ok {\n\t\treturn v\n\t}\n\treturn \"\"\n}", "title": "" }, { "docid": "8ef38465eabf38f5e28fd01e57ca5e49", "score": "0.6934983", "text": "func (instance *Client) GetHost() string {\n\treturn instance.host\n}", "title": "" }, { "docid": "49f4ae8d18a775290d5180208a18dd16", "score": "0.67500293", "text": "func (recv *URI) GetHost() string {\n\tretC := C.soup_uri_get_host((*C.SoupURI)(recv.native))\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "f2deb9362fa0175f6bd0c5344d6053a0", "score": "0.66762185", "text": "func (recv *Auth) GetHost() string {\n\tretC := C.soup_auth_get_host((*C.SoupAuth)(recv.native))\n\tretGo := C.GoString(retC)\n\n\treturn retGo\n}", "title": "" }, { "docid": "58c92c0caeb521b59d7ca7a4a14a9dbb", "score": "0.6554148", "text": "func GetHost(\n\tctx context.Context,\n) string {\n\treturn env.Get(ctx).Config[EnvCfgHost]\n}", "title": "" }, { "docid": "1ab253e8103a60e4db7d00b65c8686df", "score": "0.64795136", "text": "func (ec *EvernoteClient) GetHost() string {\n\tif ec.Sandbox {\n\t\treturn SandboxEvernoteCom\n\t}\n\n\treturn EvernoteCom\n}", "title": "" }, { "docid": "daf4d1f7fc47208c05cfd1a67eb0877c", "score": "0.64132863", "text": "func (r *requestWrapperFromEcho) Host() string {\n\treturn r.Request.Host()\n}", "title": "" }, { "docid": "53f4bece9c8b51e0411e67d4114cb44e", "score": "0.6298857", "text": "func (r *Gitlab) GetHost() string {\n\turi, _ := url.Parse(r.url)\n\treturn uri.Host\n}", "title": "" }, { "docid": "aef026c0b3944f0d02e20ebe932ab41f", "score": "0.6298425", "text": "func (base *BaseProtocol) GetHost() core.Host {\n\n\treturn base.Host\n\n}", "title": "" }, { "docid": "6d8161c9339aa05daed6b44dc35c42b9", "score": "0.62903976", "text": "func RequestHost(ctx context.Context) (string, error) {\n\turl, ok := ctx.Value(requestHost).(string)\n\tif ok {\n\t\treturn url, nil\n\t}\n\treturn url, errors.New(\"RequestHost is not set properly to context\")\n}", "title": "" }, { "docid": "39a49ea2a606437a94bfac4ecb9d6781", "score": "0.62239754", "text": "func GetHost(req *http.Request) string {\n\tif len(req.Host) > 0 {\n\t\treturn req.Host\n\t}\n\n\tif req.URL == nil {\n\t\treturn \"\"\n\t}\n\n\treturn req.URL.Host\n}", "title": "" }, { "docid": "966d810181da81dede353236f1f7db0a", "score": "0.6195008", "text": "func (i *BaseInstance) GetHost() string {\n\treturn i.Host\n}", "title": "" }, { "docid": "70b97da1c0733dbc0c83577a292151c5", "score": "0.6176486", "text": "func (x *ConfigRequest_V1_System_Service) GetHost() *wrapperspb.StringValue {\n\tif x != nil {\n\t\treturn x.Host\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70b97da1c0733dbc0c83577a292151c5", "score": "0.6176486", "text": "func (x *ConfigRequest_V1_System_Service) GetHost() *wrapperspb.StringValue {\n\tif x != nil {\n\t\treturn x.Host\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "70b97da1c0733dbc0c83577a292151c5", "score": "0.6176486", "text": "func (x *ConfigRequest_V1_System_Service) GetHost() *wrapperspb.StringValue {\n\tif x != nil {\n\t\treturn x.Host\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95be7a0918de3614149904c2d5d2ddf9", "score": "0.6151088", "text": "func getHost(c *lib.Context) string {\n\tvar h string\n\tif c.IsExternal {\n\t\th = strings.TrimSuffix(c.Config.ExternalShareHost, \"/\")\n\t} else {\n\t\tif c.REQ.TLS == nil {\n\t\t\th = c.Config.Http.IP + \":\" + strconv.Itoa(c.Config.Http.Port)\n\t\t} else {\n\t\t\th = c.Config.Tls.IP + \":\" + strconv.Itoa(c.Config.Tls.Port)\n\t\t}\n\t}\n\n\tif c.IsShare {\n\t\th += \"/api/shares/download\"\n\t} else {\n\t\th += \"/api/download\"\n\t}\n\tif !c.IsExternal {\n\t\tif c.REQ.TLS != nil {\n\t\t\th = \"https://\" + h\n\t\t} else {\n\t\t\th = \"http://\" + h\n\t\t}\n\t}\n\treturn h\n}", "title": "" }, { "docid": "c75cf12211db24bad42bac82c6158865", "score": "0.6083542", "text": "func (req BaseFetcherRequest) Host() (string, error) {\n\tu, err := url.Parse(req.GetURL())\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn u.Host, nil\n}", "title": "" }, { "docid": "83520919dc3fc3b3d343ac61fc52fd82", "score": "0.6044798", "text": "func (node *Node) GetHost() p2p.Host {\n\treturn node.host\n}", "title": "" }, { "docid": "acdbdd671556be496e4b314c03584a30", "score": "0.600376", "text": "func getHost(r *http.Request) string {\n\tif r.URL.IsAbs() {\n\t\treturn r.URL.Host\n\t}\n\treturn r.Host\n}", "title": "" }, { "docid": "112a73ef92342fc614f37a57ceccc4f0", "score": "0.6000211", "text": "func (s *Server) GetHost() string {\n\treturn s.Host\n}", "title": "" }, { "docid": "88e4e82737a52d81ce55c5fe750ccd83", "score": "0.5997896", "text": "func GetHTTPHost(r *http.Request) string {\n\tproto := \"https\"\n\tif r.TLS == nil {\n\t\tproto = \"http\"\n\t}\n\treturn fmt.Sprintf(\"%s://%s\", proto, r.Host)\n}", "title": "" }, { "docid": "1d78d3ed9fe5a810f26c9dc85f37fdf9", "score": "0.59815747", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLivenessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLivenessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4304ad7d36940db485fed52691dc5364", "score": "0.594206", "text": "func (m *Subdomain) GetHost()(Hostable) {\n val, err := m.GetBackingStore().Get(\"host\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(Hostable)\n }\n return nil\n}", "title": "" }, { "docid": "14a76e272fe71d6b74383290eaf728ff", "score": "0.5930544", "text": "func (p *XConsoleLog) GetHost() string {\n\treturn p.hostname\n}", "title": "" }, { "docid": "b05100825150ff35f10af69b6f832767", "score": "0.59271485", "text": "func (m *HistogramBucket) GetHost() string {\n\treturn m.Host\n}", "title": "" }, { "docid": "f5e42f9f80f49f95e8eb45623646c23c", "score": "0.59158635", "text": "func GetHost() string {\n\thost, _ := os.Hostname()\n\taddr, _ := net.LookupHost(host)\n\treturn addr[0]\n}", "title": "" }, { "docid": "c77b8706da71311fd9568a47521074eb", "score": "0.5913014", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePostStartHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePostStartHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "06c2427afd17fca06c5102265366416c", "score": "0.58943665", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLivenessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLivenessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c3994f2948a19770892a9c37a0ef526c", "score": "0.5865991", "text": "func (c *Configuration) GetHost() string {\n\treturn c.viper.GetString(serverHost)\n}", "title": "" }, { "docid": "ee21d36363947d0892aec7a419fdf6f2", "score": "0.58582664", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePreStopHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePreStopHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6d8eff69fae7998c79c3f38dc823affa", "score": "0.5855745", "text": "func (c *Client) Host() string { return c.cfg.Host }", "title": "" }, { "docid": "241e9aa7e95f5d260f6953b56ca0438a", "score": "0.5841402", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecLivenessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsExplainerContainerSpecLivenessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "347d46c6c9cd6d59a458a42592ca2eba", "score": "0.5841203", "text": "func GetRemoteHost(r *http.Request) string {\n\thost, _ := GetRemoteAddr(r)\n\treturn host\n}", "title": "" }, { "docid": "4becb59ff1ef046b020a5ed97ec8c74a", "score": "0.5820745", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersReadinessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersReadinessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "36a6eba5cde11d8b1ee34fd9b6094b50", "score": "0.58107346", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLifecyclePostStartHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLifecyclePostStartHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5b67beef7fdb90f0de1534ee4c588dec", "score": "0.5808439", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLifecyclePreStopHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLifecyclePreStopHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "6477b0062a2cab30c2f7a8285d2bcd0f", "score": "0.5806248", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLifecyclePreStopHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLifecyclePreStopHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "cfb77b3c540b6a686738f1441730d582", "score": "0.58058864", "text": "func (c *Client) Host() string {\n\treturn c.host.String()\n}", "title": "" }, { "docid": "dbc8a1eb24bb29b4e78bfd6594a4ae93", "score": "0.58032763", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersStartupProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersStartupProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "5568afc14f955502e633b69cb0dec875", "score": "0.5794117", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecLifecyclePostStartHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsExplainerContainerSpecLifecyclePostStartHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7cea817287af1f0b890d0062c56bfb05", "score": "0.5790159", "text": "func (o HTTPGetActionOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetAction) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7cea817287af1f0b890d0062c56bfb05", "score": "0.5790159", "text": "func (o HTTPGetActionOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetAction) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "2d9f5d64ef7f3918e363a2331a26fe3a", "score": "0.57899183", "text": "func (req *FetchRequest) Host() (string, error) {\n\treqURL, err := url.Parse(req.URL)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn reqURL.Host, nil\n}", "title": "" }, { "docid": "0e96a610d008f5d57a9fa7c32c12f4b5", "score": "0.57795703", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLivenessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLivenessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "7bc3cdab499f3aac2425cf755276076a", "score": "0.5777414", "text": "func GetRequestHost(r *http.Request) string {\n\thost, _ := GetRequestAddr(r)\n\treturn host\n}", "title": "" }, { "docid": "e28adf0ebf1a1f5986bcf50f6e84b3b6", "score": "0.5772109", "text": "func (o HTTPGetActionPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v HTTPGetAction) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "16270e0fa83f7b3d12666b9649a24112", "score": "0.5770548", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLifecyclePostStartHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLifecyclePostStartHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a18f0fd2fa60e26815f2c95872d240fe", "score": "0.5752904", "text": "func (c *Config) GetHost() string {\n\tif port := os.Getenv(\"HAMUSTRO_HOST\"); port != \"\" {\n\t\treturn port\n\t}\n\treturn \"localhost\"\n}", "title": "" }, { "docid": "1df8e7ea615f51fada5db6f72f112e13", "score": "0.57456636", "text": "func (ep *endpoint) Host() string {\n\treturn ep.host\n}", "title": "" }, { "docid": "24fc367150d29b66396b77e36687279b", "score": "0.5744626", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersStartupProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersStartupProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "4d1a0d5ae0310c6f6a6cc9e9638d21b1", "score": "0.5732604", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersReadinessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersReadinessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "f3b054c201e2d928c056418981ae5a1f", "score": "0.5728016", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecLifecyclePreStopHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsExplainerContainerSpecLifecyclePreStopHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "069ca0cbeaefcd5cf841fe15d2b9737a", "score": "0.5719399", "text": "func (o *V1Sars2ProteinDatasetRequest) GetHost() string {\n\tif o == nil || o.Host == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.Host\n}", "title": "" }, { "docid": "6c5220572afb95c990a3aa84648222f5", "score": "0.57142913", "text": "func (f *WeaviateConfig) GetHostAddress() string {\n\treturn fmt.Sprintf(\"%s://%s\", f.Scheme, f.Hostname)\n}", "title": "" }, { "docid": "4d7eba7a8c935b135c392a109fb93c05", "score": "0.5710968", "text": "func (o HTTPGetActionPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *HTTPGetAction) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dbd91811b59eb18bd1b37aae9607c5e2", "score": "0.5710476", "text": "func getHost(link string) (string, error) {\n\turlStruct, err := url.Parse(link)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"getHost: %v\", err)\n\t} else if len(urlStruct.Host) == 0 {\n\t\treturn \"\", fmt.Errorf(\"getHost: no host found in %s\", link)\n\t}\n\treturn urlStruct.Host, nil\n}", "title": "" }, { "docid": "e6208dce03f561b0a2a8a38f9a44374a", "score": "0.56987286", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecStartupProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsExplainerContainerSpecStartupProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "caec428f484a50fb71f4a6771882094d", "score": "0.56906736", "text": "func (vtctld *ClientProxy) Hostname() string {\n\treturn vtctld.host\n}", "title": "" }, { "docid": "c2aa2000250d3c3fa0773766ce9b8aa5", "score": "0.5677382", "text": "func (ctx *Context) Host() string {\n\tif ctx.Request.Host != \"\" {\n\t\thostParts := strings.Split(ctx.Request.Host, \":\")\n\t\tif len(hostParts) > 0 {\n\t\t\treturn hostParts[0]\n\t\t}\n\t\treturn ctx.Request.Host\n\t}\n\treturn \"localhost\"\n}", "title": "" }, { "docid": "37fb5b399ab77c9b0fa1b96de169acc2", "score": "0.56659895", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecReadinessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsExplainerContainerSpecReadinessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "56abc9da9f9678dd23974f67e78adc9f", "score": "0.5645007", "text": "func (u URL) Host() string {\n\treturn u.url.Host\n}", "title": "" }, { "docid": "0c7fbbf3ff3e29345739eb77fe5684d7", "score": "0.5639653", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersReadinessProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersReadinessProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "564504bad86a84bcb90782e14bc46b74", "score": "0.562855", "text": "func getVHostContext(r *rest.Request, client *node.ControlClient) (*svc.Service, string, string, error) {\n\tserviceID, err := url.QueryUnescape(r.PathParam(\"serviceId\"))\n\tif err != nil {\n\t\tglog.Errorf(\"Failed getting serviceID: %v\", err)\n\t\treturn nil, \"\", \"\", err\n\t}\n\n\tvar service svc.Service\n\terr = client.GetService(serviceID, &service)\n\tif err != nil {\n\t\tglog.Errorf(\"Unexpected error getting service (%s): %v\", serviceID, err)\n\t\treturn nil, \"\", \"\", err\n\t}\n\n\tapplication, err := url.QueryUnescape(r.PathParam(\"application\"))\n\tif err != nil {\n\t\tglog.Errorf(\"Failed getting application: %v\", err)\n\t\treturn nil, \"\", \"\", err\n\t}\n\n\tvhostname, err := url.QueryUnescape(r.PathParam(\"name\"))\n\tif err != nil {\n\t\tglog.Errorf(\"Failed getting hostname: %v\", err)\n\t\treturn nil, \"\", \"\", err\n\t}\n\treturn &service, application, vhostname, nil\n\n}", "title": "" }, { "docid": "f1d50132de6d8a1e7da539f4ed9556f6", "score": "0.56264514", "text": "func (topology *TopologySvc) handleGetHost(input interface{}, ctx common.RestContext) (interface{}, error) {\n\tlog.Println(\"In handleHost()\")\n\tidStr := ctx.PathVariables[\"hostId\"]\n\tid, err := strconv.ParseUint(idStr, 10, 64)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thost, err := topology.store.findHost(id)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tagentURL := fmt.Sprintf(\"http://%s:%d\", host.Ip, host.AgentPort)\n\tagentLink := common.LinkResponse{Href: agentURL, Rel: \"agent\"}\n\thostLink := common.LinkResponse{Href: hostListPath + \"/\" + idStr, Rel: \"self\"}\n\tcollectionLink := common.LinkResponse{Href: hostListPath, Rel: \"self\"}\n\thost.Links = []common.LinkResponse{agentLink, hostLink, collectionLink}\n\treturn host, nil\n}", "title": "" }, { "docid": "daadd2dfa821e7b7bdd0395bf48ea631", "score": "0.56170815", "text": "func HostGTE(v string) predicate.DNSDetectorResult {\n\treturn predicate.DNSDetectorResult(sql.FieldGTE(FieldHost, v))\n}", "title": "" }, { "docid": "fae9fbb8b16954b9beacae85d37b9aee", "score": "0.56154305", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersStartupProbeHttpGetPtrOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersStartupProbeHttpGet) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "61623c12a178bb084d68e6c8fd040cee", "score": "0.5609937", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLivenessProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLivenessProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "914c51184391b680de573e76e6396e16", "score": "0.560963", "text": "func (o HTTPGetActionResponseOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v HTTPGetActionResponse) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c1e59b5688b53d9a69dba59737b0c13d", "score": "0.56067497", "text": "func (c *Context) Host(full ...bool) string {\n\tscheme := c.Request.Header.Get(\"X-Forwarded-Proto\")\n\tif scheme == \"\" {\n\t\tscheme = \"https\"\n\t\tif c.Request.TLS == nil {\n\t\t\tscheme = \"http\"\n\t\t}\n\t}\n\thost := c.Request.Host\n\tif len(full) > 0 && full[0] {\n\t\thost += c.Request.URL.String()\n\t}\n\treturn scheme + \"://\" + host\n}", "title": "" }, { "docid": "4be85450d7167d7627b4384f0c3a7667", "score": "0.5600844", "text": "func (c *Config) HttpHost() string {\n\tif c.options.HttpHost == \"\" {\n\t\tif c.fiber.Network == fiber.NetworkTCP6 {\n\t\t\treturn \"[::1]\"\n\t\t} else if c.fiber.Network == fiber.NetworkTCP4 {\n\t\t\treturn \"0.0.0.0\"\n\t\t} else {\n\t\t\treturn \"\"\n\t\t}\n\t}\n\n\treturn c.options.HttpHost\n}", "title": "" }, { "docid": "19e8b26e5f1c3f812a9b136eac294ad0", "score": "0.5582837", "text": "func (request *Request) GetHostName() string {\n\n\turl, err := url.Parse(request.Url)\n\tif err != nil {\n\t\tlog.Fatal(\"GetHostName : \", err)\n\t}\n\treturn url.Host\n}", "title": "" }, { "docid": "ac34228c8ced0c37a460e1e2196c6413", "score": "0.5581097", "text": "func Get(ctx context.Context) (string, error) {\n\tdata, err := GetWithProvider(ctx)\n\treturn data.Hostname, err\n}", "title": "" }, { "docid": "bfccd964162db1c79d4c6a4b9dd3ba68", "score": "0.55702126", "text": "func (r *Request) URLHost() string {\n\treturn r.requestURL.Host\n}", "title": "" }, { "docid": "9f29abbbcdb28aea239426befcd58a3d", "score": "0.55575347", "text": "func (c *Config) HttpServerHost() string {\n\treturn c.httpServerHost\n}", "title": "" }, { "docid": "1c4284895ff8c0b87f2226137cfff52e", "score": "0.55547404", "text": "func (network *ServiceNetwork) GetHostNetwork() (hosthandler.HostHandler, hosthandler.Context) {\n\treturn network.hostNetwork, createContext(network.hostNetwork)\n}", "title": "" }, { "docid": "94b3ab3f659c35db085428a2ee627a22", "score": "0.5531935", "text": "func (_class HostCrashdumpClass) GetHost(sessionID SessionRef, self HostCrashdumpRef) (_retval HostRef, _err error) {\n\tif IsMock {\n\t\treturn _class.GetHostMock(sessionID, self)\n\t}\t\n\t_method := \"host_crashdump.get_host\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertHostCrashdumpRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_retval, _err = convertHostRefToGo(_method + \" -> \", _result.Value)\n\treturn\n}", "title": "" }, { "docid": "71afe69e3eba14855707e55004ca8f1c", "score": "0.5524236", "text": "func (m *SiteCollection) GetHostname()(*string) {\n val, err := m.GetBackingStore().Get(\"hostname\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "f91ee58a7f8613c20a734fbcf7c94903", "score": "0.5522261", "text": "func getHostContext(body io.ReadCloser) (*PluginRequest, error) {\n\tlog.Trace(\"getHostContext called\")\n\tpref := make(map[string]interface{})\n\tvar hostCxt *Host\n\tvar pluginReq *PluginRequest\n\n\t//Unmarshal the request into PluginRequest\n\treqBuf, err := ioutil.ReadAll(body)\n\tlog.Trace(\"Body :\", string(reqBuf))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\terr = json.Unmarshal(reqBuf, &pluginReq)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif hostContextCache != nil {\n\t\tlog.Trace(\"HostContextCache present. Reading from it\")\n\t\thostCacheLock.Lock()\n\t\tdefer hostCacheLock.Unlock()\n\t\thostCxt = hostContextCache\n\t\tlog.Trace(\"Successfully read from cache.\")\n\t\tpluginReq.Host = hostCxt\n\t\tpluginReq.Preferences = pref\n\t\treturn pluginReq, nil\n\t}\n\t// if error to read from cache. Build the context\n\tif hostContextCache == nil {\n\t\tlog.Trace(\"Cache absent.Building the Host context cache\")\n\t}\n\thostCxt, err = buildHostContext(body)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpluginReq.Host = hostCxt\n\tpluginReq.Preferences = pref\n\n\t// Try saving the context into cache\n\terr = saveHostContextInCache(hostCxt)\n\tif err != nil {\n\t\tlog.Trace(\"Unable to save the hostContext in cache, but continue the operation\")\n\t\treturn pluginReq, nil\n\t}\n\treturn pluginReq, nil\n}", "title": "" }, { "docid": "c9b47d707c4ec8a21efbd3fec6b647c1", "score": "0.5517257", "text": "func (s *Server) Host() string { return MustParseURLHost(s.URL) }", "title": "" }, { "docid": "e5499380a229f43e74a547b86bbe3676", "score": "0.5506297", "text": "func (this *Generic) Host() (string) {\n\treturn this.HostName\n}", "title": "" }, { "docid": "a515fea4f42b27fe9f031c9c048449d4", "score": "0.5498818", "text": "func Hostname() string { return hostname }", "title": "" }, { "docid": "0cc235715dd941617c58a4fe7d0375ce", "score": "0.54850805", "text": "func Hostname(ctx Context, r *http.Request) (string, error) {\n\treturn strings.Split(r.Host, \":\")[0], nil\n}", "title": "" }, { "docid": "2710fcb6eb237a7bc9c212d95be8880a", "score": "0.54828644", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLivenessProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecContainersLivenessProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "9e99c8a0c619900fdeb34b3e50adbcea", "score": "0.54821223", "text": "func GetServiceInfoHost(ctx context.Context) (string, bool) {\n\thost, found := ctx.Value(serviceInfoHostContextKey).(string)\n\treturn host, found\n}", "title": "" }, { "docid": "c61e1121f4e0078616536e8dd3816927", "score": "0.54578006", "text": "func (t *Target) Host() string {\n\treturn t.host\n}", "title": "" }, { "docid": "b7592620aab51da5904f830151da67cd", "score": "0.54431134", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecLivenessProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsExplainerContainerSpecLivenessProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "209d7b39403d41e5412d14d92f9cd7a9", "score": "0.54420406", "text": "func (m *BrowserSharedCookieHistory) GetHostOrDomain()(*string) {\n val, err := m.GetBackingStore().Get(\"hostOrDomain\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "006246e0faf27f1c87c7f8e5c0a51d63", "score": "0.54345584", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersReadinessProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersReadinessProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "683364c9d994eaee946497a029e391bd", "score": "0.5427151", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersStartupProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersStartupProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "75b849cb82e074db3250e6f7d88c6033", "score": "0.5421581", "text": "func (o LookupHttpsHealthCheckResultOutput) Host() pulumi.StringOutput {\n\treturn o.ApplyT(func(v LookupHttpsHealthCheckResult) string { return v.Host }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5cbc6c9f3e3f3c47415b25a6e20be2da", "score": "0.5405296", "text": "func (bs *BuildSummary) GetHost() (string, error) {\n\ts := bs.BuildKey.StringID()\n\tparts := strings.SplitN(s, \":\", 2)\n\tif len(parts) != 2 {\n\t\treturn \"\", errors.New(fmt.Sprintf(\"failed to parse host from BuildKey: %s\", s))\n\t}\n\treturn parts[0], nil\n}", "title": "" }, { "docid": "9332780741ce1eaf750cad5bf9463d14", "score": "0.5391991", "text": "func (r *IncomingRequest) Host() string {\n\treturn r.req.Host\n}", "title": "" }, { "docid": "0f0df8dce13961f49e18c9a7991c64b6", "score": "0.5385717", "text": "func (o SeldonDeploymentSpecPredictorsExplainerContainerSpecStartupProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsExplainerContainerSpecStartupProbeHttpGet) *string { return v.Host }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "e2895ad499f239ca4bccd6bbb39d850f", "score": "0.53850114", "text": "func GetHost(logger *zap.Logger, cfg *config.Config) *string {\n\tif cacheVal, ok := cache.Cache.Get(cache.CanonicalHostnameKey); ok {\n\t\treturn cacheVal.(*string)\n\t}\n\n\tif err := valid.Hostname(cfg.Hostname); err == nil {\n\t\tcache.Cache.Add(cache.CanonicalHostnameKey, &cfg.Hostname, cache.NoExpiration)\n\t\treturn &cfg.Hostname\n\t} else if cfg.Hostname != \"\" {\n\t\tlogger.Error(\"Hostname set in configuration is invalid\", zap.Error(err))\n\t}\n\n\t// Get system hostname\n\thostInfo := system.GetHostInfo(logger)\n\thostname := hostInfo.GetHostname(logger)\n\n\tif err := valid.Hostname(hostname); err != nil {\n\t\t// If invalid log but continue\n\t\tlogger.Error(\"Detected hostname is not valid\", zap.Error(err))\n\t}\n\n\tlogger.Debug(\"Canonical hostname automatically set\", zap.String(\"hostname\", hostname))\n\tcache.Cache.Set(cache.CanonicalHostnameKey, &hostname, cache.NoExpiration)\n\treturn &hostname\n}", "title": "" }, { "docid": "be6f40f968443d1a27ea2d2bb8941bbb", "score": "0.5375557", "text": "func getEsHost() string {\n\treturn getEnv(\"ES_HOST\", ElasticsearchDefaultHost)\n}", "title": "" }, { "docid": "02f2cfd6d24264b595ebdf59d9cf6738", "score": "0.53743625", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePostStartHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecEphemeralContainersLifecyclePostStartHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "ee142fd5c218f8dcd493d88d0a9c2242", "score": "0.5373417", "text": "func (addr *Address) Host() string {\n\treturn addr.host\n}", "title": "" }, { "docid": "74f9608c0aa4676346a10eecb2da77f3", "score": "0.5355829", "text": "func (r *Requester) GetHostAddr() *Address.Addr {\n\treturn Address.FromConnection(r.controlConnection)\n}", "title": "" }, { "docid": "76d1f93fc933715587a9055185557f15", "score": "0.53493327", "text": "func (o SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLivenessProbeHttpGetOutput) Host() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v SeldonDeploymentSpecPredictorsComponentSpecsSpecInitContainersLivenessProbeHttpGet) *string {\n\t\treturn v.Host\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" } ]
ca46396d246eca5db38ff3a0759653de
SendInt64s sends values to processor toID with given tag
[ { "docid": "0cba47ed41934fef7ebe81122c568376", "score": "0.6046171", "text": "func (o Communicator) SendInt64s(vals []int64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Long], C.int(toID), C.int(tag), o.comm)\n}", "title": "" } ]
[ { "docid": "0e2a4a9dd29d47ce1026e05522b01c58", "score": "0.63357353", "text": "func (o Communicator) SendInt64(v int64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Send(buf, 1, dataTypes[Long], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "1eaac28490b6d2db121a6da2fea27be8", "score": "0.59933275", "text": "func (node *Node) SendInt64_call(otherNodeId int32, i int64) {\n\tconn := node.connector.ConnectedConns[otherNodeId]\n\tif conn == nil {\n\t\tutils.LogE(\"nil conn\")\n\t\treturn\n\t}\n\tmsg := protocol.SimpleMessageBuffer{}\n\tmsg.Init(define.SendInt64)\n\tmsg.WriteI64(i)\n\tnode.connector.WriteTo(otherNodeId, &msg)\n\t// msg.Write(conn)\n\tutils.LogI(fmt.Sprintf(\"Sent Int64 %d\", i))\n}", "title": "" }, { "docid": "9bc9156faee16ffed6196942c3217e40", "score": "0.5923051", "text": "func (o Communicator) SendUint64(v uint64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Send(buf, 1, dataTypes[Ulong], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "d164f902658e24639082b22438da189c", "score": "0.5638895", "text": "func (p *serializer) parseInt64(f reflect.Value, d Packet) error {\n\tval, err := d.Int64()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to parse int16: %v\", err)\n\t}\n\tf.SetInt(val)\n\treturn nil\n}", "title": "" }, { "docid": "4ca8c6ed9f9252aaabe09aeede332408", "score": "0.55823135", "text": "func (o Communicator) SendUint64s(vals []uint64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Ulong], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "45cc83fa4d3bcc3a5f6bb4f28f98994c", "score": "0.5259353", "text": "func (m *Message) PutInt64(q int64) {\n\terr := binary.Write(&m.body, goodOrdering, tInt64)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = binary.Write(&m.body, goodOrdering, q)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}", "title": "" }, { "docid": "ef4a3f406e8537cc8e540a340daed1f8", "score": "0.51960206", "text": "func (r *reply) send(bv uint64) error {\n\ttype resp struct {\n\t\tReqID, BV uint64\n\t\tData rlp.RawValue\n\t}\n\treturn p2p.Send(r.w, r.msgcode, resp{r.reqID, bv, r.data})\n}", "title": "" }, { "docid": "7b6d64d0e42d798a3603d2a59ea28a6e", "score": "0.5182021", "text": "func (enc *otLogEncoder) EmitInt64(key string, value int64) {\n\tenc.writeField(key, strconv.FormatInt(value, 10))\n}", "title": "" }, { "docid": "7a86959fda9ebdce0308f2d6dc69dc05", "score": "0.51033854", "text": "func AddInt64Consume(addr *int64, value int64) int64", "title": "" }, { "docid": "95e0e1f53bf1a9e0d021eb82360f4b9f", "score": "0.50790584", "text": "func (o Communicator) SendInt32(v int32, toID int, tag int) {\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Send(buf, 1, dataTypes[Int], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "626ef73f6036fec8f7cfcc8942837db7", "score": "0.5058018", "text": "func TestScriptBuilderAddInt64(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tval int64\n\t\texpected []byte\n\t}{\n\t\t{name: \"push -1\", val: -1, expected: []byte{btcscript.OP_1NEGATE}},\n\t\t{name: \"push small int 0\", val: 0, expected: []byte{btcscript.OP_0}},\n\t\t{name: \"push small int 1\", val: 1, expected: []byte{btcscript.OP_1}},\n\t\t{name: \"push small int 2\", val: 2, expected: []byte{btcscript.OP_2}},\n\t\t{name: \"push small int 3\", val: 3, expected: []byte{btcscript.OP_3}},\n\t\t{name: \"push small int 4\", val: 4, expected: []byte{btcscript.OP_4}},\n\t\t{name: \"push small int 5\", val: 5, expected: []byte{btcscript.OP_5}},\n\t\t{name: \"push small int 6\", val: 6, expected: []byte{btcscript.OP_6}},\n\t\t{name: \"push small int 7\", val: 7, expected: []byte{btcscript.OP_7}},\n\t\t{name: \"push small int 8\", val: 8, expected: []byte{btcscript.OP_8}},\n\t\t{name: \"push small int 9\", val: 9, expected: []byte{btcscript.OP_9}},\n\t\t{name: \"push small int 10\", val: 10, expected: []byte{btcscript.OP_10}},\n\t\t{name: \"push small int 11\", val: 11, expected: []byte{btcscript.OP_11}},\n\t\t{name: \"push small int 12\", val: 12, expected: []byte{btcscript.OP_12}},\n\t\t{name: \"push small int 13\", val: 13, expected: []byte{btcscript.OP_13}},\n\t\t{name: \"push small int 14\", val: 14, expected: []byte{btcscript.OP_14}},\n\t\t{name: \"push small int 15\", val: 15, expected: []byte{btcscript.OP_15}},\n\t\t{name: \"push small int 16\", val: 16, expected: []byte{btcscript.OP_16}},\n\t\t{name: \"push 17\", val: 17, expected: []byte{btcscript.OP_DATA_1, 0x11}},\n\t\t{name: \"push 65\", val: 65, expected: []byte{btcscript.OP_DATA_1, 0x41}},\n\t\t{name: \"push 127\", val: 127, expected: []byte{btcscript.OP_DATA_1, 0x7f}},\n\t\t{name: \"push 128\", val: 128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0}},\n\t\t{name: \"push 255\", val: 255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0}},\n\t\t{name: \"push 256\", val: 256, expected: []byte{btcscript.OP_DATA_2, 0, 0x01}},\n\t\t{name: \"push 32767\", val: 32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x7f}},\n\t\t{name: \"push 32768\", val: 32768, expected: []byte{btcscript.OP_DATA_3, 0, 0x80, 0}},\n\t\t{name: \"push -2\", val: -2, expected: []byte{btcscript.OP_DATA_1, 0x82}},\n\t\t{name: \"push -3\", val: -3, expected: []byte{btcscript.OP_DATA_1, 0x83}},\n\t\t{name: \"push -4\", val: -4, expected: []byte{btcscript.OP_DATA_1, 0x84}},\n\t\t{name: \"push -5\", val: -5, expected: []byte{btcscript.OP_DATA_1, 0x85}},\n\t\t{name: \"push -17\", val: -17, expected: []byte{btcscript.OP_DATA_1, 0x91}},\n\t\t{name: \"push -65\", val: -65, expected: []byte{btcscript.OP_DATA_1, 0xc1}},\n\t\t{name: \"push -127\", val: -127, expected: []byte{btcscript.OP_DATA_1, 0xff}},\n\t\t{name: \"push -128\", val: -128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0x80}},\n\t\t{name: \"push -255\", val: -255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x80}},\n\t\t{name: \"push -256\", val: -256, expected: []byte{btcscript.OP_DATA_2, 0x00, 0x81}},\n\t\t{name: \"push -32767\", val: -32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0xff}},\n\t\t{name: \"push -32768\", val: -32768, expected: []byte{btcscript.OP_DATA_3, 0x00, 0x80, 0x80}},\n\t}\n\n\tbuilder := btcscript.NewScriptBuilder()\n\tt.Logf(\"Running %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\tbuilder.Reset().AddInt64(test.val)\n\t\tresult := builder.Script()\n\t\tif !bytes.Equal(result, test.expected) {\n\t\t\tt.Errorf(\"ScriptBuilder.AddInt64 #%d (%s) wrong result\\n\"+\n\t\t\t\t\"got: %x\\nwant: %x\", i, test.name, result,\n\t\t\t\ttest.expected)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f8690017a9f7b7d8ef480f3744a3db4d", "score": "0.5056851", "text": "func (ed *eventData) writeInt64(value int64) {\n\t_ = binary.Write(&ed.buffer, binary.LittleEndian, value)\n}", "title": "" }, { "docid": "f554ca6d9894384ae64a9311d4c56452", "score": "0.50557727", "text": "func main() {\n\t// encode\n\tvar data uint64 = 123\n\tvar prim = y3.NewPrimitivePacketEncoder(0x01)\n\tprim.SetUInt64Value(data)\n\tbuf := prim.Encode()\n\t// decode\n\tres, _, _, _ := y3.DecodePrimitivePacket(buf)\n\tval, _ := res.ToUInt64()\n\tfmt.Printf(\"val=%d\", val)\n}", "title": "" }, { "docid": "c554441498ef14e21ca00266b2872ccd", "score": "0.4997869", "text": "func send(stat string, value interface{}, t metricType, sampleRate float32) {\n\tsendAsync(stat, value, t, sampleRate)\n}", "title": "" }, { "docid": "41557b58b2813634c9a83695f832247f", "score": "0.49924693", "text": "func (in senderInfo) setOctetCount(cnt uint32) {\n\tbinary.BigEndian.PutUint32(in[16:], cnt)\n}", "title": "" }, { "docid": "e2546ae1c6aa8e06f98174116384f962", "score": "0.49920493", "text": "func (o Communicator) RecvInt64(fromID, tag int) int64 {\n\tvar v int64\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Recv(buf, 1, dataTypes[Long], C.int(fromID), C.int(tag), o.comm, C.StIgnore)\n\treturn v\n}", "title": "" }, { "docid": "1fa50bc2fbe88d4c0c9cbf0ac466560a", "score": "0.4987116", "text": "func (t *TM1638Driver) send(data byte) {\n\tfor i := 0; i < 8; i++ {\n\t\tt.pintClock.Off()\n\n\t\tif (data & 1) > 0 {\n\t\t\tt.pinData.On()\n\t\t} else {\n\t\t\tt.pinData.Off()\n\t\t}\n\t\tdata >>= 1\n\n\t\tt.pintClock.On()\n\t}\n}", "title": "" }, { "docid": "90324c91d009249cff7e8b3f762807cf", "score": "0.49798593", "text": "func IdManager() {\n var i uint64\n for i = 0; ; i++ {\n idAssignmentChan <- strconv.FormatUint(i, 10)\n }\n}", "title": "" }, { "docid": "55c76ce131c8c7f3be187bc7594f257a", "score": "0.49789825", "text": "func SendGeneric(client protobuf.SGMSServiceClient, id string, _time time.Time, measurement string, tags map[string]string, fieldsInt64 map[string]int64, fieldsDouble map[string]float64) {\n\tvar c protobuf.Common\n\tc.EntityId = id\n\tvar ts google_protobuf1.Timestamp\n\tts.Seconds = _time.Unix()\n\tts.Nanos = int32(_time.Nanosecond())\n\tc.Timestamp = &ts\n\tvar g protobuf.Generic\n\tg.Common = &c\n\tg.Measurement = measurement\n\tg.Tags = tags\n\tg.FieldsInt64 = fieldsInt64\n\tg.FieldsDouble = fieldsDouble\n\n\tvar msg protobuf.SGMS\n\tmsg.Generic = append(msg.Generic, &g)\n\n\tclient.SendSGMS(context.Background(), &msg)\n\n}", "title": "" }, { "docid": "4bd6dd80d1484d8c76c4225068647ffc", "score": "0.49411258", "text": "func (enc *otLogEncoder) EmitInt(key string, value int) {\n\tenc.writeField(key, strconv.FormatInt(int64(value), 10))\n}", "title": "" }, { "docid": "653383a137ed41c210c66569fa25058a", "score": "0.49147493", "text": "func (o Communicator) SendFloat64(v float64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Send(buf, 1, dataTypes[Double], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "53aaa565dc121af6bdc7331fd0cad25c", "score": "0.48708445", "text": "func XorInt64Consume(addr *int64, value int64) int64", "title": "" }, { "docid": "f153063543bccec6004bed2254835303", "score": "0.4861664", "text": "func (p *ProgramNode) Send(ctx context.Context, in *pb.SendMessage) (*empty.Empty, error) {\n\tswitch in.Register {\n\tcase 0:\n\t\tp.r0 <- int(in.Value)\n\tcase 1:\n\t\tp.r1 <- int(in.Value)\n\tcase 2:\n\t\tp.r2 <- int(in.Value)\n\tcase 3:\n\t\tp.r3 <- int(in.Value)\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"not a valid register\")\n\t}\n\tlog.Printf(\"received value\")\n\treturn &empty.Empty{}, nil\n}", "title": "" }, { "docid": "68313e9e056102b845cb2221371a8977", "score": "0.48464808", "text": "func NandInt64Consume(addr *int64, value int64) int64", "title": "" }, { "docid": "531e7361d6839cb78b7092bd324d8887", "score": "0.48451895", "text": "func (c *connection) send(args []interface{}) (err error) {\n\tfor _, arg := range args {\n\t\tswitch arg := arg.(type) {\n\t\tcase string:\n\t\t\terr = c.writeBytes([]byte(arg))\n\t\tcase []byte:\n\t\t\terr = c.writeBytes(arg)\n\t\tcase int:\n\t\t\tbs := strconv.AppendInt(nil, int64(arg), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase int8:\n\t\t\terr = c.writeBytes([]byte{byte(arg)})\n\t\tcase int16:\n\t\t\tbs := strconv.AppendInt(nil, int64(arg), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase int32:\n\t\t\tbs := strconv.AppendInt(nil, int64(arg), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase int64:\n\t\t\tbs := strconv.AppendInt(nil, arg, 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase uint8:\n\t\t\terr = c.writeBytes([]byte{byte(arg)})\n\t\tcase uint16:\n\t\t\tbs := strconv.AppendUint(nil, uint64(arg), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase uint32:\n\t\t\tbs := strconv.AppendUint(nil, uint64(arg), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase uint64:\n\t\t\tbs := strconv.AppendUint(nil, arg, 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase float32:\n\t\t\tbs := strconv.AppendFloat(nil, float64(arg), 'g', -1, 32)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase float64:\n\t\t\tbs := strconv.AppendFloat(nil, arg, 'g', -1, 64)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase bool:\n\t\t\tif arg {\n\t\t\t\terr = c.writeBytes([]byte{'1'})\n\t\t\t} else {\n\t\t\t\terr = c.writeBytes([]byte{'0'})\n\t\t\t}\n\t\tcase time.Time:\n\t\t\tbs := strconv.AppendInt(nil, arg.Unix(), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase time.Duration:\n\t\t\tbs := strconv.AppendInt(nil, arg.Nanoseconds(), 10)\n\t\t\terr = c.writeBytes(bs)\n\t\tcase nil:\n\t\t\terr = c.writeBytes([]byte{})\n\t\tdefault:\n\t\t\tif c.encodingFunc == nil {\n\t\t\t\terr = errors.New(\"arguments cannot be serialized, please enable Encoding\")\n\t\t\t} else if tbs := c.encodingFunc(arg); tbs != nil {\n\t\t\t\terr = c.writeBytes(tbs)\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"arguments cannot be serialized, please check EncodingFunc\")\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif err := c.bufw.WriteByte(endN); err != nil {\n\t\treturn err\n\t}\n\tif err := c.sock.SetWriteDeadline(time.Now().Add(time.Second * time.Duration(c.writeTimeout))); err != nil {\n\t\treturn err\n\t}\n\tif err = c.bufw.Flush(); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ddf09561bf473da03f31b4b182af5157", "score": "0.48404354", "text": "func sendExperimentPayload(comm communication.Communication, pod *corev1.Pod, in time.Time, out time.Time, queueName string, hostname string) bool{\r\n\r\n respBytes, err := json.Marshal(communication.ExperimentPayload{Type:\"Scheduler\",InTime:in,OutTime:out,Pod:pod,Hostname: hostname})\r\n if err != nil {\r\n log.Fatalf(\"%s\", err)\r\n }\r\n\r\n err = comm.Send(respBytes,queueName)\r\n\r\n if err != nil{\r\n return false\r\n }\r\n\r\n return true\r\n}", "title": "" }, { "docid": "aa2a5711a7c37c196cec96d2af01e439", "score": "0.4839707", "text": "func (c *Client) send(name string, value int, unit string, action string) {\n\tm := Metric{\n\t\tname: name,\n\t\tunit: unit,\n\t}\n\n\ta := Amount{Value: value}\n\n\tc.input <- MetricWithAmount{m, a, action}\n}", "title": "" }, { "docid": "0487f562312ea9a13b05b745b3fa016b", "score": "0.48386097", "text": "func Push2InfluxdbSendQueue(items []*cmodel.MetaData) {\n\tfor _, item := range items {\n\t\t// align ts\n\t\tstep := int(item.Step)\n\t\tif step < MinStep {\n\t\t\tstep = MinStep\n\t\t}\n\t\tts := alignTs(item.Timestamp, int64(step))\n\n\t\tinfluxdbItem := &cmodel.JudgeItem{\n\t\t\tEndpoint: item.Endpoint,\n\t\t\tMetric: item.Metric,\n\t\t\tValue: item.Value,\n\t\t\tTimestamp: ts,\n\t\t\tJudgeType: item.CounterType,\n\t\t\tTags: item.Tags,\n\t\t}\n\t\tQ := InfluxdbQueues[\"default\"]\n\t\tisSuccess := Q.PushFront(influxdbItem)\n\n\t\t// statistics\n\t\tif !isSuccess {\n\t\t\tproc.SendToInfluxdbDropCnt.Incr()\n\t\t}\n\t}\n}", "title": "" }, { "docid": "db5a2bcdaf33a2d8b9e0c5170faf3877", "score": "0.48340693", "text": "func Int64(p *int64, name string, value int64, usage string) {\n\tflag.Int64Var(p, name, value, usage)\n\tfor _, c := range commands {\n\t\tc.Int64(p, name, value, usage)\n\t}\n}", "title": "" }, { "docid": "ee370d5007d80aecfef4a04ed45e6a4b", "score": "0.48291513", "text": "func XdrPutInt64(buffer *bytes.Buffer, i int64) {\n\tbuffer.WriteByte(byte(i >> 56))\n\tbuffer.WriteByte(byte(i >> 48))\n\tbuffer.WriteByte(byte(i >> 40))\n\tbuffer.WriteByte(byte(i >> 32))\n\tbuffer.WriteByte(byte(i >> 24))\n\tbuffer.WriteByte(byte(i >> 16))\n\tbuffer.WriteByte(byte(i >> 8))\n\tbuffer.WriteByte(byte(i))\n\treturn\n}", "title": "" }, { "docid": "f584daa46ff81e7bec1c179fb2b52693", "score": "0.48279908", "text": "func (o Communicator) SendFloat64s(vals []float64, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Double], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "82370136df42d1e4c7f47147b65cfb98", "score": "0.47756377", "text": "func(n *Node) sendUpdate(tag Tag){\n updateLog := n.log.Entries[tag.Time_stamp:]\n msg := n.createMessageWithLog(UPDATEINFO, \"\", updateLog)\n send(n.mem_list[tag.ID].Addr, msg)\n}", "title": "" }, { "docid": "a4ec11bed9b071cdd0187b254c426ea5", "score": "0.4760015", "text": "func (NoopTelemetryIngressBatchClient) Send(TelemPayload) {}", "title": "" }, { "docid": "ee4f1c778e2ffb61fc6a2cfab1057bf9", "score": "0.47508246", "text": "func (o Communicator) SendInt32s(vals []int32, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Int], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "51db5d6d4dcb2b4e315cc0979f684abd", "score": "0.47488296", "text": "func (e *env) push() error {\n\tfmt.Println(\"push: start\")\n\n\ts, err := e.T.Count(\"\")\n\tx, err := strconv.ParseInt(s, 10, 32)\n\tif err != nil {\n\t\treturn err\n\t}\n\tmax := int32(x)\n\tfmt.Printf(\"push: max is %v\\n\", max)\n\tfor i := e.Offset; i <= max; i += 500 {\n\t\te.N <- i\n\t}\n\tclose(e.N)\n\tfmt.Println(\"push: done\")\n\treturn nil\n}", "title": "" }, { "docid": "09e8313a604c5b2d341be346adc38150", "score": "0.4735478", "text": "func SendInvocationEnhancedMetric(tags []string, demux aggregator.Demultiplexer) {\n\tincrementEnhancedMetric(invocationsMetric, tags, float64(time.Now().UnixNano())/float64(time.Second), demux)\n}", "title": "" }, { "docid": "c47b580452f675d797fd046cdd94feb8", "score": "0.47331798", "text": "func tcAtoi64(eng *Engine, index int64, args []uint64) (uint64, error) {\n\tapp, _ := eng.RunningAppFrame()\n\tvmem := app.VM.VMemory()\n\taddr := args[0]\n\n\tpBytes, err := vmem.GetString(addr)\n\tif err != nil {\n\t\treturn 0, errors.New(\"[jsonMashalParams] GetString err:\" + err.Error())\n\t}\n\n\tif pBytes == nil || len(pBytes) == 0 {\n\t\treturn 0, nil\n\t}\n\n\tstr := TrimBuffToString(pBytes)\n\ti, err := strconv.ParseInt(str, 0, 64)\n\tif err != nil {\n\t\treturn 0, errors.New(\"[jsonMashalParams] Atoi err:\" + err.Error())\n\t}\n\teng.Logger().Debug(\"WASM RUN DebugLOG:call strToInt64\", \"str\", str, \"ret\", i)\n\treturn uint64(i), nil\n\n}", "title": "" }, { "docid": "7c6a1f535b2dd579867e83227d9b9d6f", "score": "0.4731132", "text": "func (put *PutBuffer) Int64(val int64) {\n\tput.vlsEncode(val)\n}", "title": "" }, { "docid": "7950eb547ad13de769e7689ac1f5d31a", "score": "0.47245428", "text": "func (node *Node) SendInt32_call(otherNodeId int32, i int32) {\n\tconn := node.connector.ConnectedConns[otherNodeId]\n\tif conn == nil {\n\t\tutils.LogE(\"nil conn\")\n\t\treturn\n\t}\n\tmsg := protocol.SimpleMessageBuffer{}\n\tmsg.Init(define.SendInt32)\n\tmsg.WriteI32(i)\n\tnode.connector.WriteTo(otherNodeId, &msg)\n\t// msg.Write(conn)\n\tutils.LogI(fmt.Sprintf(\"Sent Int32 %d\", i))\n}", "title": "" }, { "docid": "00647f1257a4b5312b54f772e0d0181b", "score": "0.4722762", "text": "func writeInt(w enhancedWriter, i int64) (int, error) {\n\tbp := numBufPool.Get().(*[]byte)\n\t*bp = strconv.AppendInt((*bp)[:0], i, 10)\n\twritten, err := w.Write(*bp)\n\tnumBufPool.Put(bp)\n\treturn written, err\n}", "title": "" }, { "docid": "6acdae421bdf9e6f444d4bfc7bf2faa8", "score": "0.47223553", "text": "func Int64Tag(name string, value int64) Tag {\n\treturn Tag{name: name, intvalue: value, typ: typeInt64}\n}", "title": "" }, { "docid": "4a63bf81ab062d8fc12afc1c5aadfe8e", "score": "0.47059354", "text": "func (enc *otLogEncoder) EmitUint64(key string, value uint64) {\n\tenc.writeField(key, strconv.FormatUint(value, 10))\n}", "title": "" }, { "docid": "6ad2a76b05d71883841438cd1469269d", "score": "0.47018164", "text": "func (s *Service) PushMids(c context.Context, op int32, mids []int64, msg string, contentType int32) (err error) {\n\tif len(mids) > _maxPushBatch {\n\t\terr = ecode.LimitExceed\n\t\treturn\n\t}\n\tnow := time.Now().Unix()\n\ts.stats.Info(\"push_mids\", op, xstr.JoinInts(mids), \"\", \"\", len(mids), now)\n\tkeyServers, olMids, err := s.dao.KeysByMids(c, mids)\n\tif err != nil {\n\t\treturn\n\t}\n\tkeys := make(map[string][]string)\n\tfor key, server := range keyServers {\n\t\tif key != \"\" && server != \"\" {\n\t\t\tkeys[server] = append(keys[server], key)\n\t\t} else {\n\t\t\tlog.Warn(\"push key:%s server:%s is empty\", key, server)\n\t\t}\n\t}\n\tfor server, keys := range keys {\n\t\tif err = s.dao.PushMsg(c, op, server, msg, keys, contentType); err != nil {\n\t\t\treturn\n\t\t}\n\t}\n\ts.stats.Info(\"push_mids_ol\", op, xstr.JoinInts(olMids), \"\", \"\", len(olMids), now)\n\treturn\n}", "title": "" }, { "docid": "f51258d8439eabb97e973b917acba2be", "score": "0.47014973", "text": "func TestScriptBuilderAddUint64(t *testing.T) {\n\ttests := []struct {\n\t\tname string\n\t\tval uint64\n\t\texpected []byte\n\t}{\n\t\t{name: \"push small int 0\", val: 0, expected: []byte{btcscript.OP_0}},\n\t\t{name: \"push small int 1\", val: 1, expected: []byte{btcscript.OP_1}},\n\t\t{name: \"push small int 2\", val: 2, expected: []byte{btcscript.OP_2}},\n\t\t{name: \"push small int 3\", val: 3, expected: []byte{btcscript.OP_3}},\n\t\t{name: \"push small int 4\", val: 4, expected: []byte{btcscript.OP_4}},\n\t\t{name: \"push small int 5\", val: 5, expected: []byte{btcscript.OP_5}},\n\t\t{name: \"push small int 6\", val: 6, expected: []byte{btcscript.OP_6}},\n\t\t{name: \"push small int 7\", val: 7, expected: []byte{btcscript.OP_7}},\n\t\t{name: \"push small int 8\", val: 8, expected: []byte{btcscript.OP_8}},\n\t\t{name: \"push small int 9\", val: 9, expected: []byte{btcscript.OP_9}},\n\t\t{name: \"push small int 10\", val: 10, expected: []byte{btcscript.OP_10}},\n\t\t{name: \"push small int 11\", val: 11, expected: []byte{btcscript.OP_11}},\n\t\t{name: \"push small int 12\", val: 12, expected: []byte{btcscript.OP_12}},\n\t\t{name: \"push small int 13\", val: 13, expected: []byte{btcscript.OP_13}},\n\t\t{name: \"push small int 14\", val: 14, expected: []byte{btcscript.OP_14}},\n\t\t{name: \"push small int 15\", val: 15, expected: []byte{btcscript.OP_15}},\n\t\t{name: \"push small int 16\", val: 16, expected: []byte{btcscript.OP_16}},\n\t\t{name: \"push 17\", val: 17, expected: []byte{btcscript.OP_DATA_1, 0x11}},\n\t\t{name: \"push 65\", val: 65, expected: []byte{btcscript.OP_DATA_1, 0x41}},\n\t\t{name: \"push 127\", val: 127, expected: []byte{btcscript.OP_DATA_1, 0x7f}},\n\t\t{name: \"push 128\", val: 128, expected: []byte{btcscript.OP_DATA_2, 0x80, 0}},\n\t\t{name: \"push 255\", val: 255, expected: []byte{btcscript.OP_DATA_2, 0xff, 0}},\n\t\t{name: \"push 256\", val: 256, expected: []byte{btcscript.OP_DATA_2, 0, 0x01}},\n\t\t{name: \"push 32767\", val: 32767, expected: []byte{btcscript.OP_DATA_2, 0xff, 0x7f}},\n\t\t{name: \"push 32768\", val: 32768, expected: []byte{btcscript.OP_DATA_3, 0, 0x80, 0}},\n\t}\n\n\tbuilder := btcscript.NewScriptBuilder()\n\tt.Logf(\"Running %d tests\", len(tests))\n\tfor i, test := range tests {\n\t\tbuilder.Reset().AddUint64(test.val)\n\t\tresult := builder.Script()\n\t\tif !bytes.Equal(result, test.expected) {\n\t\t\tt.Errorf(\"ScriptBuilder.AddUint64 #%d (%s) wrong result\\n\"+\n\t\t\t\t\"got: %x\\nwant: %x\", i, test.name, result,\n\t\t\t\ttest.expected)\n\t\t\tcontinue\n\t\t}\n\t}\n}", "title": "" }, { "docid": "f5c3a75f841cf906faa82793ec40c666", "score": "0.46937948", "text": "func (o Communicator) RecvInt64s(fromID int, tag int) []int64 {\n\tl := o.Probe(fromID, tag).GetCount(Long)\n\tbuf := make([]int64, l)\n\to.RecvPreallocInt64s(buf, fromID, tag)\n\treturn buf\n}", "title": "" }, { "docid": "d7d96e50900fcf45bcb5dd65d5398d4c", "score": "0.4691548", "text": "func send_recv_val(val *big.Int, p int, server_list []sv.Server, stage string, client_id int, fss *big.Int) ([]*big.Int, error) {\r\n\tvals := make([]*big.Int, p)\r\n\tfor i := 0; i < p; i++ {\r\n\t\tvals[i] = new(big.Int).Add(val, big.NewInt(0))\r\n\t}\r\n\t\r\n\tres, _, err := send_recv_array(vals, p, server_list, stage, client_id, fss)\r\n\treturn res, err\r\n}", "title": "" }, { "docid": "d9842da883a9e6e8ba19563eeaafafe2", "score": "0.4690314", "text": "func (e *Ethereum) Send(fromAddress, toAddress, token, amount string, data []byte, key string, priceIn uint64,\n\tdryRun bool) (fee *big.Int, hash []byte, err error) {\n\tvar price, gas uint64\n\tprice, gas, hash, err = e.c.SendTrx(fromAddress, toAddress, token, amount, data, key, priceIn, dryRun)\n\tfee = new(big.Int).SetUint64(price)\n\n\tvar gB *big.Int = new(big.Int).SetUint64(gas)\n\tfee = fee.Mul(fee, gB)\n\n\treturn\n}", "title": "" }, { "docid": "4c43bdf16d6f533904691a470e66abb6", "score": "0.4687968", "text": "func (p *serializer) parseUint64(f reflect.Value, d Packet) error {\n\tval, err := d.Uint64()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to parse int8: %v\", err)\n\t}\n\tf.SetUint(val)\n\treturn nil\n}", "title": "" }, { "docid": "e83fd74c1a5c316cb0f8554b7e60b1c9", "score": "0.46722332", "text": "func (p *ProgramNode) sendValue(v int, target string) error {\n\tif m := regexp.MustCompile(`^(\\w+):(R[0123])$`).FindStringSubmatch(target); len(m) > 0 {\n\t\ttargetURI := m[1]\n\n\t\t// TODO: change parser to get ints\n\t\tvar register int32\n\t\tswitch m[2] {\n\t\tcase \"R0\":\n\t\t\tregister = 0\n\t\tcase \"R1\":\n\t\t\tregister = 1\n\t\tcase \"R2\":\n\t\t\tregister = 2\n\t\tcase \"R3\":\n\t\t\tregister = 3\n\t\t}\n\n\t\tconn, err := grpc.Dial(fmt.Sprintf(\"%s%s\", targetURI, grpcPort), p.dialOpts...)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"did not connect: %v\", err)\n\t\t}\n\t\tdefer conn.Close()\n\t\tc := pb.NewProgramClient(conn)\n\t\t_, err = c.Send(p.ctx, &pb.SendMessage{Register: register, Value: int32(v)})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\treturn fmt.Errorf(\"'%s' not a valid network register\", target)\n}", "title": "" }, { "docid": "8b29d67c6f522332c0af13c6eb190aa4", "score": "0.46714774", "text": "func (enc *MMSEncoder) writeInteger(i uint64) error {\n\tif i < 0x80 {\n\t\treturn enc.writeShortInteger(i)\n\t} else {\n\t\treturn enc.writeLongInteger(i)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76df9f0fa0dba3bd2ff8cf7eaabf04dc", "score": "0.46712917", "text": "func (b *Buffer) WriteInt(i int64) {\n *b = strconv.AppendInt(*b, i, 10)\n}", "title": "" }, { "docid": "7aabdec96a08c678173a4aa4b6c8ae3b", "score": "0.46356964", "text": "func (p SmoothIsogeny) Int() *big.Int { return p.p }", "title": "" }, { "docid": "f2c4ba6c2930cacd98a2d076a6dfd7cc", "score": "0.46327603", "text": "func PutVarint(buf []byte, x int64) int", "title": "" }, { "docid": "aceff31907c8e15fae2cdacccbffb04e", "score": "0.4630656", "text": "func push2InfluxDB() {\n\t// prepare to start work\n\talignPushStartTs(step)\n\t// add a timer\n\tt := time.Now().UTC()\n\t_, offset := t.Zone()\n\tlocal := int64(offset)\n\tti := time.Tick(time.Duration(step) * time.Second)\n\tfor range ti {\n\t\t// collection event count\n\t\tselfMeter(\"pfc.push.cnt\", 1) // statistics\n\t\t// current collection of all data indicators\n\t\tfms := influxDBMetrics()\n\t\t// get local time\n\t\tstart := time.Now()\n\t\t// push data\n\t\terr := influxDBPusher(fms, local, gdebug)\n\t\t// push time\n\t\tselfGauge(\"pfc.push.ms\", int64(time.Since(start)/time.Millisecond)) // statistics\n\n\t\tif err != nil {\n\t\t\tif gdebug {\n\t\t\t\tlog.Printf(\"[goappmonitor] send to %s error: %v\", api, err)\n\t\t\t}\n\t\t\t// failure case, push data size of 0\n\t\t\tselfGauge(\"pfc.push.size\", int64(0)) // statistics\n\t\t} else {\n\t\t\t// push data size\n\t\t\tselfGauge(\"pfc.push.size\", int64(len(fms))) // statistics\n\t\t}\n\t}\n}", "title": "" }, { "docid": "adfbad3da2c69f1f4e8fc7a1effcc3b0", "score": "0.4626181", "text": "func Int64Tag(key string, value int64) Tag {\n\treturn Tag{key, value}\n}", "title": "" }, { "docid": "a71bab21f7753d699d74d7bc1b562b62", "score": "0.46204817", "text": "func sendData(sendch chan<- int) {\n\tsendch <- 10\n}", "title": "" }, { "docid": "af4c9dbdaf6728006a43a0fcb63e71c0", "score": "0.46163148", "text": "func (o Communicator) SendBytes(vals []byte, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Byte], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "61d7eed6bb8dbc7c5d028be110ab3471", "score": "0.46135774", "text": "func AndInt64Consume(addr *int64, value int64) int64", "title": "" }, { "docid": "d0a0c40646042f890b20518ea426b356", "score": "0.46127677", "text": "func (o Communicator) RecvUint64(fromID, tag int) uint64 {\n\tvar v uint64\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Recv(buf, 1, dataTypes[Ulong], C.int(fromID), C.int(tag), o.comm, C.StIgnore)\n\treturn v\n}", "title": "" }, { "docid": "43acb7497da1bc152e69a9d096bd04ef", "score": "0.4606891", "text": "func (a *PerformanceStatsEncoder) SubmitWithTags(val interface{}, tags map[string]string) {\n\ta.Lock()\n\ta.Buffer.Reset()\n\terr := a.Encoder.EncodeWithoutTypes(ToolName, val, tags)\n\tif err != nil {\n\t\tif a.Logger != nil {\n\t\t\ta.Logger.WithFields(log.Fields{}).Warn(err)\n\t\t}\n\t}\n\tline := strings.TrimSpace(a.Buffer.String())\n\tif line == \"\" {\n\t\ta.Logger.WithFields(log.Fields{}).Warn(\"skipping empty influx line\")\n\t\ta.Unlock()\n\t\treturn\n\t}\n\tjsonString := []byte(line)\n\ta.Submitter.SubmitWithHeaders(jsonString, \"\", \"text/plain\", map[string]string{\n\t\t\"database\": \"telegraf\",\n\t\t\"retention_policy\": \"default\",\n\t})\n\ta.Unlock()\n}", "title": "" }, { "docid": "36c4e6352cbdb1a31aa85489512a9683", "score": "0.46023571", "text": "func (h *gateHandler) SendBatch(Sessionids string, topic string, body []byte) (int64, error) {\n\tsessionids := strings.Split(Sessionids, \",\")\n\tvar count int64 = 0\n\tvar err error\n\tfor _, sessionid := range sessionids {\n\t\tagent := h.sessions.Get(sessionid)\n\t\tif agent == nil {\n\t\t\t//log.Warning(\"No Sesssion found\")\n\t\t\tcontinue\n\t\t}\n\t\terr = agent.(gate.Agent).WriteMsg(topic, body)\n\t\tif err != nil {\n\t\t\tlog.Warning(\"WriteMsg error:\", err.Error())\n\t\t} else {\n\t\t\tcount++\n\t\t}\n\t}\n\treturn count, err\n}", "title": "" }, { "docid": "d6a79ef68dd0ea395aba19e59492c99e", "score": "0.45911202", "text": "func (t *NativeTransmitter) send(pulses HighLow, pulseLength uint) {\n\tt.gpioPin.High()\n\tsleepFor(time.Microsecond * time.Duration(pulseLength*pulses.High))\n\tt.gpioPin.Low()\n\tsleepFor(time.Microsecond * time.Duration(pulseLength*pulses.Low))\n}", "title": "" }, { "docid": "0d0b734cc831601b3450ab543195ae0f", "score": "0.4586726", "text": "func (o Communicator) SendUInt32s(vals []uint32, toID int, tag int) {\n\tbuf := unsafe.Pointer(&vals[0])\n\tC.MPI_Send(buf, C.int(len(vals)), dataTypes[Uint], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "9a9303fbf4eda6e98b9beec3ec6bfeb1", "score": "0.4578071", "text": "func sendPacketsOfSpecificSize( identifier int32, packetSizeInBytes int, totalBitsToSend int, conn net.Conn ) error {\n\n\tnoPackets := (totalBitsToSend/8) / packetSizeInBytes\n\tpacket := generatePacket(packetSizeInBytes)\n\n\tfor i:=0;i<noPackets;i++ {\n\n\t\tn, err := conn.Write(packet)\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Unable to write bytes!!! error! %s\\n\", err.Error())\n\t\t\treturn err\n\t\t}\n\n\t\tif n != packetSizeInBytes {\n\t\t\tlog.Printf(\"unable to send all of packet... something wrong\\n\")\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d206494418ac47dffce8c929b9e821b7", "score": "0.45775002", "text": "func (bp *BatchPinger) batchSendICMP() {\n\tfor _, pinger := range bp.mapIpPinger {\n\t\tpinger.SendICMP(bp.seqID)\n\t\tpinger.PacketsSent++\n\t}\n\tbp.seqID = (bp.seqID + 1) & 0xffff\n}", "title": "" }, { "docid": "e735aaa8d842d94695ffa1c8e91528f6", "score": "0.45760953", "text": "func parseInt64Parameter(param string) (int64, error) {\n\treturn strconv.ParseInt(param, 10, 64)\n}", "title": "" }, { "docid": "a72a5c118f26f7556f5b96b4e924029c", "score": "0.4564827", "text": "func (v *SecondService_EchoI64_Args) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TI64}); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteInt64(v.Arg); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "05d19a761097c4a3de0480b895bf490e", "score": "0.45625594", "text": "func (o Communicator) SendUint32(v uint32, toID int, tag int) {\n\tbuf := unsafe.Pointer(&v)\n\tC.MPI_Send(buf, 1, dataTypes[Uint], C.int(toID), C.int(tag), o.comm)\n}", "title": "" }, { "docid": "76f6cb29844956a69dcbcd42c10f9c61", "score": "0.45589504", "text": "func PutInt64(key, value int64, kv Runnable) error {\n\treturn kv.Run(client.Put(proto.Key([]byte(strconv.FormatInt(key, Base))), []byte(strconv.FormatInt(value, Base))))\n}", "title": "" }, { "docid": "9237c76a9332a7fdd5fbc4fc40a8a9a4", "score": "0.4558779", "text": "func (e *basicEncoderImpl) encodeBasicInt64(input interface{}) *PrimitivePacketEncoder {\n\tvar encoder = NewPrimitivePacketEncoder(int(e.observe))\n\tencoder.SetInt64Value(input.(int64))\n\treturn encoder\n}", "title": "" }, { "docid": "cca409ae7e90795bfce9eb6c73ae4b0b", "score": "0.4553311", "text": "func LoadInt64Consume(addr *int64) int64", "title": "" }, { "docid": "6f34a6537de03d8efa090b081b88bdb4", "score": "0.45412004", "text": "func (e *endpoint) ixySend(queueID uint16, b1, b2, b3 []byte) *tcpip.Error {\n\t// Naive, would be better to group packets into a bigger []*(driver.PktBuf) but I don't think we can\n\t// buffer array for RxBatch\n\n\t// lock mempool mutex (mempools are not thread safe)\n\te.txMempools[queueID].mu.Lock()\n\tdefer e.txMempools[queueID].mu.Unlock()\n\t// allocate a single packet\n\tpbuf := driver.PktBufAlloc(e.txMempools[queueID].mempool) // -> trying to send a packet on a queue that doesn't exist fails here\n\tif pbuf == nil {\n\t\treturn tcpip.ErrNoBufferSpace\n\t}\n\t// copy the packet into the mempool. If the packet is longer then Pkt.Size, the rest is dropped\n\tat := copy(pbuf.Pkt, b1)\n\tif len(b2) != 0 {\n\t\tat += copy(pbuf.Pkt[at:], b2)\n\t\tif len(b3) != 0 {\n\t\t\tat += copy(pbuf.Pkt[at:], b3)\n\t\t}\n\t}\n\tpbuf.Size = uint32(at)\n\t// add packet to the sending slice\n\ttb := e.txBufs[queueID]\n\ttb.bufs[tb.filled] = pbuf\n\ttb.filled++\n\n\t// check whether batchSize has been reached -> send\n\tif tb.filled == e.batchSize {\n\t\ttb.timer.Stop()\n\t\te.sendTx(queueID)\n\t\treturn nil\n\t}\n\t// otherwise\n\te.setTxTimer(queueID)\n\treturn nil\n}", "title": "" }, { "docid": "7983e67a6fc01a8c7d049c120fa0b651", "score": "0.45390636", "text": "func handler(items ...string) []string {\n\tfor _, s := range items {\n\t\tid, _ := strconv.ParseInt(s, 10, 64)\n\t\ttestPR(id)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f562504feebed8e34fd2e81cb6bcb9d3", "score": "0.45336992", "text": "func (m *InfluxMeasurement) SnmpBulkData(snmp *gosnmp.GoSNMP) (int64, int64, error) {\n\n\tnow := time.Now()\n\tvar sent int64\n\tvar errs int64\n\n\tsetRawData := func(pdu gosnmp.SnmpPDU) error {\n\t\tm.log.Debugf(\"received SNMP pdu:%+v\", pdu)\n\t\tif pdu.Value == nil {\n\t\t\tm.log.Warnf(\"no value retured by pdu :%+v\", pdu)\n\t\t\treturn nil //if error return the bulk process will stop\n\t\t}\n\t\tif metric, ok := m.oidSnmpMap[pdu.Name]; ok {\n\t\t\tm.log.Debugln(\"OK measurement \", m.cfg.ID, \"SNMP RESULT OID\", pdu.Name, \"MetricFound\", pdu.Value)\n\t\t\tmetric.setRawData(pduVal2Int64(pdu), now)\n\t\t} else {\n\t\t\tm.log.Debugf(\"returned OID from device: %s Not Found in measurement /metric list: %+v\", pdu.Name, m.cfg.ID)\n\t\t}\n\t\treturn nil\n\t}\n\tfor _, v := range m.cfg.fieldMetric {\n\t\tif err := snmp.BulkWalk(v.BaseOID, setRawData); err != nil {\n\t\t\tm.log.Errorf(\"SNMP (%s) for OID (%s) get error: %s\\n\", snmp.Target, v.BaseOID, err)\n\t\t\terrs++\n\t\t}\n\t\tsent++\n\t}\n\n\treturn sent, errs, nil\n}", "title": "" }, { "docid": "f1645b19a5980681c8cedbb13351af62", "score": "0.45245212", "text": "func Varint(buf []byte) (int64, int)", "title": "" }, { "docid": "da0638f72dfe01431147defe4192e784", "score": "0.4522486", "text": "func PutUvarint(buf []byte, x uint64) int", "title": "" }, { "docid": "f81ef0953c550c35ae4213eeebca637c", "score": "0.45213833", "text": "func Send(ctx context.Context, opts Options, forEachValue func(func(key string, value float64))) (err error) {\n\taddr, err := net.ResolveUDPAddr(\"udp\", opts.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tconn, err := net.DialUDP(\"udp\", nil, addr)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer func() {\n\t\t_ = conn.Close()\n\t}()\n\n\tif opts.PacketSize == 0 {\n\t\topts.PacketSize = 1024\n\t}\n\n\tvar (\n\t\tbuf []byte\n\t\tw = admproto.NewWriterWith(opts.ProtoOpts)\n\t)\n\n\tforEachValue(func(key string, value float64) {\n\t\t// if we have any errors, stop.\n\t\tif err != nil {\n\t\t\treturn\n\t\t}\n\n\t\tfor {\n\t\t\t// keep track of the buffer before we send\n\t\t\tbefore := buf\n\n\t\t\t// always ensure the buffer has the prefix in it.\n\t\t\tif len(buf) == 0 {\n\t\t\t\t// if we can't add the application and instance id, it's fatal.\n\t\t\t\tbuf, err = w.Begin(buf, opts.Application, opts.InstanceID, len(opts.Headers))\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tfor key, value := range opts.Headers {\n\t\t\t\t\tbuf, err = w.AppendHeader(buf, []byte(key), []byte(value))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// add the value to the buffer\n\t\t\tbuf, err = w.Append(buf, key, value)\n\t\t\tif err != nil {\n\t\t\t\t// not fatal, just back up to before, but let someone know\n\t\t\t\t// it has been skipped.\n\t\t\t\tlog.Println(\"skipped metric\", key, \"because\", err)\n\t\t\t\tbuf, err = before, nil\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// if we're still in the packet size, then get the next metric.\n\t\t\tif len(buf)+4 <= opts.PacketSize {\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\t// if we're over the packet size, send the previous value and start\n\t\t\t// over. be sure to account for the checksum that sendPacket adds.\n\t\t\t// if buf was empty at the start, we should just send it.\n\t\t\t// otherwise we should send the previous value.\n\t\t\tif len(before) == 0 {\n\t\t\t\tsendPacket(ctx, conn, buf)\n\t\t\t} else {\n\t\t\t\tsendPacket(ctx, conn, before)\n\t\t\t}\n\n\t\t\t// after sending the packet, we should reset the buffer and try to\n\t\t\t// add the point again.\n\t\t\tw.Reset()\n\t\t\tbuf = buf[:0]\n\n\t\t\t// if we had no buffer at the start, then we sent this metric, so\n\t\t\t// return to get the next metric.\n\t\t\tif len(before) == 0 {\n\t\t\t\treturn\n\t\t\t}\n\t\t}\n\t})\n\t// send off any remainder buf. we're guaranteed by the loop above that if\n\t// there is any data in buf it forms a valid packet with metrics in it.\n\tif err == nil && len(buf) > 0 {\n\t\tsendPacket(ctx, conn, buf)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "766680530411545b8198a19f8347cf88", "score": "0.45181698", "text": "func Publish(propMap map[string]string) error{\n\n var eventName string\n var err error\n var ok bool\n var regEvent reflect.Type\n err = nil\n if eventName, ok = propMap[\"EventName\"]; !ok {\n err = errors.New(\"Event name not specified\")\n return err\n }\n eventName = \"events.\" + eventName\n fmt.Println(\"event name\", eventName)\n\n regEvent = proto.MessageType(eventName)\n if regEvent == nil {\n return fmt.Errorf(\"Event %s not registered\", eventName)\n }\n\n eventPtr := reflect.New(regEvent.Elem())\n event := eventPtr.Elem()\n eventType := event.Type()\n\n propMap[\"ComponentName\"] = comp.name\n\n for key, value := range propMap {\n fmt.Printf(\"Key:%s,Value:%s\\n\", key,value)\n field := event.FieldByName(key)\n val := reflect.ValueOf(value)\n\n if !field.IsValid() {\n return fmt.Errorf(\"No such field '%s' in event '%s'\", key, eventName)\n }\n\n // If obj field value is not settable an error is thrown\n if !field.CanSet() {\n return fmt.Errorf(\"Field '%s' is unsettable\", key)\n }\n\n if field.Type() != val.Type() {\n if(key == \"Priority\"){\n valInt, _ := strconv.Atoi(value)\n valInt32 := int32(valInt)\n val = reflect.ValueOf(valInt32)\n }else {\n return fmt.Errorf(\"Provided value doesn't match '%s' field's type\", key)\n }\n }\n field.Set(val)\n }\n\n //TO-DO : remove some of these debug statements later\n fmt.Println(\"After setting\")\n for i:=0; i < event.NumField(); i++ {\n f := event.Field(i)\n fmt.Printf(\"%s:%s\\n\", eventType.Field(i).Name, f.Interface())\n }\n\n eventInterface := eventPtr.Interface().(proto.Message)\n serialData, err := proto.Marshal(eventInterface)\n if err != nil {\n fmt.Println(\"Error marshaling data, Error:\", err)\n return err\n }\n\n fmt.Println(\"serial data\", serialData)\n comp.queue <- serialData\n\n return err\n}", "title": "" }, { "docid": "7f65d8f9655c04c02cebb06586c2376e", "score": "0.4517601", "text": "func (self *Task) PutIntParam(param Iparam,parvalue int32) (err error) {\n if _tmp1096 := C.MSK_putintparam(self.ptr(),C.int32_t(param),C.int32_t(parvalue)); _tmp1096 != 0 {\n lastcode,lastmsg := self.getlasterror(_tmp1096)\n err = &MosekError{code:Rescode(lastcode),msg:lastmsg}\n return\n }\n return\n}", "title": "" }, { "docid": "c09a3b5ab62608dc001ddeb40bca0790", "score": "0.4510203", "text": "func (o InterconnectAttachmentPrivateInfoResponseOutput) Tag8021q() pulumi.IntOutput {\n\treturn o.ApplyT(func(v InterconnectAttachmentPrivateInfoResponse) int { return v.Tag8021q }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "6fd6b0491c8f72872f557566992273ae", "score": "0.4507637", "text": "func Send(w io.Writer, data []byte) (int, error) {\n\tn := len(data)\n\tb := Uint32ToBytes(uint32(n))\n\t_, err := w.Write(b)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\t_, err = w.Write(data)\n\tif err != nil {\n\t\treturn 0, err\n\t}\n\n\treturn (n + 4), nil\n}", "title": "" }, { "docid": "a3acf6403bbe0b47ffaaee069ce6c705", "score": "0.45051137", "text": "func doPUSH(em *Emulator, word uint16) (cycles uint) {\n d := (word & 0x01F0) >> 4\n em.push(em.regs[d])\n\n if em.Spec.Family == spec.XMEGA {\n return 1\n } else {\n return 2\n }\n}", "title": "" }, { "docid": "c64d7191e0879cbbdead0c453e12b947", "score": "0.44998425", "text": "func SendToNagios(str string) {\n\tform := url.Values{\n\t\t\"perfdata\": {str},\n\t}\n\tform.Add(\"ln\", \"ln\")\n\tform.Add(\"ip\", \"ip\")\n\tform.Add(\"ua\", \"ua\")\n\n\treq, err := http.NewRequest(\"POST\", \"http://10.59.20.16:8000\", strings.NewReader(form.Encode()))\n\tif err != nil {\n\t\tl.Fatal(err)\n\t}\n\treq.SetBasicAuth(\"fed_monitor\", \"l3tm31n\")\n\treq.Header.Set(\"Content-Type\", \"application/x-www-form-urlencoded\")\n\tcli := &http.Client{\n\t\tTimeout: 1 * time.Second,\n\t}\n\tresp, err := cli.Do(req)\n\tif err != nil {\n\t\tl.Fatal(err)\n\t}\n\tl.Printf(\"Resp %#v \\n\", resp)\n}", "title": "" }, { "docid": "f650347599232372747c92d17468c4ba", "score": "0.44985282", "text": "func (c *Composer) composeUin64(i uint64) (int, error) {\n\tbuf := []byte{\n\t\tbyte(i >> 56), byte(i >> 48), byte(i >> 40), byte(i >> 32),\n\t\tbyte(i >> 24), byte(i >> 16), byte(i >> 8), byte(i),\n\t}\n\tif _, err := c.write(buf); err != nil {\n\t\treturn 0, err\n\t}\n\treturn 8, nil\n}", "title": "" }, { "docid": "cdddbaf612aa26cc6bc697067390834a", "score": "0.44937056", "text": "func (c *Client) Send(stream generated.FindMaxNumber_GetMaxNumberClient, number int64) error {\n\tn := &generated.Number{Number: number}\n\terr := stream.Send(n)\n\tif err != nil {\n\t\tfmt.Println(\"Error while sending Stream: \", err)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fc1e58e2116a0f9668651b5bb0dabbbe", "score": "0.44882923", "text": "func Set(uint64) error { return nil }", "title": "" }, { "docid": "505066ee331b9728f18648ca4e236e24", "score": "0.44871047", "text": "func (in senderInfo) setPacketCount(cnt uint32) {\n\tbinary.BigEndian.PutUint32(in[12:], cnt)\n}", "title": "" }, { "docid": "cda2a62ac1f00016f371120411cd7bb4", "score": "0.44843593", "text": "func (self *State)SetInt64(a *int64,b any){\n self.IncOperations(self.coeff[\"assign\"]+self.off[\"assign\"])\n *a = b.(int64)\n}", "title": "" }, { "docid": "f87c504f3689cdc5c161f8e07cf5a161", "score": "0.44822326", "text": "func processData(data *Response) {\n\tif data == nil || len(data.DataItems) == 0 {\n\t\tstatus.SetCurrentValue(\"Empty response.\")\n\t\treturn\n\t}\n\tfmt.Println(data.DataItems[0].data)\n\t// transform the response to an int number\n\tvar value uint16\n\tslice := []byte{data.DataItems[0].data[1], data.DataItems[0].data[0]}\n\tvalue = binary.LittleEndian.Uint16(slice)\n\n\t// Print data\n\tvalueDataItem := app.ClientDataModel().FindDataItemByName(\"valueData\").(model.IntegerDataItem)\n\tvalueDataItem.SetCurrentValue(int32(value))\n\n\t// ADD YOUR CODE HERE\n\t// example: increment the value by 1 and write it to a holding register\n\tif value >= math.MaxUint16-1 {\n\t\tstatus.SetCurrentValue(\"Integer overflow detected! Value will be reset to 0.\")\n\t\tvalue = 0\n\t}\n\tvalue++\n\t_, err := client.WriteSingleRegister(address, value)\n\tif err != nil {\n\t\tstatus.SetCurrentValue(\"Can't write to register.\")\n\t}\n}", "title": "" }, { "docid": "a7c382bb63e97d0c55cbda977f3a4e43", "score": "0.44744182", "text": "func encodeUint64(buf *bytes.Buffer, i uint64) {\n\tif i == 0 {\n\t\tbuf.WriteByte(0x14)\n\t\treturn\n\t}\n\n\tvar n int\n\tvar ibuf bytes.Buffer\n\n\tn = bisectLeft(uint64(i))\n\tbuf.WriteByte(byte(0x14 + n))\n\tbinary.Write(&ibuf, binary.BigEndian, i)\n\n\tbuf.Write(ibuf.Bytes()[8-n:])\n}", "title": "" }, { "docid": "cafbaf2172e59bb37b3d783e045179d8", "score": "0.44740257", "text": "func (kb *KeyBuffer) Int64(val int64) {\n\tkb.write(KeyInt64(val))\n}", "title": "" }, { "docid": "dc87c1bb62741189457327751b7d074b", "score": "0.44704938", "text": "func (s *BasePayloadSender) send(payload *Payload) (SendStats, error) {\n\tif payload == nil {\n\t\treturn SendStats{}, nil\n\t}\n\n\tstartFlush := time.Now()\n\terr := s.endpoint.Write(payload)\n\n\tsendStats := SendStats{\n\t\tSendTime: time.Since(startFlush),\n\t}\n\n\treturn sendStats, err\n}", "title": "" }, { "docid": "bb0369b7210a8109a596512347c9ace1", "score": "0.44684792", "text": "func sumGeneric(out *[TagSize]byte, msg []byte, key *[32]byte) {\n\th := newMACGeneric(key)\n\th.Write(msg)\n\th.Sum(out)\n}", "title": "" }, { "docid": "1b29af125a59c60189b680987ffc14c0", "score": "0.4465568", "text": "func Int64(vs url.Values, k string, is ...int) int64 {\n\tn, _ := strconv.ParseInt(get(vs, k, is), 0, 16)\n\treturn n\n}", "title": "" }, { "docid": "dde08d11218ec9ad22c24dfe9e9dc9a4", "score": "0.44602364", "text": "func (e *Encoder) encodeUInt64(v cadence.UInt64) error {\n\treturn e.enc.EncodeUint64(uint64(v))\n}", "title": "" }, { "docid": "931414cf326a35e5f7c31ec34e942042", "score": "0.44597545", "text": "func (c *Client) send(bucket string, value interface{}, t string, sampleRate float32) error {\n\tif c.conn == nil {\n\t\treturn ErrNotConnected\n\t}\n\n\tif c.prefix != \"\" {\n\t\tbucket = fmt.Sprintf(\"%s.%s\", c.prefix, bucket)\n\t}\n\n\tmetric := fmt.Sprintf(\"%s:%v|%s|@%f\", bucket, value, t, sampleRate)\n\n\t_, err := c.conn.Write([]byte(metric))\n\treturn err\n}", "title": "" }, { "docid": "fcefd1c1aa4617c4f6443f044486b5af", "score": "0.4457131", "text": "func (sf *Snowflake) pack() uint64 {\n\treturn (sf.lastTimestamp << (numWorkerBit + numSequenceBits)) |\n\t\t(uint64(sf.workerID) << numSequenceBits) |\n\t\t(uint64(sf.sequence))\n}", "title": "" }, { "docid": "43803c5d2426d9c9d0b3279ea3f4c40a", "score": "0.44564614", "text": "func (client DevicesClient) TagByUserIDSender(req *http.Request) (*http.Response, error) {\n\treturn autorest.SendWithSender(client, req,\n\t\tazure.DoRetryWithRegistration(client.Client))\n}", "title": "" }, { "docid": "1a68920896455e98503e57d1ae6be625", "score": "0.44564295", "text": "func createPacked(tag TagType) Packed {\n\treturn util.ToVarint64(uint64(tag))\n}", "title": "" }, { "docid": "da22b038b15b7e4b126afb6faab99d87", "score": "0.44519126", "text": "func execUint64Var(_ int, p *gop.Context) {\n\targs := p.GetArgs(4)\n\tflag.Uint64Var(args[0].(*uint64), args[1].(string), args[2].(uint64), args[3].(string))\n}", "title": "" } ]
e79dcf73d4e05c8e6f444d8f93a8f844
The name of the Resource Group where the Logic App Integration Account Partner should exist. Changing this forces a new Logic App Integration Account Partner to be created.
[ { "docid": "f9e4dea0d17a859c73851cf854b0e4c7", "score": "0.6136815", "text": "func (o IntegrationAccountPartnerOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *IntegrationAccountPartner) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" } ]
[ { "docid": "1d8e29cc486ed629af4880df4d01fc7d", "score": "0.5343793", "text": "func AskResourceGroup(banzaiCli cli.Cli, orgID int32, secretID, defaultResourceGroup string) (string, error) {\n\tvar resourceGroup string\n\n\trgs, _, err := banzaiCli.Client().InfoApi.GetResourceGroups(context.Background(), orgID, secretID)\n\tif err != nil {\n\t\treturn \"\", errors.WrapIf(utils.ConvertError(err), \"can't list resource groups\")\n\t}\n\n\terr = survey.AskOne(&survey.Select{Message: \"Resource group:\", Options: rgs, Default: defaultResourceGroup}, &resourceGroup)\n\tif err != nil {\n\t\treturn \"\", errors.WrapIf(err, \"no resource group selected\")\n\t}\n\n\treturn resourceGroup, nil\n}", "title": "" }, { "docid": "f3becf335266f129b75da8e0cacf071e", "score": "0.52912486", "text": "func (o ServicesCommunicationsGatewayOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ServicesCommunicationsGateway) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "a9c5d7ba043845139920eb667ce3e7e4", "score": "0.5280484", "text": "func (client *Client) CreateGroup(request CreateGroupRequest) (*CreateGroupResponse, error) {\n\n\tvar respObj CreateGroupResponse\n\terr := client.doJSON(\"POST\", \"https://api.powerbi.com/v1.0/myorg/groups?workspaceV2=True\", request, &respObj)\n\treturn &respObj, err\n}", "title": "" }, { "docid": "2f76f80f33098e64335e497fc544fc21", "score": "0.5275175", "text": "func Group() error {\n\tname := os.Getenv(\"RESOURCE_GROUP\")\n\tif name == \"\" {\n\t\tname = fmt.Sprintf(\"%s-postgres\", time.Now().Format(\"060100\"))\n\t}\n\tlocation := os.Getenv(\"LOCATION\")\n\tif location == \"\" {\n\t\tlocation = \"eastus\"\n\t}\n\tcmd := []string{\n\t\t\"az\",\n\t\t\"group\",\n\t\t\"create\",\n\t\t\"--name\",\n\t\tname,\n\t\t\"--location\",\n\t\tlocation,\n\t}\n\treturn sh.RunV(cmd[0], cmd[1:]...)\n}", "title": "" }, { "docid": "c81eb2ebdc8e6c3bb45fb7ca542d8a2e", "score": "0.5257996", "text": "func (o EmailServiceOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EmailService) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "5cf749641d86ef3ab712ea7875551e72", "score": "0.5175567", "text": "func (ResGroupService) CreateResGroup(request *requests.ResourceGroupCreateRequest) (*model.ResourceGroup, error) {\n\t// resource group data check\n\twhereMap := map[string]interface{}{\n\t\t\"client_id\": request.ClientId,\n\t\t\"res_group_en\": request.ResGroupEn,\n\t}\n\tif GetResGroupService().ExistResGroup(whereMap) {\n\t\treturn nil, errors.New(\"resource group `\" + request.ResGroupEn + \"` already exists.\")\n\t}\n\n\t// check resource_ids\n\tif len(request.ResOfCurr.ResourceIDs) == 0 {\n\t\treturn nil, errors.New(\"`res_of_curr` is null\")\n\t} else {\n\t\terr := GetResGroupService().CheckResGroupByResourceIds(request.ResOfCurr.ResourceIDs, request.ClientId)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tresGroupCode := tool.GenXid()\n\n\tgroup := model.ResourceGroup{\n\t\tResGroupCode: resGroupCode,\n\t\tResGroupCn: request.ResGroupCn,\n\t\tResGroupEn: request.ResGroupEn,\n\t\tResGroupType: request.ResGroupType,\n\t\tResOfCurr: request.ResOfCurr,\n\t\tClientId: request.ClientId,\n\t\tOrgId: request.OrgId,\n\t}\n\n\terr := db.Def().Create(&group).Error\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &group, nil\n}", "title": "" }, { "docid": "c85ec8ced84ebc7ee678f3648e9f4d93", "score": "0.5143584", "text": "func (o ChannelWebChatOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ChannelWebChat) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aa22a8c2b6a55d73b318d2067c558fc1", "score": "0.51157624", "text": "func (group ASGroups) ResourceName() string {\n\treturn \"asg\"\n}", "title": "" }, { "docid": "869e1eff0f4b62f0767e926e1be2d99e", "score": "0.51149595", "text": "func (a *ResourceApiService) CreateResourceGroup(ctx context.Context) ApiCreateResourceGroupRequest {\n\treturn ApiCreateResourceGroupRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t}\n}", "title": "" }, { "docid": "e1d0b84ffff291a672486a0babb9622c", "score": "0.5104083", "text": "func createGroup() (group resources.Group, err error) {\n\tgroupsClient := resources.NewGroupsClient(clientData.SubscriptionID)\n\tgroupsClient.Authorizer = authorizer\n\n\treturn groupsClient.CreateOrUpdate(\n\t\tctx,\n\t\tresourceGroupName,\n\t\tresources.Group{\n\t\t\tLocation: to.StringPtr(resourceGroupLocation)})\n}", "title": "" }, { "docid": "4d0b2950a381e4d527dcdce6dd76362d", "score": "0.5097458", "text": "func (c *GrpcClient) CreateResourceGroup(ctx context.Context, rgName string) error {\n\tif c.Service == nil {\n\t\treturn ErrClientNotReady\n\t}\n\n\treq := &milvuspb.CreateResourceGroupRequest{\n\t\tResourceGroup: rgName,\n\t}\n\n\tresp, err := c.Service.CreateResourceGroup(ctx, req)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn handleRespStatus(resp)\n}", "title": "" }, { "docid": "b4ff263edd8df8a231a8096bac6f65e3", "score": "0.5075562", "text": "func (o IntegrationAccountSessionOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *IntegrationAccountSession) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "caae662f461b737c7a2e16d83c68d4d5", "score": "0.5048247", "text": "func (o AccountOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Account) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "44349f103f263502f887d08ca5e60305", "score": "0.50438464", "text": "func ResourceGroupName(customObject providerv1alpha1.AzureConfig) string {\n\treturn ClusterID(&customObject)\n}", "title": "" }, { "docid": "f02b74c49cd7d26d10d2bc64e3f4df5c", "score": "0.50168437", "text": "func (o NodeTemplateAzureConfigOutput) ResourceGroup() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v NodeTemplateAzureConfig) *string { return v.ResourceGroup }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c56eedb3052bf14a46f15ef6402351d5", "score": "0.49487615", "text": "func (o SpatialAnchorsAccountOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SpatialAnchorsAccount) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "360c33d770b90da69c21e01f2fd3e23b", "score": "0.49411553", "text": "func (o MachineConfigV2AzureConfigOutput) ResourceGroup() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v MachineConfigV2AzureConfig) *string { return v.ResourceGroup }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "32e7a5cfea852ce4b51d2152244b1fad", "score": "0.4939123", "text": "func (ac *APIController) ExtContractsGroupCreate(contractsGroup *contivModel.ExtContractsGroup) error {\n\tlog.Infof(\"Received ExtContractsGroupCreate: %+v\", contractsGroup)\n\n\t// Validate contracts type\n\tif contractsGroup.ContractsType != \"provided\" && contractsGroup.ContractsType != \"consumed\" {\n\t\treturn core.Errorf(\"Contracts group need to be either 'provided' or 'consumed'\")\n\t}\n\t// Make sure the tenant exists\n\ttenant := contivModel.FindTenant(contractsGroup.TenantName)\n\tif tenant == nil {\n\t\treturn core.Errorf(\"Tenant %s not found\", contractsGroup.TenantName)\n\t}\n\n\t// NOTE: Nothing more needs to be done here. This object\n\t// need not be created in the masterCfg.\n\n\treturn nil\n}", "title": "" }, { "docid": "9f4d43917a5133c34fa1b9301590215a", "score": "0.4930043", "text": "func (r Resource) Group() string {\n\treturn r.group\n}", "title": "" }, { "docid": "f11789b2dffd8ab562b529aae8ba7c72", "score": "0.49291137", "text": "func (o ChannelFacebookOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ChannelFacebook) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "fa442ddd6a0c5d8642185fa99afe2885", "score": "0.49174297", "text": "func (o ChannelSlackOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ChannelSlack) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8d042097b898da62e03004d652f073e7", "score": "0.4907029", "text": "func (m chartgroupmanager) ResourceName() string {\n\treturn m.resourceName\n}", "title": "" }, { "docid": "cf9eb4a42a4827c25320697049a690ef", "score": "0.48757246", "text": "func generateSecurityGroupName() string {\n\tid := fmt.Sprintf(\"%x\", rand.Int())\n\treturn securityGroupNamePrefix + id\n}", "title": "" }, { "docid": "7ceaddadd82546fc5784a6498c1be03d", "score": "0.48742062", "text": "func GetPartnerName(ctx *pulumi.Context) string {\n\treturn config.Get(ctx, \"google-native:partnerName\")\n}", "title": "" }, { "docid": "3a39df317f3c7895a71bde1d65a44a66", "score": "0.48709416", "text": "func (s *AgentPoolSpec) ResourceGroupName() string {\n\treturn s.ResourceGroup\n}", "title": "" }, { "docid": "6a467d4512dc6c6cb0848ff91fb88dba", "score": "0.48612642", "text": "func (r ApiCreateResourceGroupRequest) ResourceGroup(resourceGroup ResourceGroup) ApiCreateResourceGroupRequest {\n\tr.resourceGroup = &resourceGroup\n\treturn r\n}", "title": "" }, { "docid": "4ca157cdaf16e562943dfc79fb313415", "score": "0.48510373", "text": "func (client BaseClient) CreateGroupSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "31be11a377ca38c38c9abbe672acc038", "score": "0.48479772", "text": "func Test_Authorization_RoleAssignment_OnResourceGroup_CRUD(t *testing.T) {\n\tt.Parallel()\n\n\ttc := globalTestContext.ForTest(t)\n\n\trg := tc.CreateTestResourceGroupAndWait()\n\n\tconfigMapName := \"my-configmap\"\n\tprincipalIdKey := \"principalId\"\n\n\t// Create a dummy managed identity which we will assign to a role\n\tmi := &managedidentity.UserAssignedIdentity{\n\t\tObjectMeta: tc.MakeObjectMeta(\"mi\"),\n\t\tSpec: managedidentity.UserAssignedIdentity_Spec{\n\t\t\tLocation: tc.AzureRegion,\n\t\t\tOwner: testcommon.AsOwner(rg),\n\t\t\tOperatorSpec: &managedidentity.UserAssignedIdentityOperatorSpec{\n\t\t\t\tConfigMaps: &managedidentity.UserAssignedIdentityOperatorConfigMaps{\n\t\t\t\t\tPrincipalId: &genruntime.ConfigMapDestination{\n\t\t\t\t\t\tName: configMapName,\n\t\t\t\t\t\tKey: principalIdKey,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\ttc.CreateResourceAndWait(mi)\n\ttc.Expect(mi.Status.TenantId).ToNot(BeNil())\n\ttc.Expect(mi.Status.PrincipalId).ToNot(BeNil())\n\n\t// Now assign that managed identity to a new role\n\troleAssignment := &authorization.RoleAssignment{\n\t\tObjectMeta: tc.MakeObjectMeta(\"roleassignment\"),\n\t\tSpec: authorization.RoleAssignment_Spec{\n\t\t\tOwner: tc.AsExtensionOwner(rg),\n\t\t\tPrincipalIdFromConfig: &genruntime.ConfigMapReference{\n\t\t\t\tName: configMapName,\n\t\t\t\tKey: principalIdKey,\n\t\t\t},\n\t\t\tRoleDefinitionReference: &genruntime.ResourceReference{\n\t\t\t\tARMID: fmt.Sprintf(\"/subscriptions/%s/providers/Microsoft.Authorization/roleDefinitions/b24988ac-6180-42a0-ab88-20f7382dd24c\", tc.AzureSubscription), // This is contributor\n\t\t\t},\n\t\t},\n\t}\n\n\ttc.CreateResourceAndWait(roleAssignment)\n\n\ttc.Expect(roleAssignment.Status.Id).ToNot(BeNil())\n\tarmId := *roleAssignment.Status.Id\n\n\ttc.DeleteResourceAndWait(roleAssignment)\n\n\t// Ensure that the resource group was really deleted in Azure\n\texists, _, err := tc.AzureClient.HeadByID(\n\t\ttc.Ctx,\n\t\tarmId,\n\t\tstring(authorization.APIVersion_Value))\n\ttc.Expect(err).ToNot(HaveOccurred())\n\ttc.Expect(exists).To(BeFalse())\n}", "title": "" }, { "docid": "13d180b27607dc80ab3f91b29c0d5b57", "score": "0.4827965", "text": "func (o ExpressRouteCircuitPeeringOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ExpressRouteCircuitPeering) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "b710369a2604030f03be05168418a8a5", "score": "0.4824725", "text": "func (o NodeTemplateAzureConfigPtrOutput) ResourceGroup() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *NodeTemplateAzureConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroup\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "91720139b449e6ef4e3078b86c2c421a", "score": "0.4808786", "text": "func (client BaseClient) CreateOrUpdateGroupApplicationAssociationSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "f7f0b59b8be8df1521018078b0e41862", "score": "0.47704923", "text": "func resourceContactgroup() *schema.Resource {\n\treturn &schema.Resource{\n\t\tSchema: map[string]*schema.Schema{\n\t\t\t\"contactgroup_name\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDescription: \"The name of the contact group\",\n\t\t\t},\n\t\t\t\"alias\": {\n\t\t\t\tType: schema.TypeString,\n\t\t\t\tRequired: true,\n\t\t\t\tDescription: \"Determines whether or not the contact will receive notifications about host problems and recoveries\",\n\t\t\t},\n\t\t\t\"members\": {\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tDescription: \"A list of the short names of the commands used to notify the contact of a host problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified\",\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t},\n\t\t\t},\n\t\t\t\"contactgroup_members\": {\n\t\t\t\tType: schema.TypeSet,\n\t\t\t\tOptional: true,\n\t\t\t\tDescription: \"A list of the short names of the commands used to notify the contact of a service problem or recovery. Multiple notification commands should be separated by commas. All notification commands are executed when the contact needs to be notified\",\n\t\t\t\tElem: &schema.Schema{\n\t\t\t\t\tType: schema.TypeString,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tCreate: resourceCreateContactgroup,\n\t\tRead: resourceReadContactgroup,\n\t\tUpdate: resourceUpdateContactgroup,\n\t\tDelete: resourceDeleteContactgroup,\n\t\tImporter: &schema.ResourceImporter{\n\t\t\tState: schema.ImportStatePassthrough,\n\t\t},\n\t}\n}", "title": "" }, { "docid": "7aaebc7186d1ac19f3e0324f861b0db1", "score": "0.47622296", "text": "func (client BaseClient) CreateOrUpdateQueueGroupAssociationSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "5c5dfe2a520a5756d780f4ad5678f931", "score": "0.47608382", "text": "func (s *AutograderService) createGroup(request *pb.Group) (*pb.Group, error) {\n\tif !s.isValidGroupName(request.GetCourseID(), request.GetName()) {\n\t\treturn nil, ErrGroupNameDuplicate\n\t}\n\t// get users of group, check consistency of group request\n\tif _, err := s.getGroupUsers(request); err != nil {\n\t\ts.logger.Errorf(\"CreateGroup: failed to retrieve users for group %s: %v\", request.GetName(), err)\n\t\treturn nil, err\n\t}\n\t// create new group and update groupID in enrollment table\n\tif err := s.db.CreateGroup(request); err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.db.GetGroup(request.ID)\n}", "title": "" }, { "docid": "110f22a5a9692a97effab9671bc0d74a", "score": "0.47584966", "text": "func CreateGroup(t *testing.T, client *gophercloud.ServiceClient) (*groups.Group, error) {\n\n\tgroupName := tools.RandomString(\"TESTACC-\", 8)\n\tdescription := tools.RandomString(\"TESTACC-\", 8)\n\tadminStateUp := true\n\tshared := false\n\n\tcreateOpts := groups.CreateOpts{\n\t\tName: groupName,\n\t\tDescription: description,\n\t\tAdminStateUp: &adminStateUp,\n\t\tShared: &shared,\n\t}\n\n\tt.Logf(\"Attempting to create firewall group %s\",\n\t\tgroupName)\n\n\tgroup, err := groups.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\treturn group, err\n\t}\n\n\tt.Logf(\"firewall group %s successfully created\", groupName)\n\n\tth.AssertEquals(t, group.Name, groupName)\n\treturn group, nil\n}", "title": "" }, { "docid": "a402d55e8e8619ed525ff1e69e624e35", "score": "0.47427648", "text": "func (s *Subscription) Group() string {\n\treturn \"\"\n}", "title": "" }, { "docid": "fbc39ea4cea6fb61009e32d375190c81", "score": "0.47358456", "text": "func (_e *MilvusServiceServer_Expecter) CreateResourceGroup(_a0 interface{}, _a1 interface{}) *MilvusServiceServer_CreateResourceGroup_Call {\n\treturn &MilvusServiceServer_CreateResourceGroup_Call{Call: _e.mock.On(\"CreateResourceGroup\", _a0, _a1)}\n}", "title": "" }, { "docid": "3e6a6b5d24105708f2e56b01c52f3aee", "score": "0.47354823", "text": "func GetResourceGroupName(request *restful.Request) string {\n\treturn request.PathParameter(consts.PathResourceGroupNameParameter)\n}", "title": "" }, { "docid": "02bc7a3834f8f46e4ae5e96a36ae9ce1", "score": "0.47352988", "text": "func (c *client) CreateResourceGroup(ctx context.Context, resourceGroupName, location string) error {\n\trgParameters := resources.Group{\n\t\tLocation: &location,\n\t}\n\n\t_, err := c.ResourceGroupsClient.CreateOrUpdate(ctx, resourceGroupName, rgParameters)\n\treturn err\n}", "title": "" }, { "docid": "a5f6a4ceee88635cb538b4723ac2b65e", "score": "0.4734596", "text": "func (o LinkServiceOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LinkService) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "dc80c889414685627a6a473a7cf5ea3c", "score": "0.47290504", "text": "func (sdk *SDK) CreateSecurityGroup(region, suffix string) (string, error) {\n\tctx, cancel := context.WithTimeout(context.Background(), time.Second*30)\n\tdefer cancel()\n\n\tvar name = fmt.Sprintf(\"%s-%s\", SecurityGrouopNamePrefix, suffix)\n\tgroupResp, err := sdk.SwitchRegion(region).CreateSecurityGroupWithContext(ctx, &ec2.CreateSecurityGroupInput{\n\t\tGroupName: ptype.String(name),\n\t\tDescription: ptype.String(\"inf agent aws security group\"),\n\t})\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\n\tvar sgid = groupResp.GroupId\n\n\tctx2, cancel2 := context.WithTimeout(context.Background(), time.Second*30)\n\tdefer cancel2()\n\n\t_, err = sdk.SwitchRegion(region).AuthorizeSecurityGroupIngressWithContext(ctx2, &ec2.AuthorizeSecurityGroupIngressInput{\n\t\tGroupId: sgid,\n\t\tIpPermissions: []*ec2.IpPermission{ // allow all\n\t\t\t{\n\t\t\t\tIpProtocol: ptype.String(\"-1\"), // all\n\t\t\t\tFromPort: ptype.Int64(-1), // all\n\t\t\t\tToPort: ptype.Int64(-1), // all\n\t\t\t\tIpRanges: []*ec2.IpRange{{CidrIp: ptype.String(\"0.0.0.0/0\")}}, // all\n\t\t\t\tIpv6Ranges: []*ec2.Ipv6Range{{CidrIpv6: ptype.String(\"::/0\")}}, // all\n\t\t\t},\n\t\t},\n\t})\n\treturn ptype.StringV(sgid), err\n}", "title": "" }, { "docid": "571fe3c4b2a846e44039d60c72fed787", "score": "0.47284234", "text": "func (o MachineConfigV2AzureConfigPtrOutput) ResourceGroup() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *MachineConfigV2AzureConfig) *string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.ResourceGroup\n\t}).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "11b9a060e109de831c6a202d3e0ee793", "score": "0.47277436", "text": "func NewWorkloadGroup_Override(w WorkloadGroup, scope constructs.Construct, id *string, props *WorkloadGroupProps) {\n\t_init_.Initialize()\n\n\t_jsii_.Create(\n\t\t\"networkingistioio.WorkloadGroup\",\n\t\t[]interface{}{scope, id, props},\n\t\tw,\n\t)\n}", "title": "" }, { "docid": "6f2b72170a9f8c9ed3e6611b24605c13", "score": "0.47265473", "text": "func (client BaseClient) CreateOrUpdateGroupQueueAssociationSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "218d3d1dbfb645598489ef4aea2a68ef", "score": "0.47216314", "text": "func extractGroupName(resourceGroupDir string) string {\n\tparts := strings.SplitN(resourceGroupDir, \".\", 2)\n\tvar group string\n\n\tif len(parts) == 2 {\n\t\tgroup = parts[1]\n\t}\n\n\treturn group\n}", "title": "" }, { "docid": "0b5f16f88d5fb51b17179c0ebf7bfa6b", "score": "0.4712226", "text": "func ResourceGroupGenerator() gopter.Gen {\n\tif resourceGroupGenerator != nil {\n\t\treturn resourceGroupGenerator\n\t}\n\n\tgenerators := make(map[string]gopter.Gen)\n\tAddRelatedPropertyGeneratorsForResourceGroup(generators)\n\tresourceGroupGenerator = gen.Struct(reflect.TypeOf(ResourceGroup{}), generators)\n\n\treturn resourceGroupGenerator\n}", "title": "" }, { "docid": "55f582809ac278eb4f9a6b911f6ca923", "score": "0.47000265", "text": "func (manager *MockResourceGroupManager) CreateGroup(ctx context.Context, groupName string, location string) (resources.Group, error) {\n\tindex, _ := findResourceGroup(manager.resourceGroups, func(g resources.Group) bool {\n\t\treturn *g.Name == groupName\n\t})\n\n\tr := resources.Group{\n\t\tResponse: helpers.GetRestResponse(201),\n\t\tLocation: to.StringPtr(location),\n\t\tName: to.StringPtr(groupName),\n\t}\n\n\tif index == -1 {\n\t\tmanager.resourceGroups = append(manager.resourceGroups, r)\n\t}\n\n\treturn r, nil\n}", "title": "" }, { "docid": "a0c61c1aa09783762c1d57ad869d2970", "score": "0.4697418", "text": "func (o GetBackupPlansPlanOutput) ResourceGroupId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetBackupPlansPlan) string { return v.ResourceGroupId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c5dff4a9b27d37058e3e016a4e630dcc", "score": "0.46893167", "text": "func (client BaseClient) CreateOrUpdateApplicationGroupAssociationSender(req *http.Request) (*http.Response, error) {\n return autorest.SendWithSender(client, req,\n autorest.DoRetryForStatusCodes(client.RetryAttempts, client.RetryDuration, autorest.StatusCodesForRetry...))\n }", "title": "" }, { "docid": "677369019e2a44bb8b47ccf9cb481233", "score": "0.46850014", "text": "func newChannelGroup(channelConfig *Channel, mspConfig *mb.MSPConfig) (*cb.ConfigGroup, error) {\n\tvar err error\n\n\tchannelGroup := newConfigGroup()\n\n\tif err = addPolicies(channelGroup, channelConfig.Policies, AdminsPolicyKey); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to add policies to channel group: %v\", err)\n\t}\n\n\terr = addValue(channelGroup, hashingAlgorithmValue(), AdminsPolicyKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\terr = addValue(channelGroup, blockDataHashingStructureValue(), AdminsPolicyKey)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif channelConfig.Orderer != nil && len(channelConfig.Orderer.Addresses) > 0 {\n\t\terr = addValue(channelGroup, ordererAddressesValue(channelConfig.Orderer.Addresses), ordererAdminsPolicyName)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif channelConfig.Consortium != \"\" {\n\t\terr = addValue(channelGroup, consortiumValue(channelConfig.Consortium), AdminsPolicyKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif len(channelConfig.Capabilities) > 0 {\n\t\terr = addValue(channelGroup, capabilitiesValue(channelConfig.Capabilities), AdminsPolicyKey)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\n\tif channelConfig.Orderer != nil {\n\t\tchannelGroup.Groups[OrdererGroupKey], err = NewOrdererGroup(channelConfig.Orderer, mspConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create orderer group: %v\", err)\n\t\t}\n\t}\n\n\tif channelConfig.Application != nil {\n\t\tchannelGroup.Groups[ApplicationGroupKey], err = NewApplicationGroup(channelConfig.Application, mspConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create application group: %v\", err)\n\t\t}\n\t}\n\n\tif channelConfig.Consortiums != nil {\n\t\tchannelGroup.Groups[ConsortiumsGroupKey], err = NewConsortiumsGroup(channelConfig.Consortiums, mspConfig)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to create consortiums group: %v\", err)\n\t\t}\n\t}\n\n\tchannelGroup.ModPolicy = AdminsPolicyKey\n\n\treturn channelGroup, nil\n}", "title": "" }, { "docid": "27ea6e0e0730c6cb2f238e92c6148c79", "score": "0.46821186", "text": "func (o PublicCertificateOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *PublicCertificate) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e9751f85554869a9dc1aca1729dc200c", "score": "0.46738377", "text": "func (o LocalRulestackOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *LocalRulestack) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "daab573fab20a473124bbffe179f789c", "score": "0.46706", "text": "func (o AccountFilterOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AccountFilter) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "af7bc4edd97b6d33500f1a87fc43fb09", "score": "0.46554974", "text": "func NewFailoverGroup(ctx *pulumi.Context,\n\tname string, args *FailoverGroupArgs, opts ...pulumi.ResourceOption) (*FailoverGroup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.PartnerServers == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'PartnerServers'\")\n\t}\n\tif args.ReadWriteEndpointFailoverPolicy == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ReadWriteEndpointFailoverPolicy'\")\n\t}\n\tif args.ResourceGroupName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ResourceGroupName'\")\n\t}\n\tif args.ServerName == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'ServerName'\")\n\t}\n\topts = internal.PkgResourceDefaultOpts(opts)\n\tvar resource FailoverGroup\n\terr := ctx.RegisterResource(\"azure:sql/failoverGroup:FailoverGroup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "1b3b21d0382d6caf5ba9ddfd24dacdd5", "score": "0.46492875", "text": "func WorkerSecurityGroupName(customObject providerv1alpha1.AzureConfig) string {\n\treturn fmt.Sprintf(\"%s-%s\", ClusterID(&customObject), workerSecurityGroupSuffix)\n}", "title": "" }, { "docid": "a6fd93a6eacd702e69a6a1840e7207df", "score": "0.46485767", "text": "func (pr ExternalPackageReference) Group() string {\n\tpanic(fmt.Sprintf(\"external package reference %s doesn't have a group\", pr))\n}", "title": "" }, { "docid": "ac2a1ba84225e7056003829d52646034", "score": "0.463964", "text": "func ExampleProductGroupClient_CreateOrUpdate() {\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 := armapimanagement.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.NewProductGroupClient().CreateOrUpdate(ctx, \"rg1\", \"apimService1\", \"testproduct\", \"templateGroup\", 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.GroupContract = armapimanagement.GroupContract{\n\t// \tName: to.Ptr(\"templateGroup\"),\n\t// \tType: to.Ptr(\"Microsoft.ApiManagement/service/products/groups\"),\n\t// \tID: to.Ptr(\"/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/groups/templateGroup\"),\n\t// \tProperties: &armapimanagement.GroupContractProperties{\n\t// \t\tType: to.Ptr(armapimanagement.GroupTypeCustom),\n\t// \t\tDescription: to.Ptr(\"group created via Template\"),\n\t// \t\tBuiltIn: to.Ptr(false),\n\t// \t\tDisplayName: to.Ptr(\"Template Group\"),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "3b66330f053260b55a631521bb1de12f", "score": "0.4638578", "text": "func (r *Resource) Group() string {\n\tif r.group == \"\" {\n\t\treturn \"core\"\n\t}\n\n\treturn r.group\n}", "title": "" }, { "docid": "cdc41b74406e8ca3ee0a9cea7394dfd2", "score": "0.46329185", "text": "func NewResourceGroup(ctx *pulumi.Context,\n\tname string, args *ResourceGroupArgs, opts ...pulumi.ResourceOption) (*ResourceGroup, error) {\n\tif args == nil {\n\t\treturn nil, errors.New(\"missing one or more required arguments\")\n\t}\n\n\tif args.Tags == nil {\n\t\treturn nil, errors.New(\"invalid value for required argument 'Tags'\")\n\t}\n\tvar resource ResourceGroup\n\terr := ctx.RegisterResource(\"aws:inspector/resourceGroup:ResourceGroup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "48cb05bf2815dcea5b52cbc8d27ca0e3", "score": "0.4632743", "text": "func (a *ResourceApiService) UpdateResourceGroup(ctx context.Context, moid string) ApiUpdateResourceGroupRequest {\n\treturn ApiUpdateResourceGroupRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tmoid: moid,\n\t}\n}", "title": "" }, { "docid": "32e4f726e77c45868c3a0c0c614670d2", "score": "0.46305883", "text": "func ReplicationGroupExternalNameConfigure(base map[string]interface{}, name string) {\n\tbase[\"replication_group_id\"] = name\n}", "title": "" }, { "docid": "54c5078c4467cffaaba5a81afae8feb7", "score": "0.46299022", "text": "func (r CreateGroupRequest) GetRegionId() string {\n return \"\"\n}", "title": "" }, { "docid": "afacac63af58bad69806f98e8bbd8cc4", "score": "0.46165985", "text": "func (o GroupKindResponseOutput) ResourceGroup() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GroupKindResponse) string { return v.ResourceGroup }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "86287f8f459594806b07c809ad7f2f77", "score": "0.46143046", "text": "func (o DatasetBlobStorageStorageAccountOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v DatasetBlobStorageStorageAccount) string { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "9c4e71c462bc8cc081a2f6efaead4ae6", "score": "0.46125564", "text": "func (o BoolVariableOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *BoolVariable) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "610f26ae2df11f9722a6f2cb13c39a33", "score": "0.4611037", "text": "func (myAssignmentGroup *AssignmentGroup) GroupName() (param string) {\n\treturn myAssignmentGroup.GroupNamevar\n}", "title": "" }, { "docid": "66188e0a890880343d171e76103a50d0", "score": "0.4605474", "text": "func (o ResourceGuardOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ResourceGuard) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "1cc8ec629b0aa8ecc335e8f5895ccda1", "score": "0.4605461", "text": "func (o FailoverGroupOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *FailoverGroup) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "19d895ab933020a653d9984e8e4a5876", "score": "0.460247", "text": "func (o EnterpriseClusterOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EnterpriseCluster) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4197ad294a774caf570b6743aeadcab1", "score": "0.46007356", "text": "func (o ConfigurationOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Configuration) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4197ad294a774caf570b6743aeadcab1", "score": "0.46007356", "text": "func (o ConfigurationOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Configuration) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "162a83ea51593b8ec2c92ccc184b5a17", "score": "0.45977017", "text": "func NewRoleGroup()(*RoleGroup) {\n m := &RoleGroup{\n Entity: *ie233ee762e29b4ba6970aa2a2efce4b7fde11697ca9ea81099d0f8269309c1be.NewEntity(),\n }\n return m\n}", "title": "" }, { "docid": "080e882b4d98d3a6d3dde284f4afbcb6", "score": "0.4592815", "text": "func NewResourceGroup(ctx *pulumi.Context,\n\tname string, args *ResourceGroupArgs, opts ...pulumi.ResourceOption) (*ResourceGroup, error) {\n\tif args == nil {\n\t\targs = &ResourceGroupArgs{}\n\t}\n\targs.ApiVersion = pulumi.StringPtr(\"azure.microsoft.com/v1alpha1\")\n\targs.Kind = pulumi.StringPtr(\"ResourceGroup\")\n\tvar resource ResourceGroup\n\terr := ctx.RegisterResource(\"kubernetes:azure.microsoft.com/v1alpha1:ResourceGroup\", name, args, &resource, opts...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &resource, nil\n}", "title": "" }, { "docid": "4072e895c43c1c5ab4a1686514f516b3", "score": "0.45873183", "text": "func (a *ResourceApiService) CreateResourceGroupExecute(r ApiCreateResourceGroupRequest) (*ResourceGroup, *http.Response, error) {\n\tvar (\n\t\tlocalVarHTTPMethod = http.MethodPost\n\t\tlocalVarPostBody interface{}\n\t\tformFiles []formFile\n\t\tlocalVarReturnValue *ResourceGroup\n\t)\n\n\tlocalBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, \"ResourceApiService.CreateResourceGroup\")\n\tif err != nil {\n\t\treturn localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()}\n\t}\n\n\tlocalVarPath := localBasePath + \"/api/v1/resource/Groups\"\n\n\tlocalVarHeaderParams := make(map[string]string)\n\tlocalVarQueryParams := url.Values{}\n\tlocalVarFormParams := url.Values{}\n\tif r.resourceGroup == nil {\n\t\treturn localVarReturnValue, nil, reportError(\"resourceGroup 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.resourceGroup\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": "1e72c3c4281cba599f725f951f0b5289", "score": "0.4584463", "text": "func CreateTestResourceGroup(tc *AzureTestClient) (*resources.Group, func(string)) {\n\tgc := tc.createResourceGroupClient()\n\trgName := pointer.String(\"e2e-\" + string(uuid.NewUUID())[0:4])\n\trg, err := gc.CreateOrUpdate(context.Background(), *rgName, createTestTemplate(tc, rgName))\n\tExpect(err).NotTo(HaveOccurred())\n\tBy(fmt.Sprintf(\"resource group %s created\", *rgName))\n\n\treturn &rg, func(rgName string) {\n\t\tLogf(\"cleaning up test resource group %s\", rgName)\n\t\tfuture, err := gc.Delete(context.Background(), rgName)\n\t\tExpect(err).NotTo(HaveOccurred())\n\t\terr = WaitForDeleteResourceGroupCompletion(gc, future, rgName)\n\t\tExpect(err).NotTo(HaveOccurred())\n\t}\n}", "title": "" }, { "docid": "4dbcffaaada7a4982f7df63d3b339a80", "score": "0.4583799", "text": "func CreateGroup(t *testing.T, client *gophercloud.ServiceClient, c *groups.CreateOpts) (*groups.Group, error) {\n\tname := tools.RandomString(\"ACPTTEST\", 8)\n\tt.Logf(\"Attempting to create group: %s\", name)\n\n\tvar createOpts groups.CreateOpts\n\tif c != nil {\n\t\tcreateOpts = *c\n\t} else {\n\t\tcreateOpts = groups.CreateOpts{}\n\t}\n\n\tcreateOpts.Name = name\n\n\tgroup, err := groups.Create(client, createOpts).Extract()\n\tif err != nil {\n\t\treturn group, err\n\t}\n\n\tt.Logf(\"Successfully created group %s with ID %s\", name, group.ID)\n\n\tth.AssertEquals(t, group.Name, name)\n\n\treturn group, nil\n}", "title": "" }, { "docid": "ecb8e563db5c965e5ba4075b23fc0537", "score": "0.4578787", "text": "func (o ProductPolicyOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ProductPolicy) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "0ec82484dbf4f8675e405cc043d1a5a4", "score": "0.45743233", "text": "func (ac *AzureClient) CreateOrUpdate(ctx context.Context, name string, group resources.Group) (resources.Group, error) {\n\treturn ac.groups.CreateOrUpdate(ctx, name, group)\n}", "title": "" }, { "docid": "ae72327bb138fcca9716d440eea030ac", "score": "0.45656028", "text": "func TestImplGroup_Create(t *testing.T) {\n\tqtr_endtoend.TestWithDbxClient(t, func(ctx dbx_client.Client) {\n\t\tsv := New(ctx)\n\t\t_, err := sv.Create(\"test\", ManagementType(\"company_managed\"))\n\t\tif err != nil && err != qt_errors.ErrorMock {\n\t\t\tt.Error(err)\n\t\t}\n\t})\n}", "title": "" }, { "docid": "aa7a7bc8cad7fd6e203206825d3cf5f8", "score": "0.4561471", "text": "func EnsureResourceGroup(log *logrus.Entry, conf *Config) error {\n\tauthorizer, err := azureclient.NewAuthorizer(conf.ClientID, conf.ClientSecret, conf.TenantID, \"\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx := context.Background()\n\tgc := resources.NewGroupsClient(ctx, log, conf.SubscriptionID, authorizer)\n\n\tif _, err := gc.Get(ctx, conf.ResourceGroup); err == nil {\n\t\treturn nil\n\t}\n\n\ttags := map[string]*string{\n\t\t\"now\": to.StringPtr(fmt.Sprintf(\"%d\", time.Now().Unix())),\n\t\t\"ttl\": to.StringPtr(\"72h\"),\n\t}\n\tif conf.ResourceGroupTTL != \"\" {\n\t\tif _, err := time.ParseDuration(conf.ResourceGroupTTL); err != nil {\n\t\t\treturn fmt.Errorf(\"invalid ttl provided: %q - %v\", conf.ResourceGroupTTL, err)\n\t\t}\n\t\ttags[\"ttl\"] = &conf.ResourceGroupTTL\n\t}\n\n\t_, err = gc.CreateOrUpdate(ctx, conf.ResourceGroup, azresources.Group{Location: &conf.Region, Tags: tags})\n\treturn err\n}", "title": "" }, { "docid": "1133c19a7f35443a0880e6d3a82fae0c", "score": "0.4550095", "text": "func (o RdsDbProxyOutput) ResourceGroupId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *RdsDbProxy) pulumi.StringOutput { return v.ResourceGroupId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "aae9091af93367a5b650445fb4fbea91", "score": "0.45493475", "text": "func (aaa *AdminReasonsService) CreateReasonGroup(input *admin_reasons.CreateReasonGroupParams) (*reportingclientmodels.RestapiReasonGroupResponse, error) {\n\ttoken, err := aaa.TokenRepository.GetToken()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcreated, badRequest, conflict, internalServerError, err := aaa.Client.AdminReasons.CreateReasonGroup(input, client.BearerToken(*token.AccessToken))\n\tif badRequest != nil {\n\t\treturn nil, badRequest\n\t}\n\tif conflict != nil {\n\t\treturn nil, conflict\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 created.GetPayload(), nil\n}", "title": "" }, { "docid": "9c04fc49b7278a9dda0c0270a4bb9642", "score": "0.454531", "text": "func ExampleSyncGroupsClient_BeginCreateOrUpdate_createASyncGroup() {\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 := armsql.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewSyncGroupsClient().BeginCreateOrUpdate(ctx, \"syncgroupcrud-65440\", \"syncgroupcrud-8475\", \"syncgroupcrud-4328\", \"syncgroupcrud-3187\", armsql.SyncGroup{\n\t\tProperties: &armsql.SyncGroupProperties{\n\t\t\tConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin),\n\t\t\tHubDatabaseUserName: to.Ptr(\"hubUser\"),\n\t\t\tInterval: to.Ptr[int32](-1),\n\t\t\tSyncDatabaseID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328\"),\n\t\t\tUsePrivateLinkConnection: to.Ptr(true),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.SyncGroup = armsql.SyncGroup{\n\t// \tName: to.Ptr(\"syncgroupcrud-3187\"),\n\t// \tType: to.Ptr(\"Microsoft.Sql/servers/databases/syncGroups\"),\n\t// \tID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328/syncGroups/syncgroupcrud-3187\"),\n\t// \tProperties: &armsql.SyncGroupProperties{\n\t// \t\tConflictResolutionPolicy: to.Ptr(armsql.SyncConflictResolutionPolicyHubWin),\n\t// \t\tHubDatabaseUserName: to.Ptr(\"hubUser\"),\n\t// \t\tInterval: to.Ptr[int32](-1),\n\t// \t\tLastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, \"0001-01-01T08:00:00Z\"); return t}()),\n\t// \t\tPrivateEndpointName: to.Ptr(\"PE_67FDBBD6-B2D8-4014-9CC6-C68ABBCFD481_syncgroupcrud-8475\"),\n\t// \t\tSyncDatabaseID: to.Ptr(\"/subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/syncgroupcrud-3521/providers/Microsoft.Sql/servers/syncgroupcrud-8475/databases/syncgroupcrud-4328\"),\n\t// \t\tSyncState: to.Ptr(armsql.SyncGroupStateNotReady),\n\t// \t\tUsePrivateLinkConnection: to.Ptr(true),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "ba94501488dc9280f9b4531882a96769", "score": "0.45446834", "text": "func (o GetDatasetBlobStorageStorageAccountOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetDatasetBlobStorageStorageAccount) string { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "80f0f98d2ed9e65acbaa000ab9b54ad8", "score": "0.4542696", "text": "func (s *SecurityService) CreateGroup(ctx context.Context, group *Group) (*http.Response, error) {\n\turl := fmt.Sprintf(\"/ui/groups\")\n\treq, err := s.client.NewJSONEncodedRequest(\"POST\", url, group)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn s.client.Do(ctx, req, nil)\n\n}", "title": "" }, { "docid": "a096b6cfe0270b1b34abb77835e37d44", "score": "0.454144", "text": "func (o GroupKindOutput) ResourceGroup() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v GroupKind) *string { return v.ResourceGroup }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "dba2edb51b182dc0978d80ada5556c99", "score": "0.45367306", "text": "func (a *GroupApiService) CreateGroup(Ctx _context.Context) ApiCreateGroupRequest {\n\treturn ApiCreateGroupRequest{\n\t\tApiService: a,\n\t\tCtx: Ctx,\n\t}\n}", "title": "" }, { "docid": "cafc82f859c2507ee03f319508b5b64e", "score": "0.45334065", "text": "func (*StorageProvider) GroupName() string {\n\treturn platform.GroupName\n}", "title": "" }, { "docid": "93cb3869986e04f77084a1f8d3c2a744", "score": "0.45316526", "text": "func ensureResourceGroup(ctx context.Context, subscriptionID, name, location string, env azure.Environment) (*rm.Group, error) {\n\tgroupClient := getRmGroupClientWithToken(subscriptionID, env)\n\tgroup, err := groupClient.Get(ctx, name)\n\tif group.Response.Response == nil {\n\t\t// tcp dial error or something else where the response was not populated\n\t\treturn nil, err\n\t}\n\n\tif group.StatusCode == http.StatusNotFound {\n\t\tgroup, err = groupClient.CreateOrUpdate(ctx, name, rm.Group{Location: common.PtrString(location)})\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t} else if group.StatusCode >= 400 {\n\t\treturn nil, err\n\t}\n\n\treturn &group, nil\n}", "title": "" }, { "docid": "cc7aa606872e6fffbc0f3df5fe82e6ef", "score": "0.4526223", "text": "func NewGroupFromOptions(groupName string, options *model.ResourceGroupSettings) (*rmpb.ResourceGroup, error) {\n\tif options == nil {\n\t\treturn nil, ErrInvalidGroupSettings\n\t}\n\tif len(groupName) > maxGroupNameLength {\n\t\treturn nil, ErrTooLongResourceGroupName\n\t}\n\tgroup := &rmpb.ResourceGroup{\n\t\tName: groupName,\n\t}\n\tvar isRUMode bool\n\tif options.RRURate > 0 || options.WRURate > 0 {\n\t\tisRUMode = true\n\t\tgroup.Mode = rmpb.GroupMode_RUMode\n\t\tgroup.RUSettings = &rmpb.GroupRequestUnitSettings{\n\t\t\tRRU: &rmpb.TokenBucket{\n\t\t\t\tSettings: &rmpb.TokenLimitSettings{\n\t\t\t\t\tFillRate: options.RRURate,\n\t\t\t\t},\n\t\t\t},\n\t\t\tWRU: &rmpb.TokenBucket{\n\t\t\t\tSettings: &rmpb.TokenLimitSettings{\n\t\t\t\t\tFillRate: options.WRURate,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t}\n\tif len(options.CPULimiter) > 0 || len(options.IOReadBandwidth) > 0 || len(options.IOWriteBandwidth) > 0 {\n\t\tif isRUMode {\n\t\t\treturn nil, ErrInvalidResourceGroupDuplicatedMode\n\t\t}\n\t\tparseF := func(s string, scale resource.Scale) (uint64, error) {\n\t\t\tif len(s) == 0 {\n\t\t\t\treturn 0, nil\n\t\t\t}\n\t\t\tq, err := resource.ParseQuantity(s)\n\t\t\tif err != nil {\n\t\t\t\treturn 0, err\n\t\t\t}\n\t\t\treturn uint64(q.ScaledValue(scale)), nil\n\t\t}\n\t\tcpuRate, err := parseF(options.CPULimiter, resource.Milli)\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(ErrInvalidResourceGroupFormat, err.Error())\n\t\t}\n\t\tioReadRate, err := parseF(options.IOReadBandwidth, resource.Scale(0))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(ErrInvalidResourceGroupFormat, err.Error())\n\t\t}\n\t\tioWriteRate, err := parseF(options.IOWriteBandwidth, resource.Scale(0))\n\t\tif err != nil {\n\t\t\treturn nil, errors.Annotate(ErrInvalidResourceGroupFormat, err.Error())\n\t\t}\n\n\t\tgroup.Mode = rmpb.GroupMode_RawMode\n\t\tgroup.ResourceSettings = &rmpb.GroupResourceSettings{\n\t\t\tCpu: &rmpb.TokenBucket{\n\t\t\t\tSettings: &rmpb.TokenLimitSettings{\n\t\t\t\t\tFillRate: cpuRate,\n\t\t\t\t},\n\t\t\t},\n\t\t\tIoRead: &rmpb.TokenBucket{\n\t\t\t\tSettings: &rmpb.TokenLimitSettings{\n\t\t\t\t\tFillRate: ioReadRate,\n\t\t\t\t},\n\t\t\t},\n\t\t\tIoWrite: &rmpb.TokenBucket{\n\t\t\t\tSettings: &rmpb.TokenLimitSettings{\n\t\t\t\t\tFillRate: ioWriteRate,\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\t\treturn group, nil\n\t}\n\tif isRUMode {\n\t\treturn group, nil\n\t}\n\treturn nil, ErrUnknownResourceGroupMode\n}", "title": "" }, { "docid": "cf844daf9826ed0d1799246eb86be48e", "score": "0.45247144", "text": "func (o TopicOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Topic) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3e44729b0d89ef7c17010df58bf622f6", "score": "0.4522213", "text": "func (m *WindowsKioskLocalGroup) GetGroupName()(*string) {\n val, err := m.GetBackingStore().Get(\"groupName\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "457474e85b8da04e511ad0093d25cfe8", "score": "0.45221585", "text": "func (o AnalyticsWorkspaceOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *AnalyticsWorkspace) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "410a419f2910ab2f3362b143edf913f2", "score": "0.45191967", "text": "func (client *PartnerRegistrationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerRegistrationsClientListByResourceGroupOptions) (*policy.Request, error) {\n\turlPath := \"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations\"\n\tif client.subscriptionID == \"\" {\n\t\treturn nil, errors.New(\"parameter client.subscriptionID cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{subscriptionId}\", url.PathEscape(client.subscriptionID))\n\tif resourceGroupName == \"\" {\n\t\treturn nil, errors.New(\"parameter resourceGroupName cannot be empty\")\n\t}\n\turlPath = strings.ReplaceAll(urlPath, \"{resourceGroupName}\", url.PathEscape(resourceGroupName))\n\treq, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treqQP := req.Raw().URL.Query()\n\treqQP.Set(\"api-version\", \"2023-06-01-preview\")\n\tif options != nil && options.Filter != nil {\n\t\treqQP.Set(\"$filter\", *options.Filter)\n\t}\n\tif options != nil && options.Top != nil {\n\t\treqQP.Set(\"$top\", strconv.FormatInt(int64(*options.Top), 10))\n\t}\n\treq.Raw().URL.RawQuery = reqQP.Encode()\n\treq.Raw().Header[\"Accept\"] = []string{\"application/json\"}\n\treturn req, nil\n}", "title": "" }, { "docid": "e78c17764e0dcc9ff4d305531b110c94", "score": "0.45180738", "text": "func (o DeploymentOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Deployment) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3418f1e32e17f4c2aa0427295ace0719", "score": "0.45150325", "text": "func (o SharedImageOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SharedImage) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "046ad02056d35b66f4a855b1896d6a04", "score": "0.45112345", "text": "func ExampleAFDOriginGroupsClient_BeginCreate() {\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 := armcdn.NewClientFactory(\"<subscription-id>\", cred, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to create client: %v\", err)\n\t}\n\tpoller, err := clientFactory.NewAFDOriginGroupsClient().BeginCreate(ctx, \"RG\", \"profile1\", \"origingroup1\", armcdn.AFDOriginGroup{\n\t\tProperties: &armcdn.AFDOriginGroupProperties{\n\t\t\tHealthProbeSettings: &armcdn.HealthProbeParameters{\n\t\t\t\tProbeIntervalInSeconds: to.Ptr[int32](10),\n\t\t\t\tProbePath: to.Ptr(\"/path2\"),\n\t\t\t\tProbeProtocol: to.Ptr(armcdn.ProbeProtocolNotSet),\n\t\t\t\tProbeRequestType: to.Ptr(armcdn.HealthProbeRequestTypeNotSet),\n\t\t\t},\n\t\t\tLoadBalancingSettings: &armcdn.LoadBalancingSettingsParameters{\n\t\t\t\tAdditionalLatencyInMilliseconds: to.Ptr[int32](1000),\n\t\t\t\tSampleSize: to.Ptr[int32](3),\n\t\t\t\tSuccessfulSamplesRequired: to.Ptr[int32](3),\n\t\t\t},\n\t\t\tTrafficRestorationTimeToHealedOrNewEndpointsInMinutes: to.Ptr[int32](5),\n\t\t},\n\t}, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to finish the request: %v\", err)\n\t}\n\tres, err := poller.PollUntilDone(ctx, nil)\n\tif err != nil {\n\t\tlog.Fatalf(\"failed to pull the result: %v\", err)\n\t}\n\t// You could use response here. We use blank identifier for just demo purposes.\n\t_ = res\n\t// If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes.\n\t// res.AFDOriginGroup = armcdn.AFDOriginGroup{\n\t// \tName: to.Ptr(\"origingroup1\"),\n\t// \tType: to.Ptr(\"Microsoft.Cdn/profiles/origingroups\"),\n\t// \tID: to.Ptr(\"/subscriptions/subid/resourcegroups/RG/providers/Microsoft.Cdn/profiles/profile1/origingroups/origingroup1\"),\n\t// \tProperties: &armcdn.AFDOriginGroupProperties{\n\t// \t\tHealthProbeSettings: &armcdn.HealthProbeParameters{\n\t// \t\t\tProbeIntervalInSeconds: to.Ptr[int32](10),\n\t// \t\t\tProbePath: to.Ptr(\"/path1\"),\n\t// \t\t\tProbeProtocol: to.Ptr(armcdn.ProbeProtocolHTTP),\n\t// \t\t\tProbeRequestType: to.Ptr(armcdn.HealthProbeRequestTypeHEAD),\n\t// \t\t},\n\t// \t\tLoadBalancingSettings: &armcdn.LoadBalancingSettingsParameters{\n\t// \t\t\tAdditionalLatencyInMilliseconds: to.Ptr[int32](1000),\n\t// \t\t\tSampleSize: to.Ptr[int32](3),\n\t// \t\t\tSuccessfulSamplesRequired: to.Ptr[int32](3),\n\t// \t\t},\n\t// \t\tTrafficRestorationTimeToHealedOrNewEndpointsInMinutes: to.Ptr[int32](5),\n\t// \t\tDeploymentStatus: to.Ptr(armcdn.DeploymentStatusNotStarted),\n\t// \t\tProvisioningState: to.Ptr(armcdn.AfdProvisioningStateSucceeded),\n\t// \t},\n\t// }\n}", "title": "" }, { "docid": "5691c1927c2f5eb0be95644433e118d6", "score": "0.45027795", "text": "func (rv ResourceVersion) Group() string {\n\tparts := strings.SplitN(string(rv), \"/\", 2)\n\tif len(parts) == 1 {\n\t\treturn \"\"\n\t}\n\treturn parts[0]\n}", "title": "" }, { "docid": "681594472fbee3a867099651e90cc75a", "score": "0.44989404", "text": "func (client Client) GroupPreparer(ctx context.Context, body GroupRequest) (*http.Request, error) {\n\turlParameters := map[string]interface{}{\n\t\t\"Endpoint\": client.Endpoint,\n\t}\n\n\tpreparer := autorest.CreatePreparer(\n\t\tautorest.AsContentType(\"application/json; charset=utf-8\"),\n\t\tautorest.AsPost(),\n\t\tautorest.WithCustomBaseURL(\"{Endpoint}/face/v1.0\", urlParameters),\n\t\tautorest.WithPath(\"/group\"),\n\t\tautorest.WithJSON(body))\n\treturn preparer.Prepare((&http.Request{}).WithContext(ctx))\n}", "title": "" }, { "docid": "4c2245e33b17af63e7ed0a07b35e562c", "score": "0.4498908", "text": "func (o NetworkWatcherOutput) ResourceGroupName() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *NetworkWatcher) pulumi.StringOutput { return v.ResourceGroupName }).(pulumi.StringOutput)\n}", "title": "" } ]
dd6050709402181adaf49d364a1ff484
Sets the entire ModelInfo metadata struct for a ModelInfoID.
[ { "docid": "51e5626fc8fdc77a3faf26ed4a07590a", "score": "0.6716017", "text": "func (k Keeper) SetModelInfo(ctx sdk.Context, model types.ModelInfo) {\n\tstore := ctx.KVStore(k.storeKey)\n\tstore.Set(types.GetModelInfoKey(model.VID, model.PID), k.cdc.MustMarshalBinaryBare(model))\n\n\t// Update the list of products associated with vendor.\n\tproduct := types.Product{\n\t\tPID: model.PID,\n\t\tName: model.Name,\n\t\tSKU: model.SKU,\n\t\tOwner: model.Owner,\n\t}\n\tk.AppendVendorProduct(ctx, model.VID, product)\n}", "title": "" } ]
[ { "docid": "ce6186b75bae9164b8c6634f772ddb40", "score": "0.60806245", "text": "func SetID(model interface{}, id string) {\n\tv := reflect.ValueOf(model).Elem().FieldByName(\"Id\")\n\tif v.CanSet() {\n\t\tv.SetString(id)\n\t}\n}", "title": "" }, { "docid": "8f52418c680798958fc49b8829b837ad", "score": "0.5782176", "text": "func SetUserInfo(id string, user_info models.UserInfo) error {\n\tselector := database.QuerySelector{\n\t\t\"id\": id,\n\t}\n\n\terr := db.Update(\"info\", selector, &user_info)\n\n\tif err == database.ErrNotFound {\n\t\terr = db.Insert(\"info\", &user_info)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "311e36167276715085060bc9044e4c11", "score": "0.5669224", "text": "func SetID(model interface{}, id string) error {\n\t// Check if given model implements IDSetter interface\n\tif setter, ok := model.(IDSetter); ok {\n\t\tuintID, err := strconv.ParseUint(id, 10, 64)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsetter.SetID(uintID)\n\t\treturn nil\n\t}\n\n\tt := reflect.TypeOf(model).Elem()\n\tv := reflect.ValueOf(model).Elem()\n\n\tfor i := 0; i < t.NumField(); i++ {\n\t\ttField := t.Field(i)\n\t\tsField := v.Field(i)\n\n\t\tif !sField.CanSet() {\n\t\t\tcontinue\n\t\t}\n\n\t\tif strings.ToLower(tField.Name) == \"id\" {\n\t\t\terr := setFieldWithType(sField.Kind(), id, sField)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn ErrIncorrectModel\n}", "title": "" }, { "docid": "d72b898418c43786f8f5540d286f7035", "score": "0.55116016", "text": "func (gu *GroupUpdate) SetInfoID(id string) *GroupUpdate {\n\tgu.mutation.SetInfoID(id)\n\treturn gu\n}", "title": "" }, { "docid": "ffe041694a03b6770885c716db88451c", "score": "0.5481955", "text": "func (guo *GroupUpdateOne) SetInfoID(id string) *GroupUpdateOne {\n\tguo.mutation.SetInfoID(id)\n\treturn guo\n}", "title": "" }, { "docid": "b6d08ecd596406f1a6410c74c82a2c9c", "score": "0.5456022", "text": "func (vmu *VehicleModelUpdate) SetMetadataID(id int) *VehicleModelUpdate {\n\tvmu.mutation.SetMetadataID(id)\n\treturn vmu\n}", "title": "" }, { "docid": "a8dc49875bb9387824ad6260bafe4093", "score": "0.54189444", "text": "func (_options *GetModelOptions) SetModelID(modelID string) *GetModelOptions {\n\t_options.ModelID = core.StringPtr(modelID)\n\treturn _options\n}", "title": "" }, { "docid": "7266678dfc961a52063876b738dbd417", "score": "0.5384375", "text": "func (vmuo *VehicleModelUpdateOne) SetMetadataID(id int) *VehicleModelUpdateOne {\n\tvmuo.mutation.SetMetadataID(id)\n\treturn vmuo\n}", "title": "" }, { "docid": "a151c53f9e785f75ae628d086adade38", "score": "0.53158635", "text": "func (m *Mount) SetMetadata(id SourceID, metadata string) {\n\tm.log(\"setting metadata: id: %s meta: %s\", id, metadata)\n\tm.sourceMeta.Set(id, metadata)\n\tm.events <- EventNewMetadata\n\treturn\n}", "title": "" }, { "docid": "62ddf981e7c7f37950e131cf7583f3ad", "score": "0.53004116", "text": "func (r *AWSSageMakerModel) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "a8aa4f202ba6a8677d0e581a5db32946", "score": "0.5296728", "text": "func (m *Model) SetMetaFields() {\n\n\tm.Meta.modelName = reflect.TypeOf(m.Modeler).Name()\n\tm.Meta.numFields = reflect.TypeOf(m.Modeler).NumField()\n\tm.Meta.elements = make([][]string, m.Meta.numFields)\n\n\tfor i := 0; i < m.Meta.numFields; i++ {\n\t\tm.Meta.elements[i] = []string{reflect.TypeOf(m.Modeler).Field(i).Name, typeMappings[reflect.TypeOf(m.Modeler).Field(i).Type.Name()]}\n\t}\n\n\tm.Meta.isSet = true\n}", "title": "" }, { "docid": "6c421f66f2f90af24094543f04309112", "score": "0.5209969", "text": "func (d *Dao) SetBaseInfo(c context.Context, r *model.BaseInfo) (err error) {\n\tif len(r.Name) <= 0 {\n\t\tlog.Error(\"SetBaseInfo: mid(%d) len(r.Name)<=0 BaseInfo(%v)\", r.Mid, r)\n\t\treturn\n\t}\n\tif _, err = d.db.Exec(c, fmt.Sprintf(_SetBaseInfo, hit(r.Mid)), r.Mid, r.Name, r.Sex, r.Face, r.Sign, r.Rank, r.Name, r.Sex, r.Face, r.Sign, r.Rank); err != nil {\n\t\tlog.Error(\"SetBaseInfo: db.Exec(%d, %v) error(%v)\", r.Mid, r, err)\n\t}\n\treturn\n}", "title": "" }, { "docid": "5036e6a8302497e443134a89218136c9", "score": "0.52039874", "text": "func (_options *TranslateDocumentOptions) SetModelID(modelID string) *TranslateDocumentOptions {\n\t_options.ModelID = core.StringPtr(modelID)\n\treturn _options\n}", "title": "" }, { "docid": "b400e7e00eb5d7c5a47027336a51a9e3", "score": "0.51931334", "text": "func (_options *TranslateOptions) SetModelID(modelID string) *TranslateOptions {\n\t_options.ModelID = core.StringPtr(modelID)\n\treturn _options\n}", "title": "" }, { "docid": "33a005452ad4a60120cc6a0eaa49e4cc", "score": "0.5171957", "text": "func SetBuildInfo(version, date, fullCommit, tags, os, arch, goVersion string) {\n\tBuildInfo = BuildData{\n\t\tVersion: version,\n\t\tDate: date,\n\t\tFullCommit: fullCommit,\n\t\tTags: tags,\n\t\tOs: os,\n\t\tArch: arch,\n\t\tGoVersion: goVersion,\n\t}\n}", "title": "" }, { "docid": "d06e43c35a625a61d5cc05eb86a19a8a", "score": "0.51455146", "text": "func (s *SpecErr) SetInfoMessage(infoMsg string, msgId int64) {\n\ts.EmptyMsgData()\n\ts.ErrorMsgType\t= SpecErrTypeINFO\n\ts.IsErr = false\n\ts.IsPanic = false\n\ts.setMessageText(infoMsg, msgId)\n}", "title": "" }, { "docid": "072ffa43ed593102992c63f78b375581", "score": "0.5139635", "text": "func (entity_EntityInfo) SetId(object interface{}, id uint64) error {\n\tobject.(*Entity).Id = id\n\treturn nil\n}", "title": "" }, { "docid": "d0771f1f37c904e8cf84fbf20146230a", "score": "0.51161116", "text": "func (r *AWSApiGatewayModel) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "bef1ca554c3ef84edc3adb9b39510f9f", "score": "0.50963783", "text": "func (o *Object) setMetaData(info *api.Item) (err error) {\n\tif info.IsFolder {\n\t\treturn fmt.Errorf(\"%q is a folder: %w\", o.remote, fs.ErrorNotAFile)\n\t}\n\to.hasMetaData = true\n\to.size = info.Size\n\to.modTime = info.ModTime()\n\to.id = info.ID\n\treturn nil\n}", "title": "" }, { "docid": "3c963a6579381aa056e03f40583b47f1", "score": "0.50779074", "text": "func (ctx *Context) SetMetadata(l *libcnb.Layer, key, value string) {\n\tl.Metadata[key] = value\n}", "title": "" }, { "docid": "6dfe1a09e3015607ba69a29a8986a5f9", "score": "0.5069474", "text": "func (d *DocumentModel) SetCInfo(ci *mgo.ChangeInfo) {\n\td.cinfo = ci\n}", "title": "" }, { "docid": "e695f1e47e086523ff79997e91dc814b", "score": "0.50677854", "text": "func (vmu *VehicleModelUpdate) SetMetadata(m *Metadata) *VehicleModelUpdate {\n\treturn vmu.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "d8b674b2cff51bb4ed1f9b1d274f1375", "score": "0.50673616", "text": "func (m *Matrix) SetModel(char int, id string, md Model) error {\n\tif md.States() < m.states[char] {\n\t\treturn errors.Errorf(\"likelihood: matrix: model %s for %d states, char %d with %d states\", id, md.States(), char, m.states[char])\n\t}\n\tif _, ok := m.mds[id]; !ok {\n\t\tm.mds[id] = md\n\t}\n\tm.model[char] = id\n\treturn nil\n}", "title": "" }, { "docid": "bd35e53e086b735405e58786e0b3c17f", "score": "0.50477064", "text": "func SetDeviceModel(model string) { deviceModelAtomic.Store(model) }", "title": "" }, { "docid": "94b6c8944b71822b0a5f48f8761e045b", "score": "0.50345844", "text": "func (link *VideoLink) SetInfo(videoMap map[string]interface{}, sigdecoder *signaturedecoder.SignatureDecoder, videoDetails interface{}) {\r\n\r\n\tvideourl := videoMap[\"url\"]\r\n\titag := videoMap[\"itag\"]\r\n\r\n\tlink.VideoTag = itag.(float64)\r\n\tlink.VideoFormat = utils.GetTagInfo(link.VideoTag)\r\n\tlink.VideoTitle = videoDetails.(map[string]interface{})[\"title\"].(string)\r\n\r\n\tvar signature string\r\n\tif videourl != nil {\r\n\t\tlink.VideoURL = videourl.(string)\r\n\t\tr, _ := regexp.Compile(`u0026`)\r\n\t\te := r.ReplaceAllString(link.VideoURL, `&`)\r\n\t\tlink.VideoURL = e\r\n\r\n\t} else {\r\n\r\n\t\t//write the function parser for decrypting the signature\r\n\t\tsignatureCipher := videoMap[\"signatureCipher\"]\r\n\t\tcipher := videoMap[\"cipher\"]\r\n\r\n\t\tcipherKey := signatureCipher\r\n\t\tif cipherKey == nil {\r\n\t\t\tcipherKey = cipher\r\n\t\t}\r\n\r\n\t\tif cipherKey != nil {\r\n\r\n\t\t\tr, _ := regexp.Compile(`u0026`)\r\n\t\t\te := r.ReplaceAllString(cipherKey.(string), `&`)\r\n\r\n\t\t\tparsedCipher, err := url.ParseQuery(e)\r\n\t\t\tif err != nil {\r\n\t\t\t\treturn\r\n\t\t\t}\r\n\r\n\t\t\tsignature = parsedCipher[\"s\"][0]\r\n\t\t\tsigdecoder.Signature = signature\r\n\t\t\tsignature = sigdecoder.DecodeSignature()\r\n\r\n\t\t\turl := parsedCipher[\"url\"][0]\r\n\t\t\tsp := parsedCipher[\"sp\"][0]\r\n\t\t\tlink.VideoURL = url + \"&\" + sp + \"=\" + signature\r\n\t\t}\r\n\t}\r\n\r\n}", "title": "" }, { "docid": "bf6d9e804a8dbfe6b971dd59886b346b", "score": "0.50119215", "text": "func Set(info *Info) error {\n\tlabel = info.Label\n\tgitCommit = info.GitCommit\n\tos = info.OS\n\tarch = info.Arch\n\tgoVersion = info.GoVersion\n\n\treturn nil\n}", "title": "" }, { "docid": "ac6d2611de4b96e2759662248ba738c4", "score": "0.4992982", "text": "func (r *AWSServerlessSimpleTable_PrimaryKey) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "83d1d52780a69046180a8df773301b20", "score": "0.49745482", "text": "func (vmuo *VehicleModelUpdateOne) SetMetadata(m *Metadata) *VehicleModelUpdateOne {\n\treturn vmuo.SetMetadataID(m.ID)\n}", "title": "" }, { "docid": "55b922cf3d874772782bc788b7bf63e5", "score": "0.49607396", "text": "func (o *SparseOrganizationalMetadata) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "a6fa7cef6fe13b6dca34b82fb9ae0cc5", "score": "0.49341288", "text": "func (_class VDIClass) SetMetadataOfPool(sessionID SessionRef, self VDIRef, value PoolRef) (_err error) {\n\tif IsMock {\n\t\treturn _class.SetMetadataOfPoolMock(sessionID, self, value)\n\t}\t\n\t_method := \"VDI.set_metadata_of_pool\"\n\t_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"session_id\"), sessionID)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_selfArg, _err := convertVDIRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"self\"), self)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_valueArg, _err := convertPoolRefToXen(fmt.Sprintf(\"%s(%s)\", _method, \"value\"), value)\n\tif _err != nil {\n\t\treturn\n\t}\n\t_, _err = _class.client.APICall(_method, _sessionIDArg, _selfArg, _valueArg)\n\treturn\n}", "title": "" }, { "docid": "0dc97d557168c24c734054ecc4f93881", "score": "0.49316052", "text": "func (g *Generator) SetInfo(info *Info) {\n\tg.api.Info = info\n}", "title": "" }, { "docid": "fa550a7299e623642516658039ed90dc", "score": "0.49264315", "text": "func (v *Video) SetDetailInfo() error {\n\tservice := NewYoutubeService()\n\tcall := service.Videos.List(\"snippet,Statistics\").\n\t\tId(v.VideoID).\n\t\tMaxResults(1)\n\tresponse, err := call.Do()\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t} else if len(response.Items) == 0 {\n\t\treturn youtubeError{\n\t\t\tcontent: \"video\",\n\t\t\tid: v.VideoID,\n\t\t\tmessage: \"This video has been deleted\",\n\t\t}\n\t}\n\titem := response.Items[0]\n\n\tv.Title = item.Snippet.Title\n\tv.Description = item.Snippet.Description\n\tv.ThumbnailURL = item.Snippet.Thumbnails.High.Url\n\tv.ViewCount = int64(item.Statistics.ViewCount)\n\tv.CommentCount = int32(item.Statistics.CommentCount)\n\tv.ChannelID = item.Snippet.ChannelId\n\tv.CategoryID = item.Snippet.CategoryId\n\tv.setCategoryName()\n\tv.PublishedAt, err = time.Parse(time.RFC3339, item.Snippet.PublishedAt)\n\tif err != nil {\n\t\tlog.Fatalf(\"%v\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d69cd90b4cbfb734e93d8d6b857db914", "score": "0.49168324", "text": "func SetBuildInfo(build, id, ver, buildBy string) {\n\tif strings.Contains(build, \".\") && len(build) == 15 {\n\t\tbuildedAt, _ = time.Parse(\"20060102.150405\", build)\n\t} else {\n\t\tbuildedAt, _ = time.Parse(time.RFC3339, build)\n\t}\n\tcommitID = id\n\tif len(id) > 7 {\n\t\tcommitID = id[0:7]\n\t}\n\tversion = ver\n}", "title": "" }, { "docid": "c9d7e570131af34b3ce254f487ca81d5", "score": "0.48578072", "text": "func (r *DCPReceiver) SetMetaData(vbucketId uint16, value []byte) error {\n\n\tr.m.Lock()\n\tdefer r.m.Unlock()\n\n\tr.meta[vbucketId] = value\n\n\t// Check persistMeta to avoids persistence if the only feed events we've seen are the DCP echo of DCP checkpoint docs\n\tif r.persistCheckpoints && r.updatesSinceCheckpoint[vbucketId] >= kCheckpointThreshold {\n\n\t\t// Don't checkpoint more frequently than kCheckpointTimeThreshold\n\t\tif time.Since(r.lastCheckpointTime[vbucketId]) < kCheckpointTimeThreshold {\n\t\t\treturn nil\n\t\t}\n\n\t\terr := r.persistCheckpoint(vbucketId, value)\n\t\tif err != nil {\n\t\t\tWarnf(KeyAll, \"Unable to persist DCP metadata - will retry next snapshot. Error: %v\", err)\n\t\t}\n\t\tr.updatesSinceCheckpoint[vbucketId] = 0\n\t\tr.lastCheckpointTime[vbucketId] = time.Now()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ae23aed668e5870ae9f3f1393dcc297", "score": "0.4849339", "text": "func (vmu *VehicleModelUpdate) SetNillableMetadataID(id *int) *VehicleModelUpdate {\n\tif id != nil {\n\t\tvmu = vmu.SetMetadataID(*id)\n\t}\n\treturn vmu\n}", "title": "" }, { "docid": "a11525fa4b73c47fda1396f86b2e1e8c", "score": "0.48441148", "text": "func (vcuo *VehicleColorUpdateOne) SetMetadataID(id int) *VehicleColorUpdateOne {\n\tvcuo.mutation.SetMetadataID(id)\n\treturn vcuo\n}", "title": "" }, { "docid": "84d5e06df339df7c7143fcdbd650733e", "score": "0.48423788", "text": "func (vcu *VehicleColorUpdate) SetMetadataID(id int) *VehicleColorUpdate {\n\tvcu.mutation.SetMetadataID(id)\n\treturn vcu\n}", "title": "" }, { "docid": "88b07bcf32e58e62df2ffa09929d5173", "score": "0.48294887", "text": "func (o *LinkInventoryModelWithDriverVersionParams) SetModelID(modelID string) {\n\to.ModelID = modelID\n}", "title": "" }, { "docid": "65c3d9cf93393d55f123a3dcc70d52e1", "score": "0.48266023", "text": "func (entityByValue_EntityInfo) SetId(object interface{}, id uint64) error {\n\tif obj, ok := object.(*EntityByValue); ok {\n\t\tobj.Id = id\n\t\treturn nil\n\t} else {\n\t\t// NOTE while this can't update, it will at least behave consistently (panic in case of a wrong type)\n\t\t_ = object.(EntityByValue).Id\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "70c4dc7fdc3fac03359299aa8e0741c9", "score": "0.4804212", "text": "func SetUserInfo(w http.ResponseWriter, r *http.Request) {\n\t// Read in http request body\n\tbuf := new(bytes.Buffer)\n\tbuf.ReadFrom(r.Body)\n\tb := []byte(buf.String())\n\n\t// Get user ID from token\n\tuid, err := GetUIDFromBearerToken(r)\n\n\tuserID, err := strconv.Atoi(uid)\n\n\tif err != nil {\n\t\thandleErrorAndRespond(nil, model.ErrorInternalServer, w)\n\t\treturn\n\t}\n\t_userID := uint(userID)\n\n\tvar u model.UserModel\n\n\terr = json.Unmarshal(b, &u)\n\tif err != nil {\n\t\thandleErrorAndRespond(nil, model.ErrorBadRequest, w)\n\t\treturn\n\t}\n\n\t_u, err := model.SetUserInfo(_userID, u)\n\tif err != nil {\n\t\thandleErrorAndRespond(nil, err, w)\n\t\treturn\n\t}\n\n\tjs, err := json.Marshal(_u)\n\n\thandleErrorAndRespond(js, err, w)\n}", "title": "" }, { "docid": "418dd7a73a3fec2844853f75242879dd", "score": "0.4803389", "text": "func SetMetadata(mp3Location string, metadata *Metadata) {\n\ttag, err := id3v2.Open(mp3Location, id3v2.Options{Parse: true})\n\n\tif err != nil {\n\t\tlog.Fatal(\"Error while initializing a tag: \", err)\n\t}\n\n\ttag.SetTitle(metadata.Title)\n\ttag.SetArtist(metadata.Artist)\n\ttag.SetAlbum(metadata.Album)\n\n\tif err = tag.Save(); err != nil {\n\t\tlog.Fatal(\"Error while saving a tag: \", err)\n\t}\n}", "title": "" }, { "docid": "c62064d18813461fe8030cf6cf79886c", "score": "0.4800519", "text": "func (mf *MetadataFetcherS3) SetMetadataJsonByKey(key string, metadataJson string, version string) error {\n\n\terr := aws_helper.UploadToS3([]byte(metadataJson), mf.adminS3BucketName, \"metadata/\"+version+\"/\"+key+\".json\")\n\tif err != nil {\n\t\treturn errors.New(\"error uploading metadata item: \" + err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "1dce754fa17ae972acfc1a3ebc85e383", "score": "0.47920483", "text": "func (o *OrganizationalMetadata) SetIdentifier(id string) {\n\n}", "title": "" }, { "docid": "6b4be959ff47c85998f335a597f80acd", "score": "0.47878096", "text": "func (i *Instance) SetMetadata(t testing.TestingT, metadata map[string]string) {\n\terr := i.SetMetadataE(t, metadata)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}", "title": "" }, { "docid": "dd8ea1cd937c3633b768a8ae36810301", "score": "0.47858608", "text": "func (guo *GroupUpdateOne) SetInfo(g *GroupInfo) *GroupUpdateOne {\n\treturn guo.SetInfoID(g.ID)\n}", "title": "" }, { "docid": "b6adde2e4ad3a5b96b5fd7b9482fb75b", "score": "0.47709543", "text": "func TestSetInfo(t *testing.T) {\n\tg := gen(t)\n\n\tinfos := &Info{\n\t\tDescription: \"Test\",\n\t}\n\tg.SetInfo(infos)\n\n\tassert.NotNil(t, g.API().Info)\n\tassert.Equal(t, infos, g.API().Info)\n}", "title": "" }, { "docid": "8e26f3a34763fbebc25cda0a111540ba", "score": "0.47529495", "text": "func (favorite_EntityInfo) SetId(object interface{}, id uint64) error {\n\tobject.(*Favorite).Id = id\n\treturn nil\n}", "title": "" }, { "docid": "023fefcaca360a77f6897233ccc17efa", "score": "0.47302535", "text": "func (gu *GroupUpdate) SetInfo(g *GroupInfo) *GroupUpdate {\n\treturn gu.SetInfoID(g.ID)\n}", "title": "" }, { "docid": "129e2a898dc68cc1dc4b85228293eb2c", "score": "0.47295296", "text": "func (d *Dao) SetCaseInfoCache(c context.Context, cid int64, bc *model.BlockedCase) (err error) {\n\tvar (\n\t\tconn = d.mc.Get(c)\n\t\titem = &gmc.Item{Key: caseInfoKey(cid), Object: bc, Expiration: d.minCommonExpire, Flags: gmc.FlagJSON}\n\t)\n\tdefer conn.Close()\n\terr = conn.Set(item)\n\treturn\n}", "title": "" }, { "docid": "18bd65f4f09d001675c8f65c07a02d1c", "score": "0.47276017", "text": "func (e *Engine) SetMetadata(song string) {\n\tfmt.Println(\"Setting metadata\", song)\n}", "title": "" }, { "docid": "4dea1c39276582684d4b8c6425f3f55e", "score": "0.47024375", "text": "func (r *AWSGlueTable_SerdeInfo) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "9ebc2a1746d13da7edfad19d564e6bfd", "score": "0.46979907", "text": "func (config *Config) SetModel(model, params string) {\n\tcmodel := C.CString(model)\n\tcparams := C.CString(params)\n\tC.PD_ConfigSetModel(config.c, cmodel, cparams)\n\tdefer func() {\n\t\tC.free(unsafe.Pointer(cmodel))\n\t\tC.free(unsafe.Pointer(cparams))\n\t}()\n}", "title": "" }, { "docid": "4bb007e7eb388175d96d5103ad7132d6", "score": "0.46927792", "text": "func (r *AWSEC2SpotFleet_GroupIdentifier) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "3df3b756f6d04c55ef069550093b1dab", "score": "0.469276", "text": "func (_options *DeleteModelOptions) SetModelID(modelID string) *DeleteModelOptions {\n\t_options.ModelID = core.StringPtr(modelID)\n\treturn _options\n}", "title": "" }, { "docid": "f4b017958c7061b9617f120afb6b1da9", "score": "0.4686232", "text": "func (vmuo *VehicleModelUpdateOne) SetNillableMetadataID(id *int) *VehicleModelUpdateOne {\n\tif id != nil {\n\t\tvmuo = vmuo.SetMetadataID(*id)\n\t}\n\treturn vmuo\n}", "title": "" }, { "docid": "ca062a0d6974eff29d95864caf4fad18", "score": "0.46821654", "text": "func (m *Device) SetModel(value *string)() {\n err := m.GetBackingStore().Set(\"model\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "a829887ea4f7cb92e345ccc3ba5dccfb", "score": "0.4672219", "text": "func (*ormBase) setPk(mi *modelInfo, ind reflect.Value, id int64) {\n\tif mi.fields.pk.auto {\n\t\tif mi.fields.pk.fieldType&IsPositiveIntegerField > 0 {\n\t\t\tind.FieldByIndex(mi.fields.pk.fieldIndex).SetUint(uint64(id))\n\t\t} else {\n\t\t\tind.FieldByIndex(mi.fields.pk.fieldIndex).SetInt(id)\n\t\t}\n\t}\n}", "title": "" }, { "docid": "12719bf544c7d65f756e450e5b820c54", "score": "0.4651486", "text": "func SetSchemaInfo(sws *swagger.SwaggerService) error {\n\tschemaInfoList, err := sws.GetSchemaInfoList()\n\tif err != nil {\n\t\topenlogging.Error(\"get schema Info err: \" + err.Error())\n\t\treturn err\n\t}\n\tmicrosvcMeta := NewMicroserviceMeta(fileutil.SchemaDirectory)\n\tmicrosvcMeta.SchemaIDs = append(microsvcMeta.SchemaIDs, runtime.ServiceName)\n\tdefaultMicroserviceMetaMgr[runtime.ServiceName] = microsvcMeta\n\tfor _, schemaInfo := range schemaInfoList {\n\t\tDefaultSchemaIDsMap[runtime.ServiceName] = schemaInfo\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "19dc92c9a3fb651c5582316799c2e32b", "score": "0.46506524", "text": "func SetInfoColor(color string) {\n\tcolorMap[infoLabel] = getColorByName(color)\n}", "title": "" }, { "docid": "4534fc7c697202956530c9bbab179098", "score": "0.4644075", "text": "func (m *Photo) SetCameraModel(value *string)() {\n err := m.GetBackingStore().Set(\"cameraModel\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "cbd550682e7a491e88e0399c8ac60afc", "score": "0.4640117", "text": "func (m *AccessPackageResourceAttribute) SetId(value *string)() {\n err := m.GetBackingStore().Set(\"id\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "2243a1edb4983397b5db70de76188244", "score": "0.46282735", "text": "func (r *AWSEC2SpotFleet_InstanceNetworkInterfaceSpecification) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "41f85b0b5720186657e1c35334e9b55d", "score": "0.46203515", "text": "func (d *Dao) SetVoteInfoCache(c context.Context, mid, cid int64, vi *model.VoteInfo) (err error) {\n\tvar (\n\t\tconn = d.mc.Get(c)\n\t\titem = &gmc.Item{Key: voteCaseInfoKey(mid, cid), Object: vi, Expiration: d.userExpire, Flags: gmc.FlagJSON}\n\t)\n\tdefer conn.Close()\n\terr = conn.Set(item)\n\treturn\n}", "title": "" }, { "docid": "d1e43af86a53a88b291696ada6f6dd25", "score": "0.46189955", "text": "func (m *DCMotor) setID(id int) { *m = DCMotor{id: id} }", "title": "" }, { "docid": "6ff6569cb190a69d057879dd9f888254", "score": "0.46160814", "text": "func (o *VolumeModifyParams) SetInfo(info *models.Volume) {\n\to.Info = info\n}", "title": "" }, { "docid": "5e998686ca162faa79960caae827e262", "score": "0.46097866", "text": "func SetRHMIInfo(installation *integreatlyv1alpha1.RHMI) {\n\tRHMIInfo.WithLabelValues(installation.Spec.UseClusterStorage,\n\t\tinstallation.Spec.MasterURL,\n\t\tinstallation.Spec.Type,\n\t\tinstallation.GetName(),\n\t\tinstallation.GetNamespace(),\n\t\tinstallation.Spec.NamespacePrefix,\n\t\tfmt.Sprintf(\"%t\", installation.Spec.OperatorsInProductNamespace),\n\t\tinstallation.Spec.RoutingSubdomain,\n\t\tfmt.Sprintf(\"%t\", installation.Spec.SelfSignedCerts),\n\t)\n}", "title": "" }, { "docid": "84fcbc0c33499d1b0c4d0c3cc0bce152", "score": "0.46060324", "text": "func (r *AWSIoTEventsDetectorModel_Sqs) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "d6d673980721d9e86d83b15ca48ef266", "score": "0.4598843", "text": "func (r *AWSDynamoDBTable_KeySchema) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "296199c346eadc67862b0b8b4cc65e25", "score": "0.45952737", "text": "func SetVersionInfo(gitSummary string, buildDate string, version string) {\n\tGitSummary = gitSummary\n\tBuildDate = buildDate\n\tVersion = version\n}", "title": "" }, { "docid": "bf7a514a7db70cc2b1e60e7e88e5b480", "score": "0.4571394", "text": "func ModelInfoFromModel(m *ml.ModelContainer) (mi modelInfo) {\n\n\tif lr, ok := m.Model.(*linreg.LinearRegression); ok {\n\t\tmi.Model = linearRegression\n\t\tif !lr.HasTransform {\n\t\t\tmi.TransformDimension = NOT\n\t\t}\n\t\tmi.TransformDimension = Dimension(m.TransformDimension)\n\t\tmi.TransformID = m.TransformID\n\t\tif lr.IsRegularized {\n\t\t\tmi.Regularized = true\n\t\t\tmi.K = lr.K\n\t\t}\n\t} else if lr, ok := m.Model.(*logreg.LogisticRegression); ok {\n\t\tmi.Model = logisticRegression\n\t\tif !lr.HasTransform {\n\t\t\tmi.TransformDimension = NOT\n\t\t}\n\t\tmi.TransformDimension = Dimension(m.TransformDimension)\n\t\tmi.TransformID = m.TransformID\n\t\tif lr.IsRegularized {\n\t\t\tmi.Regularized = true\n\t\t\tmi.K = lr.K\n\t\t}\n\t} else if svm, ok := m.Model.(*svm.SVM); ok {\n\t\tmi.Model = supportVectorMachines\n\t\tif !svm.HasTransform {\n\t\t\tmi.TransformDimension = NOT\n\t\t}\n\t\tmi.TransformDimension = Dimension(m.TransformDimension)\n\t\tmi.TransformID = m.TransformID\n\t\tmi.K = svm.K\n\t\tmi.T = svm.T\n\t\tmi.L = svm.Lambda\n\t}\n\tmi.Features = m.Features\n\treturn\n}", "title": "" }, { "docid": "fdf867d3ba8a6711a1884b9c5fdc1fc6", "score": "0.4569127", "text": "func SetMetaDataLabel(obj metav1.Object, key, value string) {\n\tlabels := obj.GetLabels()\n\tif labels == nil {\n\t\tlabels = make(map[string]string)\n\t}\n\tlabels[key] = value\n\tobj.SetLabels(labels)\n}", "title": "" }, { "docid": "e14c233248dd1380fea85f9d6396d7ec", "score": "0.45681795", "text": "func (r *AWSKMSKey) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "cffee0f356e91e41d616ff2b50b8019d", "score": "0.45653793", "text": "func (o *Product) SetMetadata(v map[string]string) {\n\to.Metadata = &v\n}", "title": "" }, { "docid": "6f4bdf12badc4d32d1ce3de412ce8856", "score": "0.45617935", "text": "func (r *AWSCodeDeployDeploymentGroup_ELBInfo) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "e1691077ee727c59d96a37907ad5da02", "score": "0.45608634", "text": "func (r *AWSServerlessApi) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "a3be45bbd354f1746e7bef300aa61a70", "score": "0.45598662", "text": "func (appInfoService *appInfoService) SetAppInfo(appID string, appinfo *AppInfo) error {\n\tappInfo, err := json.Marshal(appinfo)\n\tif err != nil {\n\t\tlog.Error(\"AppInfo get app data error:\", err)\n\t\treturn err\n\t}\n\n\treturn appInfoService.db.Set([]byte(keyAppIDPrefix+appID), []byte(appInfo))\n}", "title": "" }, { "docid": "2cc6d4925f832a1f538d7311c6c3de01", "score": "0.45492133", "text": "func (r *AWSGluePartition_SerdeInfo) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "dc51a4456a072f6603c266e6b7d55809", "score": "0.45446044", "text": "func (myDeviceInfo *DeviceInfo) SetID(val string) {\n\tmyDeviceInfo.IDvar = val\n}", "title": "" }, { "docid": "c70bd01ab735d41825436ed3048ed0b0", "score": "0.4543131", "text": "func (r *AWSGlueClassifier) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "40c87b0bfebeb984a9cf5f2cc52c97fb", "score": "0.45418495", "text": "func (_options *CreateModelOptions) SetBaseModelID(baseModelID string) *CreateModelOptions {\n\t_options.BaseModelID = core.StringPtr(baseModelID)\n\treturn _options\n}", "title": "" }, { "docid": "92e13d0a643f339b6fd2817683c61f09", "score": "0.4536093", "text": "func (m *Call) SetMeetingInfo(value MeetingInfoable)() {\n err := m.GetBackingStore().Set(\"meetingInfo\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "04f90d01bcbdb75b2d89e11482e61b49", "score": "0.45349142", "text": "func (mdl *DoorModel) SetID(nid int) {\n\tmdl.ID = nid\n}", "title": "" }, { "docid": "a34e424bc7a4b1f3eeef60c79102d469", "score": "0.4531921", "text": "func (s stack) rpcSetMetadataOfInstance(ctx context.Context, id string, tags map[string]string) fail.Error {\n\tif id = strings.TrimSpace(id); id == \"\" {\n\t\treturn fail.InvalidParameterError(\"id\", \"cannot be empty string\")\n\t}\n\n\tvar out map[string]string\n\txerr := stacks.RetryableRemoteCall(ctx,\n\t\tfunc() (innerErr error) {\n\t\t\tres := servers.Metadata(s.ComputeClient, id)\n\t\t\tout, innerErr = res.Extract()\n\t\t\treturn innerErr\n\t\t},\n\t\tNormalizeError,\n\t)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrTimeout:\n\t\t\treturn fail.Wrap(fail.Cause(xerr), \"timeout\")\n\t\tcase *retry.ErrStopRetry:\n\t\t\treturn fail.Wrap(fail.Cause(xerr), \"stopping retries\")\n\t\tdefault:\n\t\t\treturn xerr\n\t\t}\n\t}\n\n\tfor k, v := range tags {\n\t\tout[k] = v\n\t}\n\n\tmop := make(servers.MetadataOpts)\n\tfor k, v := range out {\n\t\tmop[k] = v\n\t}\n\n\txerr = stacks.RetryableRemoteCall(ctx,\n\t\tfunc() (innerErr error) {\n\t\t\tres := servers.UpdateMetadata(s.ComputeClient, id, mop)\n\t\t\t_, innerErr = res.Extract()\n\t\t\treturn innerErr\n\t\t},\n\t\tNormalizeError,\n\t)\n\tif xerr != nil {\n\t\tswitch xerr.(type) {\n\t\tcase *fail.ErrTimeout:\n\t\t\treturn fail.Wrap(fail.Cause(xerr), \"timeout\")\n\t\tcase *retry.ErrStopRetry:\n\t\t\treturn fail.Wrap(fail.Cause(xerr), \"stopping retries\")\n\t\tdefault:\n\t\t\treturn xerr\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "22a740b65c88edee28b10934834f137e", "score": "0.45314953", "text": "func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "22a740b65c88edee28b10934834f137e", "score": "0.45311236", "text": "func (r *AWSEC2SpotFleet_SpotFleetRequestConfigData) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "5595593c9a6d56b118ffe4963afef8a4", "score": "0.45214975", "text": "func (r *AWSEC2LaunchTemplate_SpotOptions) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "93b4d75be7aa81593ee3200a0593c78e", "score": "0.45123896", "text": "func SetBuildInfo(service, hostname, envoyVersion string) {\n\tregistry.setBuildInfo(service, hostname, envoyVersion)\n}", "title": "" }, { "docid": "93b4d75be7aa81593ee3200a0593c78e", "score": "0.45123896", "text": "func SetBuildInfo(service, hostname, envoyVersion string) {\n\tregistry.setBuildInfo(service, hostname, envoyVersion)\n}", "title": "" }, { "docid": "ad2a9dfee02dd8b8f7f2890b6dcf21e1", "score": "0.4504072", "text": "func (r *AWSEC2NetworkInterface) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "9d54184145495f02cdf6a4b5d76c32d1", "score": "0.44874907", "text": "func (r *AWSGlueClassifier_JsonClassifier) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "12b414539863dd52f01c6d6920937cb2", "score": "0.44759867", "text": "func (r *AWSGlueJob) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "54803a0b511c077f22dd7c8230d7b1ce", "score": "0.44686633", "text": "func (r *AWSApiGatewayDocumentationPart) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "ad3be7625e706992312e798cb4f230df", "score": "0.4463419", "text": "func (r *AWSAmazonMQBroker_ConfigurationId) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "4be2efca9c5b95894ca7194d30621e42", "score": "0.44532517", "text": "func (c *CarModel) SetModel() {\n\tfmt.Fprintf(outputWriter, \" CarModel - SetModel\\n\")\n}", "title": "" }, { "docid": "f1443a9871937d95a27ca3128ac5e951", "score": "0.4452836", "text": "func (mf *MetadataFetcherS3) SetMetadataManifestForVersion(manifest *metadata_typedefs.MetadataManifest, version string) error {\n\tvar err error\n\tvar manifestJson []byte\n\tif config.GetEnvironmentConfiguration().AppEnvironment == config.PRODUCTION {\n\t\tmanifestJson, err = json.Marshal(manifest)\n\t} else {\n\t\tmanifestJson, err = json.MarshalIndent(manifest, \"\", \" \")\n\t}\n\tif err != nil {\n\t\treturn errors.New(\"error serializing new manifest|error=\" + err.Error())\n\t}\n\n\terr = aws_helper.UploadToS3(manifestJson, mf.adminS3BucketName, \"metadata/\"+version+\"/MetadataManifest.json\")\n\tif err != nil {\n\t\treturn errors.New(\"error uploading metadata manifest: \" + err.Error())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "b54d241eb42c6ef54e3382860d355c2a", "score": "0.44522554", "text": "func SetMetaDataAnnotation(obj metav1.Object, key, value string) {\n\ta := obj.GetAnnotations()\n\tif a == nil {\n\t\ta = make(map[string]string)\n\t}\n\ta[key] = value\n\tobj.SetAnnotations(a)\n}", "title": "" }, { "docid": "ef4a101894a77e8c959494dbc9ce6ef5", "score": "0.4440254", "text": "func (r *AWSEC2SpotFleet_SpotFleetTagSpecification) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" }, { "docid": "7d554cd51ff493b77793f88533f2f183", "score": "0.44381717", "text": "func (sys *BucketMetadataSys) Set(bucket string, meta BucketMetadata) {\n\tif !isMinioMetaBucketName(bucket) {\n\t\tsys.Lock()\n\t\tsys.metadataMap[bucket] = meta\n\t\tsys.Unlock()\n\t}\n}", "title": "" }, { "docid": "878ef3312784d41d398aa48209c43d38", "score": "0.44328442", "text": "func fillIdentity(info *accesslog.EndpointInfo, id identityPkg.NumericIdentity) {\n\tinfo.Identity = uint64(id)\n\n\tif identity := identityPkg.LookupIdentityByID(id); identity != nil {\n\t\tinfo.Labels = identity.Labels.GetModel()\n\t\tinfo.LabelsSHA256 = identity.GetLabelsSHA256()\n\t}\n}", "title": "" }, { "docid": "e85b927a5f4adbaf94900de77ca56b85", "score": "0.44309664", "text": "func (r *AWSEC2SpotFleet) SetMetadata(metadata map[string]interface{}) {\n\tr._metadata = metadata\n}", "title": "" } ]
bf8c6135687fb6c23e438500ab1dc399
get returns the file struct for the given path.
[ { "docid": "f31532e6530d17782f75d4888359022e", "score": "0.7975759", "text": "func (f *files) get(path string) *file {\n\tf.mu.RLock()\n\tdefer f.mu.RUnlock()\n\treturn f.files[path]\n}", "title": "" } ]
[ { "docid": "e7603d4e6745f66c0d23b6e0d793fe77", "score": "0.66621816", "text": "func Get(name string, subDir string) (*File, error) {\n\tif err := CheckName(name); err != nil {\n\t\treturn nil, err\n\t}\n\tlist, err := List(\"\", name, subDir)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(list) != 1 {\n\t\treturn nil, fmt.Errorf(\"no instance found with name %s\", name)\n\t}\n\treturn list[0], nil\n}", "title": "" }, { "docid": "ba2d8a8f50536d56660f4272693f3e4f", "score": "0.6527904", "text": "func (s Snapshot) getFile(path string, codec codec) (f *file, err error) {\n\tbytes, rev, err := s.getBytes(path)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvalue, err := codec.Decode(bytes)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tf = &file{dir: path, Value: value, FileRev: rev, codec: codec, Snapshot: s}\n\n\treturn\n}", "title": "" }, { "docid": "88bcf434cdfdea0b642f430899b8a75d", "score": "0.63542604", "text": "func (s Snapshot) get(path string) (string, int64, error) {\n\tval, rev, err := s.getBytes(path)\n\treturn string(val), rev, err\n}", "title": "" }, { "docid": "1b4825f1941790c6b14573c9351c6422", "score": "0.63076395", "text": "func (f Files) Get(key string) *File {\n\tif f == nil {\n\t\treturn nil\n\t}\n\n\treturn f[key]\n}", "title": "" }, { "docid": "11a362fc63c7cf91af4fc65a3538a305", "score": "0.6288304", "text": "func (c *filesystem) Get(p string) (io.ReadCloser, error) {\n\tabsPath, err := filepath.Abs(filepath.Clean(filepath.Join(c.cacheRoot, p)))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"get the object %w\", err)\n\t}\n\n\treturn os.Open(absPath)\n}", "title": "" }, { "docid": "93ccfd4cb961f88b8b46cbd502fc9c4d", "score": "0.62212664", "text": "func (fs *Filesystem) Get(k string) ([]byte, error) {\n\tp, err := fs.cleanPath(k)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tbytes, err := ioutil.ReadFile(p)\n\tif os.IsNotExist(err) {\n\t\treturn nil, db.ErrNoValue\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn bytes, nil\n}", "title": "" }, { "docid": "071718807d45c9cc4e57e3612fb9b8e8", "score": "0.6142419", "text": "func (fileMeta *File) Get(fileSha1 string) (err error) {\n\tfileInfo := &db.File{}\n\tif err = fileInfo.Get(fileSha1); err != nil {\n\t\treturn\n\t}\n\tfileMeta.FileSize = fileInfo.FileSize\n\tfileMeta.FileName = fileInfo.FileName\n\tfileMeta.FileSha1 = fileInfo.FileSha1\n\tfileMeta.Location = fileInfo.FileAddr\n\tfileMeta.UploadAt = fileInfo.UpdateAt\n\treturn\n}", "title": "" }, { "docid": "2925875dfc067d262233c468e76efff1", "score": "0.607069", "text": "func (s *fs) Get(name string) ([]byte, error) {\n\ts.RLock()\n\tdefer s.RUnlock()\n\n\treturn s.get(name)\n}", "title": "" }, { "docid": "1da46236f0cfaa74b0b33a5e5360fd1d", "score": "0.60648793", "text": "func Get(file string) ([]byte, error) {\n\tdata, ok := files[file]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"File data for %q not found\", file)\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "918030f1cd86a388371546445239c5da", "score": "0.6055551", "text": "func (fs *SFTP) Get(ctx context.Context, path string, offset, length int64) (rv io.ReadCloser, err error) {\n\tremotepath := filepath.Join(fs.root, path)\n\tfh, err := fs.client.Open(remotepath)\n\tif err != nil {\n\t\tif isNotExist(err) {\n\t\t\treturn nil, errs.Wrap(backends.ErrNotExist)\n\t\t}\n\t\treturn nil, errs.Wrap(err)\n\t}\n\tif offset > 0 {\n\t\t_, err = fh.Seek(offset, io.SeekStart)\n\t\tif err != nil {\n\t\t\tfh.Close()\n\t\t\treturn nil, errs.Wrap(err)\n\t\t}\n\t}\n\n\treturn fh, nil\n}", "title": "" }, { "docid": "7f982d39b4570ee9fb4aa39188aa2adb", "score": "0.6044065", "text": "func Get(path string) (Interface, error) {\n\tabsPath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t// TODO make context optional\n\tctxt, err := func(fname string) (map[string]interface{}, error) {\n\t\tf, err := os.Open(fname)\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn nil, nil\n\t\t\t}\n\n\t\t\treturn nil, err\n\t\t}\n\t\tdefer f.Close()\n\n\t\tbuf, err := ioutil.ReadAll(f)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\tvar metadata map[string]interface{}\n\t\tif err := json.Unmarshal(buf, &metadata); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\n\t\treturn metadata, nil\n\t}(filepath.Join(absPath, boilr.ContextFileName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmetadataExists, err := osutil.FileExists(filepath.Join(absPath, boilr.TemplateMetadataName))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmd, err := func() (Metadata, error) {\n\t\tif !metadataExists {\n\t\t\treturn Metadata{}, nil\n\t\t}\n\n\t\tb, err := ioutil.ReadFile(filepath.Join(absPath, boilr.TemplateMetadataName))\n\t\tif err != nil {\n\t\t\treturn Metadata{}, err\n\t\t}\n\n\t\tvar m Metadata\n\t\tif err := json.Unmarshal(b, &m); err != nil {\n\t\t\treturn Metadata{}, err\n\t\t}\n\n\t\treturn m, nil\n\t}()\n\n\treturn &dirTemplate{\n\t\tContext: ctxt,\n\t\tFuncMap: FuncMap,\n\t\tPath: filepath.Join(absPath, boilr.TemplateDirName),\n\t\tMetadata: md,\n\t}, err\n}", "title": "" }, { "docid": "5a8ba429db84b7a48f6e39f5c6ca33bf", "score": "0.60336125", "text": "func (s *ContentStore) Get(pointer Pointer) (storage.Object, error) {\n\tf, err := s.Open(pointer.RelativePath())\n\tif err != nil {\n\t\tlog.Error(\"Whilst trying to read LFS OID[%s]: Unable to open Error: %v\", pointer.Oid, err)\n\t\treturn nil, err\n\t}\n\treturn f, err\n}", "title": "" }, { "docid": "e63d6128c9f3764688a43504db358bce", "score": "0.60291207", "text": "func Get(id int) (t *T, err error) {\n\tt, err = readFile(filenameForID(id))\n\treturn\n}", "title": "" }, { "docid": "a4be96cbfc3d284e58dad2aec014e3bf", "score": "0.60177857", "text": "func (sw *SwiftBackend) Get(ctx context.Context, rawurl string, hostPath string, class tes.FileType) error {\n\n\turl, perr := sw.parse(rawurl)\n\tif perr != nil {\n\t\treturn perr\n\t}\n\n\tswitch class {\n\tcase tes.FileType_FILE:\n\n\t\tf, _, oerr := sw.conn.ObjectOpen(url.bucket, url.path, true, nil)\n\t\tif oerr != nil {\n\t\t\treturn oerr\n\t\t}\n\n\t\tif err := sw.get(f, hostPath); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif err := f.Close(); err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\treturn nil\n\n\tcase tes.FileType_DIRECTORY:\n\t\tobjs, err := sw.conn.ObjectsAll(url.bucket, &swift.ObjectsOpts{\n\t\t\tPrefix: url.path,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfor _, obj := range objs {\n\t\t\tf, _, oerr := sw.conn.ObjectOpen(url.bucket, obj.Name, true, nil)\n\t\t\tif oerr != nil {\n\t\t\t\treturn oerr\n\t\t\t}\n\n\t\t\tif err := sw.get(f, path.Join(hostPath, strings.TrimPrefix(obj.Name, url.path))); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tif err := f.Close(); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\treturn nil\n\n\tdefault:\n\t\treturn fmt.Errorf(\"Unknown file class: %s\", class)\n\t}\n}", "title": "" }, { "docid": "8697f440efbdf4691d341b0ff5142b11", "score": "0.6016408", "text": "func (b *Bucket) Get(path string) (data []byte, err error) {\n\tbody, err := b.GetReader(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdata, err = ioutil.ReadAll(body)\n\tbody.Close()\n\treturn data, err\n}", "title": "" }, { "docid": "18e68ab6fd2ba93ca7cf2a02b499d664", "score": "0.59473914", "text": "func (fb *Filebase) Get(fid types.FileID) (types.FileI, error) {\n\tlock.RLock()\n\tdefer lock.RUnlock()\n\treturn fb.get(fid)\n}", "title": "" }, { "docid": "3e1a809d70e624eab023a449179a1de0", "score": "0.593508", "text": "func (c *Client) Get(bucket, name string) (*File, error) {\n\tf, err := c.get(\"/file/\"+url.PathEscape(bucket)+\"/\"+url.PathEscape(name), \"\")\n\tif f != nil {\n\t\tf.Bucket = bucket\n\t}\n\treturn f, err\n}", "title": "" }, { "docid": "e37e5620287258ae8b2ce61ce4341c7d", "score": "0.5931084", "text": "func (s *Service) Get(filename string) (io.ReadCloser, error) {\n\tf, err := os.Open(filepath.Join(s.dataDirectory, filename))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "560471f7f1ac8340c6244aad6eaf54eb", "score": "0.5887866", "text": "func (fb *File) Get() []byte {\n\treturn fb.Bytes\n}", "title": "" }, { "docid": "6b4452b7d60337be898ccb866d4ab953", "score": "0.5839341", "text": "func (d *FileStorage) GetFile(number uint64, t FileType) File {\n\treturn &file{stor: d, num: number, t: t}\n}", "title": "" }, { "docid": "d94dbfdc6e8434f6ec06ef06cbb6cfea", "score": "0.5827427", "text": "func getLatest(s Snapshot, path string, codec codec) (f *file, err error) {\n\tevalue, rev, err := s.conn.Get(path, nil)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tvalue, err := codec.Decode(evalue)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tf = &file{dir: path, Value: value, codec: codec, Snapshot: s.FastForward(rev)}\n\n\treturn\n}", "title": "" }, { "docid": "5e826b8bb3c3270b4424a5e55fc0676d", "score": "0.5817386", "text": "func (s *storager) get(ctx context.Context, location string, options []storage.Option) (os.FileInfo, error) {\n\tlocation = strings.Trim(location, \"/\")\n\t_, name := path.Split(location)\n\n\tobject, err := s.HeadObject(&s3.HeadObjectInput{Bucket: &s.bucket,\n\t\tKey: &location})\n\n\t//object, err := s.GetObject(&s3.GetObjectInput{\n\t//\tBucket: &s.bucket,\n\t//\tKey: &location,\n\t//})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\thasObject := object != nil && (object.ContentLength != nil || object.LastModified != nil)\n\tif !hasObject {\n\t\treturn nil, fmt.Errorf(noSuchKeyMessage + \" \" + location)\n\t}\n\ts.assignMetadataWithHead(options, object)\n\tcontentLength := int64(0)\n\tmodified := time.Now()\n\tif object.LastModified != nil {\n\t\tmodified = *object.LastModified\n\t}\n\tif object.ContentLength != nil {\n\t\tcontentLength = *object.ContentLength\n\t}\n\tif err = s.presign(ctx, location, options); err != nil {\n\t\treturn nil, err\n\t}\n\treturn file.NewInfo(name, contentLength, file.DefaultFileOsMode, modified, false, object), nil\n}", "title": "" }, { "docid": "738f2757d14bb966b542c8887b22cf77", "score": "0.581402", "text": "func (p *Packet) Get() interface{} {\n\te := []byte(`{}`)\n\tif p.group() == \"keymap\" {\n\t\te = []byte(`[]`)\n\t}\n\n\tif _, err := os.Stat(p.path); os.IsNotExist(err) {\n\t\tlog.Finest(\"%s doesn't exist yet\", p.path)\n\t\treturn e\n\t}\n\n\td, err := ioutil.ReadFile(p.path)\n\tif err != nil {\n\t\tlog.Errorf(\"Couldn't read file: %s\", err)\n\t\treturn e\n\t}\n\treturn d\n}", "title": "" }, { "docid": "531fd1b2fc6875bc6df10c9369d4027e", "score": "0.5809319", "text": "func Get(f string, i interface{}) (results chan []byte, closer func(), err error) {\n r := strings.Split(f, \":\")\n if len(r) != 2 {\n return nil, nil, fmt.Errorf(\"could not locate the file system marker that should be prepended: %q\", f)\n }\n\n v, ok := registry[r[0]]\n if !ok {\n return nil, nil, fmt.Errorf(\"could not locate an implementation that can read the file system designated by marker %q\", r[0])\n }\n\n w := v()\n\n ch, err := w.File(r[1], i)\n if err != nil {\n return nil, nil, err\n }\n\n return ch, w.Close, nil\n}", "title": "" }, { "docid": "6f7b07e9f80bd08c17a6f80f2d61fb3e", "score": "0.5807156", "text": "func (kv *DisKV) fileGet(shard int, key string) (string, error) {\n\tfullname := kv.shardDir(shard) + \"/key-\" + kv.encodeKey(key)\n\tcontent, err := ioutil.ReadFile(fullname)\n\treturn string(content), err\n}", "title": "" }, { "docid": "136c0907a9dd255146803f545da26b82", "score": "0.5804491", "text": "func (e *embedBox) Get(file string) []byte {\n\tif f, ok := e.storage[file]; ok {\n\t\treturn f\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e139f3800a78a88a95e133db37c2dfda", "score": "0.579933", "text": "func (s *File) Get(key string) (interface{}, error) {\n\tv, err := value(key, s.values)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn v, nil\n}", "title": "" }, { "docid": "2cf062768ed7404f5604fd88283fcc08", "score": "0.5784805", "text": "func (s fileSet) Get(name string) *File {\n\treturn s[name]\n}", "title": "" }, { "docid": "54e5afbe9ec923bf613de3ecf0a1efd0", "score": "0.57566845", "text": "func (s *Server) Get(ctx context.Context, filePath string) ([]byte, topo.Version, error) {\n\tnodePath := path.Join(s.root, filePath)\n\n\tresp, err := s.cli.Get(ctx, nodePath)\n\tif err != nil {\n\t\treturn nil, nil, convertError(err, nodePath)\n\t}\n\tif len(resp.Kvs) != 1 {\n\t\treturn nil, nil, topo.NewError(topo.NoNode, nodePath)\n\t}\n\n\treturn resp.Kvs[0].Value, EtcdVersion(resp.Kvs[0].ModRevision), nil\n}", "title": "" }, { "docid": "770ff586e4ec0500fc26566714918028", "score": "0.5753669", "text": "func Get(file string) []byte {\n\treturn box.Get(file)\n}", "title": "" }, { "docid": "a575986f7b0b77a503149ea8724d0bdd", "score": "0.5749707", "text": "func (fi *fileInfo) get() FileInfo {\n\tvar r FileInfo\n\t// Copy slices, to avoid races.\n\tfi.mu.Lock()\n\tr.Data = append(r.Data, fi.data...)\n\tif !fi.sorted {\n\t\tsort.Sort(linksByStart(fi.links))\n\t\tfi.sorted = true\n\t}\n\tr.Links = append(r.Links, fi.links...)\n\tfi.mu.Unlock()\n\treturn r\n}", "title": "" }, { "docid": "ef15e7947ffe711289cc1c5ca6e3255a", "score": "0.5743016", "text": "func (c *Client) get(uri, query string) (*File, error) {\nagain:\n\tif !c.has(CapReadFiles) {\n\t\treturn nil, fmt.Errorf(\"capabilities %q insufficient for reading files\", c.Key.Cap.String())\n\t}\n\tseq := c.mut.rlock()\n\tauth := c.mut.auth\n\thost := c.mut.dl\n\tc.mut.runlock()\n\treq := &http.Request{\n\t\tMethod: \"GET\",\n\t\tURL: &url.URL{\n\t\t\tHost: host,\n\t\t\tPath: uri,\n\t\t\tScheme: \"https\",\n\t\t\tRawQuery: query,\n\t\t},\n\t\tHeader: make(http.Header),\n\t}\n\treq.Header.Set(\"Authorization\", auth)\n\tres, err := c.http().Do(req)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif res.StatusCode != 200 && res.StatusCode != 206 {\n\t\te := &Error{Op: \"GET \" + req.URL.String(), Status: res.StatusCode}\n\t\tjson.NewDecoder(res.Body).Decode(e)\n\t\tres.Body.Close()\n\t\terr = c.renew(res, e, seq)\n\t\tif err == nil {\n\t\t\tgoto again\n\t\t}\n\t\treturn nil, err\n\t}\n\n\th := res.Header\n\tname, err := url.PathUnescape(h.Get(\"X-Bz-File-Name\"))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tvar info map[string]string\n\tfor k, vals := range h {\n\t\tif strings.HasPrefix(k, \"X-Bz-Info-\") {\n\t\t\tif info == nil {\n\t\t\t\tinfo = make(map[string]string)\n\t\t\t}\n\t\t\tinfo[strings.TrimPrefix(k, \"X-Bz-Info-\")] = strings.Join(vals, \", \")\n\t\t}\n\t}\n\n\tvar created int64\n\tts := h.Get(\"X-Bz-Upload-Timestamp\")\n\tif i, err := strconv.ParseInt(ts, 10, 64); err == nil {\n\t\tcreated = i\n\t}\n\n\tf := &File{\n\t\tFileInfo: FileInfo{\n\t\t\tContentType: h.Get(\"Content-Type\"),\n\t\t\tSize: res.ContentLength,\n\t\t\tName: name,\n\t\t\tID: h.Get(\"X-Bz-File-Id\"),\n\t\t\tExtra: info,\n\t\t\tTimestamp: created,\n\t\t},\n\t\tBody: res.Body,\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "6ca2cee427e0ec6a54d3af71538c21a8", "score": "0.5707157", "text": "func (_m *MockFileSystem) Get(path string) (File, error) {\n\tret := _m.Called(path)\n\n\tvar r0 File\n\tif rf, ok := ret.Get(0).(func(string) File); ok {\n\t\tr0 = rf(path)\n\t} else {\n\t\tif ret.Get(0) != nil {\n\t\t\tr0 = ret.Get(0).(File)\n\t\t}\n\t}\n\n\tvar r1 error\n\tif rf, ok := ret.Get(1).(func(string) error); ok {\n\t\tr1 = rf(path)\n\t} else {\n\t\tr1 = ret.Error(1)\n\t}\n\n\treturn r0, r1\n}", "title": "" }, { "docid": "54c28b22c478e70eed97a2c1f77abd87", "score": "0.56872815", "text": "func (f *files) add(path string) *file {\n\tf.mu.Lock()\n\tdefer f.mu.Unlock()\n\tf.files[path] = &file{path: path}\n\treturn f.files[path]\n}", "title": "" }, { "docid": "fb08c217d6fc9b613e32f0dcc903ac4d", "score": "0.5683746", "text": "func (gcloudAgent *GCloudStorageAgent) getFile(bucketName, key string) (out io.ReadCloser, length int64, err error) {\n\tif bucketName == \"\" {\n\t\treturn out, length, ErrBucketEmpty\n\t}\n\n\tif key == \"\" {\n\t\treturn out, length, ErrKeyEmpty\n\t}\n\n\tbucket := gcloudAgent.Bucket(bucketName)\n\tctx := context.Background()\n\n\tobject := bucket.Object(key)\n\to, err := object.NewReader(ctx)\n\tif err != nil {\n\t\treturn out, length, err\n\t}\n\n\treturn o, o.Size(), err\n}", "title": "" }, { "docid": "5c69c3d7e5c0d50f3b92ea60a68225fe", "score": "0.5677998", "text": "func (gcloudAgent *GCloudStorageAgent) GetFile(path string) (out io.ReadCloser, length int64, err error) {\n\tbucket, key, err := parsePath(path)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\n\treturn gcloudAgent.getFile(bucket, key)\n}", "title": "" }, { "docid": "2a2cd9c80027aa36bacad4d06e74c980", "score": "0.56588835", "text": "func (s *Controllers) Get(path string) ([]byte, error) {\n\n\tdata, err := ioutil.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn data, nil\n}", "title": "" }, { "docid": "ef2fe4d853f43e3d77112cc0dad1989f", "score": "0.5646863", "text": "func (s FileSystem) Get(ctx context.Context, file string) (image.Image, error) {\n\timgPath := filepath.Join(s.basePath, file)\n\tf, err := os.Open(filepath.Clean(imgPath))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load the file %s from %s error %s\", file, imgPath, err.Error())\n\t}\n\n\timg, _, err := image.Decode(f)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn img, nil\n}", "title": "" }, { "docid": "eb6950ea1a5f2e2560ff18383b3daba9", "score": "0.56230956", "text": "func GetFile(fs iface.FileSys, filepath string) ([]byte, error) {\n\ttempl, err := fs.SelectPlace(\"template\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tb, err := templ.File(filepath).Read()\n\tif err == nil {\n\t\treturn b, nil\n\t}\n\tif !PossibleModPath(filepath) {\n\t\treturn nil, fmt.Errorf(\"Not found.\")\n\t}\n\tmod, err := fs.SelectPlace(\"modules\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tmtp := getModTPath(filepath)\n\treturn mod.Directory(mtp.modname, \"tpl\").File(mtp.fpath).Read()\n}", "title": "" }, { "docid": "db6fd2804e66337f7c9ca01299b5ad56", "score": "0.56147045", "text": "func GetFile(\n\tdb *proxy.DB,\n\tname string,\n\tbranch string,\n\tpath string) (*FileInfo, error) {\n\n\tpath = strings.TrimPrefix(path, \"/\")\n\n\trepo, err := openRepo(db, false, name)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\thash, err := resolveHashFromName(repo, branch)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tc, err := repo.CommitObject(hash)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tobj, err := c.File(path)\n\tif err != nil {\n\t\tif err == object.ErrFileNotFound {\n\t\t\treturn nil, errFileDoesNotExist\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tcontents, err := obj.Contents()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &FileInfo{\n\t\tContents: contents,\n\t\t//RepoHash: ref.Hash().String(),\n\t\tItemHash: obj.Hash.String(),\n\t}, nil\n}", "title": "" }, { "docid": "08826bcda1a0134160df4c376eaf050d", "score": "0.56078607", "text": "func (s *Store) Get(ctx context.Context, name string) (*file.File, error) {\n\tresp, err := s.S3.GetObjectWithContext(ctx, &s3.GetObjectInput{\n\t\tBucket: aws.String(s.Bucket),\n\t\tKey: aws.String(name),\n\t})\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &file.File{\n\t\tName: name,\n\t\tSize: *resp.ContentLength,\n\t\tLastModified: s.lastModified(resp.Metadata, *resp.LastModified),\n\t\tBody: resp.Body,\n\t}, nil\n}", "title": "" }, { "docid": "3cfc07424093f9570fe8804256942b27", "score": "0.56055653", "text": "func (f *File) Get() *[]byte {\n\treturn f.contents\n}", "title": "" }, { "docid": "2516e54c21967ea22fb84bee576a7688", "score": "0.558218", "text": "func (f *files) getOrAdd(path string) *file {\n\tif h := f.get(path); h != nil {\n\t\treturn h\n\t}\n\treturn f.add(path)\n}", "title": "" }, { "docid": "e12efdcef3a6b07492d011a9b87e9cf9", "score": "0.55666107", "text": "func (o Object) Get(path string) interface{} {\n\tparts := strings.Split(path, \".\")\n\tcurr := map[string]interface{}(o)\n\tfor i, p := range parts {\n\t\tif tmp, ok := curr[p]; ok {\n\t\t\tif i == len(parts)-1 {\n\t\t\t\treturn tmp\n\t\t\t}\n\t\t\tcurr, ok = tmp.(map[string]interface{})\n\t\t\tif !ok {\n\t\t\t\treturn nil\n\t\t\t}\n\t\t} else {\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a2216c5a1cedce45752c46563053bde", "score": "0.5563717", "text": "func (r *FsRepo) Get(key string) string {\n\tif res := r.getPermStore(key); res != \"\" {\n\t\treturn res\n\t}\n\n\tif res := r.fileCache.Get(key); res != nil {\n\t\treturn res.(Resource).Path\n\t}\n\n\treturn \"\"\n}", "title": "" }, { "docid": "62007b05e3938b7d30f6dd955bf179f7", "score": "0.5560056", "text": "func (f *fsClient) Get(offset, length int64) (io.ReadSeeker, *probe.Error) {\n\tif offset < 0 || length < 0 {\n\t\treturn nil, probe.NewError(client.InvalidRange{Offset: offset})\n\t}\n\n\ttmppath := f.PathURL.Path\n\t// Golang strips trailing / if you clean(..) or\n\t// EvalSymlinks(..). Adding '.' prevents it from doing so.\n\tif strings.HasSuffix(tmppath, string(f.PathURL.Separator)) {\n\t\ttmppath = tmppath + \".\"\n\t}\n\n\t// Resolve symlinks.\n\t_, e := filepath.EvalSymlinks(tmppath)\n\tif e != nil {\n\t\terr := f.toClientError(e, f.PathURL.Path)\n\t\treturn nil, err.Trace(f.PathURL.Path)\n\t}\n\tbody, e := os.Open(f.PathURL.Path)\n\tif e != nil {\n\t\terr := f.toClientError(e, f.PathURL.Path)\n\t\treturn nil, err.Trace(f.PathURL.Path)\n\t}\n\tif offset == 0 && length == 0 {\n\t\treturn body, nil\n\t}\n\treturn io.NewSectionReader(body, offset, length), nil\n}", "title": "" }, { "docid": "64896895e56527112f5619763853169f", "score": "0.5555373", "text": "func (fw *MockFileWatcher) Get() any {\n\treturn fw.data.Load()\n}", "title": "" }, { "docid": "7c65e4b5ca64ef8daf0e30cfa021f873", "score": "0.5547227", "text": "func (mock GetArchiver) Get(fpath, ftype string) test.Archiver {\n\tmethodName := \"Get\" // nolint: goconst\n\tif mock.impl.Get != nil {\n\t\treturn mock.impl.Get(fpath, ftype)\n\t}\n\tif mock.callbackNotImplemented != nil {\n\t\tmock.callbackNotImplemented(mock.t, mock.name, methodName)\n\t} else {\n\t\tgomic.DefaultCallbackNotImplemented(mock.t, mock.name, methodName)\n\t}\n\treturn mock.fakeZeroGet(fpath, ftype)\n}", "title": "" }, { "docid": "e4c1d1680b42da6e8970b2bf2b40c627", "score": "0.5547037", "text": "func (v *View) getFile(uri source.URI) *File {\n\tf, found := v.files[uri]\n\tif !found {\n\t\tf = &File{\n\t\t\tURI: uri,\n\t\t\tview: v,\n\t\t}\n\t\tv.files[uri] = f\n\t}\n\treturn f\n}", "title": "" }, { "docid": "892461b8b38a2fe9b6c816052db79efa", "score": "0.5542056", "text": "func (t tchain) getFile() *File {\n\tif len(t.trees) == 0 {\n\t\treturn nil\n\t}\n\treturn t.trees[0].getFile()\n}", "title": "" }, { "docid": "9880d7fa5394f18a9e30a4b420c70572", "score": "0.553454", "text": "func GetStruct(path string, value interface{}) (bool, error) {\n\treturn getTree().GetStruct(path, value)\n}", "title": "" }, { "docid": "1be54bb17a3bb5437876478f30dfa579", "score": "0.5530403", "text": "func (s Status) File(path string) *FileStatus {\n\tif _, ok := (s)[path]; !ok {\n\t\ts[path] = &FileStatus{Worktree: Untracked, Staging: Untracked}\n\t}\n\n\treturn s[path]\n}", "title": "" }, { "docid": "bae0051f0da01354792f58d31e4fd712", "score": "0.55278474", "text": "func (ds DirStore) Get(key []byte) ([]byte, error) {\n\tdat, err := ioutil.ReadFile(ds.path(key))\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\terr = ErrNotExist\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn dat, err\n}", "title": "" }, { "docid": "8f19f33662beadfcba84a66208555205", "score": "0.5511079", "text": "func GetFile(filePath string, value interface{}) interface{} {\n\n\tfilename, _ := filepath.Abs(filePath)\n\tfmt.Println(\"filename:\", filename)\n\tyamlFile, err := ioutil.ReadFile(filename)\n\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = yaml.Unmarshal(yamlFile, value)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\treturn value\n}", "title": "" }, { "docid": "517cb74fd7c8f2391616ad029d67c590", "score": "0.55097526", "text": "func (fs *FileSystem) Get(id string, domain string) (files []File, err error) {\n\tfs.Lock()\n\tdefer fs.Unlock()\n\treturn fs.get(id, domain)\n}", "title": "" }, { "docid": "ade132b055c1fba4fd7754141db3cff3", "score": "0.5492667", "text": "func (t *Tree) File(path string) (*File, error) {\n\thash, err := t.findHash(path)\n\tif err != nil {\n\t\treturn nil, ErrFileNotFound\n\t}\n\n\tobj, err := t.r.Storage.Get(*hash)\n\tif err != nil {\n\t\tif err == core.ObjectNotFoundErr {\n\t\t\treturn nil, ErrFileNotFound // a git submodule\n\t\t}\n\t\treturn nil, err\n\t}\n\n\tif obj.Type() != core.BlobObject {\n\t\treturn nil, ErrFileNotFound // a directory\n\t}\n\n\tblob := &Blob{}\n\tblob.Decode(obj)\n\n\treturn &File{Name: path, Reader: blob.Reader(), Hash: *hash}, nil\n}", "title": "" }, { "docid": "85ae7b60f0ac8f765667725dba8dc721", "score": "0.54646665", "text": "func (db *DB) GetFile(id int64) (models.File, error) {\n\tvar f = models.File{Tags: make(map[string]string, 0)}\n\tquery := `SELECT pFileID, rApplicationID, dCreated, dUploaded, sTitle, sURL, sMimeType, sSize, sValidateMimeTypes, sKey, sValue\n\tFROM tFiles JOIN tFileTags ON rFileID = pFileID\n\tWHERE pFileID = ?`\n\n\trows, err := db.Query(query, id)\n\tif err != nil {\n\t\treturn f, err\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tvar mimeType string\n\t\tvar key string\n\t\tvar value string\n\t\terr = rows.Scan(&f.ID, &f.ApplicationID, &f.Created, &f.Uploaded, &f.Title, &f.URL, &f.MimeType, &f.Size,\n\t\t\t&mimeType, &key, &value)\n\t\tif err != nil {\n\t\t\treturn f, err\n\t\t}\n\t\tf.Validate.MimeType = strings.Split(mimeType, \",\")\n\t\tf.Tags[key] = value\n\t}\n\terr = rows.Err()\n\tif err != nil {\n\t\treturn f, err\n\t}\n\tif f.ID == 0 {\n\t\treturn f, sql.ErrNoRows\n\t}\n\treturn f, nil\n}", "title": "" }, { "docid": "b6aba9e36ff67aa1bc5558a232753481", "score": "0.5459573", "text": "func (fs *FileService) GetMeta(path string) (*Meta, error) {\n\n\tpath = strings.Trim(path, \"/\")\n\n\tmeta := new(Meta)\n\t_, err := fs.client.DoRequestDecoding(\"GET\", fmt.Sprintf(getMetaSuffix, path), nil, meta)\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn meta, nil\n}", "title": "" }, { "docid": "093c8ae1f517b433eeb82b963444a682", "score": "0.544103", "text": "func (c *FileCache) Get(key string) []byte {\n\tc.m.RLock()\n\tdefer c.m.RUnlock()\n\n\tfp := filepath.Join(c.path, key) + \".cache\"\n\tb, err := ioutil.ReadFile(fp)\n\tif err != nil {\n\t\treturn nil\n\t}\n\n\treturn b\n}", "title": "" }, { "docid": "14a8e3c9f3ce0bd0f67d6dc3e0161670", "score": "0.54392385", "text": "func (blkio *BlockIOSubsystem) get(path string) error {\n\tif err := blkioThrottle(path, blkio); err != nil {\n\t\treturn err\n\t}\n\n\t// TODO(akroh): Implement reading for the CFQ values.\n\n\treturn nil\n}", "title": "" }, { "docid": "36e342210faf1327304a73b8482eca51", "score": "0.5424437", "text": "func (self *fileContent) Get() []byte {\n\treturn self.content\n}", "title": "" }, { "docid": "f159b5266deb7e305f378b7dc17c7279", "score": "0.5423921", "text": "func (t *File) getPath() string {\n\treturn t.Path\n}", "title": "" }, { "docid": "0457149468819b0fa84da50b1b7513fc", "score": "0.541993", "text": "func (b *cartonFS) GetFile(path string) (ret []byte, err error) {\n\tret, err = b.getFileFromCarton(path)\n\tif err != nil {\n\t\tret, err = b.getFileLocal(path)\n\t}\n\treturn\n}", "title": "" }, { "docid": "4c017e7aacc89e5eb16d2ce535d7d50b", "score": "0.5411039", "text": "func (tfrGetter *RegistryGetter) GetFile(dst string, src *url.URL) error {\n\treturn errors.WithStackTrace(fmt.Errorf(\"GetFile is not implemented for the Terraform Registry Getter\"))\n}", "title": "" }, { "docid": "389a8cbbd74d7130485a671e98ff7bfc", "score": "0.5409958", "text": "func (cr *GitConfigRepo) GetFile(targetApp *configrepo.ApplicationVersion, path string) (*configrepo.RepoFile, error) {\n\tlog := logrus.WithField(\"method\", \"GetFile\").WithField(\"targetApp\", targetApp).WithField(\"path\", path)\n\tbranchRef, err := cr.GetNearestBranch(targetApp)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tcommit, err := cr.repo.CommitObject(branchRef.Hash())\n\tif err != nil {\n\t\tlog.Errorf(\"Error getting the commit object:%s\", err)\n\t\treturn nil, err\n\t}\n\tlog.Debugf(\"found commit: %s\", commit.Hash.String())\n\ttree, err := commit.Tree()\n\tif err != nil {\n\t\tlog.Errorf(\"Error getting the tree:%s\", err)\n\t\treturn nil, err\n\t}\n\n\tfl, err := tree.File(path)\n\tif err != nil {\n\t\tlog.Errorf(\"Error getting the file:%s\", err)\n\t\treturn nil, err\n\t}\n\tflReader, err := fl.Reader()\n\tif err != nil {\n\t\tlog.Errorf(\"Error creating the file reader:%s\", err)\n\t\treturn nil, err\n\t}\n\tdefer flReader.Close()\n\tresult := &configrepo.RepoFile{Version: commit.Hash.String()}\n\tresult.Content, err = ioutil.ReadAll(flReader)\n\tif err != nil {\n\t\tlog.Errorf(\"Error reading the file:%s\", err)\n\t\treturn nil, err\n\t}\n\treturn result, nil\n}", "title": "" }, { "docid": "5dc243dc9c3d2ccb0ed3107fdd9dbe44", "score": "0.54049134", "text": "func GetOrHeadFile(w http.ResponseWriter, r *http.Request, fs storage.FS, spaceID string) {\n\tctx := r.Context()\n\tsublog := appctx.GetLogger(ctx).With().Str(\"svc\", \"datatx\").Str(\"handler\", \"download\").Logger()\n\n\tvar fn string\n\tfiles, ok := r.URL.Query()[\"filename\"]\n\tif !ok || len(files[0]) < 1 {\n\t\tfn = r.URL.Path\n\t} else {\n\t\tfn = files[0]\n\t}\n\n\tvar ref *provider.Reference\n\tif spaceID == \"\" {\n\t\t// ensure the absolute path starts with '/'\n\t\tref = &provider.Reference{Path: path.Join(\"/\", fn)}\n\t} else {\n\t\t// build a storage space reference\n\t\tstorageid, opaqeid, err := utils.SplitStorageSpaceID(spaceID)\n\t\tif err != nil {\n\t\t\tsublog.Error().Str(\"space_id\", spaceID).Str(\"path\", fn).Msg(\"invalid reference\")\n\t\t\tw.WriteHeader(http.StatusBadRequest)\n\t\t\treturn\n\t\t}\n\t\tref = &provider.Reference{\n\t\t\tResourceId: &provider.ResourceId{StorageId: storageid, OpaqueId: opaqeid},\n\t\t\t// ensure the relative path starts with '.'\n\t\t\tPath: utils.MakeRelativePath(fn),\n\t\t}\n\t}\n\t// TODO check preconditions like If-Range, If-Match ...\n\n\tvar (\n\t\tmd *provider.ResourceInfo\n\t\tcontent io.ReadCloser\n\t\tsize int64\n\t\terr error\n\t)\n\n\t// do a stat to get the mime type\n\tif md, err = fs.GetMD(ctx, ref, nil); err != nil {\n\t\thandleError(w, &sublog, err, \"stat\")\n\t\treturn\n\t}\n\tmimeType := md.MimeType\n\n\tif versionKey := r.URL.Query().Get(\"version_key\"); versionKey != \"\" {\n\t\t// the request is for a version file\n\t\tstat, err := statRevision(ctx, fs, ref, versionKey)\n\t\tif err != nil {\n\t\t\thandleError(w, &sublog, err, \"stat revision\")\n\t\t\treturn\n\t\t}\n\t\tsize = int64(stat.Size)\n\t\tcontent, err = fs.DownloadRevision(ctx, ref, versionKey)\n\t\tif err != nil {\n\t\t\thandleError(w, &sublog, err, \"download revision\")\n\t\t\treturn\n\t\t}\n\t} else {\n\t\tsize = int64(md.Size)\n\t\tcontent, err = fs.Download(ctx, ref)\n\t\tif err != nil {\n\t\t\thandleError(w, &sublog, err, \"download\")\n\t\t\treturn\n\t\t}\n\t}\n\tdefer content.Close()\n\n\tvar ranges []HTTPRange\n\n\tif r.Header.Get(\"Range\") != \"\" {\n\t\tranges, err = ParseRange(r.Header.Get(\"Range\"), size)\n\t\tif err != nil {\n\t\t\tif err == ErrNoOverlap {\n\t\t\t\tw.Header().Set(\"Content-Range\", fmt.Sprintf(\"bytes */%d\", size))\n\t\t\t}\n\t\t\tsublog.Error().Err(err).Interface(\"md\", md).Interface(\"ranges\", ranges).Msg(\"range request not satisfiable\")\n\t\t\tw.WriteHeader(http.StatusRequestedRangeNotSatisfiable)\n\n\t\t\treturn\n\t\t}\n\t\tif SumRangesSize(ranges) > size {\n\t\t\t// The total number of bytes in all the ranges\n\t\t\t// is larger than the size of the file by\n\t\t\t// itself, so this is probably an attack, or a\n\t\t\t// dumb client. Ignore the range request.\n\t\t\tranges = nil\n\t\t}\n\t}\n\n\tcode := http.StatusOK\n\tsendSize := size\n\tvar sendContent io.Reader = content\n\n\tvar s io.Seeker\n\tif s, ok = content.(io.Seeker); ok {\n\t\t// tell clients they can send range requests\n\t\tw.Header().Set(\"Accept-Ranges\", \"bytes\")\n\t}\n\n\tif len(ranges) > 0 {\n\t\tsublog.Debug().Int64(\"start\", ranges[0].Start).Int64(\"length\", ranges[0].Length).Msg(\"range request\")\n\t\tif s == nil {\n\t\t\tsublog.Error().Int64(\"start\", ranges[0].Start).Int64(\"length\", ranges[0].Length).Msg(\"ReadCloser is not seekable\")\n\t\t\tw.WriteHeader(http.StatusRequestedRangeNotSatisfiable)\n\t\t\treturn\n\t\t}\n\n\t\tswitch {\n\t\tcase len(ranges) == 1:\n\t\t\t// RFC 7233, Section 4.1:\n\t\t\t// \"If a single part is being transferred, the server\n\t\t\t// generating the 206 response MUST generate a\n\t\t\t// Content-Range header field, describing what range\n\t\t\t// of the selected representation is enclosed, and a\n\t\t\t// payload consisting of the range.\n\t\t\t// ...\n\t\t\t// A server MUST NOT generate a multipart response to\n\t\t\t// a request for a single range, since a client that\n\t\t\t// does not request multiple parts might not support\n\t\t\t// multipart responses.\"\n\t\t\tra := ranges[0]\n\t\t\tif _, err := s.Seek(ra.Start, io.SeekStart); err != nil {\n\t\t\t\tsublog.Error().Err(err).Int64(\"start\", ra.Start).Int64(\"length\", ra.Length).Msg(\"content is not seekable\")\n\t\t\t\tw.WriteHeader(http.StatusRequestedRangeNotSatisfiable)\n\t\t\t\treturn\n\t\t\t}\n\t\t\tsendSize = ra.Length\n\t\t\tcode = http.StatusPartialContent\n\t\t\tw.Header().Set(\"Content-Range\", ra.ContentRange(size))\n\t\tcase len(ranges) > 1:\n\t\t\tsendSize = RangesMIMESize(ranges, mimeType, size)\n\t\t\tcode = http.StatusPartialContent\n\n\t\t\tpr, pw := io.Pipe()\n\t\t\tmw := multipart.NewWriter(pw)\n\t\t\tw.Header().Set(\"Content-Type\", \"multipart/byteranges; boundary=\"+mw.Boundary())\n\t\t\tsendContent = pr\n\t\t\tdefer pr.Close() // cause writing goroutine to fail and exit if CopyN doesn't finish.\n\t\t\tgo func() {\n\t\t\t\tfor _, ra := range ranges {\n\t\t\t\t\tpart, err := mw.CreatePart(ra.MimeHeader(mimeType, size))\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t_ = pw.CloseWithError(err) // CloseWithError always returns nil\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := s.Seek(ra.Start, io.SeekStart); err != nil {\n\t\t\t\t\t\t_ = pw.CloseWithError(err) // CloseWithError always returns nil\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := io.CopyN(part, content, ra.Length); err != nil {\n\t\t\t\t\t\t_ = pw.CloseWithError(err) // CloseWithError always returns nil\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tmw.Close()\n\t\t\t\tpw.Close()\n\t\t\t}()\n\t\t}\n\t}\n\n\tif w.Header().Get(\"Content-Encoding\") == \"\" {\n\t\tw.Header().Set(\"Content-Length\", strconv.FormatInt(sendSize, 10))\n\t}\n\n\tw.WriteHeader(code)\n\n\tif r.Method != http.MethodHead {\n\t\tvar c int64\n\t\tc, err = io.CopyN(w, sendContent, sendSize)\n\t\tif err != nil {\n\t\t\tsublog.Error().Err(err).Msg(\"error copying data to response\")\n\t\t\treturn\n\t\t}\n\t\tif c != sendSize {\n\t\t\tsublog.Error().Int64(\"copied\", c).Int64(\"size\", sendSize).Msg(\"copied vs size mismatch\")\n\t\t}\n\t}\n}", "title": "" }, { "docid": "9a7ad84155063ca3d5053e0dc313215d", "score": "0.5403891", "text": "func (fs *FSStore) Get(key string) ([]byte, error) {\n\n\tvar b = new(bytes.Buffer)\n\n\tf, err := os.OpenFile(fs.filePathFor(key), os.O_RDONLY, 0644)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tif _, err := io.Copy(b, f); err != nil {\n\t\tf.Close()\n\t\treturn nil, err\n\t}\n\n\tf.Close()\n\n\ti := new(onecache.Item)\n\n\tif err := fs.b.DeSerialize(b.Bytes(), i); err != nil {\n\t\treturn nil, err\n\t}\n\n\tif i.IsExpired() {\n\t\tfs.Delete(key)\n\t\treturn nil, onecache.ErrCacheMiss\n\t}\n\n\treturn i.Data, nil\n}", "title": "" }, { "docid": "046708fd9edf6c7c51a443fd596aebe4", "score": "0.54018915", "text": "func (bot *BotAPI) GetFile(config FileConfig) (File, error) {\n\tv := url.Values{}\n\tv.Add(\"file_id\", config.FileID)\n\n\tresp, err := bot.MakeRequest(\"getFile\", v)\n\tif err != nil {\n\t\treturn File{}, err\n\t}\n\n\tvar file File\n\tjson.Unmarshal(resp.Result, &file)\n\n\tif bot.Debug {\n\t\tlog.Printf(\"getFile req : %+v\\n\", v)\n\t\tlog.Printf(\"getFile resp: %+v\\n\", file)\n\t}\n\n\treturn file, nil\n}", "title": "" }, { "docid": "4dce53579b49d328cb2a8d105ebafb97", "score": "0.54011285", "text": "func (f *Attachment) GET(c *gin.Context) {\n\tdir := \"./third_party/filetmp\"\n\thash := c.Query(\"hash\")\n\tif err := f.ipfs.Get(hash, dir); err != nil {\n\t\tlogging.Error(\"ipfs get: %v\", err.Error)\n\t\tlib.WriteString(c, 40002, nil)\n\t\treturn\n\t}\n\n\tdata, err := ioutil.ReadFile(dir + \"/\" + hash)\n\tif err != nil {\n\t\tlogging.Debug(\"ipfs get: %v\", err.Error)\n\t\tlib.WriteString(c, 40002, nil)\n\t\treturn\n\t}\n\tr := &Download{\n\t\tHash: hash,\n\t\tData: data,\n\t}\n\t// lib.DeleteFile(dir + \"/\" + hash)\n\n\tlib.WriteString(c, 200, r)\n}", "title": "" }, { "docid": "a55c593b29e6f0232b289d3e7726447d", "score": "0.53930146", "text": "func (p *Book) GetFile(name string) (result []byte, err error) {\n\tvar file io.ReadCloser\n\tname = normalizeFilename(name)\n\tfor _, v := range p.fd.File {\n\t\tif v.Name == name {\n\t\t\tfile, err = v.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbreak\n\t\t} else if \"OEBPS/\"+name == v.Name {\n\t\t\tfile, err = v.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbreak\n\t\t} else if \"OPS/\"+name == v.Name {\n\t\t\tfile, err = v.Open()\n\t\t\tif err != nil {\n\t\t\t\treturn\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif file == nil {\n\t\treturn\n\t}\n\n\tdefer file.Close()\n\n\tresult, err = ioutil.ReadAll(file)\n\treturn\n}", "title": "" }, { "docid": "87f477dccfb6fe34a4289ff4420a6064", "score": "0.53919613", "text": "func (st *StatsConn) Get(ctx context.Context, filePath string) ([]byte, Version, error) {\n\tstartTime := time.Now()\n\tstatsKey := []string{\"Get\", st.cell}\n\tdefer topoStatsConnTimings.Record(statsKey, startTime)\n\tbytes, version, err := st.conn.Get(ctx, filePath)\n\tif err != nil {\n\t\ttopoStatsConnErrors.Add(statsKey, int64(1))\n\t\treturn bytes, version, err\n\t}\n\treturn bytes, version, err\n}", "title": "" }, { "docid": "b01fedf6af88204a7eeb88f88d03f759", "score": "0.53875154", "text": "func (m Manager) GetFile(id string) ([]byte, error) {\n\tc, ok := m.store[id]\n\tif !ok {\n\t\treturn nil, fmt.Errorf(\"File not found in cache store: %v: %w\", id, errFileNotCached)\n\t}\n\treturn c.content, nil\n}", "title": "" }, { "docid": "ba8ecbf0d38e9b2b7fff830671a9a9ae", "score": "0.5387511", "text": "func (b *Bucket) GetFile(ctx context.Context, path string, w io.Writer) error {\n\tb.lock.RLock()\n\tdefer b.lock.RUnlock()\n\n\tctx, _, err := b.getContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := b.bucketsClient.PullPath(ctx, b.Key(), path, w); err != nil {\n\t\tlog.Error(\"error in GetFile from textile client\", err)\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "95de7437317d38cb15fb1a581e7772ac", "score": "0.53854895", "text": "func (m *Module) GetStruct(path string, value interface{}) (bool, error) {\n\trv := reflect.ValueOf(value)\n\tif rv.Kind() != reflect.Ptr {\n\t\tif rv.IsValid() {\n\t\t\tlog.Printf(\"%s: GetStruct(%q, non-pointer %s): invalid argument\", m.name, path, rv.Type())\n\t\t} else {\n\t\t\tlog.Printf(\"%s: GetStruct(%q, nil): invalid argument\", m.name, path)\n\t\t}\n\t\treturn false, &json.InvalidUnmarshalError{Type: reflect.TypeOf(value)}\n\t} else if rv.IsNil() {\n\t\tlog.Printf(\"%s: GetStruct(%q, nil %s): invalid argument\", m.name, path, rv.Type())\n\t\treturn false, &json.InvalidUnmarshalError{Type: reflect.TypeOf(value)}\n\t}\n\trv = rv.Elem()\n\n\tif m.getCache(path, rv) {\n\t\treturn true, nil\n\t}\n\n\tformat, data := m.get(path)\n\tswitch format {\n\tcase 0:\n\t\treturn false, nil\n\tcase 'j':\n\t\tval := reflect.New(rv.Type())\n\t\terr := json.Unmarshal(data, val.Interface())\n\t\tif err != nil {\n\t\t\tlog.Printf(\"%s:%s: failed to unmarshal JSON: %s\", m.name, path, err)\n\t\t\treturn false, err\n\t\t}\n\t\trv.Set(val.Elem())\n\t\tm.setCache(path, rv)\n\t\treturn true, nil\n\tdefault:\n\t\terr := ErrFormatIsNotJSON\n\t\tlog.Printf(\"%s:%s: %s\\n\", m.name, path, err)\n\t\treturn false, err\n\t}\n}", "title": "" }, { "docid": "1fa3a605a96f7960de847427eee0f50c", "score": "0.5384789", "text": "func (f *File) Path() string { return f.path }", "title": "" }, { "docid": "7abc5e0a5afdbd1a52b648d42cb25c0f", "score": "0.53789526", "text": "func (s *fileStore) GenericGet(name string) (string, error) {\n\tdata, err := Dir(s.root).readFile(filepath.Join(\"generic\", name))\n\treturn string(data), err\n}", "title": "" }, { "docid": "32b69ffcafffeb7298b618fc01bcb19a", "score": "0.537139", "text": "func (c HTTPBinaryCacheStore) GetFile(ctx context.Context, path string) (io.ReadCloser, error) {\n\tresp, err := http.Get(c.getURL(path))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif resp.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"unexpected file status '%s'\", resp.Status)\n\t}\n\treturn resp.Body, nil\n}", "title": "" }, { "docid": "e677b74ca5a2172d442f49d7bad40049", "score": "0.5362418", "text": "func (d *FileStorage) GetManifest() (f File, err error) {\n\tpth := filepath.Join(d.path, \"CURRENT\")\n\trw, err := os.OpenFile(pth, os.O_RDONLY, 0)\n\tif err != nil {\n\t\terr = err.(*os.PathError).Err\n\t\treturn\n\t}\n\tdefer rw.Close()\n\tbuf := new(bytes.Buffer)\n\t_, err = buf.ReadFrom(rw)\n\tif err != nil {\n\t\treturn\n\t}\n\tb := buf.Bytes()\n\tp := &file{stor: d}\n\tif len(b) < 1 || b[len(b)-1] != '\\n' || !p.parse(string(b[:len(b)-1])) {\n\t\treturn nil, errors.ErrCorrupt(\"invalid CURRENT file\")\n\t}\n\treturn p, nil\n}", "title": "" }, { "docid": "9990e6de70922e2f9a9bc4e0a15b4357", "score": "0.53546274", "text": "func (d *Db) Get(file string) error {\n\tsession, err := mgo.Dial(d.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer session.Close()\n\tg := session.DB(d.Database).GridFS(PREFIX)\n\tf, err := g.Open(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdest, err := os.Create(file)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer dest.Close()\n\t_, err = io.Copy(dest, f)\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = f.Close()\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4a908958fa17a09cbafaacb518d5c32b", "score": "0.5353296", "text": "func (s *GithubReleaseSource) GetFile(path string, requestHeaders schwift.ObjectHeaders) (io.ReadCloser, FileState, error) {\n\tu := fmt.Sprintf(\"repos/%s/%s/releases/assets/%s\", s.owner, s.repo, path)\n\treq, err := s.client.NewRequest(http.MethodGet, u, nil)\n\tif err != nil {\n\t\treturn nil, FileState{}, fmt.Errorf(\"skipping: could not create URL for %s: %s\", u, err.Error())\n\t}\n\n\tfor key, val := range requestHeaders.Headers {\n\t\treq.Header.Set(key, val)\n\t}\n\treq.Header.Set(\"User-Agent\", \"swift-http-import/\"+bininfo.VersionOr(\"dev\"))\n\treq.Header.Set(\"Accept\", \"application/octet-stream\")\n\tif s.Token != \"\" {\n\t\treq.Header.Set(\"Authorization\", fmt.Sprintf(\"token %s\", s.Token))\n\t}\n\n\t// We use http.DefaultClient explicitly instead of retrieving (s.client.Client()) the\n\t// same http.Client that was passed to github.Client because that http.Client, when\n\t// obtained using oauth2.NewClient(), does not return all headers in the request\n\t// response.\n\tresp, err := http.DefaultClient.Do(req)\n\tif err != nil {\n\t\treturn nil, FileState{}, fmt.Errorf(\"skipping %s: GET failed: %s\", req.URL.String(), err.Error())\n\t}\n\n\tif resp.StatusCode != http.StatusOK &&\n\t\tresp.StatusCode != http.StatusNotModified {\n\t\treturn nil, FileState{}, fmt.Errorf(\n\t\t\t\"skipping %s: GET returned unexpected status code: expected 200 or 304, but got %d\",\n\t\t\treq.URL.String(), resp.StatusCode,\n\t\t)\n\t}\n\n\treturn resp.Body, FileState{\n\t\tEtag: resp.Header.Get(\"Etag\"),\n\t\tLastModified: resp.Header.Get(\"Last-Modified\"),\n\t\tSizeBytes: resp.ContentLength,\n\t\tExpiryTime: nil, //no way to get this information via HTTP only\n\t\tSkipTransfer: resp.StatusCode == http.StatusNotModified,\n\t\tContentType: resp.Header.Get(\"Content-Type\"),\n\t}, nil\n}", "title": "" }, { "docid": "38a27f8c51339821fffca09903b3fb2a", "score": "0.5349978", "text": "func (s *Store) Open(path string) *File {\n\treturn s.open(cache.Lookup(path))\n}", "title": "" }, { "docid": "69cca6a27b6701f6d5c1ee197d309901", "score": "0.5348757", "text": "func (mfs *MountedFS) Get() (map[string]*MountpathInfo, map[string]*MountpathInfo) {\n\tavailable := (*map[string]*MountpathInfo)(atomic.LoadPointer(&mfs.available))\n\tdisabled := (*map[string]*MountpathInfo)(atomic.LoadPointer(&mfs.disabled))\n\tif available == nil {\n\t\ttmp := make(map[string]*MountpathInfo, 0)\n\t\tavailable = &tmp\n\t}\n\n\tif disabled == nil {\n\t\ttmp := make(map[string]*MountpathInfo, 0)\n\t\tdisabled = &tmp\n\t}\n\n\treturn *available, *disabled\n}", "title": "" }, { "docid": "6c4fe996724e4547d46815fd00528c36", "score": "0.5347792", "text": "func (app *grammarFile) Retrieve(relativePath string) (grammars.File, error) {\n path := filepath.Join(app.basePath, relativePath)\n data, err := ioutil.ReadFile(path)\n if err != nil {\n return nil, err\n }\n\n ins := new(grammarFileContent)\n err = json.Unmarshal(data, ins)\n if err != nil {\n return nil, err\n }\n\n tokensPath := filepath.Join(app.basePath, ins.Tokens)\n rulesPath := filepath.Join(app.basePath, ins.Rules)\n builder := app.fileBuilder.Create().WithRoot(ins.Root).WithTokensPath(tokensPath).WithRulesPath(rulesPath)\n if ins.Channels != \"\" {\n channelsPath := filepath.Join(app.basePath, ins.Channels)\n builder.WithChannelsPath(channelsPath)\n }\n\n return builder.Now()\n}", "title": "" }, { "docid": "388a783cc5f7e2ac09a8cc7787dd8ac6", "score": "0.5345487", "text": "func (s *Drive) GetFile(sha256sum []byte) ([]byte, error) {\n\treturn nil, errors.New(\"fail.Drive does what it says on the tin\")\n}", "title": "" }, { "docid": "133caa87e07cc07f7db47a2239192456", "score": "0.5332532", "text": "func (s *storager) Get(ctx context.Context, location string, options ...storage.Option) (os.FileInfo, error) {\n\tstarted := time.Now()\n\tdefer func() {\n\t\ts.logF(\"s3:Get %v %s\\n\", location, time.Since(started))\n\t}()\n\tlocation = strings.Trim(location, \"/\")\n\tinfo, err := s.get(ctx, location, options)\n\tif err == nil {\n\t\treturn info, err\n\t}\n\tif isNotFound(err) {\n\t\tobjectKind := &option.ObjectKind{}\n\t\tif _, ok := option.Assign(options, &objectKind); ok && objectKind.File {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\toptions = append(options, option.NewPage(0, 1))\n\tobjects, err := s.List(ctx, location, options...)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif len(objects) == 0 {\n\t\treturn nil, errors.Errorf(\"%v %v\", location, doesNotExistsMessage)\n\t}\n\treturn objects[0], err\n}", "title": "" }, { "docid": "f05581a8592e8bbd84575c7576b093db", "score": "0.5301203", "text": "func (s *Store) GetFile(name string) ([]byte, error) {\n\ts.configLock.RLock()\n\tdefer s.configLock.RUnlock()\n\treturn s.backingStore.GetFile(name)\n}", "title": "" }, { "docid": "0a31cc1f9dfc2620ea1e08644ceef4c2", "score": "0.5297273", "text": "func (k Keeper) GetFile(name string) []byte {\n\treturn k.fileCache.MustGetFile(name)\n}", "title": "" }, { "docid": "5452d1cda8163609e10e83b876e86ab8", "score": "0.5291536", "text": "func (info *Info) Get(path string, fileInfo os.FileInfo) (*MountPoint, error) {\n\tpath, err := filepath.Abs(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tpath, err = filepath.EvalSymlinks(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn info.GetReal(path, fileInfo), nil\n}", "title": "" }, { "docid": "49e324b8f1e7abcb76bea6d960db66db", "score": "0.528106", "text": "func getImage(path string) (*Image, error) {\n\tf, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to open file %s: %v\", path, err)\n\t}\n\n\tdefer f.Close()\n\tdec := gob.NewDecoder(f)\n\tvar img Image\n\terr = dec.Decode(&img)\n\treturn &img, err\n}", "title": "" }, { "docid": "bb9555da7267c52c0936025506bf7dc0", "score": "0.527882", "text": "func (c *Client) get(path string, v interface{}) (*http.Response, error) {\n\treturn c.doRequest(\"GET\", path, nil, v)\n}", "title": "" }, { "docid": "51538aceec7aee05d377cfc0e576f0ae", "score": "0.5269547", "text": "func (clnt *Clnt) Get(path string, offset uint64) ([]byte, *Qid, error) {\n\n\tobj, err := clnt.Open(path, OREAD)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\tqid := &obj.Fid.Qid //remember our qid\n\tdata, err := clnt.Read(obj.Fid, offset, obj.Fid.Iounit)\n\tif err != nil {\n\t\treturn nil, qid, err\n\t}\n\terr = clnt.Clunk(obj.Fid)\n\treturn data, qid, err\n}", "title": "" }, { "docid": "d7cbc01c59000d7ccb5a9bc7a86da1f1", "score": "0.52639383", "text": "func GetString(g Getter, path string) (body string) {\n\tv, rev := g.Get(path)\n\tif rev == Missing || rev == Dir {\n\t\treturn \"\"\n\t}\n\treturn v[0]\n}", "title": "" }, { "docid": "4d07380610d02705d5be123e51607373", "score": "0.5255766", "text": "func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) {\n\treturn c.getResponse(\"GET\", fmt.Sprintf(\"/repos/%s/%s/raw/%s/%s\", user, repo, ref, tree), nil, nil)\n}", "title": "" }, { "docid": "d4d635a67fb79706435652359fdb6c06", "score": "0.52554315", "text": "func (f *Folder) GetFile(name string) (*File, *http.Response, error) {\n\tn, resp, err := f.GetNode(name)\n\tif err != nil {\n\t\treturn nil, resp, err\n\t}\n\n\tres, ok := n.Typed().(*File)\n\tif !ok {\n\t\terr := errors.New(fmt.Sprintf(\"Node '%s' is not a file\", name))\n\t\treturn nil, resp, err\n\t}\n\n\treturn res, resp, nil\n}", "title": "" }, { "docid": "61bbc5c5d552ea7861993499cfd4d7d1", "score": "0.5254571", "text": "func (m Manifest) get(spec *unstructured.Unstructured) (*unstructured.Unstructured, error) {\n\tif spec.GetName() == \"\" && spec.GetGenerateName() != \"\" {\n\t\t// expected to be created; never fetched\n\t\treturn nil, nil\n\t}\n\tresult, err := m.Client.Get(spec)\n\tif err != nil {\n\t\tresult = nil\n\t\tif errors.IsNotFound(err) {\n\t\t\terr = nil\n\t\t}\n\t}\n\treturn result, err\n}", "title": "" }, { "docid": "675159cf862502ba6c2b377b923d4e85", "score": "0.5251876", "text": "func (self *Api) Get(key storage.Key, path string) (reader storage.LazySectionReader, mimeType string, status int, err error) {\n\tapiGetCount.Inc(1)\n\ttrie, err := loadManifest(self.dpa, key, nil)\n\tif err != nil {\n\t\tapiGetNotFound.Inc(1)\n\t\tstatus = http.StatusNotFound\n\t\tlog.Warn(fmt.Sprintf(\"loadManifestTrie error: %v\", err))\n\t\treturn\n\t}\n\n\tlog.Trace(fmt.Sprintf(\"getEntry(%s)\", path))\n\n\tentry, _ := trie.getEntry(path)\n\n\tif entry != nil {\n\t\tkey = common.Hex2Bytes(entry.Hash)\n\t\tstatus = entry.Status\n\t\tif status == http.StatusMultipleChoices {\n\t\t\tapiGetHttp300.Inc(1)\n\t\t\treturn\n\t\t} else {\n\t\t\tmimeType = entry.ContentType\n\t\t\tlog.Trace(fmt.Sprintf(\"content lookup key: '%v' (%v)\", key, mimeType))\n\t\t\treader = self.dpa.Retrieve(key)\n\t\t}\n\t} else {\n\t\tstatus = http.StatusNotFound\n\t\tapiGetNotFound.Inc(1)\n\t\terr = fmt.Errorf(\"manifest entry for '%s' not found\", path)\n\t\tlog.Warn(fmt.Sprintf(\"%v\", err))\n\t}\n\treturn\n}", "title": "" }, { "docid": "9952a75876eb5342511e854e84669ccb", "score": "0.52470046", "text": "func (s *etcdBackend) get(ctx context.Context, key string, out runtime.Object, ignoreNotFound bool) error {\n\tkey = path.Join(s.pathPrefix, key, api.NamespaceSystem)\n\tgetResp, err := s.client.KV.Get(ctx, key)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(getResp.Kvs) == 0 {\n\t\tif ignoreNotFound {\n\t\t\treturn runtime.SetZeroValue(out)\n\t\t}\n\t\treturn fmt.Errorf(\"key not found: %s\", key)\n\t}\n\tkv := getResp.Kvs[0]\n\treturn decode(s.decoder, kv.Value, out)\n}", "title": "" }, { "docid": "623f6499bb448575d3fcd75149b07963", "score": "0.5243982", "text": "func (t *Task) GetFile(fd int32) *vfs.FileDescription {\n\tf, _ := t.fdTable.Get(fd)\n\treturn f\n}", "title": "" }, { "docid": "28190b0789ec58e8ead8e9600ec83fdb", "score": "0.5243273", "text": "func (fh *TagFile) Get(tag *TagStruct) string {\n\treturn fh.tlf.Tag(tag.tn)\n}", "title": "" }, { "docid": "823a6061b5a8158fbe122d2722eef7b2", "score": "0.52408683", "text": "func (r *GroupPolicyDefinitionFileRequest) Get(ctx context.Context) (resObj *GroupPolicyDefinitionFile, err error) {\n\tvar query string\n\tif r.query != nil {\n\t\tquery = \"?\" + r.query.Encode()\n\t}\n\terr = r.JSONRequest(ctx, \"GET\", query, nil, &resObj)\n\treturn\n}", "title": "" } ]
60b9a7470eda76a907a526895b9fcfba
Complete completes component options
[ { "docid": "14817cc15042ef05b54792b84d221532", "score": "0.7505821", "text": "func (co *ComponentOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tco.Context = genericclioptions.NewContext(cmd)\n\n\t// If no arguments have been passed, get the current component\n\t// else, use the first argument and check to see if it exists\n\tif len(args) == 0 {\n\t\tco.componentName = co.Context.Component()\n\t} else {\n\t\tco.componentName = co.Context.Component(args[0])\n\t}\n\treturn\n}", "title": "" } ]
[ { "docid": "20e9c99eed3f464dc3b9c02253ba1c80", "score": "0.7254277", "text": "func (r *renderOpts) Complete() error {\n\tif err := r.manifest.Complete(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.generic.Complete(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20e9c99eed3f464dc3b9c02253ba1c80", "score": "0.7254277", "text": "func (r *renderOpts) Complete() error {\n\tif err := r.manifest.Complete(); err != nil {\n\t\treturn err\n\t}\n\tif err := r.generic.Complete(); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ead0fdfea344b0aa01a7db2c23ea168d", "score": "0.7176443", "text": "func (co *ConvertOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tco.context, err = genericclioptions.NewContext(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tco.componentName = co.context.LocalConfigInfo.GetName()\n\treturn nil\n\n}", "title": "" }, { "docid": "69c1bcbc8a356d8a68170f939ae1b42d", "score": "0.7153292", "text": "func (o *ViewOptions) Complete(ctx context.Context, cmdline cmdline.Cmdline, args []string) (err error) {\n\treturn\n}", "title": "" }, { "docid": "c29b61ec668dac697e87f373ffb5c880", "score": "0.6959937", "text": "func (o *UpdateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.operation = \"update\"\n\to.registryName = args[0]\n\to.registryURL = args[1]\n\to.user = \"default\"\n\treturn\n}", "title": "" }, { "docid": "49baa4173271512b7b518ac5fd27ddb1", "score": "0.6892183", "text": "func (o *options) Complete() error {\n\to.dryRun, _ = o.fs.GetBool(\"dry-run\")\n\n\to.testrunnerConfig.Timeout = time.Duration(o.timeout) * time.Second\n\to.collectConfig.ComponentDescriptorPath = o.shootParameters.ComponentDescriptorPath\n\n\to.shootParameters.OCIOpts = o.ociOpts\n\to.collectConfig.OCIOpts = o.ociOpts\n\n\tif len(o.shootParameters.FlavorConfigPath) != 0 {\n\t\tgardenK8sClient, err := kutil.NewClientFromFile(o.shootParameters.GardenKubeconfigPath, client.Options{\n\t\t\tScheme: gardener.GardenScheme,\n\t\t})\n\t\tif err != nil {\n\t\t\tlogger.Log.Error(err, \"unable to build garden kubernetes client\", \"file\", o.tmKubeconfigPath)\n\t\t\tos.Exit(1)\n\t\t}\n\t\tflavors, err := GetShootFlavors(o.shootParameters.FlavorConfigPath, gardenK8sClient, o.shootPrefix, o.filterPatchVersions)\n\t\tif err != nil {\n\t\t\tlogger.Log.Error(err, \"unable to parse shoot flavors from test configuration\")\n\t\t\tos.Exit(1)\n\t\t}\n\t\to.shootFlavors = flavors.GetShoots()\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f265c012fcc8e44232c3f62c36c910eb", "score": "0.6872646", "text": "func (o *ServiceListOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tif experimental.IsExperimentalModeEnabled() {\n\t\to.Context = genericclioptions.NewDevfileContext(cmd)\n\t} else {\n\t\to.Context = genericclioptions.NewContext(cmd)\n\t}\n\treturn\n}", "title": "" }, { "docid": "39bb246f791f31fd416cfe7bda7bb597", "score": "0.6844231", "text": "func (o *PSAOptions) Complete() error {\n\tconfig := o.configFlags.ToRawKubeConfigLoader()\n\trestConfig, err := config.ClientConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create rest config: %w\", err)\n\t}\n\n\tnamespace, _, err := config.Namespace()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get namespace: %w\", err)\n\t}\n\to.namespace = namespace\n\n\t// Setup a client with a custom WarningHandler that collects the warnings.\n\to.warnings = &warningsHandler{}\n\trestConfig.WarningHandler = o.warnings\n\to.client, err = kubernetes.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create client: %w\", err)\n\t}\n\n\tif o.printFlags.OutputFormat != nil && len(*o.printFlags.OutputFormat) > 0 {\n\t\tprinter, err := o.printFlags.ToPrinter()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.printObj = printer.PrintObj\n\n\t\treturn nil\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "bd01e86321511d37c61a68438de5d525", "score": "0.68394804", "text": "func (o *SetOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.paramName = args[0]\n\to.paramValue = args[1]\n\treturn\n}", "title": "" }, { "docid": "e3ec70c46529ab307754a9a932598b25", "score": "0.68328196", "text": "func (to *TestOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tto.devfilePath = filepath.Join(to.componentContext, DevfilePath)\n\tto.Context = genericclioptions.NewDevfileContext(cmd)\n\n\treturn\n}", "title": "" }, { "docid": "f65a28b2c0e6d2315f0f178685346c2d", "score": "0.6820573", "text": "func (o *ApplyOptions) Complete(cmd *cobra.Command, args []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "02c5101bf8f6bd0c072a7c75ad97a808", "score": "0.67706436", "text": "func (o *UnsetOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.paramName = args[0]\n\treturn\n}", "title": "" }, { "docid": "84c8af7749cf70f66156279e6181aefb", "score": "0.6766091", "text": "func (o *ProvisioningReportOptions) Complete(cmd *cobra.Command, args []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "300c0b2dc4c17b0b037df21fd8c0f74a", "score": "0.6757385", "text": "func (o *ServiceOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tname, err := NameFromCommandArgs(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Name = name\n\n\tclientConfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Client, err = corev1client.NewForConfig(clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\n\tprinter, err := o.PrintFlags.ToPrinter()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.PrintObj = func(obj runtime.Object) error {\n\t\treturn printer.PrintObj(obj, o.Out)\n\t}\n\n\to.ValidationDirective, err = cmdutil.GetValidationDirective(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6c574492dbf09d8e89ce68c2270a8d19", "score": "0.6705314", "text": "func (o *ListOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.Context = genericclioptions.NewContext(cmd)\n\treturn\n}", "title": "" }, { "docid": "232f9f01fdeb2ee2ba5ce731b2552ed2", "score": "0.66392106", "text": "func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tvar err error\n\tif o.ClientOnly {\n\t\treturn nil\n\t}\n\to.discoveryClient, err = f.ToDiscoveryClient()\n\t// if we had an empty rest.Config, continue and just print out client information.\n\t// if we had an error other than being unable to build a rest.Config, fail.\n\tif err != nil && !clientcmd.IsEmptyConfig(err) {\n\t\treturn err\n\t}\n\n\to.args = args\n\treturn nil\n}", "title": "" }, { "docid": "ddf5e96c7b543393bb18e67bb46a4325", "score": "0.6589506", "text": "func (o *CreateOptions) Complete() (err error) {\n\tconfig, err := o.Config()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn o.complete(config)\n}", "title": "" }, { "docid": "3eeb90ab1bd7f4ad680606f8ee83e413", "score": "0.6539187", "text": "func (o *UnsetOptions) Complete(ctx context.Context, cmdline cmdline.Cmdline, args []string) (err error) {\n\to.paramName = strings.ToLower(args[0])\n\treturn\n}", "title": "" }, { "docid": "8dd57100693b872af4fc96060773d60c", "score": "0.65296686", "text": "func (o *SetOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tcheckRouteAvailability := false\n\tif o.now {\n\t\tcheckRouteAvailability = true\n\t}\n\to.Context, err = genericclioptions.New(genericclioptions.CreateParameters{\n\t\tCmd: cmd,\n\t\tDevfilePath: \"\",\n\t\tComponentContext: o.GetComponentContext(),\n\t\tIsNow: o.now,\n\t\tCheckRouteAvailability: checkRouteAvailability,\n\t})\n\tif err != nil {\n\t\tif err1 := util.IsInvalidKubeConfigError(err); err1 != nil {\n\t\t\treturn err1\n\t\t}\n\t\treturn err\n\t}\n\to.DevfilePath = o.Context.EnvSpecificInfo.GetDevfilePath()\n\to.EnvSpecificInfo = o.Context.EnvSpecificInfo\n\n\tif o.envArray == nil {\n\t\to.paramName = args[0]\n\t\to.paramValue = args[1]\n\t}\n\n\tif o.now {\n\t\tprjName := o.Context.LocalConfigProvider.GetNamespace()\n\t\to.ResolveSrcAndConfigFlags()\n\t\terr = o.ResolveProject(prjName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "24f22ee3a317229f85bb90492298a3f2", "score": "0.65133834", "text": "func (o *Options) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tvar err error\n\to.NebulaClusterName, o.Namespace, err = f.GetNebulaClusterNameAndNamespace(true, args)\n\tif err != nil && !cmdutil.IsErNotSpecified(err) {\n\t\treturn err\n\t}\n\n\tvar imagePullPolicy string\n\timagePullPolicy, err = cmd.Flags().GetString(\"image-pull-policy\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.ImagePullPolicy = corev1.PullPolicy(imagePullPolicy)\n\n\to.runtimeCli, err = f.ToRuntimeClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.restClientGetter = f\n\n\treturn nil\n}", "title": "" }, { "docid": "1f310d55d88049d067e7f7b1cb16fb07", "score": "0.64679545", "text": "func (o *URLDeleteOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.Context = genericclioptions.NewContext(cmd)\n\to.urlName = args[0]\n\treturn\n\n}", "title": "" }, { "docid": "72db5adaf562aaa5d206aee2f2bc1143", "score": "0.6444257", "text": "func (o *addResourceOptions) Complete(cmd *cobra.Command, args []string) error {\n\treturn nil\n}", "title": "" }, { "docid": "3c2f3fd90225629ab086b2c2794df7f9", "score": "0.64161515", "text": "func (o *DeleteObjectsOptions) Complete(cmd *cobra.Command, args []string) error {\n\to.fileName = args[0]\n\treturn nil\n}", "title": "" }, { "docid": "8ce05b14b310d89266e1eeb37ebeb574", "score": "0.64057136", "text": "func (o *DeployOptions) Complete(ctx context.Context, cmdline cmdline.Cmdline, args []string) (err error) {\n\tscontext.SetPlatform(ctx, o.clientset.KubernetesClient)\n\treturn nil\n}", "title": "" }, { "docid": "7fe6c8d54769aeb81afc1f909177ac79", "score": "0.6391038", "text": "func (o *SetOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.cfg, err = envinfo.NewEnvSpecificInfo(o.context)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to load environment file\")\n\t}\n\n\to.paramName = args[0]\n\to.paramValue = args[1]\n\n\treturn nil\n}", "title": "" }, { "docid": "1f657e1a49f38f3c30f2cb0a0f595db4", "score": "0.6379903", "text": "func (phase *phaseCoreAuto) PossibilitiesComplete() {\n\tphase.possibilitiesComplete = true\n}", "title": "" }, { "docid": "0c27141ec35912107bc4a9c2a1955b11", "score": "0.63741946", "text": "func (o *ViewOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.cfg, err = envinfo.NewEnvSpecificInfo(o.context)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"failed to load environment file\")\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "aee3568bfd5ef07215d2de3a81dada03", "score": "0.63654655", "text": "func (o *ConsoleCmdOptions) Complete(args []string) error {\n\to.args = args\n\n\treturn nil\n}", "title": "" }, { "docid": "05b0dfe091e8cb2e37d5765c71ba022d", "score": "0.6361592", "text": "func (pco *ProjectCreateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tpco.projectName = args[0]\n\tpco.Context = genericclioptions.NewContext(cmd)\n\treturn\n}", "title": "" }, { "docid": "1cb8e852604b10fae1ecd95a47fa9603", "score": "0.6357454", "text": "func (o *Options) Complete(cmd *cobra.Command, args []string) error {\n\tif len(args) > 0 {\n\t\to.crdName = args[0]\n\t}\n\n\treturn o.Init(cmd)\n}", "title": "" }, { "docid": "725624e03f888bda2f6ace54a69d08de", "score": "0.6319174", "text": "func (o *Options) Complete() error {\n\tif len(o.ConfigFile) > 0 {\n\t\tcfgData, err := ioutil.ReadFile(o.ConfigFile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read hook configuration file %q, %v\", o.ConfigFile, err)\n\t\t}\n\n\t\t// decode hook configuration\n\t\tversioned := &v1alpha1.HookConfiguration{}\n\t\tv1alpha1.SetObjectDefaults_HookConfiguration(versioned)\n\t\tdecoder := scheme.Codecs.UniversalDecoder(v1alpha1.SchemeGroupVersion)\n\t\tif err := runtime.DecodeInto(decoder, cfgData, versioned); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to decode hook configuration file %q, %v\", o.ConfigFile, err)\n\t\t}\n\n\t\t// convert versioned hook configuration to internal version\n\t\tif err := scheme.Scheme.Convert(versioned, o.config, nil); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to convert versioned hook configurtion to internal version, %v\", err)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0005b904cfa30086121f245ad90f694a", "score": "0.62438834", "text": "func (o *GetContextsOptions) Complete(cmd *cobra.Command, args []string) error {\n\tsupportedOutputTypes := sets.NewString(\"\", \"name\")\n\tif !supportedOutputTypes.Has(o.outputFormat) {\n\t\treturn fmt.Errorf(\"--output %v is not available in kubectl config get-contexts; resetting to default output format\", o.outputFormat)\n\t}\n\to.contextNames = args\n\to.nameOnly = false\n\tif o.outputFormat == \"name\" {\n\t\to.nameOnly = true\n\t}\n\to.showHeaders = true\n\tif cmdutil.GetFlagBool(cmd, \"no-headers\") || o.nameOnly {\n\t\to.showHeaders = false\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d1c478a31a72a4c2b1deac7bc2541d40", "score": "0.6237083", "text": "func (h *DeletePodCmdHandle) Complete(argsIn []string, settings *config.Config) {\n\tif h.options.environment == \"\" {\n\t\th.options.environment = settings.GetStringQ(config.KubeEnvironmentName)\n\t}\n\th.argsIn = argsIn\n}", "title": "" }, { "docid": "81715e3b235076b60327f98e057f4fe8", "score": "0.6227727", "text": "func (o *ServiceCreateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.serviceType = args[0]\n\t// if only one arg is given, then it is considered as service name and service type both\n\to.serviceName = o.serviceType\n\t// if two args are given, first is service type and second one is service name\n\tif len(args) == 2 {\n\t\to.serviceName = args[1]\n\t}\n\to.Context = genericclioptions.NewContextCreatingAppIfNeeded(cmd)\n\treturn err\n}", "title": "" }, { "docid": "4358a62c0f12fe96fc039e19cb793209", "score": "0.6209102", "text": "func (o *CommandRegisterOption) Complete(args []string) error {\n\t// Get karmada apiserver endpoint from the command args.\n\to.BootstrapToken.APIServerEndpoint = args[0]\n\n\trestConfig, err := apiclient.RestConfig(o.Context, o.KubeConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(o.ClusterName) == 0 {\n\t\to.KubeConfig = apiclient.KubeConfigPath(o.KubeConfig)\n\n\t\tconfigBytes, err := os.ReadFile(o.KubeConfig)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read kubeconfig file %s, err: %w\", o.KubeConfig, err)\n\t\t}\n\n\t\tconfig, err := clientcmd.Load(configBytes)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\to.ClusterName = config.Contexts[config.CurrentContext].Cluster\n\t}\n\n\to.memberClusterEndpoint = restConfig.Host\n\n\to.memberClusterClient, err = apiclient.NewClientSet(restConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cdc746f895fd9965a8fe60de4098fd0f", "score": "0.6192503", "text": "func (o *LinkOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\terr = o.complete(name, cmd, args)\n\tif !experimental.IsExperimentalModeEnabled() {\n\t\to.operation = o.Client.LinkSecret\n\t}\n\treturn err\n}", "title": "" }, { "docid": "921af5c2f9a646fc134df066f6231e65", "score": "0.6164118", "text": "func (o *LoginOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\tif len(args) == 1 {\n\t\to.server = args[0]\n\t}\n\treturn\n}", "title": "" }, { "docid": "3f81961646510d7c5e6547bc480e683b", "score": "0.61524796", "text": "func (o *LogsOptions) Complete(cmd *cobra.Command, args []string) error {\n\tclient, err := kubernetes.NewClient(o.configFlags)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to new Kubernetes client: %w\", err)\n\t}\n\n\tif !o.preview {\n\t\to.preview, _ = strconv.ParseBool(os.Getenv(previewEnabledEnvVar))\n\t}\n\n\to.podClient = client.CoreV1()\n\to.builder = resource.NewBuilder(o.configFlags)\n\n\tif !o.allNamespaces {\n\t\tkubeConfig := o.configFlags.ToRawKubeConfigLoader()\n\n\t\tnamespace, _, err := kubeConfig.Namespace()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"faild to get namespace from kube config: %w\", err)\n\t\t}\n\n\t\to.namespace = namespace\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a3df1d1cb819254b0e6302a5e0d2b0e5", "score": "0.61019653", "text": "func (o *CreateJobOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tname, err := NameFromCommandArgs(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Name = name\n\tif len(args) > 1 {\n\t\to.Command = args[1:]\n\t}\n\n\tclientConfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Client, err = batchv1client.NewForConfig(clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.CreateAnnotation = cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag)\n\n\to.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Builder = f.NewBuilder()\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\tprinter, err := o.PrintFlags.ToPrinter()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.PrintObj = func(obj runtime.Object) error {\n\t\treturn printer.PrintObj(obj, o.Out)\n\t}\n\n\to.ValidationDirective, err = cmdutil.GetValidationDirective(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ba00cdc660889a33cb1d1e406518e750", "score": "0.6069508", "text": "func (o *AggregationOptions) Complete() error {\n\tc, err := config.ParseConfig(o.configFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\t//base64decode\n\tif c.BcsStorageToken != \"\" {\n\t\ttokenBytes, err := base64.StdEncoding.DecodeString(c.BcsStorageToken)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tc.BcsStorageToken = string(tokenBytes)\n\t}\n\n\to.config = c\n\treturn nil\n}", "title": "" }, { "docid": "aa758e03b5bf0d085855a304e998aa21", "score": "0.604724", "text": "func (o *DoctorOptions) Complete(cmd *cobra.Command, args []string, argsLenAtDash int) error {\n\n\to.Args = args\n\tif len(args) == 0 {\n\t\tlog.Info(\"Going for a full scan as no flags are set!\")\n\t\to.FullScan = true\n\t}\n\to.KubeCli = clientset\n\n\tvar err error\n\n\tconfigLoader := o.Flags.ToRawKubeConfigLoader()\n\n\tmatchVersionKubeConfigFlags := cmdutil.NewMatchVersionFlags(o.Flags)\n\tf := cmdutil.NewFactory(matchVersionKubeConfigFlags)\n\n\to.RESTClient, err = f.RESTClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tlog.Info(\"Retrieving necessary clientset for targeted k8s cluster.\")\n\to.CoreClient = clientset.CoreV1()\n\n\tfetchedNamespaces, _ := o.CoreClient.Namespaces().List(v1.ListOptions{})\n\tfor _, i := range fetchedNamespaces.Items {\n\t\to.FetchedNamespaces = append(o.FetchedNamespaces, i.GetName())\n\t}\n\tlog.Info(\"\")\n\tlog.Info(\"Fetched namespaces: \", o.FetchedNamespaces)\n\tlog.Info(\"\")\n\n\to.Config, err = configLoader.ClientConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d30996bd217dd97e2654a6d4b074329e", "score": "0.6038546", "text": "func (o *StorageDeleteOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\to.Context = genericclioptions.NewContext(cmd)\n\to.storageName = args[0]\n\treturn\n}", "title": "" }, { "docid": "af81f146000cdb744f0971ac2318f188", "score": "0.6031467", "text": "func Complete(s *options.ServerRunOptions) error {\n\n\t// loading configuration file\n\tconf := apiserverconfig.Get()\n\n\tconf.Apply(&apiserverconfig.Config{\n\t\tMySQLOptions: s.MySQLOptions,\n\t\tDevopsOptions: s.DevopsOptions,\n\t\tSonarQubeOptions: s.SonarQubeOptions,\n\t\tKubernetesOptions: s.KubernetesOptions,\n\t\tServiceMeshOptions: s.ServiceMeshOptions,\n\t\tMonitoringOptions: s.MonitoringOptions,\n\t\tS3Options: s.S3Options,\n\t\tOpenPitrixOptions: s.OpenPitrixOptions,\n\t\tLoggingOptions: s.LoggingOptions,\n\t})\n\n\t*s = options.ServerRunOptions{\n\t\tGenericServerRunOptions: s.GenericServerRunOptions,\n\t\tKubernetesOptions: conf.KubernetesOptions,\n\t\tDevopsOptions: conf.DevopsOptions,\n\t\tSonarQubeOptions: conf.SonarQubeOptions,\n\t\tServiceMeshOptions: conf.ServiceMeshOptions,\n\t\tMySQLOptions: conf.MySQLOptions,\n\t\tMonitoringOptions: conf.MonitoringOptions,\n\t\tS3Options: conf.S3Options,\n\t\tOpenPitrixOptions: conf.OpenPitrixOptions,\n\t\tLoggingOptions: conf.LoggingOptions,\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "3eeaccbbbc82bd8ae37161d8fdf01dc4", "score": "0.59967583", "text": "func (o *GenerateOptions) Complete(cmd *cobra.Command, args []string) error {\n\tif len(args) != 1 {\n\t\treturn errors.New(\"Resource to generate required\")\n\t}\n\tresourceName := strings.ToLower(args[0])\n\to.ResourceName = resourceName\n\n\tupstream, err := getUpstreamSchema(o)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.UpstreamSchema = upstream\n\n\tlocal, err := getLocalSchema()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.LocalSchema = local\n\n\treturn nil\n}", "title": "" }, { "docid": "7a16d9c43d60d109cfe80762c9b85da8", "score": "0.5985406", "text": "func (o *podsOptions) complete(cmd *cobra.Command, args []string) error {\n\to.args = args\n\tvar err error\n\n\tclientConfig := o.configFlags.ToRawKubeConfigLoader()\n\t// Create the Client for Read/Write operations.\n\to.client, err = common.NewClient(clientConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to instantiate client, err: %w\", err)\n\t}\n\n\to.userNamespace, _, err = clientConfig.Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tns, err2 := cmd.Flags().GetString(\"namespace\")\n\tif err2 != nil {\n\t\treturn err\n\t}\n\tif ns != \"\" {\n\t\to.userNamespace = ns\n\t}\n\n\tif len(args) > 0 {\n\t\to.userExtendedDaemonSetName = args[0]\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "a3037da68ff2d7e233569ed102c5aff7", "score": "0.59840196", "text": "func (in *Config) Complete() {\n\tin.Web.Complete()\n\tin.Executor.Complete()\n\tin.Log.Complete()\n}", "title": "" }, { "docid": "463ea34db9442325dd369ac76d804766", "score": "0.59525204", "text": "func (self *TraitEntryCompletion) Complete() {\n\tC.gtk_entry_completion_complete(self.CPointer)\n\treturn\n}", "title": "" }, { "docid": "eb97cb4144469bb93b11e45e2d52a6d0", "score": "0.59221494", "text": "func (blder *Builder) Complete(c tkAdmission.Controller) error {\n\tblder.c = c\n\treturn blder.registerWebhooks()\n}", "title": "" }, { "docid": "f510a2df55e8f29c618f32f1b81ec169", "score": "0.59117174", "text": "func (c *Config) Complete() {\n\tif !c.LoadBalancer.Disabled && c.LoadBalancer.SecurityListManagementMode == \"\" {\n\t\tc.LoadBalancer.SecurityListManagementMode = ManagementModeAll // default\n\t\tif c.LoadBalancer.DisableSecurityListManagement {\n\t\t\tglog.Warningf(\"cloud-provider config: \\\"loadBalancer.disableSecurityListManagement\\\" is DEPRECIATED and will be removed in a later release. Please set \\\"loadBalancer.SecurityListManagementMode: %s\\\".\", ManagementModeNone)\n\t\t\tc.LoadBalancer.SecurityListManagementMode = ManagementModeNone\n\t\t}\n\t}\n\tif c.CompartmentID == \"\" && c.Auth.CompartmentID != \"\" {\n\t\tglog.Warning(\"cloud-provider config: \\\"auth.compartment\\\" is DEPRECIATED and will be removed in a later release. Please set \\\"compartment\\\".\")\n\t\tc.CompartmentID = c.Auth.CompartmentID\n\t}\n\tif c.Auth.Passphrase == \"\" && c.Auth.PrivateKeyPassphrase != \"\" {\n\t\tglog.Warning(\"cloud-provider config: \\\"auth.key_passphrase\\\" is DEPRECIATED and will be removed in a later release. Please set \\\"auth.passphrase\\\".\")\n\t\tc.Auth.Passphrase = c.Auth.PrivateKeyPassphrase\n\t}\n}", "title": "" }, { "docid": "cb7a388dca96ba16a43d3572a1e56be1", "score": "0.5850963", "text": "func (co *CreateOptions) Complete(name string, cmd *cobra.Command, args []string) (err error) {\n\n\tif co.now {\n\t\t// this populates the EnvInfo as well\n\t\tco.Context, err = genericclioptions.NewContextCreatingAppIfNeeded(cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\tco.Context, err = genericclioptions.NewOfflineContext(cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tDevfilePath := location.DevfileLocation(\"\")\n\t// Configure the context\n\tif co.componentContext != \"\" {\n\t\tDevfilePath = location.DevfileLocation(co.componentContext)\n\t\tEnvFilePath = filepath.Join(co.componentContext, envFile)\n\t\tco.PushOptions.componentContext = co.componentContext\n\t}\n\tco.DevfilePath = DevfilePath\n\n\tif util.CheckPathExists(EnvFilePath) && util.CheckPathExists(co.DevfilePath) {\n\t\treturn errors.New(\"this directory already contains a component\")\n\t}\n\n\tif util.CheckPathExists(EnvFilePath) && !util.CheckPathExists(co.DevfilePath) {\n\t\tlog.Warningf(\"Found a dangling env file without a devfile, overwriting it\")\n\t\tif err := util.DeletePath(EnvFilePath); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif util.CheckPathExists(co.DevfilePath) && co.devfileMetadata.devfilePath.value != \"\" && !util.PathEqual(co.DevfilePath, co.devfileMetadata.devfilePath.value) {\n\t\treturn errors.New(\"this directory already contains a devfile, you can't specify devfile via --devfile\")\n\t}\n\n\t// we check if the devfile is already present or not, this location is important - check should happen early\n\tif util.CheckPathExists(co.DevfilePath) {\n\t\tco.devfileMetadata.userCreatedDevfile = true\n\t}\n\n\tco.appName = genericclioptions.ResolveAppFlag(cmd)\n\n\tisDevfileRegistryPresent := true // defaulted to true since odo ships with a default registry set\n\tvar catalogDevfileList catalog.DevfileComponentTypeList\n\n\t// Validate user specify devfile path\n\tif co.devfileMetadata.devfilePath.value != \"\" {\n\t\tfileErr := util.ValidateFile(co.devfileMetadata.devfilePath.value)\n\t\turlErr := util.ValidateURL(co.devfileMetadata.devfilePath.value)\n\t\tif fileErr != nil && urlErr != nil {\n\t\t\treturn errors.Errorf(\"the devfile path you specify is invalid with either file error \\\"%v\\\" or url error \\\"%v\\\"\", fileErr, urlErr)\n\t\t} else if fileErr == nil {\n\t\t\tco.devfileMetadata.devfilePath.protocol = \"file\"\n\t\t} else if urlErr == nil {\n\t\t\tco.devfileMetadata.devfilePath.protocol = \"http(s)\"\n\t\t}\n\t}\n\n\t// Validate user specify registry\n\tif co.devfileMetadata.devfileRegistry.Name != \"\" {\n\n\t\tif co.devfileMetadata.devfilePath.value != \"\" {\n\t\t\treturn errors.New(\"you can't specify registry via --registry if you want to use the devfile that is specified via --devfile\")\n\t\t}\n\n\t\tregistryList, err := catalog.GetDevfileRegistries(co.devfileMetadata.devfileRegistry.Name)\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"failed to get registry\")\n\t\t}\n\t\tif len(registryList) == 0 {\n\t\t\treturn errors.Errorf(\"registry %s doesn't exist, please specify a valid registry via --registry\", co.devfileMetadata.devfileRegistry.Name)\n\t\t}\n\t}\n\n\t// Can't use the existing devfile or download devfile from registry, go to interactive mode\n\tif len(args) == 0 && !util.CheckPathExists(co.DevfilePath) && co.devfileMetadata.devfilePath.value == \"\" {\n\t\tco.interactive = true\n\t}\n\n\tvar componentType string\n\tvar componentName string\n\tvar componentNamespace string\n\n\tif co.interactive {\n\t\t// Interactive mode\n\n\t\t// Get available devfile components for checking devfile compatibility\n\t\tcatalogDevfileList, err = catalog.ListDevfileComponents(co.devfileMetadata.devfileRegistry.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(catalogDevfileList.DevfileRegistries) == 0 {\n\t\t\tisDevfileRegistryPresent = false\n\t\t\tlog.Warning(\"Registry is empty, please run `odo registry add <registry name> <registry URL>` to add a registry\\n\")\n\t\t}\n\n\t\tif isDevfileRegistryPresent {\n\t\t\t// Component type: We provide devfile component list to let user choose\n\t\t\tcomponentType = ui.SelectDevfileComponentType(catalogDevfileList.Items)\n\n\t\t\t// Component name: User needs to specify the component name, by default it is component type that user chooses\n\t\t\tcomponentName = ui.EnterDevfileComponentName(componentType)\n\n\t\t\t// Component namespace: User needs to specify component namespace, by default it is the current active namespace\n\t\t\tif cmd.Flags().Changed(\"project\") {\n\t\t\t\tcomponentNamespace, err = cmd.Flags().GetString(\"project\")\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tclient, err := genericclioptions.Client()\n\t\t\t\t// if the user is logged in or if we have cluster information, display the default project\n\t\t\t\tif err == nil {\n\t\t\t\t\tcomponentNamespace = ui.EnterDevfileComponentProject(client.GetCurrentProjectName())\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t} else {\n\t\t// Direct mode (User enters the full command)\n\n\t\tif util.CheckPathExists(co.DevfilePath) || co.devfileMetadata.devfilePath.value != \"\" {\n\t\t\t// Use existing devfile directly\n\n\t\t\tif len(args) > 1 {\n\t\t\t\treturn errors.Errorf(\"accepts between 0 and 1 arg when using existing devfile, received %d\", len(args))\n\t\t\t}\n\n\t\t\t// If user can use existing devfile directly, the first arg is component name instead of component type\n\t\t\tif len(args) == 1 {\n\t\t\t\tcomponentName = args[0]\n\t\t\t} else {\n\t\t\t\t// If there is an existing devfile, and no component name is passed, parse it from the devfile,\n\t\t\t\t// and assign the value if the metadata name is set\n\t\t\t\tdevfileObj, err := devfile.ParseFromFile(DevfilePath)\n\t\t\t\tif err == nil && devfileObj.GetMetadataName() != \"\" {\n\t\t\t\t\tcomponentName = devfileObj.GetMetadataName()\n\t\t\t\t} else {\n\t\t\t\t\t// If the metadata name is not available, then assign the current directory name to component\n\t\t\t\t\tcurrentDirPath, err := os.Getwd()\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\tcurrentDirName := filepath.Base(currentDirPath)\n\t\t\t\t\tcomponentName = currentDirName\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tco.devfileMetadata.devfileSupport = true\n\t\t} else if len(args) > 0 {\n\t\t\t// Download devfile from registry\n\n\t\t\t// Component type: Get from full command's first argument (mandatory in direct mode)\n\t\t\tcomponentType = args[0]\n\n\t\t\t// Component name: Get from full command's second argument (optional in direct mode), by default it is a generated name if second arg is not provided\n\t\t\tif len(args) == 2 {\n\t\t\t\tcomponentName = args[1]\n\t\t\t} else {\n\t\t\t\tvar err error\n\t\t\t\tcomponentName, err = createDefaultComponentName(\n\t\t\t\t\tcomponentType,\n\t\t\t\t\tco.componentContext,\n\t\t\t\t)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Get available devfile components for checking devfile compatibility\n\t\t\tcatalogDevfileList, err = catalog.ListDevfileComponents(co.devfileMetadata.devfileRegistry.Name)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif co.devfileMetadata.devfileRegistry.Name != \"\" && catalogDevfileList.Items == nil {\n\t\t\t\treturn errors.Errorf(\"can't create devfile component from registry %s\", co.devfileMetadata.devfileRegistry.Name)\n\t\t\t}\n\n\t\t\tif len(catalogDevfileList.DevfileRegistries) == 0 {\n\t\t\t\tisDevfileRegistryPresent = false\n\t\t\t\tlog.Warning(\"Registry list is empty, please run `odo registry add <registry name> <registry URL>` to add a registry\\n\")\n\t\t\t}\n\t\t}\n\n\t\tcomponentNamespace = co.Context.Project\n\t}\n\n\t// set devfileName to same value as componentType for telemetry\n\tco.devfileName = componentType\n\tscontext.SetDevfileName(cmd.Context(), co.devfileName)\n\n\t// Set devfileMetadata struct\n\tco.devfileMetadata.componentType = componentType\n\tco.devfileMetadata.componentName = strings.ToLower(componentName)\n\tco.devfileMetadata.componentNamespace = strings.ToLower(componentNamespace)\n\n\tif util.CheckPathExists(co.DevfilePath) || co.devfileMetadata.devfilePath.value != \"\" {\n\t\t// Categorize the sections\n\t\tlog.Info(\"Devfile Object Validation\")\n\n\t\tvar devfileAbsolutePath string\n\t\tif util.CheckPathExists(co.DevfilePath) || co.devfileMetadata.devfilePath.protocol == \"file\" {\n\t\t\tvar devfilePath string\n\t\t\tif util.CheckPathExists(co.DevfilePath) {\n\t\t\t\tdevfilePath = co.DevfilePath\n\t\t\t} else {\n\t\t\t\tdevfilePath = co.devfileMetadata.devfilePath.value\n\t\t\t}\n\t\t\tdevfileAbsolutePath, err = filepath.Abs(devfilePath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t} else if co.devfileMetadata.devfilePath.protocol == \"http(s)\" {\n\t\t\tdevfileAbsolutePath = co.devfileMetadata.devfilePath.value\n\t\t}\n\t\tdevfileSpinner := log.Spinnerf(\"Creating a devfile component from devfile path: %s\", devfileAbsolutePath)\n\t\tdefer devfileSpinner.End(true)\n\n\t\t// Initialize envinfo\n\t\terr = co.InitEnvInfoFromContext()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t}\n\n\tif isDevfileRegistryPresent {\n\t\t// Categorize the sections\n\n\t\t// Since we need to support both devfile and s2i, so we have to check if the component type is\n\t\t// supported by devfile, if it is supported we return and will download the corresponding devfile later,\n\t\t// if it is not supported we still need to run all the codes related with s2i after devfile compatibility check\n\n\t\thasComponent := false\n\t\tvar devfileExistSpinner *log.Status\n\t\tlog.Info(\"Devfile Object Validation\")\n\t\tdevfileExistSpinner = log.Spinner(\"Checking devfile existence\")\n\t\tdefer devfileExistSpinner.End(false)\n\n\t\tfor _, devfileComponent := range catalogDevfileList.Items {\n\t\t\tif co.devfileMetadata.componentType == devfileComponent.Name {\n\t\t\t\thasComponent = true\n\t\t\t\tco.devfileMetadata.devfileSupport = true\n\t\t\t\tco.devfileMetadata.devfileLink = devfileComponent.Link\n\t\t\t\tco.devfileMetadata.devfileRegistry = devfileComponent.Registry\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\n\t\tif hasComponent {\n\t\t\tdevfileExistSpinner.End(true)\n\t\t} else {\n\t\t\tdevfileExistSpinner.End(false)\n\t\t}\n\n\t\tif co.devfileMetadata.devfileSupport {\n\t\t\tregistrySpinner := log.Spinnerf(\"Creating a devfile component from registry: %s\", co.devfileMetadata.devfileRegistry.Name)\n\t\t\tif registryUtil.IsGitBasedRegistry(co.devfileMetadata.devfileRegistry.URL) {\n\t\t\t\tregistryUtil.PrintGitRegistryDeprecationWarning()\n\t\t\t}\n\t\t\t// Initialize envinfo\n\t\t\terr = co.InitEnvInfoFromContext()\n\t\t\tif err != nil {\n\t\t\t\tregistrySpinner.End(false)\n\t\t\t\treturn err\n\t\t\t}\n\n\t\t\tregistrySpinner.End(true)\n\t\t\treturn nil\n\t\t}\n\n\t\treturn fmt.Errorf(\"devfile component type %q is not supported, please run `odo catalog list components` for a list of supported devfile component types\", co.devfileMetadata.componentType)\n\n\t}\n\treturn\n}", "title": "" }, { "docid": "2c903fb914eddf4a3ee6cc3715fa56aa", "score": "0.58471435", "text": "func (x *HelpExt) RenderComplete() {\n\tif x.Render != nil {\n\t\tx.Render.RenderComplete()\n\t}\n}", "title": "" }, { "docid": "bd342e53e94e6610b105c29b8715c030", "score": "0.584436", "text": "func complete() error {\n\tsource := getSources()\n\n\tvar prefix string\n\tif len(os.Args) == 3 {\n\t\tprefix = os.Args[2]\n\t}\n\n\tfor _, completion := range source.Complete(prefix) {\n\t\tfmt.Println(completion)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "daff172603e3373ec2a8ca4a82340533", "score": "0.5841302", "text": "func (o *PodDisruptionBudgetOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tvar err error\n\to.Name, err = NameFromCommandArgs(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trestConfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Client, err = policyv1client.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.CreateAnnotation = cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag)\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\n\tprinter, err := o.PrintFlags.ToPrinter()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.PrintObj = func(obj runtime.Object) error {\n\t\treturn printer.PrintObj(obj, o.Out)\n\t}\n\n\to.ValidationDirective, err = cmdutil.GetValidationDirective(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d90913088a26118c2ee5b1908668a4b6", "score": "0.5773138", "text": "func Complete(name string, cmd Completer) {\n\tvar (\n\t\tline = getEnv(\"COMP_LINE\")\n\t\tpoint = getEnv(\"COMP_POINT\")\n\t\tdoInstall = getEnv(\"COMP_INSTALL\") == \"1\"\n\t\tdoUninstall = getEnv(\"COMP_UNINSTALL\") == \"1\"\n\t\tyes = getEnv(\"COMP_YES\") == \"1\"\n\t)\n\tif doInstall || doUninstall {\n\t\tinstall.Run(name, doUninstall, yes, out, in)\n\t\texit(0)\n\t\treturn\n\t}\n\tif line == \"\" {\n\t\treturn\n\t}\n\ti, err := strconv.Atoi(point)\n\tif err != nil {\n\t\tpanic(\"COMP_POINT env should be integer, got: \" + point)\n\t}\n\n\t// Parse the command line up to the completion point.\n\targs := arg.Parse(line[:i])\n\n\t// The first word is the current command name.\n\targs = args[1:]\n\n\t// Run the completion algorithm.\n\toptions, err := completer{Completer: cmd, args: args}.complete()\n\tif err != nil {\n\t\tfmt.Fprintln(out, \"\\n\"+err.Error())\n\t} else {\n\t\tfor _, option := range options {\n\t\t\tfmt.Fprintln(out, option)\n\t\t}\n\t}\n\texit(0)\n}", "title": "" }, { "docid": "8e2e57309b07685f89662e46f8a7e3b9", "score": "0.5759415", "text": "func (o *QuotaOpts) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tvar err error\n\to.Name, err = NameFromCommandArgs(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\trestConfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Client, err = coreclient.NewForConfig(restConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.CreateAnnotation = cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag)\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\n\tprinter, err := o.PrintFlags.ToPrinter()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.PrintObj = func(obj runtime.Object) error {\n\t\treturn printer.PrintObj(obj, o.Out)\n\t}\n\n\to.ValidationDirective, err = cmdutil.GetValidationDirective(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "009fdfaa7aa82b6b0ea541d57e272c7d", "score": "0.5756427", "text": "func (s *Action) ConfigComplete(c *cli.Context) {\n\tfor _, k := range s.configKeys() {\n\t\tfmt.Fprintln(stdout, k)\n\t}\n}", "title": "" }, { "docid": "70f2eeb4186cd4815f4aaf50fdca0ba7", "score": "0.57257754", "text": "func (c completer) complete() ([]string, error) {\nreset:\n\targ := arg.Arg{}\n\tif len(c.args) > 0 {\n\t\targ = c.args[0]\n\t}\n\tswitch {\n\tcase len(c.SubCmdList()) == 0:\n\t\t// No sub commands, parse flags and positional arguments.\n\t\treturn c.suggestLeafCommandOptions(), nil\n\n\t// case !arg.Completed && arg.IsFlag():\n\t// Suggest help flags for command\n\t// return []string{helpFlag(arg.Text)}, nil\n\n\tcase !arg.Completed:\n\t\t// Currently typing a sub command.\n\t\treturn c.suggestSubCommands(arg.Text), nil\n\n\tcase c.SubCmdGet(arg.Text) != nil:\n\t\t// Sub command completed, look into that sub command completion.\n\t\t// Set the complete command to the requested sub command, and the before text to all the text\n\t\t// after the command name and rerun the complete algorithm with the new sub command.\n\t\tc.stack = append([]Completer{c.Completer}, c.stack...)\n\t\tc.Completer = c.SubCmdGet(arg.Text)\n\t\tc.args = c.args[1:]\n\t\tgoto reset\n\n\tdefault:\n\n\t\t// Sub command is unknown...\n\t\treturn nil, fmt.Errorf(\"unknown subcommand: %s\", arg.Text)\n\t}\n}", "title": "" }, { "docid": "6abf90982269c65a7781ea499af3edf1", "score": "0.5711653", "text": "func (cfg *Config) Complete() CompletedConfig {\n\tc := completedConfig{\n\t\tcfg.GenericConfig.Complete(),\n\t\t&cfg.ExtraConfig,\n\t}\n\n\tc.GenericConfig.Version = &version.Info{\n\t\tMajor: \"1\",\n\t\tMinor: \"0\",\n\t}\n\n\treturn CompletedConfig{&c}\n}", "title": "" }, { "docid": "6abf90982269c65a7781ea499af3edf1", "score": "0.5711653", "text": "func (cfg *Config) Complete() CompletedConfig {\n\tc := completedConfig{\n\t\tcfg.GenericConfig.Complete(),\n\t\t&cfg.ExtraConfig,\n\t}\n\n\tc.GenericConfig.Version = &version.Info{\n\t\tMajor: \"1\",\n\t\tMinor: \"0\",\n\t}\n\n\treturn CompletedConfig{&c}\n}", "title": "" }, { "docid": "fa75595302aff8b32d3c47b93de22d50", "score": "0.5706095", "text": "func (o *DebugOptions) Complete(restClientGetter genericclioptions.RESTClientGetter, cmd *cobra.Command, args []string) error {\n\tvar err error\n\n\to.PullPolicy = corev1.PullPolicy(cmdutil.GetFlagString(cmd, \"image-pull-policy\"))\n\n\t// Arguments\n\targsLen := cmd.ArgsLenAtDash()\n\to.TargetNames = args\n\t// If there is a dash and there are args after the dash, extract the args.\n\tif argsLen >= 0 && len(args) > argsLen {\n\t\to.TargetNames, o.Args = args[:argsLen], args[argsLen:]\n\t}\n\n\t// Attach\n\tattachFlag := cmd.Flags().Lookup(\"attach\")\n\tif !attachFlag.Changed && o.Interactive {\n\t\to.Attach = true\n\t}\n\n\t// Environment\n\tenvStrings, err := cmd.Flags().GetStringToString(\"env\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"internal error getting env flag: %v\", err)\n\t}\n\tfor k, v := range envStrings {\n\t\to.Env = append(o.Env, corev1.EnvVar{Name: k, Value: v})\n\t}\n\n\t// Namespace\n\to.Namespace, o.explicitNamespace, err = restClientGetter.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// Record flags that the user explicitly changed from their defaults\n\to.attachChanged = cmd.Flags().Changed(\"attach\")\n\to.shareProcessedChanged = cmd.Flags().Changed(\"share-processes\")\n\n\t// Set default WarningPrinter\n\tif o.WarningPrinter == nil {\n\t\to.WarningPrinter = printers.NewWarningPrinter(o.ErrOut, printers.WarningPrinterOptions{Color: term.AllowsColorOutput(o.ErrOut)})\n\t}\n\n\tif o.Applier == nil {\n\t\tapplier, err := NewProfileApplier(o.Profile)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.Applier = applier\n\t}\n\n\tclientConfig, err := restClientGetter.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclient, err := kubernetes.NewForConfig(clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.podClient = client.CoreV1()\n\n\to.Builder = resource.NewBuilder(restClientGetter)\n\n\treturn nil\n}", "title": "" }, { "docid": "3b80532232f45a09c4b8de1e96ae9eae", "score": "0.56894296", "text": "func (overrides ConfigOverrides) Complete(match string) []flags.Completion {\n\treturn core.DefaultConfiguration().Completions(match)\n}", "title": "" }, { "docid": "ddff17f610c83cb1e1ff92793e729650", "score": "0.5649854", "text": "func mainComplete() error {\n\t// Recursively register all commands and subcommands\n\t// along with global and local flags\n\tvar complCmds = make(complete.Commands)\n\tfor _, cmd := range appCmds {\n\t\tcomplCmds[cmd.Name] = cmdToCompleteCmd(cmd, \"\")\n\t}\n\tcomplFlags := flagsToCompleteFlags(nil)\n\tcliComplete := complete.Command{\n\t\tSub: complCmds,\n\t\tGlobalFlags: complFlags,\n\t}\n\t// Answer to bash completion call\n\tcomplete.New(filepath.Base(os.Args[0]), cliComplete).Run()\n\treturn nil\n}", "title": "" }, { "docid": "b43c88eb108c89b39ac8d2f4269436bd", "score": "0.56431013", "text": "func (o *RshOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string) error {\n\targsLenAtDash := cmd.ArgsLenAtDash()\n\tif len(args) == 0 && argsLenAtDash == 0 && len(o.FilenameOptions.Filenames) == 0 {\n\t\treturn kcmdutil.UsageErrorf(cmd, \"%s\", rshUsageErrStr)\n\t}\n\t// this check ensures we don't accept invocation with '--' in it, iow.\n\t// 'oc rsh pod -- date' nor 'oc rsh -f pod.yaml -- date'\n\tif argsLenAtDash != -1 || (len(args) > 0 && args[0] == \"--\") || (len(args) > 1 && args[1] == \"--\") {\n\t\treturn kcmdutil.UsageErrorf(cmd, \"%s\", rshUsageErrStr)\n\t}\n\n\tswitch {\n\tcase o.ForceTTY && o.DisableTTY:\n\t\treturn kcmdutil.UsageErrorf(cmd, \"you may not specify -t and -T together\")\n\tcase o.ForceTTY:\n\t\to.TTY = true\n\tcase o.DisableTTY:\n\t\to.TTY = false\n\tdefault:\n\t\to.TTY = term.IsTerminal(o.In)\n\t}\n\n\t// Value of argsLenAtDash is -1 since cmd.ArgsLenAtDash() assumes all the flags\n\t// of flag.FlagSet were parsed. The opposite is true. Thus, it needs to be computed manually.\n\t// In case the command is present, the first item in args is a pod name,\n\t// the rest is a command and its arguments.\n\t// kubectl exec expects the command to be preceded by '--'.\n\t// oc rsh always provides the command as the second item of args.\n\tif len(args) > 1 {\n\t\targsLenAtDash = 1\n\t}\n\n\tif err := o.ExecOptions.Complete(f, cmd, args, argsLenAtDash); err != nil {\n\t\treturn err\n\t}\n\n\t// overwrite ExecOptions with rsh specifics\n\tif len(args) > 0 && len(o.FilenameOptions.Filenames) != 0 {\n\t\to.Command = args[0:]\n\t\to.ResourceName = \"\"\n\t} else if len(args) > 1 {\n\t\to.Command = args[1:]\n\t} else {\n\t\to.Command = []string{o.Executable}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "42d449f141d4e4d99f3dbcbd6a05abef", "score": "0.5612262", "text": "func (lvl Uplevel) Complete(context interface{}, function string) {\n\tdt, file, funcName, pid := dtFile(2+int(lvl), function)\n\toutput(Dev.get(DevStart), \"%s: %s[%d]: %s: %v: %s: Completed:\\n\", dt, l.prefix, pid, file, context, funcName)\n}", "title": "" }, { "docid": "be6707db53efb1bc8748831eb2afbdb9", "score": "0.5592046", "text": "func (f *PrintFlags) Complete(successTemplate string) error {\n\treturn f.NamePrintFlags.Complete(successTemplate)\n}", "title": "" }, { "docid": "21c702120758c8b56d9013703070490b", "score": "0.5545554", "text": "func (td *traitDef) Complete(ctx process.Context) error {\n\tbi := build.NewContext().NewInstance(\"\", nil)\n\tif err := bi.AddFile(\"-\", td.templ); err != nil {\n\t\treturn err\n\t}\n\tif td.params != nil {\n\t\tbt, _ := json.Marshal(td.params)\n\t\tif err := bi.AddFile(\"parameter\", fmt.Sprintf(\"parameter: %s\", string(bt))); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := bi.AddFile(\"f\", ctx.Compile(\"context\")); err != nil {\n\t\treturn err\n\t}\n\tinsts := cue.Build([]*build.Instance{bi})\n\tfor _, inst := range insts {\n\n\t\tif err := inst.Value().Err(); err != nil {\n\t\t\treturn errors.WithMessagef(err, \"traitDef %s build\", td.name)\n\t\t}\n\n\t\tprocessing := inst.Lookup(\"processing\")\n\t\tvar err error\n\t\tif processing.Exists() {\n\t\t\tif inst, err = task.Process(inst); err != nil {\n\t\t\t\treturn errors.WithMessagef(err, \"traitDef %s build\", td.name)\n\t\t\t}\n\t\t}\n\n\t\toutput := inst.Lookup(OutputFieldName)\n\t\tif output.Exists() {\n\t\t\tother, err := model.NewOther(output)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessagef(err, \"traitDef %s new Assist\", td.name)\n\t\t\t}\n\t\t\tctx.PutAssistants(process.Assistant{Ins: other, Type: td.name})\n\t\t}\n\n\t\toutputs := inst.Lookup(OutputsFieldName)\n\t\tst, err := outputs.Struct()\n\t\tif err == nil {\n\t\t\tfor i := 0; i < st.Len(); i++ {\n\t\t\t\tfieldInfo := st.Field(i)\n\t\t\t\tif fieldInfo.IsDefinition || fieldInfo.IsHidden || fieldInfo.IsOptional {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tother, err := model.NewOther(fieldInfo.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.WithMessagef(err, \"traitDef %s new Assists(%s)\", td.name, fieldInfo.Name)\n\t\t\t\t}\n\t\t\t\tctx.PutAssistants(process.Assistant{Ins: other, Type: td.name})\n\t\t\t}\n\t\t}\n\n\t\tpatcher := inst.Lookup(PatchFieldName)\n\t\tif patcher.Exists() {\n\t\t\tbase, _ := ctx.Output()\n\t\t\tp, err := model.NewOther(patcher)\n\t\t\tif err != nil {\n\t\t\t\treturn errors.WithMessagef(err, \"traitDef %s patcher NewOther\", td.name)\n\t\t\t}\n\t\t\tif err := base.Unify(p); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "79a2c567dc7bb1d4a7c03b035954e46b", "score": "0.5539774", "text": "func (w *whoCan) Complete(args []string) error {\n\terr := w.resolveArgs(args)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif w.resource != \"\" {\n\t\tw.gr, err = w.resourceResolver.Resolve(w.verb, w.resource, w.subResource)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"resolving resource: %v\", err)\n\t\t}\n\t\tglog.V(3).Infof(\"Resolved resource `%s`\", w.resource)\n\t}\n\n\terr = w.resolveNamespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "e33f4ebc9b02f4fc514b469388088fbd", "score": "0.5528285", "text": "func (c *Config) Complete() completedConfig {\n\tc.GenericConfig.Complete()\n\n\treturn completedConfig{c}\n}", "title": "" }, { "docid": "afaaf6208003ecc522645ab2d6421026", "score": "0.5527537", "text": "func (b *BuildRun) Complete(client dynamic.Interface, ns string, args []string) error {\n\tif len(args) != 2 {\n\t\treturn fmt.Errorf(\"not enough arguments, informed: '%v'\", args)\n\t}\n\tnoun := args[0]\n\tname := args[1]\n\tswitch noun {\n\tcase \"build-run\":\n\t\tb.name = name\n\tcase \"build\":\n\t\t// FIXME: decide upon how to name build-run resources when the \"run build\" is issued;\n\t\tb.name = \"should-be-random-name\"\n\t\tb.spec.BuildRef.Name = name\n\tdefault:\n\t\treturn fmt.Errorf(\"unknown noun '%s' in command-line parameters\", noun)\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bafb8df5763239d3d84f58bcb9825cfe", "score": "0.5517137", "text": "func (cs *ParallelScheduler) Complete() {\n\tcs.pool.Wait()\n}", "title": "" }, { "docid": "da5948c6c102cd858ec071973d0ab225", "score": "0.55099326", "text": "func (o *CreateCRROptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tname, err := NameFromCommandArgs(cmd, args)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Name = name\n\tclientConfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.ClientSet, err = kubernetes.NewForConfig(clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.kruisev1alpha1Client, err = kruiseclientsets.NewForConfig(clientConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.Namespace, o.EnforceNamespace, err = f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif len(o.Namespace) == 0 {\n\t\to.Namespace = \"default\"\n\t}\n\to.CreateAnnotation = cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag)\n\n\to.Builder = f.NewBuilder()\n\n\tif len(o.Containers) == 0 {\n\t\t// restart all containers in pod\n\t\to.ContainerRecreateRequestContainer, err = o.getAllCRRContainersInPod()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdynamicClient, err := f.DynamicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.DryRunVerifier = resource.NewDryRunVerifier(dynamicClient, f.OpenAPIGetter())\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\tprinter, err := o.PrintFlags.ToPrinter()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.PrintObj = func(obj runtime.Object) error {\n\t\treturn printer.PrintObj(obj, o.Out)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "389a6ef6adec99a990ff393a37b43847", "score": "0.5450622", "text": "func (ii *importInfo) Complete(info *PackageInfo) {\n\tif info == nil {\n\t\tpanic(\"info == nil\")\n\t}\n\tii.info = info\n\tclose(ii.complete)\n}", "title": "" }, { "docid": "5a8913a86f5d9bdae446b9c24e9b2bc6", "score": "0.5447245", "text": "func (c *CrdServerConfig) Complete() CompletedConfig {\n\tcompletedCfg := completedConfig{\n\t\tc.GenericConfig.Complete(),\n\t}\n\n\tcompletedCfg.GenericConfig.Version = &version.Info{\n\t\tMajor: \"1\",\n\t\tMinor: \"0\",\n\t}\n\n\treturn CompletedConfig{&completedCfg}\n}", "title": "" }, { "docid": "4462af0e1ff1d5db589b8005e420ebc8", "score": "0.5445746", "text": "func (flow *flowControl) Complete(data interface{}) {\n\t// Try to chnage the result from None to Completed and if it's successful\n\t// finish the flow.\n\tif atomic.CompareAndSwapInt32(&flow.result, None.Int32(), Completed.Int32()) {\n\t\tflow.data = data\n\t\tflow.cancel()\n\t}\n}", "title": "" }, { "docid": "2bcdf43cdfe862942d5f5c55553c51f5", "score": "0.54390836", "text": "func (c *Config) Complete() error {\n\tif c.Scheme == \"\" {\n\t\tc.Scheme = \"http\"\n\t}\n\tif c.Scheme != \"http\" && c.Scheme != \"https\" {\n\t\treturn unrecognizedHTTPScheme.Error(c.Scheme)\n\t}\n\tif c.Host == \"\" {\n\t\treturn noHTTPHost.Error()\n\t}\n\tif c.Executor == nil {\n\t\tc.Executor = &http.Client{}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "717d92eb7ea7c5f9dd4fcebf9e4ebdc5", "score": "0.54238343", "text": "func (c *Config) Complete() completedConfig {\n\n\treturn completedConfig{c}\n}", "title": "" }, { "docid": "a8d524bef34cb989c675831828353022", "score": "0.5422879", "text": "func (m *MockClient) Complete(v0 context.Context, v1 int, v2 error) error {\n\tr0 := m.CompleteFunc.nextHook()(v0, v1, v2)\n\tm.CompleteFunc.appendCall(ClientCompleteFuncCall{v0, v1, v2, r0})\n\treturn r0\n}", "title": "" }, { "docid": "704813e8b48e3faf87e873490e8e2e1b", "score": "0.5405658", "text": "func (o *RshOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []string) error {\n\tswitch {\n\tcase o.ForceTTY && o.DisableTTY:\n\t\treturn kcmdutil.UsageErrorf(cmd, \"you may not specify -t and -T together\")\n\tcase o.ForceTTY:\n\t\to.TTY = true\n\tcase o.DisableTTY:\n\t\to.TTY = false\n\tdefault:\n\t\to.TTY = term.IsTerminal(o.In)\n\t}\n\n\tif len(args) < 1 {\n\t\treturn kcmdutil.UsageErrorf(cmd, \"rsh requires a single Pod to connect to\")\n\t}\n\tresource := args[0]\n\targs = args[1:]\n\tif len(args) > 0 {\n\t\to.Command = args\n\t} else {\n\t\to.Command = []string{o.Executable}\n\t}\n\n\tnamespace, _, err := f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Namespace = namespace\n\n\tconfig, err := f.ToRESTConfig()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.Config = config\n\n\tclient, err := kclientset.NewForConfig(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\to.PodClient = client.Core()\n\n\to.PodName, err = podForResource(f, resource, time.Duration(o.Timeout)*time.Second)\n\n\tfullCmdName := \"\"\n\tcmdParent := cmd.Parent()\n\tif cmdParent != nil {\n\t\tfullCmdName = cmdParent.CommandPath()\n\t}\n\tif len(fullCmdName) > 0 && kcmdutil.IsSiblingCommandExists(cmd, \"describe\") {\n\t\to.ExecOptions.SuggestedCmdUsage = fmt.Sprintf(\"Use '%s describe pod/%s -n %s' to see all of the containers in this pod.\", fullCmdName, o.PodName, o.Namespace)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "b8f853de2ff5bedf8321e7d76a6b180b", "score": "0.5403686", "text": "func (c *Config) Complete() completedConfig {\n\treturn completedConfig{c}\n}", "title": "" }, { "docid": "163474807098a52e927b9027f9fb27ab", "score": "0.536919", "text": "func complete(cube [54]Facelet) string {\n\treturn \"\"\n}", "title": "" }, { "docid": "493434d4d30fb385b01434f9a2176cb8", "score": "0.5366942", "text": "func Complete(fx trees.EventHandler, selectorOverride string) *trees.Event {\n\treturn trees.NewEvent(\"complete\", selectorOverride, fx)\n}", "title": "" }, { "docid": "04317eeaa9e9378b6f9e4fdd833ef2b3", "score": "0.53329134", "text": "func (_PearlDistributeOysterby *PearlDistributeOysterbyCaller) Complete(opts *bind.CallOpts) (bool, error) {\n\tvar (\n\t\tret0 = new(bool)\n\t)\n\tout := ret0\n\terr := _PearlDistributeOysterby.contract.Call(opts, out, \"complete\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "e2e1aeb94d329c4c6d63dcdef20f69a1", "score": "0.5323067", "text": "func (in *LogConfig) Complete() {\n\tif in.Output == \"\" {\n\t\tin.Output = \"/var/log/panther\"\n\t}\n}", "title": "" }, { "docid": "ffff9ef98347fc9da0ab895d90eb39a2", "score": "0.53170305", "text": "func (n *node) Complete() Opts {\n\tn.complete = true\n\treturn n\n}", "title": "" }, { "docid": "b959645eb0aeae1824d55e043ff1da64", "score": "0.53070414", "text": "func WithCompleteChan(c chan struct{}) Option {\n\treturn func(t *target) {\n\t\tt.completeChan = c\n\t}\n}", "title": "" }, { "docid": "55c3c113897eeee31c2fb571bbc44ceb", "score": "0.52920353", "text": "func (wd *workloadDef) Complete(ctx process.Context) error {\n\tbi := build.NewContext().NewInstance(\"\", nil)\n\tif err := bi.AddFile(\"-\", wd.templ); err != nil {\n\t\treturn err\n\t}\n\tif wd.params != nil {\n\t\tbt, _ := json.Marshal(wd.params)\n\t\tif err := bi.AddFile(\"parameter\", fmt.Sprintf(\"parameter: %s\", string(bt))); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tif err := bi.AddFile(\"-\", ctx.Compile(\"context\")); err != nil {\n\t\treturn err\n\t}\n\tinsts := cue.Build([]*build.Instance{bi})\n\tfor _, inst := range insts {\n\t\tif err := inst.Value().Err(); err != nil {\n\t\t\treturn errors.WithMessagef(err, \"workloadDef %s eval\", wd.name)\n\t\t}\n\t\toutput := inst.Lookup(OutputFieldName)\n\t\tbase, err := model.NewBase(output)\n\t\tif err != nil {\n\t\t\treturn errors.WithMessagef(err, \"workloadDef %s new base\", wd.name)\n\t\t}\n\t\tctx.SetBase(base)\n\n\t\t// we will support outputs for workload composition, and it will become trait in AppConfig.\n\t\toutputs := inst.Lookup(OutputsFieldName)\n\t\tst, err := outputs.Struct()\n\t\tif err == nil {\n\t\t\tfor i := 0; i < st.Len(); i++ {\n\t\t\t\tfieldInfo := st.Field(i)\n\t\t\t\tif fieldInfo.IsDefinition || fieldInfo.IsHidden || fieldInfo.IsOptional {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tother, err := model.NewOther(fieldInfo.Value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn errors.WithMessagef(err, \"parse WorkloadDefinition %s outputs(%s)\", wd.name, fieldInfo.Name)\n\t\t\t\t}\n\t\t\t\tctx.PutAssistants(process.Assistant{Ins: other, Type: AuxiliaryWorkload})\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "caed27c7c34c5747b960fe2b86d15c17", "score": "0.5268868", "text": "func Complete(listener gr.Listener) *gr.EventListener {\n\treturn gr.NewEventListener(\"onComplete\", listener)\n}", "title": "" }, { "docid": "6a8eddd834746bd9a84a80b689e60058", "score": "0.5262294", "text": "func (c *Channels) Complete(chid datatransfer.ChannelID) error {\n\treturn c.send(chid, datatransfer.Complete)\n}", "title": "" }, { "docid": "9fe1000d8ed06087ca7b4f89ab3f5994", "score": "0.5250981", "text": "func Completed(ctx context.Context, cog cogger.Cog, completed func()) {\n\tgo func() {\n\t\tdefer completed()\n\t\tResolve(ctx, cog)\n\t}()\n}", "title": "" }, { "docid": "a567e664cb983c323d45872d0b616b8b", "score": "0.5238314", "text": "func complete(o *delete.DeleteOptions, f cmdutil.Factory, args []string) error {\n\t// func (o *ApplyOptions) Complete(f cmdutil.Factory, cmd *cobra.Command) error {\n\tcmdNamespace, enforceNamespace, err := f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.WarnClusterScope = enforceNamespace && !o.DeleteAllNamespaces\n\n\t// if o.DeleteAll || len(o.LabelSelector) > 0 || len(o.FieldSelector) > 0 {\n\t// if f := cmd.Flags().Lookup(\"ignore-not-found\"); f != nil && !f.Changed {\n\t// // If the user didn't explicitly set the option, default to ignoring NotFound errors when used with --all, -l, or --field-selector\n\t// o.IgnoreNotFound = true\n\t// }\n\t// }\n\tif o.DeleteNow {\n\t\tif o.GracePeriod != -1 {\n\t\t\treturn fmt.Errorf(\"--now and --grace-period cannot be specified together\")\n\t\t}\n\t\to.GracePeriod = 1\n\t}\n\tif o.GracePeriod == 0 && !o.ForceDeletion {\n\t\t// To preserve backwards compatibility, but prevent accidental data loss, we convert --grace-period=0\n\t\t// into --grace-period=1. Users may provide --force to bypass this conversion.\n\t\to.GracePeriod = 1\n\t}\n\tif o.ForceDeletion && o.GracePeriod < 0 {\n\t\to.GracePeriod = 0\n\t}\n\n\t// o.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\t// if err != nil {\n\t// return err\n\t// }\n\tdynamicClient, err := f.DynamicClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\tdiscoveryClient, err := f.ToDiscoveryClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\to.DryRunVerifier = resource.NewDryRunVerifier(dynamicClient, discoveryClient)\n\n\tif len(o.Raw) == 0 {\n\t\tr := f.NewBuilder().\n\t\t\tUnstructured().\n\t\t\tContinueOnError().\n\t\t\tNamespaceParam(cmdNamespace).DefaultNamespace().\n\t\t\tFilenameParam(enforceNamespace, &o.FilenameOptions).\n\t\t\tLabelSelectorParam(o.LabelSelector).\n\t\t\tFieldSelectorParam(o.FieldSelector).\n\t\t\tSelectAllParam(o.DeleteAll).\n\t\t\tAllNamespaces(o.DeleteAllNamespaces).\n\t\t\tResourceTypeOrNameArgs(false, args...).RequireObject(false).\n\t\t\tFlatten().\n\t\t\tDo()\n\t\terr = r.Err()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\to.Result = r\n\n\t\to.Mapper, err = f.ToRESTMapper()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\to.DynamicClient, err = f.DynamicClient()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ad191f6b2ef39afcb40fa7a5c413f8df", "score": "0.52344483", "text": "func (upload *MultipartUpload) complete(info minio.ObjectInfo) {\n\tupload.Done <- &MultipartUploadResult{Info: info}\n\tclose(upload.Done)\n}", "title": "" }, { "docid": "ac09767fdb8150c69c3f14737ad547e5", "score": "0.5224363", "text": "func (o *TargetClientOptions) Complete() error {\n\trestConfig, err := getTargetRESTConfig(o.kubeconfigPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create REST config for target cluster: %w\", err)\n\t}\n\n\t// TODO: make this configurable\n\trestConfig.QPS = 100.0\n\trestConfig.Burst = 130\n\n\trestMapper, err := getTargetRESTMapper(restConfig)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create REST mapper for target cluster: %w\", err)\n\t}\n\n\tscheme := getTargetScheme()\n\n\tvar (\n\t\ttargetCache cache.Cache\n\t\ttargetClient client.Client\n\t)\n\n\tif o.disableCache {\n\t\t// create direct client for target cluster\n\t\ttargetClient, err = client.New(restConfig, client.Options{\n\t\t\tMapper: restMapper,\n\t\t\tScheme: scheme,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to create client for target cluster: %w\", err)\n\t\t}\n\t} else {\n\t\t// create cached client for target cluster\n\t\ttargetCache, err = cache.New(restConfig, cache.Options{\n\t\t\tMapper: restMapper,\n\t\t\tResync: &o.cacheResyncPeriod,\n\t\t\tScheme: scheme,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to create client cache for target cluster: %w\", err)\n\t\t}\n\n\t\ttargetClient, err = newCachedClient(targetCache, *restConfig, client.Options{\n\t\t\tMapper: restMapper,\n\t\t\tScheme: scheme,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to create client for target cluster: %w\", err)\n\t\t}\n\t}\n\n\to.targetClient = &TargetClientConfig{\n\t\tClient: targetClient,\n\t\tRESTMapper: restMapper,\n\t\tScheme: scheme,\n\t\tcache: targetCache,\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "32fd43b7a2f09f0f7e966043c0122565", "score": "0.5211993", "text": "func (b *BugzillaQueryBuilder) Complete() *url.URL {\n\tb.values.Set(\"classification\", baseBzClassification)\n\tb.values.Set(\"query_format\", \"advanced\")\n\tb.values.Set(\"ctype\", \"csv\")\n\tb.values.Set(\"f1\", \"version\")\n\tb.values.Set(\"o1\", \"notregexp\")\n\tb.values.Set(\"human\", \"1\")\n\tb.values.Set(\"v1\", `^2\\.`)\n\tb.url.RawQuery = b.values.Encode()\n\treturn b.url\n}", "title": "" }, { "docid": "e29211a5f7fe26c9c31113f1a591bf94", "score": "0.5207583", "text": "func (s *System) Complete() error {\n\n\tvar readmeBuffer bytes.Buffer\n\terr := readmeTemplate.Execute(&readmeBuffer, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts.NooBaa.Status.Readme = readmeBuffer.String()\n\ts.NooBaa.Status.Accounts.Admin.SecretRef.Name = s.SecretAdmin.Name\n\ts.NooBaa.Status.Accounts.Admin.SecretRef.Namespace = s.SecretAdmin.Namespace\n\treturn nil\n}", "title": "" }, { "docid": "dad9bc30934a76b8a5bae3430925fe35", "score": "0.51917607", "text": "func (l *Logger) Complete(context interface{}, function string) {\n\tif l.level() >= LevelTrace {\n\t\tUp1.Complete(context, function)\n\t}\n}", "title": "" }, { "docid": "5fa9a64b4081d5bf1e73c78637031958", "score": "0.5150814", "text": "func createCommandComplete(command *cli.Command, meta *config.Metadata) func(c *cli.Context) {\n\treturn func(c *cli.Context) {\n\t\tif !meta.Completion.IsFlagValue {\n\t\t\tfmt.Println(\"normal\")\n\t\t\tfor _, flag := range command.Flags {\n\t\t\t\tprintFlag(c, flag)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\n\t\t// Default to file completion\n\t\tfmt.Println(\"file\")\n\t}\n}", "title": "" }, { "docid": "d785cf22756bc05bdb6ddb9f7978392a", "score": "0.51410997", "text": "func (o *TaintOptions) Complete(f cmdutil.Factory, cmd *cobra.Command, args []string) (err error) {\n\tnamespace, _, err := f.ToRawKubeConfigLoader().Namespace()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.Mapper, err = f.ToRESTMapper()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\to.DryRunStrategy, err = cmdutil.GetDryRunStrategy(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tcmdutil.PrintFlagsWithDryRunStrategy(o.PrintFlags, o.DryRunStrategy)\n\n\to.ValidationDirective, err = cmdutil.GetValidationDirective(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// retrieves resource and taint args from args\n\t// also checks args to verify that all resources are specified before taints\n\ttaintArgs := []string{}\n\tmetTaintArg := false\n\tfor _, s := range args {\n\t\tisTaint := strings.Contains(s, \"=\") || strings.Contains(s, \":\") || strings.HasSuffix(s, \"-\")\n\t\tswitch {\n\t\tcase !metTaintArg && isTaint:\n\t\t\tmetTaintArg = true\n\t\t\tfallthrough\n\t\tcase metTaintArg && isTaint:\n\t\t\ttaintArgs = append(taintArgs, s)\n\t\tcase !metTaintArg && !isTaint:\n\t\t\to.resources = append(o.resources, s)\n\t\tcase metTaintArg && !isTaint:\n\t\t\treturn fmt.Errorf(\"all resources must be specified before taint changes: %s\", s)\n\t\t}\n\t}\n\n\to.ToPrinter = func(operation string) (printers.ResourcePrinter, error) {\n\t\to.PrintFlags.NamePrintFlags.Operation = operation\n\t\treturn o.PrintFlags.ToPrinter()\n\t}\n\n\tif len(o.resources) < 1 {\n\t\treturn fmt.Errorf(\"one or more resources must be specified as <resource> <name>\")\n\t}\n\tif len(taintArgs) < 1 {\n\t\treturn fmt.Errorf(\"at least one taint update is required\")\n\t}\n\n\tif o.taintsToAdd, o.taintsToRemove, err = parseTaints(taintArgs); err != nil {\n\t\treturn cmdutil.UsageErrorf(cmd, err.Error())\n\t}\n\to.builder = f.NewBuilder().\n\t\tWithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).\n\t\tContinueOnError().\n\t\tNamespaceParam(namespace).DefaultNamespace()\n\tif o.selector != \"\" {\n\t\to.builder = o.builder.LabelSelectorParam(o.selector).ResourceTypes(\"node\")\n\t}\n\tif o.all {\n\t\to.builder = o.builder.SelectAllParam(o.all).ResourceTypes(\"node\").Flatten().Latest()\n\t}\n\tif !o.all && o.selector == \"\" && len(o.resources) >= 2 {\n\t\to.builder = o.builder.ResourceNames(\"node\", o.resources[1:]...)\n\t}\n\to.builder = o.builder.LabelSelectorParam(o.selector).\n\t\tFlatten().\n\t\tLatest()\n\n\to.ClientForMapping = f.ClientForMapping\n\treturn nil\n}", "title": "" }, { "docid": "e416a088c558a271c68b98ceba24f378", "score": "0.51069725", "text": "func OnComplete(onComplete FnOnComplete) SubscriberOption {\n\treturn func(s *subscriber) {\n\t\ts.fnOnComplete = onComplete\n\t}\n}", "title": "" }, { "docid": "472100d7e3e9d5358d0b859d83835f7a", "score": "0.50993454", "text": "func (b *ILBuilder) Complete() *data.Metadata {\n\tb.fixOperands(b.Metadata.Contract.Instructions)\n\tfor _, function := range b.Metadata.Contract.Functions {\n\t\tb.fixOperands(function.Instructions)\n\t}\n\treturn b.Metadata\n}", "title": "" }, { "docid": "9318b2473b080f8a610be0434c23281d", "score": "0.50959104", "text": "func (o KogitoBuildStatusBuildsOutput) Complete() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v KogitoBuildStatusBuilds) []string { return v.Complete }).(pulumi.StringArrayOutput)\n}", "title": "" } ]
d49932b70bdd65aed273fcd37a3f8b1c
Deprecated: Use NodeGroupsAddNodesRequest.ProtoReflect.Descriptor instead.
[ { "docid": "34cd60b0ae4aae8641fca32880a75ae0", "score": "0.76270306", "text": "func (*NodeGroupsAddNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{315}\n}", "title": "" } ]
[ { "docid": "105af02ac2d31f0f808a46ba65e5635d", "score": "0.7346443", "text": "func (*AddNodesNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{816}\n}", "title": "" }, { "docid": "c2b1d2d72c93bdbd6de0ce7e63b29417", "score": "0.7008024", "text": "func (*ListNodeGroupNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "056b7c492c5089da46c82e5bc1c000a2", "score": "0.6963045", "text": "func (*ListNodesNodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{824}\n}", "title": "" }, { "docid": "8a762b22c27d8aea0b33f3668d48d3f9", "score": "0.6890287", "text": "func (*NodeGroupsDeleteNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{316}\n}", "title": "" }, { "docid": "c6b658ba054b7d1e16f8dad735fa6807", "score": "0.6736248", "text": "func (*CreateNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{9}\n}", "title": "" }, { "docid": "7855f31dd7c78d2340ad5597ae71f7c9", "score": "0.66982657", "text": "func (*ListNodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "61a7140f063e7fbd748e7e8c74e31333", "score": "0.6665118", "text": "func (*DeleteNodesNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{819}\n}", "title": "" }, { "docid": "caffbef95d0086f3e0c4dac1758e86d1", "score": "0.66479975", "text": "func (*InsertNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{822}\n}", "title": "" }, { "docid": "0e7685622019b53f463d6a7d461d0d75", "score": "0.66407156", "text": "func (*UpdateNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "c0007db1ac3694fb880f36b730cec02f", "score": "0.6582871", "text": "func (*ListNodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{823}\n}", "title": "" }, { "docid": "f24094a24de40cddba636c02bf86957b", "score": "0.65685713", "text": "func (*NodeGroupsListNodes) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{317}\n}", "title": "" }, { "docid": "66e094ea3449322923d7037a6e4d342b", "score": "0.6363487", "text": "func (*AggregatedListNodeGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{817}\n}", "title": "" }, { "docid": "e20d885c274bef5f9f81e38dff75d764", "score": "0.63511854", "text": "func (*DeleteNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "47dae49ac3b67063ff911030e98f1b10", "score": "0.6343851", "text": "func (*PatchNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{825}\n}", "title": "" }, { "docid": "a52399221587cea1904b635457e12140", "score": "0.6231205", "text": "func (*DeleteNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{818}\n}", "title": "" }, { "docid": "aa1e552738c0dc3e0925fe1f0ba05722", "score": "0.62226695", "text": "func (*ListNodeGroupNodesResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a0af847562f3f490b653ab17182252c3", "score": "0.62037486", "text": "func (*CreateNodeGroupMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "edb6106a8b8df13abe139d8315ee1ddf", "score": "0.61894083", "text": "func (*ListNodeGroupOperationsRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "e858ec3d00403ff222bf1353a0a5626d", "score": "0.6179552", "text": "func (*UpdateNodeGroupMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "396ea7a2f38fe8e79de8e322943b6862", "score": "0.61734486", "text": "func (*GetNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "051a05c845c947c574010aabe3feabe7", "score": "0.6170551", "text": "func (*SetIamPolicyNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{826}\n}", "title": "" }, { "docid": "43cc211acc77e6acaf495c3dd9c292de", "score": "0.61418957", "text": "func (*AutoUpgradeNodeGroupMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "f0fa782434f7015de0be25817d521c5e", "score": "0.61260456", "text": "func (*SetNodeTemplateNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{827}\n}", "title": "" }, { "docid": "8eb0006ff3fba6957166322b0bdad58f", "score": "0.60763156", "text": "func (*GetNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{820}\n}", "title": "" }, { "docid": "569544d73f18b7479db12580fd0d6a73", "score": "0.60683393", "text": "func (*NodeGroupNode) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{314}\n}", "title": "" }, { "docid": "29f0d0beb63fa460b698f33ae11fe889", "score": "0.60379577", "text": "func (*TestIamPermissionsNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{828}\n}", "title": "" }, { "docid": "4485584305fc33a8c8c2a747605bc3b7", "score": "0.6023697", "text": "func (*NodeGroupsScopedList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{310}\n}", "title": "" }, { "docid": "d9ea3a920da454f0506dcdad2fc459b2", "score": "0.60188854", "text": "func (*NodeGroupsSetNodeTemplateRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{318}\n}", "title": "" }, { "docid": "396355f9433a7a1a885b5819bb091b61", "score": "0.59763974", "text": "func (*NodeGroupList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{312}\n}", "title": "" }, { "docid": "826de03d5f41d463a4ac1114fc549f1c", "score": "0.5949646", "text": "func (*InstanceGroupsAddInstancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{217}\n}", "title": "" }, { "docid": "a68a445bb6740616fc0a3a257436b053", "score": "0.59484184", "text": "func (*DeleteNodeGroupMetadata) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "780cbafca11bde2084cda0c6df5a40a1", "score": "0.5930611", "text": "func (*AddGroups_Request) Descriptor() ([]byte, []int) {\n\treturn file_group_service_api_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "774b128c9e0d372353aa2ef07c64d13b", "score": "0.59077245", "text": "func (*NodeGroup) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{309}\n}", "title": "" }, { "docid": "0543cc904867af0aa52dbfdca048ddcc", "score": "0.58648896", "text": "func (*ListNodeGroupsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{2}\n}", "title": "" }, { "docid": "f80350ba5013f539ea978da1ad3f071f", "score": "0.58246285", "text": "func (*InstanceGroupsSetNamedPortsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{222}\n}", "title": "" }, { "docid": "55cfd6150ad6af9b3d3a40fc958edf48", "score": "0.5792711", "text": "func (*GetIamPolicyNodeGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{821}\n}", "title": "" }, { "docid": "fb2c8f9c9641126c8dd0a9278e936cc9", "score": "0.57295", "text": "func (*InsertNetworkEndpointGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{801}\n}", "title": "" }, { "docid": "a27ecb06d8cc21dfca4279c5417d0ee8", "score": "0.5675723", "text": "func (*AddInstancesInstanceGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{712}\n}", "title": "" }, { "docid": "ad6056bd9c9f6ea15860e871963c9a58", "score": "0.56394583", "text": "func (*ListInstanceGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{717}\n}", "title": "" }, { "docid": "acc0e95486376e52985c373e588415e1", "score": "0.5634266", "text": "func (*ListNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{802}\n}", "title": "" }, { "docid": "ea1f6251194db0b5ecb423b7c4f30667", "score": "0.5628465", "text": "func (*InsertGlobalNetworkEndpointGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{656}\n}", "title": "" }, { "docid": "436fb59e3b1a161b7261e1b7ebb57b6b", "score": "0.5596349", "text": "func (*InsertInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{700}\n}", "title": "" }, { "docid": "1e3c948c2734433dd29a60ef05a188c0", "score": "0.55958784", "text": "func (*SetNamedPortsInstanceGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{720}\n}", "title": "" }, { "docid": "a1adae65edd3b27c7e0437962b46aa31", "score": "0.55927706", "text": "func (*ListWalletGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_global_api_proto_rawDescGZIP(), []int{37}\n}", "title": "" }, { "docid": "561943582b08f6b6108b87cdecd0cd1c", "score": "0.5578118", "text": "func (*ListNetworkEndpointsNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{803}\n}", "title": "" }, { "docid": "7a7f0556093d7911acc0ce4a5c30623c", "score": "0.5569255", "text": "func (*ListEnabledNSNodesMatchRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "e103da8945b6144207fbf0ad6e5a44f3", "score": "0.55686885", "text": "func (*AggregatedListNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{796}\n}", "title": "" }, { "docid": "e5e7e75b10da399b1cd94f9cd2600a7e", "score": "0.5564889", "text": "func (*RecreateInstancesInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{707}\n}", "title": "" }, { "docid": "aad44efb9449564d9032426db3d6313b", "score": "0.5558367", "text": "func (*InsertInstanceGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{716}\n}", "title": "" }, { "docid": "2c2629726349c9cadcc45a22a1846aa6", "score": "0.55506456", "text": "func (*CreateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "83eb9d200b824922a1fec9125cabb1e6", "score": "0.5550371", "text": "func (*ListGlobalNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{657}\n}", "title": "" }, { "docid": "eda5a884f75d2080b29345f377f4d020", "score": "0.555011", "text": "func (*NetworksAddPeeringRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{302}\n}", "title": "" }, { "docid": "5bf2c15738ee35f60d0c188a53b19af8", "score": "0.55370057", "text": "func (*UpdateNodeTags) Descriptor() ([]byte, []int) {\n\treturn file_interservice_infra_proxy_request_nodes_proto_rawDescGZIP(), []int{3}\n}", "title": "" }, { "docid": "2bf9c1dc3030657a055b72632ca6e664", "score": "0.55356055", "text": "func (*ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{658}\n}", "title": "" }, { "docid": "48fee0017c94fde13183891672189bb1", "score": "0.553161", "text": "func (*AggregatedListInstanceGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{713}\n}", "title": "" }, { "docid": "0877554d0072e5244df63fbdbdc8edd1", "score": "0.5531096", "text": "func (*RegionInstanceGroupsSetNamedPortsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{393}\n}", "title": "" }, { "docid": "b5aba4c43879b27af1926d2bb9f1b746", "score": "0.5526355", "text": "func (*NodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_kythe_proto_graph_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "86e02a64330284dc45b65be302ee6708", "score": "0.55203944", "text": "func (*NodeGroup_Node) Descriptor() ([]byte, []int) {\n\treturn file_influxdata_iox_management_v1_shard_proto_rawDescGZIP(), []int{4, 0}\n}", "title": "" }, { "docid": "4b438eeb1de2d304917711aa9c1eecc2", "score": "0.551244", "text": "func (*AddQuestionGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_hts_organizer_service_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "25d0be46abe45f8fa4a769a6c048822d", "score": "0.55066544", "text": "func (*Nodes) Descriptor() ([]byte, []int) {\n\treturn file_interservice_infra_proxy_request_nodes_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "65c44402f9339463189d8d3278e2b801", "score": "0.5501833", "text": "func (*FindAllEnabledNSNodesWithNSClusterIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "95ed99d9fee40b18511ec13e6bee9517", "score": "0.54935414", "text": "func (*CreateInstancesInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{695}\n}", "title": "" }, { "docid": "d7a529e49c56c8095a175fcc0c5d6c85", "score": "0.5490272", "text": "func (*ListNodesRequest) Descriptor() ([]byte, []int) {\n\treturn file_tb_proto_rawDescGZIP(), []int{8}\n}", "title": "" }, { "docid": "ef9d78fe92b5f9cda0ead2a128552c51", "score": "0.5474511", "text": "func (*AddGrpFriendReq) Descriptor() ([]byte, []int) {\n\treturn file_protobuf_service_messageService_proto_rawDescGZIP(), []int{11}\n}", "title": "" }, { "docid": "3804ea1021c3b87a58caf4125530b820", "score": "0.54701906", "text": "func (*AttachNetworkEndpointsNetworkEndpointGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{797}\n}", "title": "" }, { "docid": "f0bfb2e31f21981e0e1122622281bb60", "score": "0.5455841", "text": "func (*UpdateNSNodeRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "b4ca773a73ec474a682a36281bf5385c", "score": "0.5454281", "text": "func (*PatchInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{705}\n}", "title": "" }, { "docid": "136849cfeda69beea175f2e5b866cb6a", "score": "0.54523486", "text": "func (*AttachNetworkEndpointsGlobalNetworkEndpointGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{652}\n}", "title": "" }, { "docid": "644812983b0a0655aab054c5520b6bd4", "score": "0.543025", "text": "func (*InsertRegionNetworkEndpointGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{939}\n}", "title": "" }, { "docid": "54bbda07473d1db59d4cd05a60fbb695", "score": "0.54276776", "text": "func (*NetworkEndpointGroupsAttachEndpointsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{296}\n}", "title": "" }, { "docid": "f417d2ffc8b2f1dbc9f764ace2191c8b", "score": "0.54246193", "text": "func (*CreateWalletGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_global_api_proto_rawDescGZIP(), []int{32}\n}", "title": "" }, { "docid": "f8857e34b49069590f8f9103e0074c9b", "score": "0.5415471", "text": "func (*ListNodeGroupOperationsResponse) Descriptor() ([]byte, []int) {\n\treturn file_yandex_cloud_k8s_v1_node_group_service_proto_rawDescGZIP(), []int{13}\n}", "title": "" }, { "docid": "c31c6f81a6f6f33cff7708d443582293", "score": "0.54115033", "text": "func (*GlobalNetworkEndpointGroupsAttachEndpointsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{127}\n}", "title": "" }, { "docid": "f529fc76899617813769f8823fe301e1", "score": "0.5398483", "text": "func (*CreateServerGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_server_group_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "92496aa9603423e41d1062315a4bc863", "score": "0.53974015", "text": "func (*NodeGroupAggregatedList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{311}\n}", "title": "" }, { "docid": "ac954c25732afe7454878da25198d31c", "score": "0.5378716", "text": "func (*ListInstancesInstanceGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{718}\n}", "title": "" }, { "docid": "b0d0d70ec8650b1c8beff1402f620d51", "score": "0.53749377", "text": "func (*AggregatedListNodeTypesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{837}\n}", "title": "" }, { "docid": "ade8872c9bde73378b0b37e9ceec6c70", "score": "0.5371508", "text": "func (*RespParacrossNodeGroups) Descriptor() ([]byte, []int) {\n\treturn file_paranodegroup_proto_rawDescGZIP(), []int{12}\n}", "title": "" }, { "docid": "ff633ba588fe7a380fb7cafac2761c43", "score": "0.5367648", "text": "func (*InstanceGroupsRemoveInstancesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{221}\n}", "title": "" }, { "docid": "0821d3ac108ddd6bb17033423c154570", "score": "0.5367444", "text": "func (*UpdateNodeAttributes) Descriptor() ([]byte, []int) {\n\treturn file_interservice_infra_proxy_request_nodes_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "f3393be2b24667d3d5dbd83e11213bee", "score": "0.5351097", "text": "func (*Nodes) Descriptor() ([]byte, []int) {\n\treturn file_external_nodes_nodes_proto_rawDescGZIP(), []int{7}\n}", "title": "" }, { "docid": "e67ecbfb64d793833766d48f454b197b", "score": "0.5351095", "text": "func (*GroupsCreate) Descriptor() ([]byte, []int) {\n\treturn file_chat_groups_proto_rawDescGZIP(), []int{0}\n}", "title": "" }, { "docid": "9e2722c6d2c074d58162d7d39d586fd8", "score": "0.5347528", "text": "func (*InsertRegionInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{920}\n}", "title": "" }, { "docid": "46b9476085e8ea5dfd93aa888321cfe8", "score": "0.5345554", "text": "func (*NodeGroup) Descriptor() ([]byte, []int) {\n\treturn file_influxdata_iox_management_v1_shard_proto_rawDescGZIP(), []int{4}\n}", "title": "" }, { "docid": "a90fcbb11066bb25bac1b31e08330617", "score": "0.53445095", "text": "func (*UpdatePerInstanceConfigsInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{711}\n}", "title": "" }, { "docid": "0d3d4dc0fe58346497c14fd6f333e226", "score": "0.53335583", "text": "func (*SetNamedPortsRegionInstanceGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{935}\n}", "title": "" }, { "docid": "7132eeab64285539f43c51e37c748623", "score": "0.53311783", "text": "func (*ListRegionNetworkEndpointGroupsRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{940}\n}", "title": "" }, { "docid": "0d93fa91f28cd10d15f69f5751af421d", "score": "0.5328526", "text": "func (*PatchPerInstanceConfigsInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{706}\n}", "title": "" }, { "docid": "a27c692ae36830ac6cc095934613ff74", "score": "0.53267646", "text": "func (*ApplyUpdatesToInstancesInstanceGroupManagerRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{694}\n}", "title": "" }, { "docid": "f6ba68f045eabf407559f7e556cfbb05", "score": "0.53247225", "text": "func (*GenerateNodeInterfaceNameRequest) Descriptor() ([]byte, []int) {\n\treturn file_daemon_proto_meshnet_v1beta1_meshnet_proto_rawDescGZIP(), []int{10}\n}", "title": "" }, { "docid": "1e394af346ec93aecf49fcd968b0b85a", "score": "0.53213173", "text": "func (*GroupsAddUser) Descriptor() ([]byte, []int) {\n\treturn file_chat_groups_proto_rawDescGZIP(), []int{1}\n}", "title": "" }, { "docid": "9ccf2aa1c2ba69e1856926028f7160cc", "score": "0.53041667", "text": "func (*CountAllUpgradeNSNodesWithNSClusterIdRequest) Descriptor() ([]byte, []int) {\n\treturn file_service_ns_node_proto_rawDescGZIP(), []int{6}\n}", "title": "" }, { "docid": "b8245480583add1b7eb2a6e7c381f33b", "score": "0.5294198", "text": "func (*ListInstanceGroupManagersRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{701}\n}", "title": "" }, { "docid": "97c53c6e5729b76bf686ce5464c81096", "score": "0.5285106", "text": "func (*AddClusterRequest) Descriptor() ([]byte, []int) {\n\treturn file_teleport_lib_teleterm_v1_service_proto_rawDescGZIP(), []int{22}\n}", "title": "" }, { "docid": "5bdc992b532941e342eabd196f8232b0", "score": "0.52837086", "text": "func (*UpdateNodeCapacityRequest) Descriptor() ([]byte, []int) {\n\treturn file_pkg_agent_api_v1_api_proto_rawDescGZIP(), []int{5}\n}", "title": "" }, { "docid": "142cf01f5aae165d28215f9e7d45b03b", "score": "0.5269354", "text": "func (*UpdateWalletGroupRequest) Descriptor() ([]byte, []int) {\n\treturn file_gincoinc_adamant_global_v1_adamantglobalv1_global_api_proto_rawDescGZIP(), []int{34}\n}", "title": "" }, { "docid": "b0407f4aada0984429b9f0a2a43b2d74", "score": "0.5268249", "text": "func (*NetworkEndpointGroupsScopedList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{293}\n}", "title": "" }, { "docid": "ee0f517cc3af0be1ab4a464ebe877b5a", "score": "0.52669567", "text": "func (*ListNodeTypesRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{839}\n}", "title": "" }, { "docid": "84bbc199aebc593bee1e0ac84afed76f", "score": "0.5263001", "text": "func (*NodeTypesScopedList) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{325}\n}", "title": "" }, { "docid": "11d1ee3fed939448c68ba957fd0c4ac5", "score": "0.5261526", "text": "func (*SetLabelsGlobalForwardingRuleRequest) Descriptor() ([]byte, []int) {\n\treturn file_google_cloud_compute_v1_compute_proto_rawDescGZIP(), []int{650}\n}", "title": "" } ]
e3c6d0876ca6cecea9a351e73d475df2
Tx returns an `ent.Tx` for mutations that were executed in transactions; it returns an error otherwise.
[ { "docid": "6840f5eb563b8207f4494ec0ad4858d7", "score": "0.6950203", "text": "func (m UserMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" } ]
[ { "docid": "2d06f4c50688c798838f59960c8b3cb4", "score": "0.74548316", "text": "func (m GoodsMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "c36035abfa4ed0175dbd590c5d668802", "score": "0.744809", "text": "func (m LikeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "8bc1efd92b97e665e6da901c48d00cee", "score": "0.7408768", "text": "func (m GoodsSpecsMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "92d6c33215c458af390582014f34e8ac", "score": "0.73666286", "text": "func (m GoodsClassifyMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "6089f27b6dc452cef9c778ce53def0e7", "score": "0.7337296", "text": "func (m StatustMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "2c60e27a44c666034da4229b327c6cea", "score": "0.7303351", "text": "func (m APIMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "3b52c87901fb845339d3ca4d0a67625e", "score": "0.7287332", "text": "func (m StatementEndingBalancMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "c3139627c151db0941b5b6c681a86537", "score": "0.7263128", "text": "func (m OccupationhistoryMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "c939f983460454f8d8cbad7a80d49a0e", "score": "0.71897626", "text": "func (m CheckoutMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "99e6fb433393e487198a139dfbf61441", "score": "0.71858525", "text": "func (m BuildingMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "99e6fb433393e487198a139dfbf61441", "score": "0.71858525", "text": "func (m BuildingMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "0a8b5d3d89e86c66443bef51da904bb7", "score": "0.71727", "text": "func (m PermissionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "f069cebca296bd844e5d2d778193c8e6", "score": "0.7169262", "text": "func (m BillingstatusMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "6a9f3fbe31ff905e98bad1e888b0c3ed", "score": "0.7165347", "text": "func (m VlanMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "27f5273099f40f13b96a1e2763980f87", "score": "0.7165063", "text": "func (m PointtransactionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "7ba2445bc4217d06ef939409f03d14bf", "score": "0.71650577", "text": "func (m BulkMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "07bbd86e4e549d21742f4453aa45ee50", "score": "0.71586025", "text": "func (m FundMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "cedd6b6d196b4a21c9c544f8dff2129f", "score": "0.71554995", "text": "func (m CoveredPersonMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "0f34be3e37402ee40002626936d10946", "score": "0.7152102", "text": "func (m UserStatusMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "002796f72312f9ab3432c940cc48e4c4", "score": "0.71491706", "text": "func (m PointkycrvMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4519d5ac702515f09fc5b370618a12c3", "score": "0.7148554", "text": "func (m GroupInfoMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "86877be5d39e1499e0009604caca3bc9", "score": "0.7140942", "text": "func (m OptMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "8771549033a9e74b8db5d761c4d675c9", "score": "0.71404374", "text": "func (m CampaignMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "848852216d2aaa13459aef2024037aba", "score": "0.7139384", "text": "func (m AgentkycMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "26a2714cffa517d2897dee4939064677", "score": "0.71338344", "text": "func (m FileimportMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "407d35e9457c8e4e05d9a76246bebb56", "score": "0.7132073", "text": "func (m ReturninvoiceMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "1037d518f7fd48ed5989db58404dad73", "score": "0.71311486", "text": "func (m ItemMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "3e73868420f45067fcd6adfa46471b79", "score": "0.7117708", "text": "func (m GoodsSpecsOptionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "a1974bc3d765648ca694f7379a17a70f", "score": "0.71158576", "text": "func (m CityMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "e1f1624efeda82b533af97162424afdf", "score": "0.7108793", "text": "func (m CertificateMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "52690ac8e5b06f151b3a3e602b6c4125", "score": "0.7107089", "text": "func (m StatusRMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "8b5eec90e2a4e4b224b919a371a81f7f", "score": "0.71054107", "text": "func (m AccountMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "15e958fe1599acf7833d7c4dd45b3fee", "score": "0.710518", "text": "func (m PetMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4d1ba8e7aa511ddec37f3711b3383d2e", "score": "0.7102412", "text": "func (m MerchantTransactionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "94b0682de2f4b215dde7c6968afe9b43", "score": "0.71011657", "text": "func (m BookstatusMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "89469c8dd2d5081ac9125a78a0b7aa53", "score": "0.7098936", "text": "func (m FileinsertMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4d27c3cf83d0d862344436fea27bbb74", "score": "0.7098473", "text": "func (m SymptomMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "9e3b059b97a9d101c9b38affd032fc6c", "score": "0.70981616", "text": "func (m PartMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "973bf3f0d59448d4a5f6f4ae5546e400", "score": "0.70978045", "text": "func (m FileMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "b45ceef852ec9ed7c29888a5145a6ea7", "score": "0.70967066", "text": "func (m AreahistoryMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "422926e29a3f7db2c89d59bb610744d1", "score": "0.7096249", "text": "func (m DetectionJobInstanceMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "9a92fa1eaf5df4d7f0aadf38786d8791", "score": "0.7095989", "text": "func (m BankMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4e869b8daee3367739ee76814cb2296a", "score": "0.7095979", "text": "func (m PointpendingkyctransactionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "77a825bad4d062a9f6e1d03e1713985e", "score": "0.7095838", "text": "func (m LimitpointMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4f22d5f96895ca8666c53f5462a38f63", "score": "0.7095317", "text": "func (m RoomInfoMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "05f0776bbf62f5e920de60cbb0d29260", "score": "0.7091291", "text": "func (m TaskMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "2e07bdce2520fdb0b6177d6dadf1c650", "score": "0.709111", "text": "func (m RankingMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "db4258ed012720244c6443d29c32caac", "score": "0.709103", "text": "func (m ConsumerMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "78fe353963bd88581ea14236afb5e830", "score": "0.7089162", "text": "func (m DepartmentMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "fc6f446c71140e3c535e32f8bb343ae2", "score": "0.7084016", "text": "func (m NodeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "2712716adf631d912baaf14c2085355c", "score": "0.7083876", "text": "func (m NetInterfaceMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "2dab74d7a9a3d2e08f02d6e3c55d3438", "score": "0.7082855", "text": "func (m NetTopologyMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "7ae87a4f0fa4260e283060ce268878e6", "score": "0.7082323", "text": "func (m AgenttypeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "fbd38148fb95ef2d8d627414b412d61b", "score": "0.70789593", "text": "func (m RoomStatusMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "814d35af85ece8b52dc8378cd0f405db", "score": "0.70697486", "text": "func (m DetectionJobMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "f6ae1ad22fe071de2c2db2ffa04c0abe", "score": "0.7067111", "text": "func (m LicenseMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "1d238c0b2cf9cb943a6f90ff034e8479", "score": "0.7061936", "text": "func (m ConfirmationMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "7c531ff965a52f0bd0da0172583c95c1", "score": "0.7061902", "text": "func (m NodeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "9a05cd23b4e43f14f25e12c2972616af", "score": "0.70541847", "text": "func (m GoodsSpuImgsMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "b06b60aae2ff9f635f671f0f2a400cec", "score": "0.7053071", "text": "func (m PartorderMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "4812311c571b07edbbe89461270744dc", "score": "0.70521545", "text": "func (m BankdetailMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "5a4c01c2f7fedd7d2ca620feace5b064", "score": "0.70487547", "text": "func (m JobMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "452fa8370ee014c25511c309350b69a7", "score": "0.7037241", "text": "func (m LogexportMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "6f51a6b764737ccb6bd0f50b20f2338a", "score": "0.7031454", "text": "func (m TagMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "6f51a6b764737ccb6bd0f50b20f2338a", "score": "0.7031454", "text": "func (m TagMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "49add8b70d7c38c8c202e96368b3978f", "score": "0.7016129", "text": "func (m PointpendinglbtransactionMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "9d70c95433f931d9e68b429de14f5183", "score": "0.7015939", "text": "func (m PatientMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "9d70c95433f931d9e68b429de14f5183", "score": "0.7015939", "text": "func (m PatientMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "c3a558d71cf7d0938b070bc12c4075d0", "score": "0.70158714", "text": "func (m RestaurantMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "e05054e91f9f54556d63a60d43e0cc87", "score": "0.70155644", "text": "func (m PendingkycMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "bd0510acb7279e479026e86b36926e4a", "score": "0.70144624", "text": "func (m DoctorMutation) Tx() (*Tx, error) {\r\n\tif _, ok := m.driver.(*txDriver); !ok {\r\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\r\n\t}\r\n\ttx := &Tx{config: m.config}\r\n\ttx.init()\r\n\treturn tx, nil\r\n}", "title": "" }, { "docid": "f2c9d5a989564b69beefa61bad2c94ed", "score": "0.7014429", "text": "func (m AdministratorMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "ae0bfc873a8875613240322ca1891cce", "score": "0.70139676", "text": "func (m TodoMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"entity: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "f0981ed1f956260050c4517532a131bd", "score": "0.70118195", "text": "func (m SchemeTypeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "5fb432c398f5578acc2cc15b05ed2133", "score": "0.7010867", "text": "func (m NetInterfaceLayerMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "cc77562828fad2f3c1abf18aa48d0f5f", "score": "0.70089346", "text": "func (m DegreeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "dfc98f817ab09acd4aa4323adb5a5fa7", "score": "0.7004999", "text": "func (m SpecMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "091641d88ba53e175026ef9bff33df65", "score": "0.7002422", "text": "func (m BasicLinkMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "227e84b57250bb5299f430c14b97b293", "score": "0.70022136", "text": "func (m PostMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "072cc1ec075a72f4411f6f4bf8b64946", "score": "0.70019037", "text": "func (m MediaMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"models: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "fe19c2fce928d75db5d10d23d2807f53", "score": "0.6999059", "text": "func (m CountryMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "3104197535daa8f0f17dfe5e4c19b59d", "score": "0.698875", "text": "func (m BranchMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "3104197535daa8f0f17dfe5e4c19b59d", "score": "0.698875", "text": "func (m BranchMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "84fa64775ae75c1d08196e2c962a5339", "score": "0.6988148", "text": "func (m WatchlistMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "6c96e278a70c618598827fb522826b14", "score": "0.698793", "text": "func (m BookMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "d1ceb1c2bfba559721714208c7566389", "score": "0.69784266", "text": "func (m DoctorMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "1ebb742412b1d5340e1ee1d71fa8a65e", "score": "0.6975786", "text": "func (m RepairInvoiceMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "84a93ecedc8e0bbbd879816f100f7835", "score": "0.6961326", "text": "func (m UserMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "2255f41ff9e37ebaccd0d8be70909226", "score": "0.69545764", "text": "func (m OrderInfoMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "7d7f9a3db87778538f6174b554487d39", "score": "0.69531214", "text": "func (m FieldTypeMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, errors.New(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" }, { "docid": "7b2eb55d850208d2d11a0ac8b6cf598a", "score": "0.6949277", "text": "func (m OrganizationMutation) Tx() (*Tx, error) {\n\tif _, ok := m.driver.(*txDriver); !ok {\n\t\treturn nil, fmt.Errorf(\"ent: mutation is not running in a transaction\")\n\t}\n\ttx := &Tx{config: m.config}\n\ttx.init()\n\treturn tx, nil\n}", "title": "" } ]
7c0900f46eb44319534ef6cd7290913c
InputLossActionForHlsOut_Values returns all elements of the InputLossActionForHlsOut enum
[ { "docid": "1539e44278bed6906ba337c632747653", "score": "0.8585292", "text": "func InputLossActionForHlsOut_Values() []string {\n\treturn []string{\n\t\tInputLossActionForHlsOutEmitOutput,\n\t\tInputLossActionForHlsOutPauseOutput,\n\t}\n}", "title": "" } ]
[ { "docid": "9e1963bf92812dc7dd2cfaf0fb44ae3b", "score": "0.7785944", "text": "func InputLossActionForUdpOut_Values() []string {\n\treturn []string{\n\t\tInputLossActionForUdpOutDropProgram,\n\t\tInputLossActionForUdpOutDropTs,\n\t\tInputLossActionForUdpOutEmitProgram,\n\t}\n}", "title": "" }, { "docid": "b85d0f2895f825471beb2efdd837dab2", "score": "0.7288842", "text": "func InputLossActionForMsSmoothOut_Values() []string {\n\treturn []string{\n\t\tInputLossActionForMsSmoothOutEmitOutput,\n\t\tInputLossActionForMsSmoothOutPauseOutput,\n\t}\n}", "title": "" }, { "docid": "01bc3bcee3117ab19ae3dad456249477", "score": "0.7252142", "text": "func InputLossActionForRtmpOut_Values() []string {\n\treturn []string{\n\t\tInputLossActionForRtmpOutEmitOutput,\n\t\tInputLossActionForRtmpOutPauseOutput,\n\t}\n}", "title": "" }, { "docid": "78a7bff33915110f1ca0b14e450fd7bc", "score": "0.5930331", "text": "func InputLossImageType_Values() []string {\n\treturn []string{\n\t\tInputLossImageTypeColor,\n\t\tInputLossImageTypeSlate,\n\t}\n}", "title": "" }, { "docid": "27317b226ceb7db3fe397d58c57daae5", "score": "0.5359245", "text": "func GlobalConfigurationInputEndAction_Values() []string {\n\treturn []string{\n\t\tGlobalConfigurationInputEndActionNone,\n\t\tGlobalConfigurationInputEndActionSwitchAndLoopInputs,\n\t}\n}", "title": "" }, { "docid": "9eaeb9e1f240712c2f49c113d5c86feb", "score": "0.5337192", "text": "func (UpdateActionStatus) Values() []UpdateActionStatus {\n\treturn []UpdateActionStatus{\n\t\t\"not-applied\",\n\t\t\"waiting-to-start\",\n\t\t\"in-progress\",\n\t\t\"stopping\",\n\t\t\"stopped\",\n\t\t\"complete\",\n\t\t\"scheduling\",\n\t\t\"scheduled\",\n\t\t\"not-applicable\",\n\t}\n}", "title": "" }, { "docid": "0a3792278c8e8c7840c17b30d35198ea", "score": "0.5309015", "text": "func HlsOutputSelection_Values() []string {\n\treturn []string{\n\t\tHlsOutputSelectionManifestsAndSegments,\n\t\tHlsOutputSelectionSegmentsOnly,\n\t\tHlsOutputSelectionVariantManifestsAndSegments,\n\t}\n}", "title": "" }, { "docid": "537269034b33f08ed8f5a329f713c0d1", "score": "0.526116", "text": "func InputStatus_Values() []string {\n\treturn []string{\n\t\tInputStatusCreating,\n\t\tInputStatusUpdating,\n\t\tInputStatusActive,\n\t\tInputStatusDeleting,\n\t}\n}", "title": "" }, { "docid": "a64a3fe283c112b2c43a30f8055e934c", "score": "0.5229506", "text": "func (ActionOnFailure) Values() []ActionOnFailure {\n\treturn []ActionOnFailure{\n\t\t\"TERMINATE_JOB_FLOW\",\n\t\t\"TERMINATE_CLUSTER\",\n\t\t\"CANCEL_AND_WAIT\",\n\t\t\"CONTINUE\",\n\t}\n}", "title": "" }, { "docid": "a76b107f68f6695c5007b87f98b6d666", "score": "0.5086183", "text": "func (SpotProvisioningTimeoutAction) Values() []SpotProvisioningTimeoutAction {\n\treturn []SpotProvisioningTimeoutAction{\n\t\t\"SWITCH_TO_ON_DEMAND\",\n\t\t\"TERMINATE_CLUSTER\",\n\t}\n}", "title": "" }, { "docid": "104125b90071f33d2bdbfeadbf8c6d9c", "score": "0.5041755", "text": "func TargetHealthReason_Values() []string {\n\treturn []string{\n\t\tTargetHealthReasonUnreachable,\n\t\tTargetHealthReasonConnectionFailed,\n\t\tTargetHealthReasonAuthFailure,\n\t\tTargetHealthReasonPendingProxyCapacity,\n\t\tTargetHealthReasonInvalidReplicationState,\n\t}\n}", "title": "" }, { "docid": "c2a6ec373f647f0831618c997354ab0f", "score": "0.50101763", "text": "func (IngestionStatus) Values() []IngestionStatus {\n\treturn []IngestionStatus{\n\t\t\"PENDING\",\n\t\t\"FAILED\",\n\t\t\"SUCCESS\",\n\t\t\"RUNNING\",\n\t\t\"STOP_REQUESTED\",\n\t}\n}", "title": "" }, { "docid": "17386ee0cd6b42914a3412e2394a439e", "score": "0.49363884", "text": "func (o ActionRuleSuppressionConditionSeverityOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionSeverity) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "d11c0dcc1653788d3fffbc2ee701b565", "score": "0.49277264", "text": "func (StepStateChangeReasonCode) Values() []StepStateChangeReasonCode {\n\treturn []StepStateChangeReasonCode{\n\t\t\"NONE\",\n\t}\n}", "title": "" }, { "docid": "9b74459d2ee2f4d7532a24422c1c1d6c", "score": "0.49276295", "text": "func (l RequestOkLabels) Values() []string {\n\treturn []string{l.SegType.String(), strconv.FormatBool(l.CacheOnly), l.DstISD.String()}\n}", "title": "" }, { "docid": "011785f4d16281c14fdfeb9e2c8730d0", "score": "0.49244732", "text": "func (o ActionRuleActionGroupConditionSeverityOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleActionGroupConditionSeverity) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5745382c6acba5bc1f0b4bbbed731485", "score": "0.49170256", "text": "func (HookFailureMode) Values() []HookFailureMode {\n\treturn []HookFailureMode{\n\t\t\"FAIL\",\n\t\t\"WARN\",\n\t}\n}", "title": "" }, { "docid": "515b7f9b321eb2790dad72b4985c9096", "score": "0.49147594", "text": "func PossibleHighAvailabilityStateValues() []HighAvailabilityState {\n\treturn []HighAvailabilityState{\n\t\tHighAvailabilityStateCreatingStandby,\n\t\tHighAvailabilityStateFailingOver,\n\t\tHighAvailabilityStateHealthy,\n\t\tHighAvailabilityStateNotEnabled,\n\t\tHighAvailabilityStateRemovingStandby,\n\t}\n}", "title": "" }, { "docid": "f17ab354d2c7df49ff3fa92b634f4e56", "score": "0.48917726", "text": "func (MacieStatus) Values() []MacieStatus {\n\treturn []MacieStatus{\n\t\t\"PAUSED\",\n\t\t\"ENABLED\",\n\t}\n}", "title": "" }, { "docid": "f7c44fb56e0b1532035339a4d798f34f", "score": "0.4861717", "text": "func InputSecurityGroupState_Values() []string {\n\treturn []string{\n\t\tInputSecurityGroupStateIdle,\n\t\tInputSecurityGroupStateInUse,\n\t\tInputSecurityGroupStateUpdating,\n\t\tInputSecurityGroupStateDeleted,\n\t}\n}", "title": "" }, { "docid": "a694a3d8a9aaf4924aec21d454c8d72d", "score": "0.48545617", "text": "func (InstanceFleetStateChangeReasonCode) Values() []InstanceFleetStateChangeReasonCode {\n\treturn []InstanceFleetStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"VALIDATION_ERROR\",\n\t\t\"INSTANCE_FAILURE\",\n\t\t\"CLUSTER_TERMINATED\",\n\t}\n}", "title": "" }, { "docid": "f3c2e578a679ae00be9448374f392a40", "score": "0.4840333", "text": "func (page ActionsListPage) Values() []ActionResponse {\n\tif page.al.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.al.Value\n}", "title": "" }, { "docid": "8ccbbf3bb374c1f86d3e09168864fc2e", "score": "0.48391107", "text": "func (o ActionRuleSuppressionConditionAlertRuleIdOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionAlertRuleId) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b7615c3c1d2c3a81128fc6d47d973c6d", "score": "0.48364228", "text": "func (OnFailure) Values() []OnFailure {\n\treturn []OnFailure{\n\t\t\"DO_NOTHING\",\n\t\t\"ROLLBACK\",\n\t\t\"DELETE\",\n\t}\n}", "title": "" }, { "docid": "ad9d4ab748d3f05a8ff1d38b9a3b0d92", "score": "0.4835766", "text": "func (o AlertProcessingRuleActionGroupConditionSeverityOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupConditionSeverity) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "1c2913a5b83f21b5b64ec4ed120c90e3", "score": "0.4820116", "text": "func (o ActionRuleSuppressionConditionMonitorOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionMonitor) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "976efaa1d543824b0c677d2177c9c3cb", "score": "0.4818166", "text": "func (KeywordAction) Values() []KeywordAction {\n\treturn []KeywordAction{\n\t\t\"AUTOMATIC_RESPONSE\",\n\t\t\"OPT_OUT\",\n\t\t\"OPT_IN\",\n\t}\n}", "title": "" }, { "docid": "38a0347a322d4f5c1e7f51b7086e257e", "score": "0.48146406", "text": "func (AlarmStateName) Values() []AlarmStateName {\n\treturn []AlarmStateName{\n\t\t\"DISABLED\",\n\t\t\"NORMAL\",\n\t\t\"ACTIVE\",\n\t\t\"ACKNOWLEDGED\",\n\t\t\"SNOOZE_DISABLED\",\n\t\t\"LATCHED\",\n\t}\n}", "title": "" }, { "docid": "6eab7b6d7f3b46ccd58f692e8b51d28a", "score": "0.4805247", "text": "func (o ActionRuleSuppressionConditionSeverityPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ActionRuleSuppressionConditionSeverity) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "5b24958c6c88b1a7bf1613c89401fc9d", "score": "0.48009738", "text": "func (o ActionRuleActionGroupConditionSeverityPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ActionRuleActionGroupConditionSeverity) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "9278f5ac5dfd324b6eb666d63814f159", "score": "0.47945875", "text": "func (OptedOutFilterName) Values() []OptedOutFilterName {\n\treturn []OptedOutFilterName{\n\t\t\"end-user-opted-out\",\n\t}\n}", "title": "" }, { "docid": "75236e8723ec74094d723ae0f10b2a7b", "score": "0.47936735", "text": "func InputDeviceState_Values() []string {\n\treturn []string{\n\t\tInputDeviceStateIdle,\n\t\tInputDeviceStateStreaming,\n\t}\n}", "title": "" }, { "docid": "5c92b4da3454c5f3cb2f7a4538fea089", "score": "0.47889215", "text": "func (MessageAction) Values() []MessageAction {\n\treturn []MessageAction{\n\t\t\"SUPPRESS\",\n\t\t\"RESEND\",\n\t}\n}", "title": "" }, { "docid": "7d062791bfeadb16ea52734fb35de75f", "score": "0.47768047", "text": "func (o AlertProcessingRuleSuppressionConditionSeverityOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionSeverity) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "228aef40e26fe89d231ccb9b2802adfb", "score": "0.4770196", "text": "func (InstanceGroupStateChangeReasonCode) Values() []InstanceGroupStateChangeReasonCode {\n\treturn []InstanceGroupStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"VALIDATION_ERROR\",\n\t\t\"INSTANCE_FAILURE\",\n\t\t\"CLUSTER_TERMINATED\",\n\t}\n}", "title": "" }, { "docid": "6325b4d04ef5f7f60f606205d33944b1", "score": "0.47695097", "text": "func (OutpostMode) Values() []OutpostMode {\n\treturn []OutpostMode{\n\t\t\"single-outpost\",\n\t\t\"cross-outpost\",\n\t}\n}", "title": "" }, { "docid": "d3c31379e3d9e521d19e8810401f5785", "score": "0.476811", "text": "func InputState_Values() []string {\n\treturn []string{\n\t\tInputStateCreating,\n\t\tInputStateDetached,\n\t\tInputStateAttached,\n\t\tInputStateDeleting,\n\t\tInputStateDeleted,\n\t}\n}", "title": "" }, { "docid": "a9e8fa4b7046d0b169ef01d4300ef55d", "score": "0.47595397", "text": "func (HandshakeState) Values() []HandshakeState {\n\treturn []HandshakeState{\n\t\t\"REQUESTED\",\n\t\t\"OPEN\",\n\t\t\"CANCELED\",\n\t\t\"ACCEPTED\",\n\t\t\"DECLINED\",\n\t\t\"EXPIRED\",\n\t}\n}", "title": "" }, { "docid": "29760375d0b0ac2769bcd170334ef28e", "score": "0.47583306", "text": "func (EventType) Values() []EventType {\n\treturn []EventType{\n\t\t\"STATE_CHANGE\",\n\t}\n}", "title": "" }, { "docid": "501abd94ab46e91ce241ee38b0e0d785", "score": "0.47567415", "text": "func (o ActionRuleSuppressionConditionDescriptionOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionDescription) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "23c3aa40d0e2e170db7d0050c17117f2", "score": "0.47490004", "text": "func (page OutputListResultPage) Values() []Output {\n\tif page.olr.IsEmpty() {\n\t\treturn nil\n\t}\n\treturn *page.olr.Value\n}", "title": "" }, { "docid": "7fa21e708364514f8c42f81babbe44a9", "score": "0.47423455", "text": "func (OnStackFailure) Values() []OnStackFailure {\n\treturn []OnStackFailure{\n\t\t\"DO_NOTHING\",\n\t\t\"ROLLBACK\",\n\t\t\"DELETE\",\n\t}\n}", "title": "" }, { "docid": "ff1d3da8a14b97c29d6462dabf08de0b", "score": "0.473282", "text": "func (AutoScalingPolicyStateChangeReasonCode) Values() []AutoScalingPolicyStateChangeReasonCode {\n\treturn []AutoScalingPolicyStateChangeReasonCode{\n\t\t\"USER_REQUEST\",\n\t\t\"PROVISION_FAILURE\",\n\t\t\"CLEANUP_FAILURE\",\n\t}\n}", "title": "" }, { "docid": "94f2e2f783e5c2f30a68f7a88b61bd16", "score": "0.4728256", "text": "func (ServiceUpdateSeverity) Values() []ServiceUpdateSeverity {\n\treturn []ServiceUpdateSeverity{\n\t\t\"critical\",\n\t\t\"important\",\n\t\t\"medium\",\n\t\t\"low\",\n\t}\n}", "title": "" }, { "docid": "2b3e9fb08a3d71b847e86fb00f42e1fc", "score": "0.47266376", "text": "func M2tsAbsentInputAudioBehavior_Values() []string {\n\treturn []string{\n\t\tM2tsAbsentInputAudioBehaviorDrop,\n\t\tM2tsAbsentInputAudioBehaviorEncodeSilence,\n\t}\n}", "title": "" }, { "docid": "1f9024f0ef369a8b9d673042e34115a8", "score": "0.47109798", "text": "func (StackInstanceStatus) Values() []StackInstanceStatus {\n\treturn []StackInstanceStatus{\n\t\t\"CURRENT\",\n\t\t\"OUTDATED\",\n\t\t\"INOPERABLE\",\n\t}\n}", "title": "" }, { "docid": "a9bf41a9892bc770d887c4d82ca7abea", "score": "0.47105023", "text": "func (LayerFailureCode) Values() []LayerFailureCode {\n\treturn []LayerFailureCode{\n\t\t\"InvalidLayerDigest\",\n\t\t\"MissingLayerDigest\",\n\t}\n}", "title": "" }, { "docid": "d5610395e04a551e5509230049f7ceff", "score": "0.47042963", "text": "func (Action) Values() []Action {\n\treturn []Action{\n\t\t\"CLIPBOARD_COPY_FROM_LOCAL_DEVICE\",\n\t\t\"CLIPBOARD_COPY_TO_LOCAL_DEVICE\",\n\t\t\"FILE_UPLOAD\",\n\t\t\"FILE_DOWNLOAD\",\n\t\t\"PRINTING_TO_LOCAL_DEVICE\",\n\t}\n}", "title": "" }, { "docid": "2c2f1c3ac8322fcaeb3afb4cf00c03ff", "score": "0.47039506", "text": "func (StackSetOperationAction) Values() []StackSetOperationAction {\n\treturn []StackSetOperationAction{\n\t\t\"CREATE\",\n\t\t\"UPDATE\",\n\t\t\"DELETE\",\n\t\t\"DETECT_DRIFT\",\n\t}\n}", "title": "" }, { "docid": "72e5dd79915396f3dce0e6f1fa0f7fae", "score": "0.47013924", "text": "func (o ActionRuleSuppressionConditionMonitorServiceOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionMonitorService) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "83c572bf1be1d329f7f25eacb2cea2ce", "score": "0.46955994", "text": "func (o AlertProcessingRuleSuppressionConditionSignalTypeOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionSignalType) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "9d0d72768b4961322cb05524574dbf2d", "score": "0.46952355", "text": "func (o ActionRuleSuppressionConditionDescriptionPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ActionRuleSuppressionConditionDescription) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "7da01c8d8b1cd5b08b0a9f3af3772e72", "score": "0.4694926", "text": "func InsightStatus_Values() []string {\n\treturn []string{\n\t\tInsightStatusOngoing,\n\t\tInsightStatusClosed,\n\t}\n}", "title": "" }, { "docid": "e9de656a657e281a7da5c0436a762a17", "score": "0.46925613", "text": "func GetPatchSummaryLastActionEnumValues() []PatchSummaryLastActionEnum {\n\tvalues := make([]PatchSummaryLastActionEnum, 0)\n\tfor _, v := range mappingPatchSummaryLastAction {\n\t\tvalues = append(values, v)\n\t}\n\treturn values\n}", "title": "" }, { "docid": "e13a36b4cf73444c16a380f69e250608", "score": "0.4692524", "text": "func (o ActionRuleActionGroupConditionAlertRuleIdOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleActionGroupConditionAlertRuleId) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "13482258555c1f1832d1dd1198fc5cb1", "score": "0.46925187", "text": "func (StackSetOperationStatus) Values() []StackSetOperationStatus {\n\treturn []StackSetOperationStatus{\n\t\t\"RUNNING\",\n\t\t\"SUCCEEDED\",\n\t\t\"FAILED\",\n\t\t\"STOPPING\",\n\t\t\"STOPPED\",\n\t\t\"QUEUED\",\n\t}\n}", "title": "" }, { "docid": "0f35f6991b1012da977d4bbcf695fbda", "score": "0.46915647", "text": "func (o AlertProcessingRuleSuppressionConditionTargetResourceOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionTargetResource) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "6f149ac04db1f6efcfac5e454e229601", "score": "0.46849537", "text": "func (State) Values() []State {\n\treturn []State{\n\t\t\"OFFLINE\",\n\t\t\"ONLINE\",\n\t\t\"STARTING\",\n\t\t\"STOPPING\",\n\t\t\"START_FAILED\",\n\t\t\"STOP_FAILED\",\n\t}\n}", "title": "" }, { "docid": "95c2505227df90103ac447df006b8898", "score": "0.46834448", "text": "func determineOutcomes(s string) [2]string {\n\tvar output [2]string\n\tswitch s {\n\tcase \"win\":\n\t\toutput[0] = \"win\"\n\t\toutput[1] = \"loss\"\n\tcase \"loss\":\n\t\toutput[0] = \"loss\"\n\t\toutput[1] = \"win\"\n\tcase \"draw\":\n\t\toutput[0] = \"draw\"\n\t\toutput[1] = \"draw\"\n\t}\n\n\treturn output\n}", "title": "" }, { "docid": "d3ff7eaa19238a23bfd2200426a8c004", "score": "0.46830517", "text": "func (StackDriftDetectionStatus) Values() []StackDriftDetectionStatus {\n\treturn []StackDriftDetectionStatus{\n\t\t\"DETECTION_IN_PROGRESS\",\n\t\t\"DETECTION_FAILED\",\n\t\t\"DETECTION_COMPLETE\",\n\t}\n}", "title": "" }, { "docid": "a5240c3ad51159f5fcccf7372d4661ea", "score": "0.46805254", "text": "func (InstanceStateChangeReasonCode) Values() []InstanceStateChangeReasonCode {\n\treturn []InstanceStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"VALIDATION_ERROR\",\n\t\t\"INSTANCE_FAILURE\",\n\t\t\"BOOTSTRAP_FAILURE\",\n\t\t\"CLUSTER_TERMINATED\",\n\t}\n}", "title": "" }, { "docid": "b1431e6a42b7a448b6707c27242aa614", "score": "0.46795306", "text": "func (OperationStatus) Values() []OperationStatus {\n\treturn []OperationStatus{\n\t\t\"PENDING\",\n\t\t\"IN_PROGRESS\",\n\t\t\"SUCCESS\",\n\t\t\"FAILED\",\n\t}\n}", "title": "" }, { "docid": "ac94dba587955414a5e71df6e9ff0d31", "score": "0.4672591", "text": "func (StackSetOperationResultStatus) Values() []StackSetOperationResultStatus {\n\treturn []StackSetOperationResultStatus{\n\t\t\"PENDING\",\n\t\t\"RUNNING\",\n\t\t\"SUCCEEDED\",\n\t\t\"FAILED\",\n\t\t\"CANCELLED\",\n\t}\n}", "title": "" }, { "docid": "f2e2a58bc8e49b75825e94f9d925584d", "score": "0.46687856", "text": "func (ExportStatus) Values() []ExportStatus {\n\treturn []ExportStatus{\n\t\t\"IN_PROGRESS\",\n\t\t\"COMPLETED\",\n\t\t\"CANCELLED\",\n\t}\n}", "title": "" }, { "docid": "646d226deef1b9b5c0c6067d1722c26e", "score": "0.46670792", "text": "func TargetState_Values() []string {\n\treturn []string{\n\t\tTargetStateRegistering,\n\t\tTargetStateAvailable,\n\t\tTargetStateUnavailable,\n\t}\n}", "title": "" }, { "docid": "171e67a4bc9e0c0ef04d971bcf9b98a7", "score": "0.4666959", "text": "func InsightSeverity_Values() []string {\n\treturn []string{\n\t\tInsightSeverityLow,\n\t\tInsightSeverityMedium,\n\t\tInsightSeverityHigh,\n\t}\n}", "title": "" }, { "docid": "71e86bc630858e5eaec38fa00172339d", "score": "0.46660975", "text": "func (o AlertProcessingRuleActionGroupConditionSeverityPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AlertProcessingRuleActionGroupConditionSeverity) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "db79d22a839ea05b4c07894ea1b2cfae", "score": "0.46646187", "text": "func (o ActionRuleActionGroupConditionMonitorOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleActionGroupConditionMonitor) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "128de71406147d691c31d3b7c6fc55fe", "score": "0.4663634", "text": "func (t *OpenconfigPlatform_Components_Component_Transceiver_PhysicalChannels_Channel_State_OutputPower) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OpenconfigPlatform_Components_Component_Transceiver_PhysicalChannels_Channel_State_OutputPower\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ca1e142da0708ce5d72271719c8186fe", "score": "0.46559113", "text": "func (Event) Values() []Event {\n\treturn []Event{\n\t\t\"discovered\",\n\t\t\"lost\",\n\t\t\"ack\",\n\t\t\"nack\",\n\t\t\"passthrough\",\n\t}\n}", "title": "" }, { "docid": "cfe89a36bb54ea20e7c50d018ad9e8d3", "score": "0.46545914", "text": "func (o ActionRuleSuppressionConditionAlertRuleIdPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *ActionRuleSuppressionConditionAlertRuleId) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "dcdfc41b2d186afe3ec608d4d892b918", "score": "0.46507668", "text": "func (ImageStateChangeReasonCode) Values() []ImageStateChangeReasonCode {\n\treturn []ImageStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"IMAGE_BUILDER_NOT_AVAILABLE\",\n\t\t\"IMAGE_COPY_FAILURE\",\n\t}\n}", "title": "" }, { "docid": "92e698aa5c1d958634eb423dfd43c2f1", "score": "0.46493933", "text": "func (eh *EventHappend) GetValues() interface{} {\n\treturn eh.Values\n}", "title": "" }, { "docid": "76f660daa56b626646d52e4fc3cfc319", "score": "0.46426177", "text": "func (t *OpenconfigPlatform_Components_Component_Transceiver_State_OutputPower) Validate(opts ...ygot.ValidationOption) error {\n\tif err := ytypes.Validate(SchemaTree[\"OpenconfigPlatform_Components_Component_Transceiver_State_OutputPower\"], t, opts...); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a535f4f1eecad83d4befe7a6646533df", "score": "0.46377763", "text": "func ActionValue_Values() []string {\n\treturn []string{\n\t\tActionValueAllow,\n\t\tActionValueBlock,\n\t\tActionValueCount,\n\t\tActionValueCaptcha,\n\t\tActionValueChallenge,\n\t\tActionValueExcludedAsCount,\n\t}\n}", "title": "" }, { "docid": "7b0926362b6f4cd63e8642aab843ef46", "score": "0.46339098", "text": "func (ImageBuilderStateChangeReasonCode) Values() []ImageBuilderStateChangeReasonCode {\n\treturn []ImageBuilderStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"IMAGE_UNAVAILABLE\",\n\t}\n}", "title": "" }, { "docid": "9984a4ed3a41469f991e1cfc951fc86b", "score": "0.46304587", "text": "func PossibleManagementOperationStateValues() []ManagementOperationState {\n\treturn []ManagementOperationState{ManagementOperationStateCancelInProgress, ManagementOperationStateCancelled, ManagementOperationStateFailed, ManagementOperationStateInProgress, ManagementOperationStatePending, ManagementOperationStateSucceeded}\n}", "title": "" }, { "docid": "9984a4ed3a41469f991e1cfc951fc86b", "score": "0.46304587", "text": "func PossibleManagementOperationStateValues() []ManagementOperationState {\n\treturn []ManagementOperationState{ManagementOperationStateCancelInProgress, ManagementOperationStateCancelled, ManagementOperationStateFailed, ManagementOperationStateInProgress, ManagementOperationStatePending, ManagementOperationStateSucceeded}\n}", "title": "" }, { "docid": "2874ac7fd9c954996e4b6cab6b5aa9ef", "score": "0.46293548", "text": "func (ClusterStateChangeReasonCode) Values() []ClusterStateChangeReasonCode {\n\treturn []ClusterStateChangeReasonCode{\n\t\t\"INTERNAL_ERROR\",\n\t\t\"VALIDATION_ERROR\",\n\t\t\"INSTANCE_FAILURE\",\n\t\t\"INSTANCE_FLEET_TIMEOUT\",\n\t\t\"BOOTSTRAP_FAILURE\",\n\t\t\"USER_REQUEST\",\n\t\t\"STEP_FAILURE\",\n\t\t\"ALL_STEPS_COMPLETED\",\n\t}\n}", "title": "" }, { "docid": "145bcd4fde0e6144770871f7269b510e", "score": "0.4627896", "text": "func (ServiceUpdateStatus) Values() []ServiceUpdateStatus {\n\treturn []ServiceUpdateStatus{\n\t\t\"available\",\n\t\t\"cancelled\",\n\t\t\"expired\",\n\t}\n}", "title": "" }, { "docid": "266f57273c99b46efa69b8433df2687d", "score": "0.4622061", "text": "func (StackSetDriftDetectionStatus) Values() []StackSetDriftDetectionStatus {\n\treturn []StackSetDriftDetectionStatus{\n\t\t\"COMPLETED\",\n\t\t\"FAILED\",\n\t\t\"PARTIAL_SUCCESS\",\n\t\t\"IN_PROGRESS\",\n\t\t\"STOPPED\",\n\t}\n}", "title": "" }, { "docid": "83924e33012fef4f884c95faf19aff31", "score": "0.46216592", "text": "func (o ActionRuleSuppressionConditionTargetResourceTypeOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionTargetResourceType) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "aee0cab63b1e3bdbde778e3f3313829e", "score": "0.46211174", "text": "func (LayerAvailability) Values() []LayerAvailability {\n\treturn []LayerAvailability{\n\t\t\"AVAILABLE\",\n\t\t\"UNAVAILABLE\",\n\t}\n}", "title": "" }, { "docid": "592862b52c30aedbdae8221edbc1733f", "score": "0.46201482", "text": "func HlsMode_Values() []string {\n\treturn []string{\n\t\tHlsModeLive,\n\t\tHlsModeVod,\n\t}\n}", "title": "" }, { "docid": "0eb762333a8764769455ea6a83795d5c", "score": "0.46152785", "text": "func (m *MSELoss) Inputs() Inputs {\n\treturn Inputs{}\n}", "title": "" }, { "docid": "58b549e140f97f50bc80abda6ac54aee", "score": "0.46149498", "text": "func (EncryptionStatus) Values() []EncryptionStatus {\n\treturn []EncryptionStatus{\n\t\t\"UPDATING\",\n\t\t\"ACTIVE\",\n\t}\n}", "title": "" }, { "docid": "6a88e1e27f9fc585c7312673144e9254", "score": "0.46143505", "text": "func (StackSetStatus) Values() []StackSetStatus {\n\treturn []StackSetStatus{\n\t\t\"ACTIVE\",\n\t\t\"DELETED\",\n\t}\n}", "title": "" }, { "docid": "7e1f48419fab98e0716567682f64c670", "score": "0.46112108", "text": "func PossibleManagementOperationStateValues() []ManagementOperationState {\n\treturn []ManagementOperationState{CancelInProgress, Cancelled, Failed, InProgress, Pending, Succeeded}\n}", "title": "" }, { "docid": "fb75389e8c9727af59310b6cb729a3b7", "score": "0.4611194", "text": "func (o AlertProcessingRuleSuppressionConditionTargetResourceTypeOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionTargetResourceType) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "55216082f2faea111d512fe2cc60d1b8", "score": "0.46107724", "text": "func (o AlertProcessingRuleSuppressionConditionAlertRuleIdOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionAlertRuleId) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "c74f4055deef252f96d4ae70a6a18256", "score": "0.46053746", "text": "func (o AlertProcessingRuleActionGroupConditionSignalTypeOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleActionGroupConditionSignalType) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "726583fd72c24e0f8ebbe50b12235822", "score": "0.4604866", "text": "func (o AlertProcessingRuleSuppressionConditionMonitorConditionOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionMonitorCondition) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "b48ae27d63fd2361bf5dd04139b7e85e", "score": "0.45993784", "text": "func (o AlertProcessingRuleSuppressionConditionAlertRuleNameOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v AlertProcessingRuleSuppressionConditionAlertRuleName) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "02b701341586a79ee14225eff589db66", "score": "0.45981672", "text": "func (o ActionRuleSuppressionConditionAlertContextOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v ActionRuleSuppressionConditionAlertContext) []string { return v.Values }).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "a0b0fd5ed59564e1f902daaa4749514c", "score": "0.45953166", "text": "func (o AlertProcessingRuleSuppressionConditionTargetResourcePtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AlertProcessingRuleSuppressionConditionTargetResource) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "daf7e94785668d3c5f51926b0cbccddb", "score": "0.45951965", "text": "func PossibleManagementOperationStateValues() []ManagementOperationState {\n\treturn []ManagementOperationState{\n\t\tManagementOperationStateCancelInProgress,\n\t\tManagementOperationStateCancelled,\n\t\tManagementOperationStateFailed,\n\t\tManagementOperationStateInProgress,\n\t\tManagementOperationStatePending,\n\t\tManagementOperationStateSucceeded,\n\t}\n}", "title": "" }, { "docid": "d1a2ca054135ffe06bcc56df685b63ff", "score": "0.4593757", "text": "func (UpdateDataRetentionOperation) Values() []UpdateDataRetentionOperation {\n\treturn []UpdateDataRetentionOperation{\n\t\t\"INCREASE_DATA_RETENTION\",\n\t\t\"DECREASE_DATA_RETENTION\",\n\t}\n}", "title": "" }, { "docid": "d1a2ca054135ffe06bcc56df685b63ff", "score": "0.4593757", "text": "func (UpdateDataRetentionOperation) Values() []UpdateDataRetentionOperation {\n\treturn []UpdateDataRetentionOperation{\n\t\t\"INCREASE_DATA_RETENTION\",\n\t\t\"DECREASE_DATA_RETENTION\",\n\t}\n}", "title": "" }, { "docid": "513466d40e1739fc625cee630af473c2", "score": "0.4591413", "text": "func (o AlertProcessingRuleSuppressionConditionSeverityPtrOutput) Values() pulumi.StringArrayOutput {\n\treturn o.ApplyT(func(v *AlertProcessingRuleSuppressionConditionSeverity) []string {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.Values\n\t}).(pulumi.StringArrayOutput)\n}", "title": "" }, { "docid": "02972fcf050384d7e7311844ed8bdeeb", "score": "0.4582266", "text": "func (s *BaseJavaListener) ExitEnumConstants(ctx *EnumConstantsContext) {}", "title": "" } ]
ee9c8d8bb3a52691fca1185d6a7707c4
WriteTo encode struct to buffer
[ { "docid": "6ba2f590184588c392a6265ec7fbab00", "score": "0.0", "text": "func (st *TLchannels_toggleSignatures) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = st.Channel.WriteBlock(_os, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = st.Enabled.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" } ]
[ { "docid": "aeb393f8c7ae3917445e6137f391c7db", "score": "0.64654684", "text": "func EncodeStruct(in interface{}) []byte {\n\tv := reflect.ValueOf(in)\n\tt := reflect.TypeOf(in)\n\tlength := v.NumField()\n\n\tout := bytes.NewBuffer([]byte{0xBF}) // Major type 5 additional 31 - Indefinite length map - used due to the length including unexported fields\n\tfor i := 0; i < length; i++ {\n\t\tif !v.Field(i).CanInterface() {\n\t\t\tcontinue\n\t\t}\n\t\tf := v.Field(i).Interface()\n\t\ts := t.Field(i)\n\t\tif tag := s.Tag.Get(\"cbor\"); tag != \"\" {\n\t\t\ttags := strings.Split(tag, \",\")\n\t\t\tout.Write(EncodeString(tags[0]))\n\t\t} else {\n\t\t\tout.Write(EncodeString(s.Name))\n\t\t}\n\t\tout.Write(encode(f))\n\t}\n\tout.WriteByte(0xFF)\n\treturn out.Bytes()\n}", "title": "" }, { "docid": "7311574fb9408feed0c3789601979c7e", "score": "0.6391142", "text": "func (buf *Buffer) WriteStruct(x Encoder) {\n\tif buf.err != nil {\n\t\treturn\n\t}\n\tbuf.err = x.Encode(buf)\n}", "title": "" }, { "docid": "0ba84454560a873f50f08a48a76bec2d", "score": "0.63773775", "text": "func (p *objectOp) encodeStruct(buf *ibuf.Buffer, opNode *structOperation, ptr unsafe.Pointer) error {\n\treturn p.encodeDynamic(buf, opNode.opInstance, opNode.opType.UnsafeIndirect(ptr))\n}", "title": "" }, { "docid": "dd8d69ea3bf210fd02a0d7a7d40200d3", "score": "0.63640624", "text": "func Encode(structPtr interface{}, blockSize int) ([]byte, error) {\n\n objBytes, err := protobuf.Encode(structPtr)\n\n if err != nil {\n return []byte{}, err\n }\n\n objSize := len(objBytes)\n\n if err != nil {\n return []byte{}, err\n }\n\n totalSize := objSize + 8\n\n if totalSize > blockSize {\n return []byte{}, ErrEncodingNotEnoughSpace\n }\n\n // Copy buffer bytes into a byte slice\n data := make([]byte, blockSize)\n _ = binary.PutUvarint(data[:8], uint64(len(objBytes)))\n copy(data[8:totalSize], objBytes)\n\n // Add padding at the end\n rand.Read(data[totalSize:])\n\n return data, nil\n}", "title": "" }, { "docid": "ba47c3bd728a0b2e0f298ff64bba40a9", "score": "0.62148947", "text": "func StructToBytes(object interface{}) (dat []byte, err error) {\n\t// Convert Structure to bytes\n\tbuf := &bytes.Buffer{}\n\terr = binary.Write(buf, binary.BigEndian, object)\n\tdat = buf.Bytes()\n\treturn\n}", "title": "" }, { "docid": "9b9eaf770fb236626e71b92f8cb58258", "score": "0.6149841", "text": "func (e *encoder) writeBuffer(s *compiler.S, dst, src *codegen.Value) {\n\tsize := src.Index(0, compiler.BufSize).Load()\n\tbytes := src.Index(0, compiler.BufData).Load()\n\te.writeBytes(s, dst, size, bytes)\n}", "title": "" }, { "docid": "a2ff0b871e5737f5648968c033cb18f8", "score": "0.6046274", "text": "func (b *packetBuffer) write(v interface{}) error { //nolint:gocognit\n\tvalue := reflect.ValueOf(v)\n\n\t// Indirect is safe to call on non-pointers, and\n\t// will simply return the same value in such cases\n\tvalue = reflect.Indirect(value)\n\n\tswitch value.Kind() {\n\tcase reflect.Uint8:\n\t\tif len(b.bytes) < 1 {\n\t\t\treturn errWrongMarshalSize\n\t\t}\n\t\tif value.CanInterface() {\n\t\t\tb.bytes[0] = byte(value.Uint())\n\t\t}\n\t\tb.bytes = b.bytes[1:]\n\tcase reflect.Uint16:\n\t\tif len(b.bytes) < 2 {\n\t\t\treturn errWrongMarshalSize\n\t\t}\n\t\tif value.CanInterface() {\n\t\t\tbinary.BigEndian.PutUint16(b.bytes, uint16(value.Uint()))\n\t\t}\n\t\tb.bytes = b.bytes[2:]\n\tcase reflect.Uint32:\n\t\tif len(b.bytes) < 4 {\n\t\t\treturn errWrongMarshalSize\n\t\t}\n\t\tif value.CanInterface() {\n\t\t\tbinary.BigEndian.PutUint32(b.bytes, uint32(value.Uint()))\n\t\t}\n\t\tb.bytes = b.bytes[4:]\n\tcase reflect.Uint64:\n\t\tif len(b.bytes) < 8 {\n\t\t\treturn errWrongMarshalSize\n\t\t}\n\t\tif value.CanInterface() {\n\t\t\tbinary.BigEndian.PutUint64(b.bytes, value.Uint())\n\t\t}\n\t\tb.bytes = b.bytes[8:]\n\tcase reflect.Slice:\n\t\tfor i := 0; i < value.Len(); i++ {\n\t\t\tif value.Index(i).CanInterface() {\n\t\t\t\tif err := b.write(value.Index(i).Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tb.bytes = b.bytes[value.Index(i).Type().Size():]\n\t\t\t}\n\t\t}\n\tcase reflect.Struct:\n\t\tfor i := 0; i < value.NumField(); i++ {\n\t\t\tencoding := value.Type().Field(i).Tag.Get(\"encoding\")\n\t\t\tif encoding == omit {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif value.Field(i).CanInterface() {\n\t\t\t\tif err := b.write(value.Field(i).Interface()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tadvance := int(value.Field(i).Type().Size())\n\t\t\t\tif len(b.bytes) < advance {\n\t\t\t\t\treturn errWrongMarshalSize\n\t\t\t\t}\n\t\t\t\tb.bytes = b.bytes[advance:]\n\t\t\t}\n\t\t}\n\tdefault:\n\t\treturn errBadStructMemberType\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8bf3afc894daa5012f8b5b40d49ad981", "score": "0.5990478", "text": "func (enc *Encoder) Encode(typeID uint64, s capnp.Struct) error {\n\tif enc.w.err != nil {\n\t\treturn enc.w.err\n\t}\n\terr := enc.marshalStruct(typeID, s)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn enc.w.err\n}", "title": "" }, { "docid": "a1f12be2e4021be9030b95c62370a987", "score": "0.5970684", "text": "func encStruct(v Any, b []byte) []byte {\n\tvar (\n\t\ti int\n\t\tl int\n\t\tlength int\n\t\tstr string\n\t\tbuf *bytes.Buffer\n\t\tvT reflect.Type\n\t\tvV reflect.Value\n\t\tmethodType reflect.Value\n\t\ttypeName reflect.Value\n\t\tmethod reflect.Method\n\t\trvArray []reflect.Value\n\t)\n\n\t// check Type exists\n\t// mast contains Type Field to convert to object\n\tvV = reflect.ValueOf(v)\n\tmethodType = vV.MethodByName(\"GetType\")\n\tif !methodType.IsValid() {\n\t\tlog.Error(\"Don'T contains GetType !\")\n\t\treturn nil\n\t}\n\n\tb = append(b, 'M')\n\t//encode type Name\n\tb = append(b, 't')\n\t// encode struct name\n\ttypeName = methodType.Call([]reflect.Value{})[0] //call return [string,]\n\tbuf = bytes.NewBufferString(typeName.String())\n\tlength = utf8.RuneCount(buf.Bytes())\n\tb = append(b, PackUint16(uint16(length))...)\n\tfor i = 0; i < length; i++ {\n\t\tif r, s, err := buf.ReadRune(); s > 0 && err == nil {\n\t\t\t// b = append(b, []byte(string(r))...)\n\t\t\tb = append(b, gxstrings.Slice(string(r))...) // 直接基于r的内存空间把它转换为[]byte\n\t\t}\n\t}\n\n\t//encode the Fields\n\tvT = reflect.TypeOf(v)\n\tfor i = 0; i < vT.NumMethod(); i++ {\n\t\tmethod = vT.Method(i)\n\t\tif !strings.HasPrefix(method.Name, \"Get\") {\n\t\t\tcontinue\n\t\t}\n\t\tif strings.EqualFold(method.Name, \"GetType\") {\n\t\t\tcontinue //jump type Field\n\t\t}\n\n\t\t//name change GetXaa to xaa\n\t\tif method.Name[3] < 'a' {\n\t\t\tstr = string(method.Name[3] + 32)\n\t\t} else {\n\t\t\tstr = string(method.Name[3])\n\t\t}\n\t\t// key\n\t\tl = len(b)\n\t\tb = encString(str+method.Name[4:], b)\n\t\tlength = len(b)\n\n\t\t// value\n\t\trvArray = vV.Method(i).Call([]reflect.Value{}) //return [] reflect.Value\n\t\tb = Encode(rvArray[0].Interface(), b) //GetXXX returns [string,]\n\t\t// 如果值为空就不向b里面填充key了\n\t\tif len(b) == length {\n\t\t\tfmt.Printf(\"key:%s, rvArray:%#v, %v, %v, %v\\n\", str+method.Name[4:], rvArray, rvArray == nil, len(rvArray), rvArray[0])\n\t\t\tb = b[:l]\n\t\t\tcontinue\n\t\t}\n\t} //end of for\n\n\treturn append(b, 'z')\n}", "title": "" }, { "docid": "65cffd05787e1dd16db367c307793275", "score": "0.59552884", "text": "func EncodeSomeProtoBuf(obj interface{}) ([]byte, error){\n\t// if v, ok := obj.(); ok {\n\t// \treturn proto.Marshal(v)\n\t// }\n\treturn nil, errors.New(\"Proto: Unknown message type\")\n}", "title": "" }, { "docid": "f478554fe89b6fcca0134238c12ff9f0", "score": "0.5925635", "text": "func (gobCodec) Encode(obj interface{}) ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\terr := gob.NewEncoder(buf).Encode(obj)\n\treturn buf.Bytes(), err\n}", "title": "" }, { "docid": "34d0bde60ae18f45e3bb3f4ee7fa63bb", "score": "0.5878913", "text": "func (enc *Encoder) Encode(data interface{}) error {\n\tpadding := enc.offset - len(enc.Buf)\n\n\tif padding > 0 {\n\t\tenc.Buf = append(enc.Buf, make([]byte, padding)...)\n\t}\n\n\tif data, ok := data.(CMarshaler); ok {\n\t\traw, err := data.MarshalC()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tenc.Buf = append(enc.Buf, raw...)\n\n\t\treturn nil\n\t}\n\n\trv := reflect.Indirect(reflect.ValueOf(data))\n\tif !rv.IsValid() {\n\t\treturn fmt.Errorf(\"cmem: reflect.ValueOf returned invalid value for type %T\", data)\n\t}\n\n\trt := rv.Type()\n\n\tswitch rt.Kind() {\n\tcase reflect.Slice, reflect.Array:\n\t\tfor i := 0; i < rv.Len(); i++ {\n\t\t\tif err := enc.Encode(rv.Index(i).Interface()); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\n\tcase reflect.Struct:\n\t\toffset := enc.offset\n\t\tfor i := 0; i < rv.NumField(); i++ {\n\t\t\tsfv := rv.Field(i).Interface()\n\t\t\t// In order to keep the memory offset always correct, we use the\n\t\t\t// structs offset.\n\t\t\tenc.offset = offset + int(rt.Field(i).Offset)\n\t\t\tif err := enc.Encode(sfv); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// Reset the offset to the correct array size.\n\t\t\tenc.offset = offset + int(rt.Size())\n\t\t}\n\t\treturn nil\n\n\tcase reflect.String:\n\t\tstr := append([]byte(rv.String()), 0)\n\n\t\t// This direct machine conversion is only used\n\t\t// because HDF5 uses machine endianism.\n\t\t//\n\t\t// DO NOT DO THIS AT HOME.\n\t\t//\n\t\traw := (*[unsafe.Sizeof(uintptr(0))]byte)(unsafe.Pointer(&str))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += len(raw)\n\n\tcase reflect.Ptr:\n\t\treturn enc.Encode(rv.Elem())\n\n\tcase reflect.Int8:\n\t\tenc.Buf = append(enc.Buf, byte(rv.Int()))\n\t\tenc.offset++\n\n\tcase reflect.Uint8:\n\t\tenc.Buf = append(enc.Buf, byte(rv.Uint()))\n\t\tenc.offset++\n\n\tcase reflect.Int16:\n\t\tvar raw [2]byte\n\t\tnativeEndian.PutUint16(raw[:], uint16(rv.Int()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 2\n\n\tcase reflect.Uint16:\n\t\tvar raw [2]byte\n\t\tnativeEndian.PutUint16(raw[:], uint16(rv.Uint()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 2\n\n\tcase reflect.Int32:\n\t\tvar raw [4]byte\n\t\tnativeEndian.PutUint32(raw[:], uint32(rv.Int()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 4\n\n\tcase reflect.Uint32:\n\t\tvar raw [4]byte\n\t\tnativeEndian.PutUint32(raw[:], uint32(rv.Uint()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 4\n\n\tcase reflect.Int64:\n\t\tvar raw [8]byte\n\t\tnativeEndian.PutUint64(raw[:], uint64(rv.Int()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 8\n\n\tcase reflect.Uint64:\n\t\tvar raw [8]byte\n\t\tnativeEndian.PutUint64(raw[:], uint64(rv.Uint()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 8\n\n\tcase reflect.Float32:\n\t\tvar raw [4]byte\n\t\tnativeEndian.PutUint32(raw[:], math.Float32bits(float32(rv.Float())))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 4\n\n\tcase reflect.Float64:\n\t\tvar raw [8]byte\n\t\tnativeEndian.PutUint64(raw[:], math.Float64bits(rv.Float()))\n\t\tenc.Buf = append(enc.Buf, raw[:]...)\n\t\tenc.offset += 8\n\n\tcase reflect.Bool:\n\t\tval := byte(0)\n\t\tif rv.Bool() {\n\t\t\tval = 1\n\t\t}\n\t\tenc.Buf = append(enc.Buf, val)\n\t\tenc.offset++\n\n\tdefault:\n\t\treturn fmt.Errorf(\"hdf5: PT Append does not support datatype (%s)\", rt.Kind())\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "f5cce2c752f6bd6ef3932d7796caad0d", "score": "0.58674484", "text": "func (gobCodec) Encode(obj interface{}) ([]byte, error) {\n\tbuf := new(bytes.Buffer)\n\tif err := gob.NewEncoder(buf).Encode(obj); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn buf.Bytes(), nil\n}", "title": "" }, { "docid": "88e253dc5ee80770de6a53b11e52ba9c", "score": "0.5864719", "text": "func (e *Encoder) Write(pkt Packet) error {\r\n\t// reset and eventually grow buffer\r\n\tpacketLength := pkt.Len()\r\n\te.buffer.Reset()\r\n\te.buffer.Grow(packetLength)\r\n\tbuf := e.buffer.Bytes()[0:packetLength]\r\n\r\n\t// encode packet\r\n\t_, err := pkt.Encode(buf)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\t// write buffer\r\n\t_, err = e.writer.Write(buf)\r\n\tif err != nil {\r\n\t\treturn err\r\n\t}\r\n\r\n\treturn nil\r\n}", "title": "" }, { "docid": "e16097c893480f359de6263e3a0b9173", "score": "0.5846914", "text": "func (e *encoder) writeBytes(s *compiler.S, buf, size, bytes *codegen.Value) {\n\te.writeVarint(s, buf, size)\n\te.AppendBuffer(s, buf, size, bytes)\n}", "title": "" }, { "docid": "1458c6d46555068d4a5f541374c97804", "score": "0.5803867", "text": "func (t Bytes) Marshal(buf *Buffer) {\n\tbuf.EncodeVarint(tagBytes)\n\tbuf.EncodeString(string(t))\n}", "title": "" }, { "docid": "c00836a4c2e2bc77e40b5f26a1b6bbec", "score": "0.57931113", "text": "func EncodeBlock(structPtr interface{}, blockSize int) ([]byte, error) {\n\n objBytes, err := protobuf.Encode(structPtr)\n\n if err != nil {\n return []byte{}, err\n }\n\n objSize := len(objBytes)\n\n if err != nil {\n return []byte{}, err\n }\n\n totalSize := objSize + 8\n paddedSize := totalSize + blockSize - (totalSize % blockSize)\n\n // Copy buffer bytes into a byte slice\n data := make([]byte, paddedSize)\n _ = binary.PutUvarint(data[:8], uint64(len(objBytes)))\n copy(data[8:totalSize], objBytes)\n\n // Add padding at the end\n rand.Read(data[totalSize:])\n\n return data, nil\n}", "title": "" }, { "docid": "cfc35aca25fbb3d6be1086cc31d69365", "score": "0.5774547", "text": "func (ctx *Context) encodeStruct(value reflect.Value) ([]byte, error) {\n\t// Encode each child to a raw value\n\tchildren, err := ctx.getRawValuesFromFields(value)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn ctx.encodeRawValues(children...)\n}", "title": "" }, { "docid": "ed7d9e2f07281d520f2743a7ab5423ae", "score": "0.57566893", "text": "func (w *Writer) Pack(ptr interface{}) {\n\tw.w.count = 0\n\tw.w.record = true\n\tw.err = binary.Write(w.w, w.order, ptr)\n\tw.position += w.w.count\n\tw.w.record = false\n}", "title": "" }, { "docid": "72f085f6a50177e9ed5e5fe19a8a6c3e", "score": "0.5745341", "text": "func (o *Buffer) enc_struct_message(p *Properties, base structPointer) error {\n\tvar state errorState\n\tstructp := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(structp) {\n\t\treturn ErrNil\n\t}\n\n\t// Can the object marshal itself?\n\tif p.isMarshaler {\n\t\tm := structPointer_Interface(structp, p.stype).(Marshaler)\n\t\tdata, err := m.Marshal()\n\t\tif err != nil && !state.shouldContinue(err, nil) {\n\t\t\treturn err\n\t\t}\n\t\to.buf = append(o.buf, p.tagcode...)\n\t\to.EncodeRawBytes(data)\n\t\treturn state.err\n\t}\n\n\to.buf = append(o.buf, p.tagcode...)\n\treturn o.enc_len_struct(p.sprop, structp, &state)\n}", "title": "" }, { "docid": "404792daa050a70ad8ce977dec7663dd", "score": "0.57402474", "text": "func (t *Frame) Encode(buffer []byte) interface{} {\n\tencodeBuffer := make([]byte, 4+len(buffer))\n\tcopy(encodeBuffer[4:], buffer)\n\tbinary.BigEndian.PutUint32(encodeBuffer, 4+uint32(len(buffer)))\n\n\treturn encodeBuffer\n}", "title": "" }, { "docid": "f1087e5a5286ed61131e38dbe2df93f8", "score": "0.5729886", "text": "func (c *Custom) Encode(b *bytes.Buffer, pver uint32) error {\n\t_, err := b.Write(c.Data)\n\treturn err\n}", "title": "" }, { "docid": "2ff19be026241582fb4ef27fc535856d", "score": "0.56855756", "text": "func (*Protocol) Encode(v wire.Value, w io.Writer) error {\n\twriter := BorrowWriter(w)\n\terr := writer.WriteValue(v)\n\tReturnWriter(writer)\n\treturn err\n}", "title": "" }, { "docid": "cd80b3bfc9183bd8eb67d54e9d3c6cc3", "score": "0.5673734", "text": "func (enc *Encoder) Encode(pdu Writer) error {\n\trPdu := reflect.ValueOf(pdu).Elem()\n\n\t//The order of the following fields doesn't matter much\n\ttypeOfPdu := rPdu.Type()\n\tvar err error\n\tfor i := 0; i < rPdu.NumField(); i++ {\n\t\tfieldName := typeOfPdu.Field(i).Name\n\t\tencodeTag := typeOfPdu.Field(i).Tag.Get(\"encode\")\n\t\tf := rPdu.Field(i)\n\n\t\tif encodeTag == \"no\" {\n\t\t\tcontinue\n\t\t}\n\t\tswitch f.Kind() {\n\t\tcase reflect.Uint:\n\t\tcase reflect.Uint8:\n\t\t\tenc.log = enc.log + fmt.Sprintf(\"%s: %d %#x\\n\", fieldName, f.Uint(), f.Uint())\n\t\tcase reflect.Bool:\n\t\t\tenc.log = enc.log + fmt.Sprintf(fieldName, f.Bool())\n\t\tdefault:\n\t\t\tenc.log = enc.log + fmt.Sprintf(fieldName, f)\n\t\t}\n\n\t\tswitch fieldName {\n\t\tcase \"Type\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsMessageType, byte(f.Uint()))\n\t\tcase \"Version\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsMmsVersion, byte(f.Uint()))\n\t\tcase \"ResponseStatus\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsMmsVersion, byte(f.Uint()))\n\t\tcase \"TransactionID\":\n\t\t\terr = enc.writeStringParam(HeaderXMmsTransactionID, f.String())\n\t\tcase \"MessageID\":\n\t\t\terr = enc.writeStringParam(HeaderMessageID, f.String())\n\t\tcase \"Status\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsStatus, byte(f.Uint()))\n\t\tcase \"From\":\n\t\t\terr = enc.writeFrom()\n\t\tcase \"Name\":\n\t\t\terr = enc.writeStringParam(wspParameterTypeNameDefunct, f.String())\n\t\tcase \"Start\":\n\t\t\terr = enc.writeStringParam(wspParameterTypeStartDefunct, f.String())\n\t\tcase \"To\":\n\t\t\tfor i := 0; i < f.Len(); i++ {\n\t\t\t\terr = enc.writeStringParam(HeaderTo, f.Index(i).String())\n\t\t\t\tif err != nil {\n\t\t\t\t\tbreak\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"ContentType\":\n\t\t\t// if there is a ContentType there has HeaderTo be content\n\t\t\tif mSendReq, ok := pdu.(*MSendReq); ok {\n\t\t\t\tif err := enc.setParam(HeaderContentType); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\tif err = enc.writeContentType(mSendReq.ContentType, mSendReq.ContentTypeStart, mSendReq.ContentTypeType, \"\"); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = enc.writeAttachments(mSendReq.Attachments)\n\t\t\t} else {\n\t\t\t\terr = errors.New(\"unhandled content type\")\n\t\t\t}\n\t\tcase \"MediaType\":\n\t\t\tif a, ok := pdu.(*Attachment); ok {\n\t\t\t\tif err = enc.writeContentType(a.MediaType, \"\", \"\", a.Name); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif err = enc.writeMediaType(f.String()); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\tcase \"Charset\":\n\t\t\t//TODO\n\t\t\terr = enc.writeCharset(f.String())\n\t\tcase \"ContentLocation\":\n\t\t\terr = enc.writeStringParam(mmsPartContentLocation, f.String())\n\t\tcase \"ContentID\":\n\t\t\terr = enc.writeQuotedStringParam(mmsPartContentID, f.String())\n\t\tcase \"Date\":\n\t\t\tdateTime := f.Uint()\n\t\t\tif dateTime > 0 {\n\t\t\t\terr = enc.writeLongIntegerParam(HeaderDate, dateTime)\n\t\t\t}\n\t\tcase \"Class\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsMessageClass, byte(f.Uint()))\n\t\tcase \"ReportAllowed\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsReportAllowed, byte(f.Uint()))\n\t\tcase \"DeliveryReport\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsDeliveryReport, byte(f.Uint()))\n\t\tcase \"ReadReport\":\n\t\t\terr = enc.writeByteParam(HeaderXMmsReadReport, byte(f.Uint()))\n\t\tcase \"Expiry\":\n\t\t\texpiry := f.Uint()\n\t\t\tif expiry > 0 {\n\t\t\t\terr = enc.writeRelativeExpiry(expiry)\n\t\t\t}\n\t\tdefault:\n\t\t\tif encodeTag == \"optional\" {\n\t\t\t\tlog.Printf(\"Unhandled optional field %s\", fieldName)\n\t\t\t} else {\n\t\t\t\treturn fmt.Errorf(\"missing encoding for mandatory field %s\", fieldName)\n\t\t\t}\n\t\t}\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"cannot encode field %s with value %s: %s ... encoded so far: %s\", fieldName, f, err, enc.log)\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "54bcda8435b05e59e6c35af72b0ad58d", "score": "0.5673553", "text": "func (e *encoder) writeWireAndTag(s *compiler.S, buf *codegen.Value, wire uint64, tag serialization.ProtoFieldID) {\n\tif tag < 1 {\n\t\tpanic(fmt.Sprintf(\"Illegal tag: %v\"))\n\t}\n\te.writeVarint(s, buf, s.Scalar(wire|(uint64(tag)<<3)))\n}", "title": "" }, { "docid": "07039eea07a99b0f3bdc2433f3158987", "score": "0.5641457", "text": "func (*Encoder) WriteField(f HeaderField) error", "title": "" }, { "docid": "c530c12d2d8faa8c49c4ce570948caf3", "score": "0.5638466", "text": "func (c *Codec) Write(p []byte) {\n\tc.buff.Write(p)\n}", "title": "" }, { "docid": "73fdaab32bdc6fd70dca65f1fb50f52d", "score": "0.5623875", "text": "func WriteStruct(w http.ResponseWriter, dst interface{}) {\n\tjs, err := json.Marshal(dst)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tw.Write(js)\n\t// fmt.Fprintf(w, \"%+v\\n\", dst)\n}", "title": "" }, { "docid": "c5ab7df1f2daa38d63468590ed759d3f", "score": "0.55980635", "text": "func (e *encoder81) writeRawBytes(rb *RawBytes) error {\n\tif rb.IsNil() {\n\t\treturn e.NilValue(rb.Type)\n\t}\n\ttt := rb.Type\n\tif tt.Kind() == vdl.Optional {\n\t\te.SetNextStartValueIsOptional()\n\t\ttt = tt.Elem()\n\t}\n\tif err := e.StartValue(tt); err != nil {\n\t\treturn err\n\t}\n\tif containsAny(tt) || containsTypeObject(tt) {\n\t\tfor _, refType := range rb.RefTypes {\n\t\t\ttid, err := e.typeEnc.encode(refType)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\te.tids.ReferenceTypeID(tid)\n\t\t}\n\t}\n\tif containsAny(tt) {\n\t\te.anyLens.lens = rb.AnyLengths\n\t}\n\te.buf.Write(rb.Data)\n\treturn e.FinishValue()\n}", "title": "" }, { "docid": "0f9efeb08ae53978f65e65c3d35c56aa", "score": "0.5591233", "text": "func (e *encoder) encodeField(s *compiler.S, ptr, buf *codegen.Value, id serialization.ProtoFieldID, ty semantic.Type) {\n\te.debug(s, \"encoding field at %p: '%s' id: %d, ty: %s\", ptr, ptr.Name(), id, ty.Name())\n\n\tent := e.ent(ty)\n\tdoEncode := func(s *compiler.S) {\n\t\tswitch ty := semantic.Underlying(ty).(type) {\n\t\tcase *semantic.StaticArray:\n\t\t\tif ent := e.ent(ty.ValueType); ent.isPacked() {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireBytes, id)\n\t\t\t\te.writeBlob(s, buf, func(buf *codegen.Value) {\n\t\t\t\t\tfor i := uint32(0); i < ty.Size; i++ {\n\t\t\t\t\t\te.encodeValue(s, ptr.Index(0, int(i)), buf, ty.ValueType)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tfor i := uint32(0); i < ty.Size; i++ {\n\t\t\t\t\te.writeWireAndTag(s, buf, ent.wireTy, id)\n\t\t\t\t\te.encodeValue(s, ptr.Index(0, int(i)), buf, ty.ValueType)\n\t\t\t\t}\n\t\t\t}\n\t\tdefault:\n\t\t\te.writeWireAndTag(s, buf, ent.wireTy, id)\n\t\t\te.encodeValue(s, ptr, buf, ty)\n\t\t}\n\t}\n\n\tif cond := e.shouldEncode(s, ptr, ty); cond != nil {\n\t\ts.If(cond, doEncode)\n\t} else {\n\t\tdoEncode(s)\n\t}\n}", "title": "" }, { "docid": "86bd814ffb35d255ca1e944b79d023fb", "score": "0.55714464", "text": "func (f EncoderFunc) Encode(m Marshaler) error { return f(m) }", "title": "" }, { "docid": "d1e2b5fdd78de6b311d3ae42f9cbb507", "score": "0.55704826", "text": "func (e Encoder) Encode(dst interface{}) error {\n\tv := reflect.ValueOf(dst)\n\tn, err := encodeToNode(v, e.z)\n\tif err != nil {\n\t\treturn err\n\t}\n\ts := n.values(e.d, e.e).Encode()\n\tl, err := io.WriteString(e.w, s)\n\tswitch {\n\tcase err != nil:\n\t\treturn err\n\tcase l != len(s):\n\t\treturn errors.New(\"could not write data completely\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c53830960423561dc21f986910c7fdc", "score": "0.5556095", "text": "func encodeGetBlocksMessageToBuffer(buf []byte, obj *GetBlocksMessage) error {\n\tif uint64(len(buf)) < encodeSizeGetBlocksMessage(obj) {\n\t\treturn encoder.ErrBufferUnderflow\n\t}\n\n\te := &encoder.Encoder{\n\t\tBuffer: buf[:],\n\t}\n\n\t// obj.LastBlock\n\te.Uint64(obj.LastBlock)\n\n\t// obj.RequestedBlocks\n\te.Uint64(obj.RequestedBlocks)\n\n\treturn nil\n}", "title": "" }, { "docid": "7643e30ab632cd007f95610673a62c11", "score": "0.5552756", "text": "func encodeDisconnectMessageToBuffer(buf []byte, obj *DisconnectMessage) error {\n\tif uint64(len(buf)) < encodeSizeDisconnectMessage(obj) {\n\t\treturn encoder.ErrBufferUnderflow\n\t}\n\n\te := &encoder.Encoder{\n\t\tBuffer: buf[:],\n\t}\n\n\t// obj.ReasonCode\n\te.Uint16(obj.ReasonCode)\n\n\t// obj.Reserved length check\n\tif uint64(len(obj.Reserved)) > math.MaxUint32 {\n\t\treturn errors.New(\"obj.Reserved length exceeds math.MaxUint32\")\n\t}\n\n\t// obj.Reserved length\n\te.Uint32(uint32(len(obj.Reserved)))\n\n\t// obj.Reserved copy\n\te.CopyBytes(obj.Reserved)\n\n\treturn nil\n}", "title": "" }, { "docid": "c6862e2edea4a41e84e5ec9e8fe8e462", "score": "0.5542882", "text": "func Encode(dataStructure interface{}) (encoded []byte, err error) {\n\tvar buffer bytes.Buffer\n\tencoder := gob.NewEncoder(&buffer)\n\terr = encoder.Encode(dataStructure)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error : %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "c6862e2edea4a41e84e5ec9e8fe8e462", "score": "0.5542882", "text": "func Encode(dataStructure interface{}) (encoded []byte, err error) {\n\tvar buffer bytes.Buffer\n\tencoder := gob.NewEncoder(&buffer)\n\terr = encoder.Encode(dataStructure)\n\n\tif err != nil {\n\t\tlog.Printf(\"Error : %s\", err)\n\t\treturn nil, err\n\t}\n\n\treturn buffer.Bytes(), nil\n}", "title": "" }, { "docid": "f80b8a9da6a400054eb4cd05f1451ec3", "score": "0.5528899", "text": "func (binaryCodec) Encode(obj interface{}) ([]byte, error) {\n\tswitch obj.(type) {\n\tcase encoding.BinaryMarshaler:\n\t\treturn obj.(encoding.BinaryMarshaler).MarshalBinary()\n\tdefault:\n\t\tbuf := new(bytes.Buffer)\n\t\terr := binary.Write(buf, binary.LittleEndian, obj)\n\t\treturn buf.Bytes(), err\n\t}\n}", "title": "" }, { "docid": "1f06cddcdb55eba673c01e7bce646c6e", "score": "0.5522244", "text": "func (p *SimpleProtocol) Write(writer io.Writer, packet Packet) error {\n\tif p.MaxPacketSize > 0 && len(packet.Data) > p.MaxPacketSize {\n\t\treturn PacketTooLargeError\n\t}\n\tp.encodeHead(packet.Data)\n\tif _, err := writer.Write(packet.Data); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e899f3cd5f25e0beca9112aff5a819c", "score": "0.5519559", "text": "func encodeGivePeersMessageToBuffer(buf []byte, obj *GivePeersMessage) error {\n\tif uint64(len(buf)) < encodeSizeGivePeersMessage(obj) {\n\t\treturn encoder.ErrBufferUnderflow\n\t}\n\n\te := &encoder.Encoder{\n\t\tBuffer: buf[:],\n\t}\n\n\t// obj.Peers maxlen check\n\tif len(obj.Peers) > 512 {\n\t\treturn encoder.ErrMaxLenExceeded\n\t}\n\n\t// obj.Peers length check\n\tif uint64(len(obj.Peers)) > math.MaxUint32 {\n\t\treturn errors.New(\"obj.Peers length exceeds math.MaxUint32\")\n\t}\n\n\t// obj.Peers length\n\te.Uint32(uint32(len(obj.Peers)))\n\n\t// obj.Peers\n\tfor _, x := range obj.Peers {\n\n\t\t// x.IP\n\t\te.Uint32(x.IP)\n\n\t\t// x.Port\n\t\te.Uint16(x.Port)\n\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "03d63a0ecd06719bf5b46a881a61f995", "score": "0.5509315", "text": "func Encode(fields ...Field) (wire []byte, e error) {\n\tvar eb EncodingBuffer\n\tfor _, f := range fields {\n\t\teb.Append(f)\n\t}\n\treturn eb.Output()\n}", "title": "" }, { "docid": "2c5d42cc209cb00f17160adf57310239", "score": "0.55088145", "text": "func (f *Frame) Encode() []byte {\n\tvar buf bytes.Buffer\n\n\tbuf.WriteByte(byte((f.Type.Type() << 2) | (f.Type.Subtype() << 4) | f.Version))\n\n\tvar flagByte byte\n\tflags := []bool{f.ToDS, f.FromDS, f.MoreFrag, f.Retry, f.PowerManagement,\n\t\tf.MoreData, f.Encrypted, f.Order}\n\tfor i, flag := range flags {\n\t\tif flag {\n\t\t\tflagByte |= byte(1 << uint(i))\n\t\t}\n\t}\n\tbuf.WriteByte(flagByte)\n\n\tnumBuf := make([]byte, 2)\n\tbinary.BigEndian.PutUint16(numBuf, f.DurationID)\n\tbuf.Write(numBuf)\n\n\tfor i := 0; i < 3 && i < len(f.Addresses); i++ {\n\t\tbuf.Write(f.Addresses[i][:])\n\t}\n\n\tif f.SequenceControl != nil {\n\t\tbinary.BigEndian.PutUint16(numBuf, *f.SequenceControl)\n\t\tbuf.Write(numBuf)\n\t}\n\n\tif len(f.Addresses) == 4 {\n\t\tbuf.Write(f.Addresses[3][:])\n\t}\n\n\tif f.CarriedFrameControl != nil {\n\t\tbinary.BigEndian.PutUint16(numBuf, *f.CarriedFrameControl)\n\t\tbuf.Write(numBuf)\n\t}\n\n\tif f.QoSControl != nil {\n\t\tbinary.BigEndian.PutUint16(numBuf, *f.QoSControl)\n\t\tbuf.Write(numBuf)\n\t}\n\n\tif f.HTControlField != nil {\n\t\tbigNumBuf := make([]byte, 4)\n\t\tbinary.BigEndian.PutUint32(bigNumBuf, *f.HTControlField)\n\t\tbuf.Write(bigNumBuf)\n\t}\n\n\tbuf.Write(f.Payload)\n\n\tchecksum := crc32.ChecksumIEEE(buf.Bytes())\n\tchecksumBuf := make([]byte, 4)\n\tbinary.LittleEndian.PutUint32(checksumBuf, checksum)\n\tbuf.Write(checksumBuf)\n\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "ffd53118e3f5e2851b61c4f394fb9d90", "score": "0.5499826", "text": "func (bo *breachedOutput) Encode(w io.Writer) error {\n\tvar scratch [8]byte\n\n\tbinary.BigEndian.PutUint64(scratch[:8], uint64(bo.amt))\n\tif _, err := w.Write(scratch[:8]); err != nil {\n\t\treturn err\n\t}\n\n\tif err := writeOutpoint(w, &bo.outpoint); err != nil {\n\t\treturn err\n\t}\n\n\tif err := lnwallet.WriteSignDescriptor(\n\t\tw, &bo.signDescriptor); err != nil {\n\t\treturn err\n\t}\n\n\tbinary.BigEndian.PutUint16(scratch[:2], uint16(bo.witnessType))\n\tif _, err := w.Write(scratch[:2]); err != nil {\n\t\treturn err\n\t}\n\n\tif bo.twoStageClaim {\n\t\tscratch[0] = 1\n\t} else {\n\t\tscratch[0] = 0\n\t}\n\tif _, err := w.Write(scratch[:1]); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "c454ddf42ed144eb1447b1b83ffbbe86", "score": "0.54806626", "text": "func (e *BufferEncoder) Encode(msg eventstream.Message) ([]byte, error) {\n\te.buffer.Reset()\n\n\tif err := e.encoder.Encode(msg); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn e.buffer.Bytes(), nil\n}", "title": "" }, { "docid": "c47de4089f490afd78e501896ece12f5", "score": "0.5473929", "text": "func (e *framedMsgpackEncoder) encodeAndWriteInternal(ctx context.Context, frame interface{}, sendNotifier func()) (int64, <-chan error) {\n\tbytes, err := e.encodeFrame(frame)\n\tch := make(chan error, 1)\n\tif err != nil {\n\t\tch <- err\n\t\treturn 0, ch\n\t}\n\tselect {\n\tcase <-e.doneCh:\n\t\tch <- io.EOF\n\tcase <-ctx.Done():\n\t\tch <- ctx.Err()\n\tcase e.writeCh <- writeBundle{bytes, ch, sendNotifier}:\n\t}\n\treturn int64(len(bytes)), ch\n}", "title": "" }, { "docid": "d93465e113eb0922dca339fd38bcdd68", "score": "0.54602873", "text": "func (w *Writer) WriteStruct(v interface{}) (err error) {\n\n\trv := reflect.ValueOf(v)\n\tif rv.Kind() != reflect.Struct {\n\t\tpanic(\"must be struct\")\n\t}\n\tdata := make([]string, rv.NumField())\n\n\tfor s := 0; s < rv.NumField(); s++ {\n\t\tval := rv.Field(s)\n\n\t\tstr, err := w.reflectValue(val)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tdata[s] = str\n\t\t//fmt.Sprintf(\"%v\", val.Interface())\n\t}\n\terr = w.Write(data)\n\treturn\n}", "title": "" }, { "docid": "0fe045eb562fc7872d9edfcce0f199e7", "score": "0.5449414", "text": "func encodeBytes(buf *bytes.Buffer, b []byte) error {\n\t// length\n\t_, err := buf.WriteString(strconv.Itoa(len(b)))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// :\n\t_, err = buf.Write(StringDelimiter)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// actual bytes\n\t_, err = buf.Write(b)\n\treturn err\n}", "title": "" }, { "docid": "57dd1600ef8fc1f01652b2bc35565bcf", "score": "0.54417753", "text": "func (b *WriteBuffer) WriteObject(src interface{}) error {\n\tgh := hessian.NewGoHessian(nil, nil)\n\terr := gh.ToBytes2(src, b)\n\treturn err\n}", "title": "" }, { "docid": "f860906326be82c4d5caff2b58cdb11e", "score": "0.54399586", "text": "func (e *encoder) encodeValue(s *compiler.S, ptr, buf *codegen.Value, ty semantic.Type) {\n\tty = semantic.Underlying(ty)\n\tswitch ty := ty.(type) {\n\tcase *semantic.Builtin:\n\t\tswitch ty {\n\t\tcase semantic.Int8Type,\n\t\t\tsemantic.Int16Type,\n\t\t\tsemantic.Int32Type,\n\t\t\tsemantic.Int64Type,\n\t\t\tsemantic.IntType,\n\t\t\tsemantic.CharType:\n\t\t\te.writeZigzag(s, buf, ptr.Load().Cast(e.T.Int64)) // Sign-ext\n\t\t\treturn\n\t\tcase semantic.Uint8Type,\n\t\t\tsemantic.Uint16Type,\n\t\t\tsemantic.Uint32Type,\n\t\t\tsemantic.Uint64Type,\n\t\t\tsemantic.UintType,\n\t\t\tsemantic.SizeType,\n\t\t\tsemantic.BoolType:\n\t\t\te.writeZigzag(s, buf, ptr.Load().Cast(e.T.Uint64)) // No sign-ext\n\t\t\treturn\n\t\tcase semantic.Float32Type:\n\t\t\te.writeFixed32(s, buf, ptr.Load())\n\t\t\treturn\n\t\tcase semantic.Float64Type:\n\t\t\te.writeFixed64(s, buf, ptr.Load())\n\t\t\treturn\n\t\tcase semantic.StringType:\n\t\t\tstrPtr := ptr.Load()\n\t\t\tsize := strPtr.Index(0, compiler.StringLength).Load().Cast(e.T.Uint32)\n\t\t\tbytes := strPtr.Index(0, compiler.StringData, 0)\n\t\t\te.debug(s, \"encoding string at %p: size: %d, refcount: %d, str: %s\",\n\t\t\t\tstrPtr, size, strPtr.Index(0, compiler.StringRefCount).Load(), bytes)\n\t\t\te.writeBytes(s, buf, size, bytes)\n\t\t\treturn\n\t\t}\n\tcase *semantic.Enum:\n\t\te.encodeValue(s, ptr, buf, ty.NumberType)\n\t\treturn\n\tcase *semantic.Pointer:\n\t\te.encodeValue(s, ptr, buf, semantic.Uint64Type)\n\t\treturn\n\tcase *semantic.StaticArray:\n\t\tpanic(\"Must be handled in encodeField\")\n\tcase *semantic.Class:\n\t\te.writeBlob(s, buf, func(buf *codegen.Value) {\n\t\t\ts.Call(e.funcs.encodeToBuf[ty], ptr, s.Ctx, buf)\n\t\t})\n\t\treturn\n\tcase *semantic.Reference:\n\t\trefPtr := ptr.Load()\n\t\ts.If(s.NotEqual(refPtr, s.Zero(refPtr.Type())), func(s *compiler.S) {\n\t\t\tsignedRefID := s.Call(e.callbacks.encodeBackref, s.Ctx, refPtr.Cast(e.T.VoidPtr))\n\t\t\tnewRef := s.GreaterOrEqualTo(signedRefID, s.Scalar(int64(0)))\n\t\t\trefID := s.Select(newRef, signedRefID, s.Negate(signedRefID))\n\n\t\t\te.writeBlob(s, buf, func(buf *codegen.Value) {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.RefRef)\n\t\t\t\te.writeZigzag(s, buf, refID)\n\n\t\t\t\ts.If(newRef, func(s *compiler.S) {\n\t\t\t\t\te.writeWireAndTag(s, buf, proto.WireBytes, serialization.RefVal)\n\t\t\t\t\te.encodeValue(s, refPtr.Index(0, compiler.RefValue), buf, ty.To)\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\treturn\n\tcase *semantic.Map:\n\t\tmapPtr := ptr.Load()\n\t\te.writeBlob(s, buf, func(buf *codegen.Value) {\n\t\t\tsignedRefID := s.Call(e.callbacks.encodeBackref, s.Ctx, mapPtr.Cast(e.T.VoidPtr))\n\t\t\tnewRef := s.GreaterOrEqualTo(signedRefID, s.Scalar(int64(0)))\n\t\t\trefID := s.Select(newRef, signedRefID, s.Negate(signedRefID))\n\n\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.MapRef)\n\t\t\te.writeZigzag(s, buf, refID)\n\n\t\t\ts.If(newRef, func(s *compiler.S) {\n\t\t\t\tcount := mapPtr.Index(0, compiler.MapCount).Load()\n\t\t\t\te.debug(s, \"encoding map '\"+ty.Name()+\"' at %p: cnt: %d, cap: %d, refcount: %d\",\n\t\t\t\t\tmapPtr, count,\n\t\t\t\t\tmapPtr.Index(0, compiler.MapCapacity).Load(),\n\t\t\t\t\tmapPtr.Index(0, compiler.MapRefCount).Load())\n\t\t\t\ts.If(s.NotEqual(count, s.Zero(count.Type())), func(s *compiler.S) {\n\t\t\t\t\twriter := func(ty semantic.Type, id serialization.ProtoFieldID) (write func(*codegen.Value), flush func()) {\n\t\t\t\t\t\tent := e.ent(ty)\n\t\t\t\t\t\tif ent.isPacked() {\n\t\t\t\t\t\t\tpackBuf, delBuf := e.newBuf(s)\n\t\t\t\t\t\t\treturn func(v *codegen.Value) {\n\t\t\t\t\t\t\t\t\te.encodeValue(s, v, packBuf, ty)\n\t\t\t\t\t\t\t\t}, func() {\n\t\t\t\t\t\t\t\t\te.writeWireAndTag(s, buf, proto.WireBytes, id)\n\t\t\t\t\t\t\t\t\te.writeBuffer(s, buf, packBuf)\n\t\t\t\t\t\t\t\t\tdelBuf()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn func(v *codegen.Value) {\n\t\t\t\t\t\t\te.writeWireAndTag(s, buf, ent.wireTy, id)\n\t\t\t\t\t\t\te.encodeValue(s, v, buf, ty)\n\t\t\t\t\t\t}, func() {}\n\t\t\t\t\t}\n\n\t\t\t\t\twriteVal, flushVal := writer(ty.ValueType, serialization.MapVal)\n\t\t\t\t\twriteKey, flushKey := writer(ty.KeyType, serialization.MapKey)\n\n\t\t\t\t\te.IterateMap(s, mapPtr, semantic.Uint32Type, func(i, k, v *codegen.Value) {\n\t\t\t\t\t\te.debug(s, \"encoding map '\"+ty.Name()+\"' val %d\", i.Load())\n\t\t\t\t\t\twriteVal(v)\n\t\t\t\t\t})\n\t\t\t\t\te.IterateMap(s, mapPtr, semantic.Uint32Type, func(i, k, v *codegen.Value) {\n\t\t\t\t\t\te.debug(s, \"encoding map '\"+ty.Name()+\"' key %d\", i.Load())\n\t\t\t\t\t\twriteKey(k)\n\t\t\t\t\t})\n\n\t\t\t\t\tflushVal()\n\t\t\t\t\tflushKey()\n\t\t\t\t})\n\t\t\t})\n\t\t})\n\t\treturn\n\tcase *semantic.Slice:\n\t\te.writeBlob(s, buf, func(buf *codegen.Value) {\n\t\t\troot := ptr.Index(0, compiler.SliceRoot).Load()\n\t\t\tbase := ptr.Index(0, compiler.SliceBase).Load()\n\t\t\tsize := ptr.Index(0, compiler.SliceSize).Load()\n\t\t\tcount := ptr.Index(0, compiler.SliceCount).Load()\n\t\t\tpool := ptr.Index(0, compiler.SlicePool).Load()\n\n\t\t\ts.If(s.NotEqual(root, s.Zero(root.Type())), func(s *compiler.S) {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.SliceRoot)\n\t\t\t\te.writeVarint(s, buf, root.Cast(e.T.Uint64))\n\t\t\t})\n\n\t\t\ts.If(s.NotEqual(base, s.Zero(base.Type())), func(s *compiler.S) {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.SliceBase)\n\t\t\t\te.writeVarint(s, buf, base.Cast(e.T.Uint64))\n\t\t\t})\n\n\t\t\ts.If(s.NotEqual(size, s.Zero(size.Type())), func(s *compiler.S) {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.SliceSize)\n\t\t\t\te.writeVarint(s, buf, size)\n\t\t\t})\n\n\t\t\ts.If(s.NotEqual(count, s.Zero(size.Type())), func(s *compiler.S) {\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.SliceCount)\n\t\t\t\te.writeVarint(s, buf, count)\n\t\t\t})\n\n\t\t\ts.If(s.Not(pool.IsNull()), func(s *compiler.S) {\n\t\t\t\tid := pool.Index(0, compiler.PoolID).Load()\n\t\t\t\te.writeWireAndTag(s, buf, proto.WireVarint, serialization.SlicePool)\n\t\t\t\te.writeVarint(s, buf, id)\n\t\t\t})\n\t\t})\n\t\ts.Call(e.callbacks.sliceEncoded, s.Ctx, ptr)\n\t\treturn\n\t}\n\n\te.Fail(\"Unsupported type: %T %v\", ty, ty)\n}", "title": "" }, { "docid": "8826624db10a9cd23e48b01aa13927af", "score": "0.5429185", "text": "func (o *Buffer) enc_struct_group(p *Properties, base structPointer) error {\n\tvar state errorState\n\tb := structPointer_GetStructPointer(base, p.field)\n\tif structPointer_IsNil(b) {\n\t\treturn ErrNil\n\t}\n\n\to.EncodeVarint(uint64((p.Tag << 3) | WireStartGroup))\n\terr := o.enc_struct(p.sprop, b)\n\tif err != nil && !state.shouldContinue(err, nil) {\n\t\treturn err\n\t}\n\to.EncodeVarint(uint64((p.Tag << 3) | WireEndGroup))\n\treturn state.err\n}", "title": "" }, { "docid": "cd52bacf701d349f775c7d50907723d1", "score": "0.542116", "text": "func (w *Writer) Write(f *Frame) error {\n\tvar err error\n\n\tif f == nil {\n\t\t// nil frame means send a heart-beat LF\n\t\t_, err = w.writer.Write(newlineSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t} else {\n\t\t_, err = w.writer.Write([]byte(f.Command))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t_, err = w.writer.Write(newlineSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t//println(\"TX:\", f.Command)\n\t\tif f.Header != nil {\n\t\t\tfor i := 0; i < f.Header.Len(); i++ {\n\t\t\t\tkey, value := f.Header.GetAt(i)\n\t\t\t\t//println(\" \", key, \":\", value)\n\t\t\t\t_, err = replacerForEncodeValue.WriteString(w.writer, key)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t_, err = w.writer.Write(colonSlice)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t_, err = replacerForEncodeValue.WriteString(w.writer, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\t_, err = w.writer.Write(newlineSlice)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t_, err = w.writer.Write(newlineSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tif len(f.Body) > 0 {\n\t\t\t_, err = w.writer.Write(f.Body)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\n\t\t// write the final null (0) byte\n\t\t_, err = w.writer.Write(nullSlice)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\terr = w.writer.Flush()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "45fdf9476b9d3e5e0a6fd830a4166f99", "score": "0.5418378", "text": "func Encode(v any) ([]byte, error) { return EncodeWithDefName(v) }", "title": "" }, { "docid": "8a30e646c1c63f21cb478a029b44396c", "score": "0.5413727", "text": "func (em *eventMetadata) writeStruct(name string, fieldCount uint8, tags uint32) {\n\tem.writeFieldInner(name, inTypeStruct, outType(fieldCount), tags, 0)\n}", "title": "" }, { "docid": "5b212e40f3b5b18cbafe657f67350167", "score": "0.54068434", "text": "func (Codec) Marshal(obj interface{}) ([]byte, error) {\n\tswitch v := obj.(type) {\n\tcase vtprotoMessage:\n\t\treturn v.MarshalVT()\n\tcase proto.Message:\n\t\treturn proto.Marshal(v)\n\tdefault:\n\t\treturn nil, errors.ErrInvalidProtoMessageType(v)\n\t}\n}", "title": "" }, { "docid": "a519bed9dbb7f3042b4c6ae1b0a1c5e0", "score": "0.5404413", "text": "func (e *structEncoderImpl) encodeStruct(structVal reflect.Value, wrapper *NodePacketEncoder) *NodePacketEncoder {\n\tvar fields []field\n\n\tstructType := structVal.Type()\n\tfor i := 0; i < structType.NumField(); i++ {\n\t\tfieldType := structType.Field(i)\n\t\tfields = append(fields, field{fieldType, structVal.Field(i)})\n\t}\n\n\tfor _, f := range fields {\n\t\tstructField, fieldValue := f.field, f.val\n\t\tfieldName := fieldNameByTag(e.config.TagName, structField)\n\t\te.encodeStructFromField(structField.Type, fieldName, fieldValue, wrapper)\n\t}\n\n\treturn wrapper\n}", "title": "" }, { "docid": "f379c21f2b3f76c34d0bb46cc1e02215", "score": "0.5392789", "text": "func Encode(buffer []byte, md map[string]string) ([]byte, error) {\n\tif len(md) < 1 {\n\t\treturn buffer, nil\n\t}\n\n\tmsg := invoke.Metadata{\n\t\tData: md,\n\t}\n\n\tmsgBytes, err := proto.Marshal(&msg)\n\tif err != nil {\n\t\treturn buffer, err\n\t}\n\n\tbuffer = append(buffer, msgBytes...)\n\n\treturn buffer, nil\n}", "title": "" }, { "docid": "e6bdd2edce04dfbdc2be3e18c3986bc3", "score": "0.53918463", "text": "func (e *Encoder) encodeStruct(rv reflect.Value) error {\n\terr := e.writeString(\"<dict>\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\te.indentLevel++\n\n\tfor i := 0; i < rv.NumField(); i++ {\n\t\trt := rv.Type()\n\t\tf := rt.Field(i)\n\t\tname := f.Tag.Get(\"plist\")\n\t\tif name == \"-\" {\n\t\t\tcontinue\n\t\t}\n\t\tif name == \"\" {\n\t\t\tname = f.Name\n\t\t}\n\n\t\t_, err = e.bw.WriteString(e.indent() + \"<key>\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\txml.Escape(e.bw, []byte(name))\n\t\t_, err = e.bw.WriteString(\"</key>\\n\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = e.encodeAny(rv.Field(i))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\te.indentLevel--\n\n\terr = e.writeString(\"</dict>\\n\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "d049ca018562787ceaaed49d469ec4a5", "score": "0.53872955", "text": "func (b *PackBuffer) Write(value uint32, bits int8) {\n\tif bits < 0 || bits > 32 {\n\t\tgoto err\n\t}\n\tif b.endbyte >= int32(len(b.buffer)-4) {\n\t\tif b.ptr == nil {\n\t\t\treturn\n\t\t}\n\t\tif int32(len(b.buffer)) > bw_INT32_MAX-bw_BUFFER_INCREMENT {\n\t\t\tgoto err\n\t\t}\n\t\tb.buffer = append(b.buffer, make([]byte, bw_BUFFER_INCREMENT)...)\n\t\tb.ptr = b.buffer[b.endbyte:]\n\t}\n\n\tvalue &= mask[bits]\n\tbits += b.endbit\n\n\tb.ptr[0] |= byte(value << uint(b.endbit))\n\n\tif bits >= 8 {\n\t\tb.ptr[1] = byte((value >> (8 - uint(b.endbit))))\n\t\tif bits >= 16 {\n\t\t\tb.ptr[2] = byte((value >> (16 - uint(b.endbit))))\n\t\t\tif bits >= 24 {\n\t\t\t\tb.ptr[3] = byte((value >> (24 - uint(b.endbit))))\n\t\t\t\tif bits >= 32 {\n\t\t\t\t\tif b.endbit != 0 {\n\t\t\t\t\t\tb.ptr[4] = byte((value >> (32 - uint(b.endbit))))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tb.ptr[4] = 0\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tb.endbyte += int32(bits / 8)\n\tb.ptr = b.ptr[bits/8:]\n\tb.endbit = bits & 7\n\treturn\nerr:\n\tb.WriteClear()\n}", "title": "" }, { "docid": "a4bb8ee58b5f4a6f93b3d9df4404e43e", "score": "0.5376606", "text": "func (nr *NFv5Record) encode(b []byte) error {\n\tif len(b) < RecordSize {\n\t\treturn ErrInvalidRecordBuffer\n\t}\n\tif len(nr.Src) == 4 {\n\t\tcopy(b[0:4], []byte(nr.Src))\n\t}\n\tif len(nr.Dst) == 4 {\n\t\tcopy(b[4:8], []byte(nr.Dst))\n\t}\n\tif len(nr.Next) == 4 {\n\t\tcopy(b[8:12], []byte(nr.Next))\n\t}\n\n\tbinary.BigEndian.PutUint16(b[12:14], nr.Input)\n\tbinary.BigEndian.PutUint16(b[14:16], nr.Output)\n\tbinary.BigEndian.PutUint32(b[16:20], nr.Pkts)\n\tbinary.BigEndian.PutUint32(b[20:24], nr.Bytes)\n\tbinary.BigEndian.PutUint32(b[24:28], nr.UptimeFirst)\n\tbinary.BigEndian.PutUint32(b[28:32], nr.UptimeLast)\n\tbinary.BigEndian.PutUint16(b[32:34], nr.SrcPort)\n\tbinary.BigEndian.PutUint16(b[34:36], nr.DstPort)\n\tb[36] = nr.Pad\n\tb[37] = nr.Flags\n\tb[38] = nr.Protocol\n\tb[39] = nr.ToS\n\tbinary.BigEndian.PutUint16(b[40:42], nr.SrcAs)\n\tbinary.BigEndian.PutUint16(b[42:44], nr.DstAs)\n\tb[44] = nr.SrcMask\n\tb[45] = nr.DstMask\n\tbinary.BigEndian.PutUint16(b[46:48], nr.Pad2)\n\treturn nil\n}", "title": "" }, { "docid": "a9397b8dfa81a61948ebe3df78aa8fcc", "score": "0.5372783", "text": "func (gobs GobsSerialization) Encode(data interface{}) interface{} {\n\tvar buf bytes.Buffer\n\tgob.NewEncoder(&buf).Encode(data)\n\treturn buf.Bytes()\n}", "title": "" }, { "docid": "153f876e9c86474e3d95c32551a0c3ff", "score": "0.5370652", "text": "func (b Encoder) PutBytes(v []byte) {\n\t// See https://core.telegram.org/tdlib/docs/td__json__client_8h.html\n\t//\n\t// ... fields of bytes type are base64 encoded and then stored as String ...\n\tb.Writer.Str(base64.RawURLEncoding.EncodeToString(v))\n}", "title": "" }, { "docid": "e146152128d5c3a30c402d0418b0aaea", "score": "0.5369278", "text": "func Encode(in interface{}) (out []byte, err error) {\n\treturn EncodeGOB(in)\n}", "title": "" }, { "docid": "a0c5872bbd6fe9bfe9b567c4fb242696", "score": "0.53614306", "text": "func (m *BackendT) MarshalToWriter(writer jspb.Writer) {\n\tif m == nil {\n\t\treturn\n\t}\n\n\tif len(m.Domain) > 0 {\n\t\twriter.WriteString(1, m.Domain)\n\t}\n\n\tfor _, val := range m.Ips {\n\t\twriter.WriteString(2, val)\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "9a672fcde2819cb2088d016ef49a2d5e", "score": "0.5357861", "text": "func Encode(node ipld.Node, w io.Writer) error {\n\t// 1KiB can be allocated on the stack, and covers most small nodes\n\t// without having to grow the buffer and cause allocations.\n\tenc := make([]byte, 0, 1024)\n\n\tenc, err := AppendEncode(enc, node)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = w.Write(enc)\n\treturn err\n}", "title": "" }, { "docid": "74cb9b80662225abc2d35975d2ace39b", "score": "0.5346445", "text": "func (e *Encoder) AsStruct() *Encoder {\n\treturn &Encoder{w: e.w, encode: asStruct}\n}", "title": "" }, { "docid": "a1a26876490768fb0b4954b82df32015", "score": "0.533167", "text": "func (st *StickerPack) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = _os.Write_int32(st.Constructor, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = st.Data.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" }, { "docid": "9c0f832193103973fc4737032648e00b", "score": "0.532997", "text": "func (enc *Encoder) Encode(v interface{}) error {\n\tenc.hdr.Do(enc.writeHeader)\n\tif enc.w.err != nil {\n\t\treturn enc.w.err\n\t}\n\n\tif v, ok := v.(Marshaler); ok {\n\t\treturn v.MarshalBoost(enc.w)\n\t}\n\n\trv := reflect.Indirect(reflect.ValueOf(v))\n\tswitch rv.Kind() {\n\tcase reflect.Bool:\n\t\tenc.w.WriteBool(rv.Bool())\n\tcase reflect.Int8:\n\t\tenc.w.WriteI8(int8(rv.Int()))\n\tcase reflect.Int16:\n\t\tenc.w.WriteI16(int16(rv.Int()))\n\tcase reflect.Int32:\n\t\tenc.w.WriteI32(int32(rv.Int()))\n\tcase reflect.Int64:\n\t\tenc.w.WriteI64(rv.Int())\n\tcase reflect.Uint8:\n\t\tenc.w.WriteU8(uint8(rv.Uint()))\n\tcase reflect.Uint16:\n\t\tenc.w.WriteU16(uint16(rv.Uint()))\n\tcase reflect.Uint32:\n\t\tenc.w.WriteU32(uint32(rv.Uint()))\n\tcase reflect.Uint64:\n\t\tenc.w.WriteU64(rv.Uint())\n\tcase reflect.Float32:\n\t\tenc.w.WriteF32(float32(rv.Float()))\n\tcase reflect.Float64:\n\t\tenc.w.WriteF64(rv.Float())\n\tcase reflect.Complex64:\n\t\tenc.w.WriteC64(complex64(rv.Complex()))\n\tcase reflect.Complex128:\n\t\tenc.w.WriteC128(rv.Complex())\n\tcase reflect.String:\n\t\tenc.w.WriteString(rv.String())\n\tcase reflect.Struct:\n\t\trt := rv.Type()\n\t\tenc.w.WriteTypeDescr(rt)\n\t\tfor i := 0; i < rt.NumField(); i++ {\n\t\t\tenc.Encode(rv.Field(i).Interface())\n\t\t}\n\tcase reflect.Slice:\n\t\trt := rv.Type()\n\t\tenc.w.WriteTypeDescr(rt)\n\t\tn := rv.Len()\n\t\tenc.w.writeLen(n)\n\t\tif et := rt.Elem(); !isCxxBoostBuiltin(et.Kind()) {\n\t\t\tenc.w.WriteU32(0) // FIXME(sbinet): what is this?\n\t\t}\n\t\tfor i := 0; i < int(n); i++ {\n\t\t\te := rv.Index(i)\n\t\t\tenc.Encode(e.Interface()) // FIXME(sbinet): do not go through Decode each time\n\t\t}\n\tcase reflect.Array:\n\t\trt := rv.Type()\n\t\tenc.w.WriteTypeDescr(rt)\n\t\tn := int(rv.Len())\n\t\tenc.w.writeLen(n)\n\t\tfor i := 0; i < n; i++ {\n\t\t\te := rv.Index(i)\n\t\t\tenc.Encode(e.Interface()) // FIXME(sbinet): do not go through Decode each time\n\t\t}\n\tcase reflect.Map:\n\t\trt := rv.Type()\n\t\tenc.w.WriteTypeDescr(rt)\n\t\tn := int(rv.Len())\n\t\tenc.w.writeLen(n)\n\t\tenc.w.WriteU64(0) // FIXME(sbinet): what is this ?\n\t\tenc.w.WriteU8(0) // FIXME(sbinet): ditto ?\n\t\tkeys := rv.MapKeys()\n\t\tfor _, k := range keys {\n\t\t\tv := rv.MapIndex(k)\n\t\t\tenc.Encode(k.Interface()) // FIXME(sbinet): do not go through Decode each time\n\t\t\tenc.Encode(v.Interface()) // FIXME(sbinet): do not go through Decode each time\n\t\t}\n\n\tdefault:\n\t\treturn ErrTypeNotSupported\n\t}\n\treturn enc.w.err\n}", "title": "" }, { "docid": "a941f1f46e8b259383d47bf9c8337e7b", "score": "0.532927", "text": "func (c *BinaryCodec) Write( i interface{ Write(*BinaryCodec) } ) *BinaryCodec {\n if c.err == nil {\n i.Write( c )\n }\n return c\n}", "title": "" }, { "docid": "41532d8e7af8a2ab39bbd28f96253502", "score": "0.53289443", "text": "func encode(p Point) []byte {\n\tbuf := make([]byte, 20)\n\tn := binary.PutVarint(buf, p.Timestamp)\n\tm := binary.PutVarint(buf[n:], p.Value)\n\treturn buf[:m+n]\n}", "title": "" }, { "docid": "edd84f69c52d4ea27eb9157ee1d090f2", "score": "0.53207994", "text": "func Marshal(v interface{}) ([]byte, error)", "title": "" }, { "docid": "1cd7ca74dc981a8c7a3a7876e22bfb42", "score": "0.5317796", "text": "func (e *structEncoderImpl) encode(input interface{}, signals []*PrimitivePacketEncoder) ([]byte, error) {\n\tvar inputVal reflect.Value\n\n\tif input != nil {\n\t\tinputVal = reflect.Indirect(reflect.ValueOf(input))\n\t\tif inputVal.Kind() == reflect.Ptr && inputVal.IsNil() {\n\t\t\tinput = nil\n\t\t}\n\t}\n\n\tif input == nil {\n\t\treturn nil, fmt.Errorf(\"::encode input is nill\")\n\t}\n\n\tif !inputVal.IsValid() {\n\t\treturn nil, fmt.Errorf(\"::encode input value is not valid\")\n\t}\n\n\tvar nodeEncoder *NodePacketEncoder\n\n\tinputKind := inputVal.Kind()\n\tswitch inputKind {\n\tcase reflect.Struct:\n\t\tnodeEncoder = e.encodeStruct(inputVal, NewNodePacketEncoder(int(e.observe)))\n\tcase reflect.Slice:\n\t\tnodeEncoder = e.encodeSlice(inputVal, NewNodePacketEncoder(int(e.observe)))\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"unsupported type: %s\", inputKind)\n\t}\n\n\tif !utils.IsEmptyKey(e.root) {\n\t\troot := NewNodePacketEncoder(int(e.root))\n\t\tfor _, signal := range signals {\n\t\t\troot.AddPrimitivePacket(signal)\n\t\t}\n\t\troot.AddNodePacket(nodeEncoder)\n\t\treturn root.Encode(), nil\n\t}\n\n\tbuf := make([][]byte, 0)\n\tfor _, signal := range signals {\n\t\tbuf = append(buf, signal.Encode())\n\t}\n\tbuf = append(buf, nodeEncoder.Encode())\n\treturn bytes.Join(buf, []byte{}), nil\n}", "title": "" }, { "docid": "bc3686566c80bace380d19f2e80ea12f", "score": "0.5315454", "text": "func (self Encoding) Encode(out []byte, src []byte) {\n if len(src) != 0 {\n if buf := out[:0:len(out)]; self.EncodedLen(len(src)) <= len(out) {\n self.EncodeUnsafe(&buf, src)\n } else {\n panic(\"encoder output buffer is too small\")\n }\n }\n}", "title": "" }, { "docid": "4ea197e6b7f870a6c92b194af637621f", "score": "0.5314357", "text": "func Pack(order binary.ByteOrder, v interface{}) (data []byte, err error) {\n\tdefer func() {\n\t\tif r := recover(); r != nil {\n\t\t\tdata = nil\n\t\t\terr = r.(error)\n\t\t}\n\t}()\n\n\tss := structstack{allowexpr: expressionsEnabled, buf: []byte{}}\n\n\tf, val := fieldFromIntf(v)\n\tdata = make([]byte, ss.fieldbytes(f, val))\n\n\tss.buf = data\n\te := encoder{structstack: ss, order: order}\n\te.write(f, val)\n\n\treturn\n}", "title": "" }, { "docid": "77d234d2eea2a38bde0a076070a43413", "score": "0.53107363", "text": "func (self Encoding) EncodeUnsafe(out *[]byte, src []byte) {\n __b64encode(out, &src, int(self) | archFlags)\n}", "title": "" }, { "docid": "e85d67f5c249b8b50766e74d4277ffcc", "score": "0.53103083", "text": "func TestEncodings(t *testing.T) {\n\tdefer leaktest.AfterTest(t)()\n\tdefer log.Scope(t).Close(t)\n\n\ttests := readEncodingTests(t)\n\tbuf := newWriteBuffer(metric.NewCounter(metric.Metadata{}))\n\n\tverifyLen := func(t *testing.T) []byte {\n\t\tt.Helper()\n\t\tb := buf.wrapped.Bytes()\n\t\tif len(b) < 4 {\n\t\t\tt.Fatal(\"short buffer\")\n\t\t}\n\t\tn := binary.BigEndian.Uint32(b)\n\t\t// The first 4 bytes are the length prefix.\n\t\tdata := b[4:]\n\t\tif len(data) != int(n) {\n\t\t\tt.Logf(\"%v\", b)\n\t\t\tt.Errorf(\"expected %d bytes, got %d\", n, len(data))\n\t\t}\n\t\treturn data\n\t}\n\n\tvar conv sessiondata.DataConversionConfig\n\tctx := context.Background()\n\tevalCtx := ast.MakeTestingEvalContext(nil)\n\tt.Run(\"encode\", func(t *testing.T) {\n\t\tt.Run(pgwirebase.FormatText.String(), func(t *testing.T) {\n\t\t\tfor _, tc := range tests {\n\t\t\t\td := tc.Datum\n\n\t\t\t\tbuf.reset()\n\t\t\t\tbuf.textFormatter.Buffer.Reset()\n\t\t\t\tbuf.writeTextDatum(ctx, d, conv, tc.T)\n\t\t\t\tif buf.err != nil {\n\t\t\t\t\tt.Fatal(buf.err)\n\t\t\t\t}\n\t\t\t\tgot := verifyLen(t)\n\t\t\t\tif !bytes.Equal(got, tc.TextAsBinary) {\n\t\t\t\t\tt.Errorf(\"unexpected text encoding:\\n\\t%q found,\\n\\t%q expected\", got, tc.Text)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t\tt.Run(pgwirebase.FormatBinary.String(), func(t *testing.T) {\n\t\t\tfor _, tc := range tests {\n\t\t\t\td := tc.Datum\n\t\t\t\tbuf.reset()\n\t\t\t\tbuf.writeBinaryDatum(ctx, d, time.UTC, tc.T)\n\t\t\t\tif buf.err != nil {\n\t\t\t\t\tt.Fatal(buf.err)\n\t\t\t\t}\n\t\t\t\tgot := verifyLen(t)\n\t\t\t\tif !bytes.Equal(got, tc.Binary) {\n\t\t\t\t\tt.Errorf(\"unexpected binary encoding:\\n\\t%v found,\\n\\t%v expected\", got, tc.Binary)\n\t\t\t\t}\n\t\t\t}\n\t\t})\n\t})\n\tt.Run(\"decode\", func(t *testing.T) {\n\t\tfor _, tc := range tests {\n\t\t\tswitch tc.Datum.(type) {\n\t\t\tcase *ast.DFloat:\n\t\t\t\t// Skip floats because postgres rounds them different than Go.\n\t\t\t\tcontinue\n\t\t\tcase *ast.DTuple:\n\t\t\t\t// Unsupported.\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tfor code, value := range map[pgwirebase.FormatCode][]byte{\n\t\t\t\tpgwirebase.FormatText: tc.TextAsBinary,\n\t\t\t\tpgwirebase.FormatBinary: tc.Binary,\n\t\t\t} {\n\t\t\t\td, err := pgwirebase.DecodeOidDatum(nil, tc.Oid, code, value)\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\t// Text decoding returns a string for some kinds of arrays. If that's\n\t\t\t\t// the case, manually do the conversion to array.\n\t\t\t\tdarr, isdarr := tc.Datum.(*ast.DArray)\n\t\t\t\tif isdarr && d.ResolvedType().Family() == types.StringFamily {\n\t\t\t\t\td, _, err = ast.ParseDArrayFromString(&evalCtx, string(value), darr.ParamTyp)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tt.Fatal(err)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif d.Compare(&evalCtx, tc.Datum) != 0 {\n\t\t\t\t\tt.Fatalf(\"%v != %v\", d, tc.Datum)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t})\n}", "title": "" }, { "docid": "df56b324de4037236d7c909dfdf0dde3", "score": "0.5296144", "text": "func (r *Reading) Encode() (buf []byte) {\n var buffer []byte\n buffer = append(buffer, Float64ToByteArray(r.Temperature)...)\n buffer = append(buffer, Float64ToByteArray(r.Altitude)...)\n buffer = append(buffer, Float64ToByteArray(r.Latitude)...)\n buffer = append(buffer, Float64ToByteArray(r.Longitude)...)\n buffer = append(buffer, Float64ToByteArray(r.BatteryLevel)...)\n return buffer\n}", "title": "" }, { "docid": "af5fda61e0f45656f9a31b34260eabae", "score": "0.52954066", "text": "func (o *Buffer) enc_len_struct(prop *StructProperties, base structPointer, state *errorState) error {\n\treturn o.enc_len_thing(func() error { return o.enc_struct(prop, base) }, state)\n}", "title": "" }, { "docid": "f80f6622a1304ca985e5d13f41fe76bf", "score": "0.5280363", "text": "func (f *OnionPacket) Encode(w io.Writer) error {\n\tephemeral := f.Header.EphemeralKey\n\n\tif _, err := w.Write([]byte{f.Header.Version}); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.Write(ephemeral[:]); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.Write(f.Header.HeaderMAC[:]); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.Write(f.Header.RoutingInfo[:]); err != nil {\n\t\treturn err\n\t}\n\n\tif _, err := w.Write(f.Payload[:]); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "7daae6691f39c037670120ecfea4ddc2", "score": "0.5268867", "text": "func (fn EncoderFunc) Encode(src interface{}) error { return fn(src) }", "title": "" }, { "docid": "900b40153d7c41922d233f50f449f8ab", "score": "0.5263881", "text": "func (msg *MsgTx) BtcEncode(w io.Writer, pver uint32, enc MessageEncoding) error {\n\terr := binarySerializer.PutUint32(w, littleEndian, uint32(msg.Version))\n\tif err != nil {\n\t\treturn err\n\t}\n\tdoWitness := enc == WitnessEncoding && msg.HasWitness()\n\tif doWitness {\n\t\t// After the txn's Version field, we include two additional\n\t\t// bytes specific to the witness encoding. The first byte is an\n\t\t// always 0x00 marker byte, which allows decoders to\n\t\t// distinguish a serialized transaction with witnesses from a\n\t\t// regular (legacy) one. The second byte is the Flag field,\n\t\t// which at the moment is always 0x01, but may be extended in\n\t\t// the future to accommodate auxiliary non-committed fields.\n\t\tif _, err := w.Write(witnessMarkerBytes); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcount := uint64(len(msg.TxIn))\n\terr = WriteVarInt(w, pver, count)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, ti := range msg.TxIn {\n\t\terr = writeTxIn(w, pver, msg.Version, ti)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tcount = uint64(len(msg.TxOut))\n\terr = WriteVarInt(w, pver, count)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, to := range msg.TxOut {\n\t\terr = WriteTxOut(w, pver, msg.Version, to)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\t// If this transaction is a witness transaction, and the witness\n\t// encoded is desired, then encode the witness for each of the inputs\n\t// within the transaction.\n\tif doWitness {\n\t\tfor _, ti := range msg.TxIn {\n\t\t\terr = writeTxWitness(w, pver, msg.Version, ti.Witness)\n\t\t}\n\t}\n\n\treturn binarySerializer.PutUint32(w, littleEndian, msg.LockTime)\n\n}", "title": "" }, { "docid": "f11af5d50ec5d7daa5157e864632b2a7", "score": "0.52591604", "text": "func (pw *protoWriter) Flush() error { return pw.buf.Flush() }", "title": "" }, { "docid": "d001a44cd46b3718bd2fc2e6f59a878d", "score": "0.5257994", "text": "func (st *Upload_File_Data) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = st.Type.WriteBlock(_os, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.Mtime, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.Bytes)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.Bytes {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.Write_int32(st.Dc_id, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.File_token)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.File_token {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 5)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.Encryption_key)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.Encryption_key {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 6)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.Encryption_iv)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.Encryption_iv {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 7)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.File_hashes)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.File_hashes {\n\n\t\terr = v.WriteBlock(_os, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" }, { "docid": "5b8be8e2de545037cf1a8902fb265c87", "score": "0.5250878", "text": "func (c *GobCodec) Write(h *Header, body interface{}) error {\n\tvar err error\n\tdefer func() {\n\t\t// write with buffer, need flush\n\t\t_ = c.buf.Flush()\n\t\tif err != nil {\n\t\t\t_ = c.Close()\n\t\t}\n\t}()\n\tif err = c.enc.Encode(h); err != nil {\n\t\tlog.Printf(\"encoding header error: %s\\n\", err)\n\t\treturn err\n\t}\n\tif err = c.enc.Encode(body); err != nil {\n\t\tlog.Printf(\"encoding body error: %s\\n\", body)\n\t\treturn err\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1466215d03a86bd20fa9d443d6e6cabc", "score": "0.52495617", "text": "func EncodeTo(w io.Writer, val interface{}) (err error) {\n\twrite1(w, VersionTag)\n\terr = writeTag(w, reflect.ValueOf(val))\n\treturn\n}", "title": "" }, { "docid": "ad4d9a2835e2e5d5f0301cc56bfc12cd", "score": "0.5241115", "text": "func (st *TLhelp_support) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = st.Data.WriteBlock(_os, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" }, { "docid": "d36f333f6d9153276932f7422da14cc4", "score": "0.52402806", "text": "func (v *DocumentStructure) Encode(sw stream.Writer) error {\n\tif err := sw.WriteStructBegin(); err != nil {\n\t\treturn err\n\t}\n\n\tif v.R2 == nil {\n\t\treturn errors.New(\"field R2 of DocumentStructure is required\")\n\t}\n\tif err := sw.WriteFieldBegin(stream.FieldHeader{ID: 1, Type: wire.TStruct}); err != nil {\n\t\treturn err\n\t}\n\tif err := v.R2.Encode(sw); err != nil {\n\t\treturn err\n\t}\n\tif err := sw.WriteFieldEnd(); err != nil {\n\t\treturn err\n\t}\n\n\treturn sw.WriteStructEnd()\n}", "title": "" }, { "docid": "9a237c0eebb8faadf053eaa416bc60a3", "score": "0.52352715", "text": "func (d *DevAddr) encode(buffer []byte, pos *int) error {\n\tif pos == nil {\n\t\treturn ErrNilError\n\t}\n\tif len(buffer) < (*pos + 4) {\n\t\treturn ErrBufferTruncated\n\t}\n\tif d.NwkID > MaxNwkID || d.NwkAddr > MaxNwkAddr {\n\t\treturn ErrParameterOutOfRange\n\t}\n\tbinary.LittleEndian.PutUint32(buffer[*pos:], d.ToUint32())\n\t*pos += 4\n\treturn nil\n}", "title": "" }, { "docid": "dddb09ba88baefe92f05f86bf30f758b", "score": "0.52348363", "text": "func (j *Container) MarshalJSONBuf(buf fflib.EncodingBuffer) error {\n\tif j == nil {\n\t\tbuf.WriteString(\"null\")\n\t\treturn nil\n\t}\n\tvar err error\n\tvar obj []byte\n\t_ = obj\n\t_ = err\n\tbuf.WriteString(`{ \"id\":`)\n\tfflib.WriteJsonString(buf, string(j.ID))\n\tbuf.WriteByte(',')\n\tif len(j.Names) != 0 {\n\t\tbuf.WriteString(`\"names\":`)\n\t\tif j.Names != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.Names {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.WriteString(`\"image\":`)\n\tfflib.WriteJsonString(buf, string(j.ImageID))\n\tbuf.WriteString(`,\"layer\":`)\n\tfflib.WriteJsonString(buf, string(j.LayerID))\n\tbuf.WriteByte(',')\n\tif len(j.Metadata) != 0 {\n\t\tbuf.WriteString(`\"metadata\":`)\n\t\tfflib.WriteJsonString(buf, string(j.Metadata))\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BigDataNames) != 0 {\n\t\tbuf.WriteString(`\"big-data-names\":`)\n\t\tif j.BigDataNames != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.BigDataNames {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\tfflib.WriteJsonString(buf, string(v))\n\t\t\t}\n\t\t\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BigDataSizes) != 0 {\n\t\tif j.BigDataSizes == nil {\n\t\t\tbuf.WriteString(`\"big-data-sizes\":null`)\n\t\t} else {\n\t\t\tbuf.WriteString(`\"big-data-sizes\":{ `)\n\t\t\tfor key, value := range j.BigDataSizes {\n\t\t\t\tfflib.WriteJsonString(buf, key)\n\t\t\t\tbuf.WriteString(`:`)\n\t\t\t\tfflib.FormatBits2(buf, uint64(value), 10, value < 0)\n\t\t\t\tbuf.WriteByte(',')\n\t\t\t}\n\t\t\tbuf.Rewind(1)\n\t\t\tbuf.WriteByte('}')\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.BigDataDigests) != 0 {\n\t\tif j.BigDataDigests == nil {\n\t\t\tbuf.WriteString(`\"big-data-digests\":null`)\n\t\t} else {\n\t\t\tbuf.WriteString(`\"big-data-digests\":{ `)\n\t\t\tfor key, value := range j.BigDataDigests {\n\t\t\t\tfflib.WriteJsonString(buf, key)\n\t\t\t\tbuf.WriteString(`:`)\n\t\t\t\tfflib.WriteJsonString(buf, string(value))\n\t\t\t\tbuf.WriteByte(',')\n\t\t\t}\n\t\t\tbuf.Rewind(1)\n\t\t\tbuf.WriteByte('}')\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif true {\n\t\tbuf.WriteString(`\"created\":`)\n\n\t\t{\n\n\t\t\tobj, err = j.Created.MarshalJSON()\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tbuf.Write(obj)\n\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.UIDMap) != 0 {\n\t\tbuf.WriteString(`\"uidmap\":`)\n\t\tif j.UIDMap != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.UIDMap {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\t/* Struct fall back. type=idtools.IDMap kind=struct */\n\t\t\t\terr = buf.Encode(&v)\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\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.GIDMap) != 0 {\n\t\tbuf.WriteString(`\"gidmap\":`)\n\t\tif j.GIDMap != nil {\n\t\t\tbuf.WriteString(`[`)\n\t\t\tfor i, v := range j.GIDMap {\n\t\t\t\tif i != 0 {\n\t\t\t\t\tbuf.WriteString(`,`)\n\t\t\t\t}\n\t\t\t\t/* Struct fall back. type=idtools.IDMap kind=struct */\n\t\t\t\terr = buf.Encode(&v)\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\tbuf.WriteString(`]`)\n\t\t} else {\n\t\t\tbuf.WriteString(`null`)\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tif len(j.Flags) != 0 {\n\t\tbuf.WriteString(`\"flags\":`)\n\t\t/* Falling back. type=map[string]interface {} kind=map */\n\t\terr = buf.Encode(j.Flags)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tbuf.WriteByte(',')\n\t}\n\tbuf.Rewind(1)\n\tbuf.WriteByte('}')\n\treturn nil\n}", "title": "" }, { "docid": "6fd679b45c1d826d3be38a1766353df3", "score": "0.52341765", "text": "func (p *InitPacket) Write(w io.Writer) error {\n\t// Transforming to network bytes\n\tpacket := new(bytes.Buffer)\n\tbinary.Write(packet, binary.BigEndian, p.Iv)\n\tbinary.Write(packet, binary.BigEndian, p.Timestamp)\n\tb := packet.Bytes()\n\tn, err := w.Write(b)\n\t// Consistency check\n\tif err == nil && n != len(b) {\n\t\terr = fmt.Errorf(\"%d bytes written but the packet is %d bytes\", n, len(b))\n\t}\n\treturn err\n}", "title": "" }, { "docid": "13d91ec960407369df49f99b4c881da6", "score": "0.5232097", "text": "func Marshal(w io.Writer, val interface{}) error {\n\treturn EncodeTo(w, val)\n}", "title": "" }, { "docid": "ca3cb59357899985fc005a39517014a7", "score": "0.52313626", "text": "func (st *EncryptedChat_Data) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = _os.Write_int32(st.Id, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int64(st.Access_hash, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.Date, 2)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.Admin_id, 3)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.Participant_id, 4)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(st.Folder_id, 5)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 6)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.G_a)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.G_a {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.WriteHead(codec.LIST, 7)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = _os.Write_int32(int32(len(st.G_a_or_b)), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range st.G_a_or_b {\n\n\t\terr = _os.Write_uint8(v, 0)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t}\n\n\terr = _os.Write_int64(st.Key_fingerprint, 8)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" }, { "docid": "ae4b937e9066bd315a705ba2e2eb1973", "score": "0.5231322", "text": "func (enc *Encoder) Encode(v interface{}) error {\n\tif enc.err != nil {\n\t\treturn enc.err\n\t}\n\n\tvar err error\n\tvar buf = encoderBufferPool.Get().(*encoderBuffer)\n\n\tbuf.data, err = Append(buf.data[:0], v, enc.flags)\n\n\tif err != nil {\n\t\tencoderBufferPool.Put(buf)\n\t\treturn err\n\t}\n\n\tbuf.data = append(buf.data, '\\n')\n\tb := buf.data\n\n\tif enc.prefix != \"\" || enc.indent != \"\" {\n\t\tif enc.buffer == nil {\n\t\t\tenc.buffer = new(bytes.Buffer)\n\t\t\tenc.buffer.Grow(2 * len(buf.data))\n\t\t} else {\n\t\t\tenc.buffer.Reset()\n\t\t}\n\t\tIndent(enc.buffer, buf.data, enc.prefix, enc.indent)\n\t\tb = enc.buffer.Bytes()\n\t}\n\n\tif _, err := enc.writer.Write(b); err != nil {\n\t\tenc.err = err\n\t}\n\n\tencoderBufferPool.Put(buf)\n\treturn err\n}", "title": "" }, { "docid": "0084fb3a0f131e2a69976e1edb9f17a0", "score": "0.5231176", "text": "func (p *Buffer) Marshal(pb Message) error {\n\t// Can the object marshal itself?\n\tif m, ok := pb.(Marshaler); ok {\n\t\tdata, err := m.Marshal()\n\t\tp.buf = append(p.buf, data...)\n\t\treturn err\n\t}\n\n\tt, base, err := getbase(pb)\n\tif structPointer_IsNil(base) {\n\t\treturn ErrNil\n\t}\n\tif err == nil {\n\t\terr = p.enc_struct(GetProperties(t.Elem()), base)\n\t}\n\n\tif collectStats {\n\t\t(stats).Encode++ // Parens are to work around a goimports bug.\n\t}\n\n\tif len(p.buf) > maxMarshalSize {\n\t\treturn ErrTooLarge\n\t}\n\treturn err\n}", "title": "" }, { "docid": "aa023699b570679ae19801e6ef50cf8d", "score": "0.5230342", "text": "func (raw Raw) EncodeMsgpack(w *Writer) error {\n\treturn w.WriteRaw(raw)\n}", "title": "" }, { "docid": "2080ea29dfcce7de62a000055dc4bde8", "score": "0.5229403", "text": "func MarshalTo(c Codec, w io.Writer, o interface{}) error {\n\treturn c.Encoder(w).Encode(o)\n}", "title": "" }, { "docid": "66bc5176eed5cdec34a4abebe4ec3d7a", "score": "0.52218014", "text": "func encode(data interface{}) (bytes.Buffer, error) {\n\tvar buf bytes.Buffer\n\t_, err := xdr.Marshal(&buf, data)\n\n\treturn buf, err\n}", "title": "" }, { "docid": "4dab48426a837434af64923ae913bec7", "score": "0.5218872", "text": "func (_e *MockPlcTag_Expecter) SerializeWithWriteBuffer(ctx interface{}, writeBuffer interface{}) *MockPlcTag_SerializeWithWriteBuffer_Call {\n\treturn &MockPlcTag_SerializeWithWriteBuffer_Call{Call: _e.mock.On(\"SerializeWithWriteBuffer\", ctx, writeBuffer)}\n}", "title": "" }, { "docid": "10ccdfae352dec7c0c5a0f6a23f4eeab", "score": "0.52129674", "text": "func (st *Update) WriteTo(_os *codec.Buffer) error {\n\tvar err error\n\n\terr = _os.Write_int32(st.Constructor, 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = st.Data.WriteBlock(_os, 1)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t_ = err\n\n\treturn nil\n}", "title": "" }, { "docid": "743ebf9571ddae3d9ee6d8cd4dfb7433", "score": "0.52069986", "text": "func (f *Frame) Marshal(buf []byte) ([]byte, error) {\n\tn := f.NumBytes()\n\n\tvar m []byte\n\tif int64(len(buf)) >= n {\n\t\tm = buf[:n]\n\t} else {\n\t\tm = make([]byte, n)\n\t}\n\tbinary.LittleEndian.PutUint64(m[:8], uint64(f.Prim))\n\tif n == 8 {\n\t\treturn m, nil\n\t}\n\tpti := f.GetPTI()\n\tswitch pti {\n\tcase PtiOneFloat64:\n\t\tbinary.LittleEndian.PutUint64(m[8:16], math.Float64bits(f.V0))\n\tcase PtiTwo64:\n\t\tbinary.LittleEndian.PutUint64(m[8:16], math.Float64bits(f.V0))\n\t\tbinary.LittleEndian.PutUint64(m[16:24], uint64(f.V1))\n\tcase PtiUDE:\n\t\tbinary.LittleEndian.PutUint64(m[8:16], uint64(f.Ude))\n\t\tif n == 16 {\n\t\t\treturn m, nil\n\t\t}\n\t\tcopy(m[16:], f.Data)\n\t\tm[n-1] = 0\n\t}\n\n\treturn m, nil\n}", "title": "" }, { "docid": "9861f89f19e85eae033a35c202082174", "score": "0.5201523", "text": "func (codec TypeLengthValueCodec) Encode(msg Message) ([]byte, error) {\n data, err := msg.Serialize()\n if err != nil {\n return nil, err\n }\n buf := new(bytes.Buffer)\n binary.Write(buf, binary.LittleEndian, msg.MessageNumber())\n binary.Write(buf, binary.LittleEndian, int32(len(data)))\n buf.Write(data)\n packet := buf.Bytes()\n return packet, nil\n}", "title": "" }, { "docid": "0833c29a97c17e64b7a13adb1d3d8ecc", "score": "0.51981366", "text": "func (p Obscure) Write(w config.Writer, v []byte, h scope.TypeID) (err error) {\n\tv, err = p.Encrypt(v)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn p.Byte.Write(w, v, h)\n}", "title": "" }, { "docid": "212015bdcfe59ba6a8731ced22e992c4", "score": "0.519378", "text": "func (p *twExtendedPoint) Encode() []byte {\n\tout := make([]byte, fieldBytes)\n\tp.decafEncode(out)\n\treturn out\n}", "title": "" } ]
b86cfc5eb41dc9102dbeb1e4147192e4
GetQueryString returns the QueryString field value.
[ { "docid": "d7cc69f53de268543a852a430be5849a", "score": "0.77875787", "text": "func (o *SLOListWidgetQuery) GetQueryString() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn o.QueryString\n}", "title": "" } ]
[ { "docid": "ddb330f699e12e6b68d8b49c57e1fd34", "score": "0.83808327", "text": "func (o *WafEventRequest) GetQueryString() string {\n\tif o == nil || o.QueryString == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.QueryString\n}", "title": "" }, { "docid": "6f0c61dd09dbb8e0e0dc28510b899b72", "score": "0.82177263", "text": "func (q *QueryConfig) GetQueryString() string {\n\tif q == nil || q.QueryString == nil {\n\t\treturn \"\"\n\t}\n\treturn *q.QueryString\n}", "title": "" }, { "docid": "34de3955036675b5b1d9225ae494e6e8", "score": "0.80268884", "text": "func (f *Form) GetQueryString(k string) string {\n\treturn f.c.Query(k)\n}", "title": "" }, { "docid": "6f18aa3ecf23a5a5093572d7ba1e9206", "score": "0.7988958", "text": "func (i Input) GetQueryString(key string) (string, error) {\n\t// Check if parameter is defined\n\t_, err := i.Parameters.GetParameter(QueryParameter, key)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn i.Request.URL.Query().Get(key), nil\n}", "title": "" }, { "docid": "a52d809b810ce0f9ef26ed018e829f56", "score": "0.7820006", "text": "func GetQueryString(ctx context.Context) *QueryString {\n\treturn ctx.Value(queryStringContextKey).(*QueryString)\n}", "title": "" }, { "docid": "0fa00ecfbdd4aff13af91517fb66c5be", "score": "0.7705041", "text": "func GetQueryString(r *http.Request, key string) string {\n\tm, err := url.ParseQuery(r.URL.RawQuery)\n\tif err != nil {\n\t\treturn \"\"\n\t}\n\treturn m[key][0]\n}", "title": "" }, { "docid": "392633c89fb4dd73f645715743f03e54", "score": "0.69572186", "text": "func (u *URL) QueryString() string {\n\treturn string(u.URI.QueryString())\n}", "title": "" }, { "docid": "e59b957930c2e97a7e08be2f29306493", "score": "0.6911704", "text": "func (u *URI) QueryString() []byte {\n\treturn u.queryString\n}", "title": "" }, { "docid": "7f8f54cf90b03aecaef1d08e6f854036", "score": "0.6866662", "text": "func (ctx *Context) QueryString() string {\n\treturn ctx.echoContext.QueryString()\n}", "title": "" }, { "docid": "a31a8cfa17a1d253bd64f1239e881f5e", "score": "0.6830844", "text": "func (r *Request) QueryString() string {\n\trawQuery := r.QueryValues().Encode()\n\tquery, err := url.QueryUnescape(rawQuery)\n\tif err != nil {\n\t\tglog.Warning(err)\n\t\treturn rawQuery // use rawQuery if unescape fail\n\t}\n\treturn query\n}", "title": "" }, { "docid": "13dd6306da5301c3d4343f091d6cf731", "score": "0.68182737", "text": "func (o *WafEventRequest) SetQueryString(v string) {\n\to.QueryString = &v\n}", "title": "" }, { "docid": "745ef1d3a8eb2ad0c766b687c2b3be8e", "score": "0.67975837", "text": "func getQueryString(req *http.Request, key string, def string) string {\n\tq := req.URL.Query()\n\n\tv := q.Get(key)\n\tif v == \"\" {\n\t\treturn def\n\t}\n\n\treturn v\n}", "title": "" }, { "docid": "7bc9535e8f4e652b207b4b3367f43238", "score": "0.67774296", "text": "func (m *SearchAlteration) GetAlteredQueryString()(*string) {\n val, err := m.GetBackingStore().Get(\"alteredQueryString\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "7fba0c8fe5a2622c4014b3fd2434c47f", "score": "0.6754166", "text": "func (o WebAclRuleStatementSqliMatchStatementFieldToMatchOutput) QueryString() WebAclRuleStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementSqliMatchStatementFieldToMatch) *WebAclRuleStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "eb3d562ef0a8b7c5c188c967f68a78e6", "score": "0.672265", "text": "func (c *Context) QueryString() string {\n\treturn c.Request.URL.RawQuery\n}", "title": "" }, { "docid": "7fc81110bb2fe7ed4827e069c6a5032e", "score": "0.67104983", "text": "func (f ListFilter) getQueryString() string {\n\tv := url.Values{}\n\tif f.FriendlyName != \"\" {\n\t\tv.Add(\"FriendlyName\", f.FriendlyName)\n\t}\n\tif f.Status != \"\" {\n\t\tv.Add(\"Status\", f.Status)\n\t}\n\tqs := v.Encode()\n\tif qs != \"\" {\n\t\treturn \"?\" + qs\n\t}\n\treturn qs\n}", "title": "" }, { "docid": "7d784f58432f90bf0d55e8f39aeb2d96", "score": "0.6707839", "text": "func (u *MyUrl) GetQueryValue() string {\n\tvar queryString string\n\tqueryLength := len(u.QueryValues)\n\tcounter := 0\n\tfor key, value := range u.QueryValues {\n\t\tqueryString += url.QueryEscape(key) +\n\t\t\t\"=\" + url.QueryEscape(value)\n\t\tif counter != queryLength-1 {\n\t\t\tqueryString += \"&\"\n\t\t}\n\t\tcounter++\n\t}\n\tresult := queryString\n\treturn result\n}", "title": "" }, { "docid": "5e2df2efd482225d416272d814222a83", "score": "0.66852224", "text": "func (o WebAclRuleStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementSqliMatchStatementFieldToMatch) *WebAclRuleStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "ff59c21b990ca09fedb90b65a88a6915", "score": "0.66764396", "text": "func (m *Measurement) QueryString() string {\n return m.data.QueryString\n}", "title": "" }, { "docid": "79ef9d0b972f9b7fd89d28e8eaa30422", "score": "0.6641068", "text": "func GetQueryValue(r *http.Request, keyName string) string {\n\treturn r.URL.Query().Get(keyName)\n}", "title": "" }, { "docid": "5f2022136e94ef0f59fa22e7ed8aba40", "score": "0.66202134", "text": "func (o WebAclRuleStatementRegexMatchStatementFieldToMatchOutput) QueryString() WebAclRuleStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRegexMatchStatementFieldToMatch) *WebAclRuleStatementRegexMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "6360d362a6214f78c1cf5c0ea9a80eac", "score": "0.6586618", "text": "func (o WebAclRuleStatementXssMatchStatementFieldToMatchOutput) QueryString() WebAclRuleStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementXssMatchStatementFieldToMatch) *WebAclRuleStatementXssMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "06ecd8b6f45700e18d52a7c7b0e27834", "score": "0.6570497", "text": "func (q *QueryConfig) GetQueryStringOk() (string, bool) {\n\tif q == nil || q.QueryString == nil {\n\t\treturn \"\", false\n\t}\n\treturn *q.QueryString, true\n}", "title": "" }, { "docid": "21a09c9a79ad714533f3556bbdf86b14", "score": "0.65616167", "text": "func (o WebAclRuleStatementRegexMatchStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRegexMatchStatementFieldToMatch) *WebAclRuleStatementRegexMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "ebfac956d27b4dd794a3cee45a751c96", "score": "0.6551049", "text": "func QueryString(r *http.Request, key string) string {\n\treturn r.URL.Query().Get(key)\n}", "title": "" }, { "docid": "0492e5ad420403aebc104723aeb98187", "score": "0.6550545", "text": "func ParseQueryStringToString(r *http.Request, queryStringKey string, defaultValue string) string {\n\tvalue, ok := r.URL.Query()[queryStringKey]\n\tif !ok {\n\t\treturn defaultValue\n\t}\n\treturn value[0]\n}", "title": "" }, { "docid": "7edff57e1783aeafd06351228084db76", "score": "0.6547648", "text": "func getQueryString(query url.Values) string {\n\tencoded := query.Encode()\n\tif len(encoded) > 0 {\n\t\tencoded = fmt.Sprintf(\"?%s\", encoded)\n\t}\n\treturn encoded\n}", "title": "" }, { "docid": "a332cae00b3cdc2c36d44973d1bd7c28", "score": "0.6545135", "text": "func GetFilteredQueryString(q string) string {\n\tvalues, err := url.ParseQuery(q)\n\tif err != nil {\n\t\treturn placeholder\n\t}\n\n\tfor name := range values {\n\t\tvalues.Set(name, placeholder)\n\t}\n\n\treturn values.Encode()\n}", "title": "" }, { "docid": "939c3fc0b44803d6081265827c0d3c5a", "score": "0.65149546", "text": "func (f *FilterConfiguration) GetQuery() string {\n\tif f == nil || f.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *f.Query\n}", "title": "" }, { "docid": "f50b8a8bfde8cbd1c37d0f77ae7ee48c", "score": "0.6502405", "text": "func (o *WafEventRequest) GetQueryStringOk() (*string, bool) {\n\tif o == nil || o.QueryString == nil {\n\t\treturn nil, false\n\t}\n\treturn o.QueryString, true\n}", "title": "" }, { "docid": "1c8b4efd275d404a8cc17db340a7c2fc", "score": "0.64977443", "text": "func (o WebAclRuleStatementXssMatchStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementXssMatchStatementFieldToMatch) *WebAclRuleStatementXssMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "34a7f1cba132480cdf62abe6f883579a", "score": "0.6494471", "text": "func (o RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "c78ad72ab85937d76065eecb98f71deb", "score": "0.64731747", "text": "func (f *Filter) GetQuery() string {\n\tif f == nil || f.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *f.Query\n}", "title": "" }, { "docid": "fe9e34b208274baee00de2bac0c112eb", "score": "0.6448166", "text": "func QueryString(r *http.Request, param string) string {\n\treturn r.URL.Query().Get(param)\n}", "title": "" }, { "docid": "0b574111de4a88ee2c6322c7e6a24d57", "score": "0.64375734", "text": "func (o RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "4f05475d0f499c399ee6725dc1de3b12", "score": "0.64290977", "text": "func (u *EchoRequest) QueryString() url.Values {\n\tvar q = url.Values{}\n\tq.Set(\"m_type\", u.MType.String())\n\tq.Set(\"message\", u.Message)\n\treturn q\n}", "title": "" }, { "docid": "988aa88b0887fd61dfafb48831326e72", "score": "0.64199233", "text": "func (q *FMQuery) QueryString() string {\n\tvar startString = q.dbLayString() + withAmp(q.responseLayoutString()) + withAmp(q.scriptsString()) + withAmp(q.scriptParamsString())\n\tswitch q.Action {\n\tcase Delete, Duplicate:\n\t\treturn startString +\n\t\t\twithAmp(q.recordIDString()) +\n\t\t\tq.Action.String()\n\tcase Edit:\n\t\treturn startString +\n\t\t\twithAmp(q.recordIDString()) +\n\t\t\twithAmp(q.simpleFieldsString()) +\n\t\t\tq.Action.String()\n\tcase New:\n\t\treturn startString +\n\t\t\twithAmp(q.simpleFieldsString()) +\n\t\t\tq.Action.String()\n\tcase FindAny:\n\t\treturn startString +\n\t\t\tq.Action.String()\n\tcase FindAll:\n\t\treturn startString +\n\t\t\twithAmp(q.sortFieldsString()) +\n\t\t\twithAmp(q.maxSkipString()) +\n\t\t\tq.Action.String()\n\tcase Find:\n\t\tif q.RecordID != fmNoRecordID {\n\t\t\treturn startString +\n\t\t\t\twithAmp(q.recordIDString()) + \"-find\"\n\t\t}\n\t\tif q.compoundQueryString() == \"\" || q.compoundFieldsString() == \"\" {\n\t\t\treturn startString +\n\t\t\t\twithAmp(q.sortFieldsString()) +\n\t\t\t\twithAmp(q.maxSkipString()) +\n\t\t\t\t\"-find\"\n\t\t}\n\t\treturn startString +\n\t\t\twithAmp(q.sortFieldsString()) +\n\t\t\twithAmp(q.maxSkipString()) +\n\t\t\twithAmp(q.compoundQueryString()) +\n\t\t\twithAmp(q.compoundFieldsString()) +\n\t\t\tq.Action.String()\n\tdefault:\n\t\treturn \"\"\n\t}\n}", "title": "" }, { "docid": "1495083e9188727a31131b3970209e09", "score": "0.64087456", "text": "func (o RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "21ff485f2699cd146c15c507e5c9dce9", "score": "0.6389097", "text": "func (s *QueryDefinition) SetQueryString(v string) *QueryDefinition {\n\ts.QueryString = &v\n\treturn s\n}", "title": "" }, { "docid": "8dd2dd2a5c0431c429556596e84e2ad1", "score": "0.6388534", "text": "func (s *SearchChatsOnServerRequest) GetQuery() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Query\n}", "title": "" }, { "docid": "314d2c1fddc3526cee392e2a2f5bbf9c", "score": "0.6381511", "text": "func (s *SearchMessagesRequest) GetQuery() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Query\n}", "title": "" }, { "docid": "e2e5df97e8b24baab6659a8df9e88b41", "score": "0.6378863", "text": "func (o RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "9b10354cefbd62c6c324f651bdd21487", "score": "0.6366193", "text": "func (s *SearchSecretMessagesRequest) GetQuery() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Query\n}", "title": "" }, { "docid": "fee4558963a5d53fd089c179bef22c09", "score": "0.63598824", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "969662c86781dc257d6661f399a783dc", "score": "0.6357342", "text": "func (o RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "9adad448ebf5eba2f40d155fc4002c0a", "score": "0.63511485", "text": "func (q *QueryConfig) SetQueryString(v string) {\n\tq.QueryString = &v\n}", "title": "" }, { "docid": "5eca739be39e31a703b12ade0515d26e", "score": "0.63495636", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "0006108947bbfb3c952bd0b9ac11f0b0", "score": "0.63423574", "text": "func GetQuery(qs string, query Query) error {\n\treturn query.UnmarshalQueryString(qs)\n}", "title": "" }, { "docid": "c05231bf52be8fa93e09e2ba7fc8c28b", "score": "0.63418096", "text": "func (o RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "3c2e0a702a3c0cc6fe5550970c4d49dc", "score": "0.63344556", "text": "func (c *Base) QueryString(ctx *iris.Context, key string, defaultVal string) string {\n\tif str := ctx.URLParam(key); str != \"\" {\n\t\treturn str\n\t}\n\treturn defaultVal\n}", "title": "" }, { "docid": "f48f84170e995335900de89bb4810c18", "score": "0.6334384", "text": "func (s *PutQueryDefinitionInput) SetQueryString(v string) *PutQueryDefinitionInput {\n\ts.QueryString = &v\n\treturn s\n}", "title": "" }, { "docid": "d2f72e852f8181075326918344bfd7bb", "score": "0.6334066", "text": "func (e *EventStreamDefinition) GetQuery() string {\n\tif e == nil || e.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *e.Query\n}", "title": "" }, { "docid": "fbff71012098e0f3656d55f22cb7de87", "score": "0.63330185", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "807ffa9fa1116528698689bba2366881", "score": "0.6329925", "text": "func (s *QueryInfo) SetQueryString(v string) *QueryInfo {\n\ts.QueryString = &v\n\treturn s\n}", "title": "" }, { "docid": "654b694f3c1bdd67832c26b785c15be9", "score": "0.6324173", "text": "func (u *EchoResponse) QueryString() url.Values {\n\tvar q = url.Values{}\n\tq.Set(\"m_type\", u.MType.String())\n\tq.Set(\"message\", u.Message)\n\treturn q\n}", "title": "" }, { "docid": "45230b8dfc632a5c5db33096adfb5c80", "score": "0.63222593", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "cad7c382632ced7ae0632d7d34c27c55", "score": "0.6319651", "text": "func (req Request) GetQuery(key string) string {\n\treturn req.Query.Get(key)\n}", "title": "" }, { "docid": "07149dd486e41c8156c724d701cc5289", "score": "0.6317458", "text": "func (s *SearchStickerSetsRequest) GetQuery() (value string) {\n\tif s == nil {\n\t\treturn\n\t}\n\treturn s.Query\n}", "title": "" }, { "docid": "dc2ac5bdd8a1c4f79fa40842c2518260", "score": "0.6312829", "text": "func (r *PageList) GetQuery() string {\n\treturn r.Query\n}", "title": "" }, { "docid": "7aec8d304ea48c23f6248a9e6984fc3e", "score": "0.6304853", "text": "func GetQuery(u string) (url.Values, error) {\n\tq, err := url.ParseQuery(html.UnescapeString(u))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn q, nil\n}", "title": "" }, { "docid": "b00c70c76abdf8a50bccf000cf38b5bb", "score": "0.6303673", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchOutput) QueryString() WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatch) *WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "248ff858d4a8684cdc4d586556a16773", "score": "0.6299366", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "744d4de3fce433841bcdaf24a5144846", "score": "0.6298355", "text": "func (s *StartQueryExecutionInput) SetQueryString(v string) *StartQueryExecutionInput {\n\ts.QueryString = &v\n\treturn s\n}", "title": "" }, { "docid": "d5443f43a37c8b471c07064126f695c4", "score": "0.6289542", "text": "func (o WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatch) *WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRateBasedStatementScopeDownStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "bd3035ff043ec18cf62c8e52efb3a1ab", "score": "0.62875235", "text": "func (o *SLOHistoryMetrics) GetQuery() string {\n\tif o == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn o.Query\n}", "title": "" }, { "docid": "872764b9a3fd333da294ffe525e0e58b", "score": "0.62848365", "text": "func (o RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "aaa236c9c4233f8d5dc1133cb7d99a40", "score": "0.6281235", "text": "func (o RuleGroupRuleStatementOrStatementStatementSizeConstraintStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementSizeConstraintStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementSizeConstraintStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "df60d78aafcc3db6ef249aa557bd5f90", "score": "0.62787306", "text": "func (o *SLOListWidgetQuery) GetQueryStringOk() (*string, bool) {\n\tif o == nil {\n\t\treturn nil, false\n\t}\n\treturn &o.QueryString, true\n}", "title": "" }, { "docid": "96f06f03e1193f9bd471f95ec1ab952d", "score": "0.6277842", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "b4859a595410926687fc9b30826f8f17", "score": "0.6273314", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "a8fbb75150844e36e5c23b54eb3183b4", "score": "0.6262578", "text": "func (i *Input) GetQueryParam(param string) string {\n\tparams, ok := i.event[\"queryStringParameters\"]\n\tif !ok || params == nil {\n\t\treturn \"\"\n\t}\n\n\tvalue, ok := params.(map[string]interface{})[param]\n\tif !ok {\n\t\treturn \"\"\n\t}\n\n\tswitch v := value.(type) {\n\tcase string:\n\t\treturn v\n\tdefault:\n\t\tencoded, _ := json.Marshal(value)\n\t\treturn string(encoded)\n\t}\n}", "title": "" }, { "docid": "c1669d5fe3edd9b43072203b2d99ad13", "score": "0.6256022", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "5bf62ddad24ff64fc453967372c5b3c7", "score": "0.62510866", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "1fdf7cbfdb3fb758525691f823cea03f", "score": "0.62509733", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "fbe445e8e67efc332cdffd374aafbf59", "score": "0.6250895", "text": "func (o RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "31893d088181519a39c54d0f28777262", "score": "0.624947", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "9ea6de47fb7465ef76dbd6475d9bc332", "score": "0.6237824", "text": "func (gq *getQuery) GetQuery() (url.Values, error) {\n\tvals := url.Values{}\n\n\tif gq.Attachments {\n\t\tvals.Set(\"attachments\", \"true\")\n\t}\n\tif gq.AttEncodingInfo {\n\t\tvals.Set(\"att_encoding_info\", \"true\")\n\t}\n\tif len(gq.AttsSince) > 0 {\n\t\tdata, err := json.Marshal(gq.AttsSince)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvals.Set(\"attsSince\", string(data[:]))\n\t}\n\tif gq.Conflicts {\n\t\tvals.Set(\"conflicts\", \"true\")\n\t}\n\tif gq.DeletedConflicts {\n\t\tvals.Set(\"deleted_conflicts\", \"true\")\n\t}\n\tif gq.Latest {\n\t\tvals.Set(\"latest\", \"true\")\n\t}\n\tif gq.LocalSeq {\n\t\tvals.Set(\"local_seq\", \"true\")\n\t}\n\tif gq.Meta {\n\t\tvals.Set(\"meta\", \"true\")\n\t}\n\tif len(gq.OpenRevs) > 0 {\n\t\tdata, err := json.Marshal(gq.OpenRevs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tvals.Set(\"open_revs\", string(data[:]))\n\t}\n\tif gq.Rev != \"\" {\n\t\tvals.Set(\"rev\", gq.Rev)\n\t}\n\tif gq.Revs {\n\t\tvals.Set(\"revs\", \"true\")\n\t}\n\tif gq.RevsInfo {\n\t\tvals.Set(\"revs_info\", \"true\")\n\t}\n\n\treturn vals, nil\n}", "title": "" }, { "docid": "3c52d79600236b3c3f2e59309b029d2e", "score": "0.623718", "text": "func (w *WidgetEvent) GetQuery() string {\n\tif w == nil || w.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *w.Query\n}", "title": "" }, { "docid": "46aeb45b015080afcbf720b507a27b42", "score": "0.6235829", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "c1ccbbd8fb0e346e9c53c5f92ed80ba1", "score": "0.6233848", "text": "func (o WebAclRuleStatementSizeConstraintStatementFieldToMatchOutput) QueryString() WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementSizeConstraintStatementFieldToMatch) *WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "16c506f452fb3b91a28fdbad65f6efce", "score": "0.6219178", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "91df1a753660e8f8ee801522598cc528", "score": "0.6218043", "text": "func (o WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchOutput) QueryString() WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatch) *WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "ead23873214480d082bb205b7a757fc2", "score": "0.62161356", "text": "func (t *TileDefRequest) GetQuery() string {\n\tif t == nil || t.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *t.Query\n}", "title": "" }, { "docid": "03efa83a1da441be55c8ce935a59f773", "score": "0.6216024", "text": "func (o RuleGroupRuleStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementOrStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "bda3935ecd1daa25f8394b49a1a7589b", "score": "0.6211466", "text": "func (o WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatch) *WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementRegexPatternSetReferenceStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "57bbca51f07a32b56ffba503bc5c5c31", "score": "0.62094", "text": "func (l *LogStreamDefinition) GetQuery() string {\n\tif l == nil || l.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *l.Query\n}", "title": "" }, { "docid": "9f5bd3af21648ca54b9a71f3c369d93b", "score": "0.62064725", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "29d85c097eaae870ec025d2e38ed30cb", "score": "0.6200151", "text": "func (o *SLOListWidgetQuery) SetQueryString(v string) {\n\to.QueryString = v\n}", "title": "" }, { "docid": "b28964ab60b0c18ee76789e4ba16b232", "score": "0.61909354", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "428743244e05f6b5e77903dd750e3654", "score": "0.61892617", "text": "func (a *Alert) GetQuery() string {\n\tif a == nil || a.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *a.Query\n}", "title": "" }, { "docid": "98cefef060e2713b85eb907f3221fa7c", "score": "0.61863506", "text": "func (o RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementAndStatementStatementRegexMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "284102aebdfb541343fad59befcbf58a", "score": "0.6179913", "text": "func (o DistributionDefaultCacheBehaviorForwardedValuesOutput) QueryString() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v DistributionDefaultCacheBehaviorForwardedValues) bool { return v.QueryString }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "5e9c0f8326b934f4a6bae85e1465a493", "score": "0.6177937", "text": "func (p *parser) GetParsedQuery() string {\n\treturn p.revisedQuery\n}", "title": "" }, { "docid": "6f86ac9bc700c607109c60fbf0ecb904", "score": "0.61738324", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementByteMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "2adf75782fc776196457201b0d7e7684", "score": "0.6170464", "text": "func (b *Baton) QueryString(key string) (string, bool) {\n\tstr := b.r.URL.Query().Get(key)\n\tif len(str) < 1 {\n\t\treturn \"\", false\n\t}\n\treturn str, true\n}", "title": "" }, { "docid": "db0b92f0093807de2126334516c000cd", "score": "0.6165815", "text": "func (o DistributionOrderedCacheBehaviorForwardedValuesOutput) QueryString() pulumi.BoolOutput {\n\treturn o.ApplyT(func(v DistributionOrderedCacheBehaviorForwardedValues) bool { return v.QueryString }).(pulumi.BoolOutput)\n}", "title": "" }, { "docid": "8fac27be4f286a13dafb88ad6441b6c5", "score": "0.61653036", "text": "func (o WebAclRuleStatementSizeConstraintStatementFieldToMatchPtrOutput) QueryString() WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *WebAclRuleStatementSizeConstraintStatementFieldToMatch) *WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(WebAclRuleStatementSizeConstraintStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "b92a3fad43f2759c3902d570c00fedd8", "score": "0.6162055", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchPtrOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v *RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryString {\n\t\tif v == nil {\n\t\t\treturn nil\n\t\t}\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementSqliMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "fdcc5665ad33355e7afcce5295943b59", "score": "0.6152506", "text": "func (o RuleGroupRuleStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchOutput) QueryString() RuleGroupRuleStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput {\n\treturn o.ApplyT(func(v RuleGroupRuleStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatch) *RuleGroupRuleStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchQueryString {\n\t\treturn v.QueryString\n\t}).(RuleGroupRuleStatementOrStatementStatementNotStatementStatementXssMatchStatementFieldToMatchQueryStringPtrOutput)\n}", "title": "" }, { "docid": "412984caffb12c487024c8dfaf71cac5", "score": "0.61510086", "text": "func (w *Widget) GetQuery() string {\n\tif w == nil || w.Query == nil {\n\t\treturn \"\"\n\t}\n\treturn *w.Query\n}", "title": "" } ]
b21c4cb12bee8c645f5dda1954c44207
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
[ { "docid": "f18668f42e126a228f6a63214da6549e", "score": "0.0", "text": "func (in *List) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
[ { "docid": "bec585c3741d33d02f1bac002151ce05", "score": "0.73602164", "text": "func (in *Runtime) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "92ab1939fb02c0d288e64cae5e007ac9", "score": "0.72249705", "text": "func DeepCopy(obj interface{}) (r interface{}) {\n\treturn go_deepcopy.Copy(obj)\n}", "title": "" }, { "docid": "33e9f359830ebb46aaab30b9eff7c550", "score": "0.71386445", "text": "func (in *Network) DeepCopyObject() runtime.Object {\nif c := in.DeepCopy(); c != nil {\nreturn c\n}\nreturn nil\n}", "title": "" }, { "docid": "3347ef85eeed487752f2af5ad6f8cccc", "score": "0.7098431", "text": "func (in *Run) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "bd0a0db6c63ccaa643c40d29a695c1d7", "score": "0.7078234", "text": "func (in *VeleroInstall) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45cdd1dffea6cff8d6de0cc88473da12", "score": "0.70615464", "text": "func (in *Datakit) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "51c7b116933b8ebf439e820b69618123", "score": "0.70369273", "text": "func (in *BuildRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4db7951820f3f54b8de42bf79ad0e75a", "score": "0.70364565", "text": "func (in *Port) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "770bba5351e5ed25a6cf4cd24b368841", "score": "0.7024145", "text": "func (in *Base) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b4f3859beeb939f4f588c5c59a4246b7", "score": "0.7011291", "text": "func (in *DingShin888Type) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8990dba588b3ca4c14772f9f2e57cf35", "score": "0.6987812", "text": "func (in *RedisVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1d4c6527b916e54ba0777a054d7629a", "score": "0.69671345", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a1d4c6527b916e54ba0777a054d7629a", "score": "0.69671345", "text": "func (in *Extension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a89adcd5592af968511aa79f6072ebd4", "score": "0.6962531", "text": "func (in *MacBook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0c55dfab4bb060a6057768fbf012e1b", "score": "0.6962238", "text": "func (in *Standalone) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "95e80f1c20ab1f8e99879171d716b8cb", "score": "0.69572026", "text": "func (in *NetworkList) DeepCopyObject() runtime.Object {\nif c := in.DeepCopy(); c != nil {\nreturn c\n}\nreturn nil\n}", "title": "" }, { "docid": "bde395ade772c32b35a7a9267d2fee3e", "score": "0.69570404", "text": "func (in *EventBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "030df03bc1795d6085beb84cf812c360", "score": "0.6947719", "text": "func (in *PipelineRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0eb04cff0846bd67a605352eb490aa9c", "score": "0.69461244", "text": "func (in *Iter8) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4b9def50fe26f4fdc1e040c1a63d2b64", "score": "0.69390506", "text": "func (in *Genericdaemon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ecc17f78abc6e644bb22e2836d1726a6", "score": "0.69210976", "text": "func (in *RuntimeList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "432ce827f7a65ed253621190b6ee9edb", "score": "0.691967", "text": "func (in *View) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "fd0e51316a7b486bd283a4dcca70b381", "score": "0.6901703", "text": "func (in *VirtualHost) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "729fe22e99cf83ec9383557d074eafbe", "score": "0.6896038", "text": "func (in *MysqlBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "75c97097d92e2b3a75e4bb85235d2230", "score": "0.6888014", "text": "func (in *CephRBDMirror) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "75f3a4c8bbb0b798eecaf902bf392e45", "score": "0.68875796", "text": "func (in *EtcdProxy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e2453c64911b22a0e21ea255fd4f5e3c", "score": "0.6880698", "text": "func (in *RpcService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "27331ed45a6ffd21fc86e203e455c3f4", "score": "0.68755126", "text": "func (in *Host) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d845b8d4e58bb7158cef98b5d66e8423", "score": "0.6872736", "text": "func (in *Chaincode) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3cc1db4bcd86e808735592fbd459cfcc", "score": "0.686197", "text": "func (in *Kubemanager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "aedecadc77b0c322960c324f0cfeec0f", "score": "0.6860161", "text": "func (in *KubevirtMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "657831a1e0160184fdd5c11310b968d8", "score": "0.6858397", "text": "func (in *MemcachedVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0ba02670c1575f93d5515cc3246a9e12", "score": "0.6848743", "text": "func (in *ViewList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8930b1fdd2549ccb6fc862dbe87945f2", "score": "0.6844354", "text": "func (in *Receiver) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83bf86fa9a7ee0c81d6671f21cc4925f", "score": "0.6842512", "text": "func (in *RkeAddon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c35108e61454644332ecdc049959caf", "score": "0.6842458", "text": "func (in *KitaSpace) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "28cc1e8a5e1b2073bb142f5d6867dc93", "score": "0.68368536", "text": "func (in *Kibana) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0c21048bf98b285d5a88ff6ac35fef14", "score": "0.6836473", "text": "func (in *Iter8List) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.6835855", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.6835855", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "47873f0593624111dc977964e679e6b1", "score": "0.6835855", "text": "func (in *Build) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "686ff00b62204806d68c9301afec2fbd", "score": "0.68325144", "text": "func (in *Fluentd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b40d62941763c1d416e9d31ab26c911f", "score": "0.6826851", "text": "func (in *Redis) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e6311e72ac7441529ef9836a9c47d80", "score": "0.68193394", "text": "func (in *Peer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2e6311e72ac7441529ef9836a9c47d80", "score": "0.68193394", "text": "func (in *Peer) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9f2cab9dbf9d3837d5e240104c44f2a5", "score": "0.68144304", "text": "func (in *BaseImage) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "81ec9c7e50e902721ad3bf36f4c935cd", "score": "0.6811049", "text": "func (in *RunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e7812f4458e6515c6a27452bf00aea25", "score": "0.6809136", "text": "func (in *BuildRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3c48d899e5ab1210b58360f2e96b74bc", "score": "0.6808345", "text": "func (in *VirtulMachine) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "80550853547af574a8c3af9844dea1a5", "score": "0.67991745", "text": "func (in *DatakitList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1ef7c62c12f497bfec5c213d9b3f4c8a", "score": "0.6799122", "text": "func (in *BuildStrategy) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a88f5321a0cb3b5444c8406007f7c29b", "score": "0.67983335", "text": "func (in *Something) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "97e495bf2d4df1e4618b4246db180a9a", "score": "0.67957366", "text": "func (in *DingShinType) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0aca54338016103ddc7086798d108fa1", "score": "0.67893016", "text": "func (in *ChaosService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "69873677637e7096c79ebbc283e462e3", "score": "0.6788984", "text": "func (in *Tunnel) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8d3edbc4aafe3a0e94ec1c46a354361", "score": "0.6788019", "text": "func (in *ExtensionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "e8d3edbc4aafe3a0e94ec1c46a354361", "score": "0.6788019", "text": "func (in *ExtensionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "269d6d6ded99a4fb32894042b6e09906", "score": "0.6787886", "text": "func (in *ArgoCD) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "269d6d6ded99a4fb32894042b6e09906", "score": "0.6787886", "text": "func (in *ArgoCD) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c5af50219c350299d4c4519ea368e615", "score": "0.6785883", "text": "func (in *Crowd) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b3b9ea2bcdf7e9e1d9cfe1e83aad516", "score": "0.6782317", "text": "func (in *ServiceMeshExtension) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f6385e72355fbaa8cb620488489d711", "score": "0.6781952", "text": "func (in *ArgoCDExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2f6385e72355fbaa8cb620488489d711", "score": "0.6781952", "text": "func (in *ArgoCDExport) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "25a155b2a12099e23ed2847a7c8cff50", "score": "0.67765814", "text": "func (in *Addon) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5c711e599e565345ddb4443fb2297163", "score": "0.6770578", "text": "func (in *Director) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ede1d5dc41c768ccb674e269c5f9d6c6", "score": "0.6767958", "text": "func (in *PaddleService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6766233", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5884cf4be95f33abeb1548f45b0d68ae", "score": "0.6766233", "text": "func (in *VirtualService) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ff7df7379f0578daabcbbeb337ca24c0", "score": "0.67606246", "text": "func (in *MysqlBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "4ecb51587a6c9e8cbefcfb10eafaec3b", "score": "0.67547584", "text": "func (in *GenericdaemonList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "cc5cb736b00f9874538ad9d302cbd48a", "score": "0.6753389", "text": "func (in *SyntheticRun) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "91d693471187a0da4b58f2d4d2c54edf", "score": "0.6750084", "text": "func (in *Password) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "0d935506b803e6ee1a9d90e0160b2261", "score": "0.674928", "text": "func (in *Remote) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "2800934e3afa1df923b4cde8cbbc8174", "score": "0.6749265", "text": "func (in *BundleView) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "489ac2ef40f080225543e2e17c3bd783", "score": "0.67487484", "text": "func (in *EtcdVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "a95e988ab9b2587f520277cb34df35fc", "score": "0.6747456", "text": "func (in *FusionAppInstance) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "05c4256b5dd70484f99b222d961b6e18", "score": "0.6746901", "text": "func (in *GlobalRoleBinding) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67370975", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "6ffb7ee075d003d884c6708fc7694c95", "score": "0.67370975", "text": "func (in *User) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f72db4f50be20f654f8ffbaf17ad2fa", "score": "0.6736549", "text": "func (in *ArgoCDList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "1f72db4f50be20f654f8ffbaf17ad2fa", "score": "0.6736549", "text": "func (in *ArgoCDList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "5ab6268416817b0e311d2948bd652521", "score": "0.6736242", "text": "func (in *APIVersions) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9ad9cb30efab1b79e2588ed1670b3ec6", "score": "0.6733704", "text": "func (in *DataType) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "425c312ec8d40530130c241f3b3dddfd", "score": "0.6732443", "text": "func (in *PipelineRunList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d5bc98c1ff2d063db4c0b73e98f862f1", "score": "0.6730956", "text": "func (in *Cassandra) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d882a45db822a9493ccaa49a16bc01b7", "score": "0.67297024", "text": "func (in *SlimeBoot) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "c1472e180b8d5c85a37780678edd2257", "score": "0.67284113", "text": "func (in *Iperf3) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "9b710022648c9a8902c91eed24a767fd", "score": "0.6727832", "text": "func (in *EdgeX) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "8a272e0205c0a055fd18df513c0f8e5c", "score": "0.67266464", "text": "func (in *MonitoringConsole) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "20986c2271614ac062e026acef32e687", "score": "0.6726471", "text": "func (in *Bundle) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "44a77fa4ba40fba09cd27830bd44497e", "score": "0.67239267", "text": "func (in *listchecker) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "ca15ecdf5db91acfa35f372a962726e2", "score": "0.6722397", "text": "func (in *RedisVersionList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "7e2628d0ac0626ab19857f2a8e75d740", "score": "0.6720124", "text": "func (in *EdgeXList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "94e00e1d60b780f3ea465a99fde4306a", "score": "0.6714343", "text": "func (in *HelmApplicationVersion) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "ac6e507b07597564c35fb3b42c3dd3a4", "score": "0.6713815", "text": "func (in *DialogflowCXWebhook) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "76e29853467e0646666eb77db1b5ddbc", "score": "0.6712182", "text": "func (in *EventBindingList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f0e3fba0a391303d0352cf2e51f29f5d", "score": "0.6711723", "text": "func (in *Webui) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "d7a5e4cd1c1ecd36b879d9ee3e0893fb", "score": "0.670722", "text": "func (in *FusionApp) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be4cf0d77c97470e33b542733e7b5a8a", "score": "0.67070633", "text": "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "be4cf0d77c97470e33b542733e7b5a8a", "score": "0.67070633", "text": "func (in *Manager) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b9ec9036bc10219eb001d43b7578e012", "score": "0.67059475", "text": "func (in *CephRBDMirrorList) DeepCopyObject() runtime.Object {\n\tif c := in.DeepCopy(); c != nil {\n\t\treturn c\n\t}\n\treturn nil\n}", "title": "" } ]
8d3f2a5e6c1c352a360cf13ef7a7f8e5
Deposit is a paid mutator transaction binding the contract method 0xd0e30db0. Solidity: function deposit() payable returns()
[ { "docid": "1252a174a18a79582e5d70c2b6e3d3b9", "score": "0.66753143", "text": "func (_Pancake *PancakeTransactorSession) Deposit() (*types.Transaction, error) {\n\treturn _Pancake.Contract.Deposit(&_Pancake.TransactOpts)\n}", "title": "" } ]
[ { "docid": "9c5dd766b2d58878a45c6c6bc4a77899", "score": "0.72500724", "text": "func (_Mpe *MpeTransactor) Deposit(opts *bind.TransactOpts, value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.contract.Transact(opts, \"deposit\", value)\n}", "title": "" }, { "docid": "84130aa46e16f30d2a46c73b41d1e66a", "score": "0.71116376", "text": "func (_Mpe *MpeSession) Deposit(value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Deposit(&_Mpe.TransactOpts, value)\n}", "title": "" }, { "docid": "5c74e35292cc60ce0748d7db8893c405", "score": "0.708522", "text": "func (_Mpe *MpeTransactorSession) Deposit(value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Deposit(&_Mpe.TransactOpts, value)\n}", "title": "" }, { "docid": "47f7544142adb28a9f0b7ae266c357f0", "score": "0.7036947", "text": "func (_IWETH *IWETHTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _IWETH.contract.Transact(opts, \"deposit\")\n}", "title": "" }, { "docid": "83645719fc154159a4138e4bcba46ead", "score": "0.6977504", "text": "func (_PalletOne *PalletOneTransactorSession) Deposit(redeem []byte) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Deposit(&_PalletOne.TransactOpts, redeem)\n}", "title": "" }, { "docid": "53961b5f9a5d5cbe2724ead6bdeb38c8", "score": "0.6974445", "text": "func (_PalletOne *PalletOneTransactor) Deposit(opts *bind.TransactOpts, redeem []byte) (*types.Transaction, error) {\n\treturn _PalletOne.contract.Transact(opts, \"deposit\", redeem)\n}", "title": "" }, { "docid": "4b098e952e49a31f66d67c6c85625771", "score": "0.69380945", "text": "func (_Bscvalidatorset *BscvalidatorsetTransactor) Deposit(opts *bind.TransactOpts, valAddr common.Address) (*types.Transaction, error) {\n\treturn _Bscvalidatorset.contract.Transact(opts, \"deposit\", valAddr)\n}", "title": "" }, { "docid": "4c8ea162eb95edf0df51320479310cff", "score": "0.6921564", "text": "func (_Mining *MiningTransactor) Deposit(opts *bind.TransactOpts, _pid *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Mining.contract.Transact(opts, \"deposit\", _pid, _amount)\n}", "title": "" }, { "docid": "4ae47d19259e6c41ef9c2397735f188b", "score": "0.6915375", "text": "func (_PalletOne *PalletOneSession) Deposit(redeem []byte) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Deposit(&_PalletOne.TransactOpts, redeem)\n}", "title": "" }, { "docid": "0d95eb278afb0c22740bd0a5c9fba5cc", "score": "0.6906223", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n\n}", "title": "" }, { "docid": "5072a87bb97e1dca129e998151267fac", "score": "0.6901578", "text": "func (_NetworkContract *NetworkContractTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _NetworkContract.contract.Transact(opts, \"deposit\")\n}", "title": "" }, { "docid": "8a2b6a4955407accff0effc6c7a6053d", "score": "0.68776214", "text": "func (_Plasma *PlasmaTransactor) Deposit(opts *bind.TransactOpts, txBytes []byte) (*types.Transaction, error) {\n\treturn _Plasma.contract.Transact(opts, \"deposit\", txBytes)\n}", "title": "" }, { "docid": "5a337fa744962729f989edadc81b42bf", "score": "0.68745166", "text": "func (_IWETH *IWETHSession) Deposit() (*types.Transaction, error) {\n\treturn _IWETH.Contract.Deposit(&_IWETH.TransactOpts)\n}", "title": "" }, { "docid": "9ebde2a83ef289c520d7f8d23077ba26", "score": "0.68615144", "text": "func (_IWETH *IWETHTransactorSession) Deposit() (*types.Transaction, error) {\n\treturn _IWETH.Contract.Deposit(&_IWETH.TransactOpts)\n}", "title": "" }, { "docid": "0a33b8357c07ea6d1f3bdb835df76e03", "score": "0.6836604", "text": "func (_Mining *MiningTransactorSession) Deposit(_pid *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Mining.Contract.Deposit(&_Mining.TransactOpts, _pid, _amount)\n}", "title": "" }, { "docid": "3793f86ad5adb0859111153e8f47ca6b", "score": "0.6824459", "text": "func (_Pancake *PancakeTransactor) Deposit(opts *bind.TransactOpts) (*types.Transaction, error) {\n\treturn _Pancake.contract.Transact(opts, \"deposit\")\n}", "title": "" }, { "docid": "4d79e159d14d00e75fecb4813103d374", "score": "0.681655", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.bal += amount\n}", "title": "" }, { "docid": "6cbcb28a99d17d94fba3e3c48d9ea5d2", "score": "0.68146485", "text": "func (_Bscvalidatorset *BscvalidatorsetSession) Deposit(valAddr common.Address) (*types.Transaction, error) {\n\treturn _Bscvalidatorset.Contract.Deposit(&_Bscvalidatorset.TransactOpts, valAddr)\n}", "title": "" }, { "docid": "a652bdc4dbfc4d14ecc8809864df9c61", "score": "0.68128383", "text": "func (_Mining *MiningSession) Deposit(_pid *big.Int, _amount *big.Int) (*types.Transaction, error) {\n\treturn _Mining.Contract.Deposit(&_Mining.TransactOpts, _pid, _amount)\n}", "title": "" }, { "docid": "6cbe5952a9fdb3233f251f3182ca4e85", "score": "0.68065363", "text": "func (w Wallet) Deposit(amount Bitcoin) {\n\t// The \\n escape character, prints new line after outputting the memory address. We get the pointer to a thing with the address of symbol; &.\n\tfmt.Printf(\"address of balance in Deposit is %v \\n\", &w.balance)\n\tw.balance += amount\n}", "title": "" }, { "docid": "2bf3546c9e5bd4574a15e255a55dc0b7", "score": "0.679589", "text": "func (_NetworkContract *NetworkContractTransactorSession) Deposit() (*types.Transaction, error) {\n\treturn _NetworkContract.Contract.Deposit(&_NetworkContract.TransactOpts)\n}", "title": "" }, { "docid": "d01d87d0bb362d7c7647a098c20f2b13", "score": "0.67905784", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n}", "title": "" }, { "docid": "d01d87d0bb362d7c7647a098c20f2b13", "score": "0.67905784", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n}", "title": "" }, { "docid": "d01d87d0bb362d7c7647a098c20f2b13", "score": "0.67905784", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n}", "title": "" }, { "docid": "d01d87d0bb362d7c7647a098c20f2b13", "score": "0.67905784", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n}", "title": "" }, { "docid": "d01d87d0bb362d7c7647a098c20f2b13", "score": "0.67905784", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tw.balance += amount\n}", "title": "" }, { "docid": "e0a91a1712414e187cf1744c288b17a4", "score": "0.6788503", "text": "func (_Bscvalidatorset *BscvalidatorsetTransactorSession) Deposit(valAddr common.Address) (*types.Transaction, error) {\n\treturn _Bscvalidatorset.Contract.Deposit(&_Bscvalidatorset.TransactOpts, valAddr)\n}", "title": "" }, { "docid": "0e479a5d679a606121d559d51dfa3413", "score": "0.6779143", "text": "func (_NetworkContract *NetworkContractSession) Deposit() (*types.Transaction, error) {\n\treturn _NetworkContract.Contract.Deposit(&_NetworkContract.TransactOpts)\n}", "title": "" }, { "docid": "1d05859d4129a2e578dcd6a594a416a6", "score": "0.6766207", "text": "func (a *Account) Deposit(amount int64) (int64,bool) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\tif a.open == false {\n\t\treturn 0,false\n\t}\n\n\tif a.balance+amount < 0 {\n\t\treturn a.balance,false\n\t}\n\n\ta.balance = a.balance + amount\n\treturn a.balance,true\n}", "title": "" }, { "docid": "09544bd634b77857c6528be32472a248", "score": "0.6742112", "text": "func (telegram TelegramBot) Deposit(command Command, update *tgbotapi.Update) {\n\tuser := RegisterTelegramSender(command)\n\n\tif len(command.Params) < 1 {\n\t\tmsg := tgbotapi.NewMessage(update.Message.Chat.ID, fmt.Sprintf(viper.GetString(\"telegram_error_messages.deposit\")))\n\t\ttelegram.bot.Send(msg)\n\t\treturn\n\t}\n\n\tnetwork, err := telegram.setNetwork(command.Params[0], update)\n\tif err != nil {\n\t\treturn\n\t}\n\n\tpublicKey := user.PublicKey(network).String()\n\tmessage := fmt.Sprintf(viper.GetString(\"telegram_messages.deposit\"), network.Name, network.Symbol, publicKey)\n\twarning := fmt.Sprintf(viper.GetString(\"telegram_messages.backup_privkey\"), network.Symbol)\n\n\tmsg := tgbotapi.NewMessage(update.Message.Chat.ID, message+warning)\n\tcoin, _ := bcoins.SelectCoin(command.Params[0])\n\tif coin.Binance == true {\n\t\tbinanceShill := fmt.Sprintf(\"\\n\\n\"+viper.GetString(\"shill_message.binance\"), coin.Name)\n\t\tmsg = tgbotapi.NewMessage(update.Message.Chat.ID, message+warning+binanceShill)\n\t}\n\tmsg.DisableWebPagePreview = true\n\n\ttelegram.bot.Send(msg)\n}", "title": "" }, { "docid": "fe6fa7e923592270c4e2c1d53ccfbc88", "score": "0.6734621", "text": "func Deposit(amount int) { deposits <- amount }", "title": "" }, { "docid": "a72f961979b27d003a92dc721423ed21", "score": "0.6679392", "text": "func (_Vault *VaultTransactor) Deposit(opts *bind.TransactOpts, incognitoAddress string) (*types.Transaction, error) {\n\treturn _Vault.contract.Transact(opts, \"deposit\", incognitoAddress)\n}", "title": "" }, { "docid": "fbcec435c02abcea076ddbf467c84193", "score": "0.6650908", "text": "func (api *SmartPlasma) Deposit(req *RawReq, resp *RawResp) error {\n\tctx, cancel := api.newContext()\n\tdefer cancel()\n\n\tif err := api.service.MediatorTransaction(\n\t\tctx, req.RawTx); err != nil {\n\t\tresp.Error = err.Error()\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "83ec959874a347937820f95af6714ca7", "score": "0.66425204", "text": "func (_Pancake *PancakeSession) Deposit() (*types.Transaction, error) {\n\treturn _Pancake.Contract.Deposit(&_Pancake.TransactOpts)\n}", "title": "" }, { "docid": "e0bfb7658c52f7237d498ab3e19d7651", "score": "0.6632388", "text": "func (w *Wallet) Deposit(amount Bitcoin) {\n\tfmt.Printf(\"address of balance in Deposit is %v \\n\", &w.balance)\n\t// These pointers to `structs` even have their own name: `struct pointers` and they are automatically dereferenced.\n\t// this is also valid `(*w).balance`\n\tw.balance = amount\n}", "title": "" }, { "docid": "523f66347c5e95b3049894dc50f08bbe", "score": "0.66167575", "text": "func (_Plasma *PlasmaSession) Deposit(txBytes []byte) (*types.Transaction, error) {\n\treturn _Plasma.Contract.Deposit(&_Plasma.TransactOpts, txBytes)\n}", "title": "" }, { "docid": "58353c661a3c28e4dd2f913994883a52", "score": "0.66165936", "text": "func (a *Account) Deposit(amount int64) (int64, bool) {\n\ta.Lock()\n\tdefer a.Unlock()\n\tif !a.open {\n\t\treturn 0, false\n\t}\n\n\ta.balance += amount\n\tif a.balance < 0 {\n\t\ta.balance = 0\n\t\treturn 0, false\n\t}\n\n\treturn a.balance, true\n}", "title": "" }, { "docid": "d0f667665c50c0d6ab7345530aa30fb6", "score": "0.6613117", "text": "func (_Plasma *PlasmaTransactorSession) Deposit(txBytes []byte) (*types.Transaction, error) {\n\treturn _Plasma.Contract.Deposit(&_Plasma.TransactOpts, txBytes)\n}", "title": "" }, { "docid": "cfd6ec89faadc7a399369783cfc149c1", "score": "0.656383", "text": "func (a *Account) Deposit(amount int) (int, bool) {\n\ta.mu.Lock()\n\tdefer a.mu.Unlock()\n\n\tendBalance := amount + a.balance\n\tif a.isClosed || (endBalance < 0) {\n\t\treturn 0, false\n\t}\n\ta.balance = endBalance\n\treturn a.balance, true\n}", "title": "" }, { "docid": "b5446d84d80cac07c3132bc4792639cb", "score": "0.65414006", "text": "func (a *Account) Deposit(amount int) {\n\t// (a Account) is receiver, make copy\n\t// (a *Account) is receiver, get origin\n\ta.balance += amount\n}", "title": "" }, { "docid": "77fade2ccc8bcff183413b6378a45e47", "score": "0.6536954", "text": "func Deposit(amount int) {\n\tbalance = balance + amount\n\tvalores = append(valores, balance)\n}", "title": "" }, { "docid": "501ce5b30dc3cfee6f3586b96d90d74a", "score": "0.651529", "text": "func (v *Verification) Deposit(\n\texchange, token, amount string, timepoint uint64) (common.ActivityID, error) {\n\tresult := DepositWithdrawResponse{}\n\tlog.Println(\"Start deposit\")\n\trespBody, err := v.GetResponse(\n\t\t\"POST\",\n\t\tv.baseURL+\"/deposit/\"+exchange,\n\t\tmap[string]string{\n\t\t\t\"amount\": amount,\n\t\t\t\"token\": token,\n\t\t},\n\t\ttrue,\n\t\ttimepoint,\n\t)\n\tif err != nil {\n\t\treturn result.ID, err\n\t}\n\tif err := json.Unmarshal(respBody, &result); err != nil {\n\t\treturn result.ID, err\n\t}\n\tif result.Success != true {\n\t\terr = fmt.Errorf(\"Cannot deposit: %s\", result.Reason)\n\t}\n\treturn result.ID, err\n}", "title": "" }, { "docid": "7f47a17bf56abe9b9c00c3eddb027d95", "score": "0.6514846", "text": "func (w *Wallet) Deposit(amount Bitcoin) error {\n\tw.mutex.Lock()\n\tdefer w.mutex.Unlock()\n\tif amount <= 0 {\n\t\treturn fmt.Errorf(\"%v, %w\", amount, ErrIncorrectInput)\n\t}\n\tw.balance += amount\n\treturn nil\n}", "title": "" }, { "docid": "7eb1fe7928d3941d274eb9c97add5b3f", "score": "0.6506223", "text": "func (_Vault *VaultTransactorSession) Deposit(incognitoAddress string) (*types.Transaction, error) {\n\treturn _Vault.Contract.Deposit(&_Vault.TransactOpts, incognitoAddress)\n}", "title": "" }, { "docid": "1e5a9711d483a961c31696f8687a3742", "score": "0.64929134", "text": "func (_Vault *VaultSession) Deposit(incognitoAddress string) (*types.Transaction, error) {\n\treturn _Vault.Contract.Deposit(&_Vault.TransactOpts, incognitoAddress)\n}", "title": "" }, { "docid": "e29ca0d88b2346673f1ba12eddeebc67", "score": "0.64888036", "text": "func (a *Account) Deposit(amount int64) (newBalance int64, ok bool) {\n\ta.Lock()\n\tdefer a.Unlock()\n\n\tnewBalance = a.balance + amount\n\tif a.closed || newBalance < 0 {\n\t\treturn 0, false\n\t}\n\n\ta.balance = newBalance\n\treturn newBalance, true\n}", "title": "" }, { "docid": "ebdb9793042f0904615fdc51357ec3b9", "score": "0.6482439", "text": "func (acct *Account) Deposit(amount int64) (int64, bool) {\n\tacct.Lock()\n\tdefer acct.Unlock()\n\tif acct.closed {\n\t\treturn 0, false\n\t}\n\tif acct.balance+amount < 0 {\n\t\treturn acct.balance, false\n\t}\n\tacct.balance += amount\n\treturn acct.balance, true\n}", "title": "" }, { "docid": "22b17c915c25047cb41386e3e7aed7f5", "score": "0.646794", "text": "func (c *PlasmaCashClient) Deposit(deposit *pctypes.DepositRequest) error {\n\tif _, err := c.loomcontract.Call(\"DepositRequest\", deposit, c.signer, nil); err != nil {\n\t\treturn errors.Wrap(err, \"failed to commit DepositRequest tx\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "b863a6df365fa1621954e18ba2cd7c45", "score": "0.64393693", "text": "func (acc *Account) Deposit(amount int64) (newBalance int64, ok bool) {\n\tacc.Lock()\n\tdefer acc.Unlock()\n\n\tnewBalance = acc.balance + amount\n\tif !acc.active || newBalance < 0 {\n\t\treturn acc.balance, false\n\t}\n\tacc.balance = newBalance\n\treturn acc.balance, true\n}", "title": "" }, { "docid": "d0c07da2894f2319318cb032accf2079", "score": "0.64176214", "text": "func CreditDeposit(deposit *Deposit) {\n\n // SANITY CHECK\n if deposit.Id == 0 { panic(NewError(\"Expected a saved deposit but got a new one\")) }\n // END SANITY CHECK\n\n err := db.DoBeginSerializable(func(tx *db.ModelTx) {\n // Load the corresponding deposit.\n deposit := LoadDeposit(tx, deposit.Id)\n // If the deposit isn't pending, do nothing.\n if deposit.Status != DEPOSIT_STATUS_PENDING { return }\n // Credit the account.\n UpdateBalanceByWallet(tx, deposit.UserId, deposit.Wallet, deposit.Coin, int64(deposit.Amount), false)\n UpdateDepositSetStatus(tx, deposit.Id, DEPOSIT_STATUS_CREDITED)\n })\n if err != nil { panic(err) }\n}", "title": "" }, { "docid": "1f7cea6116d7e7e137388fc239591578", "score": "0.64138615", "text": "func UncreditDeposit(deposit *Deposit) (balance *Balance) {\n\n // SANITY CHECK\n if deposit.Id == 0 { panic(NewError(\"Expected a saved deposit but got a new one\")) }\n // END SANITY CHECK\n\n err := db.DoBeginSerializable(func(tx *db.ModelTx) {\n // Load the corresponding deposit.\n deposit := LoadDeposit(tx, deposit.Id)\n // If the deposit isn't credited, do nothing.\n if deposit.Status != DEPOSIT_STATUS_CREDITED { return }\n // Uncredit the account.\n balance = UpdateBalanceByWallet(tx, deposit.UserId, deposit.Wallet, deposit.Coin, -int64(deposit.Amount), false)\n UpdateDepositSetStatus(tx, deposit.Id, DEPOSIT_STATUS_PENDING)\n })\n if err != nil { panic(err) }\n return\n}", "title": "" }, { "docid": "90d54e7d4d4d53cf0a640f08a2d1d692", "score": "0.64034396", "text": "func (k Keeper) Deposit(ctx sdk.Context, msg types.MsgDepositCall) (types.Call, error) {\n\tcall, err := k.createNewCall(ctx, msg.UniqueId, types.Call_DEPOSIT, msg.Nominee, msg.Address, msg.SourceMeta, msg.Amount)\n\tif err != nil {\n\t\treturn types.Call{}, err\n\t}\n\n\ttargetAccAddr, _ := sdk.AccAddressFromBech32(call.Address)\n\tif err := k.bankKeeper.MintCoins(ctx, types.ModuleName, call.Amount); err != nil {\n\t\treturn types.Call{}, fmt.Errorf(\"minting coins (%s) for module: %w\", call.Amount, err)\n\t}\n\tif err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, targetAccAddr, call.Amount); err != nil {\n\t\treturn types.Call{}, fmt.Errorf(\"sending coins (%s) from module to account (%s): %w\", call.Amount, targetAccAddr.String(), err)\n\t}\n\n\treturn call, nil\n}", "title": "" }, { "docid": "e5098a856ab4a103191dacd6360648fe", "score": "0.63719034", "text": "func Deposit(sender string, deposit *big.Int) {\n\tif err := stats.RecordWithTags(census.ctx,\n\t\t[]tag.Mutator{tag.Insert(census.kSender, sender)}, census.mDeposit.M(wei2gwei(deposit))); err != nil {\n\n\t\tglog.Errorf(\"Error recording metrics err=%q\", err)\n\t}\n}", "title": "" }, { "docid": "cdfc21349b107ec5984d5a4354650ed2", "score": "0.6314526", "text": "func (uh *UserHandler) Deposit(rw http.ResponseWriter, r *http.Request) {\n\tqueryParams := r.URL.Query()\n\tuserID := queryParams[\"user\"][0]\n\tamount, err := strconv.ParseFloat(queryParams[\"amount\"][0], 64)\n\tif err != nil {\n\t\thttp.Error(rw, \"Cannot parse amount of money\", http.StatusBadRequest)\n\t}\n\tif amount > 0 {\n\t\terr = uh.r.Deposit(userID, amount)\n\t\tswitch err {\n\t\tcase nil:\n\t\tcase users.ErrDBQuery:\n\t\t\thttp.Error(rw, \"Internal error\", http.StatusInternalServerError)\n\t\t}\n\t} else {\n\t\thttp.Error(rw, \"Deposit of only positive sums is allowed\", http.StatusBadRequest)\n\t}\n}", "title": "" }, { "docid": "6548fcf705b78299a60a0c48837219fa", "score": "0.6275444", "text": "func CreditDepositForPayment(payment *bitcoin.Payment) {\n\n // SANITY CHECK\n paymentId := payment.Id\n // Reload the payment.\n payment = bitcoin.LoadPaymentByTxId(payment.TxId, payment.Vout)\n // Ensure that it isn't orphaned.\n if payment.Orphaned != bitcoin.PAYMENT_ORPHANED_STATUS_GOOD {\n panic(NewError(\"Cannot credit deposit for an orphaned payment\")) }\n // Are you paranoid enough?\n if paymentId != payment.Id {\n panic(NewError(\"payment.Id didn't match\")) }\n // END SANITY CHECK\n\n err := db.DoBeginSerializable(func(tx *db.ModelTx) {\n // Load the corresponding deposit.\n deposit := LoadDepositForPayment(tx, payment.Id)\n // If the deposit isn't pending, do nothing.\n if deposit.Status != DEPOSIT_STATUS_PENDING { return }\n // Credit the account.\n UpdateBalanceByWallet(tx, deposit.UserId, deposit.Wallet, deposit.Coin, int64(deposit.Amount), false)\n UpdateDepositSetStatus(tx, deposit.Id, DEPOSIT_STATUS_CREDITED)\n })\n if err != nil { panic(err) }\n}", "title": "" }, { "docid": "31ebfe86eecf1dd80611472f18a16708", "score": "0.6194599", "text": "func (p *ParameterProposal) Deposit() *big.Int {\n\treturn p.deposit\n}", "title": "" }, { "docid": "92c6336e4d74e961e53aa730a7c7489a", "score": "0.61851794", "text": "func UncreditDepositForPayment(payment *bitcoin.Payment) (balance *Balance) {\n\n // SANITY CHECK\n paymentId := payment.Id\n // Reload the payment.\n payment = bitcoin.LoadPaymentByTxId(payment.TxId, payment.Vout)\n // Ensure that it is orphaned.\n if payment.Orphaned != bitcoin.PAYMENT_ORPHANED_STATUS_ORPHANED {\n panic(NewError(\"Cannot uncredit deposit for a payment that isn't in STATUS_ORPHANED\")) }\n // Are you paranoid enough?\n if paymentId != payment.Id {\n panic(NewError(\"payment.Id didn't match\")) }\n // END SANITY CHECK\n\n err := db.DoBeginSerializable(func(tx *db.ModelTx) {\n // Load the corresponding deposit.\n deposit := LoadDepositForPayment(tx, payment.Id)\n // If the deposit isn't credited, do nothing.\n if deposit.Status != DEPOSIT_STATUS_CREDITED { return }\n // Uncredit the account.\n balance = UpdateBalanceByWallet(tx, deposit.UserId, deposit.Wallet, deposit.Coin, -int64(deposit.Amount), false)\n UpdateDepositSetStatus(tx, deposit.Id, DEPOSIT_STATUS_PENDING)\n })\n if err != nil { panic(err) }\n return\n}", "title": "" }, { "docid": "21a4c7833759d168421d3de4a3314aa4", "score": "0.5915404", "text": "func CreateDeposit(deposit *Deposit) (*Deposit) {\n\n // SANITY CHECK\n if deposit.Id != 0 { panic(NewError(\"Expected a new deposit but got a saved one\")) }\n if deposit.Type != DEPOSIT_TYPE_FIAT { panic(NewError(\"Expected a fiat (bank) deposit\")) }\n if deposit.PaymentId != 0 { panic(NewError(\"Fiat (bank) deposit cannot have a payment\")) } // TODO move to validator.\n if deposit.Status != DEPOSIT_STATUS_PENDING { panic(NewError(\"Expected a pending deposit\")) }\n // END SANITY CHECK\n\n _, err := SaveDeposit(db.GetModelDB(), deposit)\n if err != nil { panic(err) }\n\n return deposit\n}", "title": "" }, { "docid": "35485f7a744eb0b31d337ac7337ddd74", "score": "0.59071004", "text": "func (_PalletOne *PalletOneTransactor) Deposittoken(opts *bind.TransactOpts, token common.Address, redeem []byte, amount *big.Int) (*types.Transaction, error) {\n\treturn _PalletOne.contract.Transact(opts, \"deposittoken\", token, redeem, amount)\n}", "title": "" }, { "docid": "eb6463cb2d03046a52d93a941b7d4e7d", "score": "0.58649576", "text": "func (dc *DepositCreate) Save(ctx context.Context) (*Deposit, error) {\n\tif _, ok := dc.mutation.Addedtime(); !ok {\n\t\treturn nil, &ValidationError{Name: \"addedtime\", err: errors.New(\"ent: missing required field \\\"addedtime\\\"\")}\n\t}\n\tif _, ok := dc.mutation.Info(); !ok {\n\t\treturn nil, &ValidationError{Name: \"info\", err: errors.New(\"ent: missing required field \\\"info\\\"\")}\n\t}\n\tif v, ok := dc.mutation.Info(); ok {\n\t\tif err := deposit.InfoValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"info\", err: fmt.Errorf(\"ent: validator failed for field \\\"info\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := dc.mutation.Depositorname(); !ok {\n\t\treturn nil, &ValidationError{Name: \"depositorname\", err: errors.New(\"ent: missing required field \\\"depositorname\\\"\")}\n\t}\n\tif v, ok := dc.mutation.Depositorname(); ok {\n\t\tif err := deposit.DepositornameValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"depositorname\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositorname\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := dc.mutation.Depositortell(); !ok {\n\t\treturn nil, &ValidationError{Name: \"depositortell\", err: errors.New(\"ent: missing required field \\\"depositortell\\\"\")}\n\t}\n\tif v, ok := dc.mutation.Depositortell(); ok {\n\t\tif err := deposit.DepositortellValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"depositortell\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositortell\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := dc.mutation.Recipienttell(); !ok {\n\t\treturn nil, &ValidationError{Name: \"recipienttell\", err: errors.New(\"ent: missing required field \\\"recipienttell\\\"\")}\n\t}\n\tif v, ok := dc.mutation.Recipienttell(); ok {\n\t\tif err := deposit.RecipienttellValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"recipienttell\", err: fmt.Errorf(\"ent: validator failed for field \\\"recipienttell\\\": %w\", err)}\n\t\t}\n\t}\n\tif _, ok := dc.mutation.Parcelcode(); !ok {\n\t\treturn nil, &ValidationError{Name: \"parcelcode\", err: errors.New(\"ent: missing required field \\\"parcelcode\\\"\")}\n\t}\n\tif v, ok := dc.mutation.Parcelcode(); ok {\n\t\tif err := deposit.ParcelcodeValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"parcelcode\", err: fmt.Errorf(\"ent: validator failed for field \\\"parcelcode\\\": %w\", err)}\n\t\t}\n\t}\n\tvar (\n\t\terr error\n\t\tnode *Deposit\n\t)\n\tif len(dc.hooks) == 0 {\n\t\tnode, err = dc.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*DepositMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tdc.mutation = mutation\n\t\t\tnode, err = dc.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(dc.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = dc.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, dc.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "74f40a991be250ed4de1750c4aed9941", "score": "0.5856326", "text": "func (duo *DepositUpdateOne) Save(ctx context.Context) (*Deposit, error) {\n\tif v, ok := duo.mutation.Info(); ok {\n\t\tif err := deposit.InfoValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"info\", err: fmt.Errorf(\"ent: validator failed for field \\\"info\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := duo.mutation.Depositorname(); ok {\n\t\tif err := deposit.DepositornameValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"depositorname\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositorname\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := duo.mutation.Depositortell(); ok {\n\t\tif err := deposit.DepositortellValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"depositortell\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositortell\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := duo.mutation.Recipienttell(); ok {\n\t\tif err := deposit.RecipienttellValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"recipienttell\", err: fmt.Errorf(\"ent: validator failed for field \\\"recipienttell\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := duo.mutation.Parcelcode(); ok {\n\t\tif err := deposit.ParcelcodeValidator(v); err != nil {\n\t\t\treturn nil, &ValidationError{Name: \"parcelcode\", err: fmt.Errorf(\"ent: validator failed for field \\\"parcelcode\\\": %w\", err)}\n\t\t}\n\t}\n\n\tvar (\n\t\terr error\n\t\tnode *Deposit\n\t)\n\tif len(duo.hooks) == 0 {\n\t\tnode, err = duo.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*DepositMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tduo.mutation = mutation\n\t\t\tnode, err = duo.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn node, err\n\t\t})\n\t\tfor i := len(duo.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = duo.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, duo.mutation); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\treturn node, err\n}", "title": "" }, { "docid": "871271012123e0979ce1bd991730ab1a", "score": "0.583326", "text": "func (h *Resource) Deposit(q us.Quantity) bool {\n\tif !us.AreCompatible(h.balance, q) {\n\t\treturn false\n\t}\n\tn := us.Add(h.balance, q)\n\tif h.outOfBounds(n) {\n\t\treturn false\n\t}\n\th.balance = n\n\treturn true\n}", "title": "" }, { "docid": "ed3c08c33b5f12413c326e391e1634bd", "score": "0.5828092", "text": "func TestDeposit(t *testing.T) {\n\tassert := groth16.NewAssert(t)\n\n\tvar depositCircuit DepositCircuit\n\n\t// compiles our circuit into a R1CS\n\tr1cs, err := frontend.Compile(ecc.BN254, backend.GROTH16, &depositCircuit)\n\tassert.NoError(err)\n\n\t{\n\t\t//var witness Deposit\n\t\tdepositCircuit.NoteHash.Assign(\"14803109164298493466684583242985432968056297173621710679077236816845588688436\")\n\t\tdepositCircuit.Amount.Assign(28242048)\n\t\tdepositCircuit.ReceiverPubKey.Assign(\"13496572805321444273664325641440458311310163934354047265362731297880627774936\")\n\t\tdepositCircuit.ReturnPubKey.Assign(\"10193030166569398670555398535278072963719579248877156082361830729347727033510\")\n\t\tdepositCircuit.AuthorizePubKey.Assign(\"2302306531516619173363925550130201424458047172090558749779153607734711372580\")\n\t\tdepositCircuit.NoteRandom.Assign(2824204835)\n\t\tassert.ProverSucceeded(r1cs, &depositCircuit)\n\t}\n\tvar pubBuf bytes.Buffer\n\twitness.WritePublicTo(&pubBuf, ecc.BN254, &depositCircuit)\n\t//fmt.Println(\"buf\",hex.EncodeToString(pubBuf.Bytes()))\n\tpubStr := hex.EncodeToString(pubBuf.Bytes())\n\n\tvar buf bytes.Buffer\n\tpk, vk, err := groth16.Setup(r1cs)\n\tassert.Nil(err)\n\tbuf.Reset()\n\tvk.WriteTo(&buf)\n\t//fmt.Println(\"vk\",hex.EncodeToString(buf.Bytes()))\n\tvkStr := hex.EncodeToString(buf.Bytes())\n\n\tproof, err := groth16.Prove(r1cs, pk, &depositCircuit)\n\tassert.Nil(err)\n\tbuf.Reset()\n\tproof.WriteTo(&buf)\n\t//fmt.Println(\"proof\",hex.EncodeToString(buf.Bytes()))\n\tpfStr := hex.EncodeToString(buf.Bytes())\n\n\td, _ := hex.DecodeString(vkStr)\n\tvkt := groth16.NewVerifyingKey(ecc.BN254)\n\tbuf.Reset()\n\tbuf.Write(d)\n\tvkt.ReadFrom(&buf)\n\n\td, _ = hex.DecodeString(pfStr)\n\tbuf.Reset()\n\tbuf.Write(d)\n\tprt := groth16.NewProof(ecc.BN254)\n\tprt.ReadFrom(&buf)\n\n\td, _ = hex.DecodeString(pubStr)\n\tbuf.Reset()\n\tbuf.Write(d)\n\n\terr = groth16.ReadAndVerify(prt, vkt, &buf)\n\tassert.Nil(err)\n}", "title": "" }, { "docid": "56b55144b78204abe07000b09f72c9d2", "score": "0.58081174", "text": "func (_PalletOne *PalletOneTransactorSession) Deposittoken(token common.Address, redeem []byte, amount *big.Int) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Deposittoken(&_PalletOne.TransactOpts, token, redeem, amount)\n}", "title": "" }, { "docid": "4adaafbad1faf18e39f5c41cbe84fef0", "score": "0.5781722", "text": "func (_Mpe *MpeSession) Withdraw(value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Withdraw(&_Mpe.TransactOpts, value)\n}", "title": "" }, { "docid": "b7908ee813bb2a73f2cac7392d9b1ee9", "score": "0.57771754", "text": "func (_PalletOne *PalletOneSession) Deposittoken(token common.Address, redeem []byte, amount *big.Int) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Deposittoken(&_PalletOne.TransactOpts, token, redeem, amount)\n}", "title": "" }, { "docid": "77bfb43f3c6a65f6f7a784756b40fb26", "score": "0.5762787", "text": "func (spc *SimplePaymentContract) Transfer(ctx contractapi.TransactionContextInterface, beneficiary string, amount int64) (string, error) {\r\n\r\n\tremitter, _ := ctx.GetClientIdentity().GetID()\r\n\tremitterAccountBytes, err := ctx.GetStub().GetState(remitter)\r\n\tif err != nil {\r\n\t\treturn \"check\", fmt.Errorf(\"failed to read from world state for remitter: %v\", err)\r\n\t}\r\n\r\n\tbeneficiaryAccountBytes, err := ctx.GetStub().GetState(beneficiary)\r\n\tif err != nil {\r\n\t\treturn \"check\", fmt.Errorf(\"failed to read from world state for beneficiary: %v\", err)\r\n\t}\r\n\r\n\tvar remitterAccount Account\r\n\terr = json.Unmarshal(remitterAccountBytes, &remitterAccount)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\tvar beneficiaryAccount Account\r\n\terr = json.Unmarshal(beneficiaryAccountBytes, &beneficiaryAccount)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\tif remitterAccount.Balance < amount {\r\n\t\treturn \"check\", fmt.Errorf(\" Insufficient balance with the remitter \")\r\n\t}\r\n\r\n\tremitterAccount.Balance -= amount\r\n\tbeneficiaryAccount.Balance += amount\r\n\r\n\tremitterAccountBytes, err = json.Marshal(remitterAccount)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\tbeneficiaryAccountBytes, err = json.Marshal(beneficiaryAccount)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\terr = ctx.GetStub().PutState(remitterAccount.AccountID, remitterAccountBytes)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\terr = ctx.GetStub().PutState(beneficiaryAccount.AccountID, beneficiaryAccountBytes)\r\n\tif err != nil {\r\n\t\treturn \"check\", err\r\n\t}\r\n\r\n\treturn \"check\", nil\r\n}", "title": "" }, { "docid": "02853b240bbd8bc334013745bfc598c2", "score": "0.5718604", "text": "func (_Mpe *MpeTransactor) Withdraw(opts *bind.TransactOpts, value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.contract.Transact(opts, \"withdraw\", value)\n}", "title": "" }, { "docid": "c5335c2cf0a35170e2bb424859b4e8ad", "score": "0.5686805", "text": "func (_Mpe *MpeTransactorSession) Withdraw(value *big.Int) (*types.Transaction, error) {\n\treturn _Mpe.Contract.Withdraw(&_Mpe.TransactOpts, value)\n}", "title": "" }, { "docid": "b2aac531163eb95cc70a1326e5e318ca", "score": "0.56576407", "text": "func (_Contract *ContractSession) InvokeFiatDeposit(_amount *big.Int, _bankAccountNumber string) (*types.Transaction, error) {\n\treturn _Contract.Contract.InvokeFiatDeposit(&_Contract.TransactOpts, _amount, _bankAccountNumber)\n}", "title": "" }, { "docid": "0262511d5dac64eb6ec0a441eddc933e", "score": "0.5644504", "text": "func (_Bridge *BridgeTransactor) RevealDeposit(opts *bind.TransactOpts, fundingTx BitcoinTxInfo, reveal DepositDepositRevealInfo) (*types.Transaction, error) {\n\treturn _Bridge.contract.Transact(opts, \"revealDeposit\", fundingTx, reveal)\n}", "title": "" }, { "docid": "b529809147ce2baf98badb5f7dcae8b2", "score": "0.5636442", "text": "func (_Contract *ContractTransactorSession) InvokeFiatDeposit(_amount *big.Int, _bankAccountNumber string) (*types.Transaction, error) {\n\treturn _Contract.Contract.InvokeFiatDeposit(&_Contract.TransactOpts, _amount, _bankAccountNumber)\n}", "title": "" }, { "docid": "82323ede8b3f4e54c0e0e637af138e8b", "score": "0.56236744", "text": "func Example_depositAddress() {\n\t// Create the address manager and votingpool DB namespace. See the example\n\t// for the Create() function for more info on how this is done.\n\tteardown, db, mgr := exampleCreateDBAndMgr()\n\tdefer teardown()\n\n\terr := walletdb.Update(db, func(tx walletdb.ReadWriteTx) error {\n\t\tns := votingpoolNamespace(tx)\n\n\t\t// Create the voting pool.\n\t\tpool, err := votingpool.Create(ns, mgr, []byte{0x00})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Create a 2-of-3 series.\n\t\tseriesID := uint32(1)\n\t\trequiredSignatures := uint32(2)\n\t\tpubKeys := []string{\n\t\t\t\"xpub661MyMwAqRbcFDDrR5jY7LqsRioFDwg3cLjc7tML3RRcfYyhXqqgCH5SqMSQdpQ1Xh8EtVwcfm8psD8zXKPcRaCVSY4GCqbb3aMEs27GitE\",\n\t\t\t\"xpub661MyMwAqRbcGsxyD8hTmJFtpmwoZhy4NBBVxzvFU8tDXD2ME49A6JjQCYgbpSUpHGP1q4S2S1Pxv2EqTjwfERS5pc9Q2yeLkPFzSgRpjs9\",\n\t\t\t\"xpub661MyMwAqRbcEbc4uYVXvQQpH9L3YuZLZ1gxCmj59yAhNy33vXxbXadmRpx5YZEupNSqWRrR7PqU6duS2FiVCGEiugBEa5zuEAjsyLJjKCh\",\n\t\t}\n\t\terr = pool.CreateSeries(ns, votingpool.CurrentVersion, seriesID, requiredSignatures, pubKeys)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\t// Create a deposit address.\n\t\taddr, err := pool.DepositScriptAddress(seriesID, votingpool.Branch(0), votingpool.Index(1))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfmt.Println(\"Generated deposit address:\", addr.EncodeAddress())\n\t\treturn nil\n\t})\n\tif err != nil {\n\t\tfmt.Println(err)\n\t\treturn\n\t}\n\n\t// Output:\n\t// Generated deposit address: pruafy9cc8kmpt86wcewzw6u55ckjrmnhspuk2fxvz\n}", "title": "" }, { "docid": "d85b676448d1f6e268ae2d05a3864377", "score": "0.55874145", "text": "func (v *Verification) VerifyDeposit() error {\n\tvar err error\n\ttimepoint := common.GetTimepoint()\n\ttoken, err := common.GetInternalToken(\"ETH\")\n\tamount := getTokenAmount(0.5, token)\n\tInfo.Println(\"Start deposit to exchanges\")\n\tfor _, exchange := range v.exchanges {\n\t\tactivityID, err := v.Deposit(exchange, token.ID, amount, timepoint)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tInfo.Printf(\"Deposit id: %s\", activityID)\n\t\tgo v.CheckPendingActivities(activityID, timepoint)\n\t\tgo v.CheckPendingAuthData(activityID, timepoint)\n\t\tgo v.CheckActivities(activityID, timepoint)\n\t}\n\treturn err\n}", "title": "" }, { "docid": "17df47c4cc8696ce6018d40ae3d72365", "score": "0.55589116", "text": "func (_BurnablePayment *BurnablePaymentTransactorSession) Commit() (*types.Transaction, error) {\n\treturn _BurnablePayment.Contract.Commit(&_BurnablePayment.TransactOpts)\n}", "title": "" }, { "docid": "f4bcc260bfa071d3ba7bd2cf16d10dfb", "score": "0.55538213", "text": "func (_PalletOne *PalletOneSession) Withdraw(redeem []byte, recver common.Address, amount *big.Int, nonece *big.Int, sigstr1 []byte, sigstr2 []byte) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Withdraw(&_PalletOne.TransactOpts, redeem, recver, amount, nonece, sigstr1, sigstr2)\n}", "title": "" }, { "docid": "98388cc7fe049e38c63885842b9e7a95", "score": "0.55411834", "text": "func (_PalletOne *PalletOneTransactorSession) Withdraw(redeem []byte, recver common.Address, amount *big.Int, nonece *big.Int, sigstr1 []byte, sigstr2 []byte) (*types.Transaction, error) {\n\treturn _PalletOne.Contract.Withdraw(&_PalletOne.TransactOpts, redeem, recver, amount, nonece, sigstr1, sigstr2)\n}", "title": "" }, { "docid": "852f47be01d3051f567f218c3e9b9e43", "score": "0.5532814", "text": "func (api *API) ValidatorDeposit(ctx context.Context, username, deposit,\n\tvalidatorPubKey, link, privKeyHex string) (*model.BroadcastResponse, errors.Error) {\n\tresp, _, err := api.GuaranteeBroadcast(ctx, username, func(seq uint64) ([]byte, errors.Error) {\n\t\treturn api.MakeValidatorDepositMsg(username, deposit, validatorPubKey, link, privKeyHex, seq)\n\t})\n\treturn resp, err\n}", "title": "" }, { "docid": "26425b3fd0611c2c9929131d07e0c604", "score": "0.55316365", "text": "func (_Bridge *BridgeTransactorSession) RevealDeposit(fundingTx BitcoinTxInfo, reveal DepositDepositRevealInfo) (*types.Transaction, error) {\n\treturn _Bridge.Contract.RevealDeposit(&_Bridge.TransactOpts, fundingTx, reveal)\n}", "title": "" }, { "docid": "40c6f80e7daa42a5fb44521a7e39952f", "score": "0.55298036", "text": "func (f *Fund) Withdraw(amount int) {\n\tf.balance -= amount\n}", "title": "" }, { "docid": "0efc2af3d22a652f49c996cfa635d292", "score": "0.5518404", "text": "func (k Keeper) Withdraw(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Coin, depositType types.DepositType) error {\n\tdeposit, found := k.GetDeposit(ctx, depositor, amount.Denom, depositType)\n\tif !found {\n\t\treturn sdkerrors.Wrapf(types.ErrDepositNotFound, \"no %s %s deposit found for %s\", amount.Denom, depositType, depositor)\n\t}\n\tif !deposit.Amount.IsGTE(amount) {\n\t\treturn sdkerrors.Wrapf(types.ErrInvaliWithdrawAmount, \"%s>%s\", amount, deposit.Amount)\n\t}\n\n\tvar err error\n\tswitch depositType {\n\tcase types.LP:\n\t\terr = k.supplyKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleAccountName, depositor, sdk.NewCoins(amount))\n\tdefault:\n\t\treturn sdkerrors.Wrap(types.ErrInvalidDepositType, string(depositType))\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx.EventManager().EmitEvent(\n\t\tsdk.NewEvent(\n\t\t\ttypes.EventTypeHarvestWithdrawal,\n\t\t\tsdk.NewAttribute(sdk.AttributeKeyAmount, amount.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyDepositor, depositor.String()),\n\t\t\tsdk.NewAttribute(types.AttributeKeyDepositDenom, amount.Denom),\n\t\t\tsdk.NewAttribute(types.AttributeKeyDepositType, string(depositType)),\n\t\t),\n\t)\n\n\tif deposit.Amount.IsEqual(amount) {\n\t\tctx.EventManager().EmitEvent(\n\t\t\tsdk.NewEvent(\n\t\t\t\ttypes.EventTypeDeleteHarvestDeposit,\n\t\t\t\tsdk.NewAttribute(types.AttributeKeyDepositor, depositor.String()),\n\t\t\t\tsdk.NewAttribute(types.AttributeKeyDepositDenom, amount.Denom),\n\t\t\t\tsdk.NewAttribute(types.AttributeKeyDepositType, string(depositType)),\n\t\t\t),\n\t\t)\n\t\tk.DeleteDeposit(ctx, deposit)\n\t\treturn nil\n\t}\n\n\tdeposit.Amount = deposit.Amount.Sub(amount)\n\tk.SetDeposit(ctx, deposit)\n\n\treturn nil\n}", "title": "" }, { "docid": "e64304ffcacc8d9cb634fd6d5c3bdd51", "score": "0.55153465", "text": "func (abc *appBlockChain) updateLastBlockDeposit(update *state.Update, block *wire.MsgBlock) error {\n\tfTree := getFullMerkleTreeByBlock(block)\n\t// Traverse all outs, add dout to the deposit pool\n\tfor _, out := range block.Body.Outs {\n\t\tmyAddress := abc.getAddress()\n\t\tif out.OutPoint.IsDepositOut() {\n\t\t\toutData, err := wire.OutToDepositData(&out.OutPoint)\n\t\t\tif err != nil {\n\t\t\t\tabc.log.Errorf(\"Failed to get data out deposit out: %v\", out.OutPoint)\n\t\t\t\treturn err\n\t\t\t}\n\t\t\t// The miner only cares about his own deposit\n\t\t\tif outData.BindingAddress.IsEqual(myAddress) {\n\t\t\t\tproof, err := getOutProofByUpdate(update, fTree, out)\n\t\t\t\tif err != nil {\n\t\t\t\t\tabc.log.Errorf(\"Failed to get proof of deposit out,%v\", err)\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t\terr = abc.dPool.Add(&out.OutPoint, wire.BlockHeight(block.Header.Height), proof)\n\t\t\t\tif err != nil {\n\t\t\t\t\tabc.log.Errorf(\"Failed to add dout to pool: %s\", out.OutPoint.String())\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Traverse all transactions, If a dout was used, lock or remove\n\tfor _, tx := range block.Body.Transactions {\n\t\tswitch tx.Tx.API {\n\t\tcase isysapi.SysAPIWithdraw:\n\t\t\tfor _, txIn := range tx.Tx.TxIn {\n\t\t\t\tif txIn.PreviousOutPoint.IsDepositOut() {\n\t\t\t\t\terr := abc.dPool.Lock(&txIn.PreviousOutPoint)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tabc.log.Errorf(\"failed to lock previous outpoint,%v\", err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase isysapi.SysAPIBinding:\n\t\t\tfor _, txIn := range tx.Tx.TxIn {\n\t\t\t\tif txIn.PreviousOutPoint.IsDepositOut() {\n\t\t\t\t\terr := abc.dPool.Remove(&txIn.PreviousOutPoint)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tabc.log.Errorf(\"failed to remove previous outpoint,%v\", err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\tcase isysapi.SysAPIDeposit, isysapi.SysAPITransfer:\n\t\t\tfor _, txIn := range tx.Tx.TxIn {\n\t\t\t\tif txIn.PreviousOutPoint.IsWithdrawOut() {\n\t\t\t\t\terr := abc.dPool.Remove(&txIn.PreviousOutPoint)\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\tabc.log.Errorf(\"failed to remove previous outpoint,%v\", err)\n\t\t\t\t\t\treturn err\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "3b4cb95d17b9d481bb8f34198ec8578b", "score": "0.5512369", "text": "func (_Bridge *BridgeCaller) Deposits(opts *bind.CallOpts, depositKey *big.Int) (DepositDepositRequest, error) {\n\tvar out []interface{}\n\terr := _Bridge.contract.Call(opts, &out, \"deposits\", depositKey)\n\n\tif err != nil {\n\t\treturn *new(DepositDepositRequest), err\n\t}\n\n\tout0 := *abi.ConvertType(out[0], new(DepositDepositRequest)).(*DepositDepositRequest)\n\n\treturn out0, err\n\n}", "title": "" }, { "docid": "5b1ce7f7c6b9a99fce81414e934708f4", "score": "0.5510429", "text": "func (_Rollup *RollupCaller) DepositManager(opts *bind.CallOpts) (common.Address, error) {\n\tvar (\n\t\tret0 = new(common.Address)\n\t)\n\tout := ret0\n\terr := _Rollup.contract.Call(opts, out, \"depositManager\")\n\treturn *ret0, err\n}", "title": "" }, { "docid": "8918078a53164fdabd384b62d06c70e4", "score": "0.55021185", "text": "func (_Contract *ContractTransactor) InvokeFiatDeposit(opts *bind.TransactOpts, _amount *big.Int, _bankAccountNumber string) (*types.Transaction, error) {\n\treturn _Contract.contract.Transact(opts, \"invokeFiatDeposit\", _amount, _bankAccountNumber)\n}", "title": "" }, { "docid": "12fe40580da06f180e212d20e09d3be6", "score": "0.549379", "text": "func (_Bridge *BridgeSession) RevealDeposit(fundingTx BitcoinTxInfo, reveal DepositDepositRevealInfo) (*types.Transaction, error) {\n\treturn _Bridge.Contract.RevealDeposit(&_Bridge.TransactOpts, fundingTx, reveal)\n}", "title": "" }, { "docid": "8817c7660f216feca62be100e4dcd419", "score": "0.5492259", "text": "func settleDepositToPb(selp action.SealedEnvelope, settleDeposit *action.SettleDeposit) (*pb.SettleDeposit, error) {\n\tif settleDeposit == nil {\n\t\treturn nil, errors.Wrap(ErrExecution, \"deposit cannot be nil\")\n\t}\n\tsettleDepositPb := &pb.SettleDeposit{\n\t\tVersion: int64(selp.Version()),\n\t\tNonce: int64(selp.Nonce()),\n\t\tIndex: int64(settleDeposit.Index()),\n\t\tSignature: hex.EncodeToString(selp.Signature()),\n\t\tSender: selp.SrcAddr(),\n\t\tRecipient: selp.DstAddr(),\n\t\tSenderPubKey: keypair.EncodePublicKey(selp.SrcPubkey()),\n\t\tGasLimit: int64(selp.GasLimit()),\n\t}\n\tif settleDeposit.Amount() != nil && len(settleDeposit.Amount().String()) > 0 {\n\t\tsettleDepositPb.Amount = settleDeposit.Amount().String()\n\t}\n\tif selp.GasPrice() != nil && len(selp.GasPrice().String()) > 0 {\n\t\tsettleDepositPb.GasPrice = selp.GasPrice().String()\n\t}\n\treturn settleDepositPb, nil\n}", "title": "" }, { "docid": "ce0a4924a066c8478fbe2d4351dd91ec", "score": "0.54859906", "text": "func (_PalletOne *PalletOneTransactor) Withdraw(opts *bind.TransactOpts, redeem []byte, recver common.Address, amount *big.Int, nonece *big.Int, sigstr1 []byte, sigstr2 []byte) (*types.Transaction, error) {\n\treturn _PalletOne.contract.Transact(opts, \"withdraw\", redeem, recver, amount, nonece, sigstr1, sigstr2)\n}", "title": "" }, { "docid": "f7fe4bcbe04e60b866c1d380eb296f12", "score": "0.5484739", "text": "func (du *DepositUpdate) Save(ctx context.Context) (int, error) {\n\tif v, ok := du.mutation.Info(); ok {\n\t\tif err := deposit.InfoValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"info\", err: fmt.Errorf(\"ent: validator failed for field \\\"info\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := du.mutation.Depositorname(); ok {\n\t\tif err := deposit.DepositornameValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"depositorname\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositorname\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := du.mutation.Depositortell(); ok {\n\t\tif err := deposit.DepositortellValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"depositortell\", err: fmt.Errorf(\"ent: validator failed for field \\\"depositortell\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := du.mutation.Recipienttell(); ok {\n\t\tif err := deposit.RecipienttellValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"recipienttell\", err: fmt.Errorf(\"ent: validator failed for field \\\"recipienttell\\\": %w\", err)}\n\t\t}\n\t}\n\tif v, ok := du.mutation.Parcelcode(); ok {\n\t\tif err := deposit.ParcelcodeValidator(v); err != nil {\n\t\t\treturn 0, &ValidationError{Name: \"parcelcode\", err: fmt.Errorf(\"ent: validator failed for field \\\"parcelcode\\\": %w\", err)}\n\t\t}\n\t}\n\n\tvar (\n\t\terr error\n\t\taffected int\n\t)\n\tif len(du.hooks) == 0 {\n\t\taffected, err = du.sqlSave(ctx)\n\t} else {\n\t\tvar mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) {\n\t\t\tmutation, ok := m.(*DepositMutation)\n\t\t\tif !ok {\n\t\t\t\treturn nil, fmt.Errorf(\"unexpected mutation type %T\", m)\n\t\t\t}\n\t\t\tdu.mutation = mutation\n\t\t\taffected, err = du.sqlSave(ctx)\n\t\t\tmutation.done = true\n\t\t\treturn affected, err\n\t\t})\n\t\tfor i := len(du.hooks) - 1; i >= 0; i-- {\n\t\t\tmut = du.hooks[i](mut)\n\t\t}\n\t\tif _, err := mut.Mutate(ctx, du.mutation); err != nil {\n\t\t\treturn 0, err\n\t\t}\n\t}\n\treturn affected, err\n}", "title": "" }, { "docid": "fa1f75ac77ec22b5c65d523151e97e51", "score": "0.54659396", "text": "func (h *HostPrivateAPI) setDeposit(str string) error {\n\twei, err := unit.ParseCurrency(str)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid currency expression: %v\", err)\n\t}\n\th.storageHost.config.Deposit = wei\n\treturn nil\n}", "title": "" }, { "docid": "cddf2f4db1e19522b97f365c9b089d64", "score": "0.54583126", "text": "func (ds *DepositToStake) Amount() *big.Int { return ds.amount }", "title": "" }, { "docid": "f2bbcaf4ed25e44271d5f0f4fe1c8046", "score": "0.54494375", "text": "func includeDepositAnteHandler(ctx sdk.Context, ds store.DataStore, msg msgs.IncludeDepositMsg, client plasmaConn) (newCtx sdk.Context, res sdk.Result, abort bool) {\n\tif ds.HasDeposit(ctx, msg.DepositNonce) {\n\t\treturn ctx, ErrInvalidTransaction(\"deposit, %s, already exists in store\", msg.DepositNonce.String()).Result(), true\n\t}\n\tdeposit, threshold, ok := client.GetDeposit(ds.PlasmaBlockHeight(ctx), msg.DepositNonce)\n\tif !ok && threshold == nil {\n\t\treturn ctx, ErrInvalidTransaction(\"deposit, %s, does not exist.\", msg.DepositNonce.String()).Result(), true\n\t}\n\tif !ok {\n\t\treturn ctx, ErrInvalidTransaction(\"deposit, %s, has not finalized yet. Please wait at least %d blocks before resubmitting\", msg.DepositNonce.String(), threshold.Int64()).Result(), true\n\t}\n\tif !bytes.Equal(deposit.Owner[:], msg.Owner[:]) {\n\t\treturn ctx, ErrInvalidTransaction(\"deposit, %s, does not equal the owner specified in the include-deposit Msg\", msg.DepositNonce).Result(), true\n\t}\n\n\tdepositPosition := plasma.NewPosition(big.NewInt(0), 0, 0, msg.DepositNonce)\n\texited, err := client.HasTxExited(ds.PlasmaBlockHeight(ctx), depositPosition)\n\tif err != nil {\n\t\treturn ctx, ErrInvalidTransaction(\"failed to retrieve deposit information for deposit, %s\", msg.DepositNonce.String()).Result(), true\n\t} else if exited {\n\t\treturn ctx, ErrInvalidTransaction(\"deposit, %s, has already exitted from rootchain\", msg.DepositNonce.String()).Result(), true\n\t}\n\tif !bytes.Equal(msg.Owner.Bytes(), deposit.Owner.Bytes()) {\n\t\treturn ctx, ErrInvalidTransaction(fmt.Sprintf(\"msg has the wrong owner field for given deposit. Resubmit with correct deposit owner: %s\", deposit.Owner.String())).Result(), true\n\t}\n\treturn ctx, sdk.Result{}, false\n}", "title": "" }, { "docid": "79f871bea26e2c830d7147f80cc8536e", "score": "0.5422208", "text": "func (msg MsgEthDeposit) Type() string { return \"eth_deposit\" }", "title": "" }, { "docid": "b081c409bf9f526f7de1e297e77c0319", "score": "0.5419953", "text": "func (dl *depositList) WithdrawDeposit(dc DepositContext, id []byte, value *big.Int) (*big.Int, *big.Int, error) {\n\tdeposits := *dl\n\tfor idx, dp := range deposits {\n\t\tif dp.IsIdentifiedBy(id) {\n\t\t\tamount, penalty, removal, err :=\n\t\t\t\tdp.Withdraw(dc.BlockHeight(), dc.StepPrice(), value)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, err\n\t\t\t}\n\t\t\tif removal {\n\t\t\t\tcopy(deposits[idx:], deposits[idx+1:])\n\t\t\t\tdeposits = deposits[0 : len(deposits)-1]\n\t\t\t\tif len(deposits) > 0 {\n\t\t\t\t\t*dl = deposits\n\t\t\t\t} else {\n\t\t\t\t\t*dl = nil\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn amount, penalty, nil\n\t\t}\n\t}\n\treturn nil, nil, scoreresult.InvalidRequestError.New(\"DepositNotFound\")\n}", "title": "" }, { "docid": "c14a3134603853f5fe40ff3bbc21cfaf", "score": "0.5413346", "text": "func (_Bridge *BridgeCallerSession) Deposits(depositKey *big.Int) (DepositDepositRequest, error) {\n\treturn _Bridge.Contract.Deposits(&_Bridge.CallOpts, depositKey)\n}", "title": "" }, { "docid": "95552a7f8236a17f20ae8f3a656a7c7b", "score": "0.5405876", "text": "func (_Sdctsystem *SdctsystemTransactor) DepositAccount(opts *bind.TransactOpts, publicKey [2]*big.Int, tokenAddr common.Address, tokenAmount *big.Int) (*types.Transaction, error) {\n\treturn _Sdctsystem.contract.Transact(opts, \"depositAccount\", publicKey, tokenAddr, tokenAmount)\n}", "title": "" }, { "docid": "1b9bccfec5eaaaa674d6b57521ad4c80", "score": "0.5403313", "text": "func (_BurnablePayment *BurnablePaymentSession) Commit() (*types.Transaction, error) {\n\treturn _BurnablePayment.Contract.Commit(&_BurnablePayment.TransactOpts)\n}", "title": "" }, { "docid": "b7e76768206251cc94b38534cdd2bbcb", "score": "0.5397454", "text": "func (bs Deposit) Serialize() ([]byte, error) {\n\tgen := &protogen.Deposit{\n\t\tAddress: bs.Addr,\n\t\tConfirmed: bs.Confirmed,\n\t}\n\tif bs.Amount != nil {\n\t\tgen.Amount = bs.Amount.Bytes()\n\t}\n\treturn proto.Marshal(gen)\n}", "title": "" }, { "docid": "5dc44ab490f1d8f2017ab7f97215dce8", "score": "0.5394217", "text": "func (am *actionMempool) AddDeposit(deposit *primitives.Deposit, state state.State) error {\n\tif err := state.IsDepositValid(deposit, am.params); err != nil {\n\t\treturn err\n\t}\n\n\tam.depositsLock.Lock()\n\tdefer am.depositsLock.Unlock()\n\n\tfor _, d := range am.deposits {\n\t\tif bytes.Equal(d.Data.PublicKey[:], deposit.Data.PublicKey[:]) {\n\t\t\treturn nil\n\t\t}\n\t}\n\t_, ok := am.deposits[deposit.Hash()]\n\tif !ok {\n\t\tam.deposits[deposit.Hash()] = deposit\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "cd2ebe05ebbb4605cfaad3e815c3f813", "score": "0.53916246", "text": "func (_Bridge *BridgeSession) Deposits(depositKey *big.Int) (DepositDepositRequest, error) {\n\treturn _Bridge.Contract.Deposits(&_Bridge.CallOpts, depositKey)\n}", "title": "" } ]
190d3e489afb32262d51352458fd4dc4
SetServiceID adds the serviceId to the controllers public v1 proxy get service catalog details params
[ { "docid": "1d424341b86bb5a217d2c67213fefb28", "score": "0.7877701", "text": "func (o *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) SetServiceID(serviceID string) {\n\to.ServiceID = serviceID\n}", "title": "" } ]
[ { "docid": "8d075f9d25e208c14c5ec2324616e479", "score": "0.7211535", "text": "func (o *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) WithServiceID(serviceID string) *ControllersPublicV1ProxyGetServiceCatalogDetailsParams {\n\to.SetServiceID(serviceID)\n\treturn o\n}", "title": "" }, { "docid": "a0d579f29fe6b3a2a1ad9bbdac1e2ab4", "score": "0.66562504", "text": "func (acu *AccessControlUpdate) SetServiceID(i int64) *AccessControlUpdate {\n\tacu.mutation.ResetServiceID()\n\tacu.mutation.SetServiceID(i)\n\treturn acu\n}", "title": "" }, { "docid": "ea7fd53435ffa1f67b6d6a8caa3ee965", "score": "0.65950084", "text": "func (acuo *AccessControlUpdateOne) SetServiceID(i int64) *AccessControlUpdateOne {\n\tacuo.mutation.ResetServiceID()\n\tacuo.mutation.SetServiceID(i)\n\treturn acuo\n}", "title": "" }, { "docid": "82b6056b7aa786e0ff093692a8f74288", "score": "0.6256792", "text": "func SetCtxServiceID(ctx context.Context, v string) context.Context {\n\treturn context.WithValue(ctx, ctxKeyServiceID, v)\n}", "title": "" }, { "docid": "4e4c4b6190e7697e2fd58d7f07aa5c3f", "score": "0.61901534", "text": "func (c *Context) ServiceID() ServiceID {\n\treturn c.serviceID\n}", "title": "" }, { "docid": "b9350b438f096192c64cfeb5d51a4483", "score": "0.6003719", "text": "func NewServiceID(id string) entity.Resource { return &entity.ServiceID{Value: id} }", "title": "" }, { "docid": "345737ce50034aa131ddece151cd163d", "score": "0.596024", "text": "func (m *AppleManagedIdentityProvider) SetServiceId(value *string)() {\n err := m.GetBackingStore().Set(\"serviceId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "014cd93dfcf3a3e4f4f0664751aa4e5a", "score": "0.5946016", "text": "func (acuo *AccessControlUpdateOne) AddServiceID(i int64) *AccessControlUpdateOne {\n\tacuo.mutation.AddServiceID(i)\n\treturn acuo\n}", "title": "" }, { "docid": "877a936d491d4e1c4d07c3e15d966aa0", "score": "0.5878251", "text": "func (acu *AccessControlUpdate) AddServiceID(i int64) *AccessControlUpdate {\n\tacu.mutation.AddServiceID(i)\n\treturn acu\n}", "title": "" }, { "docid": "302493b119ec8bc831973cbf5f7b6043", "score": "0.58047956", "text": "func (o ServiceDynamicSnippetContentOutput) ServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ServiceDynamicSnippetContent) pulumi.StringOutput { return v.ServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "3389627684974c02c2862dbc5bcacb4e", "score": "0.58018917", "text": "func ServiceID(v int64) predicate.AccessControl {\n\treturn predicate.AccessControl(func(s *sql.Selector) {\n\t\ts.Where(sql.EQ(s.C(FieldServiceID), v))\n\t})\n}", "title": "" }, { "docid": "b41daa27a52f23982f451e2feb84ed2a", "score": "0.576773", "text": "func (o ServiceOutput) ServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *Service) pulumi.StringOutput { return v.ServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "43f674dafbe9e7bad7d08f84f0be9468", "score": "0.55773413", "text": "func (o *CompatibilityCompatibleVersions) SetDataServiceId(v string) {\n\to.DataServiceId = &v\n}", "title": "" }, { "docid": "25563a648e127d07c4d1cf5b072fc395", "score": "0.55605006", "text": "func (a *App) ServiceID() string {\n\treturn a.Relationships.Services.Data[0].ID\n}", "title": "" }, { "docid": "e0d2b440ceed6f13cde56b0669224020", "score": "0.5519191", "text": "func (o *GetCatalogsByIDParams) SetCatalogID(catalogID string) {\n\to.CatalogID = catalogID\n}", "title": "" }, { "docid": "1d4745659972bc3fe6106958ca2d3fcd", "score": "0.5515134", "text": "func (s *serviceFactory) ServiceID(name string) ServiceID {\n\ts.mutex.RLock()\n\tdefer s.mutex.RUnlock()\n\tfor _, c := range s.constructors {\n\t\tif name == c.name {\n\t\t\treturn c.serviceID\n\t\t}\n\t}\n\treturn NilServiceID\n}", "title": "" }, { "docid": "747b8e15d9784e3b08744bc3ea261e3a", "score": "0.5464028", "text": "func (m *AccessReviewInstanceDecisionItemServicePrincipalTarget) SetServicePrincipalId(value *string)() {\n err := m.GetBackingStore().Set(\"servicePrincipalId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "95c33c799e0843b39e750c837ccde32e", "score": "0.5460805", "text": "func (m *BookingBusinessItemRequestBuilder) ServicesById(id string)(*i1dac550ea6326e46204247bf797ccc6ac538b2fbe14da8d2f54928298a9ad4d6.BookingServiceItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"bookingService%2Did\"] = id\n }\n return i1dac550ea6326e46204247bf797ccc6ac538b2fbe14da8d2f54928298a9ad4d6.NewBookingServiceItemRequestBuilderInternal(urlTplParams, m.requestAdapter);\n}", "title": "" }, { "docid": "0fe7873733fc0b55a79ab94c1eb1e19e", "score": "0.5414255", "text": "func (o EndpointV3Output) ServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *EndpointV3) pulumi.StringOutput { return v.ServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "be3bbdfb6fef5ee6ad713b446604de4c", "score": "0.54017437", "text": "func ServicesChainID(config *Config) uuid.UUID {\n\tbaseID := MainChainID(config)\n\treturn SubID(baseID, \"Services Chain\")\n}", "title": "" }, { "docid": "17af920d6d86f68b3e9963be5268df2c", "score": "0.5390266", "text": "func (a *AppData) ServiceID() string {\n\treturn a.Data.ServiceID()\n}", "title": "" }, { "docid": "a98429b970148c7ec245463510e69fc2", "score": "0.52573925", "text": "func (m *EntitlementManagementRequestBuilder) CatalogsById(id string)(*EntitlementManagementCatalogsAccessPackageCatalogItemRequestBuilder) {\n urlTplParams := make(map[string]string)\n for idx, item := range m.pathParameters {\n urlTplParams[idx] = item\n }\n if id != \"\" {\n urlTplParams[\"accessPackageCatalog%2Did\"] = id\n }\n return NewEntitlementManagementCatalogsAccessPackageCatalogItemRequestBuilderInternal(urlTplParams, m.requestAdapter)\n}", "title": "" }, { "docid": "ea1087ee8f8d718b38d750e5e8d059ef", "score": "0.52339643", "text": "func GetCtxServiceID(ctx context.Context) string {\n\tv, ok := ctx.Value(ctxKeyServiceID).(string)\n\tif !ok || v == \"\" {\n\t\treturn \"\"\n\t}\n\treturn v\n}", "title": "" }, { "docid": "f2ee50fa37328fc8bd8f299be25edf72", "score": "0.52256805", "text": "func InitService(next http.Handler) http.Handler {\n\tfn := func(w http.ResponseWriter, r *http.Request) {\n\t\tserviceAlias := chi.URLParam(r, \"service_alias\")\n\t\tif serviceAlias == \"\" {\n\t\t\thttputil.ReturnError(r, w, 404, \"cant find service alias\")\n\t\t\treturn\n\t\t}\n\t\ttenantID := r.Context().Value(ContextKey(\"tenant_id\"))\n\t\tservice, err := db.GetManager().TenantServiceDao().GetServiceByTenantIDAndServiceAlias(tenantID.(string), serviceAlias)\n\t\tif err != nil {\n\t\t\tif err.Error() == gorm.ErrRecordNotFound.Error() {\n\t\t\t\thttputil.ReturnError(r, w, 404, \"cant find service\")\n\t\t\t\treturn\n\t\t\t}\n\t\t\tlogrus.Errorf(\"get service by tenant & service alias error, %v\", err)\n\t\t\thttputil.ReturnError(r, w, 500, \"get service id error\")\n\t\t\treturn\n\t\t}\n\t\tserviceID := service.ServiceID\n\t\tctx := context.WithValue(r.Context(), ContextKey(\"service_alias\"), serviceAlias)\n\t\tctx = context.WithValue(ctx, ContextKey(\"service_id\"), serviceID)\n\t\tctx = context.WithValue(ctx, ContextKey(\"service\"), service)\n\t\tnext.ServeHTTP(w, r.WithContext(ctx))\n\t}\n\treturn http.HandlerFunc(fn)\n}", "title": "" }, { "docid": "6760f34fd484672d4941a875a1a6ce63", "score": "0.5221815", "text": "func (ptc *PropertyTypeCreate) SetServiceTypeID(id string) *PropertyTypeCreate {\n\tif ptc.service_type == nil {\n\t\tptc.service_type = make(map[string]struct{})\n\t}\n\tptc.service_type[id] = struct{}{}\n\treturn ptc\n}", "title": "" }, { "docid": "c66f4422eb76291abc621033f0d89fcf", "score": "0.5184274", "text": "func (o *GetV1CatalogsCatalogIDRefreshParams) SetCatalogID(catalogID int32) {\n\to.CatalogID = catalogID\n}", "title": "" }, { "docid": "4d3300a6271ac15e67dd59ee434a09ba", "score": "0.51794076", "text": "func (this *ControlPlaneDao) GetService(id string, myService *service.Service) error {\n\tsvc, err := this.facade.GetService(datastore.Get(), id)\n\tif svc != nil {\n\t\t*myService = *svc\n\t}\n\treturn err\n}", "title": "" }, { "docid": "e885b9de03375f5bde053aeb0a69c635", "score": "0.51609755", "text": "func (p *Pod) GetServiceID(serviceName string) string {\n\t// ServiceID is katalog-sync_service_namespace_pod\n\treturn strings.Join([]string{\n\t\t\"katalog-sync\",\n\t\tserviceName,\n\t\tp.Pod.ObjectMeta.Namespace,\n\t\tp.Pod.ObjectMeta.Name,\n\t}, \"_\")\n}", "title": "" }, { "docid": "754c14dfc7fad924535ad0d135da5db1", "score": "0.5155683", "text": "func (o GetServiceHealthResultCheckOutput) ServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServiceHealthResultCheck) string { return v.ServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "47086c2592dad3c8462059b78959c499", "score": "0.5146581", "text": "func (o SharedPrivateLinkServiceOutput) SearchServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SharedPrivateLinkService) pulumi.StringOutput { return v.SearchServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "e62ed93fc3eb651ff68fc99e4e93c824", "score": "0.51417685", "text": "func (o LinkedServiceAzureBlobStorageOutput) ServicePrincipalId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v *LinkedServiceAzureBlobStorage) pulumi.StringPtrOutput { return v.ServicePrincipalId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "8a92bb90b17bdcbb093d154398bc6dd7", "score": "0.510778", "text": "func (o *GetCatalogsByIDCategoriesByIDParams) SetCatalogID(catalogID string) {\n\to.CatalogID = catalogID\n}", "title": "" }, { "docid": "4c78b3fb074810481472e8ad11452e7a", "score": "0.50945336", "text": "func (o *PatchServicesServiceIDParams) WithServiceID(ServiceID int64) *PatchServicesServiceIDParams {\n\to.ServiceID = ServiceID\n\treturn o\n}", "title": "" }, { "docid": "c88b38725f6fc6a11f373394fb830651", "score": "0.5062335", "text": "func WithIDGenerator(gen platform.IDGenerator) ServiceOption {\n\treturn func(s *Service) {\n\t\ts.idGen = gen\n\t}\n}", "title": "" }, { "docid": "5fcd577a620e636ef08b46d8813e04fc", "score": "0.50534785", "text": "func (o CatalogEntryServiceOutput) Id() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v CatalogEntryService) *string { return v.Id }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "a3182e5c79de3471cd89799771c13b96", "score": "0.50290245", "text": "func (o *GetCatalogsByIDParams) WithContext(ctx context.Context) *GetCatalogsByIDParams {\n\to.SetContext(ctx)\n\treturn o\n}", "title": "" }, { "docid": "c83654c486f04ff58188087e72f355ff", "score": "0.5028816", "text": "func (m *SignIn) SetServicePrincipalId(value *string)() {\n err := m.GetBackingStore().Set(\"servicePrincipalId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "6ff34b486cda9538d6500e5cb8a78678", "score": "0.5001154", "text": "func (d *DbInfo) SetSvc(svc *dynamodb.DynamoDB) {\n\td.Svc = svc\n}", "title": "" }, { "docid": "29778ad592c15ff1db4a85c3241b3322", "score": "0.49969894", "text": "func (o *GetZoneUsingGETParams) SetID(id strfmt.UUID) {\n\to.ID = id\n}", "title": "" }, { "docid": "3cea8d2d329f0c6284532bbd707a091f", "score": "0.49841672", "text": "func (o *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) WithXGlobalTransactionID(xGlobalTransactionID *string) *ControllersPublicV1ProxyGetServiceCatalogDetailsParams {\n\to.SetXGlobalTransactionID(xGlobalTransactionID)\n\treturn o\n}", "title": "" }, { "docid": "54fab67d87a776d64086c9c69a88817d", "score": "0.49319768", "text": "func (c *Container) Set(id string, service interface{}) (err error) {\n\tif service == nil {\n\t\treturn cargo.NewError(ServiceInvalid, \"Service \\\"%s\\\" must not be nil\", id)\n\t}\n\n\tid = strings.ToLower(id)\n\n\tif _, ok := c.aliases[id]; ok {\n\t\tdelete(c.aliases, id)\n\t}\n\n\tif def, ok := c.definitions[id]; ok {\n\t\tif s, err := c.createService(id, def); err != nil {\n\t\t\tc.services[id] = reflect.ValueOf(s)\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tdef := definition.NewDefinition(service)\n\tc.definitions[id] = def\n\n\tif s, err := c.createService(id, def); err != nil {\n\t\tc.services[id] = reflect.ValueOf(s)\n\t}\n\n\treturn cargo.NewError(ServiceNotRegistered, \"Service \\\"%s\\\" was not registered\", id)\n}", "title": "" }, { "docid": "f96c49bf3d748b2b2c5b471fcf4f6ff6", "score": "0.492958", "text": "func (__receiver_AService *AccountService) ID(id string) *AccountService {\n\t__receiver_AService.ResourceID = id\n\tswitch __receiver_AService.action {\n\tcase types.BULKREAD:\n\t\t__receiver_AService.data = struct{}{}\n\t\t__receiver_AService.url = resources.AccountURLS[types.READ]\n\t\t__receiver_AService.action = types.READ\n\n\t}\n\treturn __receiver_AService\n}", "title": "" }, { "docid": "ffdec7473f0edce827cbbbfeb097131f", "score": "0.4925238", "text": "func (a *ResourcesApiService) ServiceSetParams(ctx _context.Context, space string, resourceID string) ApiServiceSetParamsRequest {\n\treturn ApiServiceSetParamsRequest{\n\t\tApiService: a,\n\t\tctx: ctx,\n\t\tspace: space,\n\t\tresourceID: resourceID,\n\t}\n}", "title": "" }, { "docid": "4ab1da9335cf781fae3bfa13874e2586", "score": "0.49214607", "text": "func (_options *GetDataOptions) SetDatasourceID(datasourceID string) *GetDataOptions {\n\t_options.DatasourceID = core.StringPtr(datasourceID)\n\treturn _options\n}", "title": "" }, { "docid": "b5e8946e9ff3a5e5140d064eb0f31120", "score": "0.4900347", "text": "func (o *GetCatalogsByIDParams) WithCatalogID(catalogID string) *GetCatalogsByIDParams {\n\to.SetCatalogID(catalogID)\n\treturn o\n}", "title": "" }, { "docid": "a4ec10877bdde2f51225496ef7024dc3", "score": "0.48940977", "text": "func (o SpringCloudConfigurationServiceOutput) SpringCloudServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *SpringCloudConfigurationService) pulumi.StringOutput { return v.SpringCloudServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "8d5959641d5d74625862591f9f2adb9e", "score": "0.48917785", "text": "func (o GetCatalogServiceServiceOutput) NodeId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetCatalogServiceService) string { return v.NodeId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "635850ad5bc2ce82a3c026476db9a044", "score": "0.4884934", "text": "func (m *MockClient) ServiceID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "ea0c408fc9e57778b2d3e1a9ec790423", "score": "0.48711884", "text": "func (mr *MockClientMockRecorder) ServiceID() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ServiceID\", reflect.TypeOf((*MockClient)(nil).ServiceID))\n}", "title": "" }, { "docid": "2690e4d3d85bd4b5600eeec0284a4ef6", "score": "0.4870338", "text": "func (o *ListBranchesParams) SetServiceEndpointID(serviceEndpointID *strfmt.UUID) {\n\to.ServiceEndpointID = serviceEndpointID\n}", "title": "" }, { "docid": "82ea913f541d17db09636e127a345f9c", "score": "0.48594058", "text": "func (k Keeper) setID(ctx sdk.Context, id dnTypes.ID) {\n\tstore := ctx.KVStore(k.storeKey)\n\tstore.Set(types.LastOrderIDKey, k.cdc.MustMarshalBinaryBare(id))\n}", "title": "" }, { "docid": "bd76abfc4044692aa57c65ed9d3e0c76", "score": "0.48234287", "text": "func (ks *Services) Get(id string) *Services {\n\n\tif len(id) > 0 {\n\t\tpath := fmt.Sprintf(\"%s/%s\", ServicesURI, id)\n\n\t\tif _, err := ks.kong.Session.BodyAsJSON(nil).Get(path, ks.service, ks.fail); err != nil {\n\t\t\tks.service = &Service{}\n\t\t}\n\t}\n\treturn ks\n}", "title": "" }, { "docid": "50060cf1d9000b124d6a92fc52ce6121", "score": "0.48187307", "text": "func (l GautocloudLoader) InjectFromId(id string, service interface{}) error {\n\terr := l.checkInCloudEnv()\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = l.checkConnectorIdExist(id)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif reflect.TypeOf(service).Kind() != reflect.Ptr {\n\t\treturn NewErrPtrNotGiven()\n\t}\n\treflectType := reflect.TypeOf(service).Elem()\n\n\tvService := reflect.ValueOf(service).Elem()\n\tisArray := false\n\tif reflectType.Kind() == reflect.Slice {\n\t\tisArray = true\n\t\treflectType = reflectType.Elem()\n\t}\n\tdataSlice := make([]interface{}, 0)\n\tfor _, store := range l.store[id] {\n\t\tif store.ReflectType == reflectType {\n\t\t\tdataSlice = append(dataSlice, store.Data)\n\t\t}\n\t}\n\n\tif len(dataSlice) == 0 {\n\t\treturn NewErrGiveService(\n\t\t\tfmt.Sprintf(\n\t\t\t\t\"Connector with id '%s' doesn't give a service with the type '%s'. (perhaps no services match the connector)\",\n\t\t\t\tid,\n\t\t\t\treflectType.String(),\n\t\t\t),\n\t\t)\n\t}\n\tif !isArray {\n\t\tvService.Set(reflect.ValueOf(dataSlice[0]))\n\t\treturn nil\n\t}\n\tloadSchemas := reflect.MakeSlice(reflect.SliceOf(reflectType), 0, 0)\n\tfor _, data := range dataSlice {\n\t\tloadSchemas = reflect.Append(loadSchemas, reflect.ValueOf(data))\n\t}\n\tif service == nil {\n\t\tvService.Set(loadSchemas)\n\t\treturn nil\n\t}\n\tfor i := 0; i < vService.Len(); i++ {\n\t\tloadSchemas = reflect.Append(loadSchemas, vService.Index(i))\n\t}\n\tvService.Set(loadSchemas)\n\n\treturn nil\n}", "title": "" }, { "docid": "6d09bd4ffeda5aecaac4542b6b9ccf1d", "score": "0.48079035", "text": "func (o FlexibleAppVersionEndpointsApiServiceOutput) ConfigId() pulumi.StringPtrOutput {\n\treturn o.ApplyT(func(v FlexibleAppVersionEndpointsApiService) *string { return v.ConfigId }).(pulumi.StringPtrOutput)\n}", "title": "" }, { "docid": "c5c5a6624e176dcd90aef3b8e2e4f09c", "score": "0.47968104", "text": "func (a *API) StartService(serviceID string) error {\n\tsr, err := a.db.Get(serviceID)\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = sr.Start(a.container)\n\treturn err\n}", "title": "" }, { "docid": "88669e11587b97af74fa1660de26cfb1", "score": "0.47901303", "text": "func (a *Server) SetOIDCService(svc OIDCService) {\n\ta.oidcAuthService = svc\n}", "title": "" }, { "docid": "1789cd1f12b199d3270aa40bdb1a7284", "score": "0.47841272", "text": "func (stu *ServiceTypeUpdate) AddServiceIDs(ids ...string) *ServiceTypeUpdate {\n\tif stu.services == nil {\n\t\tstu.services = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tstu.services[ids[i]] = struct{}{}\n\t}\n\treturn stu\n}", "title": "" }, { "docid": "21289ea5777289089a62dd2e0e040df1", "score": "0.4776532", "text": "func NewIDService(h host.Host, opts ...Option) (*idService, error) {\n\tvar cfg config\n\tfor _, opt := range opts {\n\t\topt(&cfg)\n\t}\n\n\tuserAgent := defaultUserAgent\n\tif cfg.userAgent != \"\" {\n\t\tuserAgent = cfg.userAgent\n\t}\n\n\tctx, cancel := context.WithCancel(context.Background())\n\ts := &idService{\n\t\tHost: h,\n\t\tUserAgent: userAgent,\n\t\tProtocolVersion: cfg.protocolVersion,\n\t\tctx: ctx,\n\t\tctxCancel: cancel,\n\t\tconns: make(map[network.Conn]entry),\n\t\tdisableSignedPeerRecord: cfg.disableSignedPeerRecord,\n\t\tsetupCompleted: make(chan struct{}),\n\t\tmetricsTracer: cfg.metricsTracer,\n\t}\n\n\tobservedAddrs, err := NewObservedAddrManager(h)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create observed address manager: %s\", err)\n\t}\n\ts.observedAddrs = observedAddrs\n\n\ts.emitters.evtPeerProtocolsUpdated, err = h.EventBus().Emitter(&event.EvtPeerProtocolsUpdated{})\n\tif err != nil {\n\t\tlog.Warnf(\"identify service not emitting peer protocol updates; err: %s\", err)\n\t}\n\ts.emitters.evtPeerIdentificationCompleted, err = h.EventBus().Emitter(&event.EvtPeerIdentificationCompleted{})\n\tif err != nil {\n\t\tlog.Warnf(\"identify service not emitting identification completed events; err: %s\", err)\n\t}\n\ts.emitters.evtPeerIdentificationFailed, err = h.EventBus().Emitter(&event.EvtPeerIdentificationFailed{})\n\tif err != nil {\n\t\tlog.Warnf(\"identify service not emitting identification failed events; err: %s\", err)\n\t}\n\treturn s, nil\n}", "title": "" }, { "docid": "e3620b9dae36766313c245455122beb6", "score": "0.47694746", "text": "func (m *SignIn) SetServicePrincipalCredentialKeyId(value *string)() {\n err := m.GetBackingStore().Set(\"servicePrincipalCredentialKeyId\", value)\n if err != nil {\n panic(err)\n }\n}", "title": "" }, { "docid": "fa1ba7eefcc045beb19dd4d06b826302", "score": "0.47689694", "text": "func (s *IGDService) ID() string {\n\treturn s.UUID + \"/\" + s.Device.FriendlyName + \"/\" + s.ServiceID + \"/\" + s.URN + \"/\" + s.URL\n}", "title": "" }, { "docid": "aaae283e776a4b257dba6cf2df7ac707", "score": "0.47615668", "text": "func (m *MockServer) ServiceID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "0d6bf566730ceadf63aabdf6fae9260b", "score": "0.47580466", "text": "func (o *CompatibilityCompatibleVersions) GetDataServiceId() string {\n\tif o == nil || o.DataServiceId == nil {\n\t\tvar ret string\n\t\treturn ret\n\t}\n\treturn *o.DataServiceId\n}", "title": "" }, { "docid": "8f698402d988455ba3348da643f80d23", "score": "0.47554073", "text": "func (m *MockService) ServiceID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "1be3e5f09665a9ec32e8a15957d9713a", "score": "0.47507408", "text": "func (c *EpinioClient) ServiceDetails(name string) error {\n\tlog := c.Log.WithName(\"Service Details\").\n\t\tWithValues(\"Name\", name, \"Organization\", c.Config.Org)\n\tlog.Info(\"start\")\n\tdefer log.Info(\"return\")\n\n\tc.ui.Note().\n\t\tWithStringValue(\"Name\", name).\n\t\tWithStringValue(\"Organization\", c.Config.Org).\n\t\tMsg(\"Service Details\")\n\n\tjsonResponse, err := c.get(api.Routes.Path(\"ServiceShow\", c.Config.Org, name))\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar serviceDetails map[string]string\n\tif err := json.Unmarshal(jsonResponse, &serviceDetails); err != nil {\n\t\treturn err\n\t}\n\n\tmsg := c.ui.Success().WithTable(\"\", \"\")\n\tkeys := make([]string, 0, len(serviceDetails))\n\tfor k := range serviceDetails {\n\t\tkeys = append(keys, k)\n\t}\n\tsort.Strings(keys)\n\tfor _, k := range keys {\n\t\tmsg = msg.WithTableRow(k, serviceDetails[k])\n\t}\n\n\tmsg.Msg(\"\")\n\treturn nil\n}", "title": "" }, { "docid": "72e4d2c98d76426859513f7bf2457f4f", "score": "0.4744173", "text": "func getService(id string) string {\n\ti := strings.Index(id, \":\")\n\tif i <= 0 {\n\t\treturn \"\"\n\t}\n\treturn id[:i]\n}", "title": "" }, { "docid": "67eafd58746cb80cc70d4177badbfab9", "score": "0.47292072", "text": "func (b *EntitlementManagementAccessPackageCatalogsCollectionRequestBuilder) ID(id string) *AccessPackageCatalogRequestBuilder {\n\tbb := &AccessPackageCatalogRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "23140a7f6f1cb173d6f9d2bba3e9395d", "score": "0.4727117", "text": "func (o *GetCatalogsByIDParams) WithHTTPClient(client *http.Client) *GetCatalogsByIDParams {\n\to.SetHTTPClient(client)\n\treturn o\n}", "title": "" }, { "docid": "75a8634039e127f1f75a1ca3e1239017", "score": "0.47182548", "text": "func (mr *MockServerMockRecorder) ServiceID() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ServiceID\", reflect.TypeOf((*MockServer)(nil).ServiceID))\n}", "title": "" }, { "docid": "fce3c8762eaa5e4cd992a6609e3d6b4d", "score": "0.47140092", "text": "func (self *Service) ID() string {\n\treturn \"graphite\"\n}", "title": "" }, { "docid": "63ee4f885dcdac1763f772ec29649442", "score": "0.4706614", "text": "func (o *NatService) SetNatServiceId(v string) {\n\to.NatServiceId = &v\n}", "title": "" }, { "docid": "6584b292de51940a8b782c0ffc833930", "score": "0.47039476", "text": "func (reg *ServiceRegistry) RegisterService(id string, svc interface{}) {\n\terr := reg.graph.Provide(&inject.Object{Name: id, Value: svc, Complete: false})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\treg.order[len(reg.order)] = id\n\treg.services[id] = svc\n}", "title": "" }, { "docid": "911fd33ee4d92f4f542abf866ce44f0a", "score": "0.47023723", "text": "func (this *ControlPlaneDao) AddService(svc service.Service, serviceId *string) error {\n\tif err := this.facade.DFSLock(datastore.Get()).LockWithTimeout(\"add service\", userLockTimeout); err != nil {\n\t\tglog.Warningf(\"Cannot add service: %s\", err)\n\t\treturn err\n\t}\n\tdefer this.facade.DFSLock(datastore.Get()).Unlock()\n\n\treturn this.addService(svc, serviceId)\n}", "title": "" }, { "docid": "4a0499752079286c683439b3a25294b7", "score": "0.47002408", "text": "func (o ServiceNetworkAclOutput) SignalrServiceId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v *ServiceNetworkAcl) pulumi.StringOutput { return v.SignalrServiceId }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "c57e1d3852f770ec893de5c6a3d53066", "score": "0.46994975", "text": "func (p Params) NamespacedID(namespace string) string {\n\treturn helper.AddNamespace(p.ID(), namespace)\n}", "title": "" }, { "docid": "c10297ed1bc79fb7c0b1511443118b81", "score": "0.46963665", "text": "func (s *ExplainService) Id(id string) *ExplainService {\n\ts.id = id\n\treturn s\n}", "title": "" }, { "docid": "6ed48f3a365c76d539279132f48c35cb", "score": "0.46906343", "text": "func (mr *MockServiceMockRecorder) ServiceID() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ServiceID\", reflect.TypeOf((*MockService)(nil).ServiceID))\n}", "title": "" }, { "docid": "775a93e06d7f1fea1b62daa5ecd52cb1", "score": "0.46650153", "text": "func (self *Service) ID() string {\n\treturn \"espeaker\"\n}", "title": "" }, { "docid": "debdcabf24e7fe7416bce5df6e3e1427", "score": "0.4662812", "text": "func (m *DomainDnsSrvRecord) SetService(value *string)() {\n m.service = value\n}", "title": "" }, { "docid": "9e574e769f0f88176b891b2912f7129e", "score": "0.46615282", "text": "func (m *MockServiceRegistration) ServiceID() string {\n\tm.ctrl.T.Helper()\n\tret := m.ctrl.Call(m, \"ServiceID\")\n\tret0, _ := ret[0].(string)\n\treturn ret0\n}", "title": "" }, { "docid": "9fb3f516dbc9c0cdeb09a9152ae6c159", "score": "0.46589643", "text": "func NewGetCatalogsByIDParams() *GetCatalogsByIDParams {\n\tvar ()\n\treturn &GetCatalogsByIDParams{\n\n\t\ttimeout: cr.DefaultTimeout,\n\t}\n}", "title": "" }, { "docid": "bb0282cd48b20ab96d584bd3f2852eec", "score": "0.4646542", "text": "func (o *GetCatalogsByIDParams) WithSelect(selectVar *string) *GetCatalogsByIDParams {\n\to.SetSelect(selectVar)\n\treturn o\n}", "title": "" }, { "docid": "85d1e802f68aa3543c729d16bee1aa5e", "score": "0.46421826", "text": "func (mr *MockServiceRegistrationMockRecorder) ServiceID() *gomock.Call {\n\tmr.mock.ctrl.T.Helper()\n\treturn mr.mock.ctrl.RecordCallWithMethodType(mr.mock, \"ServiceID\", reflect.TypeOf((*MockServiceRegistration)(nil).ServiceID))\n}", "title": "" }, { "docid": "b5136968a14e80399c93f2bda2df49f8", "score": "0.46205947", "text": "func SetServiceName(name string) {\n\tcfg.mu.Lock()\n\tdefer cfg.mu.Unlock()\n\tcfg.serviceName = name\n}", "title": "" }, { "docid": "1e7d86adda56352d7ac8574f0cbcf6ab", "score": "0.4620367", "text": "func (o *ControllersPublicV1ProxyGetServiceCatalogDetailsParams) SetContext(ctx context.Context) {\n\to.Context = ctx\n}", "title": "" }, { "docid": "a0e0caf0b0dad9172567e6691ddbe114", "score": "0.46181816", "text": "func GetServiceAccountID() string {\n\treturn os.Getenv(serviceProviderAccountKey)\n}", "title": "" }, { "docid": "a1751e3fe3c1a67c2000f2a9b36de24e", "score": "0.46113464", "text": "func (_options *GetV2PolicyOptions) SetID(id string) *GetV2PolicyOptions {\n\t_options.ID = core.StringPtr(id)\n\treturn _options\n}", "title": "" }, { "docid": "dfaf29de12983b4e54fba34d760b0977", "score": "0.46104214", "text": "func (stuo *ServiceTypeUpdateOne) AddServiceIDs(ids ...string) *ServiceTypeUpdateOne {\n\tif stuo.services == nil {\n\t\tstuo.services = make(map[string]struct{})\n\t}\n\tfor i := range ids {\n\t\tstuo.services[ids[i]] = struct{}{}\n\t}\n\treturn stuo\n}", "title": "" }, { "docid": "6706d566e5914eba5ed18c577c642d0b", "score": "0.46007589", "text": "func (options *GetDocumentCategoriesOptions) SetDocumentID(documentID string) *GetDocumentCategoriesOptions {\n\toptions.DocumentID = core.StringPtr(documentID)\n\treturn options\n}", "title": "" }, { "docid": "2abffbe7e3d49e48a4dcebb6809ae61a", "score": "0.4587429", "text": "func (s *ListTableStorageOptimizersInput) SetCatalogId(v string) *ListTableStorageOptimizersInput {\n\ts.CatalogId = &v\n\treturn s\n}", "title": "" }, { "docid": "618832a1a9f6eb7afcb7676ae868b65b", "score": "0.45848802", "text": "func (b *BookingBusinessServicesCollectionRequestBuilder) ID(id string) *BookingServiceRequestBuilder {\n\tbb := &BookingServiceRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder}\n\tbb.baseURL += \"/\" + id\n\treturn bb\n}", "title": "" }, { "docid": "cabaee4d2763ebb62a17acf169c0b3c3", "score": "0.4580901", "text": "func (s *QueryPlanningContext) SetCatalogId(v string) *QueryPlanningContext {\n\ts.CatalogId = &v\n\treturn s\n}", "title": "" }, { "docid": "cac310b54defb6994466dbe465abc98c", "score": "0.4577548", "text": "func TestSpiffeIDService(t testing.T, service string) *SpiffeIDService {\n\treturn TestSpiffeIDServiceWithHost(t, service, TestClusterID+\".consul\")\n}", "title": "" }, { "docid": "cea3f5783bf4371bf2788df86d63d00e", "score": "0.4576995", "text": "func Update(c *cli.Context) error {\n\tif c.NArg() == 0 {\n\t\treturn ErrServicesUpdateID\n\t}\n\n\tid := c.Args().Get(0)\n\n\tif id == \"\" {\n\t\treturn ErrServicesUpdateID\n\t}\n\n\tclient := c.App.Metadata[\"client\"].(*api.Kongo)\n\n\tsvc, _, err := client.Services.Get(id)\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, ErrServicesUpdate)\n\t}\n\n\tsvc.ConnectTimeout = c.Int64(\"connect-timeout\")\n\tsvc.Path = c.String(\"path\")\n\tsvc.Port = c.Int(\"port\")\n\tsvc.ReadTimeout = c.Int(\"read-timeout\")\n\tsvc.Retries = c.Int(\"retries\")\n\tsvc.WriteTimeout = c.Int(\"write-timeout\")\n\tsvc.URL = c.String(\"url\")\n\n\tif v := c.String(\"host\"); v != \"\" {\n\t\tsvc.Host = v\n\t}\n\n\tif v := c.String(\"name\"); v != \"\" {\n\t\tsvc.Name = v\n\t}\n\n\tif v := c.String(\"protocol\"); v != \"\" {\n\t\tsvc.Protocol = v\n\t}\n\n\tif svc.URL != \"\" {\n\t\tsvc, _, err = client.Services.UpdateByURL(id, svc)\n\t} else {\n\t\tsvc, _, err = client.Services.Update(id, svc)\n\t}\n\n\tif err != nil {\n\t\treturn errors.Wrap(err, ErrServicesUpdate)\n\t}\n\n\tfmt.Fprintln(c.App.Writer, svc.Id)\n\n\treturn nil\n}", "title": "" }, { "docid": "31b4659f7b0b7959ae0e241af74341b1", "score": "0.45715848", "text": "func SetClientID(id string) {\n\tclientID = id\n}", "title": "" }, { "docid": "44f3e2328bc2aaacfe9ef31cce52af19", "score": "0.45634142", "text": "func (s *UpdateTableStorageOptimizerInput) SetCatalogId(v string) *UpdateTableStorageOptimizerInput {\n\ts.CatalogId = &v\n\treturn s\n}", "title": "" }, { "docid": "45079ad4517702b542bffc59372e88d6", "score": "0.4560712", "text": "func (m *AppleManagedIdentityProvider) GetServiceId()(*string) {\n val, err := m.GetBackingStore().Get(\"serviceId\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.(*string)\n }\n return nil\n}", "title": "" }, { "docid": "0ebd46c9a3b72eee652acae1ccf14d0e", "score": "0.45593455", "text": "func (r *SingularityRequest) SetID(s string) ServiceRequest {\n\tr.ID = s\n\treturn r\n}", "title": "" }, { "docid": "dd8a3c52df32a0535e5be131cf6b1bcd", "score": "0.45495662", "text": "func (s *GetTableObjectsInput) SetCatalogId(v string) *GetTableObjectsInput {\n\ts.CatalogId = &v\n\treturn s\n}", "title": "" }, { "docid": "633bfee754d234f8549a3409d0d50744", "score": "0.45481664", "text": "func (o *GetCatalogsByIDParams) WithTimeout(timeout time.Duration) *GetCatalogsByIDParams {\n\to.SetTimeout(timeout)\n\treturn o\n}", "title": "" }, { "docid": "c4cfd20bff10b4312f88ff2087ac50e8", "score": "0.45437282", "text": "func (o GetServiceServiceOutput) NodeId() pulumi.StringOutput {\n\treturn o.ApplyT(func(v GetServiceService) string { return v.NodeId }).(pulumi.StringOutput)\n}", "title": "" } ]
89034a6ebabac8950235e4feb9ef2adf
SetPassword is a setter function for setting user's password from a plaintext string value
[ { "docid": "36175d00c9a22d211078fa5164cb18eb", "score": "0.7083366", "text": "func (u *User) SetPassword(password string) (*User, *errors.Error) {\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn nil, errors.Wrap(fmt.Errorf(\"Failed setting password: %v\", err.Error()), 0)\n\t}\n\tu.password = hashedPassword\n\treturn u, nil\n}", "title": "" } ]
[ { "docid": "3bb142f60c8410811ea9e25b04f84e22", "score": "0.79525816", "text": "func (s *Service) SetPassword(ctx context.Context, userID platform.ID, password string) error {\n\tif len(password) < MinPasswordLength {\n\t\treturn EShortPassword\n\t}\n\n\tu, err := s.FindUserByID(ctx, userID)\n\tif err != nil {\n\t\treturn EIncorrectUser\n\t}\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), HashCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\ts.basicAuthKV.Store(u.ID.String(), hash)\n\n\treturn nil\n}", "title": "" }, { "docid": "41ed24b20c32bdaeb71f2fccc7b6e3d6", "score": "0.7884039", "text": "func (m *InvitePostRequestBody) SetPassword(value *string)() {\n m.password = value\n}", "title": "" }, { "docid": "b69e357cfa255a70d1dfa21df17dff2e", "score": "0.7793565", "text": "func (u *UsersMutator) SetPassword(val string) bool { //nolint:dupl false positive\n\tif val != u.Password {\n\t\tu.mutations = append(u.mutations, A.X{`=`, 2, val})\n\t\tu.Password = val\n\t\treturn true\n\t}\n\treturn false\n}", "title": "" }, { "docid": "ae6901bc99cbd70c2997ca286aaa4fa3", "score": "0.7782399", "text": "func (u *User) SetPassword(password string) error {\n\t// TODO(logan): 에러를 세분화\n\tif password == \"\" {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\tif len(password) < passwordMinimumLen {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\tok := digitRegExp.MatchString(password)\n\tif !ok {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\tok = upperRegExp.MatchString(password)\n\tif !ok {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\tok = lowerRegExp.MatchString(password)\n\tif !ok {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\tok = noWordRegExp.MatchString(password)\n\tif !ok {\n\t\treturn ErrorInvalidPassword\n\t}\n\n\thashedBytes, err := bcrypt.GenerateFromPassword(\n\t\t[]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn ErrorFailedSetPassword\n\t}\n\n\tu.HashedPassword = string(hashedBytes[:])\n\treturn nil\n}", "title": "" }, { "docid": "c0ae1e6802241ad91becdb2aacfd2c0a", "score": "0.7773259", "text": "func (p *User) SetPassword(password string) error {\n\tsalt := make([]byte, 16)\n\t_, err := rand.Read(salt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Password = p.sum(password, salt)\n\treturn nil\n}", "title": "" }, { "docid": "c0ae1e6802241ad91becdb2aacfd2c0a", "score": "0.7773259", "text": "func (p *User) SetPassword(password string) error {\n\tsalt := make([]byte, 16)\n\t_, err := rand.Read(salt)\n\tif err != nil {\n\t\treturn err\n\t}\n\tp.Password = p.sum(password, salt)\n\treturn nil\n}", "title": "" }, { "docid": "1a9998010ad42838beed81c1eaa96953", "score": "0.77405834", "text": "func (u *User) SetPassword(p string) {\n\thashedPassword, err := bcrypt.GenerateFromPassword([]byte(p), bcrypt.DefaultCost)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tu.Password = string(hashedPassword)\n}", "title": "" }, { "docid": "3f41553f74ebadb85b01e35f5ffbfef9", "score": "0.7704281", "text": "func (ns *NickServ) SetPassword(password string) (res string, err error) {\n\tres, err = ns.a.Command(\"NickServ\", \"SET\", \"PASSWORD\", password)\n\n\treturn\n}", "title": "" }, { "docid": "556bacba644131761a34638389c632dd", "score": "0.7629915", "text": "func (u *User) SetPassword() {\n hpass, err := bcrypt.GenerateFromPassword([]byte(u.Password), bcrypt.DefaultCost)\n if err != nil {\n panic(err) //this is a panic because bcrypt errors on invalid costs\n }\n u.Password = \"\"\n u.Password_Hash = hpass\n}", "title": "" }, { "docid": "998e3cb573419f01815e476050e97fe8", "score": "0.76020056", "text": "func (usr *User) SetPassword(passwordHash string) error {\n\tcmd := exec.Command(\"chpasswd\", \"-e\")\n\n\t// Securely pass the password hash\n\tstdin, err := cmd.StdinPipe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = cmd.Start()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tpasswordPair := fmt.Sprintf(\"%s:%s\", usr.Name, passwordHash)\n\n\t_, err = stdin.Write([]byte(passwordPair))\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tstdin.Close()\n\n\treturn cmd.Wait()\n}", "title": "" }, { "docid": "82fee19e060eee0965f5207905778ea8", "score": "0.7596626", "text": "func (user *User) SetPassword(password string) {\n user.Password = crypto.HashPassword(password)\n}", "title": "" }, { "docid": "e8109b558b452b64f931724a917876b9", "score": "0.75930697", "text": "func (u *User) setPassword(password string, serv password.Service) error {\n\terr := serv.Validate(password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tu.passwordHash = serv.Hash(password)\n\n\treturn nil\n}", "title": "" }, { "docid": "4a2ddb747c8d9cd658561be883cf9331", "score": "0.7571309", "text": "func (c *Core) SetPassword(p string) (bool, error) {\n\tif p == \"\" {\n\t\tif c.PasswordHash == nil {\n\t\t\treturn false, ErrInvalidPassword\n\t\t}\n\n\t\treturn false, nil\n\t}\n\n\tif err := CheckPassword(p); err != nil {\n\t\treturn false, err\n\t}\n\n\th, err := bcrypt.GenerateFromPassword([]byte(p), bcrypt.DefaultCost)\n\tif err != nil {\n\t\t// unlikely to happen\n\t\treturn false, err\n\t}\n\n\tc.PasswordHash = h\n\n\treturn true, nil\n}", "title": "" }, { "docid": "fd48e331c0d437a1967c41b2b31e1136", "score": "0.7545297", "text": "func Set(r render.Render, params martini.Params, db database.Datastore, data AccountPassword, user authentication.UserInfo) {\n\n\tif len(data.Password.String) < 8 {\n\t\tresponses.Error(r, \"Passwords need to be at least 8 characters long.\")\n\t\treturn\n\t}\n\n\t// Create a bcrypt hash from the password as we don't want to store\n\t// plain-text passwords in the database\n\tpwdHash, bcryptError := bcrypt.GenerateFromPassword([]byte(data.Password.String), 0)\n\tif bcryptError != nil {\n\t\tresponses.Error(r, bcryptError.Error())\n\t\treturn\n\t}\n\n\t// Update the database record\n\t_, err := db.GetDB().Exec(\"UPDATE platform_account SET password=? WHERE id=?\", pwdHash, user.UserID)\n\tif err != nil {\n\t\tresponses.Error(r, err.Error())\n\t\treturn\n\t}\n\n\tresponses.OKStatusOnly(r, \"Password Changed\")\n\n}", "title": "" }, { "docid": "46edd0db3d4839eae337de2e6d6c30a2", "score": "0.75149024", "text": "func (user *User) SetPassword(password string) {\n\tsalt := generateSalt()\n\tpasswordHash := pbkdf2.Key([]byte(password), salt, hashIterations, hashKeyLength, sha1.New)\n\tuser.PasswordHash = base64.StdEncoding.EncodeToString(passwordHash)\n\tuser.PasswordSalt = base64.StdEncoding.EncodeToString(salt)\n}", "title": "" }, { "docid": "540ba165c851a81a830f22d96d106bfe", "score": "0.74842685", "text": "func (u *User) SetPassword(password string, cost int) error {\n\tif cost < 10 {\n\t\tcost = 10\n\t}\n\n\tu.Salt = GenString(32)\n\ts := password + u.Salt\n\thash, err := bcrypt.GenerateFromPassword([]byte(s), cost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Password = string(hash)\n\treturn nil\n}", "title": "" }, { "docid": "61b692fdd165d26c7eabe637c00a5dd2", "score": "0.747827", "text": "func (u *User) SetPassword(pwd string) {\n\thash, _ := bcrypt.GenerateFromPassword([]byte(pwd), bcrypt.DefaultCost)\n\tu.Password = string(hash)\n}", "title": "" }, { "docid": "eff3722f7b6355805247764c6c72e10c", "score": "0.7429138", "text": "func (s *StoredUser) SetPassword(password string) (err error) {\n\tvar pwd []byte\n\tpwd, err = bcrypt.GenerateFromPassword([]byte(password), StoredUserPwdCost)\n\tif err != nil {\n\t\treturn\n\t}\n\ts.Password = pwd\n\treturn\n}", "title": "" }, { "docid": "01ac0668f2670f6e8f5b7cd80e8c9f48", "score": "0.74246424", "text": "func (s Service) SetPassword(ref string, password string) (err error) {\n\treturn s.DB.Update(func(tx *bolt.Tx) error {\n\t\tid, err := getUserID(tx, []byte(ref))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsalt, err := getUserSalt(tx, id)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn setPassword(tx, id, []byte(password), salt, s.PasswordNoReuseMonths)\n\t})\n}", "title": "" }, { "docid": "f8d574c307bd5165f60f592bad53d4b3", "score": "0.74208015", "text": "func (a *Account) SetPassword(pass string) error {\n\tpasswordHash, err := generatePasswordHash(pass)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"generate error: %w\", err)\n\t}\n\ta.PasswordHash = passwordHash\n\treturn nil\n}", "title": "" }, { "docid": "016e2d58f7d7f2a5dc6a3a351869953d", "score": "0.7399525", "text": "func (c *Client) SetPassword(ctx context.Context, request *SetPasswordRequest) (*PasswordState, error) {\n\tvar result PasswordState\n\n\tif err := c.rpc.Invoke(ctx, request, &result); err != nil {\n\t\treturn nil, err\n\t}\n\treturn &result, nil\n}", "title": "" }, { "docid": "1073c339c895588ceca9f4458b6fa726", "score": "0.7387642", "text": "func (g *GPR) SetPassword(password string) { g.password = password }", "title": "" }, { "docid": "99595e54362dfaf6eb965bb10b963f56", "score": "0.73724294", "text": "func (u *User) SetPassword(password string) error {\n\thashed, err := GeneratePassword([]byte(password))\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Password = hashed\n\treturn nil\n}", "title": "" }, { "docid": "839bd02a9758a42a443eeb15d375d8fe", "score": "0.73632413", "text": "func (u *User) SetPassword(password string) error {\n\t//use the bcrypt package to generate a new hash of the password\n\t//https://godoc.org/golang.org/x/crypto/bcrypt\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.PassHash = hash\n\treturn nil\n}", "title": "" }, { "docid": "b16d545a83552c505f44a5b9db1bdde1", "score": "0.7354807", "text": "func (z *User) SetPassword(password string) error {\n\n\tbhash, err := bcrypt.GenerateFromPassword([]byte(password), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tz.PasswordHash = hex.EncodeToString(bhash)\n\n\treturn nil\n\n}", "title": "" }, { "docid": "60224606748ebc1fe370109cfd852d7c", "score": "0.7352891", "text": "func (s *User) SetPassword(val OptString) {\n\ts.Password = val\n}", "title": "" }, { "docid": "8428d92fb68894057cc75d2643dc039b", "score": "0.7340455", "text": "func (s *Service) SetPassword(ctx context.Context, name string, password string) error {\n\treturn s.kv.Update(ctx, func(tx Tx) error {\n\t\treturn s.setPassword(ctx, tx, name, password)\n\t})\n}", "title": "" }, { "docid": "85ec0ac825777a75cb2bccebdf259fec", "score": "0.7315605", "text": "func (u *User) SetPassword(password string) error {\n\t//hash the plaintext password using an adaptive\n\t//crytographic hashing algorithm like bcrypt\n\t//https://godoc.org/golang.org/x/crypto/bcrypt\n\tph, err := bcrypt.GenerateFromPassword([]byte(password), 15)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t//set the User's PassHash field to the resulting hash\n\tu.PassHash = ph\n\n\treturn nil\n}", "title": "" }, { "docid": "80db732a7404bb4b095778b6a572e8f0", "score": "0.7311155", "text": "func (u *User) SetPassword(password string) error {\n\th, err := bcrypt.GenerateFromPassword([]byte(password), 0)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Password = base64.StdEncoding.EncodeToString(h)\n\treturn nil\n}", "title": "" }, { "docid": "f9c125f716a8ea20586b7ae86e693144", "score": "0.7270314", "text": "func (w *ServerInterfaceWrapper) SetPassword(ctx echo.Context) error {\n\tvar err error\n\n\t// Parameter object where we will unmarshal all parameters from the context\n\tvar params SetPasswordParams\n\t// ------------- Required query parameter \"code\" -------------\n\n\terr = runtime.BindQueryParameter(\"form\", true, true, \"code\", ctx.QueryParams(), &params.Code)\n\tif err != nil {\n\t\treturn echo.NewHTTPError(http.StatusBadRequest, fmt.Sprintf(\"Invalid format for parameter code: %s\", err))\n\t}\n\n\t// Invoke the callback with all the unmarshalled arguments\n\terr = w.Handler.SetPassword(ctx, params)\n\treturn err\n}", "title": "" }, { "docid": "46de5bcd46d3c2fdf2b2274dd2f17fae", "score": "0.7256212", "text": "func (u *User) SetPassword(password string) error {\n\tif len(password) < 6 {\n\t\treturn ErrInvalidPasswordLength\n\t}\n\tpassHash, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost)\n\tu.PassHash = passHash\n\treturn err\n}", "title": "" }, { "docid": "845ea29ad4c1c69c346c0f3d765eab63", "score": "0.7179694", "text": "func (u *User) SetPassword(password string) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), 8)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.PassHash = string(hash)\n\treturn nil\n}", "title": "" }, { "docid": "46a9d6821d435b56dc2312cd2ba304dd", "score": "0.71719027", "text": "func (user *User) SetPassword(newPassword string) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(newPassword), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tuser.Password = string(hash)\n\treturn nil\n}", "title": "" }, { "docid": "9b2fd5ddd86be7dd09370f7743d38b32", "score": "0.7162622", "text": "func (u *User) SetPassword(password string) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), 13)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.Password = string(hash)\n\n\treturn nil\n}", "title": "" }, { "docid": "54ede652efc35c910b2c39496ca2e0f3", "score": "0.71435565", "text": "func (u *User) SetPassword(password string) error {\n\thashPass, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost)\n\n\tif err == nil {\n\t\tu.PassHash = hashPass\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "c607aadb6ab2c53938a7a15842005575", "score": "0.7133099", "text": "func (u *User) SetPassword(password string) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), bcryptCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.PassHash = hash\n\treturn nil\n}", "title": "" }, { "docid": "20c10783c081e1de856c2a62f6e298f9", "score": "0.7112612", "text": "func (b *AdminCredentialsBuilder) Password(value string) *AdminCredentialsBuilder {\n\tb.password = value\n\tb.bitmap_ |= 1\n\treturn b\n}", "title": "" }, { "docid": "9680f95b518427dc0cc3c3e03317c5f3", "score": "0.7102534", "text": "func (user *User) SetPassword(password string) error {\n\tif !ValidUserPassword.MatchString(password) {\n\t\treturn &ErrInvalid{Model: \"user\", Which: \"password\", Value: string(user.Password)}\n\t}\n\n\thash, err := bcrypt.GenerateFromPassword([]byte(password), core.GetConfig().HashCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tuser.Password = hash\n\treturn nil\n}", "title": "" }, { "docid": "a171618e825060453ca1ae30fd8ae38b", "score": "0.71009356", "text": "func (u *User) SetPassword(pwd string) error {\n\tpwdBytes := []byte(pwd)\n\thash, err := bcrypt.GenerateFromPassword(pwdBytes, bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\tu.PasswordHash = hash\n\treturn nil\n}", "title": "" }, { "docid": "5824a2380b3db1b3b9e90756ea86354a", "score": "0.71005285", "text": "func (p *Pool) SetPassword(password string) error {\n\tpasswordHash, err := argon2id.DefaultHashPassword(password)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tp.passwordHash = passwordHash\n\treturn nil\n}", "title": "" }, { "docid": "fcfc7e57483f1991b6fab6dbe56bb81f", "score": "0.7069975", "text": "func (m *SystemmemberMutation) SetPassword(s string) {\n\tm._Password = &s\n}", "title": "" }, { "docid": "03dd975bc165ea3d6bb77227d5aa025d", "score": "0.7028871", "text": "func (m *User) SetPassword(password string) error {\n\n\tif len(password) < 6 {\n\t\treturn fmt.Errorf(\"new password for %s must be at least 6 characters\", m.UserName)\n\t}\n\tm.Password = password\n\treturn nil\n}", "title": "" }, { "docid": "26eb2b41b592645001422fc39df8c551", "score": "0.7006856", "text": "func (y *YAML) SetPassword(v string) {\n\ty.password = v\n}", "title": "" }, { "docid": "fd57cf38133b645334f440e4960b8a75", "score": "0.70033866", "text": "func (ua *UserAccount) SetPassword(password string) error {\n\tdb := postgres.Db\n\tres := db.MustExec(sqlSetUserPassword, crypt.HashPassword(password), ua.UserAccountID)\n\tra, err := res.RowsAffected()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif ra < 1 {\n\t\treturn errors.New(\"no rows affected\")\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "45aba45350c4e992b398943d8204408a", "score": "0.69731086", "text": "func UpdatePassword(u, p string) {\n\topdatabase.UpdateUser(u, p)\n}", "title": "" }, { "docid": "545072f199b62a95826863080de2363e", "score": "0.69630796", "text": "func (o *orm) SetPassword(user *User, newPassword string) error {\n\thashedPassword, err := utils.HashPassword(newPassword)\n\tif err != nil {\n\t\treturn err\n\t}\n\tsql := \"UPDATE users SET hashed_password = $1, updated_at = now() WHERE email = $2 RETURNING *\"\n\treturn o.q.Get(user, sql, hashedPassword, user.Email)\n}", "title": "" }, { "docid": "92b61a1acff7e4b1dad56f4791ff8557", "score": "0.69578314", "text": "func SetUserPassword(user interface{}, newPassword string) error {\n\tval := reflect.ValueOf(user).Elem()\n\tsalt, err := generateSalt()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\thash := computeHash(newPassword, salt)\n\tval.FieldByName(\"Hash\").SetString(hash)\n\tval.FieldByName(\"Salt\").SetString(salt)\n\treturn nil\n}", "title": "" }, { "docid": "6dd98c0efea035d585e98b3b43c6c144", "score": "0.69523954", "text": "func (u *User) SetPassword(password string) {\n\tsha := generateHash(password)\n\tu.passwordHash = sha\n}", "title": "" }, { "docid": "65217f0f9308f2ec700185c9cac8b883", "score": "0.6904673", "text": "func (ua *UserAccount) SetPassword(pass string) {\n\tua.Password = HashPassword(pass)\n}", "title": "" }, { "docid": "41da5d37a91c99e17140613754f59e9d", "score": "0.6903729", "text": "func (pu *PostUpdate) SetPassword(s string) *PostUpdate {\n\tpu.mutation.SetPassword(s)\n\treturn pu\n}", "title": "" }, { "docid": "9af70f8349e339988998111d96e6744b", "score": "0.69023895", "text": "func (vsuo *VerySecretUpdateOne) SetPassword(s string) *VerySecretUpdateOne {\n\tvsuo.mutation.SetPassword(s)\n\treturn vsuo\n}", "title": "" }, { "docid": "452e8540fd112fa141151d3c680aedf4", "score": "0.6893281", "text": "func (u *Registrant) SetPass(passwd string) error {\n\thash, err := bcrypt.GenerateFromPassword([]byte(passwd), bcrypt.DefaultCost)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\t// no errors\n\tu.Password = hash\n\treturn nil\n}", "title": "" }, { "docid": "ff521e8b82f489e6b7c0c037a57794f3", "score": "0.6890549", "text": "func SetPassword(Password string) OptionFunc {\n\treturn func(c *Client) error {\n\t\tc.password = Password\n\t\treturn nil\n\t}\n}", "title": "" }, { "docid": "70bdc987dcd30d03afcd851c675d3c60", "score": "0.688146", "text": "func (n *SdfsConnection) SetPassword(ctx context.Context, password string) (err error) {\n\tfi, err := n.vc.SetPassword(ctx, &spb.SetPasswordRequest{Password: password})\n\tif err != nil {\n\t\tlog.Print(err)\n\t\treturn err\n\t} else if fi.GetErrorCode() > 0 {\n\t\treturn &SdfsError{Err: fi.GetError(), ErrorCode: fi.GetErrorCode()}\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "f4ec7030b4cf1fee88b79cccd3bb073a", "score": "0.6875537", "text": "func (u *User) PutPassword(password string) {\n\tu.Password = password\n}", "title": "" }, { "docid": "2bcbb39ad0a9cb7ba726ac2409a5bb96", "score": "0.6875104", "text": "func (euo *EmployeeUpdateOne) SetPassword(s string) *EmployeeUpdateOne {\n\teuo.mutation.SetPassword(s)\n\treturn euo\n}", "title": "" }, { "docid": "176c5e43f26df6c9bc979a02a8556f4c", "score": "0.68669575", "text": "func (file *File) SetPassword(username string, password string) error {\n\n\tfor _, line := range file.lines {\n\t\tif line.Username == username {\n\t\t\treturn line.SetPassword(password)\n\t\t}\n\t}\n\n\treturn fmt.Errorf(\"The specified user (%s) does not exist\", username)\n}", "title": "" }, { "docid": "4eaa04e1ce69456efcb30b8c2900f211", "score": "0.6854457", "text": "func (puo *PostUpdateOne) SetPassword(s string) *PostUpdateOne {\n\tpuo.mutation.SetPassword(s)\n\treturn puo\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "2078e0ae795bac266f4a5c2441da0a82", "score": "0.6819885", "text": "func (uu *UserUpdate) SetPassword(s string) *UserUpdate {\n\tuu.mutation.SetPassword(s)\n\treturn uu\n}", "title": "" }, { "docid": "a807a8fc50a211ef7628428af18da7d5", "score": "0.6816112", "text": "func (lib *Library) ModifyPassword(userid, password string) error {\n\t_, err := lib.db.Exec(`UPDATE Userlist SET password = ? WHERE id = ?`, password, userid)\n\tif err != nil {\n\t\tlog.Println(err)\n\t}\n\n\treturn err\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "3d5cefd28a6a6262a4c54b0d8726564a", "score": "0.68086", "text": "func (uuo *UserUpdateOne) SetPassword(s string) *UserUpdateOne {\n\tuuo.mutation.SetPassword(s)\n\treturn uuo\n}", "title": "" }, { "docid": "746be470bef85af364363ef72bffff45", "score": "0.67930704", "text": "func (vsu *VerySecretUpdate) SetPassword(s string) *VerySecretUpdate {\n\tvsu.mutation.SetPassword(s)\n\treturn vsu\n}", "title": "" }, { "docid": "f279e66a882f5f27ddaf21f69b94651f", "score": "0.67621946", "text": "func (ctl *TcaCtl) CmdSetPassword() *cobra.Command {\n\n\t// cloud - tenants\n\tvar _cmd = &cobra.Command{\n\t\tUse: \"password\",\n\t\tShort: \"Command sets cluster username and saves config.\",\n\t\tLong: templates.LongDesc(\n\t\t\t`Command sets cluster username and saves config.`),\n\t\tExample: \"tcactl set password mypass\",\n\t\tArgs: cobra.MinimumNArgs(1),\n\t\tRun: func(cmd *cobra.Command, args []string) {\n\t\t\tviper.Set(ConfigTcaPassword, args[0])\n\t\t\terr := viper.WriteConfig()\n\t\t\tio.CheckErr(err)\n\t\t},\n\t}\n\treturn _cmd\n}", "title": "" }, { "docid": "b343a1d11643766c9ea32499bb04f897", "score": "0.6734885", "text": "func (m *MachineMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "372f20d040bb9e2ebad8f39ea1b8ed78", "score": "0.6726097", "text": "func (m *resellerAccount) SetPassword(val *string) {\n\tm.passwordField = val\n}", "title": "" }, { "docid": "a39cf24ebfa31c4e1b2d6a1c902c4be1", "score": "0.6716664", "text": "func (user *User) SetPassword(password string) {\n\tif password == \"\" {\n\t\tuser.PasswordHash = nil\n\t} else {\n\t\tuser.PasswordHash = passwordhash.New(password)\n\t}\n}", "title": "" }, { "docid": "bb151a6192d546ff96d66bbcd03d94f7", "score": "0.6713565", "text": "func (eu *EmployeeUpdate) SetPassword(s string) *EmployeeUpdate {\n\teu.mutation.SetPassword(s)\n\treturn eu\n}", "title": "" }, { "docid": "0a83cf5a25b61336fafe85d3a96b4322", "score": "0.67098176", "text": "func (self *User) SetPassword(password string) error {\n\tself.Password = password\n\treturn self.Update()\n}", "title": "" }, { "docid": "aea9d732bfc5494828bd5e058139fc6b", "score": "0.67029667", "text": "func (ru *ResourceUpdate) SetPassword(s string) *ResourceUpdate {\n\tru.mutation.SetPassword(s)\n\treturn ru\n}", "title": "" }, { "docid": "457bf2f75b9fd5fe7192e782b78613d0", "score": "0.6698015", "text": "func (ruo *ResourceUpdateOne) SetPassword(s string) *ResourceUpdateOne {\n\truo.mutation.SetPassword(s)\n\treturn ruo\n}", "title": "" }, { "docid": "1d48f6e1580c06d87c5d660e981823d9", "score": "0.66976726", "text": "func (m *UserMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "1d48f6e1580c06d87c5d660e981823d9", "score": "0.66976726", "text": "func (m *UserMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "1d48f6e1580c06d87c5d660e981823d9", "score": "0.66976726", "text": "func (m *UserMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "1d48f6e1580c06d87c5d660e981823d9", "score": "0.66976726", "text": "func (m *UserMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "1d48f6e1580c06d87c5d660e981823d9", "score": "0.66976726", "text": "func (m *UserMutation) SetPassword(s string) {\n\tm.password = &s\n}", "title": "" }, { "docid": "270b090ba3aecd78d077b447dd4c986c", "score": "0.6674995", "text": "func (mc *MachineCreate) SetPassword(s string) *MachineCreate {\n\tmc.mutation.SetPassword(s)\n\treturn mc\n}", "title": "" }, { "docid": "7ffbdc933616882416901211c5937110", "score": "0.66650975", "text": "func (uc *UserCreate) SetPassword(s string) *UserCreate {\n\tuc.mutation.SetPassword(s)\n\treturn uc\n}", "title": "" }, { "docid": "7ffbdc933616882416901211c5937110", "score": "0.66650975", "text": "func (uc *UserCreate) SetPassword(s string) *UserCreate {\n\tuc.mutation.SetPassword(s)\n\treturn uc\n}", "title": "" }, { "docid": "7ffbdc933616882416901211c5937110", "score": "0.66650975", "text": "func (uc *UserCreate) SetPassword(s string) *UserCreate {\n\tuc.mutation.SetPassword(s)\n\treturn uc\n}", "title": "" }, { "docid": "0b8b76e84d4e6baa690a6bd21233a44e", "score": "0.6636418", "text": "func (c *Config) SetPass(pass string) {\n\tc.Salt = make([]byte, 32)\n\trand.Read(c.Salt)\n\tc.Password = auth.Hash([]byte(pass), c.Salt)\n}", "title": "" }, { "docid": "8ae632b2a3923d9d9ae35dd819101b04", "score": "0.66164434", "text": "func (f *Faker) Password(lower bool, upper bool, numeric bool, special bool, space bool, num int) string {\n\treturn password(f.Rand, lower, upper, numeric, special, space, num)\n}", "title": "" }, { "docid": "644fd5b2ab86ab4fde3d11b2969c4ccf", "score": "0.6599238", "text": "func (db *BoltDB) SetWalletPassword(wid []byte, newPW []byte) error {\n\treturn db.walletsUpdate(func(master *bbolt.Bucket) error {\n\t\twBkt := master.Bucket(wid)\n\t\tif wBkt == nil {\n\t\t\treturn fmt.Errorf(\"wallet with ID is %x not known\", wid)\n\t\t}\n\t\twallet, err := makeWallet(wBkt)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\twallet.EncryptedPW = newPW\n\t\treturn wBkt.Put(walletKey, wallet.Encode())\n\t})\n}", "title": "" }, { "docid": "fdeca783472a2260e79cba59d9099729", "score": "0.6593877", "text": "func (uc *UserCreate) SetPasswordStr(s string) *UserCreate {\n\tuc.mutation.SetPasswordStr(s)\n\treturn uc\n}", "title": "" }, { "docid": "ed58f3f64924ca64cbc51c6964a6d2dc", "score": "0.65916353", "text": "func Password(cfg config.ConfigurationSet) error {\n\tif cfg.ExistsWithValue(defaults.PasswordConfigItem) {\n\t\treturn nil\n\t}\n\n\tpassword := \"\"\n\tprompt := &survey.Password{\n\t\tMessage: \"Enter your password\",\n\t}\n\tif err := survey.AskOne(prompt, &password, survey.WithValidator(survey.Required)); err != nil {\n\t\treturn fmt.Errorf(\"asking for password name: %w\", err)\n\t}\n\n\tif err := cfg.SetValue(defaults.PasswordConfigItem, password); err != nil {\n\t\treturn fmt.Errorf(\"setting password config: %w\", err)\n\t}\n\n\treturn nil\n}", "title": "" }, { "docid": "6dda16ad812b2b772012ece4326164cb", "score": "0.6585095", "text": "func (user *User) SetPassword(password string) {\n\tuser.password = password\n}", "title": "" }, { "docid": "cc51514aa8b25a11a8ff3c355e1b9b5c", "score": "0.6575189", "text": "func Password(password string) func(*IP9258) {\n\treturn func(r *IP9258) {\n\t\tr.password = password\n\t}\n}", "title": "" }, { "docid": "6b940cc13066ca3f3a2c183c3df72335", "score": "0.65639997", "text": "func (pc *PersonnelCreate) SetPassword(s string) *PersonnelCreate {\n\tpc.mutation.SetPassword(s)\n\treturn pc\n}", "title": "" }, { "docid": "2c01839e8ae161b4daff2dc0f7e91ba8", "score": "0.6558062", "text": "func (u User) UpdatePassword(password string) error {\n\treturn ErrNotImplemented\n}", "title": "" }, { "docid": "c6c173ceefaef62119823259c0416a64", "score": "0.6545865", "text": "func (self *CTextfieldT) SetPasswordInput(\n\tpassword_input int,\n) {\n\n\tC.cefingo_textfield_set_password_input((*C.cef_textfield_t)(self.pc_textfield), (C.int)(password_input))\n\n}", "title": "" }, { "docid": "46fe7b8fe7ec607521e40bf3feb0f598", "score": "0.65393895", "text": "func (cc *CustomerCreate) SetPassword(s string) *CustomerCreate {\n\tcc.mutation.SetPassword(s)\n\treturn cc\n}", "title": "" } ]
2dea3e82b16a1f86f6def5bef51d5d7e
Get the count of the roles
[ { "docid": "1e3382f4a9ebf80ee6db5a8a8e0794b7", "score": "0.7759125", "text": "func (d *DeploymentSpec) CountOfRoles() int {\n\n\treturn len(d.Roles)\n\n}", "title": "" } ]
[ { "docid": "f81f0ea550a614001bbeb01d1a286a7b", "score": "0.71656144", "text": "func (q dGuildRoleQuery) Count() (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count d_guild_roles rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "12fd6ee5fd7073f01e1a95e06469fb3c", "score": "0.6951626", "text": "func TotalRoles(where interface{}) (int, error) {\n\troleModel = &models.Role{}\n\treturn roleModel.GetTotal(where)\n}", "title": "" }, { "docid": "ddb88865f21a6ef888e60a16a9aeb2e8", "score": "0.6793002", "text": "func (m *DirectoryRolesRequestBuilder) Count()(*i2a93ad836768ad49d953d9dfcefa9cac543730d20058b421e20bc27251dc8156.CountRequestBuilder) {\n return i2a93ad836768ad49d953d9dfcefa9cac543730d20058b421e20bc27251dc8156.NewCountRequestBuilderInternal(m.pathParameters, m.requestAdapter);\n}", "title": "" }, { "docid": "3f8e978f5073fd74e3691ef6705ff4b6", "score": "0.6651288", "text": "func (q cmfRoleUserQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count cmf_role_user rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "d79bfc75ac8180e5d19a7f12ace0a3e5", "score": "0.6637176", "text": "func (q institutionRoleQuery) Count() (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count institution_role rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "bd3e9e114e0196d302fe43b6cefee6c8", "score": "0.6595914", "text": "func (_InterchainSwap *InterchainSwapCaller) GetRoleMemberCount(opts *bind.CallOpts, role [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _InterchainSwap.contract.Call(opts, &out, \"getRoleMemberCount\", role)\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": "97c1867c867bc6414217b6eef3b1db8f", "score": "0.65561724", "text": "func (_InterchainSwap *InterchainSwapCallerSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _InterchainSwap.Contract.GetRoleMemberCount(&_InterchainSwap.CallOpts, role)\n}", "title": "" }, { "docid": "7f0aee7483eb9ca23b108d8a85975cd3", "score": "0.6539271", "text": "func (_Proxy *ProxyCaller) GetRoleMemberCount(opts *bind.CallOpts, role [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Proxy.contract.Call(opts, &out, \"getRoleMemberCount\", role)\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": "d3ec1b9411e0cf6f780e5de5f3dc1145", "score": "0.6518856", "text": "func (_InterchainSwap *InterchainSwapSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _InterchainSwap.Contract.GetRoleMemberCount(&_InterchainSwap.CallOpts, role)\n}", "title": "" }, { "docid": "e82f58f8f73f9058fecd79a6c8882363", "score": "0.64710546", "text": "func (_Proxy *ProxyCallerSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _Proxy.Contract.GetRoleMemberCount(&_Proxy.CallOpts, role)\n}", "title": "" }, { "docid": "43412a88ff52a7ba9bdbff707fb0a1f2", "score": "0.6433909", "text": "func (_AccessControl *AccessControlCaller) GetRoleMemberCount(opts *bind.CallOpts, role [32]byte) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _AccessControl.contract.Call(opts, &out, \"getRoleMemberCount\", role)\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": "b4df4c5afb36cb8025ca95eb40d2662b", "score": "0.6430815", "text": "func (_Proxy *ProxySession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _Proxy.Contract.GetRoleMemberCount(&_Proxy.CallOpts, role)\n}", "title": "" }, { "docid": "51b3a68f63298a1f171a2a62f98f3438", "score": "0.62945306", "text": "func (_AccessControl *AccessControlCallerSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _AccessControl.Contract.GetRoleMemberCount(&_AccessControl.CallOpts, role)\n}", "title": "" }, { "docid": "3cebe6165236b06132a74c32fb4d01bb", "score": "0.6210767", "text": "func (_AccessControl *AccessControlSession) GetRoleMemberCount(role [32]byte) (*big.Int, error) {\n\treturn _AccessControl.Contract.GetRoleMemberCount(&_AccessControl.CallOpts, role)\n}", "title": "" }, { "docid": "9ea3721f8a03b23ad45a660c0c004bfc", "score": "0.61625236", "text": "func (m *ManagedTenantsMyRolesRequestBuilder) Count()(*ManagedTenantsMyRolesCountRequestBuilder) {\n return NewManagedTenantsMyRolesCountRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)\n}", "title": "" }, { "docid": "ba587aea572e42e2e3070d1477ac4565", "score": "0.59467477", "text": "func (r *Role) CountRolesByKeyword(keyword string) (count int64, err error) {\n\n\tdb := G.DB()\n\tvar rs *mysql.ResultSet\n\trs, err = db.Query(db.AR().\n\t\tSelect(\"count(*) as total\").\n\t\tFrom(Table_Role_Name).\n\t\tWhere(map[string]interface{}{\n\t\t\t\"name LIKE\": \"%\" + keyword + \"%\",\n\t\t\t\"is_delete\": Role_Delete_False,\n\t\t}))\n\tif err != nil {\n\t\treturn\n\t}\n\tcount = utils.NewConvert().StringToInt64(rs.Value(\"total\"))\n\treturn\n}", "title": "" }, { "docid": "6db3f020da8b6301d3589234ab6976b7", "score": "0.5901559", "text": "func GetAllRoles(w http.ResponseWriter, r *http.Request) {\n\tparams := getURLParams(r)\n\tstartIndexStr := params.Get(\"startindex\")\n\tcountStr := params.Get(\"count\")\n\n\tres := &JSONResponse{Writer: w}\n\tcode := e.SUCCESS\n\tif startIndexStr == \"\" || countStr == \"\" {\n\t\tcode = e.INVALID_PARAMS\n\t} else {\n\t\tstartIndex := com.StrTo(startIndexStr).MustInt()\n\t\tcount := com.StrTo(countStr).MustInt()\n\t\trecords, err := application.QueryRoles(startIndex, count, \"\")\n\t\tif err != nil {\n\t\t\tcode = e.ERROR\n\t\t} else {\n\t\t\tcount, err := application.TotalRoles(\"\")\n\t\t\tif err != nil {\n\t\t\t\tcode = e.GET_TOTAL_FAILED\n\t\t\t} else {\n\t\t\t\tres.Data = &CollectionResult{Collection: records, Count: count}\n\t\t\t}\n\t\t}\n\t}\n\tres.Code = code\n\tres.Response()\n}", "title": "" }, { "docid": "7860c7cf36452ec520d64babe8b42973", "score": "0.587653", "text": "func (m *NodeMock) RolesMinimockCounter() uint64 {\n\treturn atomic.LoadUint64(&m.RolesCounter)\n}", "title": "" }, { "docid": "299d7f6129b1176ecde1d27a024c7eb9", "score": "0.58149177", "text": "func (auth *authStore) Count(ctx context.Context) (int64, error) {\n\treturn 0, nil\n}", "title": "" }, { "docid": "99637677735a8ffdcd6bf1087b405429", "score": "0.57724243", "text": "func (m *EntitlementManagementAccessPackageResourcesItemAccessPackageResourceRolesCountRequestBuilder) Get(ctx context.Context, requestConfiguration *EntitlementManagementAccessPackageResourcesItemAccessPackageResourceRolesCountRequestBuilderGetRequestConfiguration)(*int32, error) {\n requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration);\n if err != nil {\n return nil, err\n }\n errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings {\n \"4XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n \"5XX\": i20a3050780ee0b0cde0a884a4f35429a20d60067e3bcda382ec5400079147459.CreateODataErrorFromDiscriminatorValue,\n }\n res, err := m.BaseRequestBuilder.RequestAdapter.SendPrimitive(ctx, requestInfo, \"int32\", errorMapping)\n if err != nil {\n return nil, err\n }\n if res == nil {\n return nil, nil\n }\n return res.(*int32), nil\n}", "title": "" }, { "docid": "e595eb147af2177c8e42a438069f3f66", "score": "0.56059265", "text": "func (q dGuildRoleQuery) CountP() int64 {\n\tc, err := q.Count()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "4cfc547f76b1bf6f7b6eee2cf26bc590", "score": "0.55512094", "text": "func GetCasbinRoles(offset, limit int) ([]CasbinRole, int) {\n\tvar count int\t\n\tvar roles []CasbinRole\n\tgormDB.Offset(offset).Limit(limit).Order(\"id asc\").Find(&roles).Count(&count)\n\treturn roles, count\n}", "title": "" }, { "docid": "293589373993e9055c595a4c16072df3", "score": "0.5530481", "text": "func ByRolesCount(opts ...sql.OrderTermOption) OrderOption {\n\treturn func(s *sql.Selector) {\n\t\tsqlgraph.OrderByNeighborsCount(s, newRolesStep(), opts...)\n\t}\n}", "title": "" }, { "docid": "c12326c753b73e75209f393e9eb23a01", "score": "0.5520691", "text": "func (rs roles) Search(\n\tterm string, lo *repositories.ListOptions,\n) ([]models.Role, int64, error) {\n\trsSl, err := rs.repo.Roles.Search(term, lo)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\tcount, err := rs.repo.Roles.SearchCount(term)\n\tif err != nil {\n\t\treturn nil, 0, err\n\t}\n\treturn rsSl, count, nil\n}", "title": "" }, { "docid": "a7d574334fca33af2310c7e21bd65ff1", "score": "0.5492886", "text": "func (db *DatabaseRepository) GetASNCountOnRole(FabricID uint, role string) (int64, error) {\n\tif db.MockGetASNCountOnRole != nil {\n\t\treturn db.MockGetASNCountOnRole(FabricID, role)\n\t}\n\treturn 0, nil\n}", "title": "" }, { "docid": "d9088cdea20609ee97d0e826895fd209", "score": "0.54885775", "text": "func (s *UserService) Count(ctx context.Context, realm string) (uint32, error) {\n\n\tpath := \"/realms/{realm}/users/count\"\n\n\tvar result uint32\n\n\t_, err := s.client.newRequest(ctx).\n\t\tSetPathParams(map[string]string{\n\t\t\t\"realm\": s.client.Realm,\n\t\t}).\n\t\tSetResult(&result).\n\t\tGet(path)\n\n\treturn result, err\n}", "title": "" }, { "docid": "4aec3440e4253c3b9bf1af941f22efe1", "score": "0.54648936", "text": "func (_Authorizers *AuthorizersSession) AuthorizerCount() (*big.Int, error) {\n\treturn _Authorizers.Contract.AuthorizerCount(&_Authorizers.CallOpts)\n}", "title": "" }, { "docid": "6fedcb9b9f871987b6b38dd4cf1f6168", "score": "0.54489285", "text": "func (repo *Repository) Count(param User) uint {\n\tvar result uint\n\n\tvar sql = \"SELECT * FROM user WHERE 1=1\"\n\n\tif param.Name != \"\" {\n\t\tsql += \" AND name LIKE '%\" + param.Name + \"%'\"\n\t}\n\n\tif param.Role.ID != 0 {\n\t\tsql += \" AND role_id = \" + fmt.Sprint(param.Role.ID)\n\t}\n\n\trepo.db.Get(&result, sql)\n\n\treturn result\n}", "title": "" }, { "docid": "9a030a4a8d072867951f66b320d642c1", "score": "0.5445044", "text": "func (q institutionRoleQuery) CountP() int64 {\n\tc, err := q.Count()\n\tif err != nil {\n\t\tpanic(boil.WrapErr(err))\n\t}\n\n\treturn c\n}", "title": "" }, { "docid": "f2e385aa1abcedce77c2d7cf215efa6d", "score": "0.5441401", "text": "func (m *NodeMock) Roles() (r []core.NodeRole) {\n\tatomic.AddUint64(&m.RolesPreCounter, 1)\n\tdefer atomic.AddUint64(&m.RolesCounter, 1)\n\n\tif m.RolesFunc == nil {\n\t\tm.t.Fatal(\"Unexpected call to NodeMock.Roles\")\n\t\treturn\n\t}\n\n\treturn m.RolesFunc()\n}", "title": "" }, { "docid": "a4dd3d75b258783dba21d6efca042217", "score": "0.5387835", "text": "func (c *Client) Roles() (model.AdminQuery, error) {\n\treturn model.AdminQuery{}, errors.New(\"not implemented\")\n}", "title": "" }, { "docid": "a274fff18f4b9a199f1b66abe7f5f7fa", "score": "0.53808683", "text": "func (s Store) getCurrentRoles(ctx context.Context, tx *db.Tx, source *entity.User) ([]int, error) {\n\ttype result struct {\n\t\tRoleID int `json:\"role_id\"`\n\t}\n\tvar r []*result\n\terr := s.db.SelectContext(ctx, &r, \"SELECT role_id FROM role_user WHERE user_id = ?\", source.ID)\n\tif err != nil {\n\t\treturn nil, db.RollbackError(tx, errors.WithStack(err))\n\t}\n\tvar current []int\n\tfor _, res := range r {\n\t\tcurrent = append(current, res.RoleID)\n\t}\n\treturn current, nil\n}", "title": "" }, { "docid": "715e459fe6329ef74c0aa2cc5f02e5c7", "score": "0.5356592", "text": "func (m *NodeMock) RoleMinimockCounter() uint64 {\n\treturn atomic.LoadUint64(&m.RoleCounter)\n}", "title": "" }, { "docid": "e0a611b7f34cc38711dce32cc08178c8", "score": "0.5345041", "text": "func (o ScriptActionResponseOutput) Roles() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ScriptActionResponse) string { return v.Roles }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "4188b16f425f6fed0a31e4c3aa18d697", "score": "0.5345019", "text": "func (q authQuery) Count(ctx context.Context, exec boil.ContextExecutor) (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRowContext(ctx, exec).Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"schema: failed to count auths rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "9fa02a96c08276b9f905a32d682ea14a", "score": "0.5335104", "text": "func (um *UserManager) Count(channel string) int {\n\n\tch, ok := um.channels[channel]\n\tif !ok {\n\t\treturn 0\n\t}\n\treturn len(ch.users)\n}", "title": "" }, { "docid": "888b0c3a39260214b9487ee29614e611", "score": "0.53053135", "text": "func (o WebAclOverrideActionOutput) Count() pulumi.AnyOutput {\n\treturn o.ApplyT(func(v WebAclOverrideAction) interface{} { return v.Count }).(pulumi.AnyOutput)\n}", "title": "" }, { "docid": "e70a1d0bec6310e99f0fad2d1530e820", "score": "0.53038776", "text": "func (_Authorizers *AuthorizersCallerSession) AuthorizerCount() (*big.Int, error) {\n\treturn _Authorizers.Contract.AuthorizerCount(&_Authorizers.CallOpts)\n}", "title": "" }, { "docid": "9866285a721f5b60854862300f5d0edc", "score": "0.529356", "text": "func (mong *MongoStore) GetAllRoles() []string {\n\n\tdb := mong.Session.DB(mong.Database)\n\tc := db.C(\"roles\")\n\tvar results []string\n\terr := c.Find(nil).Distinct(\"roles\", &results)\n\tif err != nil {\n\t\tlog.Fatal(\"STORE\", \"\\t\", err.Error())\n\t}\n\treturn results\n}", "title": "" }, { "docid": "dcdd58535c5a5b1b6c593764a8c87f9e", "score": "0.529102", "text": "func (o ClusterNodeConfigGuestAcceleratorOutput) Count() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ClusterNodeConfigGuestAccelerator) int { return v.Count }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "d5f7ea13a7e2edbdb56e1fe960ca81af", "score": "0.52830034", "text": "func (m *User) Count() (cnt int) {\n\t//m.Ctx.Db\n\t//m.Db.DB\n\treturn 0\n}", "title": "" }, { "docid": "ba5179c2eddc1da89816c05aed175b69", "score": "0.52795136", "text": "func (u User) Roles() vo.Roles {\n\treturn u.roles\n}", "title": "" }, { "docid": "51109252bfb784e125fc2c4a9e7e0f82", "score": "0.52747583", "text": "func (o ScriptActionOutput) Roles() pulumi.StringOutput {\n\treturn o.ApplyT(func(v ScriptAction) string { return v.Roles }).(pulumi.StringOutput)\n}", "title": "" }, { "docid": "bb6909b7f141cd65b69e7db7ef5c4a31", "score": "0.52715987", "text": "func Roles() ([]Role, error) {\n\tdata, err := Request(\"GET\", \"roles\", nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tvar res rolesResponse\n\tjson.Unmarshal(data, &res)\n\treturn res.Roles, nil\n}", "title": "" }, { "docid": "9ab61382d16a46e19ccf56db33aedc12", "score": "0.5253166", "text": "func (o ClusterNodePoolNodeConfigGuestAcceleratorOutput) Count() pulumi.IntOutput {\n\treturn o.ApplyT(func(v ClusterNodePoolNodeConfigGuestAccelerator) int { return v.Count }).(pulumi.IntOutput)\n}", "title": "" }, { "docid": "77691082a6651988dc38b4917c78f9c8", "score": "0.52431023", "text": "func Roles(w http.ResponseWriter, r *http.Request) {\n\trole := roles.Role{}\n\terr := json.NewDecoder(r.Body).Decode(&role)\n\tif err != nil {\n\t\terrorImpl.WriteHTTPError(w, http.StatusInternalServerError, errorImpl.AdminsError(\"Decode roles error\", err))\n\t\treturn\n\t}\n\trole.DBClient = pgClient\n\tswitch r.Method {\n\tcase \"POST\":\n\t\terr = role.Create()\n\t\tif err != nil {\n\t\t\terrorImpl.WriteHTTPError(w, http.StatusInternalServerError, errorImpl.AdminsError(\"Create error\", err))\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, errWrite := w.Write([]byte(\"{\\\"Message\\\":\\\"Role created \\\"}\"))\n\t\tif errWrite != nil {\n\t\t\tlog.Printf(\"[ERROR] Role created, but Not Writing to ResponseWriter due: %s\", errWrite.Error())\n\t\t}\n\tcase \"PUT\":\n\t\terr = role.Update()\n\t\tif err != nil {\n\t\t\terrorImpl.WriteHTTPError(w, http.StatusInternalServerError, errorImpl.AdminsError(\"Update error\", err))\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, errWrite := w.Write([]byte(\"{\\\"Message\\\":\\\"Role updated \\\"}\"))\n\t\tif errWrite != nil {\n\t\t\tlog.Printf(\"[ERROR] Role updated, but Not Writing to ResponseWriter due: %s\", errWrite.Error())\n\t\t}\n\tcase \"DELETE\":\n\t\terr = role.Delete()\n\t\tif err != nil {\n\t\t\terrorImpl.WriteHTTPError(w, http.StatusInternalServerError, errorImpl.AdminsError(\"Delete error\", err))\n\t\t\treturn\n\t\t}\n\t\tw.WriteHeader(http.StatusOK)\n\t\t_, errWrite := w.Write([]byte(\"{\\\"Message\\\":\\\"Role deleted \\\"}\"))\n\t\tif errWrite != nil {\n\t\t\tlog.Printf(\"[ERROR] Role deleted, but Not Writing to ResponseWriter due: %s\", errWrite.Error())\n\t\t}\n\t}\n}", "title": "" }, { "docid": "59c1cd150bebb8e4e8e057c9377d0b17", "score": "0.5232105", "text": "func (u *Users) Count() int64 {\n\treturn u.userFinder.Count()\n}", "title": "" }, { "docid": "c08f83e54fe5d73af515f47245723a9f", "score": "0.52290106", "text": "func TestGetRoles232_3(t *testing.T) {\n\tconst appStream string = `\n\t{\n\t\t\"services\": [\n\t\t{\n\t\t\t\"name\": \"global\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp1\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role1\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"name\": \"erp\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp2\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role2\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"role:role1\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t}\n\t\t]\n\t}\n\t`\n\texpectedRoles := []string{\"role1\", \"role2\"}\n\n\tevaluate(t, appStream, expectedRoles)\n}", "title": "" }, { "docid": "8b37a17fc91a2640ab46a99558797175", "score": "0.52253056", "text": "func HasRole(ctx context.Context, obj interface{}, next graphql.Resolver, roles []*models.Role) (interface{}, error) {\n\tvar userroleCtx = lib.ContextKey(\"userrole\")\n\tv := ctx.Value(userroleCtx)\n\tuserRole := fmt.Sprintf(\"%v\", v)\n\tfor _, role := range roles {\n\t\tif userRole == string(*role) {\n\t\t\t// or let it pass through\n\t\t\treturn next(ctx)\n\t\t}\n\t\tfmt.Printf(\"Want ROLE : %s , have : %s\\n\", role, userRole)\n\t}\n\treturn nil, fmt.Errorf(\"access denied\")\n}", "title": "" }, { "docid": "055b87cb6574c18f57bcb7c92ceed838", "score": "0.5203969", "text": "func GetRoles() string {\n\treturn viper.GetString(confRoles)\n}", "title": "" }, { "docid": "0eae874614d6a7c9d26d2ded0c7140a8", "score": "0.51875776", "text": "func (_Authorizers *AuthorizersCaller) AuthorizerCount(opts *bind.CallOpts) (*big.Int, error) {\n\tvar out []interface{}\n\terr := _Authorizers.contract.Call(opts, &out, \"authorizerCount\")\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": "32c6558ec926212f20918f3cd2f184e3", "score": "0.51858747", "text": "func (d Departement) Count() int {\n\tc := 0\n\tfor _, org := range d.SubOrganizations {\n\t\tc += org.Count()\n\t}\n\treturn c\n}", "title": "" }, { "docid": "48a286b3fd0766ad3ac46db3a7fa81ad", "score": "0.51825345", "text": "func (ins *Strategy) Roles() []*rbacv1.Role {\n\treturn ins.roles\n}", "title": "" }, { "docid": "afc7caae75ba4e875dcf0df36be121c0", "score": "0.5178619", "text": "func (m *Manager) Count() int {\n\treturn m.provider.Count()\n}", "title": "" }, { "docid": "c3a73ad0744e21451f4da6c44aa273b4", "score": "0.5164473", "text": "func (u *Users) Count() int {\n\treturn len(u.users)\n}", "title": "" }, { "docid": "a0ef8eb59a724a1bb76d5e59559a64fe", "score": "0.5162926", "text": "func (v *infromerVersion) Roles() v1.RoleLister {\n\treturn v.factory.Rbac().V1().Roles().Lister()\n}", "title": "" }, { "docid": "50e6369d4b5dbc2edf9040509f05157a", "score": "0.51388067", "text": "func (um *UserManager) GetUserListForRole(pageNum int, numPerPage int,\n\troles []string, ulr *UserListQueryResponse, curUser *CurrentUserInfo) error {\n\tutil.ApplyQuotes(roles)\n\tkeyVals := \"[\" + strings.Join(roles, \",\") + \"]\"\n\tuserDb := Connection.SelectDB(\"_users\", AdminAuth)\n\ttype IntResult struct {\n\t\tvalue int\n\t\terr error\n\t}\n\ttype UlResult struct {\n\t\tvalue UserListQueryResponse\n\t\terr error\n\t}\n\t//These two CouchDB requests may be run concurrently\n\tc_count := make(chan IntResult)\n\tc_results := make(chan UlResult)\n\tgo func() {\n\t\tcr := CountResponse{}\n\t\tparams := url.Values{}\n\t\tparams.Set(\"keys\", keyVals)\n\t\tparams.Add(\"group\", \"true\")\n\t\tif err := userDb.GetList(\"user_queries\", \"browseUsers\",\n\t\t\t\"usersByRole\", &cr, &params); err == nil {\n\t\t\tif len(cr.Rows) > 0 {\n\t\t\t\tc_count <- IntResult{value: cr.Rows[0].Value, err: nil}\n\t\t\t} else {\n\t\t\t\tc_count <- IntResult{value: 0, err: nil}\n\t\t\t}\n\t\t} else {\n\t\t\tlog.Printf(\"\\nError in User Role Count Query: %v\\n\", err)\n\t\t\tc_count <- IntResult{value: 0, err: err}\n\t\t}\n\t}()\n\tgo func() {\n\t\tparams := url.Values{}\n\t\tparams.Set(\"keys\", keyVals)\n\t\tif numPerPage != 0 {\n\t\t\tparams.Add(\"limit\", strconv.Itoa(numPerPage))\n\t\t}\n\t\tskip := numPerPage * (pageNum - 1)\n\t\tif skip > 0 {\n\t\t\tparams.Add(\"skip\", strconv.Itoa(skip))\n\t\t}\n\t\tqr := UserListQueryResponse{}\n\t\tparams.Add(\"reduce\", \"false\")\n\t\tif err := userDb.GetList(\"user_queries\", \"browseUsers\",\n\t\t\t\"usersByRole\", &qr, &params); err == nil {\n\t\t\tc_results <- UlResult{value: qr, err: nil}\n\t\t} else {\n\t\t\tlog.Printf(\"\\nError in User Role Query: %v\\n\", err)\n\t\t\tc_results <- UlResult{value: UserListQueryResponse{}, err: err}\n\t\t}\n\t}()\n\tresults := <-c_results\n\tcount := <-c_count\n\tif results.err != nil {\n\t\treturn results.err\n\t} else if count.err != nil {\n\t\treturn count.err\n\t} else {\n\t\t*ulr = results.value\n\t\tulr.TotalRows = count.value\n\t}\n\treturn nil\n}", "title": "" }, { "docid": "14ef89a7d43581a28bce073630e69ee5", "score": "0.5134222", "text": "func (o *NiatelemetryNiaFeatureUsageAllOf) GetRealmCount() int64 {\n\tif o == nil || o.RealmCount == nil {\n\t\tvar ret int64\n\t\treturn ret\n\t}\n\treturn *o.RealmCount\n}", "title": "" }, { "docid": "1635ddd33d7a8c1df6fea7d782cdea63", "score": "0.5119105", "text": "func (boltDBProvider *BoltDBProvider) GetRoles() (string, error) {\n\n\tvar dataByte []byte\n\tboltDBProvider.db.View(func(tx *bolt.Tx) error {\n\n\t\tAppMetadataBucket := tx.Bucket([]byte(boltDBProvider.AppMetadata))\n\n\t\tdataByte = AppMetadataBucket.Get([]byte(\"ROLES_JSON\"))\n\n\t\treturn nil\n\t})\n\treturn string(dataByte), nil\n}", "title": "" }, { "docid": "20ff795088def2be521fb65291c3df07", "score": "0.5118056", "text": "func ByRolesUsersCount(opts ...sql.OrderTermOption) OrderOption {\n\treturn func(s *sql.Selector) {\n\t\tsqlgraph.OrderByNeighborsCount(s, newRolesUsersStep(), opts...)\n\t}\n}", "title": "" }, { "docid": "0a7510a8a06dc2a4db02cc49113a9499", "score": "0.51152474", "text": "func GuildRoles(s *discordgo.Session) error {\n\troles, err := s.GuildRoles(flagGuild)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor _, v := range roles {\n\t\tfmt.Printf(\"Role %s, ID: %s, Position: %d, Perms: %d, Hoist: %b, Color: %d, Managed: %b\\n\", v.Name, v.ID, v.Position, v.Permissions, v.Hoist, v.Color, v.Managed)\n\t}\n\n\tfmt.Println(len(roles), \"Guild roles\")\n\treturn nil\n}", "title": "" }, { "docid": "05d8218b2ec46dea7f7fb8f730ff597e", "score": "0.51021636", "text": "func (u UserPetsConnectionResolver) TotalCount(ctx context.Context) int32 {\n\treturn int32(len(u.ids))\n}", "title": "" }, { "docid": "57d4b7275735d23b5e3dd120ea01f2d1", "score": "0.51000726", "text": "func (rs *RankSet) Count() int {\n\tif rs == nil || rs.ns == nil {\n\t\treturn 0\n\t}\n\treturn rs.ns.Count()\n}", "title": "" }, { "docid": "5d8aeddd51319a4ec155773e05df9557", "score": "0.50958425", "text": "func TestGetRoles232_2(t *testing.T) {\n\tconst appStream string = `\n\t{\n\t\t\"services\": [\n\t\t{\n\t\t\t\"name\": \"global\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp1\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role1\",\"role2\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"name\": \"erp\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp2\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role2\",\"role3\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t}\n\t\t]\n\t}\n\t`\n\texpectedRoles := []string{\"role1\", \"role2\", \"role3\"}\n\n\tevaluate(t, appStream, expectedRoles)\n}", "title": "" }, { "docid": "e5a11550d6311210ef02475e773da77d", "score": "0.50948226", "text": "func (arh *AdminRoleHandler) GetRoles(w http.ResponseWriter,\n\tr *http.Request, _ httprouter.Params) {\n\n\troles, errs := arh.roleService.Roles()\n\n\tif len(errs) > 0 {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\toutput, err := json.MarshalIndent(roles, \"\", \"\\t\\t\")\n\n\tif err != nil {\n\t\tw.Header().Set(\"Content-Type\", \"application/json\")\n\t\thttp.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)\n\t\treturn\n\t}\n\n\tw.Header().Set(\"Content-Type\", \"application/json\")\n\tw.Write(output)\n\treturn\n\n}", "title": "" }, { "docid": "6f5535c24f54f08023c60925065c623b", "score": "0.50941265", "text": "func (e *RoleService) List() (data *RoleListResult, err error) {\n\terr = e.client.magicRequestDecoder(\"GET\", \"roles\", nil, &data)\n\treturn\n}", "title": "" }, { "docid": "632f8b3c0ac175db4c11418d4beec696", "score": "0.5092085", "text": "func (c *Client) Roles(ctx context.Context) (chronograf.RolesStore, error) {\n\treturn nil, fmt.Errorf(\"roles not support in open-source InfluxDB. Roles are support in Influx Enterprise\")\n}", "title": "" }, { "docid": "4638fd841842ef561543389e94abdf88", "score": "0.5081952", "text": "func (q userAuthQuery) Count() (int64, error) {\n\tvar count int64\n\n\tqueries.SetSelect(q.Query, nil)\n\tqueries.SetCount(q.Query)\n\n\terr := q.Query.QueryRow().Scan(&count)\n\tif err != nil {\n\t\treturn 0, errors.Wrap(err, \"models: failed to count user_auths rows\")\n\t}\n\n\treturn count, nil\n}", "title": "" }, { "docid": "472d2c8237b67ad1f3233646a560de7b", "score": "0.50812775", "text": "func CheckRoles(ctx context.Context, kubeAPI *k8s.KubernetesAPI, shouldExist bool, namespace string, expectedNames []string, labelSelector string) error {\n\toptions := metav1.ListOptions{\n\t\tLabelSelector: labelSelector,\n\t}\n\tcrList, err := kubeAPI.RbacV1().Roles(namespace).List(ctx, options)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tobjects := []runtime.Object{}\n\n\tfor _, item := range crList.Items {\n\t\titem := item // pin\n\t\tobjects = append(objects, &item)\n\t}\n\n\treturn checkResources(\"Roles\", objects, expectedNames, shouldExist)\n}", "title": "" }, { "docid": "74dc250fe753aecc1faf5c008e8b34db", "score": "0.5066815", "text": "func (lm *Manager) Count() int {\n\tlm.RLock()\n\tdefer lm.RUnlock()\n\n\treturn len(lm.Info)\n}", "title": "" }, { "docid": "1015c56d29156d4e969685c3ffc99f96", "score": "0.5050777", "text": "func (s *CacheSuite) TestRoles(c *check.C) {\n\tp := s.newPackForNode(c)\n\tdefer p.Close()\n\n\trole, err := services.NewRole(\"role1\", services.RoleSpecV3{\n\t\tOptions: services.RoleOptions{\n\t\t\tMaxSessionTTL: services.Duration(time.Hour),\n\t\t},\n\t\tAllow: services.RoleConditions{\n\t\t\tLogins: []string{\"root\", \"bob\"},\n\t\t\tNodeLabels: services.Labels{services.Wildcard: []string{services.Wildcard}},\n\t\t},\n\t\tDeny: services.RoleConditions{},\n\t})\n\tc.Assert(err, check.IsNil)\n\terr = p.accessS.UpsertRole(role)\n\tc.Assert(err, check.IsNil)\n\n\trole, err = p.accessS.GetRole(role.GetName())\n\tc.Assert(err, check.IsNil)\n\n\tselect {\n\tcase event := <-p.eventsC:\n\t\tc.Assert(event.Type, check.Equals, EventProcessed)\n\tcase <-time.After(time.Second):\n\t\tc.Fatalf(\"timeout waiting for event\")\n\t}\n\n\tout, err := p.cache.GetRole(role.GetName())\n\tc.Assert(err, check.IsNil)\n\trole.SetResourceID(out.GetResourceID())\n\tfixtures.DeepCompare(c, role, out)\n\n\t// update role\n\trole.SetLogins(services.Allow, []string{\"admin\"})\n\tc.Assert(err, check.IsNil)\n\terr = p.accessS.UpsertRole(role)\n\tc.Assert(err, check.IsNil)\n\n\trole, err = p.accessS.GetRole(role.GetName())\n\tc.Assert(err, check.IsNil)\n\n\tselect {\n\tcase event := <-p.eventsC:\n\t\tc.Assert(event.Type, check.Equals, EventProcessed)\n\tcase <-time.After(time.Second):\n\t\tc.Fatalf(\"timeout waiting for event\")\n\t}\n\n\tout, err = p.cache.GetRole(role.GetName())\n\tc.Assert(err, check.IsNil)\n\trole.SetResourceID(out.GetResourceID())\n\tfixtures.DeepCompare(c, role, out)\n\n\terr = p.accessS.DeleteRole(role.GetName())\n\tc.Assert(err, check.IsNil)\n\n\tselect {\n\tcase <-p.eventsC:\n\tcase <-time.After(time.Second):\n\t\tc.Fatalf(\"timeout waiting for event\")\n\t}\n\n\t_, err = p.cache.GetRole(role.GetName())\n\tfixtures.ExpectNotFound(c, err)\n}", "title": "" }, { "docid": "46a0178ea9383b24e6fd43bb34a4147d", "score": "0.50350887", "text": "func TestGetRoles232_4(t *testing.T) {\n\tconst appStream string = `\n\t{\n\t\t\"services\": [\n\t\t{\n\t\t\t\"name\": \"global\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp1\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role1\",\"role2\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"id\": \"rp2\",\n\t\t\t\t\"effect\": \"deny\",\n\t\t\t\t\"roles\": [\"role3\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t},\n\t\t{\n\t\t\t\"name\": \"erp\",\n\t\t\t\"type\": \"Applications\",\n\t\t\t\"rolePolicies\": [\n\t\t\t{\n\t\t\t\t\"id\": \"rp3\",\n\t\t\t\t\"effect\": \"grant\",\n\t\t\t\t\"roles\": [\"role2\",\"role3\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"id\": \"rp4\",\n\t\t\t\t\"effect\": \"deny\",\n\t\t\t\t\"roles\": [\"role1\"],\n\t\t\t\t\"principals\": [\n\t\t\t\t\t\"user:bill\"\n\t\t\t\t]\n\t\t\t}\n\t\t\t]\n\t\t}\n\t\t]\n\t}\n\t`\n\texpectedRoles := []string{\"role2\"}\n\n\tevaluate(t, appStream, expectedRoles)\n}", "title": "" }, { "docid": "41b09b5754664a4920add910a51c9132", "score": "0.5029041", "text": "func Count(i interface{}) (int, error) {\r\n\ts, err := GetSession()\r\n\tif err != nil {\r\n\t\treturn 0, err\r\n\t}\r\n\tdefer s.Close()\r\n\r\n\tcoll := GetColl(s, typeName(i))\r\n\r\n\treturn coll.Count()\r\n}", "title": "" }, { "docid": "1307f571dea143a794316df9a44cbee0", "score": "0.50230324", "text": "func (ulq *UserLoginQuery) Count(ctx context.Context) (int, error) {\n\tctx = setContextOp(ctx, ulq.ctx, \"Count\")\n\tif err := ulq.prepareQuery(ctx); err != nil {\n\t\treturn 0, err\n\t}\n\treturn withInterceptors[int](ctx, ulq, querierCount[*UserLoginQuery](), ulq.inters)\n}", "title": "" }, { "docid": "7ae5ab57f13c3c04c28b67f4a002559b", "score": "0.5017677", "text": "func (m *JetCoordinatorMock) QueryRoleMinimockCounter() uint64 {\n\treturn atomic.LoadUint64(&m.QueryRoleCounter)\n}", "title": "" }, { "docid": "f2aca71f31b066c262b3f5041ab36c52", "score": "0.50161594", "text": "func (p Payload) Roles() []string {\n\troles := make([]map[string]interface{}, 0, 256)\n\tfor _, org := range toListOfMap(p[\"organizations\"]) {\n\t\txs := toListOfMap(org[\"roles\"])\n\t\troles = append(roles, xs...)\n\t}\n\tys := toListOfMap(p[\"roles\"])\n\troles = append(roles, ys...)\n\n\tnames := collectStrings(\"name\", roles)\n\tnameSet := make([]string, 0, len(names))\n\tfor _, n := range dedupeStrings(names) {\n\t\tif n != \"\" {\n\t\t\tnameSet = append(nameSet, n)\n\t\t}\n\t}\n\treturn nameSet\n}", "title": "" }, { "docid": "edd5f6ee925761d64002d0df81cddba3", "score": "0.50138974", "text": "func (web *Web) Roles() *Roles {\n\treturn NewRoles(web.client, web.endpoint, web.config)\n}", "title": "" }, { "docid": "480129867007a137f3a21ddecf2bfdf4", "score": "0.500158", "text": "func (c *Championship) NumEntrants() int {\n\tentrants := 0\n\n\tfor _, class := range c.Classes {\n\t\tentrants += len(class.Entrants)\n\t}\n\n\treturn entrants\n}", "title": "" }, { "docid": "29615eb60beb7225a7f4e0a1427b256d", "score": "0.4999964", "text": "func (ccr *ChefClientRun) RoleNames() []string {\n\trolesJson := extractArrayOrEmpty(ccr.NodePayload.Automatic, \"roles\")\n\treturn interfaceArrayToStringArray(rolesJson)\n}", "title": "" }, { "docid": "cabf3bfaea998b6d8d75278eb7a619fe", "score": "0.49981576", "text": "func (r repository) Count(ctx context.Context) (int, error) {\n\tvar count int\n\n\terr := r.db.Count(ctx, \"user\", &count)\n\treturn count, err\n}", "title": "" }, { "docid": "89d3ea206d84c362a600be5c8383f288", "score": "0.4991345", "text": "func (o *InlineResponse20074) HasRoles() bool {\n\tif o != nil && o.Roles != nil {\n\t\treturn true\n\t}\n\n\treturn false\n}", "title": "" }, { "docid": "0f82837219e3f9601c55b0be613d6b16", "score": "0.49731132", "text": "func GetRoles(id uint) []string {\n\tvar nameResults []NameResult\n\tdb.GetDB().Raw(\"select name from roles where id in ( SELECT role_id as id FROM role_users WHERE user_id = ? )\", 1).Scan(&nameResults)\n\tlog.Println(\"roles-->\", nameResults)\n\n\tvar result []string\n\tfor _, v := range nameResults {\n\t\tresult = append(result, v.Name)\n\t}\n\treturn result\n}", "title": "" }, { "docid": "3cff5b6251d0f0801e047c344a9cc845", "score": "0.49730358", "text": "func (m *PlannerRosterMember) GetRoles()([]string) {\n val, err := m.GetBackingStore().Get(\"roles\")\n if err != nil {\n panic(err)\n }\n if val != nil {\n return val.([]string)\n }\n return nil\n}", "title": "" }, { "docid": "d3499605642825cd8cf78dd3a566e703", "score": "0.49711534", "text": "func (m MockPeer) Roles() []ttnpb.PeerInfo_Role {\n\tif m.RolesFunc == nil {\n\t\treturn nil\n\t}\n\treturn m.RolesFunc()\n}", "title": "" }, { "docid": "4298021cbcf500f591b8549fa54538dc", "score": "0.49666542", "text": "func (c *Client) Roles(guildID discord.GuildID) ([]discord.Role, error) {\n\tvar roles []discord.Role\n\treturn roles, c.RequestJSON(&roles, \"GET\", EndpointGuilds+guildID.String()+\"/roles\")\n}", "title": "" }, { "docid": "9ce41a5310bbb2b03e737ca8185e5eba", "score": "0.49626637", "text": "func (c *RolesController) List(ctx *app.ListRolesContext) error {\n\tif ctx.ResourceType == nil { // todo: check for empty string too?\n\t\treturn jsonapi.JSONErrorResponse(ctx, errors.NewBadParameterError(\"resource_type\", \"nil\"))\n\t}\n\n\tvar roleScopes []role.RoleDescriptor\n\n\t_, err := c.app.ResourceTypeRepository().Lookup(ctx, *ctx.ResourceType)\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource_type\": *ctx.ResourceType,\n\t\t\t\"err\": err,\n\t\t}, \"error getting roles for the resource type\")\n\t\t// if not found, then NotFoundError would be returned,\n\t\t// hence returning the error as is.\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\n\troleScopes, err = c.app.RoleManagementService().ListAvailableRolesByResourceType(ctx, *ctx.ResourceType)\n\n\tif err != nil {\n\t\tlog.Error(ctx, map[string]interface{}{\n\t\t\t\"resource_type\": *ctx.ResourceType,\n\t\t\t\"err\": err,\n\t\t}, \"error getting available roles for the resource\")\n\t\treturn jsonapi.JSONErrorResponse(ctx, err)\n\t}\n\trespRoles := convertRoleScopeToAppRoles(roleScopes)\n\tres := &app.Roles{\n\t\tData: respRoles,\n\t}\n\treturn ctx.OK(res)\n}", "title": "" }, { "docid": "5072d6aa440145bb108362ca99da14bd", "score": "0.49620155", "text": "func InsertRoles(engine *core.Engine) {\n\troleRepo := repo.ProvideRoleRepo(engine)\n\troleService := service.ProvideRoleService(roleRepo)\n\troles := []model.Role{\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000001,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"Super-Admin\",\n\t\t\tResources: strings.Join([]string{\n\t\t\t\tr.SupperAccess,\n\t\t\t\tr.CompanyRead, r.CompanyWrite, r.CompanyExcel,\n\t\t\t\tr.NodeRead, r.NodeWrite, r.NodeExcel,\n\t\t\t\tr.VersionRead, r.VersionWrite, r.VersionExcel,\n\t\t\t\tr.LicenseWrite,\n\t\t\t\tr.SettingRead, r.SettingWrite, r.SettingExcel,\n\t\t\t\tr.UserNames, r.UserWrite, r.UserRead, r.UserReport,\n\t\t\t\tr.ActivitySelf, r.ActivityAll,\n\t\t\t\tr.AccountNames, r.AccountRead, r.AccountWrite, r.AccountExcel,\n\t\t\t\tr.RoleRead, r.RoleWrite, r.RoleExcel,\n\t\t\t}, \", \"),\n\t\t\tDescription: \"super-admin has all privileges - do not edit\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000002,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"Admin\",\n\t\t\tResources: strings.Join([]string{\n\t\t\t\tr.CompanyRead, r.CompanyWrite, r.CompanyExcel,\n\t\t\t\tr.UserNames, r.UserWrite, r.UserRead, r.UserReport,\n\t\t\t\tr.NodeRead, r.NodeWrite, r.NodeExcel,\n\t\t\t\tr.ActivitySelf, r.ActivityAll,\n\t\t\t\tr.AccountNames, r.AccountRead, r.AccountWrite, r.AccountExcel,\n\t\t\t\tr.RoleRead, r.RoleWrite,\n\t\t\t}, \", \"),\n\t\t\tDescription: \"admin has all privileges - do not edit\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000003,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"Cashier\",\n\t\t\tResources: strings.Join([]string{r.ActivitySelf}, \", \"),\n\t\t\tDescription: \"cashier has all privileges - after migration reset\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000004,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for foreign 1\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"for foreign 1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000005,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for update 1\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"for update 1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000006,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for update 2\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"for update 2\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000007,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for delete 1\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"for delete 1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000008,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for search 1\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"searchTerm1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000009,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for search 2\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"searchTerm1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1001101000000010,\n\t\t\t},\n\t\t\tCompanyID: 1001,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for search 3\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"searchTerm1\",\n\t\t},\n\t\t{\n\t\t\tFixedCol: types.FixedCol{\n\t\t\t\tID: 1002101000000001,\n\t\t\t},\n\t\t\tCompanyID: 1002,\n\t\t\tNodeCode: 101,\n\t\t\tName: \"for delete 2\",\n\t\t\tResources: r.SupperAccess,\n\t\t\tDescription: \"for delete 2\",\n\t\t},\n\t}\n\n\tfor _, v := range roles {\n\t\tif _, err := roleService.Save(v); err != nil {\n\t\t\tengine.ServerLog.Fatal(err)\n\t\t}\n\n\t}\n\n}", "title": "" }, { "docid": "f944e674f4c46434cd9f9a5683da74f0", "score": "0.49583358", "text": "func (s *Server) Count() int {\n\treturn s.cm.count()\n}", "title": "" }, { "docid": "323a06fcdca1c7453968127f199947b1", "score": "0.4954381", "text": "func CountLoginSources() int64 {\n\tcount, _ := x.Count(new(LoginSource))\n\treturn count\n}", "title": "" }, { "docid": "f9f31ceda72b7c3316390a4c007110c7", "score": "0.49481532", "text": "func (s *SQLCounterStore) Collections() int64 {\n\treturn s.queryCount(\"SELECT COUNT(collection_id) FROM collection\")\n}", "title": "" }, { "docid": "eee04112cd7fb1f1e132341b0e298e44", "score": "0.49430102", "text": "func (s *Store) Count(c appengine.Context) int64 {\n\tstats, _ := aemc.Stats(c)\n\treturn int64(stats.Items)\n}", "title": "" }, { "docid": "1cee421fb5d4409be9ced629dfdc8aeb", "score": "0.49421442", "text": "func (e UserEdges) RolesOrErr() ([]*Role, error) {\n\tif e.loadedTypes[2] {\n\t\treturn e.Roles, nil\n\t}\n\treturn nil, &NotLoadedError{edge: \"roles\"}\n}", "title": "" }, { "docid": "e465d9af21ed335dab53505ba7b42209", "score": "0.4936519", "text": "func (svc authzService) ListRoles(ctx context.Context, token string) ([]Role, error) {\n\treturn []Role{}, nil\n}", "title": "" }, { "docid": "d7cc397144d4dd5f0e9d7a0cc257cc09", "score": "0.49343207", "text": "func (r *AdminListResolver) Total(ctx context.Context) int32 {\n\tdb := ctx.Value(b.CtxKey(\"dbr\")).(*dbr.Session)\n\tbuilder := db.Select(\"COUNT(*) as count\").\n\t\tFrom(\"admin\").\n\t\tWhere(\"dtime IS NULL\")\n\n\tif r.search != \"\" {\n\t\tbuilder.Where(dbr.Or(\n\t\t\tdbr.Expr(\"name LIKE ?\", \"%\"+r.search+\"%\"),\n\t\t))\n\t}\n\n\terr := builder.LoadOneContext(ctx, r)\n\tif err != nil {\n\t\tb.Log.Panic(err)\n\t}\n\n\treturn r.Count\n}", "title": "" }, { "docid": "2434faf08c72f63f2520010545c73743", "score": "0.49170506", "text": "func (u *User) CountAgent(userID uint) uint {\n var num uint\n mysql.DBInstance().Where(\"agent_id=? AND status=1 AND is_deleted=0\",userID).Table(u.TableName()).Count(&num)\n return num\n}", "title": "" }, { "docid": "164cf15879de50a2b82cf4b95051ee23", "score": "0.49166706", "text": "func (l Vertical) Count() (int, int) {\n\tw1, h1 := l.Left.Count()\n\tw2, h2 := l.Right.Count()\n\treturn w1 + w2, mathutil.MaxInt(h1, h2)\n}", "title": "" }, { "docid": "695a0749e8a0604c0ee727aa0d25d04d", "score": "0.49161327", "text": "func (rr Regions) Len() int {\n\ttotal := 0\n\tfor _, r := range rr {\n\t\ttotal += r.Len()\n\t}\n\treturn total\n}", "title": "" }, { "docid": "e8f0e9f7f1cb248035c1b34fd1d5aa0f", "score": "0.49079865", "text": "func (acls ACLS) CountActions(action string) (count int) {\n\tfor _, acl := range acls {\n\t\tif acl.Action == action {\n\t\t\tcount++\n\t\t}\n\t}\n\n\treturn\n}", "title": "" }, { "docid": "976aa211e4fdeb29a0407d88c117f5f4", "score": "0.49045882", "text": "func (usrs Users) Len() int {\n\treturn len(usrs)\n}", "title": "" }, { "docid": "0a5f0d410cfb499ffb42d07a0d1cf1fc", "score": "0.4897985", "text": "func (k RoleType) Int() int {\n\tswitch k {\n\tcase RoleTypeAdministrator:\n\t\treturn 1\n\tcase RoleTypeGeneralUser:\n\t\treturn 2\n\tcase RoleTypeReporter:\n\t\treturn 3\n\tcase RoleTypeViewer:\n\t\treturn 4\n\tcase RoleTypeGuestReporter:\n\t\treturn 5\n\tcase RoleTypeGuestViewer:\n\t\treturn 6\n\tdefault:\n\t\treturn 0\n\t}\n}", "title": "" } ]